阻止CKEditor删除在源模式下分配的类? [英] Preventing CKEditor from removing classes assigned in source mode?
问题描述
我希望能够在CKEditor的源代码模式下将类属性添加到UL。当我这样做并切换回普通编辑器模式时,
I want to be able to add a class attribute to a UL in source mode of CKEditor. When I do that and switch back to the normal editor mode the
<ul class="xxxx">
成为
<ul>
如何获取不删除类标记的信息?
How can I get it to not remove the class tag?
推荐答案
由于高级内容过滤器(ACF)。
您需要使用 extraAllowedContent 像这样: config.extraAllowedContent ='ul(*)';
允许 ul
元素的任何CSS类。
You need to use extraAllowedContent like this: config.extraAllowedContent = 'ul(*)';
to allow any CSS class for ul
element.
您可以更具体一些,只允许某些CSS类,例如这: config.extraAllowedContent ='ul(class1,class2,class3)';
(注意名称之间没有空格)。
You can be more specific and allow only certain CSS classes, like this: config.extraAllowedContent = 'ul(class1,class2,class3)';
(note no space between names).
您还可以禁用ACF(虽然不理想),并允许如下所示的所有内容: config.allowedContent = true;
You could also disable ACF (not ideal though) and allow everything like this: config.allowedContent = true;
这篇关于阻止CKEditor删除在源模式下分配的类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!