@liveblocks/core 3.18.0 → 3.18.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.cjs +19 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -8
- package/dist/index.d.ts +26 -8
- package/dist/index.js +19 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
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 = "3.18.
|
|
9
|
+
var PKG_VERSION = "3.18.2";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -9558,7 +9558,7 @@ function createRoom(options, config) {
|
|
|
9558
9558
|
}
|
|
9559
9559
|
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _217 => _217.get, 'call', _218 => _218(), 'optionalAccess', _219 => _219.canWrite]), () => ( true));
|
|
9560
9560
|
const root = context.root;
|
|
9561
|
-
|
|
9561
|
+
disableHistory(() => {
|
|
9562
9562
|
for (const key in context.initialStorage) {
|
|
9563
9563
|
if (root.get(key) === void 0) {
|
|
9564
9564
|
if (canWrite) {
|
|
@@ -9843,6 +9843,7 @@ function createRoom(options, config) {
|
|
|
9843
9843
|
return context.redoStack.length > 0;
|
|
9844
9844
|
}
|
|
9845
9845
|
function onHistoryChange() {
|
|
9846
|
+
if (historyDisabled > 0) return;
|
|
9846
9847
|
eventHub.history.notify({ canUndo: canUndo(), canRedo: canRedo() });
|
|
9847
9848
|
}
|
|
9848
9849
|
function onUserJoinedMessage(message) {
|
|
@@ -10632,14 +10633,24 @@ function createRoom(options, config) {
|
|
|
10632
10633
|
}
|
|
10633
10634
|
commitPausedHistoryToUndoStack();
|
|
10634
10635
|
}
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
const
|
|
10636
|
+
let historyDisabled = 0;
|
|
10637
|
+
function disableHistory(fn) {
|
|
10638
|
+
const origUndo = context.undoStack;
|
|
10639
|
+
const origRedo = context.redoStack;
|
|
10640
|
+
const tempUndo = [];
|
|
10641
|
+
const tempRedo = [];
|
|
10642
|
+
context.undoStack = tempUndo;
|
|
10643
|
+
context.redoStack = tempRedo;
|
|
10644
|
+
historyDisabled++;
|
|
10638
10645
|
try {
|
|
10639
10646
|
return fn();
|
|
10640
10647
|
} finally {
|
|
10641
|
-
|
|
10642
|
-
context.redoStack
|
|
10648
|
+
historyDisabled--;
|
|
10649
|
+
if (context.undoStack !== tempUndo || context.redoStack !== tempRedo) {
|
|
10650
|
+
throw new Error("unexpected stack swap during history.disable()");
|
|
10651
|
+
}
|
|
10652
|
+
context.undoStack = origUndo;
|
|
10653
|
+
context.redoStack = origRedo;
|
|
10643
10654
|
}
|
|
10644
10655
|
}
|
|
10645
10656
|
const syncSourceForStorage = config.createSyncSource();
|
|
@@ -10948,9 +10959,7 @@ function createRoom(options, config) {
|
|
|
10948
10959
|
clear,
|
|
10949
10960
|
pause: pauseHistory,
|
|
10950
10961
|
resume: resumeHistory,
|
|
10951
|
-
|
|
10952
|
-
withoutHistory
|
|
10953
|
-
}
|
|
10962
|
+
disable: disableHistory
|
|
10954
10963
|
},
|
|
10955
10964
|
fetchYDoc,
|
|
10956
10965
|
fetchFeeds,
|