diff options
author | Aleksander Machniak <alec@alec.pl> | 2019-07-17 19:35:46 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2019-07-17 19:35:46 +0300 |
commit | 5baa8981eaace97dadc4705d2687630c33225a25 (patch) | |
tree | d4b95517d7e007a4d0b944f6a2e209a8c2b3aea8 /skins | |
parent | 7a854f1b56288c695e9406af8558bad6458c9385 (diff) |
Elastic: Fix bug in handling pasting text into a recipient input
Diffstat (limited to 'skins')
-rw-r--r-- | skins/elastic/ui.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index ad41643c8..d29e30494 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -3120,9 +3120,18 @@ function rcube_elastic_ui() return result.recipients.length > 0; }, parse_func = function(e) { + var 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) - update_func(e.type == 'paste' ? (e.originalEvent.clipboardData || window.clipboardData).getData('text') : this.value); + if (e.type == 'paste') { + // pasted text + paste = (e.originalEvent.clipboardData || window.clipboardData).getData('text') || ''; + // insert pasted text in place of the selection (or just cursor position) + value = value.substring(0, this.selectionStart) + paste + value.substring(this.selectionEnd); + } + + update_func(value); }, keydown_func = function(e) { // On Backspace remove the last recipient |