| | |
| | | rc_client: rcube_webmail_client |
| | | }); |
| | | } |
| | | |
| | | // Toggle between the HTML and Plain Text editors |
| | | |
| | | function rcmail_toggle_editor(toggler) |
| | | { |
| | | var selectedEditor = toggler.value; |
| | | |
| | | // determine the currently displayed editor |
| | | var htmlFlag = document.getElementsByName('_is_html')[0]; |
| | | var isHtml = htmlFlag.value; |
| | | |
| | | if (((selectedEditor == 'plain') && (isHtml == "0")) || |
| | | ((selectedEditor == 'html') && (isHtml == "1"))) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | // do the appropriate conversion |
| | | if (selectedEditor == 'html') |
| | | { |
| | | rcmail.display_spellcheck_controls(false); |
| | | var composeElement = document.getElementById('compose-body'); |
| | | var htmlText = "<pre>" + composeElement.value + "</pre>"; |
| | | composeElement.value = htmlText; |
| | | tinyMCE.execCommand('mceAddControl', true, 'compose-body'); |
| | | htmlFlag.value = "1"; |
| | | } |
| | | else |
| | | { |
| | | var thisMCE = tinyMCE.get('compose-body'); |
| | | var existingHtml = thisMCE.getContent(); |
| | | rcmail.html2plain(existingHtml, 'compose-body'); |
| | | tinyMCE.execCommand('mceRemoveControl', true, 'compose-body'); |
| | | htmlFlag.value = "0"; |
| | | rcmail.display_spellcheck_controls(true); |
| | | } |
| | | } |