From 5d9238a65ac0d648d27e22b783e1606c76ae9f82 Mon Sep 17 00:00:00 2001 From: Thelonius Kort Date: Sun, 5 Mar 2023 22:05:54 +0100 Subject: [PATCH] Fix ugly bug and add more shortcuts --- assets/js/translation-form.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/js/translation-form.js b/assets/js/translation-form.js index cfc0b5a..a2450b2 100644 --- a/assets/js/translation-form.js +++ b/assets/js/translation-form.js @@ -6,15 +6,16 @@ let TranslationFormHook = { this.tunit_editor = this.el.querySelector("#tunit-editor-content") }, keyupHandler(e) { + var donothing = false var preaction = () => { } var postaction = () => { } var payload = {} if (e.altKey){ - if (e.key == "ArrowDown"){ + if (e.key == "ArrowDown" || e.key == "n"){ preaction = () => { this.title_input.focus() } postaction = () => { this.tunit_editor.focus() } var handler = "select_next_tunit" - } else if (e.key == "ArrowUp"){ + } else if (e.key == "ArrowUp" || e.key == "v"){ preaction = () => { this.title_input.focus() } postaction = () => { this.tunit_editor.focus() } var handler = "select_previous_tunit" @@ -27,9 +28,13 @@ let TranslationFormHook = { } else if (e.key == "o") { var handler = "tunit_status" payload = {status: "done"} + } else { + donothing = true + } + if (!donothing) { + preaction.call() + this.pushEventTo(this.el, handler, payload, postaction) } - preaction.call() - this.pushEventTo(this.el, handler, payload, postaction) } // console.info(["keyupHandler", e, this]) },