2013-12-22 91 views
3

在CKEditor中添加额外插件后:config.extraPlugins = 'syntaxhighlight';我无法将它放在我想要的位置的导航栏上。不能将extraPlugin放在CKEDITOR工具栏中的正确位置

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版本

回答

0

你需要找到按钮内plugin.js定义文件,所以你的情况,这将是地方: 的CKEditor /插件/ syntaxhighlight /插件的.js

订购按钮定义被传递到editor.ui.addX方法,即

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

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

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

toolbar : 'insert,5' 
+2

或者,如果你想避免代码的修改,你可以重新定义整个工具栏,使用'toolbar'设置代替'toolbarGroups'。请参阅[工具栏配置指南](http://docs.ckeditor.com/#!/guide/dev_toolbar)。 – Reinmar

+0

谢谢Marek,我会马上试试! –

+0

可悲的马雷克的建议没有奏效:(我尝试了不同的方式,都失败了,而且我想我需要用Reinmar的建议作为我的解决方案,所以如果你在一个小时内发布答案,我会标记你的答案是正确的如果不是马立克的话 –