SaaS CMS has officially launched! Learn more now.

TinyMCE stripping out <a> tags around <div>

Vote:
 

Just discovered that the TinyMCE editor was stripping all a tags that were wrapped around div tags.

For example, the markup below is intended to allow the visitor to click anywhere in the div and be taken to 'somepage'.


... lots of markup ...

But when you go to the editor the outer a tag is silently removed - even before switching to HTML edit mode.

The solution:

I added valid_children to the TinyMCEPluginNonVisual options

[TinyMCEPluginNonVisual(AlwaysEnabled = true, ServerSideOnly = true,
EditorInitConfigurationOptions = "{extended_valid_elements: 'section[*],&[*],i[*],div[*],a[*],iframe[src|frameborder=0|scrolling=no|alt|title|width|height|align|name],container[*]', forced_root_block : '', valid_children : '+a[div|img]'}"
)]
public class TinyMCE
{
}

... and in the web.config file:

#175782
Mar 01, 2017 18:09
Vote:
 

Thanks for sharing, you should be able to mark your own post as answered to help other community users :)

#175788
Mar 02, 2017 0:00
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.