直到最近我们才使用ckeditor gem 3.7.0。并决定升级到最新版本的gem以支持IE 10。
一切都很好,但它有两个插件(附件和嵌入),我们的大多数客户都在使用。我发现在将ckeditor插件升级到3.6.4(commit)
时删除了它们即使在以前的版本中(即使用3.6.3 ckeditor插件),官方repository的代码也不包含这些插件。
有谁知道如何获取ckeditor 4.x的插件?
答案 0 :(得分:2)
一旦我升级到CKEditor 4.x并且找不到附件源,我也遇到了同样的问题。我最终重写了附件插件以使其正常工作。我没有使用嵌入式插件,因此没有重写,但希望这有助于附件。
将此用于attachment / 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);
}
};
});