2014-02-20 2 views
2

최근까지 ckeditor gem 3.7.0을 사용하고있었습니다. 그리고 IE 10을 지원하기 위해 최신 버전의 gem으로 업그레이드하기로 결정하십시오.ckeditor를 사용하여 파일 첨부 (첨부 파일 및 포함 플러그인 없음)

모두 정상적으로 작동하지만 모든 고객이 사용하는 두 개의 플러그인 (첨부 파일 및 포함)이 있습니다. 나는 3.6.4 (commit)에 ckeditor 플러그인

심지어 (3.6.3 ckeditor 플러그인을 사용하는 즉,) 이전 버전에서, 공식 repository에서 코드가 이러한 플러그인을 포함하지 않습니다를 업그레이드하는 동안 그들이 제거 된 것을 관찰했다.

누구든지 ckeditor 4.x 용 플러그인을 얻는 방법을 알고 있습니까?

답변

2

CKEditor 4.x로 업그레이드하고 첨부 소스를 찾을 수없는 경우에도 동일한 문제가있었습니다. 필자는 첨부 파일 플러그인을 다시 작성하여 작동되게했습니다. embed plugin을 사용하지 않았으므로 다시 작성하지는 않았지만 잘하면 첨부 파일에 도움이됩니다. 첨부 파일/plugin.js에 대한

사용이 :

CKEDITOR.plugins.add('attachment', { 
icons: 'attachment', 
init: function(editor) { 
    editor.addCommand('attachmentDialog', new CKEDITOR.dialogCommand('attachmentDialog')); 
    editor.ui.addButton('attachment', { 
     label: 'Document', 
     command: 'attachmentDialog', 
     toolbar: 'insert' 
    }); 

    CKEDITOR.dialog.add('attachmentDialog', this.path + 'dialogs/attachment.js'); 
} 

}

를 사용하여 첨부 파일/대화 상자/attachment.js이 :

CKEDITOR.dialog.add('attachmentDialog', function(editor) { 
return { 
    title: 'Upload Document', 
    minWidth: 400, 
    minHeight: 200, 
    contents: [ 
     { 
      id: 'general', 
      label: 'Document Info', 
      elements: [ 
       { 
        type: 'text', 
        id: 'txtUrl', 
        label: 'URL', 
        validate: CKEDITOR.dialog.validate.notEmpty("URL cannot be empty") 
       }, 
       { 
        type: 'button', 
        hidden: true, 
        id: 'browse', 
        filebrowser: 'general:txtUrl', 
        label: "Use Existing Document", 
        style: 'float:right', 
       }, 
      ] 
     }, 
     { 
      id: 'Upload', 
      hidden: true, 
      filebrowser: 'uploadButton', 
      label: editor.lang.image.upload, 
      elements: [ 
       { 
        type: 'file', 
        id: 'upload', 
        label: editor.lang.image.btnUpload, 
        style: 'height:40px', 
        size: 38 
       }, 
       { 
        type: 'fileButton', 
        id: 'uploadButton', 
        filebrowser: 'general:txtUrl', 
        label: "Upload the Document", 
        'for': [ 'Upload', 'upload' ] 
       } 
      ] 
     }, 
    ], 
    onOk: function() { 
     var dialog = this; 

     //Get the value selected in the editor. 
     var selectedText = editor.getSelection().getSelectedText(); 

     var attachment = editor.document.createElement('a'); 

     attachment.setAttribute('href', dialog.getValueOf('general', 'txtUrl')); 

     //If there isn't anything selected in the editor, default the text to the document url. 
     if (selectedText == "") { 
      attachment.setText(dialog.getValueOf('general', 'txtUrl')); 
     } else { 
      attachment.setText(selectedText); 
     } 

     editor.insertElement(attachment); 
    } 
}; 

});

+2

스 니펫을 공유해 주셔서 감사합니다. 우리는 고객이 링크 팝업에서 업로드 옵션을 사용할 것을 권장했습니다. 삽입은 현재 iframe 플러그인을 사용하고 있습니다. – mintuhouse