🐛 (editor) Fix dragging locked when window is blurred while pressing keys
Closes #1311
This commit is contained in:
@@ -23,7 +23,6 @@ import { isSelectBoxIntersectingWithElement } from '../helpers/isSelectBoxInters
|
|||||||
import { useGroupsStore } from '../hooks/useGroupsStore'
|
import { useGroupsStore } from '../hooks/useGroupsStore'
|
||||||
import { useShallow } from 'zustand/react/shallow'
|
import { useShallow } from 'zustand/react/shallow'
|
||||||
import { projectMouse } from '../helpers/projectMouse'
|
import { projectMouse } from '../helpers/projectMouse'
|
||||||
import { useKeyboardShortcuts } from '@/hooks/useKeyboardShortcuts'
|
|
||||||
import { useUser } from '@/features/account/hooks/useUser'
|
import { useUser } from '@/features/account/hooks/useUser'
|
||||||
import { GraphNavigation } from '@typebot.io/prisma'
|
import { GraphNavigation } from '@typebot.io/prisma'
|
||||||
|
|
||||||
@@ -305,8 +304,6 @@ export const Graph = ({
|
|||||||
setAutoMoveDirection(undefined)
|
setAutoMoveDirection(undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
useKeyboardShortcuts({})
|
|
||||||
|
|
||||||
useEventListener('keydown', (e) => {
|
useEventListener('keydown', (e) => {
|
||||||
if (e.key === ' ') setIsDraggingGraph(true)
|
if (e.key === ' ') setIsDraggingGraph(true)
|
||||||
})
|
})
|
||||||
@@ -317,6 +314,16 @@ export const Graph = ({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
useEventListener(
|
||||||
|
'blur',
|
||||||
|
() => {
|
||||||
|
setIsDraggingGraph(false)
|
||||||
|
setIsDragging(false)
|
||||||
|
},
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
window as any
|
||||||
|
)
|
||||||
|
|
||||||
useEventListener('mousedown', handleCaptureMouseDown, undefined, {
|
useEventListener('mousedown', handleCaptureMouseDown, undefined, {
|
||||||
capture: true,
|
capture: true,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user