summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-03-31 07:37:43 +0000
committeralecpl <alec@alec.pl>2010-03-31 07:37:43 +0000
commit4cdc70941d5d25f47f920c6ba62035d2e6978454 (patch)
tree5d0d9e8ba98d938e0652e1de3c044f0d8237fcd0 /program
parent6f31b356b2b21882b439324d233aceec413f4737 (diff)
- Fix js error when switching editor mode (#1486593)
Diffstat (limited to 'program')
-rw-r--r--program/js/editor.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/program/js/editor.js b/program/js/editor.js
index b1ef31bde..2c86d8ec7 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -55,7 +55,7 @@ function rcmail_editor_init(skin_path, editor_lang, spellcheck, mode)
gecko_spellcheck : true,
relative_urls : false,
remove_script_host : false,
- rc_client: rcmail,
+ rc_client : rcmail,
oninit : 'rcmail_editor_callback'
});
}
@@ -75,10 +75,12 @@ function rcmail_editor_tabindex()
{
if (rcmail.env.task == 'mail') {
var editor = tinyMCE.get(rcmail.env.composebody);
- var textarea = editor.getElement();
- var node = editor.getContentAreaContainer().childNodes[0];
- if (textarea && node)
- node.tabIndex = textarea.tabIndex;
+ if (editor) {
+ var textarea = editor.getElement();
+ var node = editor.getContentAreaContainer().childNodes[0];
+ if (textarea && node)
+ node.tabIndex = textarea.tabIndex;
+ }
}
}
@@ -98,8 +100,9 @@ function rcmail_toggle_editor(select, textAreaId, flagElement)
rcmail.display_spellcheck_controls(false);
rcmail.plain2html(composeElement.value, textAreaId);
- tinyMCE.execCommand('mceAddControl', true, textAreaId);
- rcmail_editor_tabindex();
+ tinyMCE.execCommand('mceToggleEditor', false, textAreaId);
+ // #1486593
+ setTimeout("rcmail_editor_tabindex();", 500);
if (flagElement && (flag = rcube_find_object(flagElement)))
flag.value = '1';
}
@@ -118,7 +121,7 @@ function rcmail_toggle_editor(select, textAreaId, flagElement)
rcmail.html2plain(existingHtml, textAreaId);
}
- tinyMCE.execCommand('mceRemoveControl', true, textAreaId);
+ tinyMCE.execCommand('mceToggleEditor', false, textAreaId);
rcmail.display_spellcheck_controls(true);
if (flagElement && (flag = rcube_find_object(flagElement)))
flag.value = '0';