tinymce/tinymce — pull request #246 by enigmatic-user (2013-09-23 04:59:34+00:00)
Title: Template classes bug

In the TinyMCE plugin for MODX Revolution (uses TinyMCE 3.5.4.1) I encountered the following bug:

Using TinyMCE's template plugin, I tried to insert a snippet where the outmost tag was a DIV with a class:

```html

Content of the left column

Content of the right column

```

After adding it, only the outmost DIV was inserted, the other elements just disappeared.

I found out that this happened because my template_selected_content_classes list was empty. In the jscripts\tiny_mce\plugins\template\editor_plugin_src.js there needs to be a test if it is empty before replacing, otherwise every time a construct like this is inserted, the inner HTML will be replaced (with the empty string if nothing is selected in the editor).

This should also apply to the "standalone" TinyMCE at least up to the current 3.x version - the template plugin hasn't changed in the meantime.