diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-05-24 14:54:18 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-05-24 14:55:02 +0200 |
commit | 40d1f99cb2cb12631e2456bf4b5785500f599ffa (patch) | |
tree | ac0216e3c220b0706c8e5ff7e445b8a9221a363f /program | |
parent | 1a9d466ef31deba9a0d3bbe9e1e47351cbda976c (diff) |
Fix handling of comma when adding contact from contacts widget (#1489107)
Diffstat (limited to 'program')
-rw-r--r-- | program/js/app.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/program/js/app.js b/program/js/app.js index 7bdd98a61..d58a8f4fa 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3129,7 +3129,7 @@ function rcube_webmail() this.compose_add_recipient = function(field) { - var recipients = [], input = $('#_'+field); + var recipients = [], input = $('#_'+field), delim = this.env.recipients_delimiter; if (this.contact_list && this.contact_list.selection.length) { for (var id, n=0; n < this.contact_list.selection.length; n++) { @@ -3148,8 +3148,10 @@ function rcube_webmail() } if (recipients.length && input.length) { - var oldval = input.val(); - input.val((oldval ? oldval + this.env.recipients_delimiter : '') + recipients.join(this.env.recipients_delimiter)); + var oldval = input.val(), rx = new RegExp(RegExp.escape(delim) + '\\s*$'); + if (oldval && !rx.test(oldval)) + oldval += delim + ' '; + input.val(oldval + recipients.join(delim + ' ') + delim + ' '); this.triggerEvent('add-recipient', { field:field, recipients:recipients }); } }; |