Changeset 3334 in subversion


Ignore:
Timestamp:
Mar 6, 2010 1:59:25 PM (3 years ago)
Author:
alec
Message:
  • Don't show a warning on html2text switch when textarea is empty
  • Set properly select's value when html2text is aborted
Location:
trunk/roundcubemail/program
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/js/editor.js

    r3182 r3334  
    8484 
    8585// switch html/plain mode 
    86 function rcmail_toggle_editor(ishtml, textAreaId, flagElement) 
     86function rcmail_toggle_editor(select, textAreaId, flagElement) 
    8787{ 
    8888  var composeElement = document.getElementById(textAreaId); 
    89   var flag; 
     89  var flag, ishtml; 
     90 
     91  if (select.tagName != 'SELECT') 
     92    ishtml = select.checked; 
     93  else 
     94    ishtml = select.value == 'html'; 
    9095 
    9196  if (ishtml) 
     
    101106  else 
    102107    { 
    103     if (!confirm(rcmail.get_label('editorwarning'))) 
    104       return false; 
    105  
    106108    var thisMCE = tinyMCE.get(textAreaId); 
    107109    var existingHtml = thisMCE.getContent(); 
    108     rcmail.html2plain(existingHtml, textAreaId); 
     110 
     111    if (existingHtml) { 
     112      if (!confirm(rcmail.get_label('editorwarning'))) { 
     113        if (select.tagName == 'SELECT') 
     114          select.value = 'html'; 
     115        return false; 
     116        } 
     117 
     118      rcmail.html2plain(existingHtml, textAreaId); 
     119      } 
     120 
    109121    tinyMCE.execCommand('mceRemoveControl', true, textAreaId); 
    110122    rcmail.display_spellcheck_controls(true); 
  • trunk/roundcubemail/program/steps/mail/compose.inc

    r3316 r3334  
    977977    $attrib['name'] = 'editorSelect'; 
    978978     
    979   $attrib['onchange'] = "return rcmail_toggle_editor(this.value=='html', '".$attrib['editorid']."', '_is_html')"; 
     979  $attrib['onchange'] = "return rcmail_toggle_editor(this, '".$attrib['editorid']."', '_is_html')"; 
    980980 
    981981  $select = new html_select($attrib); 
  • trunk/roundcubemail/program/steps/settings/edit_identity.inc

    r2755 r3334  
    7171                       'bcc'          => array('type' => 'text', 'size' => $i_size), 
    7272                       'signature'        => array('type' => 'textarea', 'size' => $t_cols, 'rows' => $t_rows), 
    73                        'html_signature'=>array('type' => 'checkbox', 'label' => 'htmlsignature', 'onclick' => 'return rcmail_toggle_editor(this.checked, \'rcmfd_signature\');'), 
     73                       'html_signature'=>array('type' => 'checkbox', 'label' => 'htmlsignature', 'onclick' => 'return rcmail_toggle_editor(this, \'rcmfd_signature\');'), 
    7474                       'standard'     => array('type' => 'checkbox', 'label' => 'setdefault')); 
    7575 
Note: See TracChangeset for help on using the changeset viewer.