From ef6d81ddf89be425f2634848006a37ff5b95ac8a Mon Sep 17 00:00:00 2001 From: alec Date: Wed, 30 Jun 2010 08:40:39 +0000 Subject: - 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) git-svn-id: https://svn.roundcube.net/trunk@3793 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/js/editor.js | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'roundcubemail/program/js/editor.js') diff --git a/roundcubemail/program/js/editor.js b/roundcubemail/program/js/editor.js index a5e3af3d5..fd128cb8f 100644 --- a/roundcubemail/program/js/editor.js +++ b/roundcubemail/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'; } -- cgit v1.2.3