Fix ugly bug and add more shortcuts

This commit is contained in:
Thelonius Kort
2023-03-05 22:05:54 +01:00
parent e20f8e33ee
commit 5d9238a65a

View File

@ -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,10 +28,14 @@ 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)
}
}
// console.info(["keyupHandler", e, this])
},
}