jquery - TinyMCE Interst existing HTML -
ok, have div, when click on div, insert textarea, add tinymce controll textarea. ok, type in wsgi editor , press save save it.
then html form tinymce editor gets saved, , textarea , tinymce element removed , html tinymce inserted in div again.
that works nice, now, when click on div, html, want html display inside tunymce editor.
this have done, once click on div, adds html, removes it, why happening?
// click on div element $(".editable").live("click", function(e){ var f = $(this); // html if there html = f.html(); // insert textarea unique id f.html('<textarea class="item_html" id="'+ e.timestamp +'"></textarea> ') f.css("height","100%") //add tinymce control textarea tinymce.execcommand( 'mceaddcontrol', false, f.find("textarea").attr("id") ); // if there html insode div clicked on, add editor tinymce.execcommand( 'mceinsertcontent', false, html ); });
the part
// if there html in div clicked, add mce editor if (html) { tinymce.activeeditor.setcontent('html'); }
won't work , throw error because editor instance not initialized @ time.
have @ changes made. here: http://jsfiddle.net/m3gnm/9/ editor content
Comments
Post a Comment