X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/f69ff5261a6e77cfba0daf8eb4c164d0c57c2602..262705dd315ec4bf7088cc3ec9013dc32f3e3bd3:/vopamoi.ts?ds=sidebyside diff --git a/vopamoi.ts b/vopamoi.ts index 2567e85..505781d 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -22,15 +22,27 @@ const Model = { }, }; +const Log = { + addTask: function (description: string) { + Model.addTask(description); + }, +}; + function handleKey(event: any) { 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) { + Log.addTask(form.taskName.value); + } form.taskName.value = ""; return false; }