From 09cd65ad6907a157c1907c6b30325e31128e0267 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 27 Jan 2022 12:10:11 -0800 Subject: [PATCH] Use previous tag name as default new tag name This makes tagging a bunch of tasks with the same tag easier. --- vopamoi.ts | 4 ++++ 1 file changed, 4 insertions(+) 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; } }, -- 2.44.1