add ctrl-enter submit

This commit is contained in:
2023-11-04 22:40:56 -04:00
parent 03021614b5
commit 1b49b668b3
17 changed files with 102 additions and 82 deletions

12
assets/js/ctrlenter.js Normal file
View File

@@ -0,0 +1,12 @@
export default {
addFormSubmit (context) {
context.el.addEventListener('keydown', (e) => {
if (e.ctrlKey && e.key === 'Enter') {
context.el.dispatchEvent(
new Event('submit', { bubbles: true, cancelable: true }))
}
})
},
mounted () { this.addFormSubmit(this) },
updated () { this.addFormSubmit(this) }
}