Elastic: Fix bug where use of Tab key on autocomplete causes double insertion into a recipient input (#6850)

pull/6861/head
Aleksander Machniak 5 years ago
parent 5baa8981ea
commit fbe36c7f5a

@ -3109,13 +3109,9 @@ function rcube_elastic_ui()
insert_recipient(this.name, this.email); insert_recipient(this.name, this.email);
}); });
// setTimeout() here is needed for proper input reset on paste event input.val(result.text);
// This is also the reason why we need parse_lock apply_func();
setTimeout(function() { input_len_update();
input.val(result.text);
apply_func();
input_len_update();
}, 1);
return result.recipients.length > 0; return result.recipients.length > 0;
}, },
@ -3129,6 +3125,7 @@ function rcube_elastic_ui()
paste = (e.originalEvent.clipboardData || window.clipboardData).getData('text') || ''; paste = (e.originalEvent.clipboardData || window.clipboardData).getData('text') || '';
// insert pasted text in place of the selection (or just cursor position) // insert pasted text in place of the selection (or just cursor position)
value = value.substring(0, this.selectionStart) + paste + value.substring(this.selectionEnd); value = value.substring(0, this.selectionStart) + paste + value.substring(this.selectionEnd);
e.preventDefault();
} }
update_func(value); update_func(value);

Loading…
Cancel
Save