};
const BrowserUI = {
- addTask: function () {
+ addTask: function (event: KeyboardEvent) {
const input = <HTMLInputElement>document.getElementById("taskName");
if (input.value) {
const task = UI.addTask(input.value);
input.value = "";
+ if (event.getModifierState("Control")) {
+ this.setPriority(task, null, document.getElementsByClassName("task")[0]);
+ }
}
},
return UI.destroyTask(createTimestamp!);
},
- focusTaskNameInput: function (event: any) {
+ focusTaskNameInput: function (event: Event) {
document.getElementById("taskName")!.focus();
event.preventDefault();
},
function handleKey(event: any) {
if (event.target.tagName === "INPUT") {
- if (event.key == "Enter") return BrowserUI.addTask();
+ if (event.key == "Enter") return BrowserUI.addTask(event);
} else {
if (event.key == "j") return BrowserUI.moveCursor(1);
if (event.key == "k") return BrowserUI.moveCursor(-1);