alecpl
2010-06-30 3940ba65be1993c4a2c2be4599f53d3018228783
program/js/editor.js
@@ -95,7 +95,6 @@
// 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 @@
  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';
  }