EPiServer only:
Our clients are trying to add custom attributes to a div-tag in the TinyMCE editor - they switch to HTML mode, makes the changes and save the page. Then the attributes are removed. Washing HTML like this is standard behaviour of TinyMCE, and it is possible to configure it to allow custom tag attributes.
My question is how do I configure TinyMCE in EPiServer to allow custom HTML attributes? I don't see where I would be able to hook into the inititialization of TinyMCE. And adding div to the list of "safe" tags in episerver.config doesn't see to work either (see uiSafeHtmlTags).
Example:
<div class="fb-like" data-href="http://oursite" data-send="false"></div>
Becomes just
<div class="fb-like"></div>
From the TinyMCE documentation, on how to add custom attributes to tags: http://www.tinymce.com/wiki.php/Configuration:extended_valid_elements
You have 2 options:
First
will allow
title
anddata-test
in div tag.div[*]
will allow all attribute in div tag.Second
implement function like this:
No need to configure anything in .config file (with EPiServer's default value, they are all fine).
I have this class
and this in episerver.config:
in a recent project. It should work the same if you change the iframe part to div[data-href|data-send].
Here are some helpful links to this question
The following worked for me:
No changes in config.