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.
Just in case anybody arrived here who is using the jQuery version of TinyMce use the following instead to remove an instance:
The following code is working
If you have multiple Instances of TinyMCE you can use following code snippet to close every instance of TinyMCE:
I use it before the Ajax Content is loaded.
Bear in mind that if given
textarea
has an id, tinyMCE will use it for some strange reason, even ifselector
parameter has been used to apply editor to given element. This id is then used in internal array -tinyMCE.editors
which isn't cleared (isn't cleared if you'll usetinymce.execCommand('mceRemoveControl', true, [id])
,remove
actually removeseditors
and prevents tinyMCE to be applied ever again). As such if you have a dynamic content with tinyMCE applied, it will work once, but never again. To resolve this you need to clean this array manually perdelete tinyMCE.editors[$(node).getAttribute('id')]
we were getting error on calling
elementReference.destroy()
// destroy is a dojo functionwe replaced that code with
elementReference.domNode.remove()
we were also using tinymce.min.js, and it was giving us NS_ERROR_UNEXPECTED
tinymce.EditorManager.remove() This was working for me