X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/9f6be65ee10f3cfd4ad55b7326e8fb35fc78151a..da9a271623620d92a82608592d65fc2e4ca08491:/vopamoi.ts?ds=inline diff --git a/vopamoi.ts b/vopamoi.ts index a98a29b..e997d1c 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -213,12 +213,14 @@ const BrowserUI = { task instanceof HTMLElement && task.focus(); }, - setState: function (state: string) { + setState: function (newState: string) { const task = document.activeElement; if (!task) return; + const oldState = Model.getState(task); + if (newState === oldState) return; const createTimestamp = task.getAttribute("data-created")!; this.moveCursor(1) || this.moveCursor(-1); - return UI.setState(createTimestamp, state, Model.getState(task)); + return UI.setState(createTimestamp, newState, oldState); }, undo: function () { @@ -240,6 +242,7 @@ function handleKey(event: any) { if (event.key == "w") return BrowserUI.setState("waiting"); if (event.key == "d") return BrowserUI.setState("done"); if (event.key == "c") return BrowserUI.setState("cancelled"); + if (event.key == "t") return BrowserUI.setState("todo"); if (event.key == "X") return BrowserUI.setState("deleted"); if (event.key == "u") return BrowserUI.undo(); }