mirror of https://github.com/zulip/zulip.git
input pill: Backspace deletes pills if caret is at start of input.
This allows deleting the last pill by the backspace key, even if there is text input present.
This commit is contained in:
parent
1e0340e0a3
commit
b57ebe717e
|
@ -266,7 +266,8 @@ exports.create = function (opts) {
|
||||||
|
|
||||||
// if the user backspaces and there is input, just do normal char
|
// if the user backspaces and there is input, just do normal char
|
||||||
// deletion, otherwise delete the last pill in the sequence.
|
// deletion, otherwise delete the last pill in the sequence.
|
||||||
if (char === KEY.BACKSPACE && funcs.value(e.target).length === 0) {
|
if (char === KEY.BACKSPACE && (
|
||||||
|
funcs.value(e.target).length === 0 || window.getSelection().anchorOffset === 0)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
funcs.removeLastPill();
|
funcs.removeLastPill();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue