diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-11-03 14:26:23 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-11-03 14:26:23 +0000 |
| commit | bb911f19c2732a32709f5dbcf76e65892164fd88 (patch) | |
| tree | 7c6bc203fd27cdba0080e079a19223cb947e2e32 /roundcubemail/program/js/app.js | |
| parent | 36d7b96623d85566c4b146fae4886f0eb7f4bcce (diff) | |
- Add warning when switching editor mode from html to plain (#1485488)
- Unified editor switching functions
git-svn-id: https://svn.roundcube.net/trunk@2035 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/js/app.js')
| -rw-r--r-- | roundcubemail/program/js/app.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js index d8a7eed4b..5c258f93b 100644 --- a/roundcubemail/program/js/app.js +++ b/roundcubemail/program/js/app.js @@ -3622,24 +3622,34 @@ function rcube_webmail() this.enable_command('export', (this.contact_list.rowcount > 0)); }; - this.toggle_editor = function(checkbox, textAreaId) + this.toggle_editor = function(ishtml, textAreaId, flagElement) { - var ischecked = checkbox.checked; var composeElement = document.getElementById(textAreaId); - - if (ischecked) + var flag; + + if (ishtml) { var existingPlainText = composeElement.value; var htmlText = "<pre>" + existingPlainText + "</pre>"; + + this.display_spellcheck_controls(false); composeElement.value = htmlText; tinyMCE.execCommand('mceAddControl', true, textAreaId); + if (flagElement && (flag = rcube_find_object(flagElement))) + flag.value = '1'; } else { + if (!confirm(rcmail.get_label('editorwarning'))) + return false; + var thisMCE = tinyMCE.get(textAreaId); var existingHtml = thisMCE.getContent(); this.html2plain(existingHtml, textAreaId); tinyMCE.execCommand('mceRemoveControl', true, textAreaId); + this.display_spellcheck_controls(true); + if (flagElement && (flag = rcube_find_object(flagElement))) + flag.value = '0'; } }; |
