diff --git a/src/pages/flowEditor/FlowEditorMain.tsx b/src/pages/flowEditor/FlowEditorMain.tsx index 093ade5..21b9252 100644 --- a/src/pages/flowEditor/FlowEditorMain.tsx +++ b/src/pages/flowEditor/FlowEditorMain.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useMemo } from 'react'; import { ReactFlow, Background, @@ -76,7 +76,7 @@ interface FlowEditorMainProps { editEdge: (edge: Edge) => void; copyNode: (node: Node) => void; addNodeOnEdge: (nodeType: string, node: any) => void; - addNodeOnPane: (nodeType: string, position: { x: number; y: number }, node?: any) => void; + addNodeOnPane: (nodeType: string, position: { x: number, y: number }, node?: any) => void; handleAddNode: (nodeType: string, node: any) => void; saveFlowDataToServer: () => void; handleRun: (running: boolean) => void; @@ -135,6 +135,7 @@ const FlowEditorMain: React.FC = (props) => { const { getGuidelines, clearGuidelines, AlignmentGuides } = useAlignmentGuidelines(); const { undo, redo, canUndo, canRedo } = useHistory(); + const reactFlowId = useMemo(() => new Date().getTime().toString(), []); // 监听键盘事件实现快捷键 useEffect(() => { @@ -175,7 +176,7 @@ const FlowEditorMain: React.FC = (props) => {
e.preventDefault()}>