From 23157941d1c2c8680cf46d3cfb07553c0cbe5887 Mon Sep 17 00:00:00 2001 From: ZLY Date: Fri, 24 Oct 2025 10:42:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(flowEditor):=20=E5=8A=A8=E6=80=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=8A=82=E7=82=B9=E4=B8=8A=E4=B8=8B=E6=96=87=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flowEditor/components/nodeContextMenu.tsx | 59 ++++++++++++++----- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/src/pages/flowEditor/components/nodeContextMenu.tsx b/src/pages/flowEditor/components/nodeContextMenu.tsx index b41ea2e..a739018 100644 --- a/src/pages/flowEditor/components/nodeContextMenu.tsx +++ b/src/pages/flowEditor/components/nodeContextMenu.tsx @@ -1,5 +1,5 @@ import React, { useEffect } from 'react'; -import { Menu, Dropdown } from '@arco-design/web-react'; +import { Menu } from '@arco-design/web-react'; import { Node } from '@xyflow/react'; interface NodeContextMenuProps { @@ -34,26 +34,53 @@ const NodeContextMenu: React.FC = ({ const handleEdit = () => { onEdit && onEdit(node); - onCloseOpenModal(false); + onCloseOpenModal(true); onCloseMenu(null); }; + + // 根据节点类型和其他条件动态生成菜单项 + const renderMenuItems = () => { + const menuItems = []; + // if (!useDefault) return; + + // 对于非开始和结束节点,添加基本操作 + if (!['start', 'end'].includes(node?.type)) { + if (!['AND', 'OR', 'JSON2STR', 'STR2JSON', 'IMAGE', 'RESULT', 'LOOP_START'].includes(node.data.type as string)) { + menuItems.push( + + 编辑节点 + + ); + } + + menuItems.push( + + 复制节点 + + ); + menuItems.push( + + 删除节点 + + ); + } + + // 可以根据节点类型添加特定的操作 + if (node?.type === 'special') { + menuItems.push( + + 特殊操作 + + ); + } + + return menuItems; + }; + return ( - - 编辑节点 - - - {(!['start', 'end'].includes(node?.type)) && ( - <> - - 复制节点 - - - 删除节点 - - - )} + {renderMenuItems()} ); };