如何在ckeditor中禁用保存按钮?

时间:2010-11-29 16:46:49

标签: jquery ckeditor

我不想在ckeditor中使用任何ajax功能。如何从工具栏中删除该按钮?如果我没有禁用该保存按钮,当我点击该按钮时会出现奇怪的错误。我按照本教程: -

http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Integration

提前致谢:)

3 个答案:

答案 0 :(得分:13)

在配置文件中,您可以指定自己的工具栏(并省略保存按钮)。

例如,我的配置:

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

    config.uiColor = '#F6F6F6';
    config.fontSize_sizes = '8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;15/15px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px' ;
    config.forcePasteAsPlainText = true;
    config.format_tags = 'p;h2;h3;h4;h5;h6;pre;div'
    config.height = "400px";
    // config.protectedSource.push( //g ); // Allows PHP Code
    // config.shiftEnterMode = CKEDITOR.ENTER_BR;
    config.skin = 'kama';
    config.undoStackSize = 90;
    config.width = "98%";

    config.disableNativeSpellChecker = false;
    config.scayt_autoStartup = false;

    config.toolbarCanCollapse = false;
    config.toolbar = 'Cms';
    config.toolbar_Cms =
    [
        ['Source'],
        ['Cut','Copy','Paste','PasteText','PasteFromWord'],
        ['Undo','Redo','-','SelectAll','RemoveFormat'],
        '/',
        ['Bold','Italic','-','Subscript','Superscript'],
        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
        ['Link','Unlink','Anchor'],
        ['Image','Table','SpecialChar'],
        '/',
        ['Styles','Format','FontSize'],
        ['TextColor'],
        ['Maximize', 'ShowBlocks']
    ];
};

答案 1 :(得分:6)

您只需要从toolbar array ...

中省略它
config.toolbar_Basic =
[
    ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','-','About']
];

在上面的例子中看看Save如何消失?

config.toolbar_Basic =
[
    ['Save', 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','-','About']
];

答案 2 :(得分:0)

我只是想在这里为v4.x添加我自己的发现,因为我想要一种方法来根据需要禁用按钮'没有在配置中加载的基础。

var editor = CKEDITOR.instances['editorID'];
if (editor) { editor.destroy(true); }
  CKEDITOR.replace( 'editorID' , {
  removeButtons: 'btnName',
});