mirror of
https://github.com/logseq/logseq.git
synced 2026-05-27 14:14:24 +00:00
fix: clear keybindings after exit whiteboard
This commit is contained in:
@@ -184,8 +184,21 @@ export class TLApp<
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const shortcuts = (this.constructor['shortcuts'] || []) as TLShortcut<S, K>[]
|
||||
const childrenShortcuts = Array.from(this.children.values())
|
||||
// @ts-expect-error ???
|
||||
.filter(c => c.constructor['shortcut'])
|
||||
.map(child => {
|
||||
return {
|
||||
// @ts-expect-error ???
|
||||
keys: child.constructor['shortcut'] as string | string[],
|
||||
fn: (_: any, __: any, e: Event) => {
|
||||
this.transition(child.id)
|
||||
e.stopPropagation()
|
||||
},
|
||||
}
|
||||
})
|
||||
this._disposables.push(
|
||||
...[...ownShortcuts, ...shortcuts].map(({ keys, fn }) => {
|
||||
...[...ownShortcuts, ...shortcuts, ...childrenShortcuts].map(({ keys, fn }) => {
|
||||
return KeyUtils.registerShortcut(keys, e => {
|
||||
fn(this, this, e)
|
||||
})
|
||||
|
||||
@@ -417,16 +417,6 @@ export abstract class TLState<
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const shortcut = this.constructor['shortcut'] as string
|
||||
if (shortcut) {
|
||||
KeyUtils.registerShortcut(shortcut, e => {
|
||||
this.parent.transition(this.id)
|
||||
e.stopPropagation()
|
||||
})
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const shortcuts = this.constructor['shortcuts'] as TLShortcut<S, K>[]
|
||||
|
||||
@@ -26,7 +26,7 @@ export class KeyUtils {
|
||||
}
|
||||
Mousetrap.bind(keys, fn, 'keydown')
|
||||
return () => {
|
||||
Mousetrap.unbind(keys)
|
||||
Mousetrap.unbind(keys, 'keydown')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user