Fix to preventDefault on all key bindings (#3075)

This commit is contained in:
Jonathan Tran
2024-07-25 20:18:11 -04:00
committed by GitHub
parent e3b8807d6f
commit 029799215b
2 changed files with 4 additions and 1 deletions

View File

@ -65,6 +65,7 @@ export default class CodeManager {
this._hotkeys[key]()
return false
},
preventDefault: true,
}))
}

View File

@ -14,7 +14,9 @@ export default function useHotkeyWrapper(
callback: () => void,
additionalOptions?: Options
) {
useHotkeys(hotkey, callback, additionalOptions)
const defaultOptions = { preventDefault: true }
const options = { ...defaultOptions, ...additionalOptions }
useHotkeys(hotkey, callback, options)
useEffect(() => {
for (const key of hotkey) {
const keybinding = mapHotkeyToCodeMirrorHotkey(key)