X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/3916a89c8a391d43c8160409862bcba18259f659..634868c9a2d36621da56cc6be8a863b5e90db941:/vopamoi.ts diff --git a/vopamoi.ts b/vopamoi.ts index 3b2f163..d0f4fa1 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(); }, @@ -281,8 +284,9 @@ function BrowserUI() { input.removeEventListener("blur", this.completeTagEdit); task.removeChild(input); task.focus(); - if (!Model.hasTag(task, newTagName)) { + if (resolution === CommitOrAbort.Commit && newTagName && !Model.hasTag(task, newTagName)) { ui.addTag(task.getAttribute("data-created")!, newTagName); + lastTagNameEntered = newTagName; } },