TinyMCE strips own codesample

261 Views Asked by At

I'm using TinyMCE's codesample plugin. It works the first time and saves correctly into the database, but when opening the editor again, it either strips the code sample content (if it's "illegal") or places it outside of the codesample tags.

Saved Code:

<pre class="language-markup"><code>&lt;!DOCTYPE html&gt;</code></pre>

When loading the editor again:

<pre class="language-markup"><code></code></pre>

Should the content somehow be filtered before returning it to the editor? I assume it's because the editor is converting the escaped HTML back to normal tags first...seems a bit silly really.

Anyone know a workaround for this or encountered this before?

Thanks in advance

1

There are 1 best solutions below

0
On BEST ANSWER

See this TinyMCE Fiddle:

http://fiddle.tinymce.com/ITfaab

It seems to load your example code back into the editor just fine. What are you doing differently?