@supernova-studio/client 0.48.10 → 0.48.11
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 +20 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/yjs/version-room/utils.ts +32 -1
package/dist/index.js
CHANGED
|
@@ -6098,7 +6098,26 @@ var VersionRoomBaseYDoc = class {
|
|
|
6098
6098
|
|
|
6099
6099
|
// src/yjs/version-room/utils.ts
|
|
6100
6100
|
function generatePageContentHash(content, debug = false) {
|
|
6101
|
-
|
|
6101
|
+
let sanitizedContent = content;
|
|
6102
|
+
if (isPageContentEmpty(content)) {
|
|
6103
|
+
sanitizedContent = { blocks: [] };
|
|
6104
|
+
}
|
|
6105
|
+
return generateHash(sanitizedContent, debug);
|
|
6106
|
+
}
|
|
6107
|
+
function isPageContentEmpty(content) {
|
|
6108
|
+
if (content.blocks.length > 1)
|
|
6109
|
+
return false;
|
|
6110
|
+
if (content.blocks.length < 1)
|
|
6111
|
+
return true;
|
|
6112
|
+
const singleBlock = content.blocks[0];
|
|
6113
|
+
if (singleBlock.type !== "Block" || singleBlock.data.packageId !== "io.supernova.block.rich-text") {
|
|
6114
|
+
return false;
|
|
6115
|
+
}
|
|
6116
|
+
const singleItem = singleBlock.data.items[0];
|
|
6117
|
+
if (!singleItem || !singleItem.props["text"])
|
|
6118
|
+
return true;
|
|
6119
|
+
const textValue = singleItem.props["text"];
|
|
6120
|
+
return !textValue.value.spans.length;
|
|
6102
6121
|
}
|
|
6103
6122
|
|
|
6104
6123
|
// src/yjs/version-room/frontend.ts
|