// add a handler for the "back/forward" case -- on body.unload we save
// the HTML content into the original textarea.
try {
- window.onunload = function() {
+
+ function addWYSIWYGUnloadEvent(func) {
+ var oldonunload = window.onunload;
+ if (typeof window.onunload != 'function') {
+ window.onunload = func;
+ } else {
+ window.onunload = function() {
+ oldonunload();
+ func();
+ }
+ }
+ }
+
+ addWYSIWYGUnloadEvent(function() {
editor._textArea.value = editor.getHTML();
- };
+ });
+
} catch(e) {};
// creates & appends the toolbar
// check if any plugins have registered refresh handlers
for (var i in editor.plugins) {
- var plugin = editor.plugins[i].instance;
- if (typeof plugin.onGenerate == "function")
- plugin.onGenerate();
- if (typeof plugin.onGenerateOnce == "function") {
- plugin.onGenerateOnce();
- plugin.onGenerateOnce = null;
- }
+ try {
+ var plugin = editor.plugins[i].instance;
+ if (typeof plugin.onGenerate == "function")
+ plugin.onGenerate();
+ if (typeof plugin.onGenerateOnce == "function") {
+ plugin.onGenerateOnce();
+ plugin.onGenerateOnce = null;
+ }
+ }catch(e) { /*alert(e);*/ }
}
setTimeout(function() {
this.focusEditor();
for (var i in this.plugins) {
- var plugin = this.plugins[i].instance;
- if (typeof plugin.onMode == "function") plugin.onMode(mode);
+ try {
+ var plugin = this.plugins[i].instance;
+ if (typeof plugin.onMode == "function") plugin.onMode(mode);
+ } catch(e) { /*alert(e);*/ };
}
};
}
}
}
+ try {
btn.state("enabled", (!text || btn.text) && inContext);
+ } catch(e) { /*alert(e);*/ }
if (typeof cmd == "function") {
continue;
}
// look-it-up in the custom dropdown boxes
var dropdown = this.config.customSelects[cmd];
if ((!text || btn.text) && (typeof dropdown != "undefined")) {
- dropdown.refresh(this);
+ try { dropdown.refresh(this); } catch(e) { /*alert(e);*/ }
continue;
}
switch (cmd) {
// check if any plugins have registered refresh handlers
for (var i in this.plugins) {
- var plugin = this.plugins[i].instance;
- if (typeof plugin.onUpdateToolbar == "function")
- plugin.onUpdateToolbar();
+ try {
+ var plugin = this.plugins[i].instance;
+ if (typeof plugin.onUpdateToolbar == "function")
+ plugin.onUpdateToolbar();
+ } catch(e) { /*alert(e);*/ }
}
};
if (keyEvent)
for (var i in editor.plugins) {
- var plugin = editor.plugins[i].instance;
- if (typeof plugin.onKeyPress == "function")
- if (plugin.onKeyPress(ev))
- return false;
+ try {
+ var plugin = editor.plugins[i].instance;
+ if (typeof plugin.onKeyPress == "function")
+ if (plugin.onKeyPress(ev))
+ return false;
+ } catch(e) { /*alert(e);*/ }
}
if (keyEvent && ev.ctrlKey && !ev.altKey) {
var sel = null;