const task = this.getTask(createTimestamp);
task!.parentElement!.removeChild(task!);
},
-
- moveCursor: function (offset: number): boolean {
- var active = document.activeElement;
- if (offset === 1 && active) {
- active = active.nextElementSibling;
- }
- if (offset === -1 && active) {
- active = active.previousElementSibling;
- }
- if (active && active instanceof HTMLElement) {
- active.focus();
- return true;
- }
- return false;
- },
};
const Log = (function () {
}
return false;
},
+
destroyTask: function () {
const createTimestamp = document.activeElement?.getAttribute("data-created");
return createTimestamp && UI.destroyTask(createTimestamp);
},
-};
-function focusTaskNameInput(event: any) {
- document.getElementById("taskName")!.focus();
- event.preventDefault();
-}
+ focusTaskNameInput: function (event: any) {
+ document.getElementById("taskName")!.focus();
+ event.preventDefault();
+ },
+
+ moveCursor: function (offset: number): boolean {
+ var active = document.activeElement;
+ if (offset === 1 && active) {
+ active = active.nextElementSibling;
+ }
+ if (offset === -1 && active) {
+ active = active.previousElementSibling;
+ }
+ if (active && active instanceof HTMLElement) {
+ active.focus();
+ return true;
+ }
+ return false;
+ },
+};
function handleKey(event: any) {
if (event.target.tagName !== "INPUT") {
- if (event.key == "j") return Model.moveCursor(1);
- if (event.key == "k") return Model.moveCursor(-1);
- if (event.key == "c") return focusTaskNameInput(event);
+ if (event.key == "j") return BrowserUI.moveCursor(1);
+ if (event.key == "k") return BrowserUI.moveCursor(-1);
+ if (event.key == "c") return BrowserUI.focusTaskNameInput(event);
if (event.key == "X") return BrowserUI.destroyTask();
}
}