diff options
author | Aleksander Machniak <alec@alec.pl> | 2020-02-26 22:16:12 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2020-03-01 12:57:50 +0300 |
commit | 81e55f8033dd3389dc95cd132ef4699705414b23 (patch) | |
tree | 5cd6844b6ac46a09499a1fbb776ee6a4a1f7db4b /skins | |
parent | 1c5f83d41cccefa3e54ae2c752a534fe51136a64 (diff) |
Elastic: Fix recipient input bug when using click to select a contact from autocomplete list (#7231)
Diffstat (limited to 'skins')
-rw-r--r-- | skins/elastic/ui.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index 606cfbaa2..e63f6b225 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -3173,8 +3173,8 @@ function rcube_elastic_ui() return result.recipients.length > 0; }, - parse_func = function(e) { - var paste, value = this.value; + parse_func = function(e, ac) { + var last, paste, value = this.value; // On paste the text is not yet in the input we have to use clipboard. // Also because on paste new-line characters are replaced by spaces (#6460) @@ -3185,6 +3185,16 @@ function rcube_elastic_ui() value = value.substring(0, this.selectionStart) + paste + value.substring(this.selectionEnd); e.preventDefault(); } + // #7231: When clicking on autocompletion list a change event + // is fired twice. We have to remove last recipient box if it is + // the same recpient (with incomplete email address). + // FIXME: Anyone with a better solution? + else if (ac) { + last = list.find('li.recipient').last(); + if (last.length && this.value.indexOf(last.text().replace(/[ ,]+$/, '')) > -1) { + last.remove(); + } + } update_func(value); }, |