summaryrefslogtreecommitdiff
path: root/skins/larry/ui.js
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2013-11-08 14:06:09 +0100
committerThomas Bruederli <thomas@roundcube.net>2013-11-08 14:06:31 +0100
commit7863921d53cd301afb394d2c7b9b0e5cbe063db8 (patch)
treed0b0a41d979f147b57c8d40c0dd8dd1366264230 /skins/larry/ui.js
parent7a98df91854ddf0a979386fdbb38d89b26f4c562 (diff)
Adjust recipients textarea size according to conent.
This reduces the height to 1 row on Firefox < 25 which renders textareas rows+1 heigh (#1489198)
Diffstat (limited to 'skins/larry/ui.js')
-rw-r--r--skins/larry/ui.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index 0fd0241f7..660b18ff9 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -113,7 +113,6 @@ function rcube_mail_ui()
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'];
@@ -133,6 +132,10 @@ function rcube_mail_ui()
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();
if (opener_rc && opener_rc.env.action == 'compose' && $('#composeoptionstoggle', opener.document).hasClass('remove'))
@@ -428,6 +431,16 @@ function rcube_mail_ui()
// 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()
{