mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
fix preventDefault
This commit is contained in:
parent
3586ba9d8b
commit
8b165ae8d3
@ -286,6 +286,7 @@ class App {
|
|||||||
window.app.ShortcutsController.register({
|
window.app.ShortcutsController.register({
|
||||||
key: ",",
|
key: ",",
|
||||||
meta: true,
|
meta: true,
|
||||||
|
preventDefault: true,
|
||||||
}, (...args) => {
|
}, (...args) => {
|
||||||
App.publicMethods.openSettings(...args)
|
App.publicMethods.openSettings(...args)
|
||||||
})
|
})
|
||||||
@ -293,6 +294,7 @@ class App {
|
|||||||
window.app.ShortcutsController.register({
|
window.app.ShortcutsController.register({
|
||||||
key: ",",
|
key: ",",
|
||||||
ctrl: true,
|
ctrl: true,
|
||||||
|
preventDefault: true,
|
||||||
}, (...args) => {
|
}, (...args) => {
|
||||||
App.publicMethods.openSettings(...args)
|
App.publicMethods.openSettings(...args)
|
||||||
})
|
})
|
||||||
|
@ -8,8 +8,6 @@ export class ShortcutsController {
|
|||||||
const shortcut = this.shortcuts[key]
|
const shortcut = this.shortcuts[key]
|
||||||
|
|
||||||
if (shortcut) {
|
if (shortcut) {
|
||||||
event.preventDefault()
|
|
||||||
|
|
||||||
if (typeof shortcut.ctrl === "boolean" && event.ctrlKey !== shortcut.ctrl) {
|
if (typeof shortcut.ctrl === "boolean" && event.ctrlKey !== shortcut.ctrl) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -17,14 +15,18 @@ export class ShortcutsController {
|
|||||||
if (typeof shortcut.shift === "boolean" && event.shiftKey !== shortcut.shift) {
|
if (typeof shortcut.shift === "boolean" && event.shiftKey !== shortcut.shift) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof shortcut.alt === "boolean" && event.altKey !== shortcut.alt) {
|
if (typeof shortcut.alt === "boolean" && event.altKey !== shortcut.alt) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof shortcut.meta === "boolean" && event.metaKey !== shortcut.meta) {
|
if (typeof shortcut.meta === "boolean" && event.metaKey !== shortcut.meta) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shortcut.preventDefault) {
|
||||||
|
event.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof shortcut.fn === "function") {
|
if (typeof shortcut.fn === "function") {
|
||||||
shortcut.fn()
|
shortcut.fn()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user