tinymce re-order html in a wrong way and remove code
See original GitHub issueI put this in the source-code editor:
<ul class="myclass"><li><a href="..." style="background-image: url(image.png);"><div class="mytitle"><h2>Here is a title</h2></div>X</a></li></ul>
I close the source-code box and open it again and see this:
<ul class="myclass"><li><div class="mytitle"><h2>Here is a title</h2></div><a style="background-image: url('image.png');" href="...">X</a></li></ul>
- you can see the div with h2 is now outside of a
- remove “X” above and the result is now without a:
<ul class="myclass"><li><div class="mytitle"><h2>Here is a title</h2></div></li></ul>
How i prevent removing empty elements and re-order html? I use option schema with ‘html5’ and in html5 block element div is valid in a anchor: http://html5doctor.com/block-level-links-in-html-5/ Set option verify_html to false not help here.
reference: https://github.com/tinymce/tinymce/issues/1584
- solution for prevent remove empty a, add option: extended_valid_elements: “a[*]”,
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
This is the only thing we don’t support from HTML5 since it would be hard to edit inline and block level anchors in a sane way. Since a user can potentially have links inside a block text and there is no way to switch between them etc. Say you want to link this content:
<p>a</p>
it could be linked like this:<a href="#"><p>a</p></a>
or<p><a href="#">a</a></p>
but the user would select the same thing in both scenarios<p>[a]</p>
.Thanks for the link. Agreed, I will reopen this one.