fix: codemirror util

This commit is contained in:
2026-03-12 20:23:39 +01:00
parent e9ed508bfc
commit 35b2e9d538
4 changed files with 94 additions and 85 deletions

View File

@@ -59,6 +59,15 @@ export type AbstractNodeContext<TData = Record<string, unknown>> = {
targetIds: string[]
}
/** Returns nodes that are connected to this node (in sourceIds) and have the given type. */
export function getConnectedNodesByType<T extends FlowNode = FlowNode>(
nodes: FlowNode[],
sourceIds: string[],
type: string
): T[] {
return nodes.filter((n) => sourceIds.includes(n.id) && n.type === type) as T[]
}
// ---------------------------------------------------------------------------
// Hook
// ---------------------------------------------------------------------------