TinyMCE does not allow block level children for anchor "<a>" tags


The specification for anchor tags has changed in HTML5 to allow <A> tags to contain block-level child elements. For example,

"<a href='#'><h2>HI</h2></a>" would now be valid in HTML5. Here is the new specification:

The problem is that the TinyMCE editor in Orchard will still strip out block-level children in anchor tags with it's current settings.

To reproduce, Create an HTML widget, add in some html markup containing an anchor tag with block-level child element(s) similar to the example I provided. After closing and repoening the HTML edit panel in TinyMCE the HTML markup will have changed, stripping out the <a> tag.

The fix would be to add this setting to the "orchard-tinymce.js" file in the TinyMCE module:

valid_children: "a[span|h1|h2|h3|h4|h5|i|div|article|section|p]"


CSADNT wrote Jun 6, 2013 at 4:18 PM

Have you checked this
may be it's related ?

sebastienros wrote Jun 6, 2013 at 7:01 PM

And would you know what to change to allow <a> without anything inside ?

CSADNT wrote Jun 6, 2013 at 9:01 PM

Sorry but I get no time to test this, but on the beginning of
you may change schema setting from html4 to html5
theme: "advanced",
schema: "html5",
my personnal solution has been to replace tinymce by telerik kendoUI editor which runs ok for html5 and my other 'empty span with classes' requirements.
KendoUI editor has an open source version where you don't get the c# files, no support only js.

BertrandLeRoy wrote Jun 6, 2013 at 9:47 PM

Looks like this should be filed against TinyMCE.

Jetski5822 wrote Jun 7, 2013 at 8:34 AM

Well hold on, our tinymce version is quite out of date. We should upgrade first to see if that fixes the issue.

CSADNT wrote Jun 7, 2013 at 9:11 AM

I have tested on their online version corresponding to last code and its nok for <span>... very large backlog of errors since the v4 rewrite....
Good point, but common for html editors, It's easy to test your html using the only version.

Jetski5822 wrote Jun 7, 2013 at 8:10 PM

I will look to upgrade.

jhowe11 wrote Sep 20 at 12:11 AM

Any update on this? I am experiencing the same issue.

jhowe11 wrote Sep 20 at 12:59 AM