mirror of https://github.com/logseq/logseq
fix: keybindings should only be activated when whiteboard is focused
parent
7606fa1c04
commit
880d7b02c8
|
@ -10,13 +10,17 @@ export function useKeyboardEvents(ref: React.RefObject<HTMLDivElement>) {
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const onKeyDown: TLReactCustomEvents['keyboard'] = e => {
|
const onKeyDown: TLReactCustomEvents['keyboard'] = e => {
|
||||||
callbacks.onKeyDown?.({ type: TLTargetType.Canvas, order: -1 }, e)
|
if (ref.current?.contains(document.activeElement)) {
|
||||||
shiftKeyDownRef.current = e.shiftKey
|
callbacks.onKeyDown?.({ type: TLTargetType.Canvas, order: -1 }, e)
|
||||||
|
shiftKeyDownRef.current = e.shiftKey
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onKeyUp: TLReactCustomEvents['keyboard'] = e => {
|
const onKeyUp: TLReactCustomEvents['keyboard'] = e => {
|
||||||
callbacks.onKeyUp?.({ type: TLTargetType.Canvas, order: -1 }, e)
|
if (ref.current?.contains(document.activeElement)) {
|
||||||
shiftKeyDownRef.current = e.shiftKey
|
callbacks.onKeyUp?.({ type: TLTargetType.Canvas, order: -1 }, e)
|
||||||
|
shiftKeyDownRef.current = e.shiftKey
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onPaste = (e: ClipboardEvent) => {
|
const onPaste = (e: ClipboardEvent) => {
|
||||||
|
|
Loading…
Reference in New Issue