From bc49bd2a43688940447a54ba068474a6c47bccec Mon Sep 17 00:00:00 2001 From: zhaoying Date: Wed, 8 Apr 2026 14:17:26 +0800 Subject: [PATCH] fix(web): editor third variable init --- .../Editor/plugin/InitialValuePlugin.tsx | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx b/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx index ebccff50..8b1685ae 100644 --- a/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx +++ b/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx @@ -100,15 +100,29 @@ const InitialValuePlugin: React.FC = ({ value, options } if (match) { - const [_, nodeId, label] = match; + const [_, nodeId, rest] = match; + const restParts = rest.split('.'); + const isThreeLevel = restParts.length >= 2; + const parentLabel = isThreeLevel ? restParts.slice(0, -1).join('.') : undefined; + const label = restParts[restParts.length - 1]; - const suggestion = optionsRef.current.find(s => { + let suggestion = optionsRef.current.find(s => { if (nodeId === 'sys') { - return s.nodeData.type === 'start' && s.label === `sys.${label}` + return s.nodeData.type === 'start' && s.label === `sys.${rest}` } - return s.nodeData.id === nodeId && s.label === label + return s.nodeData.id === nodeId && s.label === rest }); + // Search in children for three-level variables (e.g. nodeId.parentLabel.label) + if (!suggestion && isThreeLevel) { + for (const s of optionsRef.current) { + if (s.nodeData.id === nodeId && s.label === parentLabel && s.children) { + const child = s.children.find(c => c.label === label); + if (child) { suggestion = child; break; } + } + } + } + if (suggestion) { paragraph.append($createVariableNode(suggestion)); } else {