我开始在我的一个项目中使用CKEditor并喜欢它。我无法弄清楚(或发现)的一件事是如何在另一个元素中禁止一个元素。我想禁止p
发生在表格单元th
或td
内。CKEditor:如何从表格单元中删除p元素?
此:
<table>
<tr>
<td>
<p>Foo</p>
</td>
</tr>
</table>
应该转换为这样的:
<table>
<tr>
<td>Foo</td>
</tr>
</table>
一个CSS技巧来隐藏款造型是不是一种选择。
table p { margin: 0; } /* I don't want this! */
我CKEditor的初始化是这样的:
CKEDITOR.replace('id_text', {
allowedContent: 'table(table); table(table-striped); thead tbody tfoot tr td th;',
toolbar: [
['Source'],
['Format'],
['Table']
]
});
看来,allowedContent
财产不处理父子规则。当其他元素发生时,如何过滤元素?