},
addTask: function (description: string) {
- document.body.appendChild(this.createTask(description));
+ document.body.appendChild(this.createTask(description)).focus();
},
moveCursor: function (offset: number) {
if (event.target.tagName !== "INPUT") {
if (event.key == "j") Model.moveCursor(1);
if (event.key == "k") Model.moveCursor(-1);
+ if (event.key == "c") {
+ document.getElementById("taskName")!.focus();
+ event.preventDefault();
+ }
}
}
function browserCreateTask(form: any) {
- Model.addTask(form.taskName.value);
+ if (form.taskName.value) {
+ Model.addTask(form.taskName.value);
+ }
form.taskName.value = "";
return false;
}