question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tinymce re-order html in a wrong way and remove code

See original GitHub issue

I 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>

  1. you can see the div with h2 is now outside of a
  2. 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:open
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
spockecommented, Jun 13, 2016

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>.

0reactions
dsakkocommented, Jul 27, 2016

Thanks for the link. Agreed, I will reopen this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Content filtering options | Docs - TinyMCE
This example string tells TinyMCE to remove all elements that are not a 'a, strong, div or br' element, convert 'b' elements to...
Read more >
User interface options | Docs - TinyMCE
Example: Disabling/removing the menu bar. To disable the menu bar, the menubar option should be provided a boolean value of false . tinymce...
Read more >
Content filtering options | TinyMCE Documentation
This option enables you to control what child elements can exists within specified parent elements. TinyMCE will remove/split any non HTML5 or HTML...
Read more >
Content Filtering - TinyMCE
This option should be used in order to get more W3C compatible code, ... This way you can handle non-HTML elements inside an...
Read more >
URL handling options | Docs - TinyMCE
This will convert all relative URLs to absolute URLs. The URLs will be absolute based on the document_base_url with domain. relative_urls : false, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found