summaryrefslogtreecommitdiff
path: root/program/js/editor.js
diff options
context:
space:
mode:
Diffstat (limited to 'program/js/editor.js')
-rw-r--r--program/js/editor.js24
1 files changed, 4 insertions, 20 deletions
diff --git a/program/js/editor.js b/program/js/editor.js
index a5e3af3d5..fd128cb8f 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -95,7 +95,6 @@ function rcmail_editor_tabindex()
// switch html/plain mode
function rcmail_toggle_editor(select, textAreaId, flagElement)
{
- var composeElement = document.getElementById(textAreaId);
var flag, ishtml;
if (select.tagName != 'SELECT')
@@ -103,32 +102,17 @@ function rcmail_toggle_editor(select, textAreaId, flagElement)
else
ishtml = select.value == 'html';
- if (ishtml) {
- rcmail.display_spellcheck_controls(false);
+ var res = rcmail.command('toggle-editor', {id:textAreaId, mode:ishtml?'html':'plain'});
- rcmail.plain2html(composeElement.value, textAreaId);
- tinyMCE.execCommand('mceAddControl', false, textAreaId);
+ if (ishtml) {
// #1486593
setTimeout("rcmail_editor_tabindex();", 500);
if (flagElement && (flag = rcube_find_object(flagElement)))
flag.value = '1';
}
else {
- var thisMCE = tinyMCE.get(textAreaId);
- var existingHtml = thisMCE.getContent();
-
- if (existingHtml) {
- if (!confirm(rcmail.get_label('editorwarning'))) {
- if (select.tagName == 'SELECT')
- select.value = 'html';
- return false;
- }
-
- rcmail.html2plain(existingHtml, textAreaId);
- }
-
- tinyMCE.execCommand('mceRemoveControl', false, textAreaId);
- rcmail.display_spellcheck_controls(true);
+ if (!res && select.tagName == 'SELECT')
+ select.value = 'html';
if (flagElement && (flag = rcube_find_object(flagElement)))
flag.value = '0';
}