Add shortcuts for saving
This commit is contained in:
@ -4,6 +4,8 @@ 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 push_event = true
|
||||
@ -11,6 +13,13 @@ let TranslationFormHook = {
|
||||
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() }
|
||||
@ -36,7 +45,7 @@ let TranslationFormHook = {
|
||||
this.pushEventTo(this.el, handler, payload, postaction)
|
||||
}
|
||||
}
|
||||
// console.info(["keyupHandler", e, this])
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user