代码之家  ›  专栏  ›  技术社区  ›  Chris

CKEditor 4.10并非所有工具栏选项都在呈现

  •  0
  • Chris  · 技术社区  · 6 年前

    我在不同的页面上有多个CKEditor实例,所以我不想修改config.js,也不想为每个页面都有一个单独的config.js实例。

    我正在运行时使用以下命令创建工具栏:

     $(document).ready(function() {
        CKEDITOR.replace('Description');
    
        var editor = CKEDITOR.instances['Description'];
        if (editor) {
            editor.destroy(true);
        }
    
        CKEDITOR.config.toolbar_Basic = [
            { name: 'document', items: [ 'Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] },
            { name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
            { name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
            { name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
            '/',
            { name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat' ] },
            { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
            { name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
            { name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] },
            '/',
            { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
            { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
            { name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] },
            { name: 'about', items: [ 'About' ] }
    
        ];
        CKEDITOR.config.toolbar = 'Basic';
        CKEDITOR.config.width=650;
        CKEDITOR.config.height=400;
        CKEDITOR.config.extraAllowedContent = 'span;ul;li;table;td;style;*[id];*(*);*{*}';
        CKEDITOR.replace('Description', CKEDITOR.config);
    
        });
    

    不是所有的工具栏选项都显示出来。例如,

        { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
        { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
    

    样式和格式可见,但字体、字体大小、文本颜色和BGColor不可见。

    如何让那些丢失的工具栏项显示出来。

    1 回复  |  直到 6 年前
        1
  •  0
  •   Chris    6 年前

    这只是一个没有安装完整的CKEditor的问题。我安装了不包含字体和颜色插件的标准版本。

    安装完整版本纠正了这种情况。