diff --git a/ts/editor/TagEditor.svelte b/ts/editor/TagEditor.svelte index 2ef5f3562..7a3cba89a 100644 --- a/ts/editor/TagEditor.svelte +++ b/ts/editor/TagEditor.svelte @@ -50,22 +50,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html activeAfterBlur = null; } - async function addEmptyTag(): Promise { - const lastTag = tags[tags.length - 1]; - - if (lastTag.name.length === 0) { - return; - } - - const index = tags.push(attachId("")) - 1; - tags = tags; - active = index; - } - function insertEmptyTagAt(index: number): void { + /* used by tag badge and tag spacer */ tags.splice(index, 0, attachId("")); tags = tags; - setActiveAfterBlur(index); + active = index; } function appendEmptyTagAt(index: number): void { @@ -87,7 +76,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html return true; } - function enterTag(tag: TagType, index: number): void { + function enterTag(_tag: TagType, index: number): void { appendEmptyTagAt(index); } @@ -158,7 +147,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html async function moveToNextTag(tag: TagType, index: number): Promise { if (isLast(index)) { - addEmptyTag(); + if (tag.name.length !== 0) { + appendEmptyTagAt(index); + } return; } console.log("movenext", index); @@ -166,8 +157,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html active = null; activeAfterBlur = index + 1; - /* await tick(); */ - /* input.setSelectionRange(0, 0); */ + await tick(); + input.setSelectionRange(0, 0); } async function activate(index: number): Promise { @@ -185,7 +176,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
- + insertEmptyTagAt(tags.length)} /> insertEmptyTagAt(tags.length)} />