@flowgram.ai/free-layout-core 0.2.1 → 0.2.3

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.js CHANGED
@@ -1390,17 +1390,15 @@ var WorkflowLinesManager = class {
1390
1390
  toNode?.removeLine(line);
1391
1391
  line.validate();
1392
1392
  });
1393
- line.toDispose.push(
1394
- import_utils12.Disposable.create(() => {
1395
- if (available) {
1396
- this.onAvailableLinesChangeEmitter.fire({
1397
- type: "DELETE_LINE" /* DELETE_LINE */,
1398
- toJSON: () => line.toJSON(),
1399
- entity: line
1400
- });
1401
- }
1402
- })
1403
- );
1393
+ line.onDispose(() => {
1394
+ if (available) {
1395
+ this.onAvailableLinesChangeEmitter.fire({
1396
+ type: "DELETE_LINE" /* DELETE_LINE */,
1397
+ toJSON: () => line.toJSON(),
1398
+ entity: line
1399
+ });
1400
+ }
1401
+ });
1404
1402
  if (available) {
1405
1403
  this.onAvailableLinesChangeEmitter.fire({
1406
1404
  type: "ADD_LINE" /* ADD_LINE */,
@@ -1834,6 +1832,7 @@ var WorkflowDocument = class extends import_document7.FlowDocument {
1834
1832
  parent
1835
1833
  },
1836
1834
  void 0,
1835
+ true,
1837
1836
  true
1838
1837
  );
1839
1838
  const registry = node.getNodeRegistry();
@@ -1881,26 +1880,24 @@ var WorkflowDocument = class extends import_document7.FlowDocument {
1881
1880
  entity: node,
1882
1881
  toJSON: () => this.toNodeJSON(node)
1883
1882
  });
1884
- node.toDispose.push(
1885
- import_utils14.Disposable.create(() => {
1886
- this.fireContentChange({
1887
- type: "DELETE_NODE" /* DELETE_NODE */,
1888
- entity: node,
1889
- toJSON: () => this.toNodeJSON(node)
1890
- });
1891
- })
1892
- );
1893
- node.toDispose.push(
1894
- import_utils14.Disposable.create(() => {
1895
- if (!node.parent || node.parent.flowNodeType === import_document7.FlowNodeBaseType.ROOT) {
1896
- return;
1897
- }
1898
- const parentTransform = node.parent.getData(import_document7.FlowNodeTransformData);
1899
- setTimeout(() => {
1900
- parentTransform.fireChange();
1901
- }, 0);
1902
- })
1903
- );
1883
+ node.onDispose(() => {
1884
+ if (!node.parent || node.parent.flowNodeType === import_document7.FlowNodeBaseType.ROOT) {
1885
+ return;
1886
+ }
1887
+ const parentTransform = node.parent.getData(import_document7.FlowNodeTransformData);
1888
+ parentTransform.fireChange();
1889
+ });
1890
+ let lastDeleteNodeData;
1891
+ node.preDispose.onDispose(() => {
1892
+ lastDeleteNodeData = this.toNodeJSON(node);
1893
+ });
1894
+ node.onDispose(() => {
1895
+ this.fireContentChange({
1896
+ type: "DELETE_NODE" /* DELETE_NODE */,
1897
+ entity: node,
1898
+ toJSON: () => lastDeleteNodeData
1899
+ });
1900
+ });
1904
1901
  }
1905
1902
  if (json.blocks) {
1906
1903
  this.renderJSON(