Search code examples
tinymce-4tinymce-plugins

TinyMCE4 custom self closing tag


I have some custom XML tags which I want to use in my TinyMCE 4 editor. One of it, is self closing. For example this 'html' is valid:

<include type="module" name="MyModule">
    <param name="myParam" value="myValue" />
</include>

According to allow these custom tags, i've added the following things to my init:

extended_valid_elements: "include[type|name],param[type|name|value]",
valid_children: "+p[include], +include[param]",

After inserting the code snippet, TinyMCE converts it into:

<include type="module" name="MyModule">
    <param name="myParam" value="myValue">
</include>

Now the param tag isn't closed anymore.

After searching, I found the variable self_closing_elements. Adding my custom tags to it, unfortunately didn't work. I also 'played' with short_ended_elements and whitespace_elements, without any success.

So, how can I allow these custom tags to be self closing in TinyMCE 4 (I can find allow about version 3, not about v4...).


Solution

  • Was a bug in the version I used. After updating to the latest TinyMCE4 version, it worked like a charm