X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/fb19ac80ac51baf83c7f5d007586212e0bc0868e..0726872b8e043c19883d26492ce42d3411505179:/vopamoi.ts diff --git a/vopamoi.ts b/vopamoi.ts index 6519cbf..c17a2f0 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -119,6 +119,14 @@ const Model = { } }, + removeTag: function (createTimestamp: string, tagName: string) { + const task = this.getTask(createTimestamp); + if (!task) return null; + const tag = this.hasTag(task, tagName); + if (!tag) return; + task.removeChild(tag); + }, + setPriority: function (createTimestamp: string, priority: number): Element | null { const target = this.getTask(createTimestamp); if (!target) return null; @@ -165,6 +173,10 @@ function Log(prefix: string = "vp-") { const [createTimestamp, tag] = splitN(data, " ", 1); return Model.addTag(createTimestamp, tag); } + if (command == "Untag") { + const [createTimestamp, tag] = splitN(data, " ", 1); + return Model.removeTag(createTimestamp, tag); + } }, record: function (entry: string) { @@ -199,7 +211,7 @@ function UI() { return log.recordAndApply(`${now} Create ${description}`); }, addTag: function (createTimestamp: string, tag: string) { - // TODO: undo + undoLog.push(`Untag ${createTimestamp} ${tag}`); return log.recordAndApply(`${clock.now()} Tag ${createTimestamp} ${tag}`); }, edit: function (createTimestamp: string, newDescription: string, oldDescription: string) { @@ -457,6 +469,7 @@ function handleKey(event: any) { if (event.key == "d") return browserUI.setView("done", "LawnGreen"); if (event.key == "q") return browserUI.setView("todo", "White"); if (event.key == "s") return browserUI.setView("someday-maybe", "DeepSkyBlue"); + if (event.key == "v") return browserUI.setView("todo", "White"); if (event.key == "w") return browserUI.setView("waiting", "MediumOrchid"); if (event.key == "x") return browserUI.setView("deleted", "Black"); }