From ed1f3853b4aad22e98c5ec248a3e98cc939f1669 Mon Sep 17 00:00:00 2001 From: Bogdan Abaev Date: Mon, 17 Jun 2024 14:17:59 -0400 Subject: [PATCH] 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. --- chrome/content/zotero/elements/tagsBox.js | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/chrome/content/zotero/elements/tagsBox.js b/chrome/content/zotero/elements/tagsBox.js index b7e6974923..10afb07408 100644 --- a/chrome/content/zotero/elements/tagsBox.js +++ b/chrome/content/zotero/elements/tagsBox.js @@ -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();