如何定义允许的标签在CKEditor? [英] How to define allowed tags in CKEditor?

查看:547
本文介绍了如何定义允许的标签在CKEditor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 有时用户将不同来源的文本复制并粘贴到CKEditor,但我想限制他们可以复制到CKEditor的标签。


  • 我只需要在CKEditor中使用某些标签:

  • ;禁用CKEditor中的其他标签?



解决方案

使用。您定义这些设置编辑ckeditor的根目录中的config.js文件。例如,如果你想要像我一样激进,你可以:

  config.forcePasteAsPlainText = true; 

如果你只想限制某些标签, p>

  config.removeFormatTags ='b,big,code,del,dfn,em,font,i,ins,kbd'; 

最后一个操作只有在用户执行remove format
详细信息: http://docs.cksource.com/ckeditor_api/symbols/ CKEDITOR.config.html#.format_tags



考虑到所有时间,我认为你已经找到了你的答案,但其他人可以帮助。 p>

  • Sometimes users copy and paste text from different sources to CKEditor, but I want to restrict what tags they can copy to CKEditor.

  • I only need to use certain tags in CKEditor: The list tag, break tag, etc...

  • Can I define them & disable the other tags in CKEditor?

解决方案

There are some settings you can use. You define these settings editing the config.js file in the ckeditor's root directory. For example, if you want to be radical like me, you could put:

config.forcePasteAsPlainText = true;

If you want to restrict only certain tags exactly like you said, I found the setting bellow:

config.removeFormatTags = 'b,big,code,del,dfn,em,font,i,ins,kbd';

The last will be done only when user execute the "remove format" command. More information: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.format_tags

Considering all the time, I think that you already have found your answer, but others can be helped.

这篇关于如何定义允许的标签在CKEditor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆