fix preventDefault

This commit is contained in:
srgooglo 2022-03-15 03:11:16 +01:00
parent 3586ba9d8b
commit 8b165ae8d3
2 changed files with 8 additions and 4 deletions

View File

@ -286,6 +286,7 @@ class App {
window.app.ShortcutsController.register({
key: ",",
meta: true,
preventDefault: true,
}, (...args) => {
App.publicMethods.openSettings(...args)
})
@ -293,6 +294,7 @@ class App {
window.app.ShortcutsController.register({
key: ",",
ctrl: true,
preventDefault: true,
}, (...args) => {
App.publicMethods.openSettings(...args)
})

View File

@ -8,8 +8,6 @@ export class ShortcutsController {
const shortcut = this.shortcuts[key]
if (shortcut) {
event.preventDefault()
if (typeof shortcut.ctrl === "boolean" && event.ctrlKey !== shortcut.ctrl) {
return
}
@ -17,14 +15,18 @@ export class ShortcutsController {
if (typeof shortcut.shift === "boolean" && event.shiftKey !== shortcut.shift) {
return
}
if (typeof shortcut.alt === "boolean" && event.altKey !== shortcut.alt) {
return
}
if (typeof shortcut.meta === "boolean" && event.metaKey !== shortcut.meta) {
return
}
if (shortcut.preventDefault) {
event.preventDefault()
}
if (typeof shortcut.fn === "function") {
shortcut.fn()