Fix to preventDefault on all key bindings (#3075)
This commit is contained in:
@ -65,6 +65,7 @@ export default class CodeManager {
|
|||||||
this._hotkeys[key]()
|
this._hotkeys[key]()
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
|
preventDefault: true,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@ export default function useHotkeyWrapper(
|
|||||||
callback: () => void,
|
callback: () => void,
|
||||||
additionalOptions?: Options
|
additionalOptions?: Options
|
||||||
) {
|
) {
|
||||||
useHotkeys(hotkey, callback, additionalOptions)
|
const defaultOptions = { preventDefault: true }
|
||||||
|
const options = { ...defaultOptions, ...additionalOptions }
|
||||||
|
useHotkeys(hotkey, callback, options)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
for (const key of hotkey) {
|
for (const key of hotkey) {
|
||||||
const keybinding = mapHotkeyToCodeMirrorHotkey(key)
|
const keybinding = mapHotkeyToCodeMirrorHotkey(key)
|
||||||
|
Reference in New Issue
Block a user