diff options
author | alecpl <alec@alec.pl> | 2010-06-30 08:40:39 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-06-30 08:40:39 +0000 |
commit | 3940ba65be1993c4a2c2be4599f53d3018228783 (patch) | |
tree | 9d426e0921c6973691474b219e33377982dbd70b /program/js/editor.js | |
parent | edfe91737e573e9f4209451e3d59a6839b1687f0 (diff) |
- Resize editor after switching to html mode
- create toggle-editor command in app.js, to make possible binding to this command
- Code cleanup in rcmail_ui (moved compose-related functions into rcmail_ui)
Diffstat (limited to 'program/js/editor.js')
-rw-r--r-- | program/js/editor.js | 24 |
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'; } |