如何关闭 CKEditor 4.6 的插件?
How to turn off plugin for CKEditor 4.6?
对于 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 时,您可以 add/remove 在您的网页中插入插件:
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 中,您可以检查列出组和项目的基本和高级配置器类型,并将它们复制到您的配置文件中。
设置 CKEditor 配置的方法有很多,您可以在 Setting CKEditor Configuration documentation. Your main issue here is that you are changing the content of the default CKEditor configuration file (config.js
) and your changes will be overwritten with each upgrade. To avoid this, use a custom configuration file or define the configuration in-page.
中阅读更多相关信息
对于 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 时,您可以 add/remove 在您的网页中插入插件:
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 中,您可以检查列出组和项目的基本和高级配置器类型,并将它们复制到您的配置文件中。
设置 CKEditor 配置的方法有很多,您可以在 Setting CKEditor Configuration documentation. Your main issue here is that you are changing the content of the default CKEditor configuration file (config.js
) and your changes will be overwritten with each upgrade. To avoid this, use a custom configuration file or define the configuration in-page.