【问题标题】:how can i disable save button in ckeditor?如何禁用ckeditor中的保存按钮?
【发布时间】:2014-11-08 08:43:37
【问题描述】:

我不想要 ckeditor 中当前的任何 ajax 功能。如何从工具栏中删除该按钮?如果我不禁用该保存按钮,当我单击该按钮时会出现奇怪的错误。我按照本教程进行操作:-

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

提前致谢:)

【问题讨论】:

    标签: jquery ckeditor


    【解决方案1】:

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

    例如我的配置:

    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']
        ];
    };

    【讨论】:

    • 谢谢,我只会使用你的配置:)。这正是我需要的。
    【解决方案2】:

    您只需从toolbar array 中省略它...

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

    看看上面的例子中保存是如何消失的?

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

    【讨论】:

      【解决方案3】:

      我只是想在这里为 v4.x 添加我自己的发现,因为我想要一种在不加载配置的情况下根据需要禁用按钮的方法。

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-08-20
        • 2022-12-18
        • 1970-01-01
        • 2013-08-22
        • 1970-01-01
        • 2020-09-28
        • 1970-01-01
        • 2015-09-17
        相关资源
        最近更新 更多