我想将一些块级标签包装在链接中(HTML5中有效):
<a href="http://example.com">
<div>foo</div>
<p>bar</p>
<span>baz</span>
<strong>zoom</strong>
</a>
但是 CKEditor 会重写代码,使得链接放置在块级标签内,并允许其包裹内联标签,如上面的代码将被替换为以下代码:
<div><a href="http://example.com">foo</a></div>
<p><a href="http://example.com">bar</a></p>
<a href="http://example.com"><span>baz</span> <strong>zoom</strong> </a>
我该如何禁用这种行为?
在CKEditor配置中,我正在使用config.allowedContent = true;
来禁用允许标签的过滤。
我们还使用config.autoParagraph = false;
来不要求根级标签被包含在段落中。
我尝试使用config.extraAllowedContent = "a p; a div";
, 但这似乎没有任何效果。