Compare commits
2 Commits
5d9238a65a
...
459c8e6a57
| Author | SHA1 | Date | |
|---|---|---|---|
| 459c8e6a57 | |||
| 21b97bec6e |
@ -4,13 +4,22 @@ let TranslationFormHook = {
|
||||
this.el.addEventListener("keyup", this.keyupHandler.bind(this))
|
||||
this.title_input = this.el.querySelector("#translation-form_title")
|
||||
this.tunit_editor = this.el.querySelector("#tunit-editor-content")
|
||||
this.save_edit_button = this.el.querySelector("#save-edit-button")
|
||||
this.save_publish_button = this.el.querySelector("#save-publish-button")
|
||||
},
|
||||
keyupHandler(e) {
|
||||
var donothing = false
|
||||
var push_event = true
|
||||
var preaction = () => { }
|
||||
var postaction = () => { }
|
||||
var payload = {}
|
||||
if (e.altKey){
|
||||
if (e.ctrlKey){
|
||||
if (e.key == "s"){
|
||||
this.save_edit_button.click()
|
||||
} else if (e.key == "p"){
|
||||
this.save_publish_button.click()
|
||||
}
|
||||
} else {
|
||||
if (e.key == "ArrowDown" || e.key == "n"){
|
||||
preaction = () => { this.title_input.focus() }
|
||||
postaction = () => { this.tunit_editor.focus() }
|
||||
@ -29,14 +38,14 @@ let TranslationFormHook = {
|
||||
var handler = "tunit_status"
|
||||
payload = {status: "done"}
|
||||
} else {
|
||||
donothing = true
|
||||
push_event = false
|
||||
}
|
||||
if (!donothing) {
|
||||
if (push_event) {
|
||||
preaction.call()
|
||||
this.pushEventTo(this.el, handler, payload, postaction)
|
||||
}
|
||||
}
|
||||
// console.info(["keyupHandler", e, this])
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user