TinyMCE 4 - remove() or destroy()

user007 picture user007 · Jul 20, 2013 · Viewed 73.8k times · Source

I am using TinyMCE editor. I want to remove or destroy tinymce editors (Page contain more then one editor). Also remove classes and IDs added by tinyMCE.

But leave editable contents

I tried :

tinymce.remove()
tinymce.destroy()
tinymce.execCommand('mceRemoveControl',true,'.editable');

Please note:

my editor class is .editable, And I have more then one editors in my page.

Answer

assassinatorr picture assassinatorr · Apr 8, 2014

I had the same problem. In v4 all suggestions above did not work for me, but this did:

tinymce.remove("div.editable");

... regenerated HTML dynamicaly ...

tinymce.init(...);

I use inline editor:

tinymce.init({
    selector: "div.editable",
    inline: true,
    plugins: [
    "advlist autolink lists link image charmap print preview anchor",
    "searchreplace visualblocks code fullscreen",
    "insertdatetime media table contextmenu paste"
    ],
    menubar: false,
    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"});

Hope this helped