|
|
|
@ -178,7 +178,7 @@ const FlowEditorMain: React.FC<FlowEditorMainProps> = (props) => {
|
|
|
|
onContextMenu={(e) => e.preventDefault()}>
|
|
|
|
onContextMenu={(e) => e.preventDefault()}>
|
|
|
|
<ReactFlow
|
|
|
|
<ReactFlow
|
|
|
|
id={reactFlowId}
|
|
|
|
id={reactFlowId}
|
|
|
|
nodes={nodes.map(node => ({...node, draggable: !isRunning}))} // 运行时禁用节点拖拽
|
|
|
|
nodes={nodes.map(node => ({ ...node, draggable: !isRunning }))} // 运行时禁用节点拖拽
|
|
|
|
edges={edges}
|
|
|
|
edges={edges}
|
|
|
|
nodeTypes={nodeTypes}
|
|
|
|
nodeTypes={nodeTypes}
|
|
|
|
edgeTypes={edgeTypes}
|
|
|
|
edgeTypes={edgeTypes}
|
|
|
|
@ -206,8 +206,6 @@ const FlowEditorMain: React.FC<FlowEditorMainProps> = (props) => {
|
|
|
|
return !isRunning; // 运行时禁止删除节点
|
|
|
|
return !isRunning; // 运行时禁止删除节点
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
onNodesDelete={(deleted) => {
|
|
|
|
onNodesDelete={(deleted) => {
|
|
|
|
console.log('deleted:', deleted);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否有循环节点
|
|
|
|
// 检查是否有循环节点
|
|
|
|
const loopNodes = deleted.filter(node =>
|
|
|
|
const loopNodes = deleted.filter(node =>
|
|
|
|
node.data?.type === 'LOOP_START' || node.data?.type === 'LOOP_END'
|
|
|
|
node.data?.type === 'LOOP_START' || node.data?.type === 'LOOP_END'
|
|
|
|
@ -298,10 +296,6 @@ const FlowEditorMain: React.FC<FlowEditorMainProps> = (props) => {
|
|
|
|
fitView
|
|
|
|
fitView
|
|
|
|
selectionOnDrag={!isRunning} // 运行时禁用拖拽选择
|
|
|
|
selectionOnDrag={!isRunning} // 运行时禁用拖拽选择
|
|
|
|
selectionMode={!isRunning ? SelectionMode.Partial : undefined} // 运行时禁用选择模式
|
|
|
|
selectionMode={!isRunning ? SelectionMode.Partial : undefined} // 运行时禁用选择模式
|
|
|
|
panOnDrag={!isRunning ? [0, 1, 2] : []} // 运行时禁用拖拽平移
|
|
|
|
|
|
|
|
zoomOnScroll={!isRunning} // 运行时禁用滚轮缩放
|
|
|
|
|
|
|
|
zoomOnPinch={!isRunning} // 运行时禁用捏合缩放
|
|
|
|
|
|
|
|
panOnScrollSpeed={!isRunning ? 0.5 : 0} // 运行时禁用滚动平移
|
|
|
|
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Background />
|
|
|
|
<Background />
|
|
|
|
<Panel position="top-left">
|
|
|
|
<Panel position="top-left">
|
|
|
|
|