I would like to wrap a few block tags in a link (valid in HTML5):
<a href="http://example.com">
<div>foo</div>
<p>bar</p>
<span>baz</span>
<strong>zoom</strong>
</a>
But CKEditor rewrites the code such that the links are placed inside block tags and allowed to wrap inline tags as the above code is replaced with the following:
<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>
How can I disable this behavior?
In the CKEditor config, I'm using config.allowedContent = true;
which disables the filtering of allowed tags.
We're also using config.autoParagraph = false;
to not require root-level tags to be wrapped in a paragraph.
I've tried using config.extraAllowedContent = "a p; a div";
, but this doesn't seem to have any effect.
You can try doing something similar to this:
CKEDITOR.dtd.a.div = 1;
CKEDITOR.dtd.a.p = 1;
src: http://ckeditor.com/forums/Support/CKEditor-wont-allow-inside
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With