Hi
I know this is an old post but we have the same issue with TinyMCE. It seems to be a bug in TinyMCE and has been fixed.
TinyMCE bug: http://www.tinymce.com/develop/bugtracker_view.php?id=5269 and http://www.tinymce.com/forum/viewtopic.php?pid=101363#p101363 and Git hub fix : https://github.com/tinymce/tinymce/commit/0eb73591f0d573bd2aee6a07a16ea1d0f51d6742
What makes it strange is that EPiServer says the current TinyMCE version is 3.5.11 ( http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/75/Editing/Customizing-the-TinyMCE-editor/ ) so that should indicate that the bug shouldn't be there anymore. But when looking at the EPiServer tiny_mce_src.js it says version 3.9.3 and release date 2010-12-20 but the fix is done 2012! So something isn't correct here.
We found 2 workarounds for our 3rd party code. Replace the div element with p element. Other workaround is to add an empty p element inside the div so that it wont get removed and also wrap the script element inside div as otherwise it will be wrapped inside p element. Like following:
<div data-somecustomvar="1234567890" style="width:400px; height:283px;" class="someclass"><p> </p></div> <div> <script type="text/javascript" src="//www.somedomain.net/embedcode.js" async="true"></script> </div>
Howdy,
Just ran into this issue myself. I think I finally found a solution (after banging my head against the wall for some considerable time).
We're on CMS 8.0 and our TinyMCE is version 3.9.3.
See http://www.tinymce.com/wiki.php/Configuration3x:valid_elements
See the last 2 control characters in the table: "-" and "#". The minus sign removes empty elements, the hash 'pads' them with a non-breaking space.
Now have a look at the default rule set, which includes "-div"! So I tried adding #div[*] to the extended_valid_elements, like so:
[TinyMCEPluginNonVisual(AlwaysEnabled = true, ServerSideOnly = true, EditorInitConfigurationOptions = "{ extended_valid_elements : '#div[*]' }")] public class TinyMCEExtendedValidElements { }
Seems to work okay - as mentioned it just adds a in the empty element.
I'm having some trouble getting TinyMCE (EPiServer 7.13.1) to allow empty div elements.
I've tried creating a TinyMCEPluginNonVisual-class and configuring extended_valid_elements, but that fails for div specifically. When doing the exact same thing for a different element name ("divi" in the example below), that works so I assume there's some default configuration for div that conflicts with my extended configuration. Any ideas what I'm doing wrong?
Also, here's the relevant row from EPiServer.config:
The reason we need empty div tags is due to embed codes from external systems.