@flowgram.ai/document 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -309,7 +309,7 @@ declare class FlowDocument<T = FlowDocumentJSON> implements Disposable {
309
309
  * @param data
310
310
  * @param addedNodes
311
311
  */
312
- addNode(data: AddNodeData, addedNodes?: FlowNodeEntity[], ignoreCreateAndUpdateEvent?: boolean, ignoreBlocks?: boolean): FlowNodeEntity;
312
+ addNode(data: AddNodeData, addedNodes?: FlowNodeEntity[]): FlowNodeEntity;
313
313
  addBlocksAsChildren(parent: FlowNodeEntity, blocks: FlowNodeJSON[], addedNodes?: FlowNodeEntity[]): void;
314
314
  /**
315
315
  * block 格式:
package/dist/index.d.ts CHANGED
@@ -309,7 +309,7 @@ declare class FlowDocument<T = FlowDocumentJSON> implements Disposable {
309
309
  * @param data
310
310
  * @param addedNodes
311
311
  */
312
- addNode(data: AddNodeData, addedNodes?: FlowNodeEntity[], ignoreCreateAndUpdateEvent?: boolean, ignoreBlocks?: boolean): FlowNodeEntity;
312
+ addNode(data: AddNodeData, addedNodes?: FlowNodeEntity[]): FlowNodeEntity;
313
313
  addBlocksAsChildren(parent: FlowNodeEntity, blocks: FlowNodeJSON[], addedNodes?: FlowNodeEntity[]): void;
314
314
  /**
315
315
  * block 格式:
package/dist/index.js CHANGED
@@ -1853,7 +1853,7 @@ var FlowDocument = class {
1853
1853
  * @param data
1854
1854
  * @param addedNodes
1855
1855
  */
1856
- addNode(data, addedNodes, ignoreCreateAndUpdateEvent, ignoreBlocks) {
1856
+ addNode(data, addedNodes) {
1857
1857
  const { id, type = "block", originParent, parent, meta, hidden, index } = data;
1858
1858
  let node = this.getNode(id);
1859
1859
  let isNew = false;
@@ -1895,23 +1895,21 @@ var FlowDocument = class {
1895
1895
  if (extendNodes && addedNodes) {
1896
1896
  addedNodes.push(...extendNodes);
1897
1897
  }
1898
- } else if (data.blocks && data.blocks.length > 0 && !ignoreBlocks) {
1898
+ } else if (data.blocks && data.blocks.length > 0) {
1899
1899
  if (!data.blocks[0].type) {
1900
1900
  this.addInlineBlocks(node, data.blocks, addedNodes);
1901
1901
  } else {
1902
1902
  this.addBlocksAsChildren(node, data.blocks, addedNodes);
1903
1903
  }
1904
1904
  }
1905
- if (!ignoreCreateAndUpdateEvent) {
1906
- if (isNew) {
1907
- this.onNodeCreateEmitter.fire({
1908
- node,
1909
- data,
1910
- json: data
1911
- });
1912
- } else {
1913
- this.onNodeUpdateEmitter.fire({ node, data, json: data });
1914
- }
1905
+ if (isNew) {
1906
+ this.onNodeCreateEmitter.fire({
1907
+ node,
1908
+ data,
1909
+ json: data
1910
+ });
1911
+ } else {
1912
+ this.onNodeUpdateEmitter.fire({ node, data, json: data });
1915
1913
  }
1916
1914
  return node;
1917
1915
  }