Merge pull request #4880 from crimx/patch-2

Fix type check for all event targets
This commit is contained in:
Moritz Klack
2025-01-10 10:27:19 +01:00
committed by GitHub
10 changed files with 27 additions and 18 deletions

View File

@@ -47,7 +47,7 @@ const AddNodeOnEdgeDrop = () => {
(event) => {
if (!connectingNodeId.current) return;
const targetIsPane = (event.target as HTMLDivElement)?.classList.contains('react-flow__pane');
const targetIsPane = (event.target as Partial<Element> | null)?.classList?.contains('react-flow__pane');
if (targetIsPane && 'clientX' in event && 'clientY' in event) {
// we need to remove the wrapper bounds, in order to get the correct position

View File

@@ -33,7 +33,7 @@
if (!connectingNodeId) return;
// See of connection landed inside the flow pane
const targetIsPane = (event.target as HTMLDivElement)?.classList.contains('svelte-flow__pane');
const targetIsPane = (event.target as Partial<Element> | null)?.classList?.contains('svelte-flow__pane');
if (targetIsPane && 'clientX' in event && 'clientY' in event) {
const id = getId();
const position = {