From 15ef6d51b38c55dc7fa059c1eb30b3d4d9f7d9ad Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Sat, 26 Jun 2021 15:26:00 +0200 Subject: [PATCH] Improve behavior when moving towards newInput --- ts/editor/TagEditor.svelte | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ts/editor/TagEditor.svelte b/ts/editor/TagEditor.svelte index f07a7f908..e20ee8cad 100644 --- a/ts/editor/TagEditor.svelte +++ b/ts/editor/TagEditor.svelte @@ -68,7 +68,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } function deleteTagAt(index: number): void { - console.log("eyo", index); tags.splice(index, 1); tags = tags; } @@ -104,9 +103,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } async function moveToNextTag(index: number): Promise { - if (index === tags.length - 1 || tags.length === 1) { - focusNewInput(); + if (index === tags.length - 2) { return; + // TODO + } else if (index === tags.length - 1) { + tags[index].active = false; + tags = tags; + + await tick(); + focusNewInput(); } tags[index].active = false; @@ -114,7 +119,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html tags = tags; await tick(); - (document.activeElement as HTMLInputElement).setSelectionRange(0, 0); }