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")
|
this.tunit_editor = this.el.querySelector("#tunit-editor-content")
|
||||||
},
|
},
|
||||||
keyupHandler(e) {
|
keyupHandler(e) {
|
||||||
|
var donothing = false
|
||||||
var preaction = () => { }
|
var preaction = () => { }
|
||||||
var postaction = () => { }
|
var postaction = () => { }
|
||||||
var payload = {}
|
var payload = {}
|
||||||
if (e.altKey){
|
if (e.altKey){
|
||||||
if (e.key == "ArrowDown"){
|
if (e.key == "ArrowDown" || e.key == "n"){
|
||||||
preaction = () => { this.title_input.focus() }
|
preaction = () => { this.title_input.focus() }
|
||||||
postaction = () => { this.tunit_editor.focus() }
|
postaction = () => { this.tunit_editor.focus() }
|
||||||
var handler = "select_next_tunit"
|
var handler = "select_next_tunit"
|
||||||
} else if (e.key == "ArrowUp"){
|
} else if (e.key == "ArrowUp" || e.key == "v"){
|
||||||
preaction = () => { this.title_input.focus() }
|
preaction = () => { this.title_input.focus() }
|
||||||
postaction = () => { this.tunit_editor.focus() }
|
postaction = () => { this.tunit_editor.focus() }
|
||||||
var handler = "select_previous_tunit"
|
var handler = "select_previous_tunit"
|
||||||
@ -27,10 +28,14 @@ let TranslationFormHook = {
|
|||||||
} else if (e.key == "o") {
|
} else if (e.key == "o") {
|
||||||
var handler = "tunit_status"
|
var handler = "tunit_status"
|
||||||
payload = {status: "done"}
|
payload = {status: "done"}
|
||||||
|
} else {
|
||||||
|
donothing = true
|
||||||
}
|
}
|
||||||
|
if (!donothing) {
|
||||||
preaction.call()
|
preaction.call()
|
||||||
this.pushEventTo(this.el, handler, payload, postaction)
|
this.pushEventTo(this.el, handler, payload, postaction)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// console.info(["keyupHandler", e, this])
|
// console.info(["keyupHandler", e, this])
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user