尝试在配置中加载多个插件,但只加载了最后一个
Try to loading multiples pugins in config but only the last one is loaded
在 CKeditor4 上,我创建了不同的插件并将它们加载到配置中,但只加载了最后一个。在以下情况下,仅加载 plugin3。当我单独加载每个插件时,每个插件都有效:
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here.
config.language = 'en';
config.toolbarGroups = [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
{ name: 'forms', groups: [ 'forms' ] },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] },
{ name: 'links', groups: [ 'links' ] },
{ name: 'insert', groups: [ 'insert' ] },
'/',
{ name: 'styles', groups: [ 'styles' ] },
{ name: 'colors', groups: [ 'colors' ] },
{ name: 'tools', groups: [ 'tools' ] },
{ name: 'others', groups: [ 'others' ] },
{ name: 'about', groups: [ 'about' ] }
];
config.removeButtons = 'Save,Preview,Print,Templates,Form,HiddenField,Flash,Iframe';
config.extraPlugins = 'plugin1';
config.extraPlugins = 'plugin2';
config.extraPlugins = 'plugin3';
};
三个插件的代码类似:
CKEDITOR.plugins.add( 'plugin1', {
icons: 'plugin1',
init: function( editor ) {
editor.addCommand( 'insertPlugin1', {
exec: function( editor ) {
editor.insertHtml( '[bbcode1][/bbcode1]' );
}
});
editor.ui.addButton( 'Plugin1', {
label: 'Insert things',
command: 'insertPlugin1',
toolbar: 'insert'
});
}
});
为什么会这样?如何加载所有额外的插件?
请先阅读文档:https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-extraPlugins
config.extraPlugins = 'plugin1,plugin2,plugin3';
在 CKeditor4 上,我创建了不同的插件并将它们加载到配置中,但只加载了最后一个。在以下情况下,仅加载 plugin3。当我单独加载每个插件时,每个插件都有效:
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here.
config.language = 'en';
config.toolbarGroups = [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
{ name: 'forms', groups: [ 'forms' ] },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] },
{ name: 'links', groups: [ 'links' ] },
{ name: 'insert', groups: [ 'insert' ] },
'/',
{ name: 'styles', groups: [ 'styles' ] },
{ name: 'colors', groups: [ 'colors' ] },
{ name: 'tools', groups: [ 'tools' ] },
{ name: 'others', groups: [ 'others' ] },
{ name: 'about', groups: [ 'about' ] }
];
config.removeButtons = 'Save,Preview,Print,Templates,Form,HiddenField,Flash,Iframe';
config.extraPlugins = 'plugin1';
config.extraPlugins = 'plugin2';
config.extraPlugins = 'plugin3';
};
三个插件的代码类似:
CKEDITOR.plugins.add( 'plugin1', {
icons: 'plugin1',
init: function( editor ) {
editor.addCommand( 'insertPlugin1', {
exec: function( editor ) {
editor.insertHtml( '[bbcode1][/bbcode1]' );
}
});
editor.ui.addButton( 'Plugin1', {
label: 'Insert things',
command: 'insertPlugin1',
toolbar: 'insert'
});
}
});
为什么会这样?如何加载所有额外的插件?
请先阅读文档:https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-extraPlugins
config.extraPlugins = 'plugin1,plugin2,plugin3';