@harbour-enterprises/superdoc 1.0.0-beta.96 → 1.0.0-beta.98
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-Cdp1WJ9e.es.js → PdfViewer-1_KffD-j.es.js} +1 -1
- package/dist/chunks/{PdfViewer-BGTfnD4T.cjs → PdfViewer-D1Ot32kX.cjs} +1 -1
- package/dist/chunks/{index-BV9YtiyI.es.js → index-CP2_WwLA.es.js} +3 -3
- package/dist/chunks/{index-C-IS20yQ.cjs → index-CUO7gEi8.cjs} +3 -3
- package/dist/chunks/{index-lfdM_gm7-_EQjLyqH.es.js → index-Dg_sTYZK-D20z8mus.es.js} +1 -1
- package/dist/chunks/{index-lfdM_gm7-qtx-V4oF.cjs → index-Dg_sTYZK-DYDzxoXL.cjs} +1 -1
- package/dist/chunks/{super-editor.es-De2XS3A1.es.js → super-editor.es-3dJOUw65.es.js} +281 -201
- package/dist/chunks/{super-editor.es-D2zn943K.cjs → super-editor.es-DN_dgBH0.cjs} +281 -201
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-B29ATZFC.js → converter-Oj-eTB79.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-BPktKUBx.js → docx-zipper-Dl188zQ3.js} +1 -1
- package/dist/super-editor/chunks/{editor-BRHMYtPA.js → editor-DBXoaaWP.js} +282 -202
- package/dist/super-editor/chunks/{index-lfdM_gm7.js → index-Dg_sTYZK.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CB2cJCLh.js → toolbar-PlGGj0Ew.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +283 -203
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -42422,7 +42422,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
42422
42422
|
static getStoredSuperdocVersion(docx) {
|
|
42423
42423
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42424
42424
|
}
|
|
42425
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42425
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.98") {
|
|
42426
42426
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42427
42427
|
}
|
|
42428
42428
|
/**
|
|
@@ -67497,7 +67497,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67497
67497
|
const shouldSkipNodeView = (editor) => {
|
|
67498
67498
|
return isHeadless(editor);
|
|
67499
67499
|
};
|
|
67500
|
-
const summaryVersion = "1.0.0-beta.
|
|
67500
|
+
const summaryVersion = "1.0.0-beta.98";
|
|
67501
67501
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
67502
67502
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
67503
67503
|
function mapAttributes(attrs) {
|
|
@@ -68286,7 +68286,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68286
68286
|
{ default: remarkStringify2 },
|
|
68287
68287
|
{ default: remarkGfm2 }
|
|
68288
68288
|
] = await Promise.all([
|
|
68289
|
-
Promise.resolve().then(() =>
|
|
68289
|
+
Promise.resolve().then(() => indexDg_sTYZK),
|
|
68290
68290
|
Promise.resolve().then(() => indexDRCvimau),
|
|
68291
68291
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
68292
68292
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -68491,7 +68491,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68491
68491
|
* Process collaboration migrations
|
|
68492
68492
|
*/
|
|
68493
68493
|
processCollaborationMigrations() {
|
|
68494
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
68494
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.98");
|
|
68495
68495
|
if (!this.options.ydoc) return;
|
|
68496
68496
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
68497
68497
|
let docVersion = metaMap.get("version");
|
|
@@ -70815,12 +70815,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70815
70815
|
})(SectionType || {});
|
|
70816
70816
|
const DEFAULT_PARAGRAPH_SECTION_TYPE = "nextPage";
|
|
70817
70817
|
const DEFAULT_BODY_SECTION_TYPE = "continuous";
|
|
70818
|
-
const TWIPS_PER_INCH$
|
|
70819
|
-
const PX_PER_INCH$
|
|
70818
|
+
const TWIPS_PER_INCH$4 = 1440;
|
|
70819
|
+
const PX_PER_INCH$3 = 96;
|
|
70820
70820
|
const DEFAULT_COLUMN_GAP_INCHES = 0.5;
|
|
70821
70821
|
function twipsToPixels$1(twips) {
|
|
70822
70822
|
const n = Number(twips);
|
|
70823
|
-
return Number.isFinite(n) ? n / TWIPS_PER_INCH$
|
|
70823
|
+
return Number.isFinite(n) ? n / TWIPS_PER_INCH$4 * PX_PER_INCH$3 : void 0;
|
|
70824
70824
|
}
|
|
70825
70825
|
function parseColumnCount(rawValue) {
|
|
70826
70826
|
if (rawValue == null) return 1;
|
|
@@ -70830,7 +70830,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70830
70830
|
function parseColumnGap(gapTwips) {
|
|
70831
70831
|
if (gapTwips == null) return DEFAULT_COLUMN_GAP_INCHES;
|
|
70832
70832
|
const gap = Number(gapTwips);
|
|
70833
|
-
return Number.isFinite(gap) ? gap / TWIPS_PER_INCH$
|
|
70833
|
+
return Number.isFinite(gap) ? gap / TWIPS_PER_INCH$4 : DEFAULT_COLUMN_GAP_INCHES;
|
|
70834
70834
|
}
|
|
70835
70835
|
function extractNormalizedMargins(attrs) {
|
|
70836
70836
|
const sectionMargins = attrs.sectionMargins;
|
|
@@ -70869,14 +70869,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70869
70869
|
return { pageSizePx, orientation };
|
|
70870
70870
|
}
|
|
70871
70871
|
function extractFallbackMargins(elements, currentHeader, currentFooter) {
|
|
70872
|
-
if (currentHeader !== void 0 && currentFooter !== void 0) {
|
|
70873
|
-
return { headerPx: currentHeader, footerPx: currentFooter };
|
|
70874
|
-
}
|
|
70875
70872
|
const pgMar = elements.find((el) => el?.name === "w:pgMar");
|
|
70876
70873
|
const a2 = pgMar?.attributes || {};
|
|
70877
70874
|
return {
|
|
70878
70875
|
headerPx: currentHeader ?? (a2["w:header"] != null ? twipsToPixels$1(a2["w:header"]) : void 0),
|
|
70879
|
-
footerPx: currentFooter ?? (a2["w:footer"] != null ? twipsToPixels$1(a2["w:footer"]) : void 0)
|
|
70876
|
+
footerPx: currentFooter ?? (a2["w:footer"] != null ? twipsToPixels$1(a2["w:footer"]) : void 0),
|
|
70877
|
+
topPx: a2["w:top"] != null ? twipsToPixels$1(a2["w:top"]) : void 0,
|
|
70878
|
+
rightPx: a2["w:right"] != null ? twipsToPixels$1(a2["w:right"]) : void 0,
|
|
70879
|
+
bottomPx: a2["w:bottom"] != null ? twipsToPixels$1(a2["w:bottom"]) : void 0,
|
|
70880
|
+
leftPx: a2["w:left"] != null ? twipsToPixels$1(a2["w:left"]) : void 0
|
|
70880
70881
|
};
|
|
70881
70882
|
}
|
|
70882
70883
|
function extractHeaderFooterRefs(elements, refName) {
|
|
@@ -70914,7 +70915,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70914
70915
|
const gapInches = parseColumnGap(cols.attributes["w:space"]);
|
|
70915
70916
|
return {
|
|
70916
70917
|
count,
|
|
70917
|
-
gap: gapInches * PX_PER_INCH$
|
|
70918
|
+
gap: gapInches * PX_PER_INCH$3
|
|
70918
70919
|
};
|
|
70919
70920
|
}
|
|
70920
70921
|
function extractVerticalAlign(elements) {
|
|
@@ -70937,7 +70938,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70937
70938
|
const type2 = extractSectionType(sectPrElements);
|
|
70938
70939
|
const { pageSizePx, orientation } = extractPageSizeAndOrientation(sectPrElements);
|
|
70939
70940
|
const titlePg = sectPrElements.some((el) => el?.name === "w:titlePg");
|
|
70940
|
-
|
|
70941
|
+
const fallbackMargins = extractFallbackMargins(sectPrElements, headerPx, footerPx);
|
|
70942
|
+
headerPx = fallbackMargins.headerPx;
|
|
70943
|
+
footerPx = fallbackMargins.footerPx;
|
|
70944
|
+
const { topPx, rightPx, bottomPx, leftPx } = fallbackMargins;
|
|
70941
70945
|
const headerRefs = extractHeaderFooterRefs(sectPrElements, "w:headerReference");
|
|
70942
70946
|
const footerRefs = extractHeaderFooterRefs(sectPrElements, "w:footerReference");
|
|
70943
70947
|
const numbering = extractPageNumbering(sectPrElements);
|
|
@@ -70946,6 +70950,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70946
70950
|
return {
|
|
70947
70951
|
headerPx,
|
|
70948
70952
|
footerPx,
|
|
70953
|
+
topPx,
|
|
70954
|
+
rightPx,
|
|
70955
|
+
bottomPx,
|
|
70956
|
+
leftPx,
|
|
70949
70957
|
type: type2,
|
|
70950
70958
|
pageSizePx,
|
|
70951
70959
|
orientation,
|
|
@@ -71057,7 +71065,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71057
71065
|
startParagraphIndex: currentStart,
|
|
71058
71066
|
endParagraphIndex: item.index,
|
|
71059
71067
|
sectPr,
|
|
71060
|
-
margins: sectionData.headerPx != null || sectionData.footerPx != null ? {
|
|
71068
|
+
margins: sectionData.headerPx != null || sectionData.footerPx != null ? {
|
|
71069
|
+
header: sectionData.headerPx ?? 0,
|
|
71070
|
+
footer: sectionData.footerPx ?? 0,
|
|
71071
|
+
top: sectionData.topPx,
|
|
71072
|
+
right: sectionData.rightPx,
|
|
71073
|
+
bottom: sectionData.bottomPx,
|
|
71074
|
+
left: sectionData.leftPx
|
|
71075
|
+
} : null,
|
|
71061
71076
|
pageSize: sectionData.pageSizePx ?? null,
|
|
71062
71077
|
orientation: sectionData.orientation ?? null,
|
|
71063
71078
|
columns: sectionData.columnsPx ?? null,
|
|
@@ -71099,7 +71114,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71099
71114
|
startParagraphIndex: currentStart,
|
|
71100
71115
|
endParagraphIndex: totalParagraphs - 1,
|
|
71101
71116
|
sectPr: bodySectPr,
|
|
71102
|
-
margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? {
|
|
71117
|
+
margins: bodySectionData.headerPx != null || bodySectionData.footerPx != null ? {
|
|
71118
|
+
header: bodySectionData.headerPx ?? 0,
|
|
71119
|
+
footer: bodySectionData.footerPx ?? 0,
|
|
71120
|
+
top: bodySectionData.topPx,
|
|
71121
|
+
right: bodySectionData.rightPx,
|
|
71122
|
+
bottom: bodySectionData.bottomPx,
|
|
71123
|
+
left: bodySectionData.leftPx
|
|
71124
|
+
} : null,
|
|
71103
71125
|
pageSize: bodySectionData.pageSizePx ?? null,
|
|
71104
71126
|
orientation: bodySectionData.orientation ?? null,
|
|
71105
71127
|
columns: bodySectionData.columnsPx ?? null,
|
|
@@ -71150,8 +71172,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71150
71172
|
}
|
|
71151
71173
|
return ranges;
|
|
71152
71174
|
}
|
|
71153
|
-
const TWIPS_PER_INCH$
|
|
71154
|
-
const PX_PER_INCH$
|
|
71175
|
+
const TWIPS_PER_INCH$3 = 1440;
|
|
71176
|
+
const PX_PER_INCH$2 = 96;
|
|
71155
71177
|
const PX_PER_PT = 96 / 72;
|
|
71156
71178
|
SectionType.NEXT_PAGE;
|
|
71157
71179
|
SectionType.CONTINUOUS;
|
|
@@ -71290,7 +71312,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71290
71312
|
}
|
|
71291
71313
|
return filtered;
|
|
71292
71314
|
};
|
|
71293
|
-
const twipsToPx$
|
|
71315
|
+
const twipsToPx$2 = (value) => value / TWIPS_PER_INCH$3 * PX_PER_INCH$2;
|
|
71294
71316
|
const ptToPx = (pt) => {
|
|
71295
71317
|
if (pt == null || !Number.isFinite(pt)) return void 0;
|
|
71296
71318
|
return pt * PX_PER_PT;
|
|
@@ -72800,8 +72822,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72800
72822
|
const beforeAutospacing = toBooleanFlag(source.beforeAutospacing ?? source.beforeAutoSpacing);
|
|
72801
72823
|
const afterAutospacing = toBooleanFlag(source.afterAutospacing ?? source.afterAutoSpacing);
|
|
72802
72824
|
const contextualSpacing = toBooleanFlag(source.contextualSpacing);
|
|
72803
|
-
const before = beforeRaw != null ? twipsToPx$
|
|
72804
|
-
const after = afterRaw != null ? twipsToPx$
|
|
72825
|
+
const before = beforeRaw != null ? twipsToPx$2(beforeRaw) : pickNumber(source.lineSpaceBefore);
|
|
72826
|
+
const after = afterRaw != null ? twipsToPx$2(afterRaw) : pickNumber(source.lineSpaceAfter);
|
|
72805
72827
|
const line = normalizeLineValue(lineRaw, lineRule);
|
|
72806
72828
|
if (before != null) spacing.before = before;
|
|
72807
72829
|
if (after != null) spacing.after = after;
|
|
@@ -72831,9 +72853,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72831
72853
|
if (value > 0 && value <= MAX_AUTO_LINE_MULTIPLIER) {
|
|
72832
72854
|
return value;
|
|
72833
72855
|
}
|
|
72834
|
-
return twipsToPx$
|
|
72856
|
+
return twipsToPx$2(value);
|
|
72835
72857
|
}
|
|
72836
|
-
return twipsToPx$
|
|
72858
|
+
return twipsToPx$2(value);
|
|
72837
72859
|
};
|
|
72838
72860
|
const normalizeLineRule = (value) => {
|
|
72839
72861
|
if (value === "auto" || value === "exact" || value === "atLeast") {
|
|
@@ -72870,7 +72892,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72870
72892
|
if (Math.abs(num) <= TWIPS_THRESHOLD$1) {
|
|
72871
72893
|
return num;
|
|
72872
72894
|
}
|
|
72873
|
-
return twipsToPx$
|
|
72895
|
+
return twipsToPx$2(Number(num));
|
|
72874
72896
|
};
|
|
72875
72897
|
const left2 = convert2(pickNumber(source.left));
|
|
72876
72898
|
const right2 = convert2(pickNumber(source.right));
|
|
@@ -73450,9 +73472,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
73450
73472
|
const family = run2.fontFamily ?? "Times New Roman";
|
|
73451
73473
|
return `${style2}${weight}${size2} ${family}`;
|
|
73452
73474
|
};
|
|
73453
|
-
const TWIPS_PER_INCH$
|
|
73475
|
+
const TWIPS_PER_INCH$2 = 1440;
|
|
73454
73476
|
const PIXELS_PER_INCH = 96;
|
|
73455
|
-
const TWIPS_PER_PIXEL = Math.round(TWIPS_PER_INCH$
|
|
73477
|
+
const TWIPS_PER_PIXEL = Math.round(TWIPS_PER_INCH$2 / PIXELS_PER_INCH);
|
|
73456
73478
|
const PIXELS_PER_TWIP = 1 / TWIPS_PER_PIXEL;
|
|
73457
73479
|
const toFiniteNumber = (value) => {
|
|
73458
73480
|
if (value == null) return null;
|
|
@@ -74476,7 +74498,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
74476
74498
|
}
|
|
74477
74499
|
const spacingTwips = parseNumberAttr(getAttribute(findChild(rPr, "w:spacing"), "w:val"));
|
|
74478
74500
|
if (spacingTwips != null && Number.isFinite(spacingTwips)) {
|
|
74479
|
-
run2.letterSpacing = twipsToPx$
|
|
74501
|
+
run2.letterSpacing = twipsToPx$2(spacingTwips);
|
|
74480
74502
|
}
|
|
74481
74503
|
return Object.keys(run2).length ? run2 : void 0;
|
|
74482
74504
|
};
|
|
@@ -74700,10 +74722,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
74700
74722
|
const convertIndentTwipsToPx = (indent2) => {
|
|
74701
74723
|
if (!indent2) return void 0;
|
|
74702
74724
|
const result = {};
|
|
74703
|
-
|
|
74704
|
-
|
|
74705
|
-
|
|
74706
|
-
|
|
74725
|
+
const toNum = (v2) => {
|
|
74726
|
+
if (typeof v2 === "string" && v2.trim() !== "" && isFinite(Number(v2))) return Number(v2);
|
|
74727
|
+
if (isFiniteNumber(v2)) return Number(v2);
|
|
74728
|
+
return void 0;
|
|
74729
|
+
};
|
|
74730
|
+
const left2 = toNum(indent2.left);
|
|
74731
|
+
const right2 = toNum(indent2.right);
|
|
74732
|
+
const firstLine = toNum(indent2.firstLine);
|
|
74733
|
+
const hanging = toNum(indent2.hanging);
|
|
74734
|
+
if (left2 != null) result.left = twipsToPx$2(left2);
|
|
74735
|
+
if (right2 != null) result.right = twipsToPx$2(right2);
|
|
74736
|
+
if (firstLine != null) result.firstLine = twipsToPx$2(firstLine);
|
|
74737
|
+
if (hanging != null) result.hanging = twipsToPx$2(hanging);
|
|
74707
74738
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
74708
74739
|
};
|
|
74709
74740
|
const toAdapterNumberingProps = (value) => {
|
|
@@ -74728,7 +74759,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
74728
74759
|
if (!stop || typeof stop.pos !== "number") continue;
|
|
74729
74760
|
const alignment2 = normalizeResolvedTabAlignment(stop.val);
|
|
74730
74761
|
if (!alignment2) continue;
|
|
74731
|
-
const position2 = twipsToPx$
|
|
74762
|
+
const position2 = twipsToPx$2(stop.pos);
|
|
74732
74763
|
if (!Number.isFinite(position2)) continue;
|
|
74733
74764
|
const resolvedStop = {
|
|
74734
74765
|
position: position2,
|
|
@@ -75169,9 +75200,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75169
75200
|
const vAnchor = asString2(framePr["w:vAnchor"] ?? framePr.vAnchor);
|
|
75170
75201
|
if (vAnchor) frame.vAnchor = vAnchor;
|
|
75171
75202
|
const xTwips = pickNumber(framePr["w:x"] ?? framePr.x);
|
|
75172
|
-
if (xTwips != null) frame.x = twipsToPx$
|
|
75203
|
+
if (xTwips != null) frame.x = twipsToPx$2(xTwips);
|
|
75173
75204
|
const yTwips = pickNumber(framePr["w:y"] ?? framePr.y);
|
|
75174
|
-
if (yTwips != null) frame.y = twipsToPx$
|
|
75205
|
+
if (yTwips != null) frame.y = twipsToPx$2(yTwips);
|
|
75175
75206
|
if (Object.keys(frame).length > 0) {
|
|
75176
75207
|
paragraphAttrs.frame = frame;
|
|
75177
75208
|
}
|
|
@@ -75259,7 +75290,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75259
75290
|
}
|
|
75260
75291
|
}
|
|
75261
75292
|
}
|
|
75262
|
-
|
|
75293
|
+
let wordLayout = computeWordLayoutForParagraph(paragraphAttrs, enrichedNumberingProps, styleContext);
|
|
75294
|
+
if (!wordLayout && enrichedNumberingProps.resolvedLevelIndent) {
|
|
75295
|
+
const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
|
|
75296
|
+
const firstLinePx = resolvedIndentPx?.firstLine ?? 0;
|
|
75297
|
+
if (firstLinePx > 0) {
|
|
75298
|
+
wordLayout = {
|
|
75299
|
+
// Treat as first-line-indent mode: text starts after the marker+firstLine offset.
|
|
75300
|
+
firstLineIndentMode: true,
|
|
75301
|
+
textStartPx: firstLinePx
|
|
75302
|
+
};
|
|
75303
|
+
}
|
|
75304
|
+
}
|
|
75305
|
+
if (wordLayout && (!wordLayout.textStartPx || !Number.isFinite(wordLayout.textStartPx)) && enrichedNumberingProps.resolvedLevelIndent) {
|
|
75306
|
+
const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
|
|
75307
|
+
const firstLinePx = resolvedIndentPx?.firstLine ?? 0;
|
|
75308
|
+
if (firstLinePx > 0) {
|
|
75309
|
+
wordLayout = {
|
|
75310
|
+
...wordLayout,
|
|
75311
|
+
firstLineIndentMode: wordLayout.firstLineIndentMode ?? true,
|
|
75312
|
+
textStartPx: firstLinePx
|
|
75313
|
+
};
|
|
75314
|
+
}
|
|
75315
|
+
}
|
|
75263
75316
|
if (wordLayout) {
|
|
75264
75317
|
if (wordLayout.marker) {
|
|
75265
75318
|
if (listRendering?.markerText) {
|
|
@@ -77170,7 +77223,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77170
77223
|
const entry = value;
|
|
77171
77224
|
if (typeof entry.value !== "number") return void 0;
|
|
77172
77225
|
if (!entry.type || entry.type === "px" || entry.type === "pixel") return entry.value;
|
|
77173
|
-
if (entry.type === "dxa") return twipsToPx$
|
|
77226
|
+
if (entry.type === "dxa") return twipsToPx$2(entry.value);
|
|
77174
77227
|
return void 0;
|
|
77175
77228
|
};
|
|
77176
77229
|
const normalizeTableWidth = (value) => {
|
|
@@ -77182,7 +77235,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77182
77235
|
return { width: raw, type: measurement.type ?? "px" };
|
|
77183
77236
|
}
|
|
77184
77237
|
if (measurement.type === "dxa") {
|
|
77185
|
-
return { width: twipsToPx$
|
|
77238
|
+
return { width: twipsToPx$2(raw), type: "px" };
|
|
77186
77239
|
}
|
|
77187
77240
|
return { width: raw, type: measurement.type };
|
|
77188
77241
|
};
|
|
@@ -77210,13 +77263,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77210
77263
|
const line = parseIntSafe$1(attrs["w:line"]);
|
|
77211
77264
|
const rawLineRule = attrs["w:lineRule"];
|
|
77212
77265
|
const lineRule = rawLineRule === "auto" || rawLineRule === "exact" || rawLineRule === "atLeast" ? rawLineRule : void 0;
|
|
77213
|
-
if (before != null) spacing.before = twipsToPx$
|
|
77214
|
-
if (after != null) spacing.after = twipsToPx$
|
|
77266
|
+
if (before != null) spacing.before = twipsToPx$2(before);
|
|
77267
|
+
if (after != null) spacing.after = twipsToPx$2(after);
|
|
77215
77268
|
if (line != null) {
|
|
77216
77269
|
if (lineRule === "auto") {
|
|
77217
77270
|
spacing.line = line / 240;
|
|
77218
77271
|
} else {
|
|
77219
|
-
spacing.line = twipsToPx$
|
|
77272
|
+
spacing.line = twipsToPx$2(line);
|
|
77220
77273
|
}
|
|
77221
77274
|
}
|
|
77222
77275
|
if (lineRule) spacing.lineRule = lineRule;
|
|
@@ -77242,7 +77295,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77242
77295
|
if (rawValue == null) return void 0;
|
|
77243
77296
|
const rawRule = heightObj.rule ?? heightObj.hRule;
|
|
77244
77297
|
const rule = rawRule === "exact" || rawRule === "atLeast" || rawRule === "auto" ? rawRule : "atLeast";
|
|
77245
|
-
const valuePx = twipsToPx$
|
|
77298
|
+
const valuePx = twipsToPx$2(rawValue);
|
|
77246
77299
|
return {
|
|
77247
77300
|
value: valuePx,
|
|
77248
77301
|
rule
|
|
@@ -77347,41 +77400,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77347
77400
|
}
|
|
77348
77401
|
}
|
|
77349
77402
|
}
|
|
77350
|
-
try {
|
|
77351
|
-
const blockSummaries = blocks2.map((b2) => {
|
|
77352
|
-
if (b2.kind === "paragraph") {
|
|
77353
|
-
const runs2 = b2.runs ?? [];
|
|
77354
|
-
const attrs = b2.attrs ?? {};
|
|
77355
|
-
return {
|
|
77356
|
-
kind: "paragraph",
|
|
77357
|
-
runKinds: runs2.map((r2) => r2.kind ?? "text"),
|
|
77358
|
-
runCount: runs2.length,
|
|
77359
|
-
runPreview: runs2.map((r2) => {
|
|
77360
|
-
const kind = r2.kind ?? "text";
|
|
77361
|
-
if (kind === "image") {
|
|
77362
|
-
const img2 = r2;
|
|
77363
|
-
return { kind, src: img2.src, width: img2.width, height: img2.height };
|
|
77364
|
-
}
|
|
77365
|
-
return { kind };
|
|
77366
|
-
}),
|
|
77367
|
-
hasNumbering: Boolean(attrs.numberingProperties),
|
|
77368
|
-
markerText: attrs.wordLayout?.marker?.markerText
|
|
77369
|
-
};
|
|
77370
|
-
}
|
|
77371
|
-
return { kind: b2.kind };
|
|
77372
|
-
});
|
|
77373
|
-
console.log(
|
|
77374
|
-
"[tableNodeToBlock.parseTableCell] cell contents",
|
|
77375
|
-
JSON.stringify({
|
|
77376
|
-
cellIndex,
|
|
77377
|
-
rowIndex,
|
|
77378
|
-
cellIdPreview: `cell-${rowIndex}-${cellIndex}`,
|
|
77379
|
-
childTypes: cellNode.content.map((c2) => c2?.type),
|
|
77380
|
-
blocks: blockSummaries
|
|
77381
|
-
})
|
|
77382
|
-
);
|
|
77383
|
-
} catch {
|
|
77384
|
-
}
|
|
77385
77403
|
if (blocks2.length === 0) {
|
|
77386
77404
|
return null;
|
|
77387
77405
|
}
|
|
@@ -77492,10 +77510,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77492
77510
|
anchor.alignV = floatingProps.tblpYSpec;
|
|
77493
77511
|
}
|
|
77494
77512
|
if (floatingProps.tblpX !== void 0) {
|
|
77495
|
-
anchor.offsetH = twipsToPx$
|
|
77513
|
+
anchor.offsetH = twipsToPx$2(floatingProps.tblpX);
|
|
77496
77514
|
}
|
|
77497
77515
|
if (floatingProps.tblpY !== void 0) {
|
|
77498
|
-
anchor.offsetV = twipsToPx$
|
|
77516
|
+
anchor.offsetV = twipsToPx$2(floatingProps.tblpY);
|
|
77499
77517
|
}
|
|
77500
77518
|
const hasDistances = floatingProps.leftFromText !== void 0 || floatingProps.rightFromText !== void 0 || floatingProps.topFromText !== void 0 || floatingProps.bottomFromText !== void 0;
|
|
77501
77519
|
const wrap2 = {
|
|
@@ -77506,16 +77524,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
77506
77524
|
};
|
|
77507
77525
|
if (hasDistances) {
|
|
77508
77526
|
if (floatingProps.topFromText !== void 0) {
|
|
77509
|
-
wrap2.distTop = twipsToPx$
|
|
77527
|
+
wrap2.distTop = twipsToPx$2(floatingProps.topFromText);
|
|
77510
77528
|
}
|
|
77511
77529
|
if (floatingProps.bottomFromText !== void 0) {
|
|
77512
|
-
wrap2.distBottom = twipsToPx$
|
|
77530
|
+
wrap2.distBottom = twipsToPx$2(floatingProps.bottomFromText);
|
|
77513
77531
|
}
|
|
77514
77532
|
if (floatingProps.leftFromText !== void 0) {
|
|
77515
|
-
wrap2.distLeft = twipsToPx$
|
|
77533
|
+
wrap2.distLeft = twipsToPx$2(floatingProps.leftFromText);
|
|
77516
77534
|
}
|
|
77517
77535
|
if (floatingProps.rightFromText !== void 0) {
|
|
77518
|
-
wrap2.distRight = twipsToPx$
|
|
77536
|
+
wrap2.distRight = twipsToPx$2(floatingProps.rightFromText);
|
|
77519
77537
|
}
|
|
77520
77538
|
}
|
|
77521
77539
|
return { anchor, wrap: wrap2 };
|
|
@@ -81246,20 +81264,6 @@ ${l}
|
|
|
81246
81264
|
}
|
|
81247
81265
|
const cellBlocks = cell2?.blocks ?? (cell2?.paragraph ? [cell2.paragraph] : []);
|
|
81248
81266
|
const blockMeasures = cellMeasure?.blocks ?? (cellMeasure?.paragraph ? [cellMeasure.paragraph] : []);
|
|
81249
|
-
try {
|
|
81250
|
-
console.log(
|
|
81251
|
-
"[DomPainter.renderTableCell] cell render input",
|
|
81252
|
-
JSON.stringify({
|
|
81253
|
-
cellId: cell2?.id,
|
|
81254
|
-
blockKinds: cellBlocks.map((b2) => b2.kind),
|
|
81255
|
-
measureKinds: blockMeasures.map((m2) => m2.kind),
|
|
81256
|
-
width: cellMeasure?.width,
|
|
81257
|
-
height: cellMeasure?.height,
|
|
81258
|
-
rowHeight
|
|
81259
|
-
})
|
|
81260
|
-
);
|
|
81261
|
-
} catch {
|
|
81262
|
-
}
|
|
81263
81267
|
if (cellBlocks.length > 0 && blockMeasures.length > 0) {
|
|
81264
81268
|
const content2 = doc2.createElement("div");
|
|
81265
81269
|
content2.style.position = "relative";
|
|
@@ -81292,15 +81296,6 @@ ${l}
|
|
|
81292
81296
|
const blockMeasure = blockMeasures[i2];
|
|
81293
81297
|
const block = cellBlocks[i2];
|
|
81294
81298
|
if (blockMeasure.kind === "image" && block?.kind === "image") {
|
|
81295
|
-
console.log(
|
|
81296
|
-
"[DomPainter.renderTableCell] rendering image block in cell",
|
|
81297
|
-
JSON.stringify({
|
|
81298
|
-
cellId: cell2?.id,
|
|
81299
|
-
blockId: block.id,
|
|
81300
|
-
width: blockMeasure.width,
|
|
81301
|
-
height: blockMeasure.height
|
|
81302
|
-
})
|
|
81303
|
-
);
|
|
81304
81299
|
const imageWrapper = doc2.createElement("div");
|
|
81305
81300
|
imageWrapper.style.position = "relative";
|
|
81306
81301
|
imageWrapper.style.width = `${blockMeasure.width}px`;
|
|
@@ -81323,16 +81318,6 @@ ${l}
|
|
|
81323
81318
|
continue;
|
|
81324
81319
|
}
|
|
81325
81320
|
if (blockMeasure.kind === "drawing" && block?.kind === "drawing") {
|
|
81326
|
-
console.log(
|
|
81327
|
-
"[DomPainter.renderTableCell] rendering drawing block in cell",
|
|
81328
|
-
JSON.stringify({
|
|
81329
|
-
cellId: cell2?.id,
|
|
81330
|
-
blockId: block.id,
|
|
81331
|
-
drawingKind: block.drawingKind,
|
|
81332
|
-
width: blockMeasure.width,
|
|
81333
|
-
height: blockMeasure.height
|
|
81334
|
-
})
|
|
81335
|
-
);
|
|
81336
81321
|
const drawingWrapper = doc2.createElement("div");
|
|
81337
81322
|
drawingWrapper.style.position = "relative";
|
|
81338
81323
|
drawingWrapper.style.width = `${blockMeasure.width}px`;
|
|
@@ -81375,20 +81360,6 @@ ${l}
|
|
|
81375
81360
|
continue;
|
|
81376
81361
|
}
|
|
81377
81362
|
if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
|
|
81378
|
-
try {
|
|
81379
|
-
const runKinds = (block.runs ?? []).map((r2) => r2.kind ?? "text");
|
|
81380
|
-
const imageRuns = (block.runs ?? []).filter((r2) => r2.kind === "image").map((r2) => ({ src: r2.src }));
|
|
81381
|
-
console.log(
|
|
81382
|
-
"[DomPainter.renderTableCell] rendering paragraph block in cell",
|
|
81383
|
-
JSON.stringify({
|
|
81384
|
-
cellId: cell2?.id,
|
|
81385
|
-
blockId: block.id,
|
|
81386
|
-
runKinds,
|
|
81387
|
-
imageRuns
|
|
81388
|
-
})
|
|
81389
|
-
);
|
|
81390
|
-
} catch {
|
|
81391
|
-
}
|
|
81392
81363
|
const paragraphMeasure = blockMeasure;
|
|
81393
81364
|
const lines = paragraphMeasure.lines;
|
|
81394
81365
|
const blockLineCount = lines?.length || 0;
|
|
@@ -83203,7 +83174,9 @@ ${l}
|
|
|
83203
83174
|
const isTocEntry = block.attrs?.isTocEntry;
|
|
83204
83175
|
const hasMarker = !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
|
|
83205
83176
|
const hasSdtContainer = block.attrs?.sdt?.type === "documentSection" || block.attrs?.sdt?.type === "structuredContent" || block.attrs?.containerSdt?.type === "documentSection" || block.attrs?.containerSdt?.type === "structuredContent";
|
|
83206
|
-
const
|
|
83177
|
+
const paraIndentForOverflow = block.attrs?.indent;
|
|
83178
|
+
const hasNegativeIndent = (paraIndentForOverflow?.left ?? 0) < 0 || (paraIndentForOverflow?.right ?? 0) < 0;
|
|
83179
|
+
const styles = isTocEntry ? { ...fragmentStyles, whiteSpace: "nowrap" } : hasMarker || hasSdtContainer || hasNegativeIndent ? { ...fragmentStyles, overflow: "visible" } : fragmentStyles;
|
|
83207
83180
|
applyStyles$2(fragmentEl, styles);
|
|
83208
83181
|
this.applyFragmentFrame(fragmentEl, fragment, context.section);
|
|
83209
83182
|
if (isTocEntry) {
|
|
@@ -83232,6 +83205,8 @@ ${l}
|
|
|
83232
83205
|
}
|
|
83233
83206
|
if (fragmentEl.style.paddingLeft) fragmentEl.style.removeProperty("padding-left");
|
|
83234
83207
|
if (fragmentEl.style.paddingRight) fragmentEl.style.removeProperty("padding-right");
|
|
83208
|
+
if (fragmentEl.style.marginLeft) fragmentEl.style.removeProperty("margin-left");
|
|
83209
|
+
if (fragmentEl.style.marginRight) fragmentEl.style.removeProperty("margin-right");
|
|
83235
83210
|
if (fragmentEl.style.textIndent) fragmentEl.style.removeProperty("text-indent");
|
|
83236
83211
|
const paraIndent = block.attrs?.indent;
|
|
83237
83212
|
const paraIndentLeft = paraIndent?.left ?? 0;
|
|
@@ -83260,16 +83235,22 @@ ${l}
|
|
|
83260
83235
|
if (!isListFirstLine) {
|
|
83261
83236
|
if (hasExplicitSegmentPositioning) {
|
|
83262
83237
|
if (isFirstLine && firstLineOffset !== 0) {
|
|
83263
|
-
const
|
|
83264
|
-
|
|
83238
|
+
const effectiveLeftIndent = paraIndentLeft < 0 ? 0 : paraIndentLeft;
|
|
83239
|
+
const adjustedPadding = effectiveLeftIndent + firstLineOffset;
|
|
83240
|
+
if (adjustedPadding > 0) {
|
|
83241
|
+
lineEl.style.paddingLeft = `${adjustedPadding}px`;
|
|
83242
|
+
}
|
|
83265
83243
|
}
|
|
83266
|
-
} else if (paraIndentLeft) {
|
|
83244
|
+
} else if (paraIndentLeft && paraIndentLeft > 0) {
|
|
83267
83245
|
lineEl.style.paddingLeft = `${paraIndentLeft}px`;
|
|
83246
|
+
} else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0) {
|
|
83247
|
+
lineEl.style.paddingLeft = `${paraIndent.hanging}px`;
|
|
83268
83248
|
}
|
|
83269
83249
|
}
|
|
83270
|
-
if (paraIndentRight) {
|
|
83250
|
+
if (paraIndentRight && paraIndentRight > 0) {
|
|
83271
83251
|
lineEl.style.paddingRight = `${paraIndentRight}px`;
|
|
83272
83252
|
}
|
|
83253
|
+
const hasNegativeLeftIndent = paraIndentLeft != null && paraIndentLeft < 0;
|
|
83273
83254
|
if (!fragment.continuesFromPrev && index2 === 0 && firstLineOffset && !isListFirstLine) {
|
|
83274
83255
|
if (!hasExplicitSegmentPositioning) {
|
|
83275
83256
|
lineEl.style.textIndent = `${firstLineOffset}px`;
|
|
@@ -84688,7 +84669,7 @@ ${l}
|
|
|
84688
84669
|
}
|
|
84689
84670
|
const runsForLine = sliceRunsForLine(block, line);
|
|
84690
84671
|
const trackedConfig = this.resolveTrackedChangesConfig(block);
|
|
84691
|
-
|
|
84672
|
+
runsForLine.length > 0 ? runsForLine.filter((r2) => (r2.kind === "text" || r2.kind === void 0) && "text" in r2 && r2.text != null).map((r2) => r2.text) : gatherTextSlicesForLine(block, line);
|
|
84692
84673
|
if (runsForLine.length === 0) {
|
|
84693
84674
|
const span = this.doc.createElement("span");
|
|
84694
84675
|
span.innerHTML = " ";
|
|
@@ -84735,19 +84716,7 @@ ${l}
|
|
|
84735
84716
|
});
|
|
84736
84717
|
}
|
|
84737
84718
|
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
84738
|
-
|
|
84739
|
-
const shouldJustify = !skipJustify && effectiveAlignment === "justify" && !hasExplicitPositioning;
|
|
84740
|
-
if (shouldJustify) {
|
|
84741
|
-
const spaceCount = textSlices.reduce(
|
|
84742
|
-
(sum, s2) => sum + Array.from(s2).filter((ch) => ch === " " || ch === " ").length,
|
|
84743
|
-
0
|
|
84744
|
-
);
|
|
84745
|
-
const slack = availableWidth - line.width;
|
|
84746
|
-
if (spaceCount > 0 && slack !== 0) {
|
|
84747
|
-
const spacingPerSpace = slack / spaceCount;
|
|
84748
|
-
el.style.wordSpacing = `${spacingPerSpace}px`;
|
|
84749
|
-
}
|
|
84750
|
-
}
|
|
84719
|
+
availableWidthOverride ?? line.maxWidth ?? line.width;
|
|
84751
84720
|
if (hasExplicitPositioning && line.segments) {
|
|
84752
84721
|
const paraIndent = block.attrs?.indent;
|
|
84753
84722
|
const indentLeft = paraIndent?.left ?? 0;
|
|
@@ -85566,15 +85535,18 @@ ${l}
|
|
|
85566
85535
|
}
|
|
85567
85536
|
const indent2 = attrs.indent;
|
|
85568
85537
|
if (indent2) {
|
|
85569
|
-
if (indent2.left) {
|
|
85538
|
+
if (indent2.left && indent2.left > 0) {
|
|
85570
85539
|
element2.style.paddingLeft = `${indent2.left}px`;
|
|
85571
85540
|
}
|
|
85572
|
-
if (indent2.right) {
|
|
85541
|
+
if (indent2.right && indent2.right > 0) {
|
|
85573
85542
|
element2.style.paddingRight = `${indent2.right}px`;
|
|
85574
85543
|
}
|
|
85575
|
-
const
|
|
85576
|
-
if (
|
|
85577
|
-
|
|
85544
|
+
const hasNegativeLeftIndent = indent2.left != null && indent2.left < 0;
|
|
85545
|
+
if (!hasNegativeLeftIndent) {
|
|
85546
|
+
const textIndent = (indent2.firstLine ?? 0) - (indent2.hanging ?? 0);
|
|
85547
|
+
if (textIndent) {
|
|
85548
|
+
element2.style.textIndent = `${textIndent}px`;
|
|
85549
|
+
}
|
|
85578
85550
|
}
|
|
85579
85551
|
}
|
|
85580
85552
|
applyParagraphBorderStyles(element2, attrs.borders);
|
|
@@ -86936,20 +86908,6 @@ ${l}
|
|
|
86936
86908
|
}
|
|
86937
86909
|
return value;
|
|
86938
86910
|
};
|
|
86939
|
-
function calculateFirstLineIndent(block, measure) {
|
|
86940
|
-
const wordLayout = block.attrs?.wordLayout;
|
|
86941
|
-
if (!wordLayout?.firstLineIndentMode) {
|
|
86942
|
-
return 0;
|
|
86943
|
-
}
|
|
86944
|
-
if (!wordLayout.marker || !measure.marker) {
|
|
86945
|
-
return 0;
|
|
86946
|
-
}
|
|
86947
|
-
const markerWidthRaw = measure.marker.markerWidth ?? wordLayout.marker.markerBoxWidthPx ?? 0;
|
|
86948
|
-
const markerWidth = Number.isFinite(markerWidthRaw) && markerWidthRaw >= 0 ? markerWidthRaw : 0;
|
|
86949
|
-
const gutterWidthRaw = measure.marker.gutterWidth ?? 0;
|
|
86950
|
-
const gutterWidth = Number.isFinite(gutterWidthRaw) && gutterWidthRaw >= 0 ? gutterWidthRaw : 0;
|
|
86951
|
-
return markerWidth + gutterWidth;
|
|
86952
|
-
}
|
|
86953
86911
|
function layoutParagraphBlock(ctx2, anchors) {
|
|
86954
86912
|
const { block, measure, columnWidth, ensurePage, advanceColumn, columnX, floatManager } = ctx2;
|
|
86955
86913
|
const remeasureParagraph2 = ctx2.remeasureParagraph;
|
|
@@ -87071,10 +87029,25 @@ ${l}
|
|
|
87071
87029
|
}
|
|
87072
87030
|
let lines = normalizeLines(measure);
|
|
87073
87031
|
const measurementWidth = lines[0]?.maxWidth;
|
|
87032
|
+
const paraIndent = block.attrs?.indent;
|
|
87033
|
+
const indentLeft = typeof paraIndent?.left === "number" && Number.isFinite(paraIndent.left) ? paraIndent.left : 0;
|
|
87034
|
+
const indentRight = typeof paraIndent?.right === "number" && Number.isFinite(paraIndent.right) ? paraIndent.right : 0;
|
|
87035
|
+
const negativeLeftIndent = indentLeft < 0 ? indentLeft : 0;
|
|
87036
|
+
const negativeRightIndent = indentRight < 0 ? indentRight : 0;
|
|
87037
|
+
const remeasureWidth = Math.max(1, columnWidth - indentLeft - indentRight);
|
|
87074
87038
|
let didRemeasureForColumnWidth = false;
|
|
87075
|
-
if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth >
|
|
87076
|
-
|
|
87077
|
-
const
|
|
87039
|
+
if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > remeasureWidth) {
|
|
87040
|
+
let firstLineIndent = 0;
|
|
87041
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
87042
|
+
if (wordLayout?.marker && measure.marker) {
|
|
87043
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
87044
|
+
if (markerJustification === "left") {
|
|
87045
|
+
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
87046
|
+
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
87047
|
+
firstLineIndent = markerWidth + gutterWidth;
|
|
87048
|
+
}
|
|
87049
|
+
}
|
|
87050
|
+
const newMeasure = remeasureParagraph2(block, remeasureWidth, firstLineIndent);
|
|
87078
87051
|
lines = normalizeLines(newMeasure);
|
|
87079
87052
|
didRemeasureForColumnWidth = true;
|
|
87080
87053
|
}
|
|
@@ -87153,9 +87126,19 @@ ${l}
|
|
|
87153
87126
|
}
|
|
87154
87127
|
tempY += lineHeight2;
|
|
87155
87128
|
}
|
|
87156
|
-
|
|
87157
|
-
|
|
87158
|
-
|
|
87129
|
+
const narrowestRemeasureWidth = Math.max(1, narrowestWidth - indentLeft - indentRight);
|
|
87130
|
+
if (narrowestRemeasureWidth < remeasureWidth) {
|
|
87131
|
+
let firstLineIndent = 0;
|
|
87132
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
87133
|
+
if (wordLayout?.marker && measure.marker) {
|
|
87134
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
87135
|
+
if (markerJustification === "left") {
|
|
87136
|
+
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
87137
|
+
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
87138
|
+
firstLineIndent = markerWidth + gutterWidth;
|
|
87139
|
+
}
|
|
87140
|
+
}
|
|
87141
|
+
const newMeasure = remeasureParagraph2(block, narrowestRemeasureWidth, firstLineIndent);
|
|
87159
87142
|
lines = normalizeLines(newMeasure);
|
|
87160
87143
|
didRemeasureForFloats = true;
|
|
87161
87144
|
}
|
|
@@ -87209,14 +87192,16 @@ ${l}
|
|
|
87209
87192
|
}
|
|
87210
87193
|
const slice2 = sliceLines(lines, fromLine, state2.contentBottom - state2.cursorY);
|
|
87211
87194
|
const fragmentHeight = slice2.height;
|
|
87195
|
+
const adjustedX = columnX(state2.columnIndex) + offsetX + negativeLeftIndent;
|
|
87196
|
+
const adjustedWidth = effectiveColumnWidth - negativeLeftIndent - negativeRightIndent;
|
|
87212
87197
|
const fragment = {
|
|
87213
87198
|
kind: "para",
|
|
87214
87199
|
blockId: block.id,
|
|
87215
87200
|
fromLine,
|
|
87216
87201
|
toLine: slice2.toLine,
|
|
87217
|
-
x:
|
|
87202
|
+
x: adjustedX,
|
|
87218
87203
|
y: state2.cursorY,
|
|
87219
|
-
width:
|
|
87204
|
+
width: adjustedWidth,
|
|
87220
87205
|
...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
|
|
87221
87206
|
};
|
|
87222
87207
|
if (didRemeasureForColumnWidth) {
|
|
@@ -90069,7 +90054,13 @@ ${l}
|
|
|
90069
90054
|
return ctx$2;
|
|
90070
90055
|
}
|
|
90071
90056
|
function isTextRun(run2) {
|
|
90072
|
-
|
|
90057
|
+
if (run2.kind === "tab" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation") {
|
|
90058
|
+
return false;
|
|
90059
|
+
}
|
|
90060
|
+
if ("src" in run2) {
|
|
90061
|
+
return false;
|
|
90062
|
+
}
|
|
90063
|
+
return true;
|
|
90073
90064
|
}
|
|
90074
90065
|
function fontString(run2) {
|
|
90075
90066
|
const textRun = isTextRun(run2) ? run2 : null;
|
|
@@ -90082,6 +90073,42 @@ ${l}
|
|
|
90082
90073
|
function runText(run2) {
|
|
90083
90074
|
return "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" ? "" : run2.text ?? "";
|
|
90084
90075
|
}
|
|
90076
|
+
const DEFAULT_TAB_INTERVAL_TWIPS$1 = 720;
|
|
90077
|
+
const TWIPS_PER_INCH$1 = 1440;
|
|
90078
|
+
const PX_PER_INCH$1 = 96;
|
|
90079
|
+
const TWIPS_PER_PX$1 = TWIPS_PER_INCH$1 / PX_PER_INCH$1;
|
|
90080
|
+
const TAB_EPSILON$1 = 0.1;
|
|
90081
|
+
const WIDTH_FUDGE_PX = 0.5;
|
|
90082
|
+
const twipsToPx$1 = (twips) => twips / TWIPS_PER_PX$1;
|
|
90083
|
+
const pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1);
|
|
90084
|
+
const buildTabStopsPx$1 = (indent2, tabs, tabIntervalTwips) => {
|
|
90085
|
+
const paragraphIndentTwips = {
|
|
90086
|
+
left: pxToTwips$1(Math.max(0, indent2?.left ?? 0)),
|
|
90087
|
+
right: pxToTwips$1(Math.max(0, indent2?.right ?? 0)),
|
|
90088
|
+
firstLine: pxToTwips$1(Math.max(0, indent2?.firstLine ?? 0)),
|
|
90089
|
+
hanging: pxToTwips$1(Math.max(0, indent2?.hanging ?? 0))
|
|
90090
|
+
};
|
|
90091
|
+
const stops = computeTabStops$1({
|
|
90092
|
+
explicitStops: tabs ?? [],
|
|
90093
|
+
defaultTabInterval: tabIntervalTwips ?? DEFAULT_TAB_INTERVAL_TWIPS$1,
|
|
90094
|
+
paragraphIndent: paragraphIndentTwips
|
|
90095
|
+
});
|
|
90096
|
+
return stops.map((stop) => ({
|
|
90097
|
+
pos: twipsToPx$1(stop.pos),
|
|
90098
|
+
val: stop.val,
|
|
90099
|
+
leader: stop.leader
|
|
90100
|
+
}));
|
|
90101
|
+
};
|
|
90102
|
+
const getNextTabStopPx$1 = (currentX, tabStops, startIndex) => {
|
|
90103
|
+
let index2 = startIndex;
|
|
90104
|
+
while (index2 < tabStops.length && tabStops[index2].pos <= currentX + TAB_EPSILON$1) {
|
|
90105
|
+
index2 += 1;
|
|
90106
|
+
}
|
|
90107
|
+
if (index2 < tabStops.length) {
|
|
90108
|
+
return { target: tabStops[index2].pos, nextIndex: index2 + 1 };
|
|
90109
|
+
}
|
|
90110
|
+
return { target: currentX + twipsToPx$1(DEFAULT_TAB_INTERVAL_TWIPS$1), nextIndex: index2 };
|
|
90111
|
+
};
|
|
90085
90112
|
function measureRunSliceWidth(run2, fromChar, toChar) {
|
|
90086
90113
|
const context = getCtx();
|
|
90087
90114
|
const text2 = runText(run2).slice(fromChar, toChar);
|
|
@@ -90105,13 +90132,38 @@ ${l}
|
|
|
90105
90132
|
return maxSize2 * 1.2;
|
|
90106
90133
|
}
|
|
90107
90134
|
function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
90135
|
+
if (!Number.isFinite(maxWidth) || maxWidth <= 0) {
|
|
90136
|
+
throw new Error(`remeasureParagraph: maxWidth must be a positive number, got ${maxWidth}`);
|
|
90137
|
+
}
|
|
90138
|
+
if (!Number.isFinite(firstLineIndent)) {
|
|
90139
|
+
throw new Error(`remeasureParagraph: firstLineIndent must be a finite number, got ${firstLineIndent}`);
|
|
90140
|
+
}
|
|
90141
|
+
if (!block) {
|
|
90142
|
+
throw new Error("remeasureParagraph: block must be defined");
|
|
90143
|
+
}
|
|
90144
|
+
if (!Array.isArray(block.runs)) {
|
|
90145
|
+
throw new Error(`remeasureParagraph: block.runs must be an array, got ${typeof block.runs}`);
|
|
90146
|
+
}
|
|
90108
90147
|
const runs2 = block.runs ?? [];
|
|
90109
90148
|
const lines = [];
|
|
90149
|
+
const attrs = block.attrs;
|
|
90150
|
+
const indent2 = attrs?.indent;
|
|
90151
|
+
const wordLayout = attrs?.wordLayout;
|
|
90152
|
+
const indentLeft = Math.max(0, indent2?.left ?? 0);
|
|
90153
|
+
const indentRight = Math.max(0, indent2?.right ?? 0);
|
|
90154
|
+
const indentFirstLine = Math.max(0, indent2?.firstLine ?? 0);
|
|
90155
|
+
const indentHanging = Math.max(0, indent2?.hanging ?? 0);
|
|
90156
|
+
const rawFirstLineOffset = Math.max(0, firstLineIndent || indentFirstLine - indentHanging);
|
|
90157
|
+
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
90158
|
+
const textStartPx = wordLayout?.textStartPx;
|
|
90159
|
+
const treatAsHanging = textStartPx && indentLeft === 0 && indentHanging === 0;
|
|
90160
|
+
const firstLineWidth = typeof textStartPx === "number" && textStartPx > indentLeft && !treatAsHanging ? Math.max(1, maxWidth - textStartPx - indentRight) : Math.max(1, contentWidth - rawFirstLineOffset);
|
|
90161
|
+
const tabStops = buildTabStopsPx$1(indent2, attrs?.tabs, attrs?.tabIntervalTwips);
|
|
90110
90162
|
let currentRun = 0;
|
|
90111
90163
|
let currentChar = 0;
|
|
90112
90164
|
while (currentRun < runs2.length) {
|
|
90113
90165
|
const isFirstLine = lines.length === 0;
|
|
90114
|
-
const effectiveMaxWidth = isFirstLine ?
|
|
90166
|
+
const effectiveMaxWidth = Math.max(1, isFirstLine ? firstLineWidth : contentWidth);
|
|
90115
90167
|
const startRun = currentRun;
|
|
90116
90168
|
const startChar = currentChar;
|
|
90117
90169
|
let width = 0;
|
|
@@ -90119,13 +90171,26 @@ ${l}
|
|
|
90119
90171
|
let lastBreakChar = -1;
|
|
90120
90172
|
let endRun = currentRun;
|
|
90121
90173
|
let endChar = currentChar;
|
|
90174
|
+
let tabStopCursor = 0;
|
|
90175
|
+
let didBreakInThisLine = false;
|
|
90122
90176
|
for (let r2 = currentRun; r2 < runs2.length; r2 += 1) {
|
|
90123
90177
|
const run2 = runs2[r2];
|
|
90178
|
+
if (run2.kind === "tab") {
|
|
90179
|
+
const { target, nextIndex } = getNextTabStopPx$1(width, tabStops, tabStopCursor);
|
|
90180
|
+
const tabAdvance = Math.max(0, target - width);
|
|
90181
|
+
width += tabAdvance;
|
|
90182
|
+
tabStopCursor = nextIndex;
|
|
90183
|
+
endRun = r2;
|
|
90184
|
+
endChar = 1;
|
|
90185
|
+
lastBreakRun = r2;
|
|
90186
|
+
lastBreakChar = 1;
|
|
90187
|
+
continue;
|
|
90188
|
+
}
|
|
90124
90189
|
const text2 = runText(run2);
|
|
90125
90190
|
const start2 = r2 === currentRun ? currentChar : 0;
|
|
90126
90191
|
for (let c2 = start2; c2 < text2.length; c2 += 1) {
|
|
90127
90192
|
const w2 = measureRunSliceWidth(run2, c2, c2 + 1);
|
|
90128
|
-
if (width + w2 > effectiveMaxWidth && width > 0) {
|
|
90193
|
+
if (width + w2 > effectiveMaxWidth - WIDTH_FUDGE_PX && width > 0) {
|
|
90129
90194
|
if (lastBreakRun >= 0) {
|
|
90130
90195
|
endRun = lastBreakRun;
|
|
90131
90196
|
endChar = lastBreakChar;
|
|
@@ -90133,6 +90198,7 @@ ${l}
|
|
|
90133
90198
|
endRun = r2;
|
|
90134
90199
|
endChar = c2;
|
|
90135
90200
|
}
|
|
90201
|
+
didBreakInThisLine = true;
|
|
90136
90202
|
break;
|
|
90137
90203
|
}
|
|
90138
90204
|
width += w2;
|
|
@@ -90144,9 +90210,7 @@ ${l}
|
|
|
90144
90210
|
lastBreakChar = c2 + 1;
|
|
90145
90211
|
}
|
|
90146
90212
|
}
|
|
90147
|
-
if (
|
|
90148
|
-
break;
|
|
90149
|
-
}
|
|
90213
|
+
if (didBreakInThisLine) break;
|
|
90150
90214
|
}
|
|
90151
90215
|
if (startRun === endRun && startChar === endChar) {
|
|
90152
90216
|
endRun = startRun;
|
|
@@ -90160,11 +90224,15 @@ ${l}
|
|
|
90160
90224
|
width,
|
|
90161
90225
|
ascent: 0,
|
|
90162
90226
|
descent: 0,
|
|
90163
|
-
lineHeight: lineHeightForRuns(runs2, startRun, endRun)
|
|
90227
|
+
lineHeight: lineHeightForRuns(runs2, startRun, endRun),
|
|
90228
|
+
maxWidth: effectiveMaxWidth
|
|
90164
90229
|
};
|
|
90165
90230
|
lines.push(line);
|
|
90166
90231
|
currentRun = endRun;
|
|
90167
90232
|
currentChar = endChar;
|
|
90233
|
+
if (currentRun >= runs2.length) {
|
|
90234
|
+
break;
|
|
90235
|
+
}
|
|
90168
90236
|
if (currentChar >= runText(runs2[currentRun]).length) {
|
|
90169
90237
|
currentRun += 1;
|
|
90170
90238
|
currentChar = 0;
|
|
@@ -90841,9 +90909,15 @@ ${l}
|
|
|
90841
90909
|
}
|
|
90842
90910
|
const DEFAULT_PAGE_SIZE$1 = { w: 612, h: 792 };
|
|
90843
90911
|
const DEFAULT_MARGINS$1 = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
90912
|
+
const normalizeMargin = (value, fallback) => Number.isFinite(value) ? value : fallback;
|
|
90844
90913
|
function resolveMeasurementConstraints(options) {
|
|
90845
90914
|
const pageSize = options.pageSize ?? DEFAULT_PAGE_SIZE$1;
|
|
90846
|
-
const margins =
|
|
90915
|
+
const margins = {
|
|
90916
|
+
top: normalizeMargin(options.margins?.top, DEFAULT_MARGINS$1.top),
|
|
90917
|
+
right: normalizeMargin(options.margins?.right, DEFAULT_MARGINS$1.right),
|
|
90918
|
+
bottom: normalizeMargin(options.margins?.bottom, DEFAULT_MARGINS$1.bottom),
|
|
90919
|
+
left: normalizeMargin(options.margins?.left, DEFAULT_MARGINS$1.left)
|
|
90920
|
+
};
|
|
90847
90921
|
const contentWidth = pageSize.w - (margins.left + margins.right);
|
|
90848
90922
|
const contentHeight = pageSize.h - (margins.top + margins.bottom);
|
|
90849
90923
|
const columns = options.columns;
|
|
@@ -92377,12 +92451,12 @@ ${l}
|
|
|
92377
92451
|
async function measureParagraphBlock(block, maxWidth) {
|
|
92378
92452
|
const ctx2 = getCanvasContext();
|
|
92379
92453
|
const wordLayout = block.attrs?.wordLayout;
|
|
92380
|
-
const
|
|
92454
|
+
const WIDTH_FUDGE_PX2 = 0.5;
|
|
92381
92455
|
const lines = [];
|
|
92382
92456
|
const indent2 = block.attrs?.indent;
|
|
92383
92457
|
const spacing = block.attrs?.spacing;
|
|
92384
|
-
const indentLeft =
|
|
92385
|
-
const indentRight =
|
|
92458
|
+
const indentLeft = sanitizeIndent(indent2?.left);
|
|
92459
|
+
const indentRight = sanitizeIndent(indent2?.right);
|
|
92386
92460
|
const firstLine = indent2?.firstLine ?? 0;
|
|
92387
92461
|
const hanging = indent2?.hanging ?? 0;
|
|
92388
92462
|
const isWordLayoutList = Boolean(wordLayout?.marker);
|
|
@@ -92391,6 +92465,7 @@ ${l}
|
|
|
92391
92465
|
const clampedFirstLineOffset = Math.max(0, rawFirstLineOffset);
|
|
92392
92466
|
const firstLineOffset = isWordLayoutList ? 0 : clampedFirstLineOffset;
|
|
92393
92467
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
92468
|
+
const bodyContentWidth = contentWidth;
|
|
92394
92469
|
let initialAvailableWidth;
|
|
92395
92470
|
const textStartPx = wordLayout?.textStartPx;
|
|
92396
92471
|
if (typeof textStartPx === "number" && textStartPx > indentLeft) {
|
|
@@ -92585,7 +92660,7 @@ ${l}
|
|
|
92585
92660
|
lines.push(emptyLine);
|
|
92586
92661
|
}
|
|
92587
92662
|
const hadPreviousLine = lines.length > 0;
|
|
92588
|
-
const nextLineMaxWidth = hadPreviousLine ? getEffectiveWidth(
|
|
92663
|
+
const nextLineMaxWidth = hadPreviousLine ? getEffectiveWidth(bodyContentWidth) : getEffectiveWidth(initialAvailableWidth);
|
|
92589
92664
|
currentLine = {
|
|
92590
92665
|
fromRun: runIndex,
|
|
92591
92666
|
fromChar: 0,
|
|
@@ -92696,7 +92771,7 @@ ${l}
|
|
|
92696
92771
|
toChar: 1,
|
|
92697
92772
|
width: imageWidth,
|
|
92698
92773
|
maxFontSize: imageHeight,
|
|
92699
|
-
maxWidth: getEffectiveWidth(
|
|
92774
|
+
maxWidth: getEffectiveWidth(bodyContentWidth),
|
|
92700
92775
|
spaceCount: 0,
|
|
92701
92776
|
segments: [
|
|
92702
92777
|
{
|
|
@@ -92785,7 +92860,7 @@ ${l}
|
|
|
92785
92860
|
toChar: 1,
|
|
92786
92861
|
width: annotationWidth,
|
|
92787
92862
|
maxFontSize: annotationHeight,
|
|
92788
|
-
maxWidth: getEffectiveWidth(
|
|
92863
|
+
maxWidth: getEffectiveWidth(bodyContentWidth),
|
|
92789
92864
|
spaceCount: 0,
|
|
92790
92865
|
segments: [
|
|
92791
92866
|
{
|
|
@@ -92847,7 +92922,7 @@ ${l}
|
|
|
92847
92922
|
};
|
|
92848
92923
|
} else {
|
|
92849
92924
|
const boundarySpacing = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
|
|
92850
|
-
if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth -
|
|
92925
|
+
if (currentLine.width + boundarySpacing + spacesWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
|
|
92851
92926
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92852
92927
|
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92853
92928
|
const completedLine = {
|
|
@@ -92867,7 +92942,7 @@ ${l}
|
|
|
92867
92942
|
width: spacesWidth,
|
|
92868
92943
|
maxFontSize: run2.fontSize,
|
|
92869
92944
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
92870
|
-
maxWidth: getEffectiveWidth(
|
|
92945
|
+
maxWidth: getEffectiveWidth(bodyContentWidth),
|
|
92871
92946
|
segments: [{ runIndex, fromChar: spacesStartChar, toChar: spacesEndChar, width: spacesWidth }],
|
|
92872
92947
|
spaceCount: spacesLength
|
|
92873
92948
|
};
|
|
@@ -92913,7 +92988,7 @@ ${l}
|
|
|
92913
92988
|
};
|
|
92914
92989
|
} else {
|
|
92915
92990
|
const boundarySpacing2 = currentLine.width > 0 ? run2.letterSpacing ?? 0 : 0;
|
|
92916
|
-
if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth -
|
|
92991
|
+
if (currentLine.width + boundarySpacing2 + singleSpaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2 && currentLine.width > 0) {
|
|
92917
92992
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
92918
92993
|
const { spaceCount: _sc, ...lineBase } = currentLine;
|
|
92919
92994
|
const completedLine = { ...lineBase, ...metrics };
|
|
@@ -92930,7 +93005,7 @@ ${l}
|
|
|
92930
93005
|
width: singleSpaceWidth,
|
|
92931
93006
|
maxFontSize: run2.fontSize,
|
|
92932
93007
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
92933
|
-
maxWidth: getEffectiveWidth(
|
|
93008
|
+
maxWidth: getEffectiveWidth(bodyContentWidth),
|
|
92934
93009
|
segments: [{ runIndex, fromChar: spaceStartChar, toChar: spaceEndChar, width: singleSpaceWidth }],
|
|
92935
93010
|
spaceCount: 1
|
|
92936
93011
|
};
|
|
@@ -92971,7 +93046,7 @@ ${l}
|
|
|
92971
93046
|
const hasTabOnlyLine = currentLine && currentLine.segments.length === 0 && currentLine.width > 0;
|
|
92972
93047
|
const remainingWidthAfterTab = hasTabOnlyLine ? currentLine.maxWidth - currentLine.width : lineMaxWidth;
|
|
92973
93048
|
const chunkWidth = hasTabOnlyLine ? Math.max(remainingWidthAfterTab, lineMaxWidth * 0.25) : lineMaxWidth;
|
|
92974
|
-
const chunks = breakWordIntoChunks(word, chunkWidth -
|
|
93049
|
+
const chunks = breakWordIntoChunks(word, chunkWidth - WIDTH_FUDGE_PX2, font, ctx2, run2);
|
|
92975
93050
|
let chunkCharOffset = wordStartChar;
|
|
92976
93051
|
for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
|
|
92977
93052
|
const chunk = chunks[chunkIndex];
|
|
@@ -92993,7 +93068,7 @@ ${l}
|
|
|
92993
93068
|
});
|
|
92994
93069
|
if (isLastChunk) {
|
|
92995
93070
|
const ls = run2.letterSpacing ?? 0;
|
|
92996
|
-
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth -
|
|
93071
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
92997
93072
|
currentLine.toChar = wordEndWithSpace;
|
|
92998
93073
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
92999
93074
|
charPosInRun = wordEndWithSpace;
|
|
@@ -93025,7 +93100,7 @@ ${l}
|
|
|
93025
93100
|
spaceCount: 0
|
|
93026
93101
|
};
|
|
93027
93102
|
const ls = run2.letterSpacing ?? 0;
|
|
93028
|
-
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth -
|
|
93103
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
93029
93104
|
currentLine.toChar = wordEndWithSpace;
|
|
93030
93105
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
93031
93106
|
charPosInRun = wordEndWithSpace;
|
|
@@ -93067,7 +93142,7 @@ ${l}
|
|
|
93067
93142
|
spaceCount: 0
|
|
93068
93143
|
};
|
|
93069
93144
|
const ls = run2.letterSpacing ?? 0;
|
|
93070
|
-
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth -
|
|
93145
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
93071
93146
|
currentLine.toChar = wordEndWithSpace;
|
|
93072
93147
|
currentLine.width = roundValue(currentLine.width + spaceWidth + ls);
|
|
93073
93148
|
charPosInRun = wordEndWithSpace;
|
|
@@ -93082,7 +93157,7 @@ ${l}
|
|
|
93082
93157
|
const justifyAlignment = block.attrs?.alignment === "justify";
|
|
93083
93158
|
const totalWidthWithWord = currentLine.width + boundarySpacing + wordCommitWidth + // Safe cast: only TextRuns produce word segments from split(), other run types are handled earlier
|
|
93084
93159
|
(isLastWord ? 0 : run2.letterSpacing ?? 0);
|
|
93085
|
-
const availableWidth = currentLine.maxWidth -
|
|
93160
|
+
const availableWidth = currentLine.maxWidth - WIDTH_FUDGE_PX2;
|
|
93086
93161
|
let shouldBreak = currentLine.width + boundarySpacing + wordOnlyWidth > availableWidth && currentLine.width > 0 && !isTocEntry;
|
|
93087
93162
|
let compressedWidth = null;
|
|
93088
93163
|
if (shouldBreak && justifyAlignment) {
|
|
@@ -93123,11 +93198,11 @@ ${l}
|
|
|
93123
93198
|
width: wordOnlyWidth,
|
|
93124
93199
|
maxFontSize: run2.fontSize,
|
|
93125
93200
|
maxFontInfo: getFontInfoFromRun(run2),
|
|
93126
|
-
maxWidth: getEffectiveWidth(
|
|
93201
|
+
maxWidth: getEffectiveWidth(bodyContentWidth),
|
|
93127
93202
|
segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }],
|
|
93128
93203
|
spaceCount: 0
|
|
93129
93204
|
};
|
|
93130
|
-
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth -
|
|
93205
|
+
if (!isLastWord && currentLine.width + spaceWidth <= currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
93131
93206
|
currentLine.toChar = wordEndWithSpace;
|
|
93132
93207
|
currentLine.width = roundValue(currentLine.width + spaceWidth + (run2.letterSpacing ?? 0));
|
|
93133
93208
|
charPosInRun = wordEndWithSpace;
|
|
@@ -93137,7 +93212,7 @@ ${l}
|
|
|
93137
93212
|
}
|
|
93138
93213
|
} else {
|
|
93139
93214
|
currentLine.toRun = runIndex;
|
|
93140
|
-
if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth -
|
|
93215
|
+
if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX2) {
|
|
93141
93216
|
currentLine.toChar = wordEndNoSpace;
|
|
93142
93217
|
currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
|
|
93143
93218
|
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
@@ -93688,6 +93763,7 @@ ${l}
|
|
|
93688
93763
|
return Math.max(baseLineHeight, raw);
|
|
93689
93764
|
};
|
|
93690
93765
|
const sanitizePositive = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, value) : 0;
|
|
93766
|
+
const sanitizeIndent = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
93691
93767
|
const sanitizeDecimalSeparator = (value) => {
|
|
93692
93768
|
if (value === ",") return ",";
|
|
93693
93769
|
return DEFAULT_DECIMAL_SEPARATOR;
|
|
@@ -98236,6 +98312,10 @@ ${l}
|
|
|
98236
98312
|
const pageSize = firstSection?.pageSize ?? defaults2.pageSize;
|
|
98237
98313
|
const margins = {
|
|
98238
98314
|
...defaults2.margins,
|
|
98315
|
+
...firstSection?.margins?.top != null ? { top: firstSection.margins.top } : {},
|
|
98316
|
+
...firstSection?.margins?.right != null ? { right: firstSection.margins.right } : {},
|
|
98317
|
+
...firstSection?.margins?.bottom != null ? { bottom: firstSection.margins.bottom } : {},
|
|
98318
|
+
...firstSection?.margins?.left != null ? { left: firstSection.margins.left } : {},
|
|
98239
98319
|
...firstSection?.margins?.header != null ? { header: firstSection.margins.header } : {},
|
|
98240
98320
|
...firstSection?.margins?.footer != null ? { footer: firstSection.margins.footer } : {}
|
|
98241
98321
|
};
|
|
@@ -151985,7 +152065,7 @@ ${style2}
|
|
|
151985
152065
|
this.config.colors = shuffleArray(this.config.colors);
|
|
151986
152066
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
151987
152067
|
this.colorIndex = 0;
|
|
151988
|
-
this.version = "1.0.0-beta.
|
|
152068
|
+
this.version = "1.0.0-beta.98";
|
|
151989
152069
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
151990
152070
|
this.superdocId = config2.superdocId || v4();
|
|
151991
152071
|
this.colors = this.config.colors;
|
|
@@ -154457,7 +154537,7 @@ ${style2}
|
|
|
154457
154537
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
154458
154538
|
);
|
|
154459
154539
|
}
|
|
154460
|
-
const
|
|
154540
|
+
const indexDg_sTYZK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
154461
154541
|
__proto__: null,
|
|
154462
154542
|
unified
|
|
154463
154543
|
}, Symbol.toStringTag, { value: "Module" }));
|