CKEDITOR ruby​​-on-rails一个config.js中的多个工具栏

时间:2018-08-15 12:09:27

标签: javascript ruby-on-rails ruby ckeditor

我有以下config.js(/ app / assets / javascripts / ckeditor)

CKEDITOR.editorConfig = function (config) {
    config.toolbar_maxi = [
        {name: 'document', groups: ['mode', 'document', 'doctools']},
        {name: 'clipboard', groups: ['clipboard', 'undo']},
        {name: 'basicstyles', groups: ['basicstyles', 'cleanup']},
        {name: 'colors', groups: ['colors']},
        {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi', 'paragraph']},
        {name: 'links', groups: ['links']},
        {name: 'others', groups: ['others']},
        {name: 'insert', groups: ['insert']},
        {name: 'styles', groups: ['styles']},
        {name: 'editing', groups: ['find', 'selection', 'spellchecker', 'editing']},
        {name: 'forms', groups: ['forms']},
        {name: 'tools', groups: ['tools']},
        {name: 'about', groups: ['about']},


    ];
    config.extraPlugins = 'youtube';
    config.removeButtons = 'Copy,Paste,Cut,NewPage,Print,Templates,PasteText,PasteFromWord,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,CopyFormatting,RemoveFormat,CreateDiv,BidiLtr,BidiRtl,Language,Flash,PageBreak,Iframe';
    config.fontSize_sizes = '8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;';
    config.uiColor = '#f8f8ff';
    config.format_tags = 'p;h3;h4;h5;h6;pre;address;div'
};

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

    config.removeButtons = 'Source,Templates,Save,Cut,NewPage,Copy,Paste,Preview,Print,PasteText,PasteFromWord,Find,Replace,SelectAll,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Subscript,Superscript,CopyFormatting,RemoveFormat,Outdent,Indent,CreateDiv,JustifyLeft,JustifyCenter,JustifyRight,JustifyBlock,Language,BidiRtl,BidiLtr,Image,Flash,SpecialChar,PageBreak,Iframe,HorizontalRule,Anchor,Styles,Format,Font,FontSize,Maximize,ShowBlocks,About,Undo,Redo';
    config.uiColor = '#f8f8ff';
    config.format_tags = 'p;h3;h4;h5;h6;pre;address;div'
};

https://github.com/tsechingho/ckeditor-rails我使用了这个宝石

我希望我的maxi工具栏具有更多图标,而mini显然具有更少图标。

我该怎么做?使用我当前的代码,我只会得到迷你工具栏。

这就是我在视图中渲染的方式

<%= f.text_area :body, :class => 'ckeditor', rows: 15, :toolbar => 'maxi' %>

0 个答案:

没有答案