4
我有一个关于将一些CkEditor工具栏选项分组到下拉菜单的问题。例如,如果我将这个选项['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']添加到工具栏,我会得到4个按钮。由于我认为这是一个浪费的工具栏空间,我想把所有4个选项放在下拉列表中 - 只有1个(选中)可见。CkEditor工具栏组选项下拉菜单
这可能吗?我发现http://jsfiddle.net/oleq/vmYCF/这个解决方案
CKEDITOR.replace('editor', {
plugins: 'wysiwygarea,sourcearea,basicstyles,toolbar,menu,menubutton,justify',
on: {
pluginsLoaded: function() {
var editor = this,
items = {};
editor.addMenuGroup('some_group');
items.justifyleft = {
label: editor.lang.justify.left,
group: 'some_group',
command: 'justifyleft',
order: 1
};
items.justifyright = {
label: editor.lang.justify.right,
group: 'some_group',
command: 'justifyright',
order: 2
};
editor.addMenuItems(items);
editor.ui.add('Groupped', CKEDITOR.UI_MENUBUTTON, {
label: 'Groupped justify',
// Disable in source mode.
modes: {
wysiwyg: 1
},
icon: 'JustifyLeft',
onMenu: function() {
var active = {};
// Make all items active.
for (var p in items)
active[ p ] = CKEDITOR.TRISTATE_OFF;
return active;
}
});
}
}
});
,但你可以看到,现在我有两种选择 - 4个按键+降了下来,所以这不是对我来说是可接受的。而且在这种情况下,我不能设置其他工具栏(我不知道为什么)。
感谢所有帮助
问候
你曾经能够算出这个? – avoliva 2015-09-16 21:16:45