바 이 두 오픈 소스 부 텍스트 편집기 UEditor 설정:그림 업로드 와 파일 업로드 독립 사용 방법
4496 단어 ueditor
첫 번 째:UEditor 설정
< script src = "ueditor/ueditor.config.js" ></ script > < script src = "ueditor/ueditor.all.min.js" ></ script > < script type = "text/javascript" > var editor = UE.getEditor('myEditor', { initialFrameWidth: 800, initialFrameHeight: 300, }); </ script >두 번 째 단계:편집기 설치< script type = "text/plain" id = "myEditor" ></ script >세 번 째 단계:위 에서 UEditor 를 배 치 했 습 니 다.그림 과 파일 을 따로 사용 하여 업로드 합 니 다.<script type= "text/javascript" > // , editor var _editor = UE.getEditor( 'upload_ue' ); _editor.ready( function () { // _editor.setDisabled(); // , , _editor.hide(); // _editor.addListener( 'beforeInsertImage' , function (t, arg) { // input $( "#picture" ).attr( "value" , arg[0].src); // $( "#preview" ).attr( "src" , arg[0].src); }) // _editor.addListener( 'afterUpfile' , function (t, arg) { $( "#file" ).attr( "value" , _editor.options.filePath + arg[0].url); }) }); // function upImage() { var myImage = _editor.getDialog( "insertimage" ); myImage.open(); } // function upFiles() { var myFiles = _editor.getDialog( "attachment" ); myFiles.open(); } </script>네 번 째 단계:마지막 단 계 는 파일 업로드 에 매우 중요 합 니 다.ueditor 폴 더 에서 파일 dialogs\attachment\attachment.html 에서 코드 editor.execCommand("insertHTML",str)를 찾 습 니 다.위 에 아래 코드 추가editor.fireEvent('afterUpfile', filesList);그리고에서 아무 위치 나 찾 아서 이 편집 기 를 놓 으 세 요.< script type = "text/plain" id = "upload_ue" ></ script >설명:두 번 의 초기 화 편집 코드 를 합 쳐 파일 의 마지막앞 에 놓 을 수 있 습 니 다.그림 업로드 설정 은 말 하지 않 겠 습 니 다.첨부 파일 의 예 는 이미 설정 되 어 있 습 니 다.다운로드 해서 참고 하 시 면 됩 니 다.전재 출처 를 명시 해 주 십시오.원본 다운로드:다운로드 클릭