Search code examples
xmltinymce

TinyMCE 6 and xml elements


TinyMCE 6 removes/strips the body tag.

For example, when I paste the following into the source code window

<body xmlns="http://www.w3c.org/1999/xhtml">
<p>test</p>
</body>

it is filtered into

<p>test</p>

How can I keep the body tag?

I've the following settings:

tinymce.init({
  selector: "textarea",
  encoding: 'raw',
  element_format : 'xhtml',

Note that TinyMCE 5 preserves body tag


Solution

  • One solution that I used is to add back the body tag when saving with save_onsavecallback, like so:

    var blob = new Blob(['<body>' + i.value+ '</body>'], {type: "text/plain;charset=utf-8"});