mirror of
https://gitee.com/ByteDance/flowgram.ai.git
synced 2025-07-07 17:43:29 +08:00
fix(core): free document prevent to trigger flowDocument.addBlocksAsChildren (#273)
This commit is contained in:
parent
9ae858b363
commit
2da1f3c5bf
@ -74,7 +74,4 @@ export const LoopNodeRegistry: FlowNodeRegistry = {
|
|||||||
batchFor: provideBatchInputEffect,
|
batchFor: provideBatchInputEffect,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onCreate() {
|
|
||||||
// NOTICE: 这个函数是为了避免触发固定布局 flowDocument.addBlocksAsChildren
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -229,7 +229,8 @@ export class FlowDocument<T = FlowDocumentJSON> implements Disposable {
|
|||||||
addNode(
|
addNode(
|
||||||
data: AddNodeData,
|
data: AddNodeData,
|
||||||
addedNodes?: FlowNodeEntity[],
|
addedNodes?: FlowNodeEntity[],
|
||||||
ignoreCreateAndUpdateEvent?: boolean
|
ignoreCreateAndUpdateEvent?: boolean,
|
||||||
|
ignoreBlocks?: boolean
|
||||||
): FlowNodeEntity {
|
): FlowNodeEntity {
|
||||||
const { id, type = 'block', originParent, parent, meta, hidden, index } = data;
|
const { id, type = 'block', originParent, parent, meta, hidden, index } = data;
|
||||||
let node = this.getNode(id);
|
let node = this.getNode(id);
|
||||||
@ -278,7 +279,7 @@ export class FlowDocument<T = FlowDocumentJSON> implements Disposable {
|
|||||||
if (extendNodes && addedNodes) {
|
if (extendNodes && addedNodes) {
|
||||||
addedNodes.push(...extendNodes);
|
addedNodes.push(...extendNodes);
|
||||||
}
|
}
|
||||||
} else if (data.blocks && data.blocks.length > 0) {
|
} else if (data.blocks && data.blocks.length > 0 && !ignoreBlocks) {
|
||||||
// 兼容老的写法
|
// 兼容老的写法
|
||||||
if (!data.blocks[0].type) {
|
if (!data.blocks[0].type) {
|
||||||
this.addInlineBlocks(node, data.blocks, addedNodes);
|
this.addInlineBlocks(node, data.blocks, addedNodes);
|
||||||
|
|||||||
@ -170,6 +170,7 @@ export class WorkflowDocument extends FlowDocument {
|
|||||||
parent,
|
parent,
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
|
true,
|
||||||
true
|
true
|
||||||
) as WorkflowNodeEntity;
|
) as WorkflowNodeEntity;
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,4 @@ export const GroupNodeRegistry: FlowNodeRegistry = {
|
|||||||
formMeta: {
|
formMeta: {
|
||||||
render: () => <></>,
|
render: () => <></>,
|
||||||
},
|
},
|
||||||
onCreate() {
|
|
||||||
// NOTICE: 这个函数是为了避免触发固定布局 flowDocument.addBlocksAsChildren
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user