我们正在使用 ckeditor gem 3.7.0直到最近。并决定升级到最新版本的gem以支持IE 10。
一切都很好,但它有两个插件(附件和嵌入),我们的大多数客户都在使用它们。我观察到它们在将 ckeditor 插件升级到 3.6.4 时被删除( commit )
即使在以前的版本(即使用3.6.3 ckeditor插件),代码也来自官方 repository不包含这些插件。
有人知道如何获取 ckeditor 4.x 的这些插件吗?
请您参考如下方法:
升级到 CKEditor 4.x 后,我遇到了同样的问题,也找不到附件源。我最终重写了附件插件以使其正常工作。我没有使用嵌入插件,因此没有重写它,但希望这对附件有所帮助。
将此用于附件/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);
}
};
});