fix(handle): check if source or target exist

This commit is contained in:
moklick
2021-03-21 17:15:23 +01:00
parent 2cbd50c23e
commit 2ddc5505a3
+3 -2
View File
@@ -99,9 +99,10 @@ export function onMouseDown(
): void {
const reactFlowNode = (event.target as Element).closest('.react-flow');
const elementBelow = document.elementFromPoint(event.clientX, event.clientY);
const elementBelowIsTarget = elementBelow?.classList.contains('target') || false;
const elementBelowIsTarget = elementBelow?.classList.contains('target');
const elementBelowIsSource = elementBelow?.classList.contains('source');
if (!reactFlowNode) {
if (!reactFlowNode || (!elementBelowIsTarget && !elementBelowIsSource)) {
return;
}