Removing all TinyMCE editors on the page for reinitializing
Posted on May 6th, 2009 in tinymce | 2 Comments »
Sometimes, one needs to remove (not hide) all TinyMCE editors on the page to run a modified version of the global tinyMCE.init code again. This is the best way I’ve found to do it so far:
var i, t = tinyMCE.editors; for (i in t){ if (t.hasOwnProperty(i)){ t[i].remove(); } } // new tinyMCE.init code here
Additionally, you can “destrory” and “recreate” specific editors via:
tinyMCE.execCommand('mceRemoveControl', false, 'idOfElement'); tinyMCE.execCommand('mceAddControl', false, 'idOfElement');
If anyone knows a better way, post in the comments.

2 Responses
I found that the event handlers for my tinyMCE instances aren’t reinitialized, even if I use your code above. I have the toolbar set to external so when I click on a TinyMCE instance, the toolbar appears, but then it won’t disappear after the mouse focus is lost. This only happens after I try reinitializing TinyMCE. I wonder if there is a way to completely remove TinyMCE and then reload it. Also, I use jQuery to initialize TinyMCE.
tinyMCE.editors=[];