Topic: Tip: toogle button to enable/disable TinyMCE
:idea:
Didn't found a solution in this forum, so I "build" it myself (don't know if that was already posted here):
I was looking for a "Toogle TinyMCE" button/link, so here it is:
[code]
var tinyMCEmode = true;
function toogleEditorMode(sEditorID) {
try {
if(tinyMCEmode) {
tinyMCE.removeMCEControl(tinyMCE.getEditorId(sEditorID));
tinyMCEmode = false;
} else {
tinyMCE.addMCEControl(document.getElementById('pagecontent'), sEditorID);
tinyMCEmode = true;
}
} catch(e) {
//error handling
}
}[/code]
To call the js function just make a html link (outside of TinyMCE, otherwise you won't have a chance to toogle it back on) like in
[code]<a href="#" title="toogle TinyMCE" onclick="toogleEditorMode('pagecontent');">Toogle TinyMCE</a>[/code]
The variable tinyMCEmode could be set in the <script> block where tinyMCE.init is called.
Hopefully this might help someone...
To the TinyMCE crew: this project rocks! far better (support/look'n'feel/...) than HTMLarea!
[/code]
spocke: is there a build-in function or property to check wether TinyMCE is active in any given textarea ?