@mocanvas/editor 4.8.0 → 4.8.2

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.ts CHANGED
@@ -8466,6 +8466,17 @@ declare class Editor extends EventEmitter<EditorEvents> {
8466
8466
  * `getOverlayShapeIds()`; `undefined` where the shape is unclipped.
8467
8467
  */
8468
8468
  getOverlayClips(): readonly (ClipRect | undefined)[];
8469
+ /**
8470
+ * Run `fn` as one operation: one history entry, and one notification to the
8471
+ * store's listeners however many writes it makes.
8472
+ *
8473
+ * It has to open an operation on the *store*, not just a signal transaction.
8474
+ * A `transact` alone batches recomputation and nothing else, so every write
8475
+ * inside still opened and closed an operation of its own — two
8476
+ * `updateShapes` calls in one `run` reached a listener as two notifications,
8477
+ * the first of them carrying a half-applied state that was never an intended
8478
+ * state of the document. A sync binding published that state to its peers.
8479
+ */
8469
8480
  run<T>(fn: () => T, opts?: {
8470
8481
  history?: "record" | "ignore" | "record-preserveRedoStack";
8471
8482
  }): T;
package/dist/index.js CHANGED
@@ -8201,11 +8201,20 @@ var Editor = class extends EventEmitter {
8201
8201
  return this._overlayClips.get();
8202
8202
  }
8203
8203
  // ---- batching / history ------------------------------------------------
8204
+ /**
8205
+ * Run `fn` as one operation: one history entry, and one notification to the
8206
+ * store's listeners however many writes it makes.
8207
+ *
8208
+ * It has to open an operation on the *store*, not just a signal transaction.
8209
+ * A `transact` alone batches recomputation and nothing else, so every write
8210
+ * inside still opened and closed an operation of its own — two
8211
+ * `updateShapes` calls in one `run` reached a listener as two notifications,
8212
+ * the first of them carrying a half-applied state that was never an intended
8213
+ * state of the document. A sync binding published that state to its peers.
8214
+ */
8204
8215
  run(fn, opts = {}) {
8205
- return transact(() => {
8206
- if (opts.history === "ignore") return this.history.ignore(fn);
8207
- return fn();
8208
- });
8216
+ if (opts.history === "ignore") return this.history.ignore(() => this.store.atomic(fn));
8217
+ return this.store.atomic(fn);
8209
8218
  }
8210
8219
  /** @deprecated use `run` */
8211
8220
  batch(fn) {