首页 文章

如何在CKEDITOR处于只读模式时启用单个按钮

提问于
浏览
0

我为CKEDITOR创建了一个插件,它将打开一个弹出对话框 . 我希望即使我的CKEDITOR处于readOnly模式也能启用它 . 无论如何我能做到吗?

另外我想知道有没有办法在readOnly模式下禁用Source按钮 .

是否禁用或启用编辑器是动态确定的,我希望所有工具栏都存在但处于禁用模式,因此我无法从工具栏中删除源按钮 .

我试图找到最后3小时的方法,我无法达到它 . 而且迫切 . :(

提前致谢 .

2 回答

  • 0

    这个愚蠢的可怕黑客可能会帮助你:)

    // Save command after loading editor.
    var sourceCommand = CKEDITOR.instances.editor1.ui._.items.Source.args[0].command;
    
    // When disabling editor, unset command
    CKEDITOR.instances.editor1.ui._.items.Source.args[0].command = undefined;
    
    // When enabling editor, reset command
    CKEDITOR.instances.editor1.ui._.items.Source.args[0].command = sourceCommand;
    
  • 1

    加载编辑器后使用类似的东西,添加/删除您想要和不想要的工具

    var editor = CKEDITOR.replace('txtarea_name',{toolbar:[['NewPage'],['Cut','Copy','Paste','PasteText','PasteWord'],['Undo',' Redo','Bold','Italic','Underline','StrikeThrough'],['OrderedList','UnorderedList'],['NumberedList','BulletedList',' - ','Outdent','Indent' ],''JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],['Font','FontSize']]}
    );

相关问题