CKEditor定义自定义工具栏

时间:2011-10-11 15:55:35

标签: javascript jquery ckeditor rich-text-editor

我正在使用CKEditor并在config.js文件中定义了一个自定义工具栏。

但是,当我刷新出现CKEditor的页面时,不会显示此自定义工具栏。

以下是config.js文件中的自定义工具栏。

CKEDITOR.editorConfig = function( config )
{
    // Define changes to default configuration here. For example:
    // config.language = 'fr';
    // config.uiColor = '#AADC6E';
    config.toolbar = 'Custom';

    config.toolbar_Custom =
    [
        { name: 'document', items : [ 'NewPage','Preview' ] },
        { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
        { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] },
        { name: 'insert', items : [ 'Image','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'
                 ,'Iframe' ] },
                '/',
        { name: 'styles', items : [ 'Styles','Format' ] },
        { name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] },
        { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote' ] },
        { name: 'links', items : [ 'Link','Unlink','Anchor' ] },
        { name: 'tools', items : [ 'Maximize','-','About' ] }
    ];
};

除了将工具栏添加到配置文件之外,还有什么我需要做的。

感谢您的时间和帮助。

1 个答案:

答案 0 :(得分:7)

有两件事情可能会发生。一,你的config.js文件可以被缓存,所以它在你做出更改之前加载了以前的文件,在这种情况下你需要清除你的浏览器缓存或者在你的浏览器中点击ctrl-F5来完全重新加载你的页面。或者两个,你正在使用一个组合加载(和缩小)的config.js文件,这意味着每次更改文件时都需要运行打包工具。有关打包工具的详细信息,请参阅this。希望有所帮助!