@supernova-studio/client 0.51.2 → 0.52.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 +159 -0
- package/dist/index.d.ts +159 -0
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/yjs/version-room/utils.ts +18 -5
package/dist/index.js
CHANGED
|
@@ -294,7 +294,8 @@ var FeaturesSummary = _zod.z.object({
|
|
|
294
294
|
workspaceViewers: featureLimitedSchema,
|
|
295
295
|
customDocumentationExporter: featureToggleSchema,
|
|
296
296
|
protectedPages: featureToggleSchema,
|
|
297
|
-
approvals: featureToggleSchema
|
|
297
|
+
approvals: featureToggleSchema,
|
|
298
|
+
selectivePublishing: featureToggleSchema
|
|
298
299
|
});
|
|
299
300
|
var InvoiceSchema = _zod.z.object({
|
|
300
301
|
id: _zod.z.string(),
|
|
@@ -6426,7 +6427,7 @@ var VersionRoomBaseYDoc = class {
|
|
|
6426
6427
|
// src/yjs/version-room/utils.ts
|
|
6427
6428
|
function generatePageContentHash(content, definitions, debug = false) {
|
|
6428
6429
|
let sanitizedContent = structuredClone(content);
|
|
6429
|
-
sanitizedContent =
|
|
6430
|
+
sanitizedContent = sanitizePageContents(sanitizedContent, definitions);
|
|
6430
6431
|
if (isPageContentEmpty(sanitizedContent)) {
|
|
6431
6432
|
sanitizedContent = { blocks: [] };
|
|
6432
6433
|
}
|
|
@@ -6447,21 +6448,21 @@ function isPageContentEmpty(content) {
|
|
|
6447
6448
|
const textValue = singleItem.props["text"];
|
|
6448
6449
|
return !textValue.value.spans.length;
|
|
6449
6450
|
}
|
|
6450
|
-
function
|
|
6451
|
+
function sanitizePageContents(content, definitions) {
|
|
6451
6452
|
const defMap = new PageBlockDefinitionsMap(definitions);
|
|
6452
6453
|
mapPageBlockItemValuesV2(content.blocks, defMap, (block, item, prop, value) => {
|
|
6453
6454
|
if (prop.type === "RichText") {
|
|
6454
6455
|
const richTextValue = value;
|
|
6455
6456
|
return {
|
|
6456
6457
|
...richTextValue,
|
|
6457
|
-
value:
|
|
6458
|
+
value: sanitizeRichText(richTextValue.value)
|
|
6458
6459
|
};
|
|
6459
6460
|
}
|
|
6460
6461
|
if (prop.type === "MultiRichText") {
|
|
6461
6462
|
const multiRichTextValue = value;
|
|
6462
6463
|
return {
|
|
6463
6464
|
...multiRichTextValue,
|
|
6464
|
-
value: multiRichTextValue.value.map(
|
|
6465
|
+
value: multiRichTextValue.value.map(sanitizeRichText)
|
|
6465
6466
|
};
|
|
6466
6467
|
}
|
|
6467
6468
|
if (prop.type === "Table") {
|
|
@@ -6470,7 +6471,7 @@ function removeCommentSpansFromPage(content, definitions) {
|
|
|
6470
6471
|
r.cells.forEach((c) => {
|
|
6471
6472
|
c.nodes.forEach((n) => {
|
|
6472
6473
|
if (n.type === "RichText") {
|
|
6473
|
-
n.value =
|
|
6474
|
+
n.value = sanitizeRichText(n.value);
|
|
6474
6475
|
}
|
|
6475
6476
|
});
|
|
6476
6477
|
});
|
|
@@ -6481,6 +6482,15 @@ function removeCommentSpansFromPage(content, definitions) {
|
|
|
6481
6482
|
});
|
|
6482
6483
|
return content;
|
|
6483
6484
|
}
|
|
6485
|
+
function sanitizeRichText(richText) {
|
|
6486
|
+
return sortSpanAttributes(removeCommentSpans(richText));
|
|
6487
|
+
}
|
|
6488
|
+
function sortSpanAttributes(richText) {
|
|
6489
|
+
richText.spans.forEach((s) => {
|
|
6490
|
+
s.attributes.sort((lhs, rhs) => lhs.type.localeCompare(rhs.type));
|
|
6491
|
+
});
|
|
6492
|
+
return richText;
|
|
6493
|
+
}
|
|
6484
6494
|
|
|
6485
6495
|
// src/yjs/version-room/frontend.ts
|
|
6486
6496
|
var FrontendVersionRoomYDoc = class {
|