@harbour-enterprises/superdoc 1.3.0-next.5 → 1.3.0-next.7
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-CvoctNPw.cjs → PdfViewer-BolWPjJ9.cjs} +2 -2
- package/dist/chunks/{PdfViewer-Dbc_J_1L.es.js → PdfViewer-CnKGOFjP.es.js} +2 -2
- package/dist/chunks/{SuperConverter-tcg6NQjY.cjs → SuperConverter-BIrkxV37.cjs} +1 -1
- package/dist/chunks/{SuperConverter-DMbipzpl.es.js → SuperConverter-Bc9dM-qO.es.js} +1 -1
- package/dist/chunks/{index-BSxlafD_.es.js → index-BuT4cwmK.es.js} +193 -27
- package/dist/chunks/{index-B697vddF.es.js → index-C0irsRkX.es.js} +4 -4
- package/dist/chunks/{index-79lZpkMi.cjs → index-CKi-JNoY.cjs} +4 -4
- package/dist/chunks/{index-BHIGTNEQ.cjs → index-CmmcvSxn.cjs} +193 -27
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +194 -28
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -36366,7 +36366,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36366
36366
|
static getStoredSuperdocVersion(docx) {
|
|
36367
36367
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
36368
36368
|
}
|
|
36369
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.3.0-next.
|
|
36369
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.3.0-next.7") {
|
|
36370
36370
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
36371
36371
|
}
|
|
36372
36372
|
/**
|
|
@@ -62076,7 +62076,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62076
62076
|
return false;
|
|
62077
62077
|
}
|
|
62078
62078
|
};
|
|
62079
|
-
const summaryVersion = "1.3.0-next.
|
|
62079
|
+
const summaryVersion = "1.3.0-next.7";
|
|
62080
62080
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
62081
62081
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
62082
62082
|
function mapAttributes(attrs) {
|
|
@@ -64710,7 +64710,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
64710
64710
|
* Process collaboration migrations
|
|
64711
64711
|
*/
|
|
64712
64712
|
processCollaborationMigrations() {
|
|
64713
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.
|
|
64713
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.7");
|
|
64714
64714
|
if (!this.options.ydoc) return;
|
|
64715
64715
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
64716
64716
|
let docVersion = metaMap.get("version");
|
|
@@ -72296,7 +72296,28 @@ ${l}
|
|
|
72296
72296
|
section: kind,
|
|
72297
72297
|
pageNumberText: page.numberText
|
|
72298
72298
|
};
|
|
72299
|
-
|
|
72299
|
+
const behindDocFragments = [];
|
|
72300
|
+
const normalFragments = [];
|
|
72301
|
+
for (const fragment of data.fragments) {
|
|
72302
|
+
const isBehindDoc = (fragment.kind === "image" || fragment.kind === "drawing") && "zIndex" in fragment && fragment.zIndex === 0;
|
|
72303
|
+
if (isBehindDoc) {
|
|
72304
|
+
behindDocFragments.push(fragment);
|
|
72305
|
+
} else {
|
|
72306
|
+
normalFragments.push(fragment);
|
|
72307
|
+
}
|
|
72308
|
+
}
|
|
72309
|
+
const behindDocSelector = `[data-behind-doc-section="${kind}"]`;
|
|
72310
|
+
pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
|
|
72311
|
+
behindDocFragments.forEach((fragment) => {
|
|
72312
|
+
const fragEl = this.renderFragment(fragment, context);
|
|
72313
|
+
const pageY = effectiveOffset + fragment.y + (kind === "footer" ? footerYOffset : 0);
|
|
72314
|
+
fragEl.style.top = `${pageY}px`;
|
|
72315
|
+
fragEl.style.left = `${marginLeft + fragment.x}px`;
|
|
72316
|
+
fragEl.style.zIndex = "0";
|
|
72317
|
+
fragEl.dataset.behindDocSection = kind;
|
|
72318
|
+
pageEl.insertBefore(fragEl, pageEl.firstChild);
|
|
72319
|
+
});
|
|
72320
|
+
normalFragments.forEach((fragment) => {
|
|
72300
72321
|
const fragEl = this.renderFragment(fragment, context);
|
|
72301
72322
|
if (footerYOffset > 0) {
|
|
72302
72323
|
const currentTop = parseFloat(fragEl.style.top) || fragment.y;
|
|
@@ -77585,8 +77606,7 @@ ${l}
|
|
|
77585
77606
|
const titlePgEnabled = sectionTitlePg === true;
|
|
77586
77607
|
const isFirstPageOfSection = sectionPageNumber === 1;
|
|
77587
77608
|
if (isFirstPageOfSection && titlePgEnabled) {
|
|
77588
|
-
if (hasFirst) return "first";
|
|
77589
|
-
if (!hasDefault && !hasEven && !hasOdd) return null;
|
|
77609
|
+
if (hasFirst || hasDefault || hasEven || hasOdd) return "first";
|
|
77590
77610
|
return null;
|
|
77591
77611
|
}
|
|
77592
77612
|
if (identifier.alternateHeaders) {
|
|
@@ -79643,6 +79663,45 @@ ${l}
|
|
|
79643
79663
|
return height;
|
|
79644
79664
|
};
|
|
79645
79665
|
const headerContentHeights = options.headerContentHeights;
|
|
79666
|
+
const footerContentHeights = options.footerContentHeights;
|
|
79667
|
+
const headerContentHeightsByRId = options.headerContentHeightsByRId;
|
|
79668
|
+
const footerContentHeightsByRId = options.footerContentHeightsByRId;
|
|
79669
|
+
const getVariantTypeForPage = (sectionPageNumber, titlePgEnabled, alternateHeaders) => {
|
|
79670
|
+
if (sectionPageNumber === 1 && titlePgEnabled) {
|
|
79671
|
+
return "first";
|
|
79672
|
+
}
|
|
79673
|
+
return "default";
|
|
79674
|
+
};
|
|
79675
|
+
const getHeaderHeightForPage = (variantType, headerRef) => {
|
|
79676
|
+
if (headerRef && headerContentHeightsByRId?.has(headerRef)) {
|
|
79677
|
+
return validateContentHeight(headerContentHeightsByRId.get(headerRef));
|
|
79678
|
+
}
|
|
79679
|
+
if (headerContentHeights) {
|
|
79680
|
+
return validateContentHeight(headerContentHeights[variantType]);
|
|
79681
|
+
}
|
|
79682
|
+
return 0;
|
|
79683
|
+
};
|
|
79684
|
+
const getFooterHeightForPage = (variantType, footerRef) => {
|
|
79685
|
+
if (footerRef && footerContentHeightsByRId?.has(footerRef)) {
|
|
79686
|
+
return validateContentHeight(footerContentHeightsByRId.get(footerRef));
|
|
79687
|
+
}
|
|
79688
|
+
if (footerContentHeights) {
|
|
79689
|
+
return validateContentHeight(footerContentHeights[variantType]);
|
|
79690
|
+
}
|
|
79691
|
+
return 0;
|
|
79692
|
+
};
|
|
79693
|
+
const calculateEffectiveTopMargin = (headerContentHeight, currentHeaderDistance, baseTopMargin) => {
|
|
79694
|
+
if (headerContentHeight > 0) {
|
|
79695
|
+
return Math.max(baseTopMargin, currentHeaderDistance + headerContentHeight);
|
|
79696
|
+
}
|
|
79697
|
+
return baseTopMargin;
|
|
79698
|
+
};
|
|
79699
|
+
const calculateEffectiveBottomMargin = (footerContentHeight, currentFooterDistance, baseBottomMargin) => {
|
|
79700
|
+
if (footerContentHeight > 0) {
|
|
79701
|
+
return Math.max(baseBottomMargin, currentFooterDistance + footerContentHeight);
|
|
79702
|
+
}
|
|
79703
|
+
return baseBottomMargin;
|
|
79704
|
+
};
|
|
79646
79705
|
const maxHeaderContentHeight = headerContentHeights ? Math.max(
|
|
79647
79706
|
0,
|
|
79648
79707
|
validateContentHeight(headerContentHeights.default),
|
|
@@ -79650,9 +79709,6 @@ ${l}
|
|
|
79650
79709
|
validateContentHeight(headerContentHeights.even),
|
|
79651
79710
|
validateContentHeight(headerContentHeights.odd)
|
|
79652
79711
|
) : 0;
|
|
79653
|
-
const headerDistance = margins.header ?? margins.top;
|
|
79654
|
-
const effectiveTopMargin = maxHeaderContentHeight > 0 ? Math.max(margins.top, headerDistance + maxHeaderContentHeight) : margins.top;
|
|
79655
|
-
const footerContentHeights = options.footerContentHeights;
|
|
79656
79712
|
const maxFooterContentHeight = footerContentHeights ? Math.max(
|
|
79657
79713
|
0,
|
|
79658
79714
|
validateContentHeight(footerContentHeights.default),
|
|
@@ -79660,8 +79716,12 @@ ${l}
|
|
|
79660
79716
|
validateContentHeight(footerContentHeights.even),
|
|
79661
79717
|
validateContentHeight(footerContentHeights.odd)
|
|
79662
79718
|
) : 0;
|
|
79719
|
+
const headerDistance = margins.header ?? margins.top;
|
|
79663
79720
|
const footerDistance = margins.footer ?? margins.bottom;
|
|
79664
|
-
const
|
|
79721
|
+
const defaultHeaderHeight = getHeaderHeightForPage("default", void 0);
|
|
79722
|
+
const defaultFooterHeight = getFooterHeightForPage("default", void 0);
|
|
79723
|
+
const effectiveTopMargin = calculateEffectiveTopMargin(defaultHeaderHeight, headerDistance, margins.top);
|
|
79724
|
+
const effectiveBottomMargin = calculateEffectiveBottomMargin(defaultFooterHeight, footerDistance, margins.bottom);
|
|
79665
79725
|
let activeTopMargin = effectiveTopMargin;
|
|
79666
79726
|
let activeBottomMargin = effectiveBottomMargin;
|
|
79667
79727
|
let activeLeftMargin = margins.left;
|
|
@@ -79670,6 +79730,10 @@ ${l}
|
|
|
79670
79730
|
let pendingBottomMargin = null;
|
|
79671
79731
|
let pendingLeftMargin = null;
|
|
79672
79732
|
let pendingRightMargin = null;
|
|
79733
|
+
let activeSectionBaseTopMargin = margins.top;
|
|
79734
|
+
let activeSectionBaseBottomMargin = margins.bottom;
|
|
79735
|
+
let pendingSectionBaseTopMargin = null;
|
|
79736
|
+
let pendingSectionBaseBottomMargin = null;
|
|
79673
79737
|
let activeHeaderDistance = margins.header ?? margins.top;
|
|
79674
79738
|
let pendingHeaderDistance = null;
|
|
79675
79739
|
let activeFooterDistance = margins.footer ?? margins.bottom;
|
|
@@ -79875,6 +79939,7 @@ ${l}
|
|
|
79875
79939
|
}
|
|
79876
79940
|
let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
|
|
79877
79941
|
let pendingSectionIndex = null;
|
|
79942
|
+
const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
|
|
79878
79943
|
const paginator = createPaginator({
|
|
79879
79944
|
margins: paginatorMargins,
|
|
79880
79945
|
getActiveTopMargin: () => activeTopMargin,
|
|
@@ -79888,6 +79953,7 @@ ${l}
|
|
|
79888
79953
|
createPage,
|
|
79889
79954
|
onNewPage: (state) => {
|
|
79890
79955
|
if (!state) {
|
|
79956
|
+
const isEnteringNewSection = pendingSectionIndex !== null;
|
|
79891
79957
|
const applied = applyPendingToActive({
|
|
79892
79958
|
activeTopMargin,
|
|
79893
79959
|
activeBottomMargin,
|
|
@@ -79955,7 +80021,69 @@ ${l}
|
|
|
79955
80021
|
activeVAlign = pendingVAlign;
|
|
79956
80022
|
pendingVAlign = null;
|
|
79957
80023
|
}
|
|
80024
|
+
if (pendingSectionBaseTopMargin !== null) {
|
|
80025
|
+
activeSectionBaseTopMargin = pendingSectionBaseTopMargin;
|
|
80026
|
+
pendingSectionBaseTopMargin = null;
|
|
80027
|
+
}
|
|
80028
|
+
if (pendingSectionBaseBottomMargin !== null) {
|
|
80029
|
+
activeSectionBaseBottomMargin = pendingSectionBaseBottomMargin;
|
|
80030
|
+
pendingSectionBaseBottomMargin = null;
|
|
80031
|
+
}
|
|
79958
80032
|
pageCount += 1;
|
|
80033
|
+
const newPageNumber = pageCount;
|
|
80034
|
+
if (isEnteringNewSection || !sectionFirstPageNumbers.has(activeSectionIndex)) {
|
|
80035
|
+
sectionFirstPageNumbers.set(activeSectionIndex, newPageNumber);
|
|
80036
|
+
}
|
|
80037
|
+
const firstPageInSection = sectionFirstPageNumbers.get(activeSectionIndex) ?? newPageNumber;
|
|
80038
|
+
const sectionPageNumber = newPageNumber - firstPageInSection + 1;
|
|
80039
|
+
const sectionMetadata = sectionMetadataList[activeSectionIndex];
|
|
80040
|
+
const titlePgEnabled = sectionMetadata?.titlePg ?? false;
|
|
80041
|
+
const variantType = getVariantTypeForPage(sectionPageNumber, titlePgEnabled);
|
|
80042
|
+
let headerRef = activeSectionRefs?.headerRefs?.[variantType];
|
|
80043
|
+
let footerRef = activeSectionRefs?.footerRefs?.[variantType];
|
|
80044
|
+
let effectiveVariantType = variantType;
|
|
80045
|
+
if (!headerRef && variantType !== "default" && activeSectionIndex > 0) {
|
|
80046
|
+
const prevSectionMetadata = sectionMetadataList[activeSectionIndex - 1];
|
|
80047
|
+
if (prevSectionMetadata?.headerRefs?.[variantType]) {
|
|
80048
|
+
headerRef = prevSectionMetadata.headerRefs[variantType];
|
|
80049
|
+
layoutLog(
|
|
80050
|
+
`[Layout] Page ${newPageNumber}: Inheriting header '${variantType}' from section ${activeSectionIndex - 1}: ${headerRef}`
|
|
80051
|
+
);
|
|
80052
|
+
}
|
|
80053
|
+
}
|
|
80054
|
+
if (!footerRef && variantType !== "default" && activeSectionIndex > 0) {
|
|
80055
|
+
const prevSectionMetadata = sectionMetadataList[activeSectionIndex - 1];
|
|
80056
|
+
if (prevSectionMetadata?.footerRefs?.[variantType]) {
|
|
80057
|
+
footerRef = prevSectionMetadata.footerRefs[variantType];
|
|
80058
|
+
layoutLog(
|
|
80059
|
+
`[Layout] Page ${newPageNumber}: Inheriting footer '${variantType}' from section ${activeSectionIndex - 1}: ${footerRef}`
|
|
80060
|
+
);
|
|
80061
|
+
}
|
|
80062
|
+
}
|
|
80063
|
+
if (!headerRef && variantType !== "default" && activeSectionRefs?.headerRefs?.default) {
|
|
80064
|
+
headerRef = activeSectionRefs.headerRefs.default;
|
|
80065
|
+
effectiveVariantType = "default";
|
|
80066
|
+
}
|
|
80067
|
+
if (!footerRef && variantType !== "default" && activeSectionRefs?.footerRefs?.default) {
|
|
80068
|
+
footerRef = activeSectionRefs.footerRefs.default;
|
|
80069
|
+
}
|
|
80070
|
+
const headerHeight = getHeaderHeightForPage(effectiveVariantType, headerRef);
|
|
80071
|
+
const footerHeight = getFooterHeightForPage(
|
|
80072
|
+
variantType !== "default" && !activeSectionRefs?.footerRefs?.[variantType] ? "default" : variantType,
|
|
80073
|
+
footerRef
|
|
80074
|
+
);
|
|
80075
|
+
activeTopMargin = calculateEffectiveTopMargin(headerHeight, activeHeaderDistance, activeSectionBaseTopMargin);
|
|
80076
|
+
activeBottomMargin = calculateEffectiveBottomMargin(
|
|
80077
|
+
footerHeight,
|
|
80078
|
+
activeFooterDistance,
|
|
80079
|
+
activeSectionBaseBottomMargin
|
|
80080
|
+
);
|
|
80081
|
+
layoutLog(
|
|
80082
|
+
`[Layout] Page ${newPageNumber}: Using variant '${variantType}' - headerHeight: ${headerHeight}, footerHeight: ${footerHeight}`
|
|
80083
|
+
);
|
|
80084
|
+
layoutLog(
|
|
80085
|
+
`[Layout] Page ${newPageNumber}: Adjusted margins - top: ${activeTopMargin}, bottom: ${activeBottomMargin} (base: ${activeSectionBaseTopMargin}, ${activeSectionBaseBottomMargin})`
|
|
80086
|
+
);
|
|
79959
80087
|
return;
|
|
79960
80088
|
}
|
|
79961
80089
|
if (state?.page) {
|
|
@@ -80161,6 +80289,20 @@ ${l}
|
|
|
80161
80289
|
pendingColumns = updatedState.pendingColumns;
|
|
80162
80290
|
activeOrientation = updatedState.activeOrientation;
|
|
80163
80291
|
pendingOrientation = updatedState.pendingOrientation;
|
|
80292
|
+
const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
80293
|
+
const blockTopMargin = effectiveBlock.margins?.top;
|
|
80294
|
+
const blockBottomMargin = effectiveBlock.margins?.bottom;
|
|
80295
|
+
if (isFirstSection) {
|
|
80296
|
+
activeSectionBaseTopMargin = typeof blockTopMargin === "number" ? blockTopMargin : margins.top;
|
|
80297
|
+
activeSectionBaseBottomMargin = typeof blockBottomMargin === "number" ? blockBottomMargin : margins.bottom;
|
|
80298
|
+
} else if (blockTopMargin !== void 0 || blockBottomMargin !== void 0) {
|
|
80299
|
+
if (blockTopMargin !== void 0) {
|
|
80300
|
+
pendingSectionBaseTopMargin = typeof blockTopMargin === "number" ? blockTopMargin : margins.top;
|
|
80301
|
+
}
|
|
80302
|
+
if (blockBottomMargin !== void 0) {
|
|
80303
|
+
pendingSectionBaseBottomMargin = typeof blockBottomMargin === "number" ? blockBottomMargin : margins.bottom;
|
|
80304
|
+
}
|
|
80305
|
+
}
|
|
80164
80306
|
if (effectiveBlock.vAlign) {
|
|
80165
80307
|
const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
80166
80308
|
if (isFirstSection2) {
|
|
@@ -80179,7 +80321,6 @@ ${l}
|
|
|
80179
80321
|
}
|
|
80180
80322
|
const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
|
|
80181
80323
|
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
80182
|
-
const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
80183
80324
|
if (Number.isFinite(metadataIndex)) {
|
|
80184
80325
|
if (isFirstSection) {
|
|
80185
80326
|
activeSectionIndex = metadataIndex;
|
|
@@ -80503,10 +80644,6 @@ ${l}
|
|
|
80503
80644
|
if (!Number.isFinite(height) || height <= 0) {
|
|
80504
80645
|
return { pages: [], height: 0 };
|
|
80505
80646
|
}
|
|
80506
|
-
const overflowBase = typeof constraints.overflowBaseHeight === "number" && Number.isFinite(constraints.overflowBaseHeight) && constraints.overflowBaseHeight > 0 ? constraints.overflowBaseHeight : height;
|
|
80507
|
-
const maxBehindDocOverflow = Math.max(192, overflowBase * 4);
|
|
80508
|
-
const minBehindDocY = -maxBehindDocOverflow;
|
|
80509
|
-
const maxBehindDocY = height + maxBehindDocOverflow;
|
|
80510
80647
|
const marginLeft = constraints.margins?.left ?? 0;
|
|
80511
80648
|
const transformedBlocks = marginLeft > 0 ? blocks2.map((block) => {
|
|
80512
80649
|
const hasPageRelativeAnchor = (block.kind === "image" || block.kind === "drawing") && block.anchor?.hRelativeFrom === "page" && block.anchor.offsetH != null;
|
|
@@ -80545,7 +80682,7 @@ ${l}
|
|
|
80545
80682
|
);
|
|
80546
80683
|
}
|
|
80547
80684
|
const anchoredBlock = block;
|
|
80548
|
-
if (anchoredBlock.anchor?.behindDoc
|
|
80685
|
+
if (anchoredBlock.anchor?.behindDoc) {
|
|
80549
80686
|
continue;
|
|
80550
80687
|
}
|
|
80551
80688
|
}
|
|
@@ -82369,6 +82506,7 @@ ${l}
|
|
|
82369
82506
|
`[Perf] 4.1 Measure all blocks: ${(measureEnd - measureStart).toFixed(2)}ms (${cacheMisses} measured, ${cacheHits} cached)`
|
|
82370
82507
|
);
|
|
82371
82508
|
let headerContentHeights;
|
|
82509
|
+
let headerContentHeightsByRId;
|
|
82372
82510
|
const hasHeaderBlocks = headerFooter?.headerBlocks && Object.keys(headerFooter.headerBlocks).length > 0;
|
|
82373
82511
|
const hasHeaderBlocksByRId = headerFooter?.headerBlocksByRId && headerFooter.headerBlocksByRId.size > 0;
|
|
82374
82512
|
if (headerFooter?.constraints && (hasHeaderBlocks || hasHeaderBlocksByRId)) {
|
|
@@ -82408,7 +82546,8 @@ ${l}
|
|
|
82408
82546
|
}
|
|
82409
82547
|
}
|
|
82410
82548
|
if (hasHeaderBlocksByRId && headerFooter.headerBlocksByRId) {
|
|
82411
|
-
|
|
82549
|
+
headerContentHeightsByRId = /* @__PURE__ */ new Map();
|
|
82550
|
+
for (const [rId, blocks2] of headerFooter.headerBlocksByRId) {
|
|
82412
82551
|
if (!blocks2 || blocks2.length === 0) continue;
|
|
82413
82552
|
const measureConstraints = {
|
|
82414
82553
|
maxWidth: headerFooter.constraints.width,
|
|
@@ -82420,8 +82559,7 @@ ${l}
|
|
|
82420
82559
|
height: headerFooter.constraints.height
|
|
82421
82560
|
});
|
|
82422
82561
|
if (layout2.height > 0) {
|
|
82423
|
-
|
|
82424
|
-
headerContentHeights.default = Math.max(currentDefault, layout2.height);
|
|
82562
|
+
headerContentHeightsByRId.set(rId, layout2.height);
|
|
82425
82563
|
}
|
|
82426
82564
|
}
|
|
82427
82565
|
}
|
|
@@ -82429,6 +82567,7 @@ ${l}
|
|
|
82429
82567
|
perfLog(`[Perf] 4.1.5 Pre-layout headers for height: ${(hfPreEnd - hfPreStart).toFixed(2)}ms`);
|
|
82430
82568
|
}
|
|
82431
82569
|
let footerContentHeights;
|
|
82570
|
+
let footerContentHeightsByRId;
|
|
82432
82571
|
const hasFooterBlocks = headerFooter?.footerBlocks && Object.keys(headerFooter.footerBlocks).length > 0;
|
|
82433
82572
|
const hasFooterBlocksByRId = headerFooter?.footerBlocksByRId && headerFooter.footerBlocksByRId.size > 0;
|
|
82434
82573
|
if (headerFooter?.constraints && (hasFooterBlocks || hasFooterBlocksByRId)) {
|
|
@@ -82471,7 +82610,8 @@ ${l}
|
|
|
82471
82610
|
}
|
|
82472
82611
|
}
|
|
82473
82612
|
if (hasFooterBlocksByRId && headerFooter.footerBlocksByRId) {
|
|
82474
|
-
|
|
82613
|
+
footerContentHeightsByRId = /* @__PURE__ */ new Map();
|
|
82614
|
+
for (const [rId, blocks2] of headerFooter.footerBlocksByRId) {
|
|
82475
82615
|
if (!blocks2 || blocks2.length === 0) continue;
|
|
82476
82616
|
const measureConstraints = {
|
|
82477
82617
|
maxWidth: headerFooter.constraints.width,
|
|
@@ -82483,8 +82623,7 @@ ${l}
|
|
|
82483
82623
|
height: headerFooter.constraints.height
|
|
82484
82624
|
});
|
|
82485
82625
|
if (layout2.height > 0) {
|
|
82486
|
-
|
|
82487
|
-
footerContentHeights.default = Math.max(currentDefault, layout2.height);
|
|
82626
|
+
footerContentHeightsByRId.set(rId, layout2.height);
|
|
82488
82627
|
}
|
|
82489
82628
|
}
|
|
82490
82629
|
}
|
|
@@ -82499,9 +82638,13 @@ ${l}
|
|
|
82499
82638
|
let layout = layoutDocument(nextBlocks, measures, {
|
|
82500
82639
|
...options,
|
|
82501
82640
|
headerContentHeights,
|
|
82502
|
-
// Pass header heights to prevent overlap
|
|
82641
|
+
// Pass header heights to prevent overlap (per-variant)
|
|
82503
82642
|
footerContentHeights,
|
|
82504
|
-
// Pass footer heights to prevent overlap
|
|
82643
|
+
// Pass footer heights to prevent overlap (per-variant)
|
|
82644
|
+
headerContentHeightsByRId,
|
|
82645
|
+
// Pass header heights by rId for per-page margin calculation
|
|
82646
|
+
footerContentHeightsByRId,
|
|
82647
|
+
// Pass footer heights by rId for per-page margin calculation
|
|
82505
82648
|
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
82506
82649
|
});
|
|
82507
82650
|
const layoutEnd = performance.now();
|
|
@@ -82549,9 +82692,13 @@ ${l}
|
|
|
82549
82692
|
layout = layoutDocument(currentBlocks, currentMeasures, {
|
|
82550
82693
|
...options,
|
|
82551
82694
|
headerContentHeights,
|
|
82552
|
-
// Pass header heights to prevent overlap
|
|
82695
|
+
// Pass header heights to prevent overlap (per-variant)
|
|
82553
82696
|
footerContentHeights,
|
|
82554
|
-
// Pass footer heights to prevent overlap
|
|
82697
|
+
// Pass footer heights to prevent overlap (per-variant)
|
|
82698
|
+
headerContentHeightsByRId,
|
|
82699
|
+
// Pass header heights by rId for per-page margin calculation
|
|
82700
|
+
footerContentHeightsByRId,
|
|
82701
|
+
// Pass footer heights by rId for per-page margin calculation
|
|
82555
82702
|
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
82556
82703
|
});
|
|
82557
82704
|
const relayoutEnd = performance.now();
|
|
@@ -100036,7 +100183,26 @@ ${l}
|
|
|
100036
100183
|
const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
|
|
100037
100184
|
const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
|
|
100038
100185
|
const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
|
|
100039
|
-
|
|
100186
|
+
let sectionRId;
|
|
100187
|
+
if (page?.sectionRefs && kind === "header") {
|
|
100188
|
+
sectionRId = page.sectionRefs.headerRefs?.[headerFooterType];
|
|
100189
|
+
if (!sectionRId && headerFooterType && headerFooterType !== "default" && sectionIndex > 0 && multiSectionId) {
|
|
100190
|
+
const prevSectionIds = multiSectionId.sectionHeaderIds.get(sectionIndex - 1);
|
|
100191
|
+
sectionRId = prevSectionIds?.[headerFooterType] ?? void 0;
|
|
100192
|
+
}
|
|
100193
|
+
if (!sectionRId && headerFooterType !== "default") {
|
|
100194
|
+
sectionRId = page.sectionRefs.headerRefs?.default;
|
|
100195
|
+
}
|
|
100196
|
+
} else if (page?.sectionRefs && kind === "footer") {
|
|
100197
|
+
sectionRId = page.sectionRefs.footerRefs?.[headerFooterType];
|
|
100198
|
+
if (!sectionRId && headerFooterType && headerFooterType !== "default" && sectionIndex > 0 && multiSectionId) {
|
|
100199
|
+
const prevSectionIds = multiSectionId.sectionFooterIds.get(sectionIndex - 1);
|
|
100200
|
+
sectionRId = prevSectionIds?.[headerFooterType] ?? void 0;
|
|
100201
|
+
}
|
|
100202
|
+
if (!sectionRId && headerFooterType !== "default") {
|
|
100203
|
+
sectionRId = page.sectionRefs.footerRefs?.default;
|
|
100204
|
+
}
|
|
100205
|
+
}
|
|
100040
100206
|
if (!headerFooterType) {
|
|
100041
100207
|
return null;
|
|
100042
100208
|
}
|
|
@@ -143864,7 +144030,7 @@ ${reason}`);
|
|
|
143864
144030
|
this.config.colors = shuffleArray(this.config.colors);
|
|
143865
144031
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
143866
144032
|
this.colorIndex = 0;
|
|
143867
|
-
this.version = "1.3.0-next.
|
|
144033
|
+
this.version = "1.3.0-next.7";
|
|
143868
144034
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
143869
144035
|
this.superdocId = config2.superdocId || v4();
|
|
143870
144036
|
this.colors = this.config.colors;
|