如何从修改中禁用CKeditor <p>标签

时间:2019-05-16 19:24:49

标签: jquery ckeditor

我在Web应用程序中使用CKEditor,并且需要禁用/启用javascript中的html标签,或者我可以使用CKEditor插件。

示例

<textarea name="editor1">
<div>
User Can modify this 
</div>

<div class="disabled" readonly="readonly">
           Read only Div
</div>
</textarea>

自定义JQuery不起作用

 CKEDITOR.instances['editor1'].on('contentDom', function() {
    this.document.on('click', function(event){
         //your code
        alert('Click Event');
         $('.disabled :input').attr('disabled', true);

     });

1 个答案:

答案 0 :(得分:0)

是的,您可以通过添加占位符插件来创建不可编辑的div或段落或任何选定的文本。

https://ckeditor.com/cke4/addon/placeholder

但是,占位符插件还需要安装一些其他插件才能起作用。当您单击“下载”时,将出现一个模式。在底部的底部显示了Add-on依赖项,这些依赖项也需要上载到plugin目录,并添加到config.js文件中。

// example config.js
config.extraPlugins = "placeholder,widget,lineutils,dialog,clipboard, ... {plus-other-dependent-plugins-as-needed}";

您无需以任何特殊方式标识div或段落或其他任何内容,即,无需readonly =“ readonly”。插件会处理它。

相关问题