@harbour-enterprises/superdoc 1.3.0-next.8 → 1.3.0
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-CjwO2nPe.es.js → PdfViewer-DfR5FJ1X.es.js} +2 -2
- package/dist/chunks/{PdfViewer-fF1B6H-9.cjs → PdfViewer-DnMzmTRw.cjs} +2 -2
- package/dist/chunks/{SuperConverter-d7nvQrVD.cjs → SuperConverter-BJ-tba6U.cjs} +2 -1
- package/dist/chunks/{SuperConverter-DwLhA2mM.es.js → SuperConverter-z20LprsX.es.js} +13 -12
- package/dist/chunks/{index-DoZiv8EQ.es.js → index-BEA-hKnM.es.js} +397 -74
- package/dist/chunks/{index-U7zpbaq1.es.js → index-BrCOOZsx.es.js} +36 -8
- package/dist/chunks/{index-DzCJy9Bf.cjs → index-CL5NVKmk.cjs} +397 -74
- package/dist/chunks/{index-B2Aynj2f.cjs → index-EMK5q5lA.cjs} +36 -8
- package/dist/style.css +40 -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.map +1 -1
- package/dist/superdoc/src/stores/comments-store.d.ts +4 -1
- package/dist/superdoc/src/stores/comments-store.d.ts.map +1 -1
- package/dist/superdoc/src/stores/superdoc-store.d.ts +12 -3
- package/dist/superdoc/src/stores/superdoc-store.d.ts.map +1 -1
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +432 -81
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/superdoc.umd.js
CHANGED
|
@@ -36435,7 +36435,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36435
36435
|
static getStoredSuperdocVersion(docx) {
|
|
36436
36436
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
36437
36437
|
}
|
|
36438
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.3.0
|
|
36438
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.3.0") {
|
|
36439
36439
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
36440
36440
|
}
|
|
36441
36441
|
/**
|
|
@@ -47282,6 +47282,105 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
47282
47282
|
tr.setNodeMarkup(pos, void 0, nextAttrs, node2.marks);
|
|
47283
47283
|
return true;
|
|
47284
47284
|
};
|
|
47285
|
+
function findGoverningSectPrParagraph(doc2, selectionPos) {
|
|
47286
|
+
const candidates = [];
|
|
47287
|
+
doc2.descendants((node2, nodePos) => {
|
|
47288
|
+
if (node2.type?.name === "paragraph" && node2.attrs?.paragraphProperties?.sectPr) {
|
|
47289
|
+
candidates.push({ node: node2, pos: nodePos });
|
|
47290
|
+
}
|
|
47291
|
+
});
|
|
47292
|
+
if (!candidates.length) return null;
|
|
47293
|
+
const inside = candidates.find((c2) => selectionPos >= c2.pos && selectionPos < c2.pos + c2.node.nodeSize);
|
|
47294
|
+
if (inside) return inside;
|
|
47295
|
+
const atOrAfter = candidates.find((c2) => c2.pos >= selectionPos);
|
|
47296
|
+
return atOrAfter ?? candidates[candidates.length - 1];
|
|
47297
|
+
}
|
|
47298
|
+
const setSectionPageMarginsAtSelection = ({ topInches, rightInches, bottomInches, leftInches } = {}) => ({ tr, state, editor }) => {
|
|
47299
|
+
if (!state || !editor) {
|
|
47300
|
+
console.warn("[setSectionPageMarginsAtSelection] Missing state or editor");
|
|
47301
|
+
return false;
|
|
47302
|
+
}
|
|
47303
|
+
const hasTop = typeof topInches === "number";
|
|
47304
|
+
const hasRight = typeof rightInches === "number";
|
|
47305
|
+
const hasBottom = typeof bottomInches === "number";
|
|
47306
|
+
const hasLeft = typeof leftInches === "number";
|
|
47307
|
+
if (!hasTop && !hasRight && !hasBottom && !hasLeft) {
|
|
47308
|
+
console.warn("[setSectionPageMarginsAtSelection] No margin values provided");
|
|
47309
|
+
return false;
|
|
47310
|
+
}
|
|
47311
|
+
if (hasTop && topInches < 0 || hasRight && rightInches < 0 || hasBottom && bottomInches < 0 || hasLeft && leftInches < 0) {
|
|
47312
|
+
console.warn("[setSectionPageMarginsAtSelection] Margin values must be >= 0");
|
|
47313
|
+
return false;
|
|
47314
|
+
}
|
|
47315
|
+
const updates = {};
|
|
47316
|
+
if (hasTop) updates.topInches = topInches;
|
|
47317
|
+
if (hasRight) updates.rightInches = rightInches;
|
|
47318
|
+
if (hasBottom) updates.bottomInches = bottomInches;
|
|
47319
|
+
if (hasLeft) updates.leftInches = leftInches;
|
|
47320
|
+
const { from: from2 } = state.selection;
|
|
47321
|
+
const governing = findGoverningSectPrParagraph(state.doc, from2);
|
|
47322
|
+
if (governing) {
|
|
47323
|
+
const { node: node2, pos } = governing;
|
|
47324
|
+
const paraProps = node2.attrs?.paragraphProperties || null;
|
|
47325
|
+
const existingSectPr = paraProps?.sectPr || null;
|
|
47326
|
+
if (!existingSectPr) {
|
|
47327
|
+
console.warn("[setSectionPageMarginsAtSelection] Paragraph found but has no sectPr");
|
|
47328
|
+
return false;
|
|
47329
|
+
}
|
|
47330
|
+
const sectPr2 = JSON.parse(JSON.stringify(existingSectPr));
|
|
47331
|
+
try {
|
|
47332
|
+
updateSectionMargins({ type: "sectPr", sectPr: sectPr2 }, updates);
|
|
47333
|
+
} catch (err) {
|
|
47334
|
+
console.error("[setSectionPageMarginsAtSelection] Failed to update sectPr:", err);
|
|
47335
|
+
return false;
|
|
47336
|
+
}
|
|
47337
|
+
const resolved = getSectPrMargins(sectPr2);
|
|
47338
|
+
const normalizedSectionMargins = {
|
|
47339
|
+
top: resolved.top ?? null,
|
|
47340
|
+
right: resolved.right ?? null,
|
|
47341
|
+
bottom: resolved.bottom ?? null,
|
|
47342
|
+
left: resolved.left ?? null,
|
|
47343
|
+
header: resolved.header ?? null,
|
|
47344
|
+
footer: resolved.footer ?? null
|
|
47345
|
+
};
|
|
47346
|
+
const newParagraphProperties = { ...paraProps || {}, sectPr: sectPr2 };
|
|
47347
|
+
const nextAttrs = {
|
|
47348
|
+
...node2.attrs,
|
|
47349
|
+
paragraphProperties: newParagraphProperties,
|
|
47350
|
+
sectionMargins: normalizedSectionMargins
|
|
47351
|
+
};
|
|
47352
|
+
tr.setNodeMarkup(pos, void 0, nextAttrs, node2.marks);
|
|
47353
|
+
tr.setMeta("forceUpdatePagination", true);
|
|
47354
|
+
return true;
|
|
47355
|
+
}
|
|
47356
|
+
const docAttrs = state.doc.attrs ?? {};
|
|
47357
|
+
const converter = editor.converter ?? null;
|
|
47358
|
+
const baseBodySectPr = docAttrs.bodySectPr || converter?.bodySectPr || null;
|
|
47359
|
+
const sectPr = baseBodySectPr != null ? JSON.parse(JSON.stringify(baseBodySectPr)) : { type: "element", name: "w:sectPr", elements: [] };
|
|
47360
|
+
try {
|
|
47361
|
+
updateSectionMargins({ type: "sectPr", sectPr }, updates);
|
|
47362
|
+
} catch (err) {
|
|
47363
|
+
console.error("[setSectionPageMarginsAtSelection] Failed to update sectPr:", err);
|
|
47364
|
+
return false;
|
|
47365
|
+
}
|
|
47366
|
+
if (converter) {
|
|
47367
|
+
converter.bodySectPr = sectPr;
|
|
47368
|
+
if (!converter.pageStyles) converter.pageStyles = {};
|
|
47369
|
+
if (!converter.pageStyles.pageMargins) converter.pageStyles.pageMargins = {};
|
|
47370
|
+
const pageMargins = converter.pageStyles.pageMargins;
|
|
47371
|
+
const resolved = getSectPrMargins(sectPr);
|
|
47372
|
+
if (resolved.top != null) pageMargins.top = resolved.top;
|
|
47373
|
+
if (resolved.right != null) pageMargins.right = resolved.right;
|
|
47374
|
+
if (resolved.bottom != null) pageMargins.bottom = resolved.bottom;
|
|
47375
|
+
if (resolved.left != null) pageMargins.left = resolved.left;
|
|
47376
|
+
if (resolved.header != null) pageMargins.header = resolved.header;
|
|
47377
|
+
if (resolved.footer != null) pageMargins.footer = resolved.footer;
|
|
47378
|
+
}
|
|
47379
|
+
const nextDocAttrs = { ...docAttrs, bodySectPr: sectPr };
|
|
47380
|
+
tr.setNodeMarkup(0, void 0, nextDocAttrs);
|
|
47381
|
+
tr.setMeta("forceUpdatePagination", true);
|
|
47382
|
+
return true;
|
|
47383
|
+
};
|
|
47285
47384
|
const insertSectionBreakAtSelection = ({ headerInches, footerInches } = {}) => ({ tr, state, editor }) => {
|
|
47286
47385
|
if (!state || !editor) {
|
|
47287
47386
|
console.warn("[insertSectionBreakAtSelection] Missing state or editor");
|
|
@@ -47813,6 +47912,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
47813
47912
|
setMeta,
|
|
47814
47913
|
setNode,
|
|
47815
47914
|
setSectionHeaderFooterAtSelection,
|
|
47915
|
+
setSectionPageMarginsAtSelection,
|
|
47816
47916
|
setTextIndentation,
|
|
47817
47917
|
setTextSelection,
|
|
47818
47918
|
skipTab,
|
|
@@ -49548,8 +49648,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
49548
49648
|
}
|
|
49549
49649
|
if (!onlyActiveThreadChanged) {
|
|
49550
49650
|
const positionsChanged = hasPositionsChanged(prevAllCommentPositions, allCommentPositions);
|
|
49551
|
-
const
|
|
49552
|
-
const shouldEmitPositions = positionsChanged || !hasEverEmitted &&
|
|
49651
|
+
const hasComments2 = Object.keys(allCommentPositions).length > 0;
|
|
49652
|
+
const shouldEmitPositions = positionsChanged || !hasEverEmitted && hasComments2;
|
|
49553
49653
|
if (shouldEmitPositions) {
|
|
49554
49654
|
prevAllCommentPositions = allCommentPositions;
|
|
49555
49655
|
hasEverEmitted = true;
|
|
@@ -52857,7 +52957,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
52857
52957
|
}
|
|
52858
52958
|
const xmlJson = JSON.parse(libExports.xml2json(contentTypesXml, null, 2));
|
|
52859
52959
|
const types2 = xmlJson.elements?.find((el) => el.name === "Types") || {};
|
|
52860
|
-
const
|
|
52960
|
+
const hasComments2 = types2.elements?.some(
|
|
52861
52961
|
(el) => el.name === "Override" && el.attributes.PartName === "/word/comments.xml"
|
|
52862
52962
|
);
|
|
52863
52963
|
const hasCommentsExtended = types2.elements?.some(
|
|
@@ -52877,7 +52977,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
52877
52977
|
};
|
|
52878
52978
|
if (hasFile("word/comments.xml")) {
|
|
52879
52979
|
const commentsDef = `<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" />`;
|
|
52880
|
-
if (!
|
|
52980
|
+
if (!hasComments2) typesString += commentsDef;
|
|
52881
52981
|
}
|
|
52882
52982
|
if (hasFile("word/commentsExtended.xml")) {
|
|
52883
52983
|
const commentsExtendedDef = `<Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml" />`;
|
|
@@ -62145,7 +62245,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62145
62245
|
return false;
|
|
62146
62246
|
}
|
|
62147
62247
|
};
|
|
62148
|
-
const summaryVersion = "1.3.0
|
|
62248
|
+
const summaryVersion = "1.3.0";
|
|
62149
62249
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
62150
62250
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
62151
62251
|
function mapAttributes(attrs) {
|
|
@@ -64148,9 +64248,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64148
64248
|
try {
|
|
64149
64249
|
const jsonObj = json;
|
|
64150
64250
|
const attrs = jsonObj.attrs;
|
|
64151
|
-
const hasBody = attrs && "bodySectPr" in attrs;
|
|
64152
64251
|
const converter = this.converter;
|
|
64153
|
-
if (
|
|
64252
|
+
if (converter && converter.bodySectPr) {
|
|
64154
64253
|
jsonObj.attrs = attrs || {};
|
|
64155
64254
|
jsonObj.attrs.bodySectPr = converter.bodySectPr;
|
|
64156
64255
|
}
|
|
@@ -64779,7 +64878,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64779
64878
|
* Process collaboration migrations
|
|
64780
64879
|
*/
|
|
64781
64880
|
processCollaborationMigrations() {
|
|
64782
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.3.0
|
|
64881
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.3.0");
|
|
64783
64882
|
if (!this.options.ydoc) return;
|
|
64784
64883
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
64785
64884
|
let docVersion = metaMap.get("version");
|
|
@@ -75012,7 +75111,9 @@ ${l}
|
|
|
75012
75111
|
textRun.pmEnd ?? "",
|
|
75013
75112
|
textRun.token ?? "",
|
|
75014
75113
|
// Tracked changes - force re-render when added or removed tracked change
|
|
75015
|
-
textRun.trackedChange ? 1 : 0
|
|
75114
|
+
textRun.trackedChange ? 1 : 0,
|
|
75115
|
+
// Comment annotations - force re-render when comments are enabled/disabled
|
|
75116
|
+
textRun.comments?.length ?? 0
|
|
75016
75117
|
].join(",");
|
|
75017
75118
|
}).join("|");
|
|
75018
75119
|
const attrs = block.attrs;
|
|
@@ -80883,6 +80984,9 @@ ${l}
|
|
|
80883
80984
|
if (borders.left) parts.push(`l:[${hashBorderSpec(borders.left)}]`);
|
|
80884
80985
|
return parts.join(";");
|
|
80885
80986
|
};
|
|
80987
|
+
function hasComments$1(run2) {
|
|
80988
|
+
return "comments" in run2 && Array.isArray(run2.comments) && run2.comments.length > 0;
|
|
80989
|
+
}
|
|
80886
80990
|
const MAX_CACHE_SIZE$1 = 1e4;
|
|
80887
80991
|
const BYTES_PER_ENTRY_ESTIMATE = 5e3;
|
|
80888
80992
|
const hashParagraphFrame = (frame) => {
|
|
@@ -80950,6 +81054,7 @@ ${l}
|
|
|
80950
81054
|
fontFamily2 ? `ff:${fontFamily2}` : "",
|
|
80951
81055
|
highlight ? `hl:${highlight}` : ""
|
|
80952
81056
|
].join("");
|
|
81057
|
+
const commentHash = hasComments$1(run2) ? run2.comments.map((c2) => `${c2.commentId ?? ""}:${c2.internal ? "1" : "0"}`).join("|") : "";
|
|
80953
81058
|
let trackedKey = "";
|
|
80954
81059
|
if (hasTrackedChange(run2)) {
|
|
80955
81060
|
const tc = run2.trackedChange;
|
|
@@ -80957,7 +81062,8 @@ ${l}
|
|
|
80957
81062
|
const afterHash = tc.after ? JSON.stringify(tc.after) : "";
|
|
80958
81063
|
trackedKey = `|tc:${tc.kind ?? ""}:${tc.id ?? ""}:${tc.author ?? ""}:${tc.date ?? ""}:${beforeHash}:${afterHash}`;
|
|
80959
81064
|
}
|
|
80960
|
-
|
|
81065
|
+
const commentKey = commentHash ? `|cm:${commentHash}` : "";
|
|
81066
|
+
cellHashes.push(`${text2}:${marks}${trackedKey}${commentKey}`);
|
|
80961
81067
|
}
|
|
80962
81068
|
if (paragraphBlock.attrs) {
|
|
80963
81069
|
const attrs = paragraphBlock.attrs;
|
|
@@ -82089,6 +82195,9 @@ ${l}
|
|
|
82089
82195
|
const totalHeight = lines.reduce((s2, l) => s2 + l.lineHeight, 0);
|
|
82090
82196
|
return { kind: "paragraph", lines, totalHeight };
|
|
82091
82197
|
}
|
|
82198
|
+
function hasComments(run2) {
|
|
82199
|
+
return "comments" in run2 && Array.isArray(run2.comments) && run2.comments.length > 0;
|
|
82200
|
+
}
|
|
82092
82201
|
const computeDirtyRegions = (previous2, next2) => {
|
|
82093
82202
|
const prevMap = new Map(previous2.map((block, index2) => [block.id, { block, index: index2 }]));
|
|
82094
82203
|
const nextMap = new Map(next2.map((block, index2) => [block.id, { block, index: index2 }]));
|
|
@@ -82149,6 +82258,10 @@ ${l}
|
|
|
82149
82258
|
}
|
|
82150
82259
|
return "";
|
|
82151
82260
|
};
|
|
82261
|
+
const getCommentKey = (run2) => {
|
|
82262
|
+
if (!hasComments(run2)) return "";
|
|
82263
|
+
return run2.comments.map((c2) => `${c2.commentId ?? ""}:${c2.internal ? "1" : "0"}`).join("|");
|
|
82264
|
+
};
|
|
82152
82265
|
const paragraphSpacingEqual = (a2, b2) => {
|
|
82153
82266
|
if (a2 === b2) return true;
|
|
82154
82267
|
if (!a2 || !b2) return !a2 && !b2;
|
|
@@ -82230,7 +82343,7 @@ ${l}
|
|
|
82230
82343
|
for (let i2 = 0; i2 < a2.runs.length; i2 += 1) {
|
|
82231
82344
|
const runA = a2.runs[i2];
|
|
82232
82345
|
const runB = b2.runs[i2];
|
|
82233
|
-
if (("src" in runA || runA.kind === "lineBreak" || runA.kind === "break" || runA.kind === "fieldAnnotation" ? "" : runA.text) !== ("src" in runB || runB.kind === "lineBreak" || runB.kind === "break" || runB.kind === "fieldAnnotation" ? "" : runB.text) || ("bold" in runA ? runA.bold : false) !== ("bold" in runB ? runB.bold : false) || ("italic" in runA ? runA.italic : false) !== ("italic" in runB ? runB.italic : false) || ("color" in runA ? runA.color : void 0) !== ("color" in runB ? runB.color : void 0) || ("fontSize" in runA ? runA.fontSize : void 0) !== ("fontSize" in runB ? runB.fontSize : void 0) || ("fontFamily" in runA ? runA.fontFamily : void 0) !== ("fontFamily" in runB ? runB.fontFamily : void 0) || ("highlight" in runA ? runA.highlight : void 0) !== ("highlight" in runB ? runB.highlight : void 0) || getTrackedChangeKey(runA) !== getTrackedChangeKey(runB)) {
|
|
82346
|
+
if (("src" in runA || runA.kind === "lineBreak" || runA.kind === "break" || runA.kind === "fieldAnnotation" ? "" : runA.text) !== ("src" in runB || runB.kind === "lineBreak" || runB.kind === "break" || runB.kind === "fieldAnnotation" ? "" : runB.text) || ("bold" in runA ? runA.bold : false) !== ("bold" in runB ? runB.bold : false) || ("italic" in runA ? runA.italic : false) !== ("italic" in runB ? runB.italic : false) || ("color" in runA ? runA.color : void 0) !== ("color" in runB ? runB.color : void 0) || ("fontSize" in runA ? runA.fontSize : void 0) !== ("fontSize" in runB ? runB.fontSize : void 0) || ("fontFamily" in runA ? runA.fontFamily : void 0) !== ("fontFamily" in runB ? runB.fontFamily : void 0) || ("highlight" in runA ? runA.highlight : void 0) !== ("highlight" in runB ? runB.highlight : void 0) || getTrackedChangeKey(runA) !== getTrackedChangeKey(runB) || getCommentKey(runA) !== getCommentKey(runB)) {
|
|
82234
82347
|
return false;
|
|
82235
82348
|
}
|
|
82236
82349
|
}
|
|
@@ -86972,7 +87085,7 @@ ${l}
|
|
|
86972
87085
|
delete run2.link;
|
|
86973
87086
|
delete run2.letterSpacing;
|
|
86974
87087
|
};
|
|
86975
|
-
const applyFormatChangeMarks = (run2, config2, hyperlinkConfig, applyMarksToRun2, themeColors) => {
|
|
87088
|
+
const applyFormatChangeMarks = (run2, config2, hyperlinkConfig, applyMarksToRun2, themeColors, enableComments = true) => {
|
|
86976
87089
|
const tracked = run2.trackedChange;
|
|
86977
87090
|
if (!tracked || tracked.kind !== "format") {
|
|
86978
87091
|
return;
|
|
@@ -86994,12 +87107,12 @@ ${l}
|
|
|
86994
87107
|
}
|
|
86995
87108
|
resetRunFormatting(run2);
|
|
86996
87109
|
try {
|
|
86997
|
-
applyMarksToRun2(run2, beforeMarks, hyperlinkConfig, themeColors);
|
|
87110
|
+
applyMarksToRun2(run2, beforeMarks, hyperlinkConfig, themeColors, void 0, enableComments);
|
|
86998
87111
|
} catch (error) {
|
|
86999
87112
|
resetRunFormatting(run2);
|
|
87000
87113
|
}
|
|
87001
87114
|
};
|
|
87002
|
-
const applyTrackedChangesModeToRuns = (runs2, config2, hyperlinkConfig, applyMarksToRun2, themeColors) => {
|
|
87115
|
+
const applyTrackedChangesModeToRuns = (runs2, config2, hyperlinkConfig, applyMarksToRun2, themeColors, enableComments = true) => {
|
|
87003
87116
|
if (!config2) {
|
|
87004
87117
|
return runs2;
|
|
87005
87118
|
}
|
|
@@ -87012,7 +87125,7 @@ ${l}
|
|
|
87012
87125
|
} else {
|
|
87013
87126
|
runs2.forEach((run2) => {
|
|
87014
87127
|
if (isTextRun$1(run2)) {
|
|
87015
|
-
applyFormatChangeMarks(run2, config2, hyperlinkConfig, applyMarksToRun2, themeColors);
|
|
87128
|
+
applyFormatChangeMarks(run2, config2, hyperlinkConfig, applyMarksToRun2, themeColors, enableComments);
|
|
87016
87129
|
}
|
|
87017
87130
|
});
|
|
87018
87131
|
}
|
|
@@ -87042,9 +87155,23 @@ ${l}
|
|
|
87042
87155
|
} else {
|
|
87043
87156
|
filtered.forEach((run2) => {
|
|
87044
87157
|
if (isTextRun$1(run2)) {
|
|
87045
|
-
applyFormatChangeMarks(
|
|
87158
|
+
applyFormatChangeMarks(
|
|
87159
|
+
run2,
|
|
87160
|
+
config2,
|
|
87161
|
+
hyperlinkConfig || DEFAULT_HYPERLINK_CONFIG$1,
|
|
87162
|
+
applyMarksToRun2,
|
|
87163
|
+
themeColors,
|
|
87164
|
+
enableComments
|
|
87165
|
+
);
|
|
87046
87166
|
}
|
|
87047
87167
|
});
|
|
87168
|
+
if ((config2.mode === "original" || config2.mode === "final") && config2.enabled) {
|
|
87169
|
+
filtered.forEach((run2) => {
|
|
87170
|
+
if (isTextRun$1(run2) && run2.trackedChange && (run2.trackedChange.kind === "insert" || run2.trackedChange.kind === "delete")) {
|
|
87171
|
+
delete run2.trackedChange;
|
|
87172
|
+
}
|
|
87173
|
+
});
|
|
87174
|
+
}
|
|
87048
87175
|
}
|
|
87049
87176
|
return filtered;
|
|
87050
87177
|
};
|
|
@@ -87953,7 +88080,10 @@ ${l}
|
|
|
87953
88080
|
const DEFAULT_HYPERLINK_CONFIG = {
|
|
87954
88081
|
enableRichHyperlinks: false
|
|
87955
88082
|
};
|
|
87956
|
-
const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors, backgroundColor) => {
|
|
88083
|
+
const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors, backgroundColor, enableComments = true) => {
|
|
88084
|
+
if (!enableComments && "comments" in run2 && run2.comments) {
|
|
88085
|
+
delete run2.comments;
|
|
88086
|
+
}
|
|
87957
88087
|
const isTabRun2 = run2.kind === "tab";
|
|
87958
88088
|
let markSetColor = false;
|
|
87959
88089
|
marks.forEach((mark2) => {
|
|
@@ -88000,7 +88130,7 @@ ${l}
|
|
|
88000
88130
|
break;
|
|
88001
88131
|
case "commentMark":
|
|
88002
88132
|
case "comment": {
|
|
88003
|
-
if (!isTabRun2) {
|
|
88133
|
+
if (!isTabRun2 && enableComments) {
|
|
88004
88134
|
pushCommentAnnotation(run2, mark2.attrs ?? {});
|
|
88005
88135
|
}
|
|
88006
88136
|
break;
|
|
@@ -90067,7 +90197,16 @@ ${l}
|
|
|
90067
90197
|
if (!value || typeof value !== "object") return;
|
|
90068
90198
|
return normalizePxIndent(value) ?? convertIndentTwipsToPx(value);
|
|
90069
90199
|
};
|
|
90070
|
-
const
|
|
90200
|
+
const hydratedIndentPx = convertIndentTwipsToPx(hydrated?.indent);
|
|
90201
|
+
const paragraphIndentPx = convertIndentTwipsToPx(paragraphProps.indent);
|
|
90202
|
+
const textIndentPx = normalizeParagraphIndent(attrs.textIndent);
|
|
90203
|
+
const attrsIndentPx = normalizeIndentObject(attrs.indent);
|
|
90204
|
+
const indentChain = [];
|
|
90205
|
+
if (hydratedIndentPx) indentChain.push({ indent: hydratedIndentPx });
|
|
90206
|
+
if (paragraphIndentPx) indentChain.push({ indent: paragraphIndentPx });
|
|
90207
|
+
if (textIndentPx) indentChain.push({ indent: textIndentPx });
|
|
90208
|
+
if (attrsIndentPx) indentChain.push({ indent: attrsIndentPx });
|
|
90209
|
+
const normalizedIndent = indentChain.length ? combineIndentProperties(indentChain).indent : void 0;
|
|
90071
90210
|
const unwrapTabStops = (tabStops) => {
|
|
90072
90211
|
if (!Array.isArray(tabStops)) {
|
|
90073
90212
|
return void 0;
|
|
@@ -91619,7 +91758,7 @@ ${l}
|
|
|
91619
91758
|
run2.letterSpacing = twipsToPx$1(runProperties.letterSpacing);
|
|
91620
91759
|
}
|
|
91621
91760
|
};
|
|
91622
|
-
function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converters, converterContext) {
|
|
91761
|
+
function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converters, converterContext, enableComments = true) {
|
|
91623
91762
|
const baseBlockId = nextBlockId("paragraph");
|
|
91624
91763
|
const paragraphProps = typeof para.attrs?.paragraphProperties === "object" && para.attrs.paragraphProperties !== null ? para.attrs.paragraphProperties : {};
|
|
91625
91764
|
const paragraphStyleId = typeof para.attrs?.styleId === "string" && para.attrs.styleId.trim() ? para.attrs.styleId : typeof paragraphProps.styleId === "string" && paragraphProps.styleId.trim() ? paragraphProps.styleId : null;
|
|
@@ -91793,7 +91932,8 @@ ${l}
|
|
|
91793
91932
|
[...node2.marks ?? [], ...inheritedMarks ?? []],
|
|
91794
91933
|
hyperlinkConfig,
|
|
91795
91934
|
themeColors,
|
|
91796
|
-
converterContext?.backgroundColor
|
|
91935
|
+
converterContext?.backgroundColor,
|
|
91936
|
+
enableComments
|
|
91797
91937
|
);
|
|
91798
91938
|
currentRuns.push(run2);
|
|
91799
91939
|
return;
|
|
@@ -91855,7 +91995,8 @@ ${l}
|
|
|
91855
91995
|
positions,
|
|
91856
91996
|
defaultFont,
|
|
91857
91997
|
defaultSize,
|
|
91858
|
-
|
|
91998
|
+
[],
|
|
91999
|
+
// Empty marks - will be applied after linked styles
|
|
91859
92000
|
activeSdt,
|
|
91860
92001
|
hyperlinkConfig,
|
|
91861
92002
|
themeColors
|
|
@@ -91864,6 +92005,14 @@ ${l}
|
|
|
91864
92005
|
applyRunStyles2(tokenRun, inlineStyleId, activeRunStyleId);
|
|
91865
92006
|
applyBaseRunDefaults(tokenRun, baseRunDefaults, defaultFont, defaultSize);
|
|
91866
92007
|
applyInlineRunProperties(tokenRun, activeRunProperties);
|
|
92008
|
+
applyMarksToRun(
|
|
92009
|
+
tokenRun,
|
|
92010
|
+
mergedMarks,
|
|
92011
|
+
hyperlinkConfig,
|
|
92012
|
+
themeColors,
|
|
92013
|
+
converterContext?.backgroundColor,
|
|
92014
|
+
enableComments
|
|
92015
|
+
);
|
|
91867
92016
|
if (pageRefPos) {
|
|
91868
92017
|
tokenRun.pmStart = pageRefPos.start;
|
|
91869
92018
|
tokenRun.pmEnd = pageRefPos.end;
|
|
@@ -91937,7 +92086,8 @@ ${l}
|
|
|
91937
92086
|
mergedMarks,
|
|
91938
92087
|
hyperlinkConfig,
|
|
91939
92088
|
themeColors,
|
|
91940
|
-
converterContext?.backgroundColor
|
|
92089
|
+
converterContext?.backgroundColor,
|
|
92090
|
+
enableComments
|
|
91941
92091
|
);
|
|
91942
92092
|
}
|
|
91943
92093
|
console.debug("[token-debug] paragraph-token-run", {
|
|
@@ -92136,7 +92286,8 @@ ${l}
|
|
|
92136
92286
|
trackedChanges,
|
|
92137
92287
|
hyperlinkConfig,
|
|
92138
92288
|
applyMarksToRun,
|
|
92139
|
-
themeColors
|
|
92289
|
+
themeColors,
|
|
92290
|
+
enableComments
|
|
92140
92291
|
);
|
|
92141
92292
|
if (trackedChanges.enabled && filteredRuns.length === 0) {
|
|
92142
92293
|
return;
|
|
@@ -93035,6 +93186,7 @@ ${l}
|
|
|
93035
93186
|
const hyperlinkConfig = {
|
|
93036
93187
|
enableRichHyperlinks: options?.enableRichHyperlinks ?? false
|
|
93037
93188
|
};
|
|
93189
|
+
const enableComments = options?.enableComments ?? true;
|
|
93038
93190
|
const themeColors = options?.themeColors;
|
|
93039
93191
|
const converterContext = options?.converterContext;
|
|
93040
93192
|
if (!doc2.content) {
|
|
@@ -93084,7 +93236,8 @@ ${l}
|
|
|
93084
93236
|
bookmarks2,
|
|
93085
93237
|
hyperlinkConfig2,
|
|
93086
93238
|
themeColorsParam ?? themeColors,
|
|
93087
|
-
converterCtx ?? converterContext
|
|
93239
|
+
converterCtx ?? converterContext,
|
|
93240
|
+
enableComments
|
|
93088
93241
|
);
|
|
93089
93242
|
const tableConverter = (node2, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
|
|
93090
93243
|
node2,
|
|
@@ -93123,6 +93276,7 @@ ${l}
|
|
|
93123
93276
|
listCounterContext: { getListCounter, incrementListCounter, resetListCounter },
|
|
93124
93277
|
trackedChangesConfig,
|
|
93125
93278
|
hyperlinkConfig,
|
|
93279
|
+
enableComments,
|
|
93126
93280
|
bookmarks,
|
|
93127
93281
|
sectionState: {
|
|
93128
93282
|
ranges: sectionRanges,
|
|
@@ -93191,7 +93345,7 @@ ${l}
|
|
|
93191
93345
|
}
|
|
93192
93346
|
return result;
|
|
93193
93347
|
}
|
|
93194
|
-
function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converterContext) {
|
|
93348
|
+
function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converterContext, enableComments = true) {
|
|
93195
93349
|
return paragraphToFlowBlocks$1(
|
|
93196
93350
|
para,
|
|
93197
93351
|
nextBlockId,
|
|
@@ -93238,7 +93392,8 @@ ${l}
|
|
|
93238
93392
|
}
|
|
93239
93393
|
)
|
|
93240
93394
|
},
|
|
93241
|
-
converterContext
|
|
93395
|
+
converterContext,
|
|
93396
|
+
enableComments
|
|
93242
93397
|
);
|
|
93243
93398
|
}
|
|
93244
93399
|
function tableNodeToBlock(node2, nextBlockId, positions, defaultFont, defaultSize, styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, _paragraphToFlowBlocksParam, converterContext, options) {
|
|
@@ -95330,10 +95485,13 @@ ${l}
|
|
|
95330
95485
|
};
|
|
95331
95486
|
}
|
|
95332
95487
|
const originX = currentLine.width;
|
|
95333
|
-
const
|
|
95488
|
+
const effectiveIndent = lines.length === 0 ? indentLeft + rawFirstLineOffset : indentLeft;
|
|
95489
|
+
const absCurrentX = currentLine.width + effectiveIndent;
|
|
95490
|
+
const { target, nextIndex, stop } = getNextTabStopPx(absCurrentX, tabStops, tabStopCursor);
|
|
95334
95491
|
tabStopCursor = nextIndex;
|
|
95335
|
-
const
|
|
95336
|
-
const
|
|
95492
|
+
const maxAbsWidth = currentLine.maxWidth + effectiveIndent;
|
|
95493
|
+
const clampedTarget = Math.min(target, maxAbsWidth);
|
|
95494
|
+
const tabAdvance = Math.max(0, clampedTarget - absCurrentX);
|
|
95337
95495
|
currentLine.width = roundValue(currentLine.width + tabAdvance);
|
|
95338
95496
|
run2.width = tabAdvance;
|
|
95339
95497
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, 12);
|
|
@@ -95341,8 +95499,9 @@ ${l}
|
|
|
95341
95499
|
currentLine.toChar = 1;
|
|
95342
95500
|
if (stop && stop.leader && stop.leader !== "none") {
|
|
95343
95501
|
const leaderStyle = stop.leader;
|
|
95344
|
-
const
|
|
95345
|
-
const
|
|
95502
|
+
const relativeTarget = clampedTarget - effectiveIndent;
|
|
95503
|
+
const from2 = Math.min(originX, relativeTarget);
|
|
95504
|
+
const to = Math.max(originX, relativeTarget);
|
|
95346
95505
|
if (!currentLine.leaders) currentLine.leaders = [];
|
|
95347
95506
|
currentLine.leaders.push({ from: from2, to, style: leaderStyle });
|
|
95348
95507
|
}
|
|
@@ -95351,27 +95510,28 @@ ${l}
|
|
|
95351
95510
|
if (stop.val === "end" || stop.val === "center" || stop.val === "decimal") {
|
|
95352
95511
|
const groupMeasure = measureTabAlignmentGroup(runIndex + 1, runsToProcess, ctx2, decimalSeparator);
|
|
95353
95512
|
if (groupMeasure.totalWidth > 0) {
|
|
95513
|
+
const relativeTarget = clampedTarget - effectiveIndent;
|
|
95354
95514
|
let groupStartX;
|
|
95355
95515
|
if (stop.val === "end") {
|
|
95356
|
-
groupStartX = Math.max(0,
|
|
95516
|
+
groupStartX = Math.max(0, relativeTarget - groupMeasure.totalWidth);
|
|
95357
95517
|
} else if (stop.val === "center") {
|
|
95358
|
-
groupStartX = Math.max(0,
|
|
95518
|
+
groupStartX = Math.max(0, relativeTarget - groupMeasure.totalWidth / 2);
|
|
95359
95519
|
} else {
|
|
95360
95520
|
const beforeDecimal = groupMeasure.beforeDecimalWidth ?? groupMeasure.totalWidth;
|
|
95361
|
-
groupStartX = Math.max(0,
|
|
95521
|
+
groupStartX = Math.max(0, relativeTarget - beforeDecimal);
|
|
95362
95522
|
}
|
|
95363
95523
|
activeTabGroup = {
|
|
95364
95524
|
measure: groupMeasure,
|
|
95365
95525
|
startX: groupStartX,
|
|
95366
95526
|
currentX: groupStartX,
|
|
95367
|
-
target:
|
|
95527
|
+
target: relativeTarget,
|
|
95368
95528
|
val: stop.val
|
|
95369
95529
|
};
|
|
95370
95530
|
currentLine.width = roundValue(groupStartX);
|
|
95371
95531
|
}
|
|
95372
95532
|
pendingTabAlignment = null;
|
|
95373
95533
|
} else {
|
|
95374
|
-
pendingTabAlignment = { target: clampedTarget, val: stop.val };
|
|
95534
|
+
pendingTabAlignment = { target: clampedTarget - effectiveIndent, val: stop.val };
|
|
95375
95535
|
}
|
|
95376
95536
|
} else {
|
|
95377
95537
|
pendingTabAlignment = null;
|
|
@@ -96012,10 +96172,13 @@ ${l}
|
|
|
96012
96172
|
};
|
|
96013
96173
|
}
|
|
96014
96174
|
const originX = currentLine.width;
|
|
96015
|
-
const
|
|
96175
|
+
const effectiveIndent = lines.length === 0 ? indentLeft + rawFirstLineOffset : indentLeft;
|
|
96176
|
+
const absCurrentX = currentLine.width + effectiveIndent;
|
|
96177
|
+
const { target, nextIndex, stop } = getNextTabStopPx(absCurrentX, tabStops, tabStopCursor);
|
|
96016
96178
|
tabStopCursor = nextIndex;
|
|
96017
|
-
const
|
|
96018
|
-
const
|
|
96179
|
+
const maxAbsWidth = currentLine.maxWidth + effectiveIndent;
|
|
96180
|
+
const clampedTarget = Math.min(target, maxAbsWidth);
|
|
96181
|
+
const tabAdvance = Math.max(0, clampedTarget - absCurrentX);
|
|
96019
96182
|
currentLine.width = roundValue(currentLine.width + tabAdvance);
|
|
96020
96183
|
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
96021
96184
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
|
|
@@ -96024,14 +96187,15 @@ ${l}
|
|
|
96024
96187
|
charPosInRun += 1;
|
|
96025
96188
|
if (stop) {
|
|
96026
96189
|
validateTabStopVal(stop);
|
|
96027
|
-
pendingTabAlignment = { target: clampedTarget, val: stop.val };
|
|
96190
|
+
pendingTabAlignment = { target: clampedTarget - effectiveIndent, val: stop.val };
|
|
96028
96191
|
} else {
|
|
96029
96192
|
pendingTabAlignment = null;
|
|
96030
96193
|
}
|
|
96031
96194
|
if (stop && stop.leader && stop.leader !== "none" && stop.leader !== "middleDot") {
|
|
96032
96195
|
const leaderStyle = stop.leader;
|
|
96033
|
-
const
|
|
96034
|
-
const
|
|
96196
|
+
const relativeTarget = clampedTarget - effectiveIndent;
|
|
96197
|
+
const from2 = Math.min(originX, relativeTarget);
|
|
96198
|
+
const to = Math.max(originX, relativeTarget);
|
|
96035
96199
|
if (!currentLine.leaders) currentLine.leaders = [];
|
|
96036
96200
|
currentLine.leaders.push({ from: from2, to, style: leaderStyle });
|
|
96037
96201
|
}
|
|
@@ -96307,7 +96471,11 @@ ${l}
|
|
|
96307
96471
|
}
|
|
96308
96472
|
async function measureImageBlock(block, constraints) {
|
|
96309
96473
|
const intrinsic = getIntrinsicImageSize(block, constraints.maxWidth);
|
|
96310
|
-
const
|
|
96474
|
+
const isBlockBehindDoc = block.anchor?.behindDoc;
|
|
96475
|
+
const isBlockWrapBehindDoc = block.wrap?.type === "None" && block.wrap?.behindDoc;
|
|
96476
|
+
const bypassWidthConstraint = isBlockBehindDoc || isBlockWrapBehindDoc;
|
|
96477
|
+
const isWidthConstraintBypassed = bypassWidthConstraint || constraints.maxWidth <= 0;
|
|
96478
|
+
const maxWidth = isWidthConstraintBypassed ? intrinsic.width : constraints.maxWidth;
|
|
96311
96479
|
const hasNegativeVerticalPosition = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
|
|
96312
96480
|
const maxHeight = hasNegativeVerticalPosition || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
|
|
96313
96481
|
const widthScale = maxWidth / intrinsic.width;
|
|
@@ -97447,12 +97615,13 @@ ${l}
|
|
|
97447
97615
|
if (!validModes.includes(mode)) {
|
|
97448
97616
|
throw new TypeError(`[PresentationEditor] Invalid mode "${mode}". Must be one of: ${validModes.join(", ")}`);
|
|
97449
97617
|
}
|
|
97618
|
+
const modeChanged = this.#documentMode !== mode;
|
|
97450
97619
|
this.#documentMode = mode;
|
|
97451
97620
|
this.#editor.setDocumentMode(mode);
|
|
97452
97621
|
this.#syncDocumentModeClass();
|
|
97453
97622
|
this.#syncHiddenEditorA11yAttributes();
|
|
97454
97623
|
const trackedChangesChanged = this.#syncTrackedChangesPreferences();
|
|
97455
|
-
if (trackedChangesChanged) {
|
|
97624
|
+
if (modeChanged || trackedChangesChanged) {
|
|
97456
97625
|
this.#pendingDocChange = true;
|
|
97457
97626
|
this.#scheduleRerender();
|
|
97458
97627
|
}
|
|
@@ -97473,9 +97642,10 @@ ${l}
|
|
|
97473
97642
|
throw new TypeError("[PresentationEditor] setTrackedChangesOverrides expects an object or undefined");
|
|
97474
97643
|
}
|
|
97475
97644
|
if (overrides !== void 0) {
|
|
97476
|
-
|
|
97645
|
+
const validModes = ["review", "original", "final", "off"];
|
|
97646
|
+
if (overrides.mode !== void 0 && !validModes.includes(overrides.mode)) {
|
|
97477
97647
|
throw new TypeError(
|
|
97478
|
-
`[PresentationEditor] Invalid tracked changes mode "${overrides.mode}". Must be one of:
|
|
97648
|
+
`[PresentationEditor] Invalid tracked changes mode "${overrides.mode}". Must be one of: ${validModes.join(", ")}`
|
|
97479
97649
|
);
|
|
97480
97650
|
}
|
|
97481
97651
|
if (overrides.enabled !== void 0 && typeof overrides.enabled !== "boolean") {
|
|
@@ -99828,12 +99998,14 @@ ${l}
|
|
|
99828
99998
|
} : void 0;
|
|
99829
99999
|
const atomNodeTypes = getAtomNodeTypes(this.#editor?.schema ?? null);
|
|
99830
100000
|
const positionMap2 = this.#editor?.state?.doc && docJson ? buildPositionMapFromPmDoc(this.#editor.state.doc, docJson) : null;
|
|
100001
|
+
const commentsEnabled = this.#documentMode !== "viewing";
|
|
99831
100002
|
const result = toFlowBlocks(docJson, {
|
|
99832
100003
|
mediaFiles: this.#editor?.storage?.image?.media,
|
|
99833
100004
|
emitSectionBreaks: true,
|
|
99834
100005
|
sectionMetadata,
|
|
99835
100006
|
trackedChangesMode: this.#trackedChangesMode,
|
|
99836
100007
|
enableTrackedChanges: this.#trackedChangesEnabled,
|
|
100008
|
+
enableComments: commentsEnabled,
|
|
99837
100009
|
enableRichHyperlinks: true,
|
|
99838
100010
|
themeColors: this.#editor?.converter?.themeColors ?? void 0,
|
|
99839
100011
|
converterContext,
|
|
@@ -99964,10 +100136,12 @@ ${l}
|
|
|
99964
100136
|
const payload = { layout, blocks: blocks2, measures, metrics };
|
|
99965
100137
|
this.emit("layoutUpdated", payload);
|
|
99966
100138
|
this.emit("paginationUpdate", payload);
|
|
99967
|
-
|
|
99968
|
-
|
|
99969
|
-
|
|
99970
|
-
|
|
100139
|
+
if (this.#documentMode !== "viewing") {
|
|
100140
|
+
const commentPositions = this.#collectCommentPositions();
|
|
100141
|
+
const positionKeys = Object.keys(commentPositions);
|
|
100142
|
+
if (positionKeys.length > 0) {
|
|
100143
|
+
this.emit("commentPositions", { positions: commentPositions });
|
|
100144
|
+
}
|
|
99971
100145
|
}
|
|
99972
100146
|
if (this.#telemetryEmitter && metrics) {
|
|
99973
100147
|
this.#telemetryEmitter({ type: "layout", data: { layout, blocks: blocks2, measures, metrics } });
|
|
@@ -101378,7 +101552,7 @@ ${l}
|
|
|
101378
101552
|
const zoom = this.#layoutOptions.zoom ?? 1;
|
|
101379
101553
|
const layoutMode = this.#layoutOptions.layoutMode ?? "vertical";
|
|
101380
101554
|
const pages = this.#layoutState.layout?.pages;
|
|
101381
|
-
const pageGap = this.#
|
|
101555
|
+
const pageGap = this.#getEffectivePageGap();
|
|
101382
101556
|
const defaultWidth = this.#layoutOptions.pageSize?.w ?? DEFAULT_PAGE_SIZE.w;
|
|
101383
101557
|
const defaultHeight = this.#layoutOptions.pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
101384
101558
|
let maxWidth = defaultWidth;
|
|
@@ -104486,7 +104660,11 @@ ${l}
|
|
|
104486
104660
|
*/
|
|
104487
104661
|
clearDocument: () => ({ commands: commands2 }) => {
|
|
104488
104662
|
return commands2.setContent("<p></p>");
|
|
104489
|
-
}
|
|
104663
|
+
},
|
|
104664
|
+
/**
|
|
104665
|
+
* Set section page margins (top/right/bottom/left) for the section at the current selection.
|
|
104666
|
+
*/
|
|
104667
|
+
setSectionPageMarginsAtSelection
|
|
104490
104668
|
};
|
|
104491
104669
|
}
|
|
104492
104670
|
});
|
|
@@ -105140,12 +105318,18 @@ ${l}
|
|
|
105140
105318
|
return null;
|
|
105141
105319
|
}
|
|
105142
105320
|
function extractParagraphContext(node2, startPos, helpers2, depth = 0) {
|
|
105143
|
-
const paragraphProperties = getResolvedParagraphProperties(node2) ?? {};
|
|
105321
|
+
const paragraphProperties = getResolvedParagraphProperties(node2) ?? node2.attrs?.paragraphProperties ?? {};
|
|
105144
105322
|
const alignmentAliases = { left: "start", right: "end" };
|
|
105145
105323
|
let tabStops = [];
|
|
105146
105324
|
if (Array.isArray(paragraphProperties.tabStops)) {
|
|
105147
105325
|
tabStops = paragraphProperties.tabStops.map((stop) => {
|
|
105148
105326
|
const ref2 = stop?.tab;
|
|
105327
|
+
if (!ref2 && stop?.pos != null) {
|
|
105328
|
+
return {
|
|
105329
|
+
...stop,
|
|
105330
|
+
pos: twipsToPixels(Number(stop.pos) || 0)
|
|
105331
|
+
};
|
|
105332
|
+
}
|
|
105149
105333
|
if (!ref2) return stop || null;
|
|
105150
105334
|
const rawType = ref2.tabType || "start";
|
|
105151
105335
|
const mappedVal = alignmentAliases[rawType] || rawType;
|
|
@@ -106411,6 +106595,13 @@ ${l}
|
|
|
106411
106595
|
pos: entry.pos,
|
|
106412
106596
|
nodeSize: node2.nodeSize
|
|
106413
106597
|
});
|
|
106598
|
+
} else if (node2.type.name === "lineBreak" || node2.type.name === "hardBreak") {
|
|
106599
|
+
spans.push({
|
|
106600
|
+
type: node2.type.name,
|
|
106601
|
+
spanId,
|
|
106602
|
+
pos: entry.pos,
|
|
106603
|
+
nodeSize: node2.nodeSize
|
|
106604
|
+
});
|
|
106414
106605
|
} else if (node2.type.name === "text") {
|
|
106415
106606
|
spans.push({
|
|
106416
106607
|
type: "text",
|
|
@@ -106460,6 +106651,7 @@ ${l}
|
|
|
106460
106651
|
paragraphNode
|
|
106461
106652
|
} = request;
|
|
106462
106653
|
const tabs = {};
|
|
106654
|
+
const leftIndentPx = request.indents?.left ?? 0;
|
|
106463
106655
|
let currentX = indentWidth;
|
|
106464
106656
|
const measureText2 = (span) => {
|
|
106465
106657
|
if (view && typeof span.from === "number" && typeof span.to === "number") {
|
|
@@ -106472,6 +106664,8 @@ ${l}
|
|
|
106472
106664
|
const span = spans[i2];
|
|
106473
106665
|
if (span.type === "text") {
|
|
106474
106666
|
currentX += measureText2(span);
|
|
106667
|
+
} else if (span.type === "lineBreak" || span.type === "hardBreak") {
|
|
106668
|
+
currentX = leftIndentPx;
|
|
106475
106669
|
} else if (span.type === "tab") {
|
|
106476
106670
|
const followingText = collectFollowingText(spans, i2 + 1);
|
|
106477
106671
|
let measureTextCallback;
|
|
@@ -106567,7 +106761,7 @@ ${l}
|
|
|
106567
106761
|
let text2 = "";
|
|
106568
106762
|
for (let i2 = startIndex; i2 < spans.length; i2++) {
|
|
106569
106763
|
const span = spans[i2];
|
|
106570
|
-
if (span.type === "tab") break;
|
|
106764
|
+
if (span.type === "tab" || span.type === "lineBreak" || span.type === "hardBreak") break;
|
|
106571
106765
|
if (span.type === "text") text2 += span.text || "";
|
|
106572
106766
|
}
|
|
106573
106767
|
return text2;
|
|
@@ -106577,7 +106771,7 @@ ${l}
|
|
|
106577
106771
|
let to = null;
|
|
106578
106772
|
for (let i2 = startIndex; i2 < spans.length; i2++) {
|
|
106579
106773
|
const span = spans[i2];
|
|
106580
|
-
if (span.type === "tab") break;
|
|
106774
|
+
if (span.type === "tab" || span.type === "lineBreak" || span.type === "hardBreak") break;
|
|
106581
106775
|
if (span.type === "text" && typeof span.from === "number" && typeof span.to === "number") {
|
|
106582
106776
|
if (from2 === null) from2 = span.from;
|
|
106583
106777
|
to = span.to;
|
|
@@ -110995,6 +111189,10 @@ ${l}
|
|
|
110995
111189
|
}
|
|
110996
111190
|
const hasAnchorData = Boolean(anchorData);
|
|
110997
111191
|
const hasMarginOffsets = marginOffset?.horizontal != null || marginOffset?.top != null;
|
|
111192
|
+
const isWrapBehindDoc = wrap2?.attrs?.behindDoc;
|
|
111193
|
+
const isAnchorBehindDoc = anchorData?.behindDoc;
|
|
111194
|
+
const isBehindDocAnchor = wrap2?.type === "None" && (isWrapBehindDoc || isAnchorBehindDoc);
|
|
111195
|
+
const isAbsolutelyPositioned = style2.includes("position: absolute;");
|
|
110998
111196
|
if (hasAnchorData) {
|
|
110999
111197
|
switch (anchorData.hRelativeFrom) {
|
|
111000
111198
|
case "page":
|
|
@@ -111022,7 +111220,6 @@ ${l}
|
|
|
111022
111220
|
style2 += "float: left;";
|
|
111023
111221
|
}
|
|
111024
111222
|
} else if (!anchorData.alignH && marginOffset?.horizontal != null) {
|
|
111025
|
-
const isAbsolutelyPositioned = style2.includes("position: absolute;");
|
|
111026
111223
|
if (isAbsolutelyPositioned) {
|
|
111027
111224
|
style2 += `left: ${baseHorizontal}px;`;
|
|
111028
111225
|
style2 += "max-width: none;";
|
|
@@ -111036,7 +111233,8 @@ ${l}
|
|
|
111036
111233
|
const relativeFromPageV = anchorData?.vRelativeFrom === "page";
|
|
111037
111234
|
const relativeFromMarginV = anchorData?.vRelativeFrom === "margin";
|
|
111038
111235
|
const maxMarginV = 500;
|
|
111039
|
-
const
|
|
111236
|
+
const allowNegativeTopOffset = isBehindDocAnchor;
|
|
111237
|
+
const baseTop = allowNegativeTopOffset ? marginOffset?.top ?? 0 : Math.max(0, marginOffset?.top ?? 0);
|
|
111040
111238
|
let rotationHorizontal = 0;
|
|
111041
111239
|
let rotationTop = 0;
|
|
111042
111240
|
const { rotation: rotation2 } = transformData ?? {};
|
|
@@ -111055,7 +111253,10 @@ ${l}
|
|
|
111055
111253
|
margin.left += horizontal;
|
|
111056
111254
|
}
|
|
111057
111255
|
}
|
|
111058
|
-
|
|
111256
|
+
const appliedTopViaStyle = isAbsolutelyPositioned && allowNegativeTopOffset && !relativeFromMarginV;
|
|
111257
|
+
if (appliedTopViaStyle) {
|
|
111258
|
+
style2 += `top: ${top2}px;`;
|
|
111259
|
+
} else if (top2 && !relativeFromMarginV) {
|
|
111059
111260
|
if (relativeFromPageV && top2 >= maxMarginV) margin.top += maxMarginV;
|
|
111060
111261
|
else margin.top += top2;
|
|
111061
111262
|
}
|
|
@@ -111068,6 +111269,9 @@ ${l}
|
|
|
111068
111269
|
}
|
|
111069
111270
|
if (margin.top) style2 += `margin-top: ${margin.top}px;`;
|
|
111070
111271
|
if (margin.bottom) style2 += `margin-bottom: ${margin.bottom}px;`;
|
|
111272
|
+
if (isBehindDocAnchor) {
|
|
111273
|
+
style2 += "max-width: none;";
|
|
111274
|
+
}
|
|
111071
111275
|
const finalAttributes = { ...htmlAttributes };
|
|
111072
111276
|
if (style2) {
|
|
111073
111277
|
const existingStyle = finalAttributes.style || "";
|
|
@@ -125556,7 +125760,7 @@ ${style2}
|
|
|
125556
125760
|
};
|
|
125557
125761
|
return ResizeObserverController2;
|
|
125558
125762
|
})();
|
|
125559
|
-
var ResizeObserver = (function() {
|
|
125763
|
+
var ResizeObserver$1 = (function() {
|
|
125560
125764
|
function ResizeObserver2(callback) {
|
|
125561
125765
|
if (arguments.length === 0) {
|
|
125562
125766
|
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
@@ -125595,7 +125799,7 @@ ${style2}
|
|
|
125595
125799
|
class ResizeObserverDelegate {
|
|
125596
125800
|
constructor() {
|
|
125597
125801
|
this.handleResize = this.handleResize.bind(this);
|
|
125598
|
-
this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver)(this.handleResize);
|
|
125802
|
+
this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver$1)(this.handleResize);
|
|
125599
125803
|
this.elHandlersMap = /* @__PURE__ */ new Map();
|
|
125600
125804
|
}
|
|
125601
125805
|
handleResize(entries) {
|
|
@@ -138508,6 +138712,31 @@ ${style2}
|
|
|
138508
138712
|
},
|
|
138509
138713
|
{ immediate: true, deep: true }
|
|
138510
138714
|
);
|
|
138715
|
+
watch(
|
|
138716
|
+
() => props.options?.rulerContainer,
|
|
138717
|
+
() => {
|
|
138718
|
+
nextTick(() => {
|
|
138719
|
+
syncRulerOffset();
|
|
138720
|
+
setupRulerObservers();
|
|
138721
|
+
});
|
|
138722
|
+
},
|
|
138723
|
+
{ immediate: true }
|
|
138724
|
+
);
|
|
138725
|
+
watch(
|
|
138726
|
+
rulersVisible,
|
|
138727
|
+
(visible) => {
|
|
138728
|
+
nextTick(() => {
|
|
138729
|
+
if (visible) {
|
|
138730
|
+
syncRulerOffset();
|
|
138731
|
+
setupRulerObservers();
|
|
138732
|
+
} else {
|
|
138733
|
+
rulerHostStyle.value = {};
|
|
138734
|
+
cleanupRulerObservers();
|
|
138735
|
+
}
|
|
138736
|
+
});
|
|
138737
|
+
},
|
|
138738
|
+
{ immediate: true }
|
|
138739
|
+
);
|
|
138511
138740
|
const containerStyle = computed(() => {
|
|
138512
138741
|
let maxWidth = 8.5 * 96;
|
|
138513
138742
|
const ed = editor.value;
|
|
@@ -138532,6 +138761,71 @@ ${style2}
|
|
|
138532
138761
|
minWidth: `${scaledWidth}px`
|
|
138533
138762
|
};
|
|
138534
138763
|
});
|
|
138764
|
+
const rulerHostStyle = ref({});
|
|
138765
|
+
const rulerContainerEl = ref(null);
|
|
138766
|
+
let editorResizeObserver = null;
|
|
138767
|
+
let rulerContainerResizeObserver = null;
|
|
138768
|
+
let layoutUpdatedHandler = null;
|
|
138769
|
+
const resolveRulerContainer = () => {
|
|
138770
|
+
const container = props.options?.rulerContainer;
|
|
138771
|
+
if (!container) return null;
|
|
138772
|
+
if (typeof container === "string") {
|
|
138773
|
+
const doc2 = editorWrapper.value?.ownerDocument ?? document;
|
|
138774
|
+
return doc2.querySelector(container);
|
|
138775
|
+
}
|
|
138776
|
+
return container instanceof HTMLElement ? container : null;
|
|
138777
|
+
};
|
|
138778
|
+
const getViewportRect2 = () => {
|
|
138779
|
+
const host = editorWrapper.value;
|
|
138780
|
+
if (!host) return null;
|
|
138781
|
+
const viewport2 = host.querySelector(".presentation-editor__viewport");
|
|
138782
|
+
const target = viewport2 ?? host;
|
|
138783
|
+
return target.getBoundingClientRect();
|
|
138784
|
+
};
|
|
138785
|
+
const syncRulerOffset = () => {
|
|
138786
|
+
if (!rulersVisible.value) {
|
|
138787
|
+
rulerHostStyle.value = {};
|
|
138788
|
+
return;
|
|
138789
|
+
}
|
|
138790
|
+
rulerContainerEl.value = resolveRulerContainer();
|
|
138791
|
+
if (!rulerContainerEl.value) {
|
|
138792
|
+
rulerHostStyle.value = {};
|
|
138793
|
+
return;
|
|
138794
|
+
}
|
|
138795
|
+
const viewportRect = getViewportRect2();
|
|
138796
|
+
if (!viewportRect) return;
|
|
138797
|
+
const hostRect = rulerContainerEl.value.getBoundingClientRect();
|
|
138798
|
+
const paddingLeft = Math.max(0, viewportRect.left - hostRect.left);
|
|
138799
|
+
const paddingRight = Math.max(0, hostRect.right - viewportRect.right);
|
|
138800
|
+
rulerHostStyle.value = {
|
|
138801
|
+
paddingLeft: `${paddingLeft}px`,
|
|
138802
|
+
paddingRight: `${paddingRight}px`
|
|
138803
|
+
};
|
|
138804
|
+
};
|
|
138805
|
+
const cleanupRulerObservers = () => {
|
|
138806
|
+
if (editorResizeObserver) {
|
|
138807
|
+
editorResizeObserver.disconnect();
|
|
138808
|
+
editorResizeObserver = null;
|
|
138809
|
+
}
|
|
138810
|
+
if (rulerContainerResizeObserver) {
|
|
138811
|
+
rulerContainerResizeObserver.disconnect();
|
|
138812
|
+
rulerContainerResizeObserver = null;
|
|
138813
|
+
}
|
|
138814
|
+
};
|
|
138815
|
+
const setupRulerObservers = () => {
|
|
138816
|
+
cleanupRulerObservers();
|
|
138817
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
138818
|
+
const viewportHost = editorWrapper.value;
|
|
138819
|
+
const rulerHost = resolveRulerContainer();
|
|
138820
|
+
if (viewportHost) {
|
|
138821
|
+
editorResizeObserver = new ResizeObserver(() => syncRulerOffset());
|
|
138822
|
+
editorResizeObserver.observe(viewportHost);
|
|
138823
|
+
}
|
|
138824
|
+
if (rulerHost) {
|
|
138825
|
+
rulerContainerResizeObserver = new ResizeObserver(() => syncRulerOffset());
|
|
138826
|
+
rulerContainerResizeObserver.observe(rulerHost);
|
|
138827
|
+
}
|
|
138828
|
+
};
|
|
138535
138829
|
const message = useMessage();
|
|
138536
138830
|
const editorWrapper = ref(null);
|
|
138537
138831
|
const editorElem = ref(null);
|
|
@@ -138843,7 +139137,7 @@ ${style2}
|
|
|
138843
139137
|
presentationEditor.on("imageDeselected", () => {
|
|
138844
139138
|
clearSelectedImage();
|
|
138845
139139
|
});
|
|
138846
|
-
|
|
139140
|
+
layoutUpdatedHandler = () => {
|
|
138847
139141
|
if (imageResizeState.visible && imageResizeState.blockId) {
|
|
138848
139142
|
const escapedBlockId = CSS.escape(imageResizeState.blockId);
|
|
138849
139143
|
const newElement = editorElem.value?.querySelector(
|
|
@@ -138876,13 +139170,17 @@ ${style2}
|
|
|
138876
139170
|
clearSelectedImage();
|
|
138877
139171
|
}
|
|
138878
139172
|
}
|
|
138879
|
-
|
|
139173
|
+
nextTick(() => syncRulerOffset());
|
|
139174
|
+
};
|
|
139175
|
+
presentationEditor.on("layoutUpdated", layoutUpdatedHandler);
|
|
138880
139176
|
zoomChangeHandler = ({ zoom }) => {
|
|
138881
139177
|
currentZoom.value = zoom;
|
|
139178
|
+
nextTick(() => syncRulerOffset());
|
|
138882
139179
|
};
|
|
138883
139180
|
presentationEditor.on("zoomChange", zoomChangeHandler);
|
|
138884
139181
|
if (typeof presentationEditor.zoom === "number") {
|
|
138885
139182
|
currentZoom.value = presentationEditor.zoom;
|
|
139183
|
+
nextTick(() => syncRulerOffset());
|
|
138886
139184
|
}
|
|
138887
139185
|
}
|
|
138888
139186
|
editor.value.on("paginationUpdate", () => {
|
|
@@ -138942,6 +139240,11 @@ ${style2}
|
|
|
138942
139240
|
onMounted(() => {
|
|
138943
139241
|
initializeData();
|
|
138944
139242
|
if (props.options?.suppressSkeletonLoader || !props.options?.collaborationProvider) editorReady.value = true;
|
|
139243
|
+
window.addEventListener("resize", syncRulerOffset, { passive: true });
|
|
139244
|
+
nextTick(() => {
|
|
139245
|
+
syncRulerOffset();
|
|
139246
|
+
setupRulerObservers();
|
|
139247
|
+
});
|
|
138945
139248
|
});
|
|
138946
139249
|
const handleMarginClick = (event) => {
|
|
138947
139250
|
if (event.button !== 0) {
|
|
@@ -138956,10 +139259,14 @@ ${style2}
|
|
|
138956
139259
|
const handleMarginChange = ({ side, value }) => {
|
|
138957
139260
|
const base2 = activeEditor.value;
|
|
138958
139261
|
if (!base2) return;
|
|
138959
|
-
const
|
|
138960
|
-
const
|
|
138961
|
-
|
|
138962
|
-
|
|
139262
|
+
const payload = side === "left" ? { leftInches: value } : side === "right" ? { rightInches: value } : side === "top" ? { topInches: value } : side === "bottom" ? { bottomInches: value } : {};
|
|
139263
|
+
const didUpdateSection = typeof base2.commands?.setSectionPageMarginsAtSelection === "function" ? base2.commands.setSectionPageMarginsAtSelection(payload) : false;
|
|
139264
|
+
if (!didUpdateSection) {
|
|
139265
|
+
const pageStyles2 = base2.getPageStyles();
|
|
139266
|
+
const { pageMargins } = pageStyles2;
|
|
139267
|
+
const update = { ...pageMargins, [side]: value };
|
|
139268
|
+
base2?.updatePageStyle({ pageMargins: update });
|
|
139269
|
+
}
|
|
138963
139270
|
};
|
|
138964
139271
|
onBeforeUnmount(() => {
|
|
138965
139272
|
stopPolling();
|
|
@@ -138968,6 +139275,12 @@ ${style2}
|
|
|
138968
139275
|
editor.value.off("zoomChange", zoomChangeHandler);
|
|
138969
139276
|
zoomChangeHandler = null;
|
|
138970
139277
|
}
|
|
139278
|
+
if (editor.value instanceof PresentationEditor && layoutUpdatedHandler) {
|
|
139279
|
+
editor.value.off("layoutUpdated", layoutUpdatedHandler);
|
|
139280
|
+
layoutUpdatedHandler = null;
|
|
139281
|
+
}
|
|
139282
|
+
cleanupRulerObservers();
|
|
139283
|
+
window.removeEventListener("resize", syncRulerOffset);
|
|
138971
139284
|
editor.value?.destroy();
|
|
138972
139285
|
editor.value = null;
|
|
138973
139286
|
});
|
|
@@ -138979,18 +139292,28 @@ ${style2}
|
|
|
138979
139292
|
__props.options.rulerContainer && rulersVisible.value && !!activeEditor.value ? (openBlock(), createBlock(Teleport, {
|
|
138980
139293
|
key: 0,
|
|
138981
139294
|
to: __props.options.rulerContainer
|
|
139295
|
+
}, [
|
|
139296
|
+
createBaseVNode("div", {
|
|
139297
|
+
class: "ruler-host",
|
|
139298
|
+
style: normalizeStyle(rulerHostStyle.value)
|
|
139299
|
+
}, [
|
|
139300
|
+
createVNode(Ruler, {
|
|
139301
|
+
class: "ruler superdoc-ruler",
|
|
139302
|
+
editor: activeEditor.value,
|
|
139303
|
+
onMarginChange: handleMarginChange
|
|
139304
|
+
}, null, 8, ["editor"])
|
|
139305
|
+
], 4)
|
|
139306
|
+
], 8, ["to"])) : rulersVisible.value && !!activeEditor.value ? (openBlock(), createElementBlock("div", {
|
|
139307
|
+
key: 1,
|
|
139308
|
+
class: "ruler-host",
|
|
139309
|
+
style: normalizeStyle(rulerHostStyle.value)
|
|
138982
139310
|
}, [
|
|
138983
139311
|
createVNode(Ruler, {
|
|
138984
|
-
class: "ruler
|
|
139312
|
+
class: "ruler",
|
|
138985
139313
|
editor: activeEditor.value,
|
|
138986
139314
|
onMarginChange: handleMarginChange
|
|
138987
139315
|
}, null, 8, ["editor"])
|
|
138988
|
-
],
|
|
138989
|
-
key: 1,
|
|
138990
|
-
class: "ruler",
|
|
138991
|
-
editor: activeEditor.value,
|
|
138992
|
-
onMarginChange: handleMarginChange
|
|
138993
|
-
}, null, 8, ["editor"])) : createCommentVNode("", true),
|
|
139316
|
+
], 4)) : createCommentVNode("", true),
|
|
138994
139317
|
createBaseVNode("div", {
|
|
138995
139318
|
class: "super-editor",
|
|
138996
139319
|
ref_key: "editorWrapper",
|
|
@@ -139095,7 +139418,7 @@ ${style2}
|
|
|
139095
139418
|
};
|
|
139096
139419
|
}
|
|
139097
139420
|
});
|
|
139098
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-
|
|
139421
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-f5c4f915"]]);
|
|
139099
139422
|
const _hoisted_1$h = ["innerHTML"];
|
|
139100
139423
|
const _sfc_main$i = {
|
|
139101
139424
|
__name: "SuperInput",
|
|
@@ -141257,6 +141580,9 @@ ${reason}`);
|
|
|
141257
141580
|
const handleEditorLocationsUpdate = (allCommentPositions) => {
|
|
141258
141581
|
editorCommentPositions.value = allCommentPositions || {};
|
|
141259
141582
|
};
|
|
141583
|
+
const clearEditorCommentPositions = () => {
|
|
141584
|
+
editorCommentPositions.value = {};
|
|
141585
|
+
};
|
|
141260
141586
|
const getFloatingComments = computed(() => {
|
|
141261
141587
|
const comments = getGroupedComments.value?.parentComments.filter((c2) => !c2.resolvedTime).filter((c2) => {
|
|
141262
141588
|
const keys2 = Object.keys(editorCommentPositions.value);
|
|
@@ -141359,6 +141685,7 @@ ${reason}`);
|
|
|
141359
141685
|
processLoadedDocxComments,
|
|
141360
141686
|
translateCommentsForExport,
|
|
141361
141687
|
handleEditorLocationsUpdate,
|
|
141688
|
+
clearEditorCommentPositions,
|
|
141362
141689
|
handleTrackedChangeUpdate
|
|
141363
141690
|
};
|
|
141364
141691
|
});
|
|
@@ -143264,6 +143591,7 @@ ${reason}`);
|
|
|
143264
143591
|
commentsStore.proxy = proxy;
|
|
143265
143592
|
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
143266
143593
|
const { uiFontFamily } = useUiFontFamily();
|
|
143594
|
+
const isViewingMode = () => proxy?.$superdoc?.config?.documentMode === "viewing";
|
|
143267
143595
|
const commentsModuleConfig = computed(() => {
|
|
143268
143596
|
const config2 = modules.comments;
|
|
143269
143597
|
if (config2 === false || config2 == null) return null;
|
|
@@ -143358,6 +143686,10 @@ ${reason}`);
|
|
|
143358
143686
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
143359
143687
|
if (!commentsConfig || commentsConfig === false) return;
|
|
143360
143688
|
if (!positions || Object.keys(positions).length === 0) return;
|
|
143689
|
+
if (isViewingMode()) {
|
|
143690
|
+
commentsStore.clearEditorCommentPositions?.();
|
|
143691
|
+
return;
|
|
143692
|
+
}
|
|
143361
143693
|
const mappedPositions = presentationEditor.getCommentBounds(positions, layers.value);
|
|
143362
143694
|
handleEditorLocationsUpdate(mappedPositions);
|
|
143363
143695
|
});
|
|
@@ -143377,6 +143709,13 @@ ${reason}`);
|
|
|
143377
143709
|
const onEditorSelectionChange = ({ editor, transaction }) => {
|
|
143378
143710
|
if (skipSelectionUpdate.value) {
|
|
143379
143711
|
skipSelectionUpdate.value = false;
|
|
143712
|
+
if (isViewingMode()) {
|
|
143713
|
+
resetSelection();
|
|
143714
|
+
}
|
|
143715
|
+
return;
|
|
143716
|
+
}
|
|
143717
|
+
if (isViewingMode()) {
|
|
143718
|
+
resetSelection();
|
|
143380
143719
|
return;
|
|
143381
143720
|
}
|
|
143382
143721
|
const { documentId } = editor.options;
|
|
@@ -143555,6 +143894,10 @@ ${reason}`);
|
|
|
143555
143894
|
const onEditorCommentLocationsUpdate = (doc2, { allCommentIds: activeThreadId, allCommentPositions } = {}) => {
|
|
143556
143895
|
const commentsConfig = proxy.$superdoc.config.modules?.comments;
|
|
143557
143896
|
if (!commentsConfig || commentsConfig === false) return;
|
|
143897
|
+
if (isViewingMode()) {
|
|
143898
|
+
commentsStore.clearEditorCommentPositions?.();
|
|
143899
|
+
return;
|
|
143900
|
+
}
|
|
143558
143901
|
const presentation = PresentationEditor.getInstance(doc2.id);
|
|
143559
143902
|
if (!presentation) {
|
|
143560
143903
|
handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
|
|
@@ -143610,11 +143953,12 @@ ${reason}`);
|
|
|
143610
143953
|
};
|
|
143611
143954
|
const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
|
|
143612
143955
|
const showCommentsSidebar = computed(() => {
|
|
143956
|
+
if (isViewingMode()) return false;
|
|
143613
143957
|
return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
|
|
143614
143958
|
});
|
|
143615
143959
|
const showToolsFloatingMenu = computed(() => {
|
|
143616
143960
|
if (!isCommentsEnabled.value) return false;
|
|
143617
|
-
return toolsMenuPosition.top && !getConfig2.value?.readOnly;
|
|
143961
|
+
return selectionPosition.value && toolsMenuPosition.top && !getConfig2.value?.readOnly;
|
|
143618
143962
|
});
|
|
143619
143963
|
computed(() => {
|
|
143620
143964
|
if (!isCommentsEnabled.value) return false;
|
|
@@ -143662,6 +144006,10 @@ ${reason}`);
|
|
|
143662
144006
|
return style2;
|
|
143663
144007
|
});
|
|
143664
144008
|
const handleSelectionChange = (selection) => {
|
|
144009
|
+
if (isViewingMode()) {
|
|
144010
|
+
resetSelection();
|
|
144011
|
+
return;
|
|
144012
|
+
}
|
|
143665
144013
|
if (!selection.selectionBounds || !isCommentsEnabled.value) return;
|
|
143666
144014
|
resetSelection();
|
|
143667
144015
|
const isMobileView = window.matchMedia("(max-width: 768px)").matches;
|
|
@@ -143687,12 +144035,14 @@ ${reason}`);
|
|
|
143687
144035
|
};
|
|
143688
144036
|
const resetSelection = () => {
|
|
143689
144037
|
selectionPosition.value = null;
|
|
144038
|
+
toolsMenuPosition.top = null;
|
|
143690
144039
|
};
|
|
143691
144040
|
const updateSelection2 = ({ startX, startY, x: x2, y: y2, source }) => {
|
|
143692
144041
|
const hasStartCoords = typeof startX === "number" || typeof startY === "number";
|
|
143693
144042
|
const hasEndCoords = typeof x2 === "number" || typeof y2 === "number";
|
|
143694
144043
|
if (!hasStartCoords && !hasEndCoords) {
|
|
143695
|
-
|
|
144044
|
+
resetSelection();
|
|
144045
|
+
return;
|
|
143696
144046
|
}
|
|
143697
144047
|
if (!selectionPosition.value) {
|
|
143698
144048
|
if (startY == null || startX == null) return;
|
|
@@ -143945,7 +144295,7 @@ ${reason}`);
|
|
|
143945
144295
|
};
|
|
143946
144296
|
}
|
|
143947
144297
|
};
|
|
143948
|
-
const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
144298
|
+
const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5196811d"]]);
|
|
143949
144299
|
const createSuperdocVueApp = () => {
|
|
143950
144300
|
const app = createApp(App);
|
|
143951
144301
|
const pinia = createPinia();
|
|
@@ -144129,7 +144479,7 @@ ${reason}`);
|
|
|
144129
144479
|
this.config.colors = shuffleArray(this.config.colors);
|
|
144130
144480
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
144131
144481
|
this.colorIndex = 0;
|
|
144132
|
-
this.version = "1.3.0
|
|
144482
|
+
this.version = "1.3.0";
|
|
144133
144483
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
144134
144484
|
this.superdocId = config2.superdocId || v4();
|
|
144135
144485
|
this.colors = this.config.colors;
|
|
@@ -144646,7 +144996,8 @@ ${reason}`);
|
|
|
144646
144996
|
}
|
|
144647
144997
|
#setModeViewing() {
|
|
144648
144998
|
this.toolbar.activeEditor = null;
|
|
144649
|
-
this.setTrackedChangesPreferences({ mode: "original", enabled:
|
|
144999
|
+
this.setTrackedChangesPreferences({ mode: "original", enabled: true });
|
|
145000
|
+
this.commentsStore?.clearEditorCommentPositions?.();
|
|
144650
145001
|
this.superdocStore.documents.forEach((doc2) => {
|
|
144651
145002
|
doc2.removeComments();
|
|
144652
145003
|
this.#applyDocumentMode(doc2, "viewing");
|