diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-06-23 15:13:15 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-06-23 15:13:15 +0200 |
commit | b4cbed71b3d613b6fc471767b2e24a9a37d689a1 (patch) | |
tree | 42b4460c2b3ed5f29cc1b90b6bfa413f69094734 | |
parent | 5b231140084cdf8e69e9ed5597fdba4ba504685f (diff) |
Mail compose: Selecting contact inserts recipient to previously focused input - to/cc/bcc accordingly (#1489684)
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | program/js/app.js | 13 |
2 files changed, 12 insertions, 2 deletions
@@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Mail compose: Selecting contact inserts recipient to previously focused input - to/cc/bcc accordingly (#1489684) - Add option to set default message list mode - default_list_mode (#1487312) - Close "no subject" prompt with Enter key (#1489580) - Add config option to specify IMAP connection socket parameters - imap_conn_options (#1489948) diff --git a/program/js/app.js b/program/js/app.js index b4a225019..61698b83f 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -346,10 +346,10 @@ function rcube_webmail() this.contact_list .addEventListener('initrow', function(o) { ref.triggerEvent('insertrow', { cid:o.uid, row:o }); }) .addEventListener('select', function(o) { ref.compose_recipient_select(o); }) - .addEventListener('dblclick', function(o) { ref.compose_add_recipient('to'); }) + .addEventListener('dblclick', function(o) { ref.compose_add_recipient(); }) .addEventListener('keypress', function(o) { if (o.key_pressed == o.ENTER_KEY) { - if (!ref.compose_add_recipient('to')) { + if (!ref.compose_add_recipient()) { // execute link action on <enter> if not a recipient entry if (o.last_selected && String(o.last_selected).charAt(0) == 'G') { $(o.rows[o.last_selected].obj).find('a').first().click(); @@ -358,6 +358,9 @@ function rcube_webmail() } }) .init(); + + // remember last focused address field + $('#_to,#_cc,#_bcc').focus(function() { ref.env.focused_field = this; }); } if (this.gui_objects.addressbookslist) { @@ -3485,6 +3488,12 @@ function rcube_webmail() this.compose_add_recipient = function(field) { + // find last focused field name + if (!field) { + field = $(this.env.focused_field).filter(':visible'); + field = field.length ? field.attr('id').replace('_', '') : 'to'; + } + var recipients = [], input = $('#_'+field), delim = this.env.recipients_delimiter; if (this.contact_list && this.contact_list.selection.length) { |