From: Scott Worley Date: Thu, 27 Jan 2022 20:10:11 +0000 (-0800) Subject: Use previous tag name as default new tag name X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/09cd65ad6907a157c1907c6b30325e31128e0267?ds=inline Use previous tag name as default new tag name This makes tagging a bunch of tasks with the same tag easier. --- diff --git a/vopamoi.ts b/vopamoi.ts index 3b2f163..a6f85f2 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -215,6 +215,7 @@ enum CommitOrAbort { function BrowserUI() { var currentViewState = "todo"; var taskFocusedBeforeJumpingToInput: HTMLElement | null = null; + var lastTagNameEntered = ""; return { addTask: function (event: KeyboardEvent) { const input = document.getElementById("taskName"); @@ -253,8 +254,10 @@ function BrowserUI() { const input = document.createElement("input"); input.classList.add("tag"); input.addEventListener("blur", this.completeTagEdit, { once: true }); + input.value = lastTagNameEntered; task.appendChild(input); input.focus(); + input.select(); event.preventDefault(); }, @@ -283,6 +286,7 @@ function BrowserUI() { task.focus(); if (!Model.hasTag(task, newTagName)) { ui.addTag(task.getAttribute("data-created")!, newTagName); + lastTagNameEntered = newTagName; } },