how can i disable save button in ckeditor?

*爱你&永不变心* 提交于 2019-12-21 05:09:30

问题


I don't want any ajax functionality currently in ckeditor. How can i remove that button from toolbar? If i do not disable that save button i get strange errors when i click that button. I followed this tutorial :-

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

Thanks in advance :)


回答1:


In your config file, you can specify your own toolbar (and leave out the save button).

For example, my config:

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:


You just need to omit it from the toolbar array...

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

see how Save is gone in the above example?

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



回答3:


Just thought I'd add in my own findings here for v4.x as I wanted a way to disable a button on an 'as needed' basis without loading in the config.

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


来源:https://stackoverflow.com/questions/4305929/how-can-i-disable-save-button-in-ckeditor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!