From 02c88b36e632f7ef62147cfe7399d7cc520be3e6 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Mon, 3 Aug 2026 09:52:03 +0800 Subject: [PATCH] feat(workflow): edit nodes on click --- .../src/components/workflow/GenericNode.tsx | 89 ++++++++----------- .../components/workflow/WorkflowCanvas.tsx | 1 + 2 files changed, 39 insertions(+), 51 deletions(-) diff --git a/frontend/src/components/workflow/GenericNode.tsx b/frontend/src/components/workflow/GenericNode.tsx index 288cf26..9e2e710 100644 --- a/frontend/src/components/workflow/GenericNode.tsx +++ b/frontend/src/components/workflow/GenericNode.tsx @@ -2,11 +2,12 @@ /** * 通用节点渲染器。所有节点类型共用一个组件,规格来自 NodeSpecsContext - * (后端 /api/node-types)。悬停/选中时在右上角显示「编辑 / 复制 / 删除」按钮。 + * (后端 /api/node-types)。点击节点由 React Flow 打开编辑抽屉;悬停/选中时 + * 仅在右上角显示「复制 / 删除」按钮。 */ import { Handle, Position, type NodeProps } from "@xyflow/react"; -import { Copy, MessageSquareText, Pencil, Trash2 } from "lucide-react"; +import { Copy, MessageSquareText, Trash2 } from "lucide-react"; import { useContext } from "react"; import { cn } from "@/lib/utils"; @@ -117,56 +118,42 @@ export function GenericNode({ id, type, data, selected }: NodeProps) { )} - {/* 悬停/选中时出现的操作按钮 */} -
- - {type !== "start" && ( - <> - - - - )} -
+ + + + )}
nodeActions.edit(node.id)} onEdgeClick={(_, edge) => edgeActions.edit(edge.id)} isValidConnection={isValidConnection} onPaneClick={() => {