fix shift-Enter tagsbox inconsistent glitches (#4231)

- remove earlier shift-Enter behavior that makes tag's
input multiline.
- shift-Enter will function just as Enter by saving the
tag and allowing focus to return to reader or itemTree.
- except after pasting multiple tags which will still turn
the tags input into a multiline field. Then, shift-enter
will add a new line, just as with any other multiline
editable-text.
This commit is contained in:
Bogdan Abaev 2024-06-17 14:17:59 -04:00 committed by Dan Stillman
parent 16a5b5b6bc
commit ed1f3853b4

View file

@ -290,24 +290,10 @@
var target = event.currentTarget;
if (event.key === 'Enter') {
var multiline = target.multiline;
// If tag's input is a multiline field, it must be right after pasting
// of multiple tags. Then, Enter adds a new line and shift-Enter will save
if (target.multiline && !event.shiftKey) return;
var empty = target.value == "";
if (event.shiftKey) {
if (!multiline) {
setTimeout(() => {
var val = target.value;
if (val !== "") {
val += "\n";
}
this.makeMultiline(target, val);
});
return;
}
// Submit
}
else if (multiline) {
return;
}
event.preventDefault();