几个月前我问过这个问题,但不幸的是它没有解决我的问题,所以我再问一遍,提供更多的信息。
我正在使用CKeditor 4.4.5
原始问题我尝试过CKeditor的在线演示。什么工作是,颜色是在CKeditor中进行编辑时呈现的,但是,当一个检索内容与彩色跨度元素在其中,因为它应该正确地做,颜色不呈现在CKeditor。此外,标签似乎并没有被剥离掉。它似乎只是CKeditor没有渲染像这样的东西:
<textarea class="RTE" cols="20" disabled="True" id="Content" name="Content"
rows="2">
<h1><span style="color:red">I should be coloured red</span></h1>
</textarea>
:
I should be coloured red
用红色。
我检查了"!"在相关的CSS中,我看不到任何会影响文本的内容。
关于为什么CKeditor在检索/显示数据时不尊重这个"span"元素的"color"属性的想法,而不是最初编辑它将非常有帮助。
提前感谢。
编辑Source视图中的源:
<h1><span style="color:red">I should be coloured red</span></h1>
EDIT2
如此:
<p style="color:red">I should be coloured red</p>
EDIT3
这是<h1 style="color:red">XXX red text XXX</h1>
标引
这行不通:
<p><span style="color:red">XXX red text XXX<</span></p>
似乎我有一些代码在我的CKeditor配置这是导致这种行为,但不知道为什么。当我把它注释掉时,我的颜色编码工作了。我还关闭了ACF,因为我发现所有的内联样式属性都被剥离了。因此,我将配置更改为:
//config.protectedSource.push(/<span[sS]*?>/g); //allows beginning <span> tag - now commented out
//config.protectedSource.push(/</span[sS]*?>/g); //allows ending </span> tag - now commented out
config.allowedContent = true; //Added