如何使用CKEditor将新按钮添加到组中

时间:2013-09-11 07:20:06

标签: javascript ckeditor

我使用以下配置:

config.toolbarGroups = [
        { name: 'document', groups: ['mode', 'document', 'doctools', 'maximize'] },
        { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
        { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
        { name: 'forms' },
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
        { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'justify' ] },
        // { name: 'links' },
        { name: 'insert' },
        { name: 'styles' },
        { name: 'colors' },
        { name: 'tools' },
        { name: 'others' }
        // ,
        //{ name: 'about' }
    ];

    // The default plugins included in the basic setup define some buttons that
    // we don't want too have in a basic editor. We remove them here.
    // config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript';
    config.removeButtons = 'Strike,Subscript,Superscript';

    // Let's have it basic on dialogs as well.
    config.removeDialogTabs = 'link:advanced';

    config.extraPlugins = 'insertpre,format,justify,maximize';

一切正常,但最大化按钮始终位于工具栏的第二行。有没有办法可以让它最大化组合旁边的其他按钮,如insertpre按钮?

1 个答案:

答案 0 :(得分:0)

您必须配置工具栏item by item以控制每个按钮的确切位置。默认情况下,Maximize属于tools组,因此您也可以将整个组放在工具栏的顶部,如下所示:

config.toolbarGroups = [
        { name: 'document', groups: [ 'tools', 'mode', 'document', 'doctools', 'maximize'] },
        ...
];