1
This commit is contained in:
parent
813a4e4350
commit
4b859989ee
@ -14,7 +14,7 @@ import { isConfigurableNode } from './nodes/types';
|
||||
import { useWorkflowSave } from './hooks/useWorkflowSave';
|
||||
import { useWorkflowLoad } from './hooks/useWorkflowLoad';
|
||||
import { useHistory } from './hooks/useHistory';
|
||||
import { generateNodeId } from './utils/idGenerator';
|
||||
import { generateNodeId, generateEdgeId } from './utils/idGenerator';
|
||||
|
||||
// 样式
|
||||
import '@xyflow/react/dist/style.css';
|
||||
@ -179,14 +179,14 @@ const WorkflowDesignInner: React.FC = () => {
|
||||
message.info('剪贴板为空');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const { nodes: copiedNodes, edges: copiedEdges } = clipboard.current;
|
||||
const offset = 50; // 粘贴偏移量
|
||||
const idMap = new Map<string, string>();
|
||||
|
||||
// 创建新节点(带偏移)
|
||||
const newNodes = copiedNodes.map(node => {
|
||||
const newId = `${node.type}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
||||
const newId = generateNodeId(); // ✅ 使用标准ID生成函数: sid_xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx
|
||||
idMap.set(node.id, newId);
|
||||
|
||||
return {
|
||||
@ -209,7 +209,7 @@ const WorkflowDesignInner: React.FC = () => {
|
||||
|
||||
return {
|
||||
...edge,
|
||||
id: `e${newSource}-${newTarget}`,
|
||||
id: generateEdgeId(), // ✅ 使用标准ID生成函数: eid_xxxxxxxx_xxxx_xxxx_xxxx_xxxxxxxxxxxx
|
||||
source: newSource,
|
||||
target: newTarget,
|
||||
selected: true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user