@harbour-enterprises/superdoc 1.7.0-next.8 → 1.7.0-next.9
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/chunks/{PdfViewer-CcFA0rJU.cjs → PdfViewer-Vnsmg2cv.cjs} +2 -2
- package/dist/chunks/{PdfViewer-CUMpkySV.es.js → PdfViewer-W0haUdLl.es.js} +2 -2
- package/dist/chunks/{SuperConverter-D0hhe2nV.es.js → SuperConverter-B0zMkLdc.es.js} +163 -34
- package/dist/chunks/{SuperConverter-krwrYQkW.cjs → SuperConverter-PbxPQOyI.cjs} +163 -34
- package/dist/chunks/{index-DTJCOo2w.es.js → index-C070FBOz.es.js} +125 -49
- package/dist/chunks/{index-FiJG3jxE.cjs → index-CDRAe8oj.cjs} +27 -5
- package/dist/chunks/{index-DGCJio0S.es.js → index-Dho4ex7D.es.js} +27 -5
- package/dist/chunks/{index-CYnDWjvg.cjs → index-nEA2vtLH.cjs} +125 -49
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc/src/components/CommentsLayer/use-comment.d.ts.map +1 -1
- package/dist/superdoc/src/composables/use-document.d.ts +1 -0
- package/dist/superdoc/src/composables/use-document.d.ts.map +1 -1
- package/dist/superdoc/src/stores/comments-store.d.ts.map +1 -1
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +311 -84
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +3 -3
|
@@ -27558,7 +27558,46 @@ const decode$l = (params) => {
|
|
|
27558
27558
|
};
|
|
27559
27559
|
commentSchema = [commentSchema, commentReference];
|
|
27560
27560
|
}
|
|
27561
|
-
|
|
27561
|
+
const usesRangeThreading = originalComment.threadingStyleOverride === "range-based" || originalComment.threadingMethod === "range-based" || originalComment.originalXmlStructure?.hasCommentsExtended === false;
|
|
27562
|
+
if (!usesRangeThreading) {
|
|
27563
|
+
return commentSchema;
|
|
27564
|
+
}
|
|
27565
|
+
const trackedMark = node.marks?.find((mark) => mark.type === "trackInsert" || mark.type === "trackDelete");
|
|
27566
|
+
if (trackedMark) {
|
|
27567
|
+
const wrapperName2 = trackedMark.type === "trackDelete" ? "w:del" : "w:ins";
|
|
27568
|
+
const markAttrs = trackedMark.attrs || {};
|
|
27569
|
+
const date2 = markAttrs.date || new Date(Date.now()).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
27570
|
+
const wrapperAttributes2 = {
|
|
27571
|
+
...markAttrs.id ? { "w:id": String(markAttrs.id) } : {},
|
|
27572
|
+
...markAttrs.author ? { "w:author": markAttrs.author } : {},
|
|
27573
|
+
...markAttrs.authorEmail ? { "w:authorEmail": markAttrs.authorEmail } : {},
|
|
27574
|
+
"w:date": date2
|
|
27575
|
+
};
|
|
27576
|
+
return {
|
|
27577
|
+
name: wrapperName2,
|
|
27578
|
+
attributes: wrapperAttributes2,
|
|
27579
|
+
elements: Array.isArray(commentSchema) ? commentSchema : [commentSchema]
|
|
27580
|
+
};
|
|
27581
|
+
}
|
|
27582
|
+
if (!parentComment?.trackedChange) {
|
|
27583
|
+
return commentSchema;
|
|
27584
|
+
}
|
|
27585
|
+
const trackedChangeType = parentComment.trackedChangeType;
|
|
27586
|
+
const isReplace = trackedChangeType === "both";
|
|
27587
|
+
const wrapperName = type === "commentRangeStart" ? "w:ins" : isReplace ? "w:del" : trackedChangeType === "trackDelete" ? "w:del" : "w:ins";
|
|
27588
|
+
const createdTime = parentComment.createdTime || Date.now();
|
|
27589
|
+
const date = new Date(createdTime).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
27590
|
+
const wrapperAttributes = {
|
|
27591
|
+
"w:id": String(parentComment.commentId),
|
|
27592
|
+
...parentComment.creatorName ? { "w:author": parentComment.creatorName } : {},
|
|
27593
|
+
...parentComment.creatorEmail ? { "w:authorEmail": parentComment.creatorEmail } : {},
|
|
27594
|
+
"w:date": date
|
|
27595
|
+
};
|
|
27596
|
+
return {
|
|
27597
|
+
name: wrapperName,
|
|
27598
|
+
attributes: wrapperAttributes,
|
|
27599
|
+
elements: Array.isArray(commentSchema) ? commentSchema : [commentSchema]
|
|
27600
|
+
};
|
|
27562
27601
|
};
|
|
27563
27602
|
const getCommentSchema = (type, commentIndex) => {
|
|
27564
27603
|
return {
|
|
@@ -29161,6 +29200,15 @@ function importCommentData({ docx, editor, converter }) {
|
|
|
29161
29200
|
const nodeListHandler = defaultNodeListHandler();
|
|
29162
29201
|
const comments = docx["word/comments.xml"];
|
|
29163
29202
|
if (!comments) return;
|
|
29203
|
+
const commentThreadingProfile = converter?.commentThreadingProfile || {
|
|
29204
|
+
defaultStyle: docx["word/commentsExtended.xml"] ? "commentsExtended" : "range-based",
|
|
29205
|
+
mixed: false,
|
|
29206
|
+
fileSet: {
|
|
29207
|
+
hasCommentsExtended: !!docx["word/commentsExtended.xml"],
|
|
29208
|
+
hasCommentsExtensible: !!docx["word/commentsExtensible.xml"],
|
|
29209
|
+
hasCommentsIds: !!docx["word/commentsIds.xml"]
|
|
29210
|
+
}
|
|
29211
|
+
};
|
|
29164
29212
|
const { elements } = comments;
|
|
29165
29213
|
if (!elements || !elements.length) return;
|
|
29166
29214
|
const { elements: allComments = [] } = elements[0];
|
|
@@ -29188,8 +29236,7 @@ function importCommentData({ docx, editor, converter }) {
|
|
|
29188
29236
|
});
|
|
29189
29237
|
const lastElement = parsedElements[parsedElements.length - 1];
|
|
29190
29238
|
const paraId = lastElement?.attrs?.["w14:paraId"];
|
|
29191
|
-
const
|
|
29192
|
-
const threadingMethod = commentsExtended ? "commentsExtended" : "range-based";
|
|
29239
|
+
const threadingMethod = commentThreadingProfile.defaultStyle;
|
|
29193
29240
|
return {
|
|
29194
29241
|
commentId: internalId || uuid.v4(),
|
|
29195
29242
|
importedId,
|
|
@@ -29207,21 +29254,45 @@ function importCommentData({ docx, editor, converter }) {
|
|
|
29207
29254
|
isDone: false,
|
|
29208
29255
|
origin: converter?.documentOrigin || "word",
|
|
29209
29256
|
threadingMethod,
|
|
29257
|
+
threadingStyleOverride: void 0,
|
|
29210
29258
|
originalXmlStructure: {
|
|
29211
|
-
|
|
29212
|
-
hasCommentsExtensible: !!docx["word/commentsExtensible.xml"],
|
|
29213
|
-
hasCommentsIds: !!docx["word/commentsIds.xml"]
|
|
29259
|
+
...commentThreadingProfile.fileSet
|
|
29214
29260
|
}
|
|
29215
29261
|
};
|
|
29216
29262
|
});
|
|
29217
|
-
const extendedComments = generateCommentsWithExtendedData({
|
|
29263
|
+
const extendedComments = generateCommentsWithExtendedData({
|
|
29264
|
+
docx,
|
|
29265
|
+
comments: extractedComments,
|
|
29266
|
+
converter,
|
|
29267
|
+
threadingProfile: commentThreadingProfile
|
|
29268
|
+
});
|
|
29269
|
+
if (converter) {
|
|
29270
|
+
const hasOverride = extendedComments.some(
|
|
29271
|
+
(comment) => comment.threadingStyleOverride && comment.threadingStyleOverride !== commentThreadingProfile.defaultStyle
|
|
29272
|
+
);
|
|
29273
|
+
converter.commentThreadingProfile = {
|
|
29274
|
+
...commentThreadingProfile,
|
|
29275
|
+
mixed: hasOverride || commentThreadingProfile.mixed
|
|
29276
|
+
};
|
|
29277
|
+
}
|
|
29218
29278
|
return extendedComments;
|
|
29219
29279
|
}
|
|
29220
|
-
const generateCommentsWithExtendedData = ({ docx, comments, converter }) => {
|
|
29280
|
+
const generateCommentsWithExtendedData = ({ docx, comments, converter, threadingProfile }) => {
|
|
29221
29281
|
if (!comments?.length) return [];
|
|
29222
29282
|
const rangeData = extractCommentRangesFromDocument(docx, converter);
|
|
29223
29283
|
const { commentsInTrackedChanges } = rangeData;
|
|
29224
29284
|
const trackedChangeParentMap = detectThreadingFromTrackedChanges(comments, commentsInTrackedChanges);
|
|
29285
|
+
const rangeThreadedComments = detectThreadingFromRanges(comments, {
|
|
29286
|
+
...rangeData,
|
|
29287
|
+
commentsInTrackedChanges: /* @__PURE__ */ new Map()
|
|
29288
|
+
});
|
|
29289
|
+
const commentIdSet = new Set(comments.map((comment) => comment.commentId));
|
|
29290
|
+
const rangeParentMap = /* @__PURE__ */ new Map();
|
|
29291
|
+
rangeThreadedComments.forEach((comment) => {
|
|
29292
|
+
if (comment.parentCommentId && commentIdSet.has(comment.parentCommentId)) {
|
|
29293
|
+
rangeParentMap.set(comment.commentId, comment.parentCommentId);
|
|
29294
|
+
}
|
|
29295
|
+
});
|
|
29225
29296
|
const commentsExtended = docx["word/commentsExtended.xml"];
|
|
29226
29297
|
if (!commentsExtended) {
|
|
29227
29298
|
const commentsWithThreading = detectThreadingFromRanges(comments, rangeData);
|
|
@@ -29240,25 +29311,43 @@ const generateCommentsWithExtendedData = ({ docx, comments, converter }) => {
|
|
|
29240
29311
|
});
|
|
29241
29312
|
let isDone = comment.isDone ?? false;
|
|
29242
29313
|
let parentCommentId = void 0;
|
|
29314
|
+
let threadingParentCommentId = void 0;
|
|
29315
|
+
let threadingStyleOverride = void 0;
|
|
29243
29316
|
const trackedChangeParent = trackedChangeParentMap.get(comment.importedId);
|
|
29244
29317
|
const isInsideTrackedChange = trackedChangeParent?.isTrackedChangeParent;
|
|
29245
29318
|
if (extendedDef) {
|
|
29246
29319
|
const details = getExtendedDetails(extendedDef);
|
|
29247
29320
|
isDone = details.isDone ?? false;
|
|
29248
|
-
if (
|
|
29321
|
+
if (details.paraIdParent) {
|
|
29249
29322
|
const parentComment = comments.find(
|
|
29250
29323
|
(c) => c.paraId === details.paraIdParent || c.elements?.some((el) => el.attrs?.["w14:paraId"] === details.paraIdParent)
|
|
29251
29324
|
);
|
|
29252
|
-
|
|
29325
|
+
const rangeParent = rangeParentMap.get(comment.commentId);
|
|
29326
|
+
if (parentComment?.trackedChange && rangeParent) {
|
|
29327
|
+
threadingParentCommentId = rangeParent;
|
|
29328
|
+
} else {
|
|
29329
|
+
threadingParentCommentId = parentComment?.commentId;
|
|
29330
|
+
}
|
|
29331
|
+
if (!isInsideTrackedChange) {
|
|
29332
|
+
parentCommentId = threadingParentCommentId;
|
|
29333
|
+
}
|
|
29253
29334
|
}
|
|
29254
29335
|
}
|
|
29255
29336
|
if (isInsideTrackedChange) {
|
|
29256
29337
|
parentCommentId = trackedChangeParent.trackedChangeId;
|
|
29257
29338
|
}
|
|
29339
|
+
if (!parentCommentId && rangeParentMap.has(comment.commentId)) {
|
|
29340
|
+
parentCommentId = rangeParentMap.get(comment.commentId);
|
|
29341
|
+
if (threadingProfile?.defaultStyle === "commentsExtended") {
|
|
29342
|
+
threadingStyleOverride = "range-based";
|
|
29343
|
+
}
|
|
29344
|
+
}
|
|
29258
29345
|
return {
|
|
29259
29346
|
...comment,
|
|
29260
29347
|
isDone,
|
|
29261
|
-
parentCommentId
|
|
29348
|
+
parentCommentId,
|
|
29349
|
+
threadingStyleOverride,
|
|
29350
|
+
threadingParentCommentId
|
|
29262
29351
|
};
|
|
29263
29352
|
});
|
|
29264
29353
|
};
|
|
@@ -30134,12 +30223,27 @@ const detectDocumentOrigin = (docx) => {
|
|
|
30134
30223
|
}
|
|
30135
30224
|
return "unknown";
|
|
30136
30225
|
};
|
|
30226
|
+
const detectCommentThreadingProfile = (docx) => {
|
|
30227
|
+
const hasCommentsExtended = !!docx["word/commentsExtended.xml"];
|
|
30228
|
+
const hasCommentsExtensible = !!docx["word/commentsExtensible.xml"];
|
|
30229
|
+
const hasCommentsIds = !!docx["word/commentsIds.xml"];
|
|
30230
|
+
return {
|
|
30231
|
+
defaultStyle: hasCommentsExtended ? "commentsExtended" : "range-based",
|
|
30232
|
+
mixed: false,
|
|
30233
|
+
fileSet: {
|
|
30234
|
+
hasCommentsExtended,
|
|
30235
|
+
hasCommentsExtensible,
|
|
30236
|
+
hasCommentsIds
|
|
30237
|
+
}
|
|
30238
|
+
};
|
|
30239
|
+
};
|
|
30137
30240
|
const createDocumentJson = (docx, converter, editor) => {
|
|
30138
30241
|
const json = carbonCopy(getInitialJSON(docx));
|
|
30139
30242
|
if (!json) return null;
|
|
30140
30243
|
if (converter) {
|
|
30141
30244
|
importFootnotePropertiesFromSettings(docx, converter);
|
|
30142
30245
|
converter.documentOrigin = detectDocumentOrigin(docx);
|
|
30246
|
+
converter.commentThreadingProfile = detectCommentThreadingProfile(docx);
|
|
30143
30247
|
}
|
|
30144
30248
|
if (converter?.telemetry) {
|
|
30145
30249
|
const files = Object.keys(docx).map((filePath) => {
|
|
@@ -32297,8 +32401,18 @@ const determineExportStrategy = (comments) => {
|
|
|
32297
32401
|
}
|
|
32298
32402
|
return "word";
|
|
32299
32403
|
};
|
|
32300
|
-
const
|
|
32301
|
-
|
|
32404
|
+
const resolveThreadingStyle = (comment, threadingProfile) => {
|
|
32405
|
+
if (comment?.threadingStyleOverride) return comment.threadingStyleOverride;
|
|
32406
|
+
if (threadingProfile?.defaultStyle) return threadingProfile.defaultStyle;
|
|
32407
|
+
return comment?.originalXmlStructure?.hasCommentsExtended ? "commentsExtended" : "range-based";
|
|
32408
|
+
};
|
|
32409
|
+
const updateCommentsExtendedXml = (comments = [], commentsExtendedXml, threadingProfile = null) => {
|
|
32410
|
+
if (!commentsExtendedXml) {
|
|
32411
|
+
return null;
|
|
32412
|
+
}
|
|
32413
|
+
const exportStrategy = typeof threadingProfile === "string" ? threadingProfile : "word";
|
|
32414
|
+
const profile = typeof threadingProfile === "string" ? null : threadingProfile;
|
|
32415
|
+
const shouldGenerateCommentsExtended = profile ? profile.defaultStyle === "commentsExtended" || profile.mixed || comments.some((comment) => resolveThreadingStyle(comment, profile) === "commentsExtended") : exportStrategy === "word" || comments.some((c) => c.originalXmlStructure?.hasCommentsExtended);
|
|
32302
32416
|
if (!shouldGenerateCommentsExtended && exportStrategy === "google-docs") {
|
|
32303
32417
|
return null;
|
|
32304
32418
|
}
|
|
@@ -32309,10 +32423,12 @@ const updateCommentsExtendedXml = (comments = [], commentsExtendedXml, exportStr
|
|
|
32309
32423
|
"w15:paraId": comment.commentParaId,
|
|
32310
32424
|
"w15:done": isResolved ? "1" : "0"
|
|
32311
32425
|
};
|
|
32312
|
-
const parentId = comment.parentCommentId;
|
|
32313
|
-
|
|
32426
|
+
const parentId = comment.threadingParentCommentId || comment.parentCommentId;
|
|
32427
|
+
const threadingStyle = resolveThreadingStyle(comment, profile);
|
|
32428
|
+
if (parentId && threadingStyle === "commentsExtended") {
|
|
32314
32429
|
const parentComment = comments.find((c) => c.commentId === parentId);
|
|
32315
|
-
|
|
32430
|
+
const allowTrackedParent = profile?.defaultStyle === "commentsExtended";
|
|
32431
|
+
if (parentComment && (allowTrackedParent || !parentComment.trackedChange)) {
|
|
32316
32432
|
attributes["w15:paraIdParent"] = parentComment.commentParaId;
|
|
32317
32433
|
}
|
|
32318
32434
|
}
|
|
@@ -32356,12 +32472,15 @@ const updateCommentsIdsAndExtensible = (comments = [], commentsIds, extensible)
|
|
|
32356
32472
|
extensibleUpdated
|
|
32357
32473
|
};
|
|
32358
32474
|
};
|
|
32359
|
-
const generateConvertedXmlWithCommentFiles = (convertedXml) => {
|
|
32475
|
+
const generateConvertedXmlWithCommentFiles = (convertedXml, fileSet = null) => {
|
|
32360
32476
|
const newXml = carbonCopy(convertedXml);
|
|
32361
32477
|
newXml["word/comments.xml"] = COMMENTS_XML_DEFINITIONS.COMMENTS_XML_DEF;
|
|
32362
|
-
|
|
32363
|
-
|
|
32364
|
-
|
|
32478
|
+
const includeExtended = fileSet ? fileSet.hasCommentsExtended : true;
|
|
32479
|
+
const includeExtensible = fileSet ? fileSet.hasCommentsExtensible : true;
|
|
32480
|
+
const includeIds = fileSet ? fileSet.hasCommentsIds : true;
|
|
32481
|
+
if (includeExtended) newXml["word/commentsExtended.xml"] = COMMENTS_XML_DEFINITIONS.COMMENTS_EXTENDED_XML_DEF;
|
|
32482
|
+
if (includeExtensible) newXml["word/commentsExtensible.xml"] = COMMENTS_XML_DEFINITIONS.COMMENTS_EXTENSIBLE_XML_DEF;
|
|
32483
|
+
if (includeIds) newXml["word/commentsIds.xml"] = COMMENTS_XML_DEFINITIONS.COMMENTS_IDS_XML_DEF;
|
|
32365
32484
|
newXml["[Content_Types].xml"] = COMMENTS_XML_DEFINITIONS.CONTENT_TYPES;
|
|
32366
32485
|
return newXml;
|
|
32367
32486
|
};
|
|
@@ -32378,20 +32497,26 @@ const generateRelationship = (target) => {
|
|
|
32378
32497
|
const rel = relsDefault.find((rel2) => rel2.attributes.Target === target);
|
|
32379
32498
|
return { ...rel };
|
|
32380
32499
|
};
|
|
32381
|
-
const prepareCommentsXmlFilesForExport = ({
|
|
32500
|
+
const prepareCommentsXmlFilesForExport = ({
|
|
32501
|
+
convertedXml,
|
|
32502
|
+
defs,
|
|
32503
|
+
commentsWithParaIds,
|
|
32504
|
+
exportType,
|
|
32505
|
+
threadingProfile
|
|
32506
|
+
}) => {
|
|
32382
32507
|
const relationships = [];
|
|
32383
32508
|
if (exportType === "clean") {
|
|
32384
32509
|
const documentXml = removeCommentsFilesFromConvertedXml(convertedXml);
|
|
32385
32510
|
return { documentXml, relationships };
|
|
32386
32511
|
}
|
|
32387
32512
|
const exportStrategy = determineExportStrategy(commentsWithParaIds);
|
|
32388
|
-
const updatedXml = generateConvertedXmlWithCommentFiles(convertedXml);
|
|
32513
|
+
const updatedXml = generateConvertedXmlWithCommentFiles(convertedXml, threadingProfile?.fileSet);
|
|
32389
32514
|
updatedXml["word/comments.xml"] = updateCommentsXml(defs, updatedXml["word/comments.xml"]);
|
|
32390
32515
|
relationships.push(generateRelationship("comments.xml"));
|
|
32391
32516
|
const commentsExtendedXml = updateCommentsExtendedXml(
|
|
32392
32517
|
commentsWithParaIds,
|
|
32393
32518
|
updatedXml["word/commentsExtended.xml"],
|
|
32394
|
-
exportStrategy
|
|
32519
|
+
threadingProfile || exportStrategy
|
|
32395
32520
|
);
|
|
32396
32521
|
if (commentsExtendedXml !== null) {
|
|
32397
32522
|
updatedXml["word/commentsExtended.xml"] = commentsExtendedXml;
|
|
@@ -32399,15 +32524,17 @@ const prepareCommentsXmlFilesForExport = ({ convertedXml, defs, commentsWithPara
|
|
|
32399
32524
|
} else {
|
|
32400
32525
|
delete updatedXml["word/commentsExtended.xml"];
|
|
32401
32526
|
}
|
|
32402
|
-
|
|
32403
|
-
|
|
32404
|
-
|
|
32405
|
-
|
|
32406
|
-
|
|
32407
|
-
|
|
32408
|
-
|
|
32409
|
-
|
|
32410
|
-
|
|
32527
|
+
if (updatedXml["word/commentsIds.xml"] && updatedXml["word/commentsExtensible.xml"]) {
|
|
32528
|
+
const { documentIdsUpdated, extensibleUpdated } = updateCommentsIdsAndExtensible(
|
|
32529
|
+
commentsWithParaIds,
|
|
32530
|
+
updatedXml["word/commentsIds.xml"],
|
|
32531
|
+
updatedXml["word/commentsExtensible.xml"]
|
|
32532
|
+
);
|
|
32533
|
+
updatedXml["word/commentsIds.xml"] = documentIdsUpdated;
|
|
32534
|
+
updatedXml["word/commentsExtensible.xml"] = extensibleUpdated;
|
|
32535
|
+
relationships.push(generateRelationship("commentsIds.xml"));
|
|
32536
|
+
relationships.push(generateRelationship("commentsExtensible.xml"));
|
|
32537
|
+
}
|
|
32411
32538
|
return {
|
|
32412
32539
|
relationships,
|
|
32413
32540
|
documentXml: updatedXml
|
|
@@ -32758,6 +32885,7 @@ class SuperConverter {
|
|
|
32758
32885
|
this.footnotes = [];
|
|
32759
32886
|
this.footnoteProperties = null;
|
|
32760
32887
|
this.inlineDocumentFonts = [];
|
|
32888
|
+
this.commentThreadingProfile = null;
|
|
32761
32889
|
this.docHiglightColors = /* @__PURE__ */ new Set([]);
|
|
32762
32890
|
this.xml = params?.xml;
|
|
32763
32891
|
this.declaration = null;
|
|
@@ -33072,7 +33200,7 @@ class SuperConverter {
|
|
|
33072
33200
|
static getStoredSuperdocVersion(docx) {
|
|
33073
33201
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
33074
33202
|
}
|
|
33075
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.7.0-next.
|
|
33203
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.7.0-next.9") {
|
|
33076
33204
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
33077
33205
|
}
|
|
33078
33206
|
/**
|
|
@@ -33472,7 +33600,8 @@ class SuperConverter {
|
|
|
33472
33600
|
exportType,
|
|
33473
33601
|
convertedXml: this.convertedXml,
|
|
33474
33602
|
defs,
|
|
33475
|
-
commentsWithParaIds
|
|
33603
|
+
commentsWithParaIds,
|
|
33604
|
+
threadingProfile: this.commentThreadingProfile
|
|
33476
33605
|
});
|
|
33477
33606
|
return { documentXml, relationships };
|
|
33478
33607
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
|
|
2
2
|
import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
|
|
3
|
-
import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-
|
|
3
|
+
import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-B0zMkLdc.es.js";
|
|
4
4
|
import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h as h$1, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
|
|
5
5
|
import "./jszip.min-DCl8qkFO.es.js";
|
|
6
6
|
import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
|
|
@@ -12927,9 +12927,43 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
12927
12927
|
comments.forEach((c2) => {
|
|
12928
12928
|
commentMap.set(c2.commentId, c2);
|
|
12929
12929
|
});
|
|
12930
|
+
const trackedChangeSpanById = /* @__PURE__ */ new Map();
|
|
12931
|
+
const trackedChangeMarksById = /* @__PURE__ */ new Map();
|
|
12932
|
+
doc2.descendants((node, pos) => {
|
|
12933
|
+
const trackedChangeMark = node.marks?.find((mark) => TRACK_CHANGE_MARKS$1.includes(mark.type.name));
|
|
12934
|
+
if (!trackedChangeMark) return;
|
|
12935
|
+
const trackedChangeId = trackedChangeMark.attrs?.id;
|
|
12936
|
+
if (!trackedChangeId) return;
|
|
12937
|
+
const existing = trackedChangeSpanById.get(trackedChangeId);
|
|
12938
|
+
const startPos = pos;
|
|
12939
|
+
const endPos = pos + node.nodeSize;
|
|
12940
|
+
if (!existing) {
|
|
12941
|
+
trackedChangeSpanById.set(trackedChangeId, { startPos, endPos });
|
|
12942
|
+
} else {
|
|
12943
|
+
existing.startPos = Math.min(existing.startPos, startPos);
|
|
12944
|
+
existing.endPos = Math.max(existing.endPos, endPos);
|
|
12945
|
+
}
|
|
12946
|
+
const marksEntry = trackedChangeMarksById.get(trackedChangeId) || {};
|
|
12947
|
+
if (trackedChangeMark.type?.name === TrackInsertMarkName$1 && !marksEntry.insertMark) {
|
|
12948
|
+
marksEntry.insertMark = trackedChangeMark;
|
|
12949
|
+
}
|
|
12950
|
+
if (trackedChangeMark.type?.name === TrackDeleteMarkName$1 && !marksEntry.deleteMark) {
|
|
12951
|
+
marksEntry.deleteMark = trackedChangeMark;
|
|
12952
|
+
}
|
|
12953
|
+
trackedChangeMarksById.set(trackedChangeId, marksEntry);
|
|
12954
|
+
});
|
|
12955
|
+
const getThreadingParentId = (comment) => {
|
|
12956
|
+
if (!comment) return comment?.parentCommentId;
|
|
12957
|
+
const usesRangeThreading = comment.threadingStyleOverride === "range-based" || comment.threadingMethod === "range-based" || comment.originalXmlStructure?.hasCommentsExtended === false;
|
|
12958
|
+
if (usesRangeThreading && comment.threadingParentCommentId) {
|
|
12959
|
+
return comment.threadingParentCommentId;
|
|
12960
|
+
}
|
|
12961
|
+
return comment.parentCommentId;
|
|
12962
|
+
};
|
|
12930
12963
|
const startNodes = [];
|
|
12931
12964
|
const endNodes = [];
|
|
12932
12965
|
const seen = /* @__PURE__ */ new Set();
|
|
12966
|
+
const trackedChangeCommentMeta = /* @__PURE__ */ new Map();
|
|
12933
12967
|
doc2.descendants((node, pos) => {
|
|
12934
12968
|
const commentMarks = node.marks?.filter((mark) => mark.type.name === CommentMarkName$1) || [];
|
|
12935
12969
|
commentMarks.forEach((commentMark) => {
|
|
@@ -12937,9 +12971,21 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
12937
12971
|
const { commentId } = attrs;
|
|
12938
12972
|
if (commentId === "pending") return;
|
|
12939
12973
|
if (seen.has(commentId)) return;
|
|
12940
|
-
seen.add(commentId);
|
|
12941
12974
|
const comment = commentMap.get(commentId);
|
|
12942
|
-
const parentCommentId = comment
|
|
12975
|
+
const parentCommentId = getThreadingParentId(comment);
|
|
12976
|
+
const trackedChangeMark = node.marks?.find((mark) => TRACK_CHANGE_MARKS$1.includes(mark.type.name));
|
|
12977
|
+
const trackedChangeId = trackedChangeMark?.attrs?.id;
|
|
12978
|
+
const trackedSpan = trackedChangeId ? trackedChangeSpanById.get(trackedChangeId) : null;
|
|
12979
|
+
if (trackedSpan) {
|
|
12980
|
+
trackedChangeCommentMeta.set(commentId, {
|
|
12981
|
+
comment,
|
|
12982
|
+
parentCommentId,
|
|
12983
|
+
trackedChangeId
|
|
12984
|
+
});
|
|
12985
|
+
seen.add(commentId);
|
|
12986
|
+
return;
|
|
12987
|
+
}
|
|
12988
|
+
seen.add(commentId);
|
|
12943
12989
|
const commentStartNodeAttrs = getPreparedComment(commentMark.attrs);
|
|
12944
12990
|
const startNode = schema.nodes.commentRangeStart.create(commentStartNodeAttrs);
|
|
12945
12991
|
startNodes.push({
|
|
@@ -12955,7 +13001,7 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
12955
13001
|
commentId,
|
|
12956
13002
|
parentCommentId
|
|
12957
13003
|
});
|
|
12958
|
-
const childComments = comments.filter((c2) => c2
|
|
13004
|
+
const childComments = comments.filter((c2) => getThreadingParentId(c2) === commentId).sort((a, b2) => a.createdTime - b2.createdTime);
|
|
12959
13005
|
childComments.forEach((c2) => {
|
|
12960
13006
|
if (seen.has(c2.commentId)) return;
|
|
12961
13007
|
seen.add(c2.commentId);
|
|
@@ -12968,47 +13014,74 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
12968
13014
|
pos,
|
|
12969
13015
|
node: childStartNode,
|
|
12970
13016
|
commentId: c2.commentId,
|
|
12971
|
-
parentCommentId: c2
|
|
13017
|
+
parentCommentId: getThreadingParentId(c2)
|
|
12972
13018
|
});
|
|
12973
13019
|
const childEndNode = schema.nodes.commentRangeEnd.create(childMark);
|
|
12974
13020
|
endNodes.push({
|
|
12975
13021
|
pos: pos + node.nodeSize,
|
|
12976
13022
|
node: childEndNode,
|
|
12977
13023
|
commentId: c2.commentId,
|
|
12978
|
-
parentCommentId: c2
|
|
13024
|
+
parentCommentId: getThreadingParentId(c2)
|
|
12979
13025
|
});
|
|
12980
13026
|
});
|
|
12981
13027
|
});
|
|
12982
|
-
const trackedChangeMark = node.marks?.find((mark) => TRACK_CHANGE_MARKS$1.includes(mark.type.name));
|
|
12983
|
-
if (trackedChangeMark) {
|
|
12984
|
-
const trackedChangeId = trackedChangeMark.attrs?.id;
|
|
12985
|
-
if (trackedChangeId) {
|
|
12986
|
-
const childComments = comments.filter((c2) => c2.parentCommentId === trackedChangeId && !c2.trackedChange).sort((a, b2) => a.createdTime - b2.createdTime);
|
|
12987
|
-
childComments.forEach((c2) => {
|
|
12988
|
-
if (seen.has(c2.commentId)) return;
|
|
12989
|
-
seen.add(c2.commentId);
|
|
12990
|
-
const childMark = getPreparedComment({
|
|
12991
|
-
commentId: c2.commentId,
|
|
12992
|
-
internal: c2.isInternal
|
|
12993
|
-
});
|
|
12994
|
-
const childStartNode = schema.nodes.commentRangeStart.create(childMark);
|
|
12995
|
-
startNodes.push({
|
|
12996
|
-
pos,
|
|
12997
|
-
node: childStartNode,
|
|
12998
|
-
commentId: c2.commentId,
|
|
12999
|
-
parentCommentId: c2.parentCommentId
|
|
13000
|
-
});
|
|
13001
|
-
const childEndNode = schema.nodes.commentRangeEnd.create(childMark);
|
|
13002
|
-
endNodes.push({
|
|
13003
|
-
pos: pos + node.nodeSize,
|
|
13004
|
-
node: childEndNode,
|
|
13005
|
-
commentId: c2.commentId,
|
|
13006
|
-
parentCommentId: c2.parentCommentId
|
|
13007
|
-
});
|
|
13008
|
-
});
|
|
13009
|
-
}
|
|
13010
|
-
}
|
|
13011
13028
|
});
|
|
13029
|
+
if (trackedChangeSpanById.size > 0) {
|
|
13030
|
+
trackedChangeCommentMeta.forEach(({ comment, parentCommentId, trackedChangeId }) => {
|
|
13031
|
+
if (!comment || !trackedChangeSpanById.has(trackedChangeId)) return;
|
|
13032
|
+
const span = trackedChangeSpanById.get(trackedChangeId);
|
|
13033
|
+
if (!span) return;
|
|
13034
|
+
const childMark = getPreparedComment({
|
|
13035
|
+
commentId: comment.commentId,
|
|
13036
|
+
internal: comment.isInternal
|
|
13037
|
+
});
|
|
13038
|
+
const trackedMarks = trackedChangeMarksById.get(trackedChangeId) || {};
|
|
13039
|
+
const startMarks = trackedMarks.insertMark ? [trackedMarks.insertMark] : trackedMarks.deleteMark ? [trackedMarks.deleteMark] : void 0;
|
|
13040
|
+
const endMarks = trackedMarks.deleteMark ? [trackedMarks.deleteMark] : trackedMarks.insertMark ? [trackedMarks.insertMark] : void 0;
|
|
13041
|
+
const childStartNode = schema.nodes.commentRangeStart.create(childMark, null, startMarks);
|
|
13042
|
+
startNodes.push({
|
|
13043
|
+
pos: span.startPos,
|
|
13044
|
+
node: childStartNode,
|
|
13045
|
+
commentId: comment.commentId,
|
|
13046
|
+
parentCommentId
|
|
13047
|
+
});
|
|
13048
|
+
const childEndNode = schema.nodes.commentRangeEnd.create(childMark, null, endMarks);
|
|
13049
|
+
endNodes.push({
|
|
13050
|
+
pos: span.endPos,
|
|
13051
|
+
node: childEndNode,
|
|
13052
|
+
commentId: comment.commentId,
|
|
13053
|
+
parentCommentId
|
|
13054
|
+
});
|
|
13055
|
+
});
|
|
13056
|
+
comments.filter((comment) => trackedChangeSpanById.has(comment.parentCommentId) && !comment.trackedChange).sort((a, b2) => a.createdTime - b2.createdTime).forEach((comment) => {
|
|
13057
|
+
if (seen.has(comment.commentId)) return;
|
|
13058
|
+
seen.add(comment.commentId);
|
|
13059
|
+
const span = trackedChangeSpanById.get(comment.parentCommentId);
|
|
13060
|
+
if (!span) return;
|
|
13061
|
+
const childMark = getPreparedComment({
|
|
13062
|
+
commentId: comment.commentId,
|
|
13063
|
+
internal: comment.isInternal
|
|
13064
|
+
});
|
|
13065
|
+
const parentCommentId = getThreadingParentId(comment);
|
|
13066
|
+
const trackedMarks = trackedChangeMarksById.get(comment.parentCommentId) || {};
|
|
13067
|
+
const startMarks = trackedMarks.insertMark ? [trackedMarks.insertMark] : trackedMarks.deleteMark ? [trackedMarks.deleteMark] : void 0;
|
|
13068
|
+
const endMarks = trackedMarks.deleteMark ? [trackedMarks.deleteMark] : trackedMarks.insertMark ? [trackedMarks.insertMark] : void 0;
|
|
13069
|
+
const childStartNode = schema.nodes.commentRangeStart.create(childMark, null, startMarks);
|
|
13070
|
+
startNodes.push({
|
|
13071
|
+
pos: span.startPos,
|
|
13072
|
+
node: childStartNode,
|
|
13073
|
+
commentId: comment.commentId,
|
|
13074
|
+
parentCommentId
|
|
13075
|
+
});
|
|
13076
|
+
const childEndNode = schema.nodes.commentRangeEnd.create(childMark, null, endMarks);
|
|
13077
|
+
endNodes.push({
|
|
13078
|
+
pos: span.endPos,
|
|
13079
|
+
node: childEndNode,
|
|
13080
|
+
commentId: comment.commentId,
|
|
13081
|
+
parentCommentId
|
|
13082
|
+
});
|
|
13083
|
+
});
|
|
13084
|
+
}
|
|
13012
13085
|
startNodes.sort((a, b2) => {
|
|
13013
13086
|
if (a.pos !== b2.pos) return a.pos - b2.pos;
|
|
13014
13087
|
const aIsParentOfB = a.commentId === b2.parentCommentId;
|
|
@@ -15771,7 +15844,7 @@ const canUseDOM = () => {
|
|
|
15771
15844
|
return false;
|
|
15772
15845
|
}
|
|
15773
15846
|
};
|
|
15774
|
-
const summaryVersion = "1.7.0-next.
|
|
15847
|
+
const summaryVersion = "1.7.0-next.9";
|
|
15775
15848
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
15776
15849
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
15777
15850
|
function mapAttributes(attrs) {
|
|
@@ -18064,19 +18137,22 @@ class Editor extends EventEmitter {
|
|
|
18064
18137
|
}
|
|
18065
18138
|
if (comments.length) {
|
|
18066
18139
|
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
18067
|
-
const commentsExtendedXml = this.converter.schemaToXml(
|
|
18068
|
-
this.converter.convertedXml["word/commentsExtended.xml"].elements[0]
|
|
18069
|
-
);
|
|
18070
|
-
const commentsExtensibleXml = this.converter.schemaToXml(
|
|
18071
|
-
this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]
|
|
18072
|
-
);
|
|
18073
|
-
const commentsIdsXml = this.converter.schemaToXml(
|
|
18074
|
-
this.converter.convertedXml["word/commentsIds.xml"].elements[0]
|
|
18075
|
-
);
|
|
18076
18140
|
updatedDocs["word/comments.xml"] = String(commentsXml);
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
|
|
18141
|
+
const commentsExtended = this.converter.convertedXml["word/commentsExtended.xml"];
|
|
18142
|
+
if (commentsExtended?.elements?.[0]) {
|
|
18143
|
+
const commentsExtendedXml = this.converter.schemaToXml(commentsExtended.elements[0]);
|
|
18144
|
+
updatedDocs["word/commentsExtended.xml"] = String(commentsExtendedXml);
|
|
18145
|
+
}
|
|
18146
|
+
const commentsExtensible = this.converter.convertedXml["word/commentsExtensible.xml"];
|
|
18147
|
+
if (commentsExtensible?.elements?.[0]) {
|
|
18148
|
+
const commentsExtensibleXml = this.converter.schemaToXml(commentsExtensible.elements[0]);
|
|
18149
|
+
updatedDocs["word/commentsExtensible.xml"] = String(commentsExtensibleXml);
|
|
18150
|
+
}
|
|
18151
|
+
const commentsIds = this.converter.convertedXml["word/commentsIds.xml"];
|
|
18152
|
+
if (commentsIds?.elements?.[0]) {
|
|
18153
|
+
const commentsIdsXml = this.converter.schemaToXml(commentsIds.elements[0]);
|
|
18154
|
+
updatedDocs["word/commentsIds.xml"] = String(commentsIdsXml);
|
|
18155
|
+
}
|
|
18080
18156
|
}
|
|
18081
18157
|
const zipper = new DocxZipper();
|
|
18082
18158
|
if (getUpdatedDocs) {
|
|
@@ -18438,7 +18514,7 @@ class Editor extends EventEmitter {
|
|
|
18438
18514
|
* Process collaboration migrations
|
|
18439
18515
|
*/
|
|
18440
18516
|
processCollaborationMigrations() {
|
|
18441
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.7.0-next.
|
|
18517
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.7.0-next.9");
|
|
18442
18518
|
if (!this.options.ydoc) return;
|
|
18443
18519
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
18444
18520
|
let docVersion = metaMap.get("version");
|