fix: codemirror util
This commit is contained in:
@@ -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
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user