tinymce code inserting, can't get it to work -
i enabled codesample plugin https://www.tinymce.com/docs/plugins/codesample/ , test entered head tag

and displays in editor

when save database gets saved this:
<pre class="language-markup"><code><head></code></pre> when reload page in editor
<pre> </pre> database still looks
<pre class="language-markup"><code><head></code></pre> but there no head tag visible in editor. ideas why?
when placing raw html <textarea> need escape html code placing in <textarea>. not doing browser (and proxy tinymce) "cleaning up" invalid markup best can.
you can either:
- properly escape html
- use
setcontent()api load html tinymce (as opposed injecting html<textarea>)
i suggest second option above eliminates vagaries of injecting html <textarea>.
if want try first solution listed above might if using php
<?php $content = "this string contains tm symbol: ™"; print "<textarea>". htmlentities($content) ."</textarea>"; ?> every language have used has equivalent htmlentities().
Comments
Post a Comment