summaryrefslogtreecommitdiff
path: root/program/js/app.js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-06-23 15:13:15 +0200
committerAleksander Machniak <alec@alec.pl>2014-06-23 15:13:15 +0200
commitb4cbed71b3d613b6fc471767b2e24a9a37d689a1 (patch)
tree42b4460c2b3ed5f29cc1b90b6bfa413f69094734 /program/js/app.js
parent5b231140084cdf8e69e9ed5597fdba4ba504685f (diff)
Mail compose: Selecting contact inserts recipient to previously focused input - to/cc/bcc accordingly (#1489684)
Diffstat (limited to 'program/js/app.js')
-rw-r--r--program/js/app.js13
1 files changed, 11 insertions, 2 deletions
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) {