Thomas Bruederli
2013-11-08 7863921d53cd301afb394d2c7b9b0e5cbe063db8
Adjust recipients textarea size according to conent.
This reduces the height to 1 row on Firefox < 25 which renders textareas rows+1 heigh (#1489198)
1 files modified
15 ■■■■■ changed files
skins/larry/ui.js 15 ●●●●● patch | view | raw | blame | history
skins/larry/ui.js
@@ -113,7 +113,6 @@
        rcmail.addEventListener('aftertoggle-editor', function(){ window.setTimeout(function(){ layout_composeview() }, 200); });
        rcmail.addEventListener('aftersend-attachment', show_uploadform);
        rcmail.addEventListener('add-recipient', function(p){ show_header_row(p.field, true); });
        layout_composeview();
        // Show input elements with non-empty value
        var f, v, field, fields = ['cc', 'bcc', 'replyto', 'followupto'];
@@ -132,6 +131,10 @@
          layout_composeview();
          return false;
        }).css('cursor', 'pointer');
        // adjust hight when textarea starts to scroll
        $("textarea[name='_to'], textarea[name='_cc'], textarea[name='_bcc']").change(function(e){ adjust_compose_editfields(this); }).change();
        rcmail.addEventListener('autocomplete_insert', function(p){ adjust_compose_editfields(p.field); });
        // toggle compose options if opened in new window and they were visible before
        var opener_rc = rcmail.opener();
@@ -428,6 +431,16 @@
    // STUB
  }
  function adjust_compose_editfields(elem)
  {
    if (elem.nodeName == 'TEXTAREA') {
      var $elem = $(elem), line_height = 14,  // hard-coded because some browsers only provide the outer height in elem.clientHeight
        content_height = elem.scrollHeight,
        rows = elem.value.length > 80 && content_height > line_height*1.5 ? 2 : 1;
      $elem.css('height', (line_height*rows) + 'px');
      layout_composeview();
    }
  }
  function layout_composeview()
  {