对于 CKEditor 4.4,在 config.js 中,将有一个部分用于选择要使用的插件以及它们应如何分组。
类似这样的事情:
config.toolbar = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor', 'magicformcustom' ] },
{ name: 'insert', items: [ 'Table', 'HorizontalRule', 'SpecialChar'] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
];
// Toolbar groups configuration.
config.toolbarGroups = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'styles' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'colors' }
];
但是,当我在 CKEditor 4.6 的 config.js 中搜索这些内容时,它们消失了。由于我需要在网站的不同部分使用不同的插件,因此我不想使用在线自定义构建器。我应该在哪里添加/删除插件?
最佳答案
当您实例化 CKEditor 时,您可以在网页中添加/删除插件,如下所示:
CKEDITOR.replace('editor1', {
extraPlugins: 'iframedialog,uploadimage,divarea,youtube',
removePlugins: 'pastetext,pastefromword'
});
您可以在网页内选择工具栏中显示的项目,如下所示:
CKEDITOR.replace('editor1', {
toolbar: [
{ name: 'document', items: [ 'Source', 'Save' ] },
{ name: 'clipboard', items: [ 'Undo', 'Redo' ] },
{ name: 'editing', items: [ 'SelectAll' ] },
{ name: 'basicstyles', items: [ 'Bold', 'Italic', '-', 'RemoveFormat' ] },
{ name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight' ] },
{ name: 'insert', items: [ 'Image', 'Table', 'Smiley' ] },
{ name: 'styles', items: [ 'Font', 'FontSize' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'tools', items: [ 'Maximize' ] }
]
});
您可以在此处查看插件的名称:https://github.com/ckeditor/ckeditor-dev/tree/master/plugins
此外,在Toolbar Configurator中,您可以检查基本和高级配置器类型,其中列出了组和项目并将它们复制到您的配置文件中。
关于javascript - 如何关闭 CKEditor 4.6 的插件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40903577/