@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jszip = require("./jszip-C8_CqJxM.cjs");
|
|
3
3
|
const helpers$1 = require("./helpers-nOdwpmwb.cjs");
|
|
4
|
-
const superEditor_converter = require("./SuperConverter-
|
|
4
|
+
const superEditor_converter = require("./SuperConverter-C-3oNlYo.cjs");
|
|
5
5
|
const vue = require("./vue-De9wkgLl.cjs");
|
|
6
6
|
require("./jszip.min-BPh2MMAa.cjs");
|
|
7
7
|
const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
|
|
@@ -13122,69 +13122,92 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
13122
13122
|
}
|
|
13123
13123
|
return comment.parentCommentId;
|
|
13124
13124
|
};
|
|
13125
|
-
const
|
|
13126
|
-
const
|
|
13127
|
-
const seen = /* @__PURE__ */ new Set();
|
|
13128
|
-
const trackedChangeCommentMeta = /* @__PURE__ */ new Map();
|
|
13125
|
+
const commentRanges = /* @__PURE__ */ new Map();
|
|
13126
|
+
const commentTrackedChangeId = /* @__PURE__ */ new Map();
|
|
13129
13127
|
doc2.descendants((node, pos) => {
|
|
13130
13128
|
const commentMarks = node.marks?.filter((mark) => mark.type.name === CommentMarkName) || [];
|
|
13129
|
+
if (!commentMarks.length) return;
|
|
13130
|
+
const nodeEnd = pos + node.nodeSize;
|
|
13131
|
+
const trackedChangeMark = node.marks?.find((mark) => TRACK_CHANGE_MARKS$1.includes(mark.type.name));
|
|
13132
|
+
const trackedChangeId = trackedChangeMark?.attrs?.id;
|
|
13131
13133
|
commentMarks.forEach((commentMark) => {
|
|
13132
13134
|
const { attrs = {} } = commentMark;
|
|
13133
13135
|
const { commentId } = attrs;
|
|
13134
13136
|
if (commentId === "pending") return;
|
|
13135
|
-
if (
|
|
13136
|
-
|
|
13137
|
-
|
|
13138
|
-
|
|
13139
|
-
|
|
13140
|
-
const trackedSpan = trackedChangeId ? trackedChangeSpanById.get(trackedChangeId) : null;
|
|
13141
|
-
if (trackedSpan) {
|
|
13142
|
-
trackedChangeCommentMeta.set(commentId, {
|
|
13143
|
-
comment,
|
|
13144
|
-
parentCommentId,
|
|
13145
|
-
trackedChangeId
|
|
13137
|
+
if (!commentRanges.has(commentId)) {
|
|
13138
|
+
commentRanges.set(commentId, {
|
|
13139
|
+
start: pos,
|
|
13140
|
+
end: nodeEnd,
|
|
13141
|
+
attrs
|
|
13146
13142
|
});
|
|
13147
|
-
|
|
13148
|
-
|
|
13143
|
+
} else {
|
|
13144
|
+
const existing = commentRanges.get(commentId);
|
|
13145
|
+
existing.start = Math.min(existing.start, pos);
|
|
13146
|
+
existing.end = Math.max(existing.end, nodeEnd);
|
|
13147
|
+
}
|
|
13148
|
+
if (trackedChangeId && !commentTrackedChangeId.has(commentId)) {
|
|
13149
|
+
commentTrackedChangeId.set(commentId, trackedChangeId);
|
|
13149
13150
|
}
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13151
|
+
});
|
|
13152
|
+
});
|
|
13153
|
+
const startNodes = [];
|
|
13154
|
+
const endNodes = [];
|
|
13155
|
+
const seen = /* @__PURE__ */ new Set();
|
|
13156
|
+
const trackedChangeCommentMeta = /* @__PURE__ */ new Map();
|
|
13157
|
+
commentRanges.forEach(({ start: start2, end: end2, attrs }, commentId) => {
|
|
13158
|
+
if (seen.has(commentId)) return;
|
|
13159
|
+
seen.add(commentId);
|
|
13160
|
+
const comment = commentMap.get(commentId);
|
|
13161
|
+
const parentCommentId = getThreadingParentId(comment);
|
|
13162
|
+
const trackedChangeId = commentTrackedChangeId.get(commentId);
|
|
13163
|
+
const trackedSpan = trackedChangeId ? trackedChangeSpanById.get(trackedChangeId) : null;
|
|
13164
|
+
if (trackedSpan) {
|
|
13165
|
+
trackedChangeCommentMeta.set(commentId, {
|
|
13166
|
+
comment,
|
|
13167
|
+
parentCommentId,
|
|
13168
|
+
trackedChangeId
|
|
13169
|
+
});
|
|
13170
|
+
return;
|
|
13171
|
+
}
|
|
13172
|
+
const commentStartNodeAttrs = getPreparedComment(attrs);
|
|
13173
|
+
const startNode = schema.nodes.commentRangeStart.create(commentStartNodeAttrs);
|
|
13174
|
+
startNodes.push({
|
|
13175
|
+
pos: start2,
|
|
13176
|
+
node: startNode,
|
|
13177
|
+
commentId,
|
|
13178
|
+
parentCommentId
|
|
13179
|
+
});
|
|
13180
|
+
const endNode = schema.nodes.commentRangeEnd.create(commentStartNodeAttrs);
|
|
13181
|
+
endNodes.push({
|
|
13182
|
+
pos: end2,
|
|
13183
|
+
node: endNode,
|
|
13184
|
+
commentId,
|
|
13185
|
+
parentCommentId
|
|
13186
|
+
});
|
|
13187
|
+
const childComments = comments.filter((c2) => getThreadingParentId(c2) === commentId).sort((a, b2) => a.createdTime - b2.createdTime);
|
|
13188
|
+
childComments.forEach((c2) => {
|
|
13189
|
+
if (seen.has(c2.commentId)) return;
|
|
13190
|
+
seen.add(c2.commentId);
|
|
13191
|
+
const childRange = commentRanges.get(c2.commentId);
|
|
13192
|
+
const childStart = childRange?.start ?? start2;
|
|
13193
|
+
const childEnd = childRange?.end ?? end2;
|
|
13194
|
+
const childMark = getPreparedComment({
|
|
13195
|
+
commentId: c2.commentId,
|
|
13196
|
+
internal: c2.isInternal
|
|
13197
|
+
});
|
|
13198
|
+
const childStartNode = schema.nodes.commentRangeStart.create(childMark);
|
|
13153
13199
|
startNodes.push({
|
|
13154
|
-
pos,
|
|
13155
|
-
node:
|
|
13156
|
-
commentId,
|
|
13157
|
-
parentCommentId
|
|
13200
|
+
pos: childStart,
|
|
13201
|
+
node: childStartNode,
|
|
13202
|
+
commentId: c2.commentId,
|
|
13203
|
+
parentCommentId: getThreadingParentId(c2)
|
|
13158
13204
|
});
|
|
13159
|
-
const
|
|
13205
|
+
const childEndNode = schema.nodes.commentRangeEnd.create(childMark);
|
|
13160
13206
|
endNodes.push({
|
|
13161
|
-
pos:
|
|
13162
|
-
node:
|
|
13163
|
-
commentId,
|
|
13164
|
-
parentCommentId
|
|
13165
|
-
});
|
|
13166
|
-
const childComments = comments.filter((c2) => getThreadingParentId(c2) === commentId).sort((a, b2) => a.createdTime - b2.createdTime);
|
|
13167
|
-
childComments.forEach((c2) => {
|
|
13168
|
-
if (seen.has(c2.commentId)) return;
|
|
13169
|
-
seen.add(c2.commentId);
|
|
13170
|
-
const childMark = getPreparedComment({
|
|
13171
|
-
commentId: c2.commentId,
|
|
13172
|
-
internal: c2.isInternal
|
|
13173
|
-
});
|
|
13174
|
-
const childStartNode = schema.nodes.commentRangeStart.create(childMark);
|
|
13175
|
-
startNodes.push({
|
|
13176
|
-
pos,
|
|
13177
|
-
node: childStartNode,
|
|
13178
|
-
commentId: c2.commentId,
|
|
13179
|
-
parentCommentId: getThreadingParentId(c2)
|
|
13180
|
-
});
|
|
13181
|
-
const childEndNode = schema.nodes.commentRangeEnd.create(childMark);
|
|
13182
|
-
endNodes.push({
|
|
13183
|
-
pos: pos + node.nodeSize,
|
|
13184
|
-
node: childEndNode,
|
|
13185
|
-
commentId: c2.commentId,
|
|
13186
|
-
parentCommentId: getThreadingParentId(c2)
|
|
13187
|
-
});
|
|
13207
|
+
pos: childEnd,
|
|
13208
|
+
node: childEndNode,
|
|
13209
|
+
commentId: c2.commentId,
|
|
13210
|
+
parentCommentId: getThreadingParentId(c2)
|
|
13188
13211
|
});
|
|
13189
13212
|
});
|
|
13190
13213
|
});
|
|
@@ -13214,6 +13237,34 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
13214
13237
|
commentId: comment.commentId,
|
|
13215
13238
|
parentCommentId
|
|
13216
13239
|
});
|
|
13240
|
+
const childComments = comments.filter((c2) => getThreadingParentId(c2) === comment.commentId).sort((a, b2) => a.createdTime - b2.createdTime);
|
|
13241
|
+
childComments.forEach((c2) => {
|
|
13242
|
+
if (seen.has(c2.commentId)) return;
|
|
13243
|
+
seen.add(c2.commentId);
|
|
13244
|
+
const childRange = commentRanges.get(c2.commentId);
|
|
13245
|
+
const childStart = childRange?.start ?? span.startPos;
|
|
13246
|
+
const childEnd = childRange?.end ?? span.endPos;
|
|
13247
|
+
const childStartMarks = childRange ? void 0 : startMarks;
|
|
13248
|
+
const childEndMarks = childRange ? void 0 : endMarks;
|
|
13249
|
+
const childMarkAttrs = getPreparedComment({
|
|
13250
|
+
commentId: c2.commentId,
|
|
13251
|
+
internal: c2.isInternal
|
|
13252
|
+
});
|
|
13253
|
+
const childStartNode2 = schema.nodes.commentRangeStart.create(childMarkAttrs, null, childStartMarks);
|
|
13254
|
+
startNodes.push({
|
|
13255
|
+
pos: childStart,
|
|
13256
|
+
node: childStartNode2,
|
|
13257
|
+
commentId: c2.commentId,
|
|
13258
|
+
parentCommentId: getThreadingParentId(c2)
|
|
13259
|
+
});
|
|
13260
|
+
const childEndNode2 = schema.nodes.commentRangeEnd.create(childMarkAttrs, null, childEndMarks);
|
|
13261
|
+
endNodes.push({
|
|
13262
|
+
pos: childEnd,
|
|
13263
|
+
node: childEndNode2,
|
|
13264
|
+
commentId: c2.commentId,
|
|
13265
|
+
parentCommentId: getThreadingParentId(c2)
|
|
13266
|
+
});
|
|
13267
|
+
});
|
|
13217
13268
|
});
|
|
13218
13269
|
comments.filter((comment) => trackedChangeSpanById.has(comment.parentCommentId) && !comment.trackedChange).sort((a, b2) => a.createdTime - b2.createdTime).forEach((comment) => {
|
|
13219
13270
|
if (seen.has(comment.commentId)) return;
|
|
@@ -16051,7 +16102,7 @@ const canUseDOM = () => {
|
|
|
16051
16102
|
return false;
|
|
16052
16103
|
}
|
|
16053
16104
|
};
|
|
16054
|
-
const summaryVersion = "1.8.0-next.
|
|
16105
|
+
const summaryVersion = "1.8.0-next.2";
|
|
16055
16106
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
16056
16107
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
16057
16108
|
function mapAttributes(attrs) {
|
|
@@ -16636,8 +16687,6 @@ class Editor extends EventEmitter {
|
|
|
16636
16687
|
onFontsResolved: null,
|
|
16637
16688
|
// async (file) => url;
|
|
16638
16689
|
handleImageUpload: null,
|
|
16639
|
-
// telemetry
|
|
16640
|
-
telemetry: null,
|
|
16641
16690
|
// Docx xml updated by User
|
|
16642
16691
|
customUpdatedFiles: {},
|
|
16643
16692
|
isHeaderFooterChanged: false,
|
|
@@ -17572,7 +17621,6 @@ class Editor extends EventEmitter {
|
|
|
17572
17621
|
media: this.options.mediaFiles,
|
|
17573
17622
|
fonts: this.options.fonts,
|
|
17574
17623
|
debug: true,
|
|
17575
|
-
telemetry: this.options.telemetry,
|
|
17576
17624
|
fileSource: this.options.fileSource,
|
|
17577
17625
|
documentId: this.options.documentId,
|
|
17578
17626
|
mockWindow: this.options.mockWindow ?? null,
|
|
@@ -17821,7 +17869,6 @@ class Editor extends EventEmitter {
|
|
|
17821
17869
|
handleClick: this.#handleNodeSelection.bind(this)
|
|
17822
17870
|
});
|
|
17823
17871
|
this.createNodeViews();
|
|
17824
|
-
this.options.telemetry?.trackUsage?.("editor_initialized", {});
|
|
17825
17872
|
}
|
|
17826
17873
|
/**
|
|
17827
17874
|
* Creates all node views.
|
|
@@ -18014,7 +18061,7 @@ class Editor extends EventEmitter {
|
|
|
18014
18061
|
this.#dispatchTransaction(tr);
|
|
18015
18062
|
}
|
|
18016
18063
|
/**
|
|
18017
|
-
* Get document identifier
|
|
18064
|
+
* Get document identifier (async - may generate hash)
|
|
18018
18065
|
*/
|
|
18019
18066
|
async getDocumentIdentifier() {
|
|
18020
18067
|
return await this.converter?.getDocumentIdentifier() || null;
|
|
@@ -18031,17 +18078,6 @@ class Editor extends EventEmitter {
|
|
|
18031
18078
|
isDocumentModified() {
|
|
18032
18079
|
return this.converter?.documentModified || false;
|
|
18033
18080
|
}
|
|
18034
|
-
/**
|
|
18035
|
-
* Get telemetry data (async because of lazy hash generation)
|
|
18036
|
-
*/
|
|
18037
|
-
async getTelemetryData() {
|
|
18038
|
-
return {
|
|
18039
|
-
documentId: await this.getDocumentIdentifier(),
|
|
18040
|
-
isModified: this.isDocumentModified(),
|
|
18041
|
-
isPermanentId: !!this.converter?.documentGuid,
|
|
18042
|
-
version: this.converter?.getSuperdocVersion()
|
|
18043
|
-
};
|
|
18044
|
-
}
|
|
18045
18081
|
/**
|
|
18046
18082
|
* @deprecated use getDocumentGuid instead
|
|
18047
18083
|
*/
|
|
@@ -18285,19 +18321,24 @@ class Editor extends EventEmitter {
|
|
|
18285
18321
|
commentsType = "external",
|
|
18286
18322
|
exportJsonOnly = false,
|
|
18287
18323
|
exportXmlOnly = false,
|
|
18288
|
-
comments
|
|
18324
|
+
comments,
|
|
18289
18325
|
getUpdatedDocs = false,
|
|
18290
18326
|
fieldsHighlightColor = null
|
|
18291
18327
|
} = {}) {
|
|
18292
18328
|
try {
|
|
18293
|
-
const
|
|
18329
|
+
const effectiveComments = comments ?? this.converter.comments ?? [];
|
|
18330
|
+
const preparedComments = effectiveComments.map((comment) => ({
|
|
18331
|
+
...comment,
|
|
18332
|
+
commentJSON: comment.commentJSON ?? comment.textJson
|
|
18333
|
+
}));
|
|
18334
|
+
const json = this.#prepareDocumentForExport(preparedComments);
|
|
18294
18335
|
const documentXml = await this.converter.exportToDocx(
|
|
18295
18336
|
json,
|
|
18296
18337
|
this.schema,
|
|
18297
18338
|
this.storage.image.media,
|
|
18298
18339
|
isFinalDoc,
|
|
18299
18340
|
commentsType,
|
|
18300
|
-
|
|
18341
|
+
preparedComments,
|
|
18301
18342
|
this,
|
|
18302
18343
|
exportJsonOnly,
|
|
18303
18344
|
fieldsHighlightColor
|
|
@@ -18343,7 +18384,7 @@ class Editor extends EventEmitter {
|
|
|
18343
18384
|
if (footnotesRelsXml) {
|
|
18344
18385
|
updatedDocs["word/_rels/footnotes.xml.rels"] = String(footnotesRelsXml);
|
|
18345
18386
|
}
|
|
18346
|
-
if (
|
|
18387
|
+
if (preparedComments.length) {
|
|
18347
18388
|
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
18348
18389
|
updatedDocs["word/comments.xml"] = String(commentsXml);
|
|
18349
18390
|
const commentsExtended = this.converter.convertedXml["word/commentsExtended.xml"];
|
|
@@ -18382,10 +18423,6 @@ class Editor extends EventEmitter {
|
|
|
18382
18423
|
fonts: this.options.fonts,
|
|
18383
18424
|
isHeadless: this.options.isHeadless
|
|
18384
18425
|
});
|
|
18385
|
-
this.options.telemetry?.trackUsage?.("document_export", {
|
|
18386
|
-
documentType: "docx",
|
|
18387
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
18388
|
-
});
|
|
18389
18426
|
return result;
|
|
18390
18427
|
} catch (error) {
|
|
18391
18428
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -18722,7 +18759,7 @@ class Editor extends EventEmitter {
|
|
|
18722
18759
|
* Process collaboration migrations
|
|
18723
18760
|
*/
|
|
18724
18761
|
processCollaborationMigrations() {
|
|
18725
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.8.0-next.
|
|
18762
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.8.0-next.2");
|
|
18726
18763
|
if (!this.options.ydoc) return;
|
|
18727
18764
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
18728
18765
|
let docVersion = metaMap.get("version");
|
|
@@ -24389,8 +24426,22 @@ const SDT_CONTAINER_STYLES = `
|
|
|
24389
24426
|
const FIELD_ANNOTATION_STYLES = `
|
|
24390
24427
|
/* Field annotation draggable styles */
|
|
24391
24428
|
.superdoc-layout .annotation[data-draggable="true"] {
|
|
24392
|
-
user-select:
|
|
24393
|
-
|
|
24429
|
+
user-select: text;
|
|
24430
|
+
}
|
|
24431
|
+
|
|
24432
|
+
.superdoc-layout .annotation::selection,
|
|
24433
|
+
.superdoc-layout .annotation *::selection {
|
|
24434
|
+
background: transparent;
|
|
24435
|
+
}
|
|
24436
|
+
|
|
24437
|
+
.superdoc-layout .annotation::-moz-selection,
|
|
24438
|
+
.superdoc-layout .annotation *::-moz-selection {
|
|
24439
|
+
background: transparent;
|
|
24440
|
+
}
|
|
24441
|
+
|
|
24442
|
+
.superdoc-layout .annotation,
|
|
24443
|
+
.superdoc-layout .annotation * {
|
|
24444
|
+
caret-color: transparent;
|
|
24394
24445
|
}
|
|
24395
24446
|
|
|
24396
24447
|
.superdoc-layout .annotation[data-draggable="true"]:hover {
|
|
@@ -55633,7 +55684,6 @@ class PresentationEditor extends EventEmitter {
|
|
|
55633
55684
|
#layoutErrorState = "healthy";
|
|
55634
55685
|
#errorBanner = null;
|
|
55635
55686
|
#errorBannerMessage = null;
|
|
55636
|
-
#telemetryEmitter = null;
|
|
55637
55687
|
#renderScheduled = false;
|
|
55638
55688
|
#pendingDocChange = false;
|
|
55639
55689
|
#pendingMapping = null;
|
|
@@ -55669,6 +55719,7 @@ class PresentationEditor extends EventEmitter {
|
|
|
55669
55719
|
#lastClickTime = 0;
|
|
55670
55720
|
#lastClickPosition = { x: 0, y: 0 };
|
|
55671
55721
|
#lastSelectedImageBlockId = null;
|
|
55722
|
+
#lastSelectedFieldAnnotation = null;
|
|
55672
55723
|
// Drag selection state
|
|
55673
55724
|
#dragAnchor = null;
|
|
55674
55725
|
#dragAnchorPageIndex = null;
|
|
@@ -56406,30 +56457,6 @@ class PresentationEditor extends EventEmitter {
|
|
|
56406
56457
|
this.on("layoutError", handler);
|
|
56407
56458
|
return () => this.off("layoutError", handler);
|
|
56408
56459
|
}
|
|
56409
|
-
/**
|
|
56410
|
-
* Attach a telemetry listener to capture layout events/errors.
|
|
56411
|
-
* Uses type-safe discriminated union for event handling.
|
|
56412
|
-
*
|
|
56413
|
-
* @param handler - Callback function receiving telemetry events
|
|
56414
|
-
* @returns Unsubscribe function to remove the handler
|
|
56415
|
-
*
|
|
56416
|
-
* @example
|
|
56417
|
-
* ```typescript
|
|
56418
|
-
* const unsubscribe = editor.onTelemetry((event) => {
|
|
56419
|
-
* if (event.type === 'remoteCursorsRender') {
|
|
56420
|
-
* console.log(`Rendered ${event.data.visibleCount} cursors in ${event.data.renderTimeMs}ms`);
|
|
56421
|
-
* }
|
|
56422
|
-
* });
|
|
56423
|
-
* ```
|
|
56424
|
-
*/
|
|
56425
|
-
onTelemetry(handler) {
|
|
56426
|
-
this.#telemetryEmitter = handler;
|
|
56427
|
-
return () => {
|
|
56428
|
-
if (this.#telemetryEmitter === handler) {
|
|
56429
|
-
this.#telemetryEmitter = null;
|
|
56430
|
-
}
|
|
56431
|
-
};
|
|
56432
|
-
}
|
|
56433
56460
|
/**
|
|
56434
56461
|
* Surface pages for pagination UI consumers.
|
|
56435
56462
|
*/
|
|
@@ -58873,9 +58900,6 @@ class PresentationEditor extends EventEmitter {
|
|
|
58873
58900
|
this.emit("commentPositions", { positions: commentPositions });
|
|
58874
58901
|
}
|
|
58875
58902
|
}
|
|
58876
|
-
if (this.#telemetryEmitter && metrics) {
|
|
58877
|
-
this.#telemetryEmitter({ type: "layout", data: { layout, blocks, measures, metrics } });
|
|
58878
|
-
}
|
|
58879
58903
|
this.#selectionSync.requestRender({ immediate: true });
|
|
58880
58904
|
if (this.#remoteCursorManager?.hasRemoteCursors()) {
|
|
58881
58905
|
this.#scheduleRemoteCursorReRender();
|
|
@@ -58974,6 +58998,45 @@ class PresentationEditor extends EventEmitter {
|
|
|
58974
58998
|
#scheduleSelectionUpdate(options) {
|
|
58975
58999
|
this.#selectionSync.requestRender(options);
|
|
58976
59000
|
}
|
|
59001
|
+
#clearSelectedFieldAnnotationClass() {
|
|
59002
|
+
if (this.#lastSelectedFieldAnnotation?.element?.classList?.contains("ProseMirror-selectednode")) {
|
|
59003
|
+
this.#lastSelectedFieldAnnotation.element.classList.remove("ProseMirror-selectednode");
|
|
59004
|
+
}
|
|
59005
|
+
this.#lastSelectedFieldAnnotation = null;
|
|
59006
|
+
}
|
|
59007
|
+
#setSelectedFieldAnnotationClass(element, pmStart) {
|
|
59008
|
+
if (this.#lastSelectedFieldAnnotation?.element && this.#lastSelectedFieldAnnotation.element !== element) {
|
|
59009
|
+
this.#lastSelectedFieldAnnotation.element.classList.remove("ProseMirror-selectednode");
|
|
59010
|
+
}
|
|
59011
|
+
element.classList.add("ProseMirror-selectednode");
|
|
59012
|
+
this.#lastSelectedFieldAnnotation = { element, pmStart };
|
|
59013
|
+
}
|
|
59014
|
+
#syncSelectedFieldAnnotationClass(selection) {
|
|
59015
|
+
if (!selection || !(selection instanceof superEditor_converter.NodeSelection)) {
|
|
59016
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
59017
|
+
return;
|
|
59018
|
+
}
|
|
59019
|
+
const node = selection.node;
|
|
59020
|
+
if (!node || node.type?.name !== "fieldAnnotation") {
|
|
59021
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
59022
|
+
return;
|
|
59023
|
+
}
|
|
59024
|
+
if (!this.#painterHost) {
|
|
59025
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
59026
|
+
return;
|
|
59027
|
+
}
|
|
59028
|
+
const pmStart = selection.from;
|
|
59029
|
+
if (this.#lastSelectedFieldAnnotation?.pmStart === pmStart && this.#lastSelectedFieldAnnotation.element) {
|
|
59030
|
+
return;
|
|
59031
|
+
}
|
|
59032
|
+
const selector = `.annotation[data-pm-start="${pmStart}"]`;
|
|
59033
|
+
const element = this.#painterHost.querySelector(selector);
|
|
59034
|
+
if (!element) {
|
|
59035
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
59036
|
+
return;
|
|
59037
|
+
}
|
|
59038
|
+
this.#setSelectedFieldAnnotationClass(element, pmStart);
|
|
59039
|
+
}
|
|
58977
59040
|
/**
|
|
58978
59041
|
* Updates the visual cursor/selection overlay to match the current editor selection.
|
|
58979
59042
|
*
|
|
@@ -59003,6 +59066,7 @@ class PresentationEditor extends EventEmitter {
|
|
|
59003
59066
|
#updateSelection() {
|
|
59004
59067
|
const sessionMode = this.#headerFooterSession?.session?.mode ?? "body";
|
|
59005
59068
|
if (sessionMode !== "body") {
|
|
59069
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
59006
59070
|
return;
|
|
59007
59071
|
}
|
|
59008
59072
|
if (!this.#localSelectionLayer) {
|
|
@@ -59010,6 +59074,7 @@ class PresentationEditor extends EventEmitter {
|
|
|
59010
59074
|
}
|
|
59011
59075
|
if (this.#isViewLocked()) {
|
|
59012
59076
|
try {
|
|
59077
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
59013
59078
|
this.#localSelectionLayer.innerHTML = "";
|
|
59014
59079
|
} catch (error) {
|
|
59015
59080
|
if (vue.process$1.env.NODE_ENV === "development") {
|
|
@@ -59023,6 +59088,7 @@ class PresentationEditor extends EventEmitter {
|
|
|
59023
59088
|
const selection = editorState?.selection;
|
|
59024
59089
|
if (!selection) {
|
|
59025
59090
|
try {
|
|
59091
|
+
this.#clearSelectedFieldAnnotationClass();
|
|
59026
59092
|
this.#localSelectionLayer.innerHTML = "";
|
|
59027
59093
|
} catch (error) {
|
|
59028
59094
|
if (vue.process$1.env.NODE_ENV === "development") {
|
|
@@ -59039,6 +59105,7 @@ class PresentationEditor extends EventEmitter {
|
|
|
59039
59105
|
if (this.#layoutEpoch < docEpoch) {
|
|
59040
59106
|
return;
|
|
59041
59107
|
}
|
|
59108
|
+
this.#syncSelectedFieldAnnotationClass(selection);
|
|
59042
59109
|
this.#updateSelectionVirtualizationPins({ includeDragBuffer: this.#isDragging });
|
|
59043
59110
|
if (selection instanceof CellSelection) {
|
|
59044
59111
|
try {
|
|
@@ -59075,7 +59142,8 @@ class PresentationEditor extends EventEmitter {
|
|
|
59075
59142
|
}
|
|
59076
59143
|
try {
|
|
59077
59144
|
this.#localSelectionLayer.innerHTML = "";
|
|
59078
|
-
|
|
59145
|
+
const isFieldAnnotationSelection = selection instanceof superEditor_converter.NodeSelection && selection.node?.type?.name === "fieldAnnotation";
|
|
59146
|
+
if (domRects.length > 0 && !isFieldAnnotationSelection) {
|
|
59079
59147
|
renderSelectionRects({
|
|
59080
59148
|
localSelectionLayer: this.#localSelectionLayer,
|
|
59081
59149
|
rects: domRects,
|
|
@@ -60590,9 +60658,6 @@ class PresentationEditor extends EventEmitter {
|
|
|
60590
60658
|
this.#layoutErrorState = this.#layoutState.layout ? "degraded" : "failed";
|
|
60591
60659
|
}
|
|
60592
60660
|
this.emit("layoutError", this.#layoutError);
|
|
60593
|
-
if (this.#telemetryEmitter) {
|
|
60594
|
-
this.#telemetryEmitter({ type: "error", data: this.#layoutError });
|
|
60595
|
-
}
|
|
60596
60661
|
this.#showLayoutErrorBanner(error);
|
|
60597
60662
|
}
|
|
60598
60663
|
#decorateError(error, stage) {
|
|
@@ -74965,7 +75030,14 @@ const TrackChanges = Extension.create({
|
|
|
74965
75030
|
return commands2.rejectTrackedChangesBetween(from3, to);
|
|
74966
75031
|
},
|
|
74967
75032
|
insertTrackedChange: (options = {}) => ({ state, dispatch, editor }) => {
|
|
74968
|
-
const {
|
|
75033
|
+
const {
|
|
75034
|
+
from: from3 = state.selection.from,
|
|
75035
|
+
to = state.selection.to,
|
|
75036
|
+
text = "",
|
|
75037
|
+
user,
|
|
75038
|
+
comment,
|
|
75039
|
+
addToHistory = true
|
|
75040
|
+
} = options;
|
|
74969
75041
|
const docSize = state.doc.content.size;
|
|
74970
75042
|
if (from3 < 0 || to > docSize || from3 > to) {
|
|
74971
75043
|
console.warn("insertTrackedChange: invalid range", { from: from3, to, docSize });
|
|
@@ -75037,6 +75109,9 @@ const TrackChanges = Extension.create({
|
|
|
75037
75109
|
});
|
|
75038
75110
|
tr.setMeta(CommentsPluginKey, { type: "force" });
|
|
75039
75111
|
tr.setMeta("skipTrackChanges", true);
|
|
75112
|
+
if (!addToHistory) {
|
|
75113
|
+
tr.setMeta("addToHistory", false);
|
|
75114
|
+
}
|
|
75040
75115
|
dispatch(tr);
|
|
75041
75116
|
if (comment?.trim() && changeId && editor.commands.addCommentReply) {
|
|
75042
75117
|
editor.commands.addCommentReply({
|
|
@@ -93783,6 +93858,12 @@ class SuperToolbar extends eventemitter3.EventEmitter {
|
|
|
93783
93858
|
const { command: command2 } = item;
|
|
93784
93859
|
const isMarkToggle = this.isMarkToggle(item);
|
|
93785
93860
|
const shouldRestoreFocus = Boolean(item?.restoreEditorFocus);
|
|
93861
|
+
const hasArgument = argument !== null && argument !== void 0;
|
|
93862
|
+
const isDropdownOpen = item?.type === "dropdown" && !hasArgument;
|
|
93863
|
+
const isFontCommand = item?.command === "setFontFamily" || item?.command === "setFontSize";
|
|
93864
|
+
if (isDropdownOpen && isFontCommand) {
|
|
93865
|
+
return;
|
|
93866
|
+
}
|
|
93786
93867
|
if (!wasFocused && isMarkToggle) {
|
|
93787
93868
|
this.pendingMarkCommands.push({ command: command2, argument, item });
|
|
93788
93869
|
item?.activate?.();
|
|
@@ -97267,7 +97348,11 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
97267
97348
|
if (event.ctrlKey && isMacOS()) {
|
|
97268
97349
|
return;
|
|
97269
97350
|
}
|
|
97270
|
-
|
|
97351
|
+
const target = event.target;
|
|
97352
|
+
if (target?.classList?.contains("ProseMirror")) return;
|
|
97353
|
+
if (target?.closest?.(".presentation-editor, .superdoc-layout")) {
|
|
97354
|
+
return;
|
|
97355
|
+
}
|
|
97271
97356
|
onMarginClickCursorChange(event, activeEditor.value);
|
|
97272
97357
|
};
|
|
97273
97358
|
const handleMarginChange = ({ side, value }) => {
|
|
@@ -97432,7 +97517,7 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
97432
97517
|
};
|
|
97433
97518
|
}
|
|
97434
97519
|
});
|
|
97435
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
97520
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-da20b5ef"]]);
|
|
97436
97521
|
const _hoisted_1 = ["innerHTML"];
|
|
97437
97522
|
const _sfc_main = {
|
|
97438
97523
|
__name: "SuperInput",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const index = require("./index-
|
|
3
|
-
require("./SuperConverter-dgfpDdcg.cjs");
|
|
2
|
+
const index = require("./index-3dXTFEES.cjs");
|
|
4
3
|
const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
|
|
5
4
|
const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
|
|
6
5
|
const provider = require("@hocuspocus/provider");
|
|
7
6
|
require("./jszip-C8_CqJxM.cjs");
|
|
8
7
|
require("./helpers-nOdwpmwb.cjs");
|
|
8
|
+
require("./SuperConverter-C-3oNlYo.cjs");
|
|
9
9
|
const vue = require("./vue-De9wkgLl.cjs");
|
|
10
10
|
require("./jszip.min-BPh2MMAa.cjs");
|
|
11
11
|
const superEditor_fileZipper = require("../super-editor/file-zipper.cjs");
|
|
@@ -7552,7 +7552,7 @@ const _sfc_main = {
|
|
|
7552
7552
|
__name: "SuperDoc",
|
|
7553
7553
|
emits: ["selection-update"],
|
|
7554
7554
|
setup(__props, { emit: __emit }) {
|
|
7555
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
7555
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-HJyFvElE.cjs")));
|
|
7556
7556
|
const superdocStore = useSuperdocStore();
|
|
7557
7557
|
const commentsStore = useCommentsStore();
|
|
7558
7558
|
const {
|
|
@@ -7691,9 +7691,6 @@ const _sfc_main = {
|
|
|
7691
7691
|
doc.setPresentationEditor(presentationEditor);
|
|
7692
7692
|
}
|
|
7693
7693
|
presentationEditor.setContextMenuDisabled?.(proxy.$superdoc.config.disableContextMenu);
|
|
7694
|
-
presentationEditor.onTelemetry((telemetryPayload) => {
|
|
7695
|
-
proxy.$superdoc.captureLayoutPipelineEvent(telemetryPayload);
|
|
7696
|
-
});
|
|
7697
7694
|
presentationEditor.on("commentPositions", ({ positions }) => {
|
|
7698
7695
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
7699
7696
|
if (!commentsConfig || commentsConfig === false) return;
|
|
@@ -7885,7 +7882,6 @@ const _sfc_main = {
|
|
|
7885
7882
|
collaborationProvider: doc.provider || null,
|
|
7886
7883
|
isNewFile: doc.isNewFile || false,
|
|
7887
7884
|
handleImageUpload: proxy.$superdoc.config.handleImageUpload,
|
|
7888
|
-
telemetry: proxy.$superdoc.telemetry,
|
|
7889
7885
|
externalExtensions: proxy.$superdoc.config.editorExtensions || [],
|
|
7890
7886
|
suppressDefaultDocxStyles: proxy.$superdoc.config.suppressDefaultDocxStyles,
|
|
7891
7887
|
disableContextMenu: proxy.$superdoc.config.disableContextMenu,
|
|
@@ -8309,7 +8305,7 @@ const _sfc_main = {
|
|
|
8309
8305
|
};
|
|
8310
8306
|
}
|
|
8311
8307
|
};
|
|
8312
|
-
const App = /* @__PURE__ */ index._export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
8308
|
+
const App = /* @__PURE__ */ index._export_sfc(_sfc_main, [["__scopeId", "data-v-b35b3325"]]);
|
|
8313
8309
|
const createSuperdocVueApp = () => {
|
|
8314
8310
|
const app = vue.createApp(App);
|
|
8315
8311
|
const pinia = createPinia();
|
|
@@ -8426,8 +8422,6 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8426
8422
|
// UI font for SuperDoc surfaces (toolbar, comments UI, etc.)
|
|
8427
8423
|
uiDisplayFallbackFont: "Arial, Helvetica, sans-serif",
|
|
8428
8424
|
isDev: false,
|
|
8429
|
-
// telemetry config
|
|
8430
|
-
telemetry: null,
|
|
8431
8425
|
// Events
|
|
8432
8426
|
onEditorBeforeCreate: () => null,
|
|
8433
8427
|
onEditorCreate: () => null,
|
|
@@ -8506,7 +8500,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
8506
8500
|
this.config.colors = shuffleArray(this.config.colors);
|
|
8507
8501
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
8508
8502
|
this.colorIndex = 0;
|
|
8509
|
-
this.version = "1.8.0-next.
|
|
8503
|
+
this.version = "1.8.0-next.2";
|
|
8510
8504
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
8511
8505
|
this.superdocId = config.superdocId || uuid.v4();
|
|
8512
8506
|
this.colors = this.config.colors;
|
|
@@ -9298,20 +9292,6 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
9298
9292
|
this.activeEditor.setHighContrastMode(isHighContrast);
|
|
9299
9293
|
this.highContrastModeStore.setHighContrastMode(isHighContrast);
|
|
9300
9294
|
}
|
|
9301
|
-
/**
|
|
9302
|
-
* Capture layout pipeline events from PresentationEditor
|
|
9303
|
-
* Forwards metrics and errors to host callbacks
|
|
9304
|
-
* @param {Object} payload - Event payload from PresentationEditor.onTelemetry
|
|
9305
|
-
* @param {string} payload.type - Event type: 'layout' or 'error'
|
|
9306
|
-
* @param {Object} payload.data - Event data (metrics for layout, error details for error)
|
|
9307
|
-
* @returns {void}
|
|
9308
|
-
*/
|
|
9309
|
-
captureLayoutPipelineEvent(payload) {
|
|
9310
|
-
this.emit("layout-pipeline", payload);
|
|
9311
|
-
if (typeof this.config.onLayoutPipelineEvent === "function") {
|
|
9312
|
-
this.config.onLayoutPipelineEvent(payload);
|
|
9313
|
-
}
|
|
9314
|
-
}
|
|
9315
9295
|
}
|
|
9316
9296
|
exports.DOCX = DOCX;
|
|
9317
9297
|
exports.HTML = HTML;
|