不能将extraPlugin放在CKEDITOR工具栏的正确位置

时间:2013-12-22 12:41:33

标签: javascript ckeditor

在CKEditor中添加额外的插件后:config.extraPlugins = 'syntaxhighlight';我无法将它放在我想要的地方的导航栏上。

    config.toolbarGroups = [
    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
    { name: 'styles' },
    { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks' ] },
    { name: 'insert' },
    { name: 'links' },
    { name: 'spellchecker' },
];

config.extraPlugins = 'syntaxhighlight';

当我加载CKEditor时,我的语法插件被放置在insert组中,我不知道如何将它从那里取出或如何将它放在其他任何地方。

我使用的是版本4.3

1 个答案:

答案 0 :(得分:0)

您需要找到 plugin.js 文件中定义按钮的位置,因此在您的情况下将是: 的的CKEditor /插件/ syntaxhighlight / plugin.js

通常将按钮定义传递给 editor.ui.addX 方法,即

editor.ui.addButton( 'MyButton',
{
    label : 'My button label',
    toolbar : 'insert,100'
} );

您需要调整toolbar属性: - 字符串部分insert告诉哪个组将收到按钮。 - 数字100代表其位置。数字越小,按钮的优先级越高。

您可以将属性更新为以下值:

toolbar : 'insert,5'