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 () {
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();
}