From 0e6d97acf941600b4d1d35f90188ad1a0bd9da2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=9E=E6=B3=95=E6=93=8D=E4=BD=9C?= Date: Wed, 25 Mar 2026 17:22:21 +0800 Subject: [PATCH] fix: HumanInput node should unable to paste into container (#34077) --- .../workflow/hooks/use-nodes-interactions.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts index 8de86edecb..66237b7203 100644 --- a/web/app/components/workflow/hooks/use-nodes-interactions.ts +++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts @@ -1820,21 +1820,26 @@ export const useNodesInteractions = () => { newChildren.push(newLoopStartNode!) } else { - // single node paste + // Paste a single regular node. Loop/Iteration nodes are handled above. const selectedNode = nodes.find(node => node.selected) let pastedToNestedBlock = false if (selectedNode) { + // Keep this list aligned with availableBlocksFilter(inContainer) + // in use-available-blocks.ts. const commonNestedDisallowPasteNodes = [ - // end node only can be placed outermost layer BlockEnum.End, + BlockEnum.Iteration, + BlockEnum.Loop, + BlockEnum.DataSource, + BlockEnum.KnowledgeBase, + BlockEnum.HumanInput, ] - // handle disallow paste node if (commonNestedDisallowPasteNodes.includes(nodeToPaste.data.type)) return - // handle paste to nested block + // If a Loop/Iteration container is selected, paste into it as a child. if (selectedNode.data.type === BlockEnum.Iteration || selectedNode.data.type === BlockEnum.Loop) { const isIteration = selectedNode.data.type === BlockEnum.Iteration @@ -1849,10 +1854,10 @@ export const useNodesInteractions = () => { x: newNode.position.x, y: newNode.position.y, } - // set position base on parent node + // Rebase position into the selected container coordinate system. newNode.position = getNestedNodePosition(newNode, selectedNode) - // update parent children array like native add + // Mirror native add behavior by appending parent._children. parentChildrenToAppend.push({ parentId: selectedNode.id, childId: newNode.id, childType: newNode.data.type }) pastedToNestedBlock = true