@superdoc-dev/cli 0.5.0-next.27 → 0.5.0-next.29
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/index.js +742 -272
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -172583,7 +172583,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
172583
172583
|
init_remark_gfm_z_sDF4ss_es();
|
|
172584
172584
|
});
|
|
172585
172585
|
|
|
172586
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
172586
|
+
// ../../packages/superdoc/dist/chunks/src-C5K9vSFa.es.js
|
|
172587
172587
|
function deleteProps(obj, propOrProps) {
|
|
172588
172588
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
172589
172589
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -182573,6 +182573,69 @@ function resolveListTextStartPx(wordLayout, indentLeft, firstLine, hanging, meas
|
|
|
182573
182573
|
if (wordLayout?.firstLineIndentMode === true)
|
|
182574
182574
|
return getFiniteNumber(wordLayout.textStartPx);
|
|
182575
182575
|
}
|
|
182576
|
+
function isMinimalWordLayout(value) {
|
|
182577
|
+
if (typeof value !== "object" || value === null)
|
|
182578
|
+
return false;
|
|
182579
|
+
const obj = value;
|
|
182580
|
+
if (obj.marker !== undefined) {
|
|
182581
|
+
if (typeof obj.marker !== "object" || obj.marker === null)
|
|
182582
|
+
return false;
|
|
182583
|
+
const marker = obj.marker;
|
|
182584
|
+
if (marker.markerText !== undefined && typeof marker.markerText !== "string")
|
|
182585
|
+
return false;
|
|
182586
|
+
if (marker.markerX !== undefined && typeof marker.markerX !== "number")
|
|
182587
|
+
return false;
|
|
182588
|
+
if (marker.textStartX !== undefined && typeof marker.textStartX !== "number")
|
|
182589
|
+
return false;
|
|
182590
|
+
}
|
|
182591
|
+
if (obj.indentLeftPx !== undefined) {
|
|
182592
|
+
if (typeof obj.indentLeftPx !== "number")
|
|
182593
|
+
return false;
|
|
182594
|
+
}
|
|
182595
|
+
if (obj.firstLineIndentMode !== undefined) {
|
|
182596
|
+
if (typeof obj.firstLineIndentMode !== "boolean")
|
|
182597
|
+
return false;
|
|
182598
|
+
}
|
|
182599
|
+
if (obj.textStartPx !== undefined) {
|
|
182600
|
+
if (typeof obj.textStartPx !== "number")
|
|
182601
|
+
return false;
|
|
182602
|
+
}
|
|
182603
|
+
if (obj.tabsPx !== undefined) {
|
|
182604
|
+
if (!Array.isArray(obj.tabsPx))
|
|
182605
|
+
return false;
|
|
182606
|
+
for (const tab of obj.tabsPx)
|
|
182607
|
+
if (typeof tab !== "number")
|
|
182608
|
+
return false;
|
|
182609
|
+
}
|
|
182610
|
+
return true;
|
|
182611
|
+
}
|
|
182612
|
+
function computeTabWidth(currentPos, justification, tabs, hangingIndent, firstLineIndent, leftIndent) {
|
|
182613
|
+
const nextDefaultTabStop = currentPos + 48 - currentPos % 48;
|
|
182614
|
+
let tabWidth;
|
|
182615
|
+
if (justification === "left") {
|
|
182616
|
+
const explicitTabs = [...tabs ?? []];
|
|
182617
|
+
if (hangingIndent && hangingIndent > 0) {
|
|
182618
|
+
explicitTabs.push(leftIndent);
|
|
182619
|
+
explicitTabs.sort((a2, b$1) => a2 - b$1);
|
|
182620
|
+
}
|
|
182621
|
+
let targetTabStop;
|
|
182622
|
+
for (const tab of explicitTabs)
|
|
182623
|
+
if (tab > currentPos) {
|
|
182624
|
+
targetTabStop = tab;
|
|
182625
|
+
break;
|
|
182626
|
+
}
|
|
182627
|
+
if (targetTabStop === undefined)
|
|
182628
|
+
targetTabStop = nextDefaultTabStop;
|
|
182629
|
+
tabWidth = targetTabStop - currentPos;
|
|
182630
|
+
} else if (justification === "right")
|
|
182631
|
+
if (firstLineIndent != null && firstLineIndent > 0)
|
|
182632
|
+
tabWidth = nextDefaultTabStop - currentPos;
|
|
182633
|
+
else
|
|
182634
|
+
tabWidth = hangingIndent ?? 0;
|
|
182635
|
+
else
|
|
182636
|
+
tabWidth = nextDefaultTabStop - currentPos;
|
|
182637
|
+
return tabWidth;
|
|
182638
|
+
}
|
|
182576
182639
|
function calculateRotatedBounds(input2) {
|
|
182577
182640
|
const width = Math.max(0, input2.width);
|
|
182578
182641
|
const height = Math.max(0, input2.height);
|
|
@@ -186330,7 +186393,7 @@ function sumRowHeights(rows, fromRow, toRow) {
|
|
|
186330
186393
|
total += rows[i4].height;
|
|
186331
186394
|
return total;
|
|
186332
186395
|
}
|
|
186333
|
-
function computeFragmentHeight(measure, fromRow, toRow, repeatHeaderCount, borderCollapse, partialRow) {
|
|
186396
|
+
function computeFragmentHeight$1(measure, fromRow, toRow, repeatHeaderCount, borderCollapse, partialRow) {
|
|
186334
186397
|
let height = 0;
|
|
186335
186398
|
let rowCount = 0;
|
|
186336
186399
|
if (repeatHeaderCount > 0) {
|
|
@@ -186591,12 +186654,12 @@ function findSplitPoint(block, measure, startRow, availableHeight, fullPageHeigh
|
|
|
186591
186654
|
if (rs > 1)
|
|
186592
186655
|
maxRowspanEnd = Math.max(maxRowspanEnd, i4 + rs);
|
|
186593
186656
|
}
|
|
186594
|
-
if (computeFragmentHeight(measure, startRow, i4 + 1, 0, borderCollapse) <= availableHeight) {
|
|
186657
|
+
if (computeFragmentHeight$1(measure, startRow, i4 + 1, 0, borderCollapse) <= availableHeight) {
|
|
186595
186658
|
lastFitRow = i4 + 1;
|
|
186596
186659
|
if (maxRowspanEnd <= i4 + 1)
|
|
186597
186660
|
lastCleanFitRow = i4 + 1;
|
|
186598
186661
|
} else {
|
|
186599
|
-
let remainingHeight = availableHeight - computeFragmentHeight(measure, startRow, lastFitRow, 0, borderCollapse);
|
|
186662
|
+
let remainingHeight = availableHeight - computeFragmentHeight$1(measure, startRow, lastFitRow, 0, borderCollapse);
|
|
186600
186663
|
if (lastFitRow === startRow) {
|
|
186601
186664
|
const cellSpacingPx = measure.cellSpacingPx ?? 0;
|
|
186602
186665
|
const topBorderPx = borderCollapse === "separate" && measure.tableBorderWidths ? measure.tableBorderWidths.top : 0;
|
|
@@ -186808,7 +186871,7 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
|
|
|
186808
186871
|
const hadRemainingLinesBefore = fromLineByCell.some((fromLine, idx) => {
|
|
186809
186872
|
return fromLine < getCellTotalLines(measure.rows[rowIndex].cells[idx]);
|
|
186810
186873
|
});
|
|
186811
|
-
const fragmentHeight$1 = computeFragmentHeight(measure, rowIndex, rowIndex + 1, repeatHeaderCount, borderCollapse, continuationPartialRow);
|
|
186874
|
+
const fragmentHeight$1 = computeFragmentHeight$1(measure, rowIndex, rowIndex + 1, repeatHeaderCount, borderCollapse, continuationPartialRow);
|
|
186812
186875
|
if (fragmentHeight$1 > 0 && madeProgress) {
|
|
186813
186876
|
const { x: x$1, width: width$1 } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.min(columnWidth, measure.totalWidth || columnWidth), block.attrs);
|
|
186814
186877
|
const scaledWidths$1 = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width$1);
|
|
@@ -186863,7 +186926,7 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
|
|
|
186863
186926
|
continue;
|
|
186864
186927
|
}
|
|
186865
186928
|
const forcedEndRow = bodyStartRow + 1;
|
|
186866
|
-
const fragmentHeight$1 = computeFragmentHeight(measure, bodyStartRow, forcedEndRow, repeatHeaderCount, borderCollapse, forcedPartialRow);
|
|
186929
|
+
const fragmentHeight$1 = computeFragmentHeight$1(measure, bodyStartRow, forcedEndRow, repeatHeaderCount, borderCollapse, forcedPartialRow);
|
|
186867
186930
|
const { x: x$1, width: width$1 } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.min(columnWidth, measure.totalWidth || columnWidth), block.attrs);
|
|
186868
186931
|
const scaledWidths$1 = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width$1);
|
|
186869
186932
|
const fragment$1 = {
|
|
@@ -186890,7 +186953,7 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
|
|
|
186890
186953
|
isTableContinuation = true;
|
|
186891
186954
|
continue;
|
|
186892
186955
|
}
|
|
186893
|
-
const fragmentHeight = computeFragmentHeight(measure, bodyStartRow, endRow, repeatHeaderCount, borderCollapse, partialRow);
|
|
186956
|
+
const fragmentHeight = computeFragmentHeight$1(measure, bodyStartRow, endRow, repeatHeaderCount, borderCollapse, partialRow);
|
|
186894
186957
|
const { x, width } = resolveTableFrame(columnX(state.columnIndex), columnWidth, Math.min(columnWidth, measure.totalWidth || columnWidth), block.attrs);
|
|
186895
186958
|
const scaledWidths = rescaleColumnWidths(measure.columnWidths, measure.totalWidth, width);
|
|
186896
186959
|
const fragment2 = {
|
|
@@ -189403,41 +189466,8 @@ function convertOmmlToMathml(ommlJson, doc$12) {
|
|
|
189403
189466
|
}
|
|
189404
189467
|
return mathEl.childNodes.length > 0 ? mathEl : null;
|
|
189405
189468
|
}
|
|
189406
|
-
function isMinimalWordLayout(value) {
|
|
189407
|
-
|
|
189408
|
-
return false;
|
|
189409
|
-
const obj = value;
|
|
189410
|
-
if (obj.marker !== undefined) {
|
|
189411
|
-
if (typeof obj.marker !== "object" || obj.marker === null)
|
|
189412
|
-
return false;
|
|
189413
|
-
const marker = obj.marker;
|
|
189414
|
-
if (marker.markerText !== undefined && typeof marker.markerText !== "string")
|
|
189415
|
-
return false;
|
|
189416
|
-
if (marker.markerX !== undefined && typeof marker.markerX !== "number")
|
|
189417
|
-
return false;
|
|
189418
|
-
if (marker.textStartX !== undefined && typeof marker.textStartX !== "number")
|
|
189419
|
-
return false;
|
|
189420
|
-
}
|
|
189421
|
-
if (obj.indentLeftPx !== undefined) {
|
|
189422
|
-
if (typeof obj.indentLeftPx !== "number")
|
|
189423
|
-
return false;
|
|
189424
|
-
}
|
|
189425
|
-
if (obj.firstLineIndentMode !== undefined) {
|
|
189426
|
-
if (typeof obj.firstLineIndentMode !== "boolean")
|
|
189427
|
-
return false;
|
|
189428
|
-
}
|
|
189429
|
-
if (obj.textStartPx !== undefined) {
|
|
189430
|
-
if (typeof obj.textStartPx !== "number")
|
|
189431
|
-
return false;
|
|
189432
|
-
}
|
|
189433
|
-
if (obj.tabsPx !== undefined) {
|
|
189434
|
-
if (!Array.isArray(obj.tabsPx))
|
|
189435
|
-
return false;
|
|
189436
|
-
for (const tab of obj.tabsPx)
|
|
189437
|
-
if (typeof tab !== "number")
|
|
189438
|
-
return false;
|
|
189439
|
-
}
|
|
189440
|
-
return true;
|
|
189469
|
+
function isMinimalWordLayout$1(value) {
|
|
189470
|
+
return isMinimalWordLayout(value);
|
|
189441
189471
|
}
|
|
189442
189472
|
function roundSnapshotMetric(value) {
|
|
189443
189473
|
if (!Number.isFinite(value))
|
|
@@ -219614,15 +219644,256 @@ function findSliceAtPosition(slices, pmPos) {
|
|
|
219614
219644
|
}
|
|
219615
219645
|
return null;
|
|
219616
219646
|
}
|
|
219647
|
+
function resolveMarkerTextWidth(markerTextWidthPx, marker) {
|
|
219648
|
+
const val = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : undefined;
|
|
219649
|
+
return val(markerTextWidthPx) ?? val(marker.glyphWidthPx) ?? val(marker.markerBoxWidthPx) ?? 0;
|
|
219650
|
+
}
|
|
219651
|
+
function resolverListMarkerGeometry(wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx) {
|
|
219652
|
+
return resolveListMarkerGeometry(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolveMarkerTextWidth(markerTextWidthPx, marker));
|
|
219653
|
+
}
|
|
219654
|
+
function resolverListTextStartPx(wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx) {
|
|
219655
|
+
return resolveListTextStartPx(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolveMarkerTextWidth(markerTextWidthPx, marker));
|
|
219656
|
+
}
|
|
219657
|
+
function resolveParagraphContent(fragment2, block, measure) {
|
|
219658
|
+
const wordLayout = isMinimalWordLayout(block.attrs?.wordLayout) ? block.attrs.wordLayout : undefined;
|
|
219659
|
+
const paraIndent = block.attrs?.indent;
|
|
219660
|
+
const paraIndentLeft = paraIndent?.left ?? 0;
|
|
219661
|
+
const paraIndentRight = paraIndent?.right ?? 0;
|
|
219662
|
+
const firstLineOffset = block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
|
|
219663
|
+
const paragraphEndsWithLineBreak = (block.runs.length > 0 ? block.runs[block.runs.length - 1] : null)?.kind === "lineBreak";
|
|
219664
|
+
const lines = fragment2.lines ?? measure.lines.slice(fragment2.fromLine, fragment2.toLine);
|
|
219665
|
+
const hasMarker = !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker;
|
|
219666
|
+
const listFirstLineTextStartPx = hasMarker ? resolverListTextStartPx(wordLayout, paraIndentLeft, paraIndent?.hanging ?? 0, paraIndent?.firstLine ?? 0, fragment2.markerTextWidth) : undefined;
|
|
219667
|
+
const listFirstLineMarkerGeometry = !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker?.justification === "left" && wordLayout.firstLineIndentMode !== true && typeof fragment2.markerTextWidth === "number" && Number.isFinite(fragment2.markerTextWidth) && fragment2.markerTextWidth >= 0 ? resolverListMarkerGeometry(wordLayout, paraIndentLeft, paraIndent?.hanging ?? 0, paraIndent?.firstLine ?? 0, fragment2.markerTextWidth) : undefined;
|
|
219668
|
+
let listTabWidth = 0;
|
|
219669
|
+
let markerStartPos = 0;
|
|
219670
|
+
if (hasMarker) {
|
|
219671
|
+
const markerTextWidth = fragment2.markerTextWidth;
|
|
219672
|
+
const anchorPoint = paraIndentLeft - (paraIndent?.hanging ?? 0) + (paraIndent?.firstLine ?? 0);
|
|
219673
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
219674
|
+
let currentPos;
|
|
219675
|
+
if (markerJustification === "left") {
|
|
219676
|
+
markerStartPos = anchorPoint;
|
|
219677
|
+
currentPos = markerStartPos + markerTextWidth;
|
|
219678
|
+
} else if (markerJustification === "right") {
|
|
219679
|
+
markerStartPos = anchorPoint - markerTextWidth;
|
|
219680
|
+
currentPos = anchorPoint;
|
|
219681
|
+
} else {
|
|
219682
|
+
markerStartPos = anchorPoint - markerTextWidth / 2;
|
|
219683
|
+
currentPos = markerStartPos + markerTextWidth;
|
|
219684
|
+
}
|
|
219685
|
+
const suffix = wordLayout.marker.suffix ?? "tab";
|
|
219686
|
+
if (listFirstLineMarkerGeometry && (suffix === "tab" || suffix === "space"))
|
|
219687
|
+
listTabWidth = listFirstLineMarkerGeometry.suffixWidthPx;
|
|
219688
|
+
else if (suffix === "tab")
|
|
219689
|
+
listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, paraIndent?.hanging, paraIndent?.firstLine, paraIndentLeft);
|
|
219690
|
+
else if (suffix === "space")
|
|
219691
|
+
listTabWidth = 4;
|
|
219692
|
+
}
|
|
219693
|
+
let marker;
|
|
219694
|
+
if (hasMarker) {
|
|
219695
|
+
const m$1 = wordLayout.marker;
|
|
219696
|
+
const justification = m$1.justification ?? "left";
|
|
219697
|
+
const firstLinePaddingLeftPx = paraIndentLeft + (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
|
|
219698
|
+
let centerPaddingAdjustPx;
|
|
219699
|
+
if (justification === "center")
|
|
219700
|
+
centerPaddingAdjustPx = fragment2.markerTextWidth / 2;
|
|
219701
|
+
marker = {
|
|
219702
|
+
text: m$1.markerText ?? "",
|
|
219703
|
+
justification,
|
|
219704
|
+
suffix: m$1.suffix ?? "tab",
|
|
219705
|
+
vanish: m$1.run?.vanish,
|
|
219706
|
+
markerStartPx: markerStartPos,
|
|
219707
|
+
suffixWidthPx: listTabWidth,
|
|
219708
|
+
firstLinePaddingLeftPx,
|
|
219709
|
+
centerPaddingAdjustPx,
|
|
219710
|
+
run: {
|
|
219711
|
+
fontFamily: m$1.run?.fontFamily ?? "",
|
|
219712
|
+
fontSize: m$1.run?.fontSize ?? 0,
|
|
219713
|
+
bold: m$1.run?.bold,
|
|
219714
|
+
italic: m$1.run?.italic,
|
|
219715
|
+
color: m$1.run?.color,
|
|
219716
|
+
letterSpacing: m$1.run?.letterSpacing
|
|
219717
|
+
}
|
|
219718
|
+
};
|
|
219719
|
+
}
|
|
219720
|
+
let dropCap;
|
|
219721
|
+
const dropCapDescriptor = block.attrs?.dropCapDescriptor;
|
|
219722
|
+
const dropCapMeasure = measure.dropCap;
|
|
219723
|
+
if (dropCapDescriptor && dropCapMeasure && !fragment2.continuesFromPrev)
|
|
219724
|
+
dropCap = {
|
|
219725
|
+
text: dropCapDescriptor.run.text,
|
|
219726
|
+
mode: dropCapDescriptor.mode,
|
|
219727
|
+
fontFamily: dropCapDescriptor.run.fontFamily,
|
|
219728
|
+
fontSize: dropCapDescriptor.run.fontSize,
|
|
219729
|
+
bold: dropCapDescriptor.run.bold,
|
|
219730
|
+
italic: dropCapDescriptor.run.italic,
|
|
219731
|
+
color: dropCapDescriptor.run.color,
|
|
219732
|
+
position: dropCapDescriptor.run.position,
|
|
219733
|
+
width: dropCapMeasure.width,
|
|
219734
|
+
height: dropCapMeasure.height
|
|
219735
|
+
};
|
|
219736
|
+
return {
|
|
219737
|
+
lines: lines.map((line, index2) => {
|
|
219738
|
+
const hasExplicitSegmentPositioning = line.segments?.some((segment) => segment.x !== undefined) === true;
|
|
219739
|
+
const hasListFirstLineMarker = index2 === 0 && !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker;
|
|
219740
|
+
const shouldUseResolvedListTextStart = hasListFirstLineMarker && hasExplicitSegmentPositioning && listFirstLineTextStartPx != null;
|
|
219741
|
+
const positiveIndentReduction = Math.max(0, paraIndentLeft) + Math.max(0, paraIndentRight);
|
|
219742
|
+
const fallbackAvailableWidth = Math.max(0, fragment2.width - positiveIndentReduction);
|
|
219743
|
+
let availableWidth = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
|
|
219744
|
+
if (shouldUseResolvedListTextStart)
|
|
219745
|
+
availableWidth = fragment2.width - listFirstLineTextStartPx - Math.max(0, paraIndentRight);
|
|
219746
|
+
const skipJustify = index2 === lines.length - 1 && !fragment2.continuesOnNext && !paragraphEndsWithLineBreak;
|
|
219747
|
+
const isListFirstLine = Boolean(hasListFirstLineMarker && fragment2.markerTextWidth);
|
|
219748
|
+
const isFirstLine = index2 === 0 && !fragment2.continuesFromPrev;
|
|
219749
|
+
let paddingLeftPx = 0;
|
|
219750
|
+
let paddingRightPx = 0;
|
|
219751
|
+
let textIndentPx = 0;
|
|
219752
|
+
if (!isListFirstLine) {
|
|
219753
|
+
if (hasExplicitSegmentPositioning) {
|
|
219754
|
+
if (isFirstLine && firstLineOffset !== 0) {
|
|
219755
|
+
const adjustedPadding = (paraIndentLeft < 0 ? 0 : paraIndentLeft) + firstLineOffset;
|
|
219756
|
+
if (adjustedPadding > 0)
|
|
219757
|
+
paddingLeftPx = adjustedPadding;
|
|
219758
|
+
}
|
|
219759
|
+
} else if (paraIndentLeft && paraIndentLeft > 0)
|
|
219760
|
+
paddingLeftPx = paraIndentLeft;
|
|
219761
|
+
else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0 && !(paraIndentLeft != null && paraIndentLeft < 0))
|
|
219762
|
+
paddingLeftPx = paraIndent.hanging;
|
|
219763
|
+
}
|
|
219764
|
+
if (paraIndentRight && paraIndentRight > 0)
|
|
219765
|
+
paddingRightPx = paraIndentRight;
|
|
219766
|
+
if (!fragment2.continuesFromPrev && index2 === 0 && firstLineOffset && !isListFirstLine) {
|
|
219767
|
+
if (!hasExplicitSegmentPositioning)
|
|
219768
|
+
textIndentPx = firstLineOffset;
|
|
219769
|
+
}
|
|
219770
|
+
const indentLeft = paraIndent?.left ?? 0;
|
|
219771
|
+
const firstLine = paraIndent?.firstLine ?? 0;
|
|
219772
|
+
const hanging = paraIndent?.hanging ?? 0;
|
|
219773
|
+
const paragraphLineIndex = fragment2.fromLine + index2;
|
|
219774
|
+
const isFirstLineOfPara = paragraphLineIndex === 0;
|
|
219775
|
+
const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
|
|
219776
|
+
const isListParagraph = Boolean(wordLayout?.marker);
|
|
219777
|
+
const fallbackListTextStartPx = typeof wordLayout?.marker?.textStartX === "number" && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
|
|
219778
|
+
const indentOffset = isListParagraph ? isFirstLineOfPara ? (shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined) ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
|
|
219779
|
+
return {
|
|
219780
|
+
line,
|
|
219781
|
+
lineIndex: paragraphLineIndex,
|
|
219782
|
+
availableWidth,
|
|
219783
|
+
skipJustify,
|
|
219784
|
+
paddingLeftPx,
|
|
219785
|
+
paddingRightPx,
|
|
219786
|
+
textIndentPx,
|
|
219787
|
+
isListFirstLine,
|
|
219788
|
+
resolvedListTextStartPx: shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined,
|
|
219789
|
+
hasExplicitSegmentPositioning,
|
|
219790
|
+
indentOffset
|
|
219791
|
+
};
|
|
219792
|
+
}),
|
|
219793
|
+
dropCap,
|
|
219794
|
+
marker,
|
|
219795
|
+
continuesFromPrev: fragment2.continuesFromPrev,
|
|
219796
|
+
continuesOnNext: fragment2.continuesOnNext,
|
|
219797
|
+
paragraphEndsWithLineBreak
|
|
219798
|
+
};
|
|
219799
|
+
}
|
|
219800
|
+
function buildBlockMap(blocks2, measures) {
|
|
219801
|
+
const map$12 = /* @__PURE__ */ new Map;
|
|
219802
|
+
for (let i4 = 0;i4 < blocks2.length; i4++)
|
|
219803
|
+
map$12.set(blocks2[i4].id, {
|
|
219804
|
+
block: blocks2[i4],
|
|
219805
|
+
measure: measures[i4]
|
|
219806
|
+
});
|
|
219807
|
+
return map$12;
|
|
219808
|
+
}
|
|
219809
|
+
function sumLineHeights$2(lines, from$1, to) {
|
|
219810
|
+
let total = 0;
|
|
219811
|
+
for (let i4 = from$1;i4 < to && i4 < lines.length; i4++)
|
|
219812
|
+
total += lines[i4].lineHeight;
|
|
219813
|
+
return total;
|
|
219814
|
+
}
|
|
219815
|
+
function computeFragmentHeight(fragment2, blockMap) {
|
|
219816
|
+
if (fragment2.kind === "image" || fragment2.kind === "drawing" || fragment2.kind === "table")
|
|
219817
|
+
return fragment2.height;
|
|
219818
|
+
const entry = blockMap.get(fragment2.blockId);
|
|
219819
|
+
if (!entry)
|
|
219820
|
+
return 0;
|
|
219821
|
+
if (fragment2.kind === "para") {
|
|
219822
|
+
if (fragment2.lines)
|
|
219823
|
+
return fragment2.lines.reduce((sum, line) => sum + line.lineHeight, 0);
|
|
219824
|
+
if (entry.measure.kind === "paragraph")
|
|
219825
|
+
return sumLineHeights$2(entry.measure.lines, fragment2.fromLine, fragment2.toLine);
|
|
219826
|
+
return 0;
|
|
219827
|
+
}
|
|
219828
|
+
if (fragment2.kind === "list-item") {
|
|
219829
|
+
const listMeasure = entry.measure;
|
|
219830
|
+
if (listMeasure.kind !== "list")
|
|
219831
|
+
return 0;
|
|
219832
|
+
const item = listMeasure.items.find((it) => it.itemId === fragment2.itemId);
|
|
219833
|
+
if (!item)
|
|
219834
|
+
return 0;
|
|
219835
|
+
return sumLineHeights$2(item.paragraph.lines, fragment2.fromLine, fragment2.toLine);
|
|
219836
|
+
}
|
|
219837
|
+
return 0;
|
|
219838
|
+
}
|
|
219839
|
+
function isAnchoredMediaFragment(fragment2) {
|
|
219840
|
+
return (fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true;
|
|
219841
|
+
}
|
|
219842
|
+
function resolveFragmentZIndex(fragment2) {
|
|
219843
|
+
if (!isAnchoredMediaFragment(fragment2))
|
|
219844
|
+
return;
|
|
219845
|
+
return fragment2.zIndex;
|
|
219846
|
+
}
|
|
219847
|
+
function resolveFragmentId(fragment2) {
|
|
219848
|
+
switch (fragment2.kind) {
|
|
219849
|
+
case "para":
|
|
219850
|
+
return `para:${fragment2.blockId}:${fragment2.fromLine}:${fragment2.toLine}`;
|
|
219851
|
+
case "list-item":
|
|
219852
|
+
return `list-item:${fragment2.blockId}:${fragment2.itemId}:${fragment2.fromLine}:${fragment2.toLine}`;
|
|
219853
|
+
case "image":
|
|
219854
|
+
return `image:${fragment2.blockId}:${fragment2.x}:${fragment2.y}`;
|
|
219855
|
+
case "drawing":
|
|
219856
|
+
return `drawing:${fragment2.blockId}:${fragment2.x}:${fragment2.y}`;
|
|
219857
|
+
case "table": {
|
|
219858
|
+
const partialKey = fragment2.partialRow ? `:${fragment2.partialRow.fromLineByCell.join(",")}-${fragment2.partialRow.toLineByCell.join(",")}` : "";
|
|
219859
|
+
return `table:${fragment2.blockId}:${fragment2.fromRow}:${fragment2.toRow}${partialKey}`;
|
|
219860
|
+
}
|
|
219861
|
+
}
|
|
219862
|
+
}
|
|
219863
|
+
function resolveParagraphContentIfApplicable(fragment2, blockMap) {
|
|
219864
|
+
if (fragment2.kind !== "para")
|
|
219865
|
+
return;
|
|
219866
|
+
const entry = blockMap.get(fragment2.blockId);
|
|
219867
|
+
if (!entry || entry.block.kind !== "paragraph" || entry.measure.kind !== "paragraph")
|
|
219868
|
+
return;
|
|
219869
|
+
return resolveParagraphContent(fragment2, entry.block, entry.measure);
|
|
219870
|
+
}
|
|
219871
|
+
function resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap) {
|
|
219872
|
+
return {
|
|
219873
|
+
kind: "fragment",
|
|
219874
|
+
id: resolveFragmentId(fragment2),
|
|
219875
|
+
pageIndex,
|
|
219876
|
+
x: fragment2.x,
|
|
219877
|
+
y: fragment2.y,
|
|
219878
|
+
width: fragment2.width,
|
|
219879
|
+
height: computeFragmentHeight(fragment2, blockMap),
|
|
219880
|
+
zIndex: resolveFragmentZIndex(fragment2),
|
|
219881
|
+
fragmentKind: fragment2.kind,
|
|
219882
|
+
blockId: fragment2.blockId,
|
|
219883
|
+
fragmentIndex,
|
|
219884
|
+
content: resolveParagraphContentIfApplicable(fragment2, blockMap)
|
|
219885
|
+
};
|
|
219886
|
+
}
|
|
219617
219887
|
function resolveLayout(input2) {
|
|
219618
|
-
const { layout, flowMode } = input2;
|
|
219619
|
-
const
|
|
219620
|
-
|
|
219621
|
-
|
|
219888
|
+
const { layout, flowMode, blocks: blocks2, measures } = input2;
|
|
219889
|
+
const blockMap = buildBlockMap(blocks2, measures);
|
|
219890
|
+
const pages = layout.pages.map((page, pageIndex) => ({
|
|
219891
|
+
id: `page-${pageIndex}`,
|
|
219892
|
+
index: pageIndex,
|
|
219622
219893
|
number: page.number,
|
|
219623
219894
|
width: page.size?.w ?? layout.pageSize.w,
|
|
219624
219895
|
height: page.size?.h ?? layout.pageSize.h,
|
|
219625
|
-
items:
|
|
219896
|
+
items: page.fragments.map((fragment2, fragmentIndex) => resolveFragmentItem(fragment2, fragmentIndex, pageIndex, blockMap))
|
|
219626
219897
|
}));
|
|
219627
219898
|
return {
|
|
219628
219899
|
version: 1,
|
|
@@ -240059,7 +240330,7 @@ var Node$13 = class Node$14 {
|
|
|
240059
240330
|
return getMinimumReadableTextStartPx(markerContentEndPx, gutterWidthPx);
|
|
240060
240331
|
}, EMUS_PER_INCH = 914400, maxSize = 5000, cache, makeKey = (text5, font, letterSpacing) => {
|
|
240061
240332
|
return `${text5}|${font}|${letterSpacing || 0}`;
|
|
240062
|
-
}, fontMetricsCache, MAX_CACHE_SIZE$1 = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", computeTabStops, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS$2 = 720, TWIPS_PER_PX$1, twipsToPx$2 = (twips) => twips / TWIPS_PER_PX$1, pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1), DEFAULT_TAB_INTERVAL_PX
|
|
240333
|
+
}, fontMetricsCache, MAX_CACHE_SIZE$1 = 1000, METRICS_TEST_STRING = "MHgypbdlÁÉÍ", computeTabStops, measurementConfig, canvasContext = null, DEFAULT_TAB_INTERVAL_TWIPS$2 = 720, TWIPS_PER_PX$1, twipsToPx$2 = (twips) => twips / TWIPS_PER_PX$1, pxToTwips$1 = (px) => Math.round(px * TWIPS_PER_PX$1), DEFAULT_TAB_INTERVAL_PX, TAB_EPSILON$1 = 0.1, DEFAULT_CELL_PADDING$1, DEFAULT_DECIMAL_SEPARATOR$1 = ".", ALLOWED_TAB_VALS, FIELD_ANNOTATION_PILL_PADDING = 8, FIELD_ANNOTATION_LINE_HEIGHT_MULTIPLIER = 1.2, FIELD_ANNOTATION_VERTICAL_PADDING = 6, DEFAULT_FIELD_ANNOTATION_FONT_SIZE = 16, DEFAULT_PARAGRAPH_FONT_SIZE = 12, DEFAULT_PARAGRAPH_FONT_FAMILY = "Arial", isValidFontSize = (value) => typeof value === "number" && Number.isFinite(value) && value > 0, normalizeFontSize$1 = (value, fallback = DEFAULT_PARAGRAPH_FONT_SIZE) => {
|
|
240063
240334
|
if (isValidFontSize(value))
|
|
240064
240335
|
return value;
|
|
240065
240336
|
if (typeof value === "string") {
|
|
@@ -240245,7 +240516,7 @@ var Node$13 = class Node$14 {
|
|
|
240245
240516
|
stop: tabStops[index2]
|
|
240246
240517
|
};
|
|
240247
240518
|
return {
|
|
240248
|
-
target: currentX + DEFAULT_TAB_INTERVAL_PX
|
|
240519
|
+
target: currentX + DEFAULT_TAB_INTERVAL_PX,
|
|
240249
240520
|
nextIndex: index2
|
|
240250
240521
|
};
|
|
240251
240522
|
}, SINGLE_COLUMN_DEFAULT, isTextRun$4 = (run2) => {
|
|
@@ -240725,37 +240996,11 @@ var Node$13 = class Node$14 {
|
|
|
240725
240996
|
line.el.style.marginLeft = `${marginLeft}px`;
|
|
240726
240997
|
line.el.style.marginRight = `${marginRight}px`;
|
|
240727
240998
|
});
|
|
240728
|
-
},
|
|
240999
|
+
}, getFiniteNonNegativeNumber = (value) => {
|
|
240729
241000
|
if (typeof value !== "number" || !Number.isFinite(value) || value < 0)
|
|
240730
241001
|
return;
|
|
240731
241002
|
return value;
|
|
240732
|
-
}, resolvePainterMarkerTextWidth = (markerTextWidthPx, marker) => getFiniteNonNegativeNumber(markerTextWidthPx) ?? getFiniteNonNegativeNumber(marker.glyphWidthPx) ?? getFiniteNonNegativeNumber(marker.markerBoxWidthPx) ?? 0, resolvePainterListMarkerGeometry = ({ wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx }) => resolveListMarkerGeometry(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolvePainterMarkerTextWidth(markerTextWidthPx, marker)), resolvePainterListTextStartPx = ({ wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx }) => resolveListTextStartPx(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolvePainterMarkerTextWidth(markerTextWidthPx, marker)),
|
|
240733
|
-
const nextDefaultTabStop = currentPos + DEFAULT_TAB_INTERVAL_PX - currentPos % DEFAULT_TAB_INTERVAL_PX;
|
|
240734
|
-
let tabWidth;
|
|
240735
|
-
if (justification === "left") {
|
|
240736
|
-
const explicitTabs = [...tabs ?? []];
|
|
240737
|
-
if (hangingIndent && hangingIndent > 0) {
|
|
240738
|
-
explicitTabs.push(leftIndent);
|
|
240739
|
-
explicitTabs.sort((a2, b$1) => a2 - b$1);
|
|
240740
|
-
}
|
|
240741
|
-
let targetTabStop;
|
|
240742
|
-
for (const tab of explicitTabs)
|
|
240743
|
-
if (tab > currentPos) {
|
|
240744
|
-
targetTabStop = tab;
|
|
240745
|
-
break;
|
|
240746
|
-
}
|
|
240747
|
-
if (targetTabStop === undefined)
|
|
240748
|
-
targetTabStop = nextDefaultTabStop;
|
|
240749
|
-
tabWidth = targetTabStop - currentPos;
|
|
240750
|
-
} else if (justification === "right")
|
|
240751
|
-
if (firstLineIndent != null && firstLineIndent > 0)
|
|
240752
|
-
tabWidth = nextDefaultTabStop - currentPos;
|
|
240753
|
-
else
|
|
240754
|
-
tabWidth = hangingIndent ?? 0;
|
|
240755
|
-
else
|
|
240756
|
-
tabWidth = nextDefaultTabStop - currentPos;
|
|
240757
|
-
return tabWidth;
|
|
240758
|
-
}, normalizeSpan = (span) => {
|
|
241003
|
+
}, resolvePainterMarkerTextWidth = (markerTextWidthPx, marker) => getFiniteNonNegativeNumber(markerTextWidthPx) ?? getFiniteNonNegativeNumber(marker.glyphWidthPx) ?? getFiniteNonNegativeNumber(marker.markerBoxWidthPx) ?? 0, resolvePainterListMarkerGeometry = ({ wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx }) => resolveListMarkerGeometry(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolvePainterMarkerTextWidth(markerTextWidthPx, marker)), resolvePainterListTextStartPx = ({ wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx }) => resolveListTextStartPx(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolvePainterMarkerTextWidth(markerTextWidthPx, marker)), normalizeSpan = (span) => {
|
|
240759
241004
|
if (typeof span !== "number" || !Number.isFinite(span) || span < 1)
|
|
240760
241005
|
return 1;
|
|
240761
241006
|
return Math.floor(span);
|
|
@@ -242617,6 +242862,10 @@ var Node$13 = class Node$14 {
|
|
|
242617
242862
|
result.push(run2);
|
|
242618
242863
|
continue;
|
|
242619
242864
|
}
|
|
242865
|
+
if (run2.kind === "math") {
|
|
242866
|
+
result.push(run2);
|
|
242867
|
+
continue;
|
|
242868
|
+
}
|
|
242620
242869
|
if (!("text" in run2))
|
|
242621
242870
|
continue;
|
|
242622
242871
|
const text5 = run2.text ?? "";
|
|
@@ -254892,7 +255141,7 @@ var Node$13 = class Node$14 {
|
|
|
254892
255141
|
return;
|
|
254893
255142
|
console.log(...args$1);
|
|
254894
255143
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
254895
|
-
var
|
|
255144
|
+
var init_src_C5K9vSFa_es = __esm(() => {
|
|
254896
255145
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
254897
255146
|
init_SuperConverter_B9oNf3OB_es();
|
|
254898
255147
|
init_jszip_ChlR43oI_es();
|
|
@@ -273193,7 +273442,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
273193
273442
|
cacheSize: 5000
|
|
273194
273443
|
};
|
|
273195
273444
|
TWIPS_PER_PX$1 = 1440 / 96;
|
|
273196
|
-
DEFAULT_TAB_INTERVAL_PX
|
|
273445
|
+
DEFAULT_TAB_INTERVAL_PX = twipsToPx$2(DEFAULT_TAB_INTERVAL_TWIPS$2);
|
|
273197
273446
|
DEFAULT_CELL_PADDING$1 = {
|
|
273198
273447
|
top: 0,
|
|
273199
273448
|
left: 4,
|
|
@@ -273553,6 +273802,16 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
273553
273802
|
setResolvedLayout(resolvedLayout) {
|
|
273554
273803
|
this.resolvedLayout = resolvedLayout;
|
|
273555
273804
|
}
|
|
273805
|
+
getResolvedPage(pageIndex) {
|
|
273806
|
+
return this.resolvedLayout?.pages[pageIndex] ?? null;
|
|
273807
|
+
}
|
|
273808
|
+
getResolvedFragmentItem(pageIndex, fragmentIndex) {
|
|
273809
|
+
const page = this.getResolvedPage(pageIndex);
|
|
273810
|
+
if (!page)
|
|
273811
|
+
return;
|
|
273812
|
+
const item = page.items[fragmentIndex];
|
|
273813
|
+
return item?.kind === "fragment" ? item : undefined;
|
|
273814
|
+
}
|
|
273556
273815
|
getPaintSnapshot() {
|
|
273557
273816
|
return this.lastPaintSnapshot;
|
|
273558
273817
|
}
|
|
@@ -273865,7 +274124,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
273865
274124
|
if (!this.currentLayout)
|
|
273866
274125
|
return;
|
|
273867
274126
|
if (this.currentLayout.pages.length !== this.virtualHeights.length)
|
|
273868
|
-
this.virtualHeights = this.currentLayout.pages.map((p$12) =>
|
|
274127
|
+
this.virtualHeights = this.currentLayout.pages.map((p$12, i4) => {
|
|
274128
|
+
return this.getResolvedPage(i4)?.height ?? p$12.size?.h ?? this.currentLayout.pageSize.h;
|
|
274129
|
+
});
|
|
273869
274130
|
const offsets = new Array(this.virtualHeights.length + 1);
|
|
273870
274131
|
offsets[0] = 0;
|
|
273871
274132
|
for (let i4 = 0;i4 < this.virtualHeights.length; i4 += 1)
|
|
@@ -273975,7 +274236,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
273975
274236
|
}
|
|
273976
274237
|
for (const i4 of mounted) {
|
|
273977
274238
|
const page = layout.pages[i4];
|
|
273978
|
-
const
|
|
274239
|
+
const resolved = this.getResolvedPage(i4);
|
|
274240
|
+
const pageSize = resolved ? {
|
|
274241
|
+
w: resolved.width,
|
|
274242
|
+
h: resolved.height
|
|
274243
|
+
} : page.size ?? layout.pageSize;
|
|
273979
274244
|
const existing = this.pageIndexToState.get(i4);
|
|
273980
274245
|
if (!existing) {
|
|
273981
274246
|
const newState = this.createPageState(page, pageSize, i4);
|
|
@@ -274052,7 +274317,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274052
274317
|
return;
|
|
274053
274318
|
mount.innerHTML = "";
|
|
274054
274319
|
layout.pages.forEach((page, pageIndex) => {
|
|
274055
|
-
const
|
|
274320
|
+
const resolved = this.getResolvedPage(pageIndex);
|
|
274321
|
+
const pageSize = resolved ? {
|
|
274322
|
+
w: resolved.width,
|
|
274323
|
+
h: resolved.height
|
|
274324
|
+
} : page.size ?? layout.pageSize;
|
|
274056
274325
|
const pageEl = this.renderPage(pageSize.w, pageSize.h, page, pageIndex);
|
|
274057
274326
|
mount.appendChild(pageEl);
|
|
274058
274327
|
});
|
|
@@ -274064,7 +274333,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274064
274333
|
const pages = layout.pages;
|
|
274065
274334
|
if (pages.length === 0)
|
|
274066
274335
|
return;
|
|
274067
|
-
const
|
|
274336
|
+
const firstResolved = this.getResolvedPage(0);
|
|
274337
|
+
const firstPageSize = firstResolved ? {
|
|
274338
|
+
w: firstResolved.width,
|
|
274339
|
+
h: firstResolved.height
|
|
274340
|
+
} : pages[0].size ?? layout.pageSize;
|
|
274068
274341
|
const firstPageEl = this.renderPage(firstPageSize.w, firstPageSize.h, pages[0], 0);
|
|
274069
274342
|
mount.appendChild(firstPageEl);
|
|
274070
274343
|
for (let i4 = 1;i4 < pages.length; i4 += 2) {
|
|
@@ -274072,12 +274345,20 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274072
274345
|
spreadEl.classList.add(CLASS_NAMES$1.spread);
|
|
274073
274346
|
applyStyles(spreadEl, spreadStyles);
|
|
274074
274347
|
const leftPage = pages[i4];
|
|
274075
|
-
const
|
|
274348
|
+
const leftResolved = this.getResolvedPage(i4);
|
|
274349
|
+
const leftPageSize = leftResolved ? {
|
|
274350
|
+
w: leftResolved.width,
|
|
274351
|
+
h: leftResolved.height
|
|
274352
|
+
} : leftPage.size ?? layout.pageSize;
|
|
274076
274353
|
const leftPageEl = this.renderPage(leftPageSize.w, leftPageSize.h, leftPage, i4);
|
|
274077
274354
|
spreadEl.appendChild(leftPageEl);
|
|
274078
274355
|
if (i4 + 1 < pages.length) {
|
|
274079
274356
|
const rightPage = pages[i4 + 1];
|
|
274080
|
-
const
|
|
274357
|
+
const rightResolved = this.getResolvedPage(i4 + 1);
|
|
274358
|
+
const rightPageSize = rightResolved ? {
|
|
274359
|
+
w: rightResolved.width,
|
|
274360
|
+
h: rightResolved.height
|
|
274361
|
+
} : rightPage.size ?? layout.pageSize;
|
|
274081
274362
|
const rightPageEl = this.renderPage(rightPageSize.w, rightPageSize.h, rightPage, i4 + 1);
|
|
274082
274363
|
spreadEl.appendChild(rightPageEl);
|
|
274083
274364
|
}
|
|
@@ -274110,7 +274391,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274110
274391
|
const betweenBorderFlags = computeBetweenBorderFlags(page.fragments, this.blockLookup);
|
|
274111
274392
|
page.fragments.forEach((fragment2, index2) => {
|
|
274112
274393
|
const sdtBoundary = sdtBoundaries.get(index2);
|
|
274113
|
-
|
|
274394
|
+
const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
|
|
274395
|
+
el.appendChild(this.renderFragment(fragment2, contextBase, sdtBoundary, betweenBorderFlags.get(index2), resolvedItem));
|
|
274114
274396
|
});
|
|
274115
274397
|
this.renderDecorationsForPage(el, page, pageIndex);
|
|
274116
274398
|
return el;
|
|
@@ -274331,7 +274613,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274331
274613
|
this.mount.innerHTML = "";
|
|
274332
274614
|
this.pageStates = [];
|
|
274333
274615
|
layout.pages.forEach((page, pageIndex) => {
|
|
274334
|
-
const
|
|
274616
|
+
const resolved = this.getResolvedPage(pageIndex);
|
|
274617
|
+
const pageSize = resolved ? {
|
|
274618
|
+
w: resolved.width,
|
|
274619
|
+
h: resolved.height
|
|
274620
|
+
} : page.size ?? layout.pageSize;
|
|
274335
274621
|
const pageState = this.createPageState(page, pageSize, pageIndex);
|
|
274336
274622
|
pageState.element.dataset.pageNumber = String(page.number);
|
|
274337
274623
|
pageState.element.dataset.pageIndex = String(pageIndex);
|
|
@@ -274344,7 +274630,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274344
274630
|
return;
|
|
274345
274631
|
const nextStates = [];
|
|
274346
274632
|
layout.pages.forEach((page, index2) => {
|
|
274347
|
-
const
|
|
274633
|
+
const resolved = this.getResolvedPage(index2);
|
|
274634
|
+
const pageSize = resolved ? {
|
|
274635
|
+
w: resolved.width,
|
|
274636
|
+
h: resolved.height
|
|
274637
|
+
} : page.size ?? layout.pageSize;
|
|
274348
274638
|
const prevState = this.pageStates[index2];
|
|
274349
274639
|
if (!prevState) {
|
|
274350
274640
|
const newState = this.createPageState(page, pageSize, index2);
|
|
@@ -274384,6 +274674,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274384
274674
|
const current = existing.get(key$1);
|
|
274385
274675
|
const sdtBoundary = sdtBoundaries.get(index2);
|
|
274386
274676
|
const betweenInfo = betweenBorderFlags.get(index2);
|
|
274677
|
+
const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
|
|
274387
274678
|
if (current) {
|
|
274388
274679
|
existing.delete(key$1);
|
|
274389
274680
|
const sdtBoundaryMismatch = shouldRebuildForSdtBoundary(current.element, sdtBoundary);
|
|
@@ -274391,13 +274682,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274391
274682
|
const newPmStart = fragment2.pmStart;
|
|
274392
274683
|
const mappingUnreliable = this.currentMapping != null && newPmStart != null && current.element.dataset.pmStart != null && this.currentMapping.map(Number(current.element.dataset.pmStart)) !== newPmStart;
|
|
274393
274684
|
if (this.changedBlocks.has(fragment2.blockId) || current.signature !== fragmentSignature(fragment2, this.blockLookup) || sdtBoundaryMismatch || betweenBorderMismatch || mappingUnreliable) {
|
|
274394
|
-
const replacement = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenInfo);
|
|
274685
|
+
const replacement = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenInfo, resolvedItem);
|
|
274395
274686
|
pageEl.replaceChild(replacement, current.element);
|
|
274396
274687
|
current.element = replacement;
|
|
274397
274688
|
current.signature = fragmentSignature(fragment2, this.blockLookup);
|
|
274398
274689
|
} else if (this.currentMapping)
|
|
274399
274690
|
this.updatePositionAttributes(current.element, this.currentMapping);
|
|
274400
|
-
this.updateFragmentElement(current.element, fragment2, contextBase.section);
|
|
274691
|
+
this.updateFragmentElement(current.element, fragment2, contextBase.section, resolvedItem);
|
|
274401
274692
|
if (sdtBoundary?.widthOverride != null)
|
|
274402
274693
|
current.element.style.width = `${sdtBoundary.widthOverride}px`;
|
|
274403
274694
|
current.fragment = fragment2;
|
|
@@ -274406,7 +274697,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274406
274697
|
nextFragments.push(current);
|
|
274407
274698
|
return;
|
|
274408
274699
|
}
|
|
274409
|
-
const fresh = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenInfo);
|
|
274700
|
+
const fresh = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenInfo, resolvedItem);
|
|
274410
274701
|
pageEl.insertBefore(fresh, pageEl.children[index2] ?? null);
|
|
274411
274702
|
nextFragments.push({
|
|
274412
274703
|
key: key$1,
|
|
@@ -274473,7 +274764,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274473
274764
|
const betweenBorderFlags = computeBetweenBorderFlags(page.fragments, this.blockLookup);
|
|
274474
274765
|
const fragmentStates = page.fragments.map((fragment2, index2) => {
|
|
274475
274766
|
const sdtBoundary = sdtBoundaries.get(index2);
|
|
274476
|
-
const
|
|
274767
|
+
const resolvedItem = this.getResolvedFragmentItem(pageIndex, index2);
|
|
274768
|
+
const fragmentEl = this.renderFragment(fragment2, contextBase, sdtBoundary, betweenBorderFlags.get(index2), resolvedItem);
|
|
274477
274769
|
el.appendChild(fragmentEl);
|
|
274478
274770
|
return {
|
|
274479
274771
|
key: fragmentKey(fragment2),
|
|
@@ -274514,20 +274806,20 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274514
274806
|
};
|
|
274515
274807
|
return this.options.pageStyles;
|
|
274516
274808
|
}
|
|
274517
|
-
renderFragment(fragment2, context, sdtBoundary, betweenInfo) {
|
|
274809
|
+
renderFragment(fragment2, context, sdtBoundary, betweenInfo, resolvedItem) {
|
|
274518
274810
|
if (fragment2.kind === "para")
|
|
274519
|
-
return this.renderParagraphFragment(fragment2, context, sdtBoundary, betweenInfo);
|
|
274811
|
+
return this.renderParagraphFragment(fragment2, context, sdtBoundary, betweenInfo, resolvedItem);
|
|
274520
274812
|
if (fragment2.kind === "list-item")
|
|
274521
|
-
return this.renderListItemFragment(fragment2, context, sdtBoundary, betweenInfo);
|
|
274813
|
+
return this.renderListItemFragment(fragment2, context, sdtBoundary, betweenInfo, resolvedItem);
|
|
274522
274814
|
if (fragment2.kind === "image")
|
|
274523
|
-
return this.renderImageFragment(fragment2, context);
|
|
274815
|
+
return this.renderImageFragment(fragment2, context, resolvedItem);
|
|
274524
274816
|
if (fragment2.kind === "drawing")
|
|
274525
|
-
return this.renderDrawingFragment(fragment2, context);
|
|
274817
|
+
return this.renderDrawingFragment(fragment2, context, resolvedItem);
|
|
274526
274818
|
if (fragment2.kind === "table")
|
|
274527
|
-
return this.renderTableFragment(fragment2, context, sdtBoundary);
|
|
274819
|
+
return this.renderTableFragment(fragment2, context, sdtBoundary, resolvedItem);
|
|
274528
274820
|
throw new Error(`DomPainter: unsupported fragment kind ${fragment2.kind}`);
|
|
274529
274821
|
}
|
|
274530
|
-
renderParagraphFragment(fragment2, context, sdtBoundary, betweenInfo) {
|
|
274822
|
+
renderParagraphFragment(fragment2, context, sdtBoundary, betweenInfo, resolvedItem) {
|
|
274531
274823
|
try {
|
|
274532
274824
|
const lookup3 = this.blockLookup.get(fragment2.blockId);
|
|
274533
274825
|
if (!lookup3 || lookup3.block.kind !== "paragraph" || lookup3.measure.kind !== "paragraph")
|
|
@@ -274536,7 +274828,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274536
274828
|
throw new Error("DomPainter: document is not available");
|
|
274537
274829
|
const block = lookup3.block;
|
|
274538
274830
|
const measure = lookup3.measure;
|
|
274539
|
-
const wordLayout = isMinimalWordLayout(block.attrs?.wordLayout) ? block.attrs.wordLayout : undefined;
|
|
274831
|
+
const wordLayout = isMinimalWordLayout$1(block.attrs?.wordLayout) ? block.attrs.wordLayout : undefined;
|
|
274832
|
+
const content3 = resolvedItem?.content;
|
|
274540
274833
|
const fragmentEl = this.doc.createElement("div");
|
|
274541
274834
|
fragmentEl.classList.add(CLASS_NAMES$1.fragment);
|
|
274542
274835
|
const isTocEntry = block.attrs?.isTocEntry;
|
|
@@ -274551,7 +274844,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274551
274844
|
...fragmentStyles,
|
|
274552
274845
|
overflow: "visible"
|
|
274553
274846
|
} : fragmentStyles);
|
|
274554
|
-
|
|
274847
|
+
if (resolvedItem)
|
|
274848
|
+
this.applyResolvedFragmentFrame(fragmentEl, resolvedItem, fragment2, context.section);
|
|
274849
|
+
else
|
|
274850
|
+
this.applyFragmentFrame(fragmentEl, fragment2, context.section);
|
|
274555
274851
|
if (isTocEntry)
|
|
274556
274852
|
fragmentEl.classList.add("superdoc-toc-entry");
|
|
274557
274853
|
if (fragment2.continuesFromPrev)
|
|
@@ -274573,11 +274869,34 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274573
274869
|
this.applySdtDataset(fragmentEl, block.attrs?.sdt);
|
|
274574
274870
|
this.applyContainerSdtDataset(fragmentEl, block.attrs?.containerSdt);
|
|
274575
274871
|
applySdtContainerStyling(this.doc, fragmentEl, block.attrs?.sdt, block.attrs?.containerSdt, sdtBoundary);
|
|
274576
|
-
|
|
274577
|
-
|
|
274578
|
-
|
|
274579
|
-
|
|
274872
|
+
if (content3?.dropCap) {
|
|
274873
|
+
const dc = content3.dropCap;
|
|
274874
|
+
const dropCapEl = this.renderDropCap({
|
|
274875
|
+
mode: dc.mode,
|
|
274876
|
+
run: {
|
|
274877
|
+
text: dc.text,
|
|
274878
|
+
fontFamily: dc.fontFamily,
|
|
274879
|
+
fontSize: dc.fontSize,
|
|
274880
|
+
bold: dc.bold,
|
|
274881
|
+
italic: dc.italic,
|
|
274882
|
+
color: dc.color,
|
|
274883
|
+
position: dc.position
|
|
274884
|
+
},
|
|
274885
|
+
lines: 0
|
|
274886
|
+
}, dc.width != null && dc.height != null ? {
|
|
274887
|
+
width: dc.width,
|
|
274888
|
+
height: dc.height,
|
|
274889
|
+
lines: 0,
|
|
274890
|
+
mode: dc.mode
|
|
274891
|
+
} : undefined);
|
|
274580
274892
|
fragmentEl.appendChild(dropCapEl);
|
|
274893
|
+
} else {
|
|
274894
|
+
const dropCapDescriptor = block.attrs?.dropCapDescriptor;
|
|
274895
|
+
const dropCapMeasure = measure.dropCap;
|
|
274896
|
+
if (dropCapDescriptor && dropCapMeasure && !fragment2.continuesFromPrev) {
|
|
274897
|
+
const dropCapEl = this.renderDropCap(dropCapDescriptor, dropCapMeasure);
|
|
274898
|
+
fragmentEl.appendChild(dropCapEl);
|
|
274899
|
+
}
|
|
274581
274900
|
}
|
|
274582
274901
|
if (fragmentEl.style.paddingLeft)
|
|
274583
274902
|
fragmentEl.style.removeProperty("padding-left");
|
|
@@ -274589,139 +274908,210 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274589
274908
|
fragmentEl.style.removeProperty("margin-right");
|
|
274590
274909
|
if (fragmentEl.style.textIndent)
|
|
274591
274910
|
fragmentEl.style.removeProperty("text-indent");
|
|
274592
|
-
|
|
274593
|
-
|
|
274594
|
-
|
|
274595
|
-
|
|
274596
|
-
|
|
274597
|
-
|
|
274598
|
-
|
|
274599
|
-
|
|
274600
|
-
|
|
274601
|
-
|
|
274602
|
-
|
|
274603
|
-
|
|
274604
|
-
|
|
274605
|
-
wordLayout,
|
|
274606
|
-
indentLeftPx: paraIndentLeft,
|
|
274607
|
-
hangingIndentPx: paraIndent?.hanging ?? 0,
|
|
274608
|
-
firstLineIndentPx: paraIndent?.firstLine ?? 0,
|
|
274609
|
-
markerTextWidthPx: fragment2.markerTextWidth
|
|
274610
|
-
}) : undefined;
|
|
274611
|
-
let listTabWidth = 0;
|
|
274612
|
-
let markerStartPos = 0;
|
|
274613
|
-
if (!fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker) {
|
|
274614
|
-
const markerTextWidth = fragment2.markerTextWidth;
|
|
274615
|
-
const anchorPoint = paraIndentLeft - (paraIndent?.hanging ?? 0) + (paraIndent?.firstLine ?? 0);
|
|
274616
|
-
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
274617
|
-
let currentPos;
|
|
274618
|
-
if (markerJustification === "left") {
|
|
274619
|
-
markerStartPos = anchorPoint;
|
|
274620
|
-
currentPos = markerStartPos + markerTextWidth;
|
|
274621
|
-
} else if (markerJustification === "right") {
|
|
274622
|
-
markerStartPos = anchorPoint - markerTextWidth;
|
|
274623
|
-
currentPos = anchorPoint;
|
|
274624
|
-
} else {
|
|
274625
|
-
markerStartPos = anchorPoint - markerTextWidth / 2;
|
|
274626
|
-
currentPos = markerStartPos + markerTextWidth;
|
|
274627
|
-
}
|
|
274628
|
-
const suffix = wordLayout.marker.suffix ?? "tab";
|
|
274629
|
-
if (listFirstLineMarkerGeometry && (suffix === "tab" || suffix === "space"))
|
|
274630
|
-
listTabWidth = listFirstLineMarkerGeometry.suffixWidthPx;
|
|
274631
|
-
else if (suffix === "tab")
|
|
274632
|
-
listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, paraIndent?.hanging, paraIndent?.firstLine, paraIndentLeft);
|
|
274633
|
-
else if (suffix === "space")
|
|
274634
|
-
listTabWidth = 4;
|
|
274635
|
-
}
|
|
274636
|
-
lines.forEach((line, index2) => {
|
|
274637
|
-
const hasExplicitSegmentPositioning = line.segments?.some((segment) => segment.x !== undefined) === true;
|
|
274638
|
-
const hasListFirstLineMarker = index2 === 0 && !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker;
|
|
274639
|
-
const shouldUseResolvedListTextStart = hasListFirstLineMarker && hasExplicitSegmentPositioning && listFirstLineTextStartPx != null;
|
|
274640
|
-
const positiveIndentReduction = Math.max(0, paraIndentLeft) + Math.max(0, paraIndentRight);
|
|
274641
|
-
const fallbackAvailableWidth = Math.max(0, fragment2.width - positiveIndentReduction);
|
|
274642
|
-
let availableWidthOverride = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
|
|
274643
|
-
if (shouldUseResolvedListTextStart)
|
|
274644
|
-
availableWidthOverride = fragment2.width - listFirstLineTextStartPx - Math.max(0, paraIndentRight);
|
|
274645
|
-
const shouldSkipJustifyForLastLine = index2 === lines.length - 1 && !fragment2.continuesOnNext && !paragraphEndsWithLineBreak;
|
|
274646
|
-
const lineEl = this.renderLine(block, line, context, availableWidthOverride, fragment2.fromLine + index2, shouldSkipJustifyForLastLine, shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined);
|
|
274647
|
-
const isListFirstLine = Boolean(hasListFirstLineMarker && fragment2.markerTextWidth);
|
|
274648
|
-
const isFirstLine = index2 === 0 && !fragment2.continuesFromPrev;
|
|
274649
|
-
if (!isListFirstLine) {
|
|
274650
|
-
if (hasExplicitSegmentPositioning) {
|
|
274651
|
-
if (isFirstLine && firstLineOffset !== 0) {
|
|
274652
|
-
const adjustedPadding = (paraIndentLeft < 0 ? 0 : paraIndentLeft) + firstLineOffset;
|
|
274653
|
-
if (adjustedPadding > 0)
|
|
274654
|
-
lineEl.style.paddingLeft = `${adjustedPadding}px`;
|
|
274911
|
+
if (content3) {
|
|
274912
|
+
const resolvedMarker = content3.marker;
|
|
274913
|
+
content3.lines.forEach((resolvedLine) => {
|
|
274914
|
+
const lineEl = this.renderLine(block, resolvedLine.line, context, resolvedLine.availableWidth, resolvedLine.lineIndex, resolvedLine.skipJustify, resolvedLine.resolvedListTextStartPx, resolvedLine.indentOffset);
|
|
274915
|
+
if (!resolvedLine.isListFirstLine) {
|
|
274916
|
+
if (resolvedLine.paddingLeftPx > 0)
|
|
274917
|
+
lineEl.style.paddingLeft = `${resolvedLine.paddingLeftPx}px`;
|
|
274918
|
+
if (resolvedLine.textIndentPx !== 0)
|
|
274919
|
+
lineEl.style.textIndent = `${resolvedLine.textIndentPx}px`;
|
|
274920
|
+
else if (resolvedLine.lineIndex > 0 || content3.continuesFromPrev) {
|
|
274921
|
+
const paraIndent = block.attrs?.indent;
|
|
274922
|
+
if ((block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0)) && !resolvedLine.isListFirstLine)
|
|
274923
|
+
lineEl.style.textIndent = "0px";
|
|
274655
274924
|
}
|
|
274656
|
-
}
|
|
274657
|
-
|
|
274658
|
-
|
|
274659
|
-
|
|
274660
|
-
|
|
274661
|
-
|
|
274662
|
-
|
|
274663
|
-
|
|
274664
|
-
|
|
274665
|
-
|
|
274666
|
-
|
|
274667
|
-
|
|
274668
|
-
|
|
274669
|
-
|
|
274670
|
-
|
|
274671
|
-
|
|
274672
|
-
|
|
274673
|
-
|
|
274674
|
-
|
|
274675
|
-
|
|
274676
|
-
|
|
274677
|
-
|
|
274678
|
-
|
|
274679
|
-
|
|
274680
|
-
|
|
274681
|
-
|
|
274682
|
-
|
|
274683
|
-
|
|
274684
|
-
|
|
274685
|
-
|
|
274686
|
-
|
|
274687
|
-
|
|
274688
|
-
|
|
274689
|
-
|
|
274925
|
+
}
|
|
274926
|
+
if (resolvedLine.paddingRightPx > 0)
|
|
274927
|
+
lineEl.style.paddingRight = `${resolvedLine.paddingRightPx}px`;
|
|
274928
|
+
if (resolvedLine.isListFirstLine && resolvedMarker) {
|
|
274929
|
+
lineEl.style.paddingLeft = `${resolvedMarker.firstLinePaddingLeftPx}px`;
|
|
274930
|
+
if (!resolvedMarker.vanish) {
|
|
274931
|
+
const markerContainer = this.doc.createElement("span");
|
|
274932
|
+
markerContainer.style.display = "inline-block";
|
|
274933
|
+
markerContainer.style.wordSpacing = "0px";
|
|
274934
|
+
const markerEl = this.doc.createElement("span");
|
|
274935
|
+
markerEl.classList.add("superdoc-paragraph-marker");
|
|
274936
|
+
markerEl.textContent = resolvedMarker.text;
|
|
274937
|
+
markerEl.style.pointerEvents = "none";
|
|
274938
|
+
markerContainer.style.position = "relative";
|
|
274939
|
+
if (resolvedMarker.justification === "right") {
|
|
274940
|
+
markerContainer.style.position = "absolute";
|
|
274941
|
+
markerContainer.style.left = `${resolvedMarker.markerStartPx}px`;
|
|
274942
|
+
} else if (resolvedMarker.justification === "center") {
|
|
274943
|
+
markerContainer.style.position = "absolute";
|
|
274944
|
+
markerContainer.style.left = `${resolvedMarker.markerStartPx - (resolvedMarker.centerPaddingAdjustPx ?? 0)}px`;
|
|
274945
|
+
lineEl.style.paddingLeft = parseFloat(lineEl.style.paddingLeft) + (resolvedMarker.centerPaddingAdjustPx ?? 0) + "px";
|
|
274946
|
+
}
|
|
274947
|
+
markerEl.style.fontFamily = toCssFontFamily(resolvedMarker.run.fontFamily) ?? resolvedMarker.run.fontFamily;
|
|
274948
|
+
markerEl.style.fontSize = `${resolvedMarker.run.fontSize}px`;
|
|
274949
|
+
markerEl.style.fontWeight = resolvedMarker.run.bold ? "bold" : "";
|
|
274950
|
+
markerEl.style.fontStyle = resolvedMarker.run.italic ? "italic" : "";
|
|
274951
|
+
if (resolvedMarker.run.color)
|
|
274952
|
+
markerEl.style.color = resolvedMarker.run.color;
|
|
274953
|
+
if (resolvedMarker.run.letterSpacing != null)
|
|
274954
|
+
markerEl.style.letterSpacing = `${resolvedMarker.run.letterSpacing}px`;
|
|
274955
|
+
markerContainer.appendChild(markerEl);
|
|
274956
|
+
if (resolvedMarker.suffix === "tab") {
|
|
274957
|
+
const tabEl = this.doc.createElement("span");
|
|
274958
|
+
tabEl.className = "superdoc-tab";
|
|
274959
|
+
tabEl.innerHTML = " ";
|
|
274960
|
+
tabEl.style.display = "inline-block";
|
|
274961
|
+
tabEl.style.wordSpacing = "0px";
|
|
274962
|
+
tabEl.style.width = `${resolvedMarker.suffixWidthPx}px`;
|
|
274963
|
+
lineEl.prepend(tabEl);
|
|
274964
|
+
} else if (resolvedMarker.suffix === "space") {
|
|
274965
|
+
const spaceEl = this.doc.createElement("span");
|
|
274966
|
+
spaceEl.classList.add("superdoc-marker-suffix-space");
|
|
274967
|
+
spaceEl.style.wordSpacing = "0px";
|
|
274968
|
+
spaceEl.textContent = " ";
|
|
274969
|
+
lineEl.prepend(spaceEl);
|
|
274970
|
+
}
|
|
274971
|
+
lineEl.prepend(markerContainer);
|
|
274690
274972
|
}
|
|
274691
|
-
|
|
274692
|
-
|
|
274693
|
-
|
|
274694
|
-
|
|
274695
|
-
|
|
274696
|
-
|
|
274697
|
-
|
|
274698
|
-
|
|
274699
|
-
|
|
274700
|
-
|
|
274701
|
-
|
|
274702
|
-
|
|
274703
|
-
|
|
274704
|
-
|
|
274705
|
-
|
|
274706
|
-
|
|
274707
|
-
|
|
274708
|
-
|
|
274709
|
-
|
|
274710
|
-
|
|
274711
|
-
|
|
274712
|
-
|
|
274713
|
-
|
|
274714
|
-
|
|
274973
|
+
}
|
|
274974
|
+
this.capturePaintSnapshotLine(lineEl, context, {
|
|
274975
|
+
inTableFragment: false,
|
|
274976
|
+
inTableParagraph: false
|
|
274977
|
+
});
|
|
274978
|
+
fragmentEl.appendChild(lineEl);
|
|
274979
|
+
});
|
|
274980
|
+
} else {
|
|
274981
|
+
const paraIndent = block.attrs?.indent;
|
|
274982
|
+
const paraIndentLeft = paraIndent?.left ?? 0;
|
|
274983
|
+
const paraIndentRight = paraIndent?.right ?? 0;
|
|
274984
|
+
const firstLineOffset = block.attrs?.suppressFirstLineIndent === true ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
|
|
274985
|
+
const paragraphEndsWithLineBreak = (block.runs.length > 0 ? block.runs[block.runs.length - 1] : null)?.kind === "lineBreak";
|
|
274986
|
+
const listFirstLineTextStartPx = !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker ? resolvePainterListTextStartPx({
|
|
274987
|
+
wordLayout,
|
|
274988
|
+
indentLeftPx: paraIndentLeft,
|
|
274989
|
+
hangingIndentPx: paraIndent?.hanging ?? 0,
|
|
274990
|
+
firstLineIndentPx: paraIndent?.firstLine ?? 0,
|
|
274991
|
+
markerTextWidthPx: fragment2.markerTextWidth
|
|
274992
|
+
}) : undefined;
|
|
274993
|
+
const listFirstLineMarkerGeometry = !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker?.justification === "left" && wordLayout.firstLineIndentMode !== true && typeof fragment2.markerTextWidth === "number" && Number.isFinite(fragment2.markerTextWidth) && fragment2.markerTextWidth >= 0 ? resolvePainterListMarkerGeometry({
|
|
274994
|
+
wordLayout,
|
|
274995
|
+
indentLeftPx: paraIndentLeft,
|
|
274996
|
+
hangingIndentPx: paraIndent?.hanging ?? 0,
|
|
274997
|
+
firstLineIndentPx: paraIndent?.firstLine ?? 0,
|
|
274998
|
+
markerTextWidthPx: fragment2.markerTextWidth
|
|
274999
|
+
}) : undefined;
|
|
275000
|
+
let listTabWidth = 0;
|
|
275001
|
+
let markerStartPos = 0;
|
|
275002
|
+
if (!fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker) {
|
|
275003
|
+
const markerTextWidth = fragment2.markerTextWidth;
|
|
275004
|
+
const anchorPoint = paraIndentLeft - (paraIndent?.hanging ?? 0) + (paraIndent?.firstLine ?? 0);
|
|
275005
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
275006
|
+
let currentPos;
|
|
275007
|
+
if (markerJustification === "left") {
|
|
275008
|
+
markerStartPos = anchorPoint;
|
|
275009
|
+
currentPos = markerStartPos + markerTextWidth;
|
|
275010
|
+
} else if (markerJustification === "right") {
|
|
275011
|
+
markerStartPos = anchorPoint - markerTextWidth;
|
|
275012
|
+
currentPos = anchorPoint;
|
|
275013
|
+
} else {
|
|
275014
|
+
markerStartPos = anchorPoint - markerTextWidth / 2;
|
|
275015
|
+
currentPos = markerStartPos + markerTextWidth;
|
|
275016
|
+
}
|
|
275017
|
+
const suffix = wordLayout.marker.suffix ?? "tab";
|
|
275018
|
+
if (listFirstLineMarkerGeometry && (suffix === "tab" || suffix === "space"))
|
|
275019
|
+
listTabWidth = listFirstLineMarkerGeometry.suffixWidthPx;
|
|
275020
|
+
else if (suffix === "tab")
|
|
275021
|
+
listTabWidth = computeTabWidth(currentPos, markerJustification, wordLayout.tabsPx, paraIndent?.hanging, paraIndent?.firstLine, paraIndentLeft);
|
|
275022
|
+
else if (suffix === "space")
|
|
275023
|
+
listTabWidth = 4;
|
|
275024
|
+
}
|
|
275025
|
+
lines.forEach((line, index2) => {
|
|
275026
|
+
const hasExplicitSegmentPositioning = line.segments?.some((segment) => segment.x !== undefined) === true;
|
|
275027
|
+
const hasListFirstLineMarker = index2 === 0 && !fragment2.continuesFromPrev && fragment2.markerWidth && wordLayout?.marker;
|
|
275028
|
+
const shouldUseResolvedListTextStart = hasListFirstLineMarker && hasExplicitSegmentPositioning && listFirstLineTextStartPx != null;
|
|
275029
|
+
const positiveIndentReduction = Math.max(0, paraIndentLeft) + Math.max(0, paraIndentRight);
|
|
275030
|
+
const fallbackAvailableWidth = Math.max(0, fragment2.width - positiveIndentReduction);
|
|
275031
|
+
let availableWidthOverride = line.maxWidth != null ? Math.min(line.maxWidth, fallbackAvailableWidth) : fallbackAvailableWidth;
|
|
275032
|
+
if (shouldUseResolvedListTextStart)
|
|
275033
|
+
availableWidthOverride = fragment2.width - listFirstLineTextStartPx - Math.max(0, paraIndentRight);
|
|
275034
|
+
const shouldSkipJustifyForLastLine = index2 === lines.length - 1 && !fragment2.continuesOnNext && !paragraphEndsWithLineBreak;
|
|
275035
|
+
const lineEl = this.renderLine(block, line, context, availableWidthOverride, fragment2.fromLine + index2, shouldSkipJustifyForLastLine, shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined);
|
|
275036
|
+
const isListFirstLine = Boolean(hasListFirstLineMarker && fragment2.markerTextWidth);
|
|
275037
|
+
const isFirstLine = index2 === 0 && !fragment2.continuesFromPrev;
|
|
275038
|
+
if (!isListFirstLine) {
|
|
275039
|
+
if (hasExplicitSegmentPositioning) {
|
|
275040
|
+
if (isFirstLine && firstLineOffset !== 0) {
|
|
275041
|
+
const adjustedPadding = (paraIndentLeft < 0 ? 0 : paraIndentLeft) + firstLineOffset;
|
|
275042
|
+
if (adjustedPadding > 0)
|
|
275043
|
+
lineEl.style.paddingLeft = `${adjustedPadding}px`;
|
|
275044
|
+
}
|
|
275045
|
+
} else if (paraIndentLeft && paraIndentLeft > 0)
|
|
275046
|
+
lineEl.style.paddingLeft = `${paraIndentLeft}px`;
|
|
275047
|
+
else if (!isFirstLine && paraIndent?.hanging && paraIndent.hanging > 0 && !(paraIndentLeft != null && paraIndentLeft < 0))
|
|
275048
|
+
lineEl.style.paddingLeft = `${paraIndent.hanging}px`;
|
|
275049
|
+
}
|
|
275050
|
+
if (paraIndentRight && paraIndentRight > 0)
|
|
275051
|
+
lineEl.style.paddingRight = `${paraIndentRight}px`;
|
|
275052
|
+
if (!fragment2.continuesFromPrev && index2 === 0 && firstLineOffset && !isListFirstLine) {
|
|
275053
|
+
if (!hasExplicitSegmentPositioning)
|
|
275054
|
+
lineEl.style.textIndent = `${firstLineOffset}px`;
|
|
275055
|
+
} else if (firstLineOffset && !isListFirstLine)
|
|
275056
|
+
lineEl.style.textIndent = "0px";
|
|
275057
|
+
if (isListFirstLine) {
|
|
275058
|
+
const marker = wordLayout?.marker;
|
|
275059
|
+
if (!marker)
|
|
275060
|
+
return;
|
|
275061
|
+
lineEl.style.paddingLeft = `${paraIndentLeft + (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0)}px`;
|
|
275062
|
+
if (!marker.run.vanish) {
|
|
275063
|
+
const markerContainer = this.doc.createElement("span");
|
|
275064
|
+
markerContainer.style.display = "inline-block";
|
|
275065
|
+
markerContainer.style.wordSpacing = "0px";
|
|
275066
|
+
const markerEl = this.doc.createElement("span");
|
|
275067
|
+
markerEl.classList.add("superdoc-paragraph-marker");
|
|
275068
|
+
markerEl.textContent = marker.markerText ?? "";
|
|
275069
|
+
markerEl.style.pointerEvents = "none";
|
|
275070
|
+
const markerJustification = marker.justification ?? "left";
|
|
275071
|
+
markerContainer.style.position = "relative";
|
|
275072
|
+
if (markerJustification === "right") {
|
|
275073
|
+
markerContainer.style.position = "absolute";
|
|
275074
|
+
markerContainer.style.left = `${markerStartPos}px`;
|
|
275075
|
+
} else if (markerJustification === "center") {
|
|
275076
|
+
markerContainer.style.position = "absolute";
|
|
275077
|
+
markerContainer.style.left = `${markerStartPos - fragment2.markerTextWidth / 2}px`;
|
|
275078
|
+
lineEl.style.paddingLeft = parseFloat(lineEl.style.paddingLeft) + fragment2.markerTextWidth / 2 + "px";
|
|
275079
|
+
}
|
|
275080
|
+
markerEl.style.fontFamily = toCssFontFamily(marker.run.fontFamily) ?? marker.run.fontFamily;
|
|
275081
|
+
markerEl.style.fontSize = `${marker.run.fontSize}px`;
|
|
275082
|
+
markerEl.style.fontWeight = marker.run.bold ? "bold" : "";
|
|
275083
|
+
markerEl.style.fontStyle = marker.run.italic ? "italic" : "";
|
|
275084
|
+
if (marker.run.color)
|
|
275085
|
+
markerEl.style.color = marker.run.color;
|
|
275086
|
+
if (marker.run.letterSpacing != null)
|
|
275087
|
+
markerEl.style.letterSpacing = `${marker.run.letterSpacing}px`;
|
|
275088
|
+
markerContainer.appendChild(markerEl);
|
|
275089
|
+
const suffix = marker.suffix ?? "tab";
|
|
275090
|
+
if (suffix === "tab") {
|
|
275091
|
+
const tabEl = this.doc.createElement("span");
|
|
275092
|
+
tabEl.className = "superdoc-tab";
|
|
275093
|
+
tabEl.innerHTML = " ";
|
|
275094
|
+
tabEl.style.display = "inline-block";
|
|
275095
|
+
tabEl.style.wordSpacing = "0px";
|
|
275096
|
+
tabEl.style.width = `${listTabWidth}px`;
|
|
275097
|
+
lineEl.prepend(tabEl);
|
|
275098
|
+
} else if (suffix === "space") {
|
|
275099
|
+
const spaceEl = this.doc.createElement("span");
|
|
275100
|
+
spaceEl.classList.add("superdoc-marker-suffix-space");
|
|
275101
|
+
spaceEl.style.wordSpacing = "0px";
|
|
275102
|
+
spaceEl.textContent = " ";
|
|
275103
|
+
lineEl.prepend(spaceEl);
|
|
275104
|
+
}
|
|
275105
|
+
lineEl.prepend(markerContainer);
|
|
274715
275106
|
}
|
|
274716
|
-
lineEl.prepend(markerContainer);
|
|
274717
275107
|
}
|
|
274718
|
-
|
|
274719
|
-
|
|
274720
|
-
|
|
274721
|
-
|
|
275108
|
+
this.capturePaintSnapshotLine(lineEl, context, {
|
|
275109
|
+
inTableFragment: false,
|
|
275110
|
+
inTableParagraph: false
|
|
275111
|
+
});
|
|
275112
|
+
fragmentEl.appendChild(lineEl);
|
|
274722
275113
|
});
|
|
274723
|
-
|
|
274724
|
-
});
|
|
275114
|
+
}
|
|
274725
275115
|
return fragmentEl;
|
|
274726
275116
|
} catch (error3) {
|
|
274727
275117
|
console.error("[DomPainter] Fragment rendering failed:", {
|
|
@@ -274780,7 +275170,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274780
275170
|
}
|
|
274781
275171
|
return dropCapEl;
|
|
274782
275172
|
}
|
|
274783
|
-
renderListItemFragment(fragment2, context, sdtBoundary, betweenInfo) {
|
|
275173
|
+
renderListItemFragment(fragment2, context, sdtBoundary, betweenInfo, resolvedItem) {
|
|
274784
275174
|
try {
|
|
274785
275175
|
const lookup3 = this.blockLookup.get(fragment2.blockId);
|
|
274786
275176
|
if (!lookup3 || lookup3.block.kind !== "list" || lookup3.measure.kind !== "list")
|
|
@@ -274796,10 +275186,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274796
275186
|
const fragmentEl = this.doc.createElement("div");
|
|
274797
275187
|
fragmentEl.classList.add(CLASS_NAMES$1.fragment, `${CLASS_NAMES$1.fragment}-list-item`);
|
|
274798
275188
|
applyStyles(fragmentEl, fragmentStyles);
|
|
274799
|
-
|
|
274800
|
-
|
|
274801
|
-
|
|
274802
|
-
|
|
275189
|
+
if (resolvedItem)
|
|
275190
|
+
this.applyResolvedListItemWrapperFrame(fragmentEl, fragment2, resolvedItem, context.section);
|
|
275191
|
+
else {
|
|
275192
|
+
fragmentEl.style.left = `${fragment2.x - fragment2.markerWidth}px`;
|
|
275193
|
+
fragmentEl.style.top = `${fragment2.y}px`;
|
|
275194
|
+
fragmentEl.style.width = `${fragment2.markerWidth + fragment2.width}px`;
|
|
275195
|
+
fragmentEl.dataset.blockId = fragment2.blockId;
|
|
275196
|
+
}
|
|
274803
275197
|
fragmentEl.dataset.itemId = fragment2.itemId;
|
|
274804
275198
|
const paragraphMetadata = item.paragraph.attrs?.sdt;
|
|
274805
275199
|
this.applySdtDataset(fragmentEl, paragraphMetadata);
|
|
@@ -274878,7 +275272,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274878
275272
|
return this.createErrorPlaceholder(fragment2.blockId, error3);
|
|
274879
275273
|
}
|
|
274880
275274
|
}
|
|
274881
|
-
renderImageFragment(fragment2, context) {
|
|
275275
|
+
renderImageFragment(fragment2, context, resolvedItem) {
|
|
274882
275276
|
try {
|
|
274883
275277
|
const lookup3 = this.blockLookup.get(fragment2.blockId);
|
|
274884
275278
|
if (!lookup3 || lookup3.block.kind !== "image" || lookup3.measure.kind !== "image")
|
|
@@ -274889,12 +275283,15 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274889
275283
|
const fragmentEl = this.doc.createElement("div");
|
|
274890
275284
|
fragmentEl.classList.add(CLASS_NAMES$1.fragment, DOM_CLASS_NAMES.IMAGE_FRAGMENT);
|
|
274891
275285
|
applyStyles(fragmentEl, fragmentStyles);
|
|
274892
|
-
|
|
274893
|
-
|
|
275286
|
+
if (resolvedItem)
|
|
275287
|
+
this.applyResolvedFragmentFrame(fragmentEl, resolvedItem, fragment2, context.section);
|
|
275288
|
+
else {
|
|
275289
|
+
this.applyFragmentFrame(fragmentEl, fragment2, context.section);
|
|
275290
|
+
fragmentEl.style.height = `${fragment2.height}px`;
|
|
275291
|
+
this.applyFragmentWrapperZIndex(fragmentEl, fragment2);
|
|
275292
|
+
}
|
|
274894
275293
|
this.applySdtDataset(fragmentEl, block.attrs?.sdt);
|
|
274895
275294
|
this.applyContainerSdtDataset(fragmentEl, block.attrs?.containerSdt);
|
|
274896
|
-
if (fragment2.isAnchored && fragment2.zIndex != null)
|
|
274897
|
-
fragmentEl.style.zIndex = String(fragment2.zIndex);
|
|
274898
275295
|
if (block.id)
|
|
274899
275296
|
fragmentEl.setAttribute("data-sd-block-id", block.id);
|
|
274900
275297
|
if (fragment2.pmStart != null)
|
|
@@ -274947,7 +275344,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274947
275344
|
return this.createErrorPlaceholder(fragment2.blockId, error3);
|
|
274948
275345
|
}
|
|
274949
275346
|
}
|
|
274950
|
-
renderDrawingFragment(fragment2, context) {
|
|
275347
|
+
renderDrawingFragment(fragment2, context, resolvedItem) {
|
|
274951
275348
|
try {
|
|
274952
275349
|
const lookup3 = this.blockLookup.get(fragment2.blockId);
|
|
274953
275350
|
if (!lookup3 || lookup3.block.kind !== "drawing" || lookup3.measure.kind !== "drawing")
|
|
@@ -274959,12 +275356,15 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
274959
275356
|
const fragmentEl = this.doc.createElement("div");
|
|
274960
275357
|
fragmentEl.classList.add(CLASS_NAMES$1.fragment, "superdoc-drawing-fragment");
|
|
274961
275358
|
applyStyles(fragmentEl, fragmentStyles);
|
|
274962
|
-
|
|
274963
|
-
|
|
275359
|
+
if (resolvedItem)
|
|
275360
|
+
this.applyResolvedFragmentFrame(fragmentEl, resolvedItem, fragment2, context.section);
|
|
275361
|
+
else {
|
|
275362
|
+
this.applyFragmentFrame(fragmentEl, fragment2, context.section);
|
|
275363
|
+
fragmentEl.style.height = `${fragment2.height}px`;
|
|
275364
|
+
this.applyFragmentWrapperZIndex(fragmentEl, fragment2);
|
|
275365
|
+
}
|
|
274964
275366
|
fragmentEl.style.position = "absolute";
|
|
274965
275367
|
fragmentEl.style.overflow = "hidden";
|
|
274966
|
-
if (fragment2.isAnchored && fragment2.zIndex != null)
|
|
274967
|
-
fragmentEl.style.zIndex = String(fragment2.zIndex);
|
|
274968
275368
|
const innerWrapper = this.doc.createElement("div");
|
|
274969
275369
|
innerWrapper.classList.add("superdoc-drawing-inner");
|
|
274970
275370
|
innerWrapper.style.position = "absolute";
|
|
@@ -275504,11 +275904,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
275504
275904
|
createChartElement(block) {
|
|
275505
275905
|
return createChartElement(this.doc, block.chartData, block.geometry);
|
|
275506
275906
|
}
|
|
275507
|
-
renderTableFragment(fragment2, context, sdtBoundary) {
|
|
275907
|
+
renderTableFragment(fragment2, context, sdtBoundary, resolvedItem) {
|
|
275508
275908
|
if (!this.doc)
|
|
275509
275909
|
throw new Error("DomPainter: document is not available");
|
|
275510
|
-
const applyFragmentFrameWithSection = (el, frag) => {
|
|
275511
|
-
this.applyFragmentFrame(el, frag, context.section);
|
|
275910
|
+
const applyFragmentFrameWithSection = (el$1, frag) => {
|
|
275911
|
+
this.applyFragmentFrame(el$1, frag, context.section);
|
|
275512
275912
|
};
|
|
275513
275913
|
const renderLineForTableCell = (block, line, ctx$1, lineIndex, isLastLine, resolvedListTextStartPx) => {
|
|
275514
275914
|
const paragraphEndsWithLineBreak = (block.runs.length > 0 ? block.runs[block.runs.length - 1] : null)?.kind === "lineBreak";
|
|
@@ -275526,7 +275926,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
275526
275926
|
return this.createChartElement(block);
|
|
275527
275927
|
return this.createDrawingPlaceholder();
|
|
275528
275928
|
};
|
|
275529
|
-
|
|
275929
|
+
const el = renderTableFragment({
|
|
275530
275930
|
doc: this.doc,
|
|
275531
275931
|
fragment: fragment2,
|
|
275532
275932
|
context,
|
|
@@ -275546,6 +275946,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
275546
275946
|
applyContainerSdtDataset: this.applyContainerSdtDataset.bind(this),
|
|
275547
275947
|
applyStyles
|
|
275548
275948
|
});
|
|
275949
|
+
if (resolvedItem)
|
|
275950
|
+
this.applyResolvedFragmentFrame(el, resolvedItem, fragment2, context.section);
|
|
275951
|
+
return el;
|
|
275549
275952
|
}
|
|
275550
275953
|
extractLinkData(run2) {
|
|
275551
275954
|
if (run2.kind === "tab" || run2.kind === "image" || run2.kind === "lineBreak" || run2.kind === "math")
|
|
@@ -276126,7 +276529,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
276126
276529
|
annotation.style.position = "relative";
|
|
276127
276530
|
annotation.appendChild(caretAnchor);
|
|
276128
276531
|
}
|
|
276129
|
-
renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify, resolvedListTextStartPx) {
|
|
276532
|
+
renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify, resolvedListTextStartPx, indentOffsetOverride) {
|
|
276130
276533
|
if (!this.doc)
|
|
276131
276534
|
throw new Error("DomPainter: document is not available");
|
|
276132
276535
|
const lineRange = computeLinePmRange$1(block, line);
|
|
@@ -276338,17 +276741,22 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
276338
276741
|
if (spacingPerSpace !== 0)
|
|
276339
276742
|
el.style.wordSpacing = `${spacingPerSpace}px`;
|
|
276340
276743
|
if (shouldUseSegmentPositioning(hasExplicitPositioning ?? false, Boolean(line.segments), isRtl)) {
|
|
276341
|
-
|
|
276342
|
-
|
|
276343
|
-
|
|
276344
|
-
|
|
276345
|
-
|
|
276346
|
-
|
|
276347
|
-
|
|
276348
|
-
|
|
276349
|
-
|
|
276350
|
-
|
|
276351
|
-
|
|
276744
|
+
let indentOffset;
|
|
276745
|
+
if (indentOffsetOverride != null)
|
|
276746
|
+
indentOffset = indentOffsetOverride;
|
|
276747
|
+
else {
|
|
276748
|
+
const paraIndent = block.attrs?.indent;
|
|
276749
|
+
const indentLeft = paraIndent?.left ?? 0;
|
|
276750
|
+
const firstLine = paraIndent?.firstLine ?? 0;
|
|
276751
|
+
const hanging = paraIndent?.hanging ?? 0;
|
|
276752
|
+
const isFirstLineOfPara = lineIndex === 0 || lineIndex === undefined;
|
|
276753
|
+
const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
|
|
276754
|
+
const wordLayoutValue = block.attrs?.wordLayout;
|
|
276755
|
+
const wordLayout = isMinimalWordLayout$1(wordLayoutValue) ? wordLayoutValue : undefined;
|
|
276756
|
+
const isListParagraph = Boolean(wordLayout?.marker);
|
|
276757
|
+
const fallbackListTextStartPx = typeof wordLayout?.marker?.textStartX === "number" && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
|
|
276758
|
+
indentOffset = isListParagraph ? isFirstLineOfPara ? resolvedListTextStartPx ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
|
|
276759
|
+
}
|
|
276352
276760
|
let cumulativeX = 0;
|
|
276353
276761
|
const segments = line.segments;
|
|
276354
276762
|
const segmentsByRun = /* @__PURE__ */ new Map;
|
|
@@ -276633,12 +277041,20 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
276633
277041
|
if (this.activeCommentId && meta2.id === this.activeCommentId)
|
|
276634
277042
|
elem.classList.add(TRACK_CHANGE_FOCUSED_CLASS);
|
|
276635
277043
|
}
|
|
276636
|
-
updateFragmentElement(el, fragment2, section) {
|
|
276637
|
-
|
|
276638
|
-
|
|
276639
|
-
|
|
276640
|
-
|
|
276641
|
-
|
|
277044
|
+
updateFragmentElement(el, fragment2, section, resolvedItem) {
|
|
277045
|
+
if (fragment2.kind === "list-item" && resolvedItem) {
|
|
277046
|
+
this.applyResolvedListItemWrapperFrame(el, fragment2, resolvedItem, section);
|
|
277047
|
+
return;
|
|
277048
|
+
}
|
|
277049
|
+
if (resolvedItem)
|
|
277050
|
+
this.applyResolvedFragmentFrame(el, resolvedItem, fragment2, section);
|
|
277051
|
+
else {
|
|
277052
|
+
this.applyFragmentFrame(el, fragment2, section);
|
|
277053
|
+
if (fragment2.kind === "image" || fragment2.kind === "drawing") {
|
|
277054
|
+
el.style.height = `${fragment2.height}px`;
|
|
277055
|
+
this.applyFragmentWrapperZIndex(el, fragment2);
|
|
277056
|
+
}
|
|
277057
|
+
}
|
|
276642
277058
|
}
|
|
276643
277059
|
applyFragmentFrame(el, fragment2, section) {
|
|
276644
277060
|
el.style.left = `${fragment2.x}px`;
|
|
@@ -276669,6 +277085,58 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
276669
277085
|
delete el.dataset.continuesOnNext;
|
|
276670
277086
|
}
|
|
276671
277087
|
}
|
|
277088
|
+
applyFragmentPmAttributes(el, fragment2, section) {
|
|
277089
|
+
if (typeof fragment2.blockId === "string" && fragment2.blockId.startsWith("footnote-"))
|
|
277090
|
+
el.setAttribute("contenteditable", "false");
|
|
277091
|
+
if (fragment2.kind === "para") {
|
|
277092
|
+
if (section === "body" || section === undefined)
|
|
277093
|
+
assertFragmentPmPositions(fragment2, "paragraph fragment");
|
|
277094
|
+
if (fragment2.pmStart != null)
|
|
277095
|
+
el.dataset.pmStart = String(fragment2.pmStart);
|
|
277096
|
+
else
|
|
277097
|
+
delete el.dataset.pmStart;
|
|
277098
|
+
if (fragment2.pmEnd != null)
|
|
277099
|
+
el.dataset.pmEnd = String(fragment2.pmEnd);
|
|
277100
|
+
else
|
|
277101
|
+
delete el.dataset.pmEnd;
|
|
277102
|
+
if (fragment2.continuesFromPrev)
|
|
277103
|
+
el.dataset.continuesFromPrev = "true";
|
|
277104
|
+
else
|
|
277105
|
+
delete el.dataset.continuesFromPrev;
|
|
277106
|
+
if (fragment2.continuesOnNext)
|
|
277107
|
+
el.dataset.continuesOnNext = "true";
|
|
277108
|
+
else
|
|
277109
|
+
delete el.dataset.continuesOnNext;
|
|
277110
|
+
}
|
|
277111
|
+
}
|
|
277112
|
+
isAnchoredMediaFragment(fragment2) {
|
|
277113
|
+
return (fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true;
|
|
277114
|
+
}
|
|
277115
|
+
resolveFragmentWrapperZIndex(fragment2, resolvedZIndex) {
|
|
277116
|
+
if (!this.isAnchoredMediaFragment(fragment2))
|
|
277117
|
+
return "";
|
|
277118
|
+
const zIndex = resolvedZIndex ?? fragment2.zIndex;
|
|
277119
|
+
return zIndex != null ? String(zIndex) : "";
|
|
277120
|
+
}
|
|
277121
|
+
applyFragmentWrapperZIndex(el, fragment2, resolvedZIndex) {
|
|
277122
|
+
el.style.zIndex = this.resolveFragmentWrapperZIndex(fragment2, resolvedZIndex);
|
|
277123
|
+
}
|
|
277124
|
+
applyResolvedFragmentFrame(el, item, fragment2, section) {
|
|
277125
|
+
el.style.left = `${item.x}px`;
|
|
277126
|
+
el.style.top = `${item.y}px`;
|
|
277127
|
+
el.style.width = `${item.width}px`;
|
|
277128
|
+
el.dataset.blockId = item.blockId;
|
|
277129
|
+
el.dataset.layoutEpoch = String(this.layoutEpoch);
|
|
277130
|
+
this.applyFragmentWrapperZIndex(el, fragment2, item.zIndex);
|
|
277131
|
+
if (item.fragmentKind === "image" || item.fragmentKind === "drawing" || item.fragmentKind === "table")
|
|
277132
|
+
el.style.height = `${item.height}px`;
|
|
277133
|
+
this.applyFragmentPmAttributes(el, fragment2, section);
|
|
277134
|
+
}
|
|
277135
|
+
applyResolvedListItemWrapperFrame(el, fragment2, item, section) {
|
|
277136
|
+
this.applyResolvedFragmentFrame(el, item, fragment2, section);
|
|
277137
|
+
el.style.left = `${item.x - fragment2.markerWidth}px`;
|
|
277138
|
+
el.style.width = `${item.width + fragment2.markerWidth}px`;
|
|
277139
|
+
}
|
|
276672
277140
|
estimateFragmentHeight(fragment2) {
|
|
276673
277141
|
const measure = this.blockLookup.get(fragment2.blockId)?.measure;
|
|
276674
277142
|
if (fragment2.kind === "para" && measure?.kind === "paragraph")
|
|
@@ -287449,7 +287917,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
287449
287917
|
layout.layoutEpoch = layoutEpoch;
|
|
287450
287918
|
resolvedLayout = resolveLayout({
|
|
287451
287919
|
layout,
|
|
287452
|
-
flowMode: this.#layoutOptions.flowMode ?? "paginated"
|
|
287920
|
+
flowMode: this.#layoutOptions.flowMode ?? "paginated",
|
|
287921
|
+
blocks: blocksForLayout,
|
|
287922
|
+
measures
|
|
287453
287923
|
});
|
|
287454
287924
|
headerLayouts = result.headers;
|
|
287455
287925
|
footerLayouts = result.footers;
|
|
@@ -289116,7 +289586,7 @@ var init_zipper_YmNpPIyc_es = __esm(() => {
|
|
|
289116
289586
|
|
|
289117
289587
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
289118
289588
|
var init_super_editor_es = __esm(() => {
|
|
289119
|
-
|
|
289589
|
+
init_src_C5K9vSFa_es();
|
|
289120
289590
|
init_SuperConverter_B9oNf3OB_es();
|
|
289121
289591
|
init_jszip_ChlR43oI_es();
|
|
289122
289592
|
init_xml_js_40FWvL78_es();
|