Fix ugly bug and add more shortcuts
This commit is contained in:
@ -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])
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user