@liveblocks/core 1.3.0 → 1.3.1

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
@@ -1273,6 +1273,10 @@ interface History {
1273
1273
  * // room.history.canRedo() is false
1274
1274
  */
1275
1275
  canRedo: () => boolean;
1276
+ /**
1277
+ * Clears the undo and redo stacks. This operation cannot be undone ;)
1278
+ */
1279
+ clear: () => void;
1276
1280
  /**
1277
1281
  * All future modifications made on the Room will be merged together to create a single history item until resume is called.
1278
1282
  *
package/dist/index.d.ts CHANGED
@@ -1273,6 +1273,10 @@ interface History {
1273
1273
  * // room.history.canRedo() is false
1274
1274
  */
1275
1275
  canRedo: () => boolean;
1276
+ /**
1277
+ * Clears the undo and redo stacks. This operation cannot be undone ;)
1278
+ */
1279
+ clear: () => void;
1276
1280
  /**
1277
1281
  * All future modifications made on the Room will be merged together to create a single history item until resume is called.
1278
1282
  *
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "1.3.0";
9
+ var PKG_VERSION = "1.3.1";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -4754,7 +4754,7 @@ function createRoom(options, config) {
4754
4754
  } else {
4755
4755
  batchUpdates(() => {
4756
4756
  addToUndoStack(reverse, doNotBatchUpdates);
4757
- context.redoStack = [];
4757
+ context.redoStack.length = 0;
4758
4758
  dispatchOps(ops);
4759
4759
  notify({ storageUpdates }, doNotBatchUpdates);
4760
4760
  });
@@ -5484,6 +5484,10 @@ ${Array.from(traces).join("\n\n")}`
5484
5484
  }
5485
5485
  flushNowOrSoon();
5486
5486
  }
5487
+ function clear() {
5488
+ context.undoStack.length = 0;
5489
+ context.redoStack.length = 0;
5490
+ }
5487
5491
  function batch(callback) {
5488
5492
  if (context.activeBatch) {
5489
5493
  return callback();
@@ -5508,7 +5512,7 @@ ${Array.from(traces).join("\n\n")}`
5508
5512
  addToUndoStack(currentBatch.reverseOps, doNotBatchUpdates);
5509
5513
  }
5510
5514
  if (currentBatch.ops.length > 0) {
5511
- context.redoStack = [];
5515
+ context.redoStack.length = 0;
5512
5516
  }
5513
5517
  if (currentBatch.ops.length > 0) {
5514
5518
  dispatchOps(currentBatch.ops);
@@ -5612,6 +5616,7 @@ ${Array.from(traces).join("\n\n")}`
5612
5616
  redo,
5613
5617
  canUndo,
5614
5618
  canRedo,
5619
+ clear,
5615
5620
  pause: pauseHistory,
5616
5621
  resume: resumeHistory
5617
5622
  },