fix: some keybindings not working issue

pull/6345/head
Peng Xiao 2022-08-10 17:26:40 +08:00
parent 1d39fe5a54
commit e0b8e66906
2 changed files with 3 additions and 2 deletions

View File

@ -420,8 +420,9 @@ export abstract class TLState<
// @ts-ignore
const shortcut = this.constructor['shortcut'] as string
if (shortcut) {
KeyUtils.registerShortcut(shortcut, () => {
KeyUtils.registerShortcut(shortcut, e => {
this.parent.transition(this.id)
e.stopPropagation()
})
}

View File

@ -24,7 +24,7 @@ export class KeyUtils {
}
callback(keyboardEvent, combo)
}
Mousetrap.bind(keys, fn)
Mousetrap.bind(keys, fn, 'keydown')
return () => Mousetrap.unbind(keys)
}
}