Partially revert #2215
This fixes the issues mentioned on https://forums.ankiweb.net/t/anki-2-1-55-beta-5/24870/78 I can't seem to reproduce the extra tag being added when auto-completing anymore, but perhaps I'm just not getting the steps right.
This commit is contained in:
parent
7f5e3c8106
commit
ed45adcb08
@ -125,15 +125,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||||||
export function appendEmptyTag(): void {
|
export function appendEmptyTag(): void {
|
||||||
// used by tag badge and tag spacer
|
// used by tag badge and tag spacer
|
||||||
deselect();
|
deselect();
|
||||||
const tagsHadFocus = active === null;
|
|
||||||
active = null;
|
|
||||||
|
|
||||||
const lastTag = tagTypes[tagTypes.length - 1];
|
const lastTag = tagTypes[tagTypes.length - 1];
|
||||||
|
|
||||||
if (!lastTag || lastTag.name.length > 0) {
|
if (!lastTag || lastTag.name.length > 0) {
|
||||||
appendTagAndFocusAt(tagTypes.length - 1, "");
|
appendTagAndFocusAt(tagTypes.length - 1, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tagsHadFocus = active === null;
|
||||||
|
active = null;
|
||||||
|
|
||||||
if (tagsHadFocus) {
|
if (tagsHadFocus) {
|
||||||
decideNextActive();
|
decideNextActive();
|
||||||
}
|
}
|
||||||
@ -163,11 +163,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||||||
const splitOff = activeName.slice(end);
|
const splitOff = activeName.slice(end);
|
||||||
|
|
||||||
activeName = current;
|
activeName = current;
|
||||||
active = null;
|
|
||||||
// await tag to update its name, so it can normalize correctly
|
// await tag to update its name, so it can normalize correctly
|
||||||
await tick();
|
await tick();
|
||||||
|
|
||||||
appendTagAndFocusAt(index, splitOff);
|
appendTagAndFocusAt(index, splitOff);
|
||||||
|
active = null;
|
||||||
await tick();
|
await tick();
|
||||||
|
|
||||||
if (index === active) {
|
if (index === active) {
|
||||||
@ -292,6 +292,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "Enter":
|
case "Enter":
|
||||||
|
autocomplete.chooseSelected();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user