fix(core): check if handle is connectable
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -169,6 +169,7 @@ export default function useHandle({
|
|||||||
// todo: remove `vue-flow__handle-connecting` in next major version
|
// todo: remove `vue-flow__handle-connecting` in next major version
|
||||||
handleDomNode.classList.add('connecting', 'vue-flow__handle-connecting')
|
handleDomNode.classList.add('connecting', 'vue-flow__handle-connecting')
|
||||||
handleDomNode.classList.toggle('valid', isValid)
|
handleDomNode.classList.toggle('valid', isValid)
|
||||||
|
// todo: remove this in next major version
|
||||||
handleDomNode.classList.toggle('vue-flow__handle-valid', isValid)
|
handleDomNode.classList.toggle('vue-flow__handle-valid', isValid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export function isValidHandle(
|
|||||||
connection: { source: '', target: '', sourceHandle: null, targetHandle: null },
|
connection: { source: '', target: '', sourceHandle: null, targetHandle: null },
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handleDomNode && handle) {
|
if (handleToCheck && handleDomNode && handle) {
|
||||||
const handleNodeId = handleDomNode.getAttribute('data-nodeid')
|
const handleNodeId = handleDomNode.getAttribute('data-nodeid')
|
||||||
const handleId = handleDomNode.getAttribute('data-handleid')
|
const handleId = handleDomNode.getAttribute('data-handleid')
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ export function isValidHandle(
|
|||||||
|
|
||||||
// in strict mode we don't allow target to target or source to source connections
|
// in strict mode we don't allow target to target or source to source connections
|
||||||
const isValid =
|
const isValid =
|
||||||
connectionMode === ConnectionMode.Strict
|
handleToCheck.classList.contains('connectable') && connectionMode === ConnectionMode.Strict
|
||||||
? (isTarget && handle.type === 'source') || (!isTarget && handle.type === 'target')
|
? (isTarget && handle.type === 'source') || (!isTarget && handle.type === 'target')
|
||||||
: handleNodeId !== fromNodeId || handleId !== fromHandleId
|
: handleNodeId !== fromNodeId || handleId !== fromHandleId
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user