@harbour-enterprises/superdoc 1.8.0-next.1 → 1.8.0-next.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/chunks/{PdfViewer-DCILVrwF.es.js → PdfViewer-DQeTXTnR.es.js} +2 -2
- package/dist/chunks/{PdfViewer-DV7ZMlJy.cjs → PdfViewer-HJyFvElE.cjs} +2 -2
- package/dist/chunks/{SuperConverter-Cv5FYCpa.es.js → SuperConverter-Br0Eq-TV.es.js} +4 -342
- package/dist/chunks/{SuperConverter-dgfpDdcg.cjs → SuperConverter-C-3oNlYo.cjs} +4 -342
- package/dist/chunks/{index-BlW_FHkN.cjs → index-3dXTFEES.cjs} +201 -116
- package/dist/chunks/{index-CpumvFGI.cjs → index-BTaAZtKc.cjs} +5 -25
- package/dist/chunks/{index-DTus436U.es.js → index-CQ5eyZh8.es.js} +5 -25
- package/dist/chunks/{index-BUj9aTuQ.es.js → index-Ck-OA2Y9.es.js} +201 -116
- package/dist/style.css +34 -34
- 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/core/SuperDoc.d.ts +0 -14
- package/dist/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/superdoc/src/core/types/index.d.ts +0 -25
- package/dist/superdoc/src/core/types/index.d.ts.map +1 -1
- package/dist/superdoc.cjs +4 -4
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +206 -201
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -33250,8 +33250,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33250
33250
|
if (exportedCommentDefs?.length === 0) return;
|
|
33251
33251
|
if (commentsExportType === "clean") return;
|
|
33252
33252
|
const commentNodeId = node2.attrs["w:id"];
|
|
33253
|
+
const nodeIdStr = String(commentNodeId);
|
|
33253
33254
|
const originalComment = comments.find((comment2) => {
|
|
33254
|
-
return comment2.commentId
|
|
33255
|
+
return String(comment2.commentId) === nodeIdStr || String(comment2.importedId) === nodeIdStr;
|
|
33255
33256
|
});
|
|
33256
33257
|
if (!originalComment) return;
|
|
33257
33258
|
const parentCommentId = originalComment.parentCommentId;
|
|
@@ -35815,38 +35816,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35815
35816
|
converter.documentOrigin = detectDocumentOrigin(docx);
|
|
35816
35817
|
converter.commentThreadingProfile = detectCommentThreadingProfile(docx);
|
|
35817
35818
|
}
|
|
35818
|
-
if (converter?.telemetry) {
|
|
35819
|
-
const files = Object.keys(docx).map((filePath) => {
|
|
35820
|
-
const parts = filePath.split("/");
|
|
35821
|
-
return {
|
|
35822
|
-
filePath,
|
|
35823
|
-
fileDepth: parts.length,
|
|
35824
|
-
fileType: filePath.split(".").pop()
|
|
35825
|
-
};
|
|
35826
|
-
});
|
|
35827
|
-
const trackStructure = (documentIdentifier = null) => converter.telemetry.trackFileStructure(
|
|
35828
|
-
{
|
|
35829
|
-
totalFiles: files.length,
|
|
35830
|
-
maxDepth: Math.max(...files.map((f) => f.fileDepth)),
|
|
35831
|
-
totalNodes: 0,
|
|
35832
|
-
files
|
|
35833
|
-
},
|
|
35834
|
-
converter.fileSource,
|
|
35835
|
-
converter.documentGuid ?? converter.documentId ?? null,
|
|
35836
|
-
documentIdentifier ?? converter.documentId ?? null,
|
|
35837
|
-
converter.documentInternalId
|
|
35838
|
-
);
|
|
35839
|
-
try {
|
|
35840
|
-
const identifierResult = converter.getDocumentIdentifier?.();
|
|
35841
|
-
if (identifierResult && typeof identifierResult.then === "function") {
|
|
35842
|
-
identifierResult.then(trackStructure).catch(() => trackStructure());
|
|
35843
|
-
} else {
|
|
35844
|
-
trackStructure(identifierResult);
|
|
35845
|
-
}
|
|
35846
|
-
} catch {
|
|
35847
|
-
trackStructure();
|
|
35848
|
-
}
|
|
35849
|
-
}
|
|
35850
35819
|
const nodeListHandler = defaultNodeListHandler();
|
|
35851
35820
|
const bodyNode = json.elements[0].elements.find((el) => el.name === "w:body");
|
|
35852
35821
|
if (bodyNode) {
|
|
@@ -35889,12 +35858,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35889
35858
|
...bodySectPr ? { bodySectPr } : {}
|
|
35890
35859
|
}
|
|
35891
35860
|
};
|
|
35892
|
-
if (result.content.length > 1) {
|
|
35893
|
-
converter?.telemetry?.trackUsage("document_import", {
|
|
35894
|
-
documentType: "docx",
|
|
35895
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
35896
|
-
});
|
|
35897
|
-
}
|
|
35898
35861
|
return {
|
|
35899
35862
|
pmDoc: result,
|
|
35900
35863
|
savedTagsToRestore: node2,
|
|
@@ -36017,16 +35980,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36017
35980
|
);
|
|
36018
35981
|
if (unhandled) {
|
|
36019
35982
|
if (!context.elementName) continue;
|
|
36020
|
-
converter?.telemetry?.trackStatistic("unknown", context);
|
|
36021
35983
|
continue;
|
|
36022
35984
|
} else {
|
|
36023
|
-
converter?.telemetry?.trackStatistic("node", context);
|
|
36024
|
-
if (context.type === "orderedList" || context.type === "bulletList") {
|
|
36025
|
-
context.content.forEach((item) => {
|
|
36026
|
-
const innerItemContext = getSafeElementContext([item], 0, item, `/word/${filename || "document.xml"}`);
|
|
36027
|
-
converter?.telemetry?.trackStatistic("attributes", innerItemContext);
|
|
36028
|
-
});
|
|
36029
|
-
}
|
|
36030
35985
|
const hasHighlightMark = nodes[0]?.marks?.find((mark2) => mark2.type === "highlight");
|
|
36031
35986
|
if (hasHighlightMark) {
|
|
36032
35987
|
converter?.docHiglightColors.add(hasHighlightMark.attrs.color.toUpperCase());
|
|
@@ -36048,26 +36003,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36048
36003
|
} catch (error) {
|
|
36049
36004
|
console.debug("Import error", error);
|
|
36050
36005
|
editor?.emit("exception", { error, editor });
|
|
36051
|
-
converter?.telemetry?.trackStatistic("error", {
|
|
36052
|
-
type: "processing_error",
|
|
36053
|
-
message: error.message,
|
|
36054
|
-
name: error.name,
|
|
36055
|
-
stack: error.stack,
|
|
36056
|
-
fileName: `/word/${filename || "document.xml"}`
|
|
36057
|
-
});
|
|
36058
36006
|
}
|
|
36059
36007
|
}
|
|
36060
36008
|
return processedElements;
|
|
36061
36009
|
} catch (error) {
|
|
36062
36010
|
console.debug("Error during import", error);
|
|
36063
36011
|
editor?.emit("exception", { error, editor });
|
|
36064
|
-
converter?.telemetry?.trackStatistic("error", {
|
|
36065
|
-
type: "fatal_error",
|
|
36066
|
-
message: error.message,
|
|
36067
|
-
name: error.name,
|
|
36068
|
-
stack: error.stack,
|
|
36069
|
-
fileName: `/word/${filename || "document.xml"}`
|
|
36070
|
-
});
|
|
36071
36012
|
throw error;
|
|
36072
36013
|
}
|
|
36073
36014
|
};
|
|
@@ -38477,7 +38418,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38477
38418
|
this.json = params2?.json;
|
|
38478
38419
|
this.tagsNotInSchema = ["w:body"];
|
|
38479
38420
|
this.savedTagsToRestore = [];
|
|
38480
|
-
this.telemetry = params2?.telemetry || null;
|
|
38481
38421
|
this.documentInternalId = null;
|
|
38482
38422
|
this.fileSource = params2?.fileSource || null;
|
|
38483
38423
|
this.documentId = params2?.documentId || null;
|
|
@@ -38770,7 +38710,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38770
38710
|
static getStoredSuperdocVersion(docx) {
|
|
38771
38711
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
38772
38712
|
}
|
|
38773
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.8.0-next.
|
|
38713
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.8.0-next.2") {
|
|
38774
38714
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
38775
38715
|
}
|
|
38776
38716
|
/**
|
|
@@ -38837,7 +38777,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38837
38777
|
return null;
|
|
38838
38778
|
}
|
|
38839
38779
|
/**
|
|
38840
|
-
* Generate document hash
|
|
38780
|
+
* Generate document hash (async, lazy)
|
|
38841
38781
|
*/
|
|
38842
38782
|
async #generateDocumentHash() {
|
|
38843
38783
|
if (!this.fileSource) return `HASH-${Date.now()}`;
|
|
@@ -51657,69 +51597,92 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
51657
51597
|
}
|
|
51658
51598
|
return comment2.parentCommentId;
|
|
51659
51599
|
};
|
|
51660
|
-
const
|
|
51661
|
-
const
|
|
51662
|
-
const seen = /* @__PURE__ */ new Set();
|
|
51663
|
-
const trackedChangeCommentMeta = /* @__PURE__ */ new Map();
|
|
51600
|
+
const commentRanges = /* @__PURE__ */ new Map();
|
|
51601
|
+
const commentTrackedChangeId = /* @__PURE__ */ new Map();
|
|
51664
51602
|
doc2.descendants((node2, pos) => {
|
|
51665
51603
|
const commentMarks = node2.marks?.filter((mark2) => mark2.type.name === CommentMarkName) || [];
|
|
51604
|
+
if (!commentMarks.length) return;
|
|
51605
|
+
const nodeEnd = pos + node2.nodeSize;
|
|
51606
|
+
const trackedChangeMark = node2.marks?.find((mark2) => TRACK_CHANGE_MARKS$1.includes(mark2.type.name));
|
|
51607
|
+
const trackedChangeId = trackedChangeMark?.attrs?.id;
|
|
51666
51608
|
commentMarks.forEach((commentMark) => {
|
|
51667
51609
|
const { attrs = {} } = commentMark;
|
|
51668
51610
|
const { commentId } = attrs;
|
|
51669
51611
|
if (commentId === "pending") return;
|
|
51670
|
-
if (
|
|
51671
|
-
|
|
51672
|
-
|
|
51673
|
-
|
|
51674
|
-
|
|
51675
|
-
const trackedSpan = trackedChangeId ? trackedChangeSpanById.get(trackedChangeId) : null;
|
|
51676
|
-
if (trackedSpan) {
|
|
51677
|
-
trackedChangeCommentMeta.set(commentId, {
|
|
51678
|
-
comment: comment2,
|
|
51679
|
-
parentCommentId,
|
|
51680
|
-
trackedChangeId
|
|
51612
|
+
if (!commentRanges.has(commentId)) {
|
|
51613
|
+
commentRanges.set(commentId, {
|
|
51614
|
+
start: pos,
|
|
51615
|
+
end: nodeEnd,
|
|
51616
|
+
attrs
|
|
51681
51617
|
});
|
|
51682
|
-
|
|
51683
|
-
|
|
51618
|
+
} else {
|
|
51619
|
+
const existing = commentRanges.get(commentId);
|
|
51620
|
+
existing.start = Math.min(existing.start, pos);
|
|
51621
|
+
existing.end = Math.max(existing.end, nodeEnd);
|
|
51622
|
+
}
|
|
51623
|
+
if (trackedChangeId && !commentTrackedChangeId.has(commentId)) {
|
|
51624
|
+
commentTrackedChangeId.set(commentId, trackedChangeId);
|
|
51684
51625
|
}
|
|
51685
|
-
|
|
51686
|
-
|
|
51687
|
-
|
|
51626
|
+
});
|
|
51627
|
+
});
|
|
51628
|
+
const startNodes = [];
|
|
51629
|
+
const endNodes = [];
|
|
51630
|
+
const seen = /* @__PURE__ */ new Set();
|
|
51631
|
+
const trackedChangeCommentMeta = /* @__PURE__ */ new Map();
|
|
51632
|
+
commentRanges.forEach(({ start: start2, end: end2, attrs }, commentId) => {
|
|
51633
|
+
if (seen.has(commentId)) return;
|
|
51634
|
+
seen.add(commentId);
|
|
51635
|
+
const comment2 = commentMap.get(commentId);
|
|
51636
|
+
const parentCommentId = getThreadingParentId(comment2);
|
|
51637
|
+
const trackedChangeId = commentTrackedChangeId.get(commentId);
|
|
51638
|
+
const trackedSpan = trackedChangeId ? trackedChangeSpanById.get(trackedChangeId) : null;
|
|
51639
|
+
if (trackedSpan) {
|
|
51640
|
+
trackedChangeCommentMeta.set(commentId, {
|
|
51641
|
+
comment: comment2,
|
|
51642
|
+
parentCommentId,
|
|
51643
|
+
trackedChangeId
|
|
51644
|
+
});
|
|
51645
|
+
return;
|
|
51646
|
+
}
|
|
51647
|
+
const commentStartNodeAttrs = getPreparedComment(attrs);
|
|
51648
|
+
const startNode = schema.nodes.commentRangeStart.create(commentStartNodeAttrs);
|
|
51649
|
+
startNodes.push({
|
|
51650
|
+
pos: start2,
|
|
51651
|
+
node: startNode,
|
|
51652
|
+
commentId,
|
|
51653
|
+
parentCommentId
|
|
51654
|
+
});
|
|
51655
|
+
const endNode = schema.nodes.commentRangeEnd.create(commentStartNodeAttrs);
|
|
51656
|
+
endNodes.push({
|
|
51657
|
+
pos: end2,
|
|
51658
|
+
node: endNode,
|
|
51659
|
+
commentId,
|
|
51660
|
+
parentCommentId
|
|
51661
|
+
});
|
|
51662
|
+
const childComments = comments.filter((c2) => getThreadingParentId(c2) === commentId).sort((a2, b2) => a2.createdTime - b2.createdTime);
|
|
51663
|
+
childComments.forEach((c2) => {
|
|
51664
|
+
if (seen.has(c2.commentId)) return;
|
|
51665
|
+
seen.add(c2.commentId);
|
|
51666
|
+
const childRange = commentRanges.get(c2.commentId);
|
|
51667
|
+
const childStart = childRange?.start ?? start2;
|
|
51668
|
+
const childEnd = childRange?.end ?? end2;
|
|
51669
|
+
const childMark = getPreparedComment({
|
|
51670
|
+
commentId: c2.commentId,
|
|
51671
|
+
internal: c2.isInternal
|
|
51672
|
+
});
|
|
51673
|
+
const childStartNode = schema.nodes.commentRangeStart.create(childMark);
|
|
51688
51674
|
startNodes.push({
|
|
51689
|
-
pos,
|
|
51690
|
-
node:
|
|
51691
|
-
commentId,
|
|
51692
|
-
parentCommentId
|
|
51675
|
+
pos: childStart,
|
|
51676
|
+
node: childStartNode,
|
|
51677
|
+
commentId: c2.commentId,
|
|
51678
|
+
parentCommentId: getThreadingParentId(c2)
|
|
51693
51679
|
});
|
|
51694
|
-
const
|
|
51680
|
+
const childEndNode = schema.nodes.commentRangeEnd.create(childMark);
|
|
51695
51681
|
endNodes.push({
|
|
51696
|
-
pos:
|
|
51697
|
-
node:
|
|
51698
|
-
commentId,
|
|
51699
|
-
parentCommentId
|
|
51700
|
-
});
|
|
51701
|
-
const childComments = comments.filter((c2) => getThreadingParentId(c2) === commentId).sort((a2, b2) => a2.createdTime - b2.createdTime);
|
|
51702
|
-
childComments.forEach((c2) => {
|
|
51703
|
-
if (seen.has(c2.commentId)) return;
|
|
51704
|
-
seen.add(c2.commentId);
|
|
51705
|
-
const childMark = getPreparedComment({
|
|
51706
|
-
commentId: c2.commentId,
|
|
51707
|
-
internal: c2.isInternal
|
|
51708
|
-
});
|
|
51709
|
-
const childStartNode = schema.nodes.commentRangeStart.create(childMark);
|
|
51710
|
-
startNodes.push({
|
|
51711
|
-
pos,
|
|
51712
|
-
node: childStartNode,
|
|
51713
|
-
commentId: c2.commentId,
|
|
51714
|
-
parentCommentId: getThreadingParentId(c2)
|
|
51715
|
-
});
|
|
51716
|
-
const childEndNode = schema.nodes.commentRangeEnd.create(childMark);
|
|
51717
|
-
endNodes.push({
|
|
51718
|
-
pos: pos + node2.nodeSize,
|
|
51719
|
-
node: childEndNode,
|
|
51720
|
-
commentId: c2.commentId,
|
|
51721
|
-
parentCommentId: getThreadingParentId(c2)
|
|
51722
|
-
});
|
|
51682
|
+
pos: childEnd,
|
|
51683
|
+
node: childEndNode,
|
|
51684
|
+
commentId: c2.commentId,
|
|
51685
|
+
parentCommentId: getThreadingParentId(c2)
|
|
51723
51686
|
});
|
|
51724
51687
|
});
|
|
51725
51688
|
});
|
|
@@ -51749,6 +51712,34 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
51749
51712
|
commentId: comment2.commentId,
|
|
51750
51713
|
parentCommentId
|
|
51751
51714
|
});
|
|
51715
|
+
const childComments = comments.filter((c2) => getThreadingParentId(c2) === comment2.commentId).sort((a2, b2) => a2.createdTime - b2.createdTime);
|
|
51716
|
+
childComments.forEach((c2) => {
|
|
51717
|
+
if (seen.has(c2.commentId)) return;
|
|
51718
|
+
seen.add(c2.commentId);
|
|
51719
|
+
const childRange = commentRanges.get(c2.commentId);
|
|
51720
|
+
const childStart = childRange?.start ?? span.startPos;
|
|
51721
|
+
const childEnd = childRange?.end ?? span.endPos;
|
|
51722
|
+
const childStartMarks = childRange ? void 0 : startMarks;
|
|
51723
|
+
const childEndMarks = childRange ? void 0 : endMarks;
|
|
51724
|
+
const childMarkAttrs = getPreparedComment({
|
|
51725
|
+
commentId: c2.commentId,
|
|
51726
|
+
internal: c2.isInternal
|
|
51727
|
+
});
|
|
51728
|
+
const childStartNode2 = schema.nodes.commentRangeStart.create(childMarkAttrs, null, childStartMarks);
|
|
51729
|
+
startNodes.push({
|
|
51730
|
+
pos: childStart,
|
|
51731
|
+
node: childStartNode2,
|
|
51732
|
+
commentId: c2.commentId,
|
|
51733
|
+
parentCommentId: getThreadingParentId(c2)
|
|
51734
|
+
});
|
|
51735
|
+
const childEndNode2 = schema.nodes.commentRangeEnd.create(childMarkAttrs, null, childEndMarks);
|
|
51736
|
+
endNodes.push({
|
|
51737
|
+
pos: childEnd,
|
|
51738
|
+
node: childEndNode2,
|
|
51739
|
+
commentId: c2.commentId,
|
|
51740
|
+
parentCommentId: getThreadingParentId(c2)
|
|
51741
|
+
});
|
|
51742
|
+
});
|
|
51752
51743
|
});
|
|
51753
51744
|
comments.filter((comment2) => trackedChangeSpanById.has(comment2.parentCommentId) && !comment2.trackedChange).sort((a2, b2) => a2.createdTime - b2.createdTime).forEach((comment2) => {
|
|
51754
51745
|
if (seen.has(comment2.commentId)) return;
|
|
@@ -65061,7 +65052,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
65061
65052
|
return false;
|
|
65062
65053
|
}
|
|
65063
65054
|
};
|
|
65064
|
-
const summaryVersion = "1.8.0-next.
|
|
65055
|
+
const summaryVersion = "1.8.0-next.2";
|
|
65065
65056
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
65066
65057
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
65067
65058
|
function mapAttributes(attrs) {
|
|
@@ -65647,8 +65638,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
65647
65638
|
onFontsResolved: null,
|
|
65648
65639
|
// async (file) => url;
|
|
65649
65640
|
handleImageUpload: null,
|
|
65650
|
-
// telemetry
|
|
65651
|
-
telemetry: null,
|
|
65652
65641
|
// Docx xml updated by User
|
|
65653
65642
|
customUpdatedFiles: {},
|
|
65654
65643
|
isHeaderFooterChanged: false,
|
|
@@ -66583,7 +66572,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
66583
66572
|
media: this.options.mediaFiles,
|
|
66584
66573
|
fonts: this.options.fonts,
|
|
66585
66574
|
debug: true,
|
|
66586
|
-
telemetry: this.options.telemetry,
|
|
66587
66575
|
fileSource: this.options.fileSource,
|
|
66588
66576
|
documentId: this.options.documentId,
|
|
66589
66577
|
mockWindow: this.options.mockWindow ?? null,
|
|
@@ -66832,7 +66820,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
66832
66820
|
handleClick: this.#handleNodeSelection.bind(this)
|
|
66833
66821
|
});
|
|
66834
66822
|
this.createNodeViews();
|
|
66835
|
-
this.options.telemetry?.trackUsage?.("editor_initialized", {});
|
|
66836
66823
|
}
|
|
66837
66824
|
/**
|
|
66838
66825
|
* Creates all node views.
|
|
@@ -67025,7 +67012,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67025
67012
|
this.#dispatchTransaction(tr);
|
|
67026
67013
|
}
|
|
67027
67014
|
/**
|
|
67028
|
-
* Get document identifier
|
|
67015
|
+
* Get document identifier (async - may generate hash)
|
|
67029
67016
|
*/
|
|
67030
67017
|
async getDocumentIdentifier() {
|
|
67031
67018
|
return await this.converter?.getDocumentIdentifier() || null;
|
|
@@ -67042,17 +67029,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67042
67029
|
isDocumentModified() {
|
|
67043
67030
|
return this.converter?.documentModified || false;
|
|
67044
67031
|
}
|
|
67045
|
-
/**
|
|
67046
|
-
* Get telemetry data (async because of lazy hash generation)
|
|
67047
|
-
*/
|
|
67048
|
-
async getTelemetryData() {
|
|
67049
|
-
return {
|
|
67050
|
-
documentId: await this.getDocumentIdentifier(),
|
|
67051
|
-
isModified: this.isDocumentModified(),
|
|
67052
|
-
isPermanentId: !!this.converter?.documentGuid,
|
|
67053
|
-
version: this.converter?.getSuperdocVersion()
|
|
67054
|
-
};
|
|
67055
|
-
}
|
|
67056
67032
|
/**
|
|
67057
67033
|
* @deprecated use getDocumentGuid instead
|
|
67058
67034
|
*/
|
|
@@ -67296,19 +67272,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67296
67272
|
commentsType = "external",
|
|
67297
67273
|
exportJsonOnly = false,
|
|
67298
67274
|
exportXmlOnly = false,
|
|
67299
|
-
comments
|
|
67275
|
+
comments,
|
|
67300
67276
|
getUpdatedDocs = false,
|
|
67301
67277
|
fieldsHighlightColor = null
|
|
67302
67278
|
} = {}) {
|
|
67303
67279
|
try {
|
|
67304
|
-
const
|
|
67280
|
+
const effectiveComments = comments ?? this.converter.comments ?? [];
|
|
67281
|
+
const preparedComments = effectiveComments.map((comment2) => ({
|
|
67282
|
+
...comment2,
|
|
67283
|
+
commentJSON: comment2.commentJSON ?? comment2.textJson
|
|
67284
|
+
}));
|
|
67285
|
+
const json = this.#prepareDocumentForExport(preparedComments);
|
|
67305
67286
|
const documentXml = await this.converter.exportToDocx(
|
|
67306
67287
|
json,
|
|
67307
67288
|
this.schema,
|
|
67308
67289
|
this.storage.image.media,
|
|
67309
67290
|
isFinalDoc,
|
|
67310
67291
|
commentsType,
|
|
67311
|
-
|
|
67292
|
+
preparedComments,
|
|
67312
67293
|
this,
|
|
67313
67294
|
exportJsonOnly,
|
|
67314
67295
|
fieldsHighlightColor
|
|
@@ -67354,7 +67335,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67354
67335
|
if (footnotesRelsXml) {
|
|
67355
67336
|
updatedDocs["word/_rels/footnotes.xml.rels"] = String(footnotesRelsXml);
|
|
67356
67337
|
}
|
|
67357
|
-
if (
|
|
67338
|
+
if (preparedComments.length) {
|
|
67358
67339
|
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
67359
67340
|
updatedDocs["word/comments.xml"] = String(commentsXml);
|
|
67360
67341
|
const commentsExtended = this.converter.convertedXml["word/commentsExtended.xml"];
|
|
@@ -67393,10 +67374,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67393
67374
|
fonts: this.options.fonts,
|
|
67394
67375
|
isHeadless: this.options.isHeadless
|
|
67395
67376
|
});
|
|
67396
|
-
this.options.telemetry?.trackUsage?.("document_export", {
|
|
67397
|
-
documentType: "docx",
|
|
67398
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
67399
|
-
});
|
|
67400
67377
|
return result;
|
|
67401
67378
|
} catch (error) {
|
|
67402
67379
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -67733,7 +67710,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67733
67710
|
* Process collaboration migrations
|
|
67734
67711
|
*/
|
|
67735
67712
|
processCollaborationMigrations() {
|
|
67736
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.8.0-next.
|
|
67713
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.8.0-next.2");
|
|
67737
67714
|
if (!this.options.ydoc) return;
|
|
67738
67715
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
67739
67716
|
let docVersion = metaMap.get("version");
|
|
@@ -73400,8 +73377,22 @@ ${o}
|
|
|
73400
73377
|
const FIELD_ANNOTATION_STYLES = `
|
|
73401
73378
|
/* Field annotation draggable styles */
|
|
73402
73379
|
.superdoc-layout .annotation[data-draggable="true"] {
|
|
73403
|
-
user-select:
|
|
73404
|
-
|
|
73380
|
+
user-select: text;
|
|
73381
|
+
}
|
|
73382
|
+
|
|
73383
|
+
.superdoc-layout .annotation::selection,
|
|
73384
|
+
.superdoc-layout .annotation *::selection {
|
|
73385
|
+
background: transparent;
|
|
73386
|
+
}
|
|
73387
|
+
|
|
73388
|
+
.superdoc-layout .annotation::-moz-selection,
|
|
73389
|
+
.superdoc-layout .annotation *::-moz-selection {
|
|
73390
|
+
background: transparent;
|
|
73391
|
+
}
|
|
73392
|
+
|
|
73393
|
+
.superdoc-layout .annotation,
|
|
73394
|
+
.superdoc-layout .annotation * {
|
|
73395
|
+
caret-color: transparent;
|
|
73405
73396
|
}
|
|
73406
73397
|
|
|
73407
73398
|
.superdoc-layout .annotation[data-draggable="true"]:hover {
|
|
@@ -104592,7 +104583,6 @@ ${o}
|
|
|
104592
104583
|
#layoutErrorState = "healthy";
|
|
104593
104584
|
#errorBanner = null;
|
|
104594
104585
|
#errorBannerMessage = null;
|
|
104595
|
-
#telemetryEmitter = null;
|
|
104596
104586
|
#renderScheduled = false;
|
|
104597
104587
|
#pendingDocChange = false;
|
|
104598
104588
|
#pendingMapping = null;
|
|
@@ -104628,6 +104618,7 @@ ${o}
|
|
|
104628
104618
|
#lastClickTime = 0;
|
|
104629
104619
|
#lastClickPosition = { x: 0, y: 0 };
|
|
104630
104620
|
#lastSelectedImageBlockId = null;
|
|
104621
|
+
#lastSelectedFieldAnnotation = null;
|
|
104631
104622
|
// Drag selection state
|
|
104632
104623
|
#dragAnchor = null;
|
|
104633
104624
|
#dragAnchorPageIndex = null;
|
|
@@ -105365,30 +105356,6 @@ ${o}
|
|
|
105365
105356
|
this.on("layoutError", handler2);
|
|
105366
105357
|
return () => this.off("layoutError", handler2);
|
|
105367
105358
|
}
|
|
105368
|
-
/**
|
|
105369
|
-
* Attach a telemetry listener to capture layout events/errors.
|
|
105370
|
-
* Uses type-safe discriminated union for event handling.
|
|
105371
|
-
*
|
|
105372
|
-
* @param handler - Callback function receiving telemetry events
|
|
105373
|
-
* @returns Unsubscribe function to remove the handler
|
|
105374
|
-
*
|
|
105375
|
-
* @example
|
|
105376
|
-
* ```typescript
|
|
105377
|
-
* const unsubscribe = editor.onTelemetry((event) => {
|
|
105378
|
-
* if (event.type === 'remoteCursorsRender') {
|
|
105379
|
-
* console.log(`Rendered ${event.data.visibleCount} cursors in ${event.data.renderTimeMs}ms`);
|
|
105380
|
-
* }
|
|
105381
|
-
* });
|
|
105382
|
-
* ```
|
|
105383
|
-
*/
|
|
105384
|
-
onTelemetry(handler2) {
|
|
105385
|
-
this.#telemetryEmitter = handler2;
|
|
105386
|
-
return () => {
|
|
105387
|
-
if (this.#telemetryEmitter === handler2) {
|
|
105388
|
-
this.#telemetryEmitter = null;
|
|
105389
|
-
}
|
|
105390
|
-
};
|
|
105391
|
-
}
|
|
105392
105359
|
/**
|
|
105393
105360
|
* Surface pages for pagination UI consumers.
|
|
105394
105361
|
*/
|
|
@@ -107803,9 +107770,6 @@ ${o}
|
|
|
107803
107770
|
this.emit("commentPositions", { positions: commentPositions });
|
|
107804
107771
|
}
|
|
107805
107772
|
}
|
|
107806
|
-
if (this.#telemetryEmitter && metrics) {
|
|
107807
|
-
this.#telemetryEmitter({ type: "layout", data: { layout, blocks: blocks2, measures, metrics } });
|
|
107808
|
-
}
|
|
107809
107773
|
this.#selectionSync.requestRender({ immediate: true });
|
|
107810
107774
|
if (this.#remoteCursorManager?.hasRemoteCursors()) {
|
|
107811
107775
|
this.#scheduleRemoteCursorReRender();
|
|
@@ -107904,6 +107868,45 @@ ${o}
|
|
|
107904
107868
|
#scheduleSelectionUpdate(options) {
|
|
107905
107869
|
this.#selectionSync.requestRender(options);
|
|
107906
107870
|
}
|
|
107871
|
+
#clearSelectedFieldAnnotationClass() {
|
|
107872
|
+
if (this.#lastSelectedFieldAnnotation?.element?.classList?.contains("ProseMirror-selectednode")) {
|
|
107873
|
+
this.#lastSelectedFieldAnnotation.element.classList.remove("ProseMirror-selectednode");
|
|
107874
|
+
}
|
|
107875
|
+
this.#lastSelectedFieldAnnotation = null;
|
|
107876
|
+
}
|
|
107877
|
+
#setSelectedFieldAnnotationClass(element2, pmStart) {
|
|
107878
|
+
if (this.#lastSelectedFieldAnnotation?.element && this.#lastSelectedFieldAnnotation.element !== element2) {
|
|
107879
|
+
this.#lastSelectedFieldAnnotation.element.classList.remove("ProseMirror-selectednode");
|
|
107880
|
+
}
|
|
107881
|
+
element2.classList.add("ProseMirror-selectednode");
|
|
107882
|
+
this.#lastSelectedFieldAnnotation = { element: element2, pmStart };
|
|
107883
|
+
}
|
|
107884
|
+
#syncSelectedFieldAnnotationClass(selection) {
|
|
107885
|
+
if (!selection || !(selection instanceof NodeSelection)) {
|
|
107886
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
107887
|
+
return;
|
|
107888
|
+
}
|
|
107889
|
+
const node2 = selection.node;
|
|
107890
|
+
if (!node2 || node2.type?.name !== "fieldAnnotation") {
|
|
107891
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
107892
|
+
return;
|
|
107893
|
+
}
|
|
107894
|
+
if (!this.#painterHost) {
|
|
107895
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
107896
|
+
return;
|
|
107897
|
+
}
|
|
107898
|
+
const pmStart = selection.from;
|
|
107899
|
+
if (this.#lastSelectedFieldAnnotation?.pmStart === pmStart && this.#lastSelectedFieldAnnotation.element) {
|
|
107900
|
+
return;
|
|
107901
|
+
}
|
|
107902
|
+
const selector = `.annotation[data-pm-start="${pmStart}"]`;
|
|
107903
|
+
const element2 = this.#painterHost.querySelector(selector);
|
|
107904
|
+
if (!element2) {
|
|
107905
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
107906
|
+
return;
|
|
107907
|
+
}
|
|
107908
|
+
this.#setSelectedFieldAnnotationClass(element2, pmStart);
|
|
107909
|
+
}
|
|
107907
107910
|
/**
|
|
107908
107911
|
* Updates the visual cursor/selection overlay to match the current editor selection.
|
|
107909
107912
|
*
|
|
@@ -107933,6 +107936,7 @@ ${o}
|
|
|
107933
107936
|
#updateSelection() {
|
|
107934
107937
|
const sessionMode = this.#headerFooterSession?.session?.mode ?? "body";
|
|
107935
107938
|
if (sessionMode !== "body") {
|
|
107939
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
107936
107940
|
return;
|
|
107937
107941
|
}
|
|
107938
107942
|
if (!this.#localSelectionLayer) {
|
|
@@ -107940,6 +107944,7 @@ ${o}
|
|
|
107940
107944
|
}
|
|
107941
107945
|
if (this.#isViewLocked()) {
|
|
107942
107946
|
try {
|
|
107947
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
107943
107948
|
this.#localSelectionLayer.innerHTML = "";
|
|
107944
107949
|
} catch (error) {
|
|
107945
107950
|
}
|
|
@@ -107950,6 +107955,7 @@ ${o}
|
|
|
107950
107955
|
const selection = editorState?.selection;
|
|
107951
107956
|
if (!selection) {
|
|
107952
107957
|
try {
|
|
107958
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
107953
107959
|
this.#localSelectionLayer.innerHTML = "";
|
|
107954
107960
|
} catch (error) {
|
|
107955
107961
|
}
|
|
@@ -107963,6 +107969,7 @@ ${o}
|
|
|
107963
107969
|
if (this.#layoutEpoch < docEpoch) {
|
|
107964
107970
|
return;
|
|
107965
107971
|
}
|
|
107972
|
+
this.#syncSelectedFieldAnnotationClass(selection);
|
|
107966
107973
|
this.#updateSelectionVirtualizationPins({ includeDragBuffer: this.#isDragging });
|
|
107967
107974
|
if (selection instanceof CellSelection) {
|
|
107968
107975
|
try {
|
|
@@ -107996,7 +108003,8 @@ ${o}
|
|
|
107996
108003
|
}
|
|
107997
108004
|
try {
|
|
107998
108005
|
this.#localSelectionLayer.innerHTML = "";
|
|
107999
|
-
|
|
108006
|
+
const isFieldAnnotationSelection = selection instanceof NodeSelection && selection.node?.type?.name === "fieldAnnotation";
|
|
108007
|
+
if (domRects.length > 0 && !isFieldAnnotationSelection) {
|
|
108000
108008
|
renderSelectionRects({
|
|
108001
108009
|
localSelectionLayer: this.#localSelectionLayer,
|
|
108002
108010
|
rects: domRects,
|
|
@@ -109502,9 +109510,6 @@ ${o}
|
|
|
109502
109510
|
this.#layoutErrorState = this.#layoutState.layout ? "degraded" : "failed";
|
|
109503
109511
|
}
|
|
109504
109512
|
this.emit("layoutError", this.#layoutError);
|
|
109505
|
-
if (this.#telemetryEmitter) {
|
|
109506
|
-
this.#telemetryEmitter({ type: "error", data: this.#layoutError });
|
|
109507
|
-
}
|
|
109508
109513
|
this.#showLayoutErrorBanner(error);
|
|
109509
109514
|
}
|
|
109510
109515
|
#decorateError(error, stage) {
|
|
@@ -123868,7 +123873,14 @@ ${o}
|
|
|
123868
123873
|
return commands2.rejectTrackedChangesBetween(from2, to);
|
|
123869
123874
|
},
|
|
123870
123875
|
insertTrackedChange: (options = {}) => ({ state, dispatch, editor }) => {
|
|
123871
|
-
const {
|
|
123876
|
+
const {
|
|
123877
|
+
from: from2 = state.selection.from,
|
|
123878
|
+
to = state.selection.to,
|
|
123879
|
+
text: text2 = "",
|
|
123880
|
+
user,
|
|
123881
|
+
comment: comment2,
|
|
123882
|
+
addToHistory = true
|
|
123883
|
+
} = options;
|
|
123872
123884
|
const docSize = state.doc.content.size;
|
|
123873
123885
|
if (from2 < 0 || to > docSize || from2 > to) {
|
|
123874
123886
|
console.warn("insertTrackedChange: invalid range", { from: from2, to, docSize });
|
|
@@ -123940,6 +123952,9 @@ ${o}
|
|
|
123940
123952
|
});
|
|
123941
123953
|
tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
123942
123954
|
tr.setMeta("skipTrackChanges", true);
|
|
123955
|
+
if (!addToHistory) {
|
|
123956
|
+
tr.setMeta("addToHistory", false);
|
|
123957
|
+
}
|
|
123943
123958
|
dispatch(tr);
|
|
123944
123959
|
if (comment2?.trim() && changeId && editor.commands.addCommentReply) {
|
|
123945
123960
|
editor.commands.addCommentReply({
|
|
@@ -144765,6 +144780,12 @@ ${style2}
|
|
|
144765
144780
|
const { command: command2 } = item;
|
|
144766
144781
|
const isMarkToggle = this.isMarkToggle(item);
|
|
144767
144782
|
const shouldRestoreFocus = Boolean(item?.restoreEditorFocus);
|
|
144783
|
+
const hasArgument = argument !== null && argument !== void 0;
|
|
144784
|
+
const isDropdownOpen = item?.type === "dropdown" && !hasArgument;
|
|
144785
|
+
const isFontCommand = item?.command === "setFontFamily" || item?.command === "setFontSize";
|
|
144786
|
+
if (isDropdownOpen && isFontCommand) {
|
|
144787
|
+
return;
|
|
144788
|
+
}
|
|
144768
144789
|
if (!wasFocused && isMarkToggle) {
|
|
144769
144790
|
this.pendingMarkCommands.push({ command: command2, argument, item });
|
|
144770
144791
|
item?.activate?.();
|
|
@@ -148258,7 +148279,11 @@ ${style2}
|
|
|
148258
148279
|
if (event.ctrlKey && isMacOS()) {
|
|
148259
148280
|
return;
|
|
148260
148281
|
}
|
|
148261
|
-
|
|
148282
|
+
const target = event.target;
|
|
148283
|
+
if (target?.classList?.contains("ProseMirror")) return;
|
|
148284
|
+
if (target?.closest?.(".presentation-editor, .superdoc-layout")) {
|
|
148285
|
+
return;
|
|
148286
|
+
}
|
|
148262
148287
|
onMarginClickCursorChange(event, activeEditor.value);
|
|
148263
148288
|
};
|
|
148264
148289
|
const handleMarginChange = ({ side, value }) => {
|
|
@@ -148423,7 +148448,7 @@ ${style2}
|
|
|
148423
148448
|
};
|
|
148424
148449
|
}
|
|
148425
148450
|
});
|
|
148426
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-
|
|
148451
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-da20b5ef"]]);
|
|
148427
148452
|
const _hoisted_1$h = ["innerHTML"];
|
|
148428
148453
|
const _sfc_main$i = {
|
|
148429
148454
|
__name: "SuperInput",
|
|
@@ -152781,9 +152806,6 @@ ${reason}`);
|
|
|
152781
152806
|
doc2.setPresentationEditor(presentationEditor);
|
|
152782
152807
|
}
|
|
152783
152808
|
presentationEditor.setContextMenuDisabled?.(proxy.$superdoc.config.disableContextMenu);
|
|
152784
|
-
presentationEditor.onTelemetry((telemetryPayload) => {
|
|
152785
|
-
proxy.$superdoc.captureLayoutPipelineEvent(telemetryPayload);
|
|
152786
|
-
});
|
|
152787
152809
|
presentationEditor.on("commentPositions", ({ positions }) => {
|
|
152788
152810
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
152789
152811
|
if (!commentsConfig || commentsConfig === false) return;
|
|
@@ -152975,7 +152997,6 @@ ${reason}`);
|
|
|
152975
152997
|
collaborationProvider: doc2.provider || null,
|
|
152976
152998
|
isNewFile: doc2.isNewFile || false,
|
|
152977
152999
|
handleImageUpload: proxy.$superdoc.config.handleImageUpload,
|
|
152978
|
-
telemetry: proxy.$superdoc.telemetry,
|
|
152979
153000
|
externalExtensions: proxy.$superdoc.config.editorExtensions || [],
|
|
152980
153001
|
suppressDefaultDocxStyles: proxy.$superdoc.config.suppressDefaultDocxStyles,
|
|
152981
153002
|
disableContextMenu: proxy.$superdoc.config.disableContextMenu,
|
|
@@ -153399,7 +153420,7 @@ ${reason}`);
|
|
|
153399
153420
|
};
|
|
153400
153421
|
}
|
|
153401
153422
|
};
|
|
153402
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
153423
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b35b3325"]]);
|
|
153403
153424
|
const createSuperdocVueApp = () => {
|
|
153404
153425
|
const app = createApp(App);
|
|
153405
153426
|
const pinia = createPinia();
|
|
@@ -153516,8 +153537,6 @@ ${reason}`);
|
|
|
153516
153537
|
// UI font for SuperDoc surfaces (toolbar, comments UI, etc.)
|
|
153517
153538
|
uiDisplayFallbackFont: "Arial, Helvetica, sans-serif",
|
|
153518
153539
|
isDev: false,
|
|
153519
|
-
// telemetry config
|
|
153520
|
-
telemetry: null,
|
|
153521
153540
|
// Events
|
|
153522
153541
|
onEditorBeforeCreate: () => null,
|
|
153523
153542
|
onEditorCreate: () => null,
|
|
@@ -153596,7 +153615,7 @@ ${reason}`);
|
|
|
153596
153615
|
this.config.colors = shuffleArray(this.config.colors);
|
|
153597
153616
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
153598
153617
|
this.colorIndex = 0;
|
|
153599
|
-
this.version = "1.8.0-next.
|
|
153618
|
+
this.version = "1.8.0-next.2";
|
|
153600
153619
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
153601
153620
|
this.superdocId = config2.superdocId || v4();
|
|
153602
153621
|
this.colors = this.config.colors;
|
|
@@ -154388,20 +154407,6 @@ ${reason}`);
|
|
|
154388
154407
|
this.activeEditor.setHighContrastMode(isHighContrast);
|
|
154389
154408
|
this.highContrastModeStore.setHighContrastMode(isHighContrast);
|
|
154390
154409
|
}
|
|
154391
|
-
/**
|
|
154392
|
-
* Capture layout pipeline events from PresentationEditor
|
|
154393
|
-
* Forwards metrics and errors to host callbacks
|
|
154394
|
-
* @param {Object} payload - Event payload from PresentationEditor.onTelemetry
|
|
154395
|
-
* @param {string} payload.type - Event type: 'layout' or 'error'
|
|
154396
|
-
* @param {Object} payload.data - Event data (metrics for layout, error details for error)
|
|
154397
|
-
* @returns {void}
|
|
154398
|
-
*/
|
|
154399
|
-
captureLayoutPipelineEvent(payload) {
|
|
154400
|
-
this.emit("layout-pipeline", payload);
|
|
154401
|
-
if (typeof this.config.onLayoutPipelineEvent === "function") {
|
|
154402
|
-
this.config.onLayoutPipelineEvent(payload);
|
|
154403
|
-
}
|
|
154404
|
-
}
|
|
154405
154410
|
}
|
|
154406
154411
|
function bail(error) {
|
|
154407
154412
|
if (error) {
|