@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.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-C8_CqJxM.cjs");
3
3
  const helpers$1 = require("./helpers-nOdwpmwb.cjs");
4
- const superEditor_converter = require("./SuperConverter-tcg6NQjY.cjs");
4
+ const superEditor_converter = require("./SuperConverter-BIrkxV37.cjs");
5
5
  const vue = require("./vue-De9wkgLl.cjs");
6
6
  require("./jszip.min-BPh2MMAa.cjs");
7
7
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
@@ -15351,7 +15351,7 @@ const canUseDOM = () => {
15351
15351
  return false;
15352
15352
  }
15353
15353
  };
15354
- const summaryVersion = "1.3.0-next.5";
15354
+ const summaryVersion = "1.3.0-next.7";
15355
15355
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15356
15356
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15357
15357
  function mapAttributes(attrs) {
@@ -17984,7 +17984,7 @@ class Editor extends EventEmitter {
17984
17984
  * Process collaboration migrations
17985
17985
  */
17986
17986
  processCollaborationMigrations() {
17987
- console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.5");
17987
+ console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.7");
17988
17988
  if (!this.options.ydoc) return;
17989
17989
  const metaMap = this.options.ydoc.getMap("meta");
17990
17990
  let docVersion = metaMap.get("version");
@@ -25568,7 +25568,28 @@ class DomPainter {
25568
25568
  section: kind,
25569
25569
  pageNumberText: page.numberText
25570
25570
  };
25571
- data.fragments.forEach((fragment) => {
25571
+ const behindDocFragments = [];
25572
+ const normalFragments = [];
25573
+ for (const fragment of data.fragments) {
25574
+ const isBehindDoc = (fragment.kind === "image" || fragment.kind === "drawing") && "zIndex" in fragment && fragment.zIndex === 0;
25575
+ if (isBehindDoc) {
25576
+ behindDocFragments.push(fragment);
25577
+ } else {
25578
+ normalFragments.push(fragment);
25579
+ }
25580
+ }
25581
+ const behindDocSelector = `[data-behind-doc-section="${kind}"]`;
25582
+ pageEl.querySelectorAll(behindDocSelector).forEach((el) => el.remove());
25583
+ behindDocFragments.forEach((fragment) => {
25584
+ const fragEl = this.renderFragment(fragment, context);
25585
+ const pageY = effectiveOffset + fragment.y + (kind === "footer" ? footerYOffset : 0);
25586
+ fragEl.style.top = `${pageY}px`;
25587
+ fragEl.style.left = `${marginLeft + fragment.x}px`;
25588
+ fragEl.style.zIndex = "0";
25589
+ fragEl.dataset.behindDocSection = kind;
25590
+ pageEl.insertBefore(fragEl, pageEl.firstChild);
25591
+ });
25592
+ normalFragments.forEach((fragment) => {
25572
25593
  const fragEl = this.renderFragment(fragment, context);
25573
25594
  if (footerYOffset > 0) {
25574
25595
  const currentTop = parseFloat(fragEl.style.top) || fragment.y;
@@ -30859,8 +30880,7 @@ function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, opt
30859
30880
  const titlePgEnabled = sectionTitlePg === true;
30860
30881
  const isFirstPageOfSection = sectionPageNumber === 1;
30861
30882
  if (isFirstPageOfSection && titlePgEnabled) {
30862
- if (hasFirst) return "first";
30863
- if (!hasDefault && !hasEven && !hasOdd) return null;
30883
+ if (hasFirst || hasDefault || hasEven || hasOdd) return "first";
30864
30884
  return null;
30865
30885
  }
30866
30886
  if (identifier.alternateHeaders) {
@@ -32916,6 +32936,45 @@ function layoutDocument(blocks, measures, options = {}) {
32916
32936
  return height;
32917
32937
  };
32918
32938
  const headerContentHeights = options.headerContentHeights;
32939
+ const footerContentHeights = options.footerContentHeights;
32940
+ const headerContentHeightsByRId = options.headerContentHeightsByRId;
32941
+ const footerContentHeightsByRId = options.footerContentHeightsByRId;
32942
+ const getVariantTypeForPage = (sectionPageNumber, titlePgEnabled, alternateHeaders) => {
32943
+ if (sectionPageNumber === 1 && titlePgEnabled) {
32944
+ return "first";
32945
+ }
32946
+ return "default";
32947
+ };
32948
+ const getHeaderHeightForPage = (variantType, headerRef) => {
32949
+ if (headerRef && headerContentHeightsByRId?.has(headerRef)) {
32950
+ return validateContentHeight(headerContentHeightsByRId.get(headerRef));
32951
+ }
32952
+ if (headerContentHeights) {
32953
+ return validateContentHeight(headerContentHeights[variantType]);
32954
+ }
32955
+ return 0;
32956
+ };
32957
+ const getFooterHeightForPage = (variantType, footerRef) => {
32958
+ if (footerRef && footerContentHeightsByRId?.has(footerRef)) {
32959
+ return validateContentHeight(footerContentHeightsByRId.get(footerRef));
32960
+ }
32961
+ if (footerContentHeights) {
32962
+ return validateContentHeight(footerContentHeights[variantType]);
32963
+ }
32964
+ return 0;
32965
+ };
32966
+ const calculateEffectiveTopMargin = (headerContentHeight, currentHeaderDistance, baseTopMargin) => {
32967
+ if (headerContentHeight > 0) {
32968
+ return Math.max(baseTopMargin, currentHeaderDistance + headerContentHeight);
32969
+ }
32970
+ return baseTopMargin;
32971
+ };
32972
+ const calculateEffectiveBottomMargin = (footerContentHeight, currentFooterDistance, baseBottomMargin) => {
32973
+ if (footerContentHeight > 0) {
32974
+ return Math.max(baseBottomMargin, currentFooterDistance + footerContentHeight);
32975
+ }
32976
+ return baseBottomMargin;
32977
+ };
32919
32978
  const maxHeaderContentHeight = headerContentHeights ? Math.max(
32920
32979
  0,
32921
32980
  validateContentHeight(headerContentHeights.default),
@@ -32923,9 +32982,6 @@ function layoutDocument(blocks, measures, options = {}) {
32923
32982
  validateContentHeight(headerContentHeights.even),
32924
32983
  validateContentHeight(headerContentHeights.odd)
32925
32984
  ) : 0;
32926
- const headerDistance = margins.header ?? margins.top;
32927
- const effectiveTopMargin = maxHeaderContentHeight > 0 ? Math.max(margins.top, headerDistance + maxHeaderContentHeight) : margins.top;
32928
- const footerContentHeights = options.footerContentHeights;
32929
32985
  const maxFooterContentHeight = footerContentHeights ? Math.max(
32930
32986
  0,
32931
32987
  validateContentHeight(footerContentHeights.default),
@@ -32933,8 +32989,12 @@ function layoutDocument(blocks, measures, options = {}) {
32933
32989
  validateContentHeight(footerContentHeights.even),
32934
32990
  validateContentHeight(footerContentHeights.odd)
32935
32991
  ) : 0;
32992
+ const headerDistance = margins.header ?? margins.top;
32936
32993
  const footerDistance = margins.footer ?? margins.bottom;
32937
- const effectiveBottomMargin = maxFooterContentHeight > 0 ? Math.max(margins.bottom, footerDistance + maxFooterContentHeight) : margins.bottom;
32994
+ const defaultHeaderHeight = getHeaderHeightForPage("default", void 0);
32995
+ const defaultFooterHeight = getFooterHeightForPage("default", void 0);
32996
+ const effectiveTopMargin = calculateEffectiveTopMargin(defaultHeaderHeight, headerDistance, margins.top);
32997
+ const effectiveBottomMargin = calculateEffectiveBottomMargin(defaultFooterHeight, footerDistance, margins.bottom);
32938
32998
  let activeTopMargin = effectiveTopMargin;
32939
32999
  let activeBottomMargin = effectiveBottomMargin;
32940
33000
  let activeLeftMargin = margins.left;
@@ -32943,6 +33003,10 @@ function layoutDocument(blocks, measures, options = {}) {
32943
33003
  let pendingBottomMargin = null;
32944
33004
  let pendingLeftMargin = null;
32945
33005
  let pendingRightMargin = null;
33006
+ let activeSectionBaseTopMargin = margins.top;
33007
+ let activeSectionBaseBottomMargin = margins.bottom;
33008
+ let pendingSectionBaseTopMargin = null;
33009
+ let pendingSectionBaseBottomMargin = null;
32946
33010
  let activeHeaderDistance = margins.header ?? margins.top;
32947
33011
  let pendingHeaderDistance = null;
32948
33012
  let activeFooterDistance = margins.footer ?? margins.bottom;
@@ -33148,6 +33212,7 @@ function layoutDocument(blocks, measures, options = {}) {
33148
33212
  }
33149
33213
  let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
33150
33214
  let pendingSectionIndex = null;
33215
+ const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
33151
33216
  const paginator = createPaginator({
33152
33217
  margins: paginatorMargins,
33153
33218
  getActiveTopMargin: () => activeTopMargin,
@@ -33161,6 +33226,7 @@ function layoutDocument(blocks, measures, options = {}) {
33161
33226
  createPage,
33162
33227
  onNewPage: (state) => {
33163
33228
  if (!state) {
33229
+ const isEnteringNewSection = pendingSectionIndex !== null;
33164
33230
  const applied = applyPendingToActive({
33165
33231
  activeTopMargin,
33166
33232
  activeBottomMargin,
@@ -33228,7 +33294,69 @@ function layoutDocument(blocks, measures, options = {}) {
33228
33294
  activeVAlign = pendingVAlign;
33229
33295
  pendingVAlign = null;
33230
33296
  }
33297
+ if (pendingSectionBaseTopMargin !== null) {
33298
+ activeSectionBaseTopMargin = pendingSectionBaseTopMargin;
33299
+ pendingSectionBaseTopMargin = null;
33300
+ }
33301
+ if (pendingSectionBaseBottomMargin !== null) {
33302
+ activeSectionBaseBottomMargin = pendingSectionBaseBottomMargin;
33303
+ pendingSectionBaseBottomMargin = null;
33304
+ }
33231
33305
  pageCount += 1;
33306
+ const newPageNumber = pageCount;
33307
+ if (isEnteringNewSection || !sectionFirstPageNumbers.has(activeSectionIndex)) {
33308
+ sectionFirstPageNumbers.set(activeSectionIndex, newPageNumber);
33309
+ }
33310
+ const firstPageInSection = sectionFirstPageNumbers.get(activeSectionIndex) ?? newPageNumber;
33311
+ const sectionPageNumber = newPageNumber - firstPageInSection + 1;
33312
+ const sectionMetadata = sectionMetadataList[activeSectionIndex];
33313
+ const titlePgEnabled = sectionMetadata?.titlePg ?? false;
33314
+ const variantType = getVariantTypeForPage(sectionPageNumber, titlePgEnabled);
33315
+ let headerRef = activeSectionRefs?.headerRefs?.[variantType];
33316
+ let footerRef = activeSectionRefs?.footerRefs?.[variantType];
33317
+ let effectiveVariantType = variantType;
33318
+ if (!headerRef && variantType !== "default" && activeSectionIndex > 0) {
33319
+ const prevSectionMetadata = sectionMetadataList[activeSectionIndex - 1];
33320
+ if (prevSectionMetadata?.headerRefs?.[variantType]) {
33321
+ headerRef = prevSectionMetadata.headerRefs[variantType];
33322
+ layoutLog(
33323
+ `[Layout] Page ${newPageNumber}: Inheriting header '${variantType}' from section ${activeSectionIndex - 1}: ${headerRef}`
33324
+ );
33325
+ }
33326
+ }
33327
+ if (!footerRef && variantType !== "default" && activeSectionIndex > 0) {
33328
+ const prevSectionMetadata = sectionMetadataList[activeSectionIndex - 1];
33329
+ if (prevSectionMetadata?.footerRefs?.[variantType]) {
33330
+ footerRef = prevSectionMetadata.footerRefs[variantType];
33331
+ layoutLog(
33332
+ `[Layout] Page ${newPageNumber}: Inheriting footer '${variantType}' from section ${activeSectionIndex - 1}: ${footerRef}`
33333
+ );
33334
+ }
33335
+ }
33336
+ if (!headerRef && variantType !== "default" && activeSectionRefs?.headerRefs?.default) {
33337
+ headerRef = activeSectionRefs.headerRefs.default;
33338
+ effectiveVariantType = "default";
33339
+ }
33340
+ if (!footerRef && variantType !== "default" && activeSectionRefs?.footerRefs?.default) {
33341
+ footerRef = activeSectionRefs.footerRefs.default;
33342
+ }
33343
+ const headerHeight = getHeaderHeightForPage(effectiveVariantType, headerRef);
33344
+ const footerHeight = getFooterHeightForPage(
33345
+ variantType !== "default" && !activeSectionRefs?.footerRefs?.[variantType] ? "default" : variantType,
33346
+ footerRef
33347
+ );
33348
+ activeTopMargin = calculateEffectiveTopMargin(headerHeight, activeHeaderDistance, activeSectionBaseTopMargin);
33349
+ activeBottomMargin = calculateEffectiveBottomMargin(
33350
+ footerHeight,
33351
+ activeFooterDistance,
33352
+ activeSectionBaseBottomMargin
33353
+ );
33354
+ layoutLog(
33355
+ `[Layout] Page ${newPageNumber}: Using variant '${variantType}' - headerHeight: ${headerHeight}, footerHeight: ${footerHeight}`
33356
+ );
33357
+ layoutLog(
33358
+ `[Layout] Page ${newPageNumber}: Adjusted margins - top: ${activeTopMargin}, bottom: ${activeBottomMargin} (base: ${activeSectionBaseTopMargin}, ${activeSectionBaseBottomMargin})`
33359
+ );
33232
33360
  return;
33233
33361
  }
33234
33362
  if (state?.page) {
@@ -33434,6 +33562,20 @@ function layoutDocument(blocks, measures, options = {}) {
33434
33562
  pendingColumns = updatedState.pendingColumns;
33435
33563
  activeOrientation = updatedState.activeOrientation;
33436
33564
  pendingOrientation = updatedState.pendingOrientation;
33565
+ const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
33566
+ const blockTopMargin = effectiveBlock.margins?.top;
33567
+ const blockBottomMargin = effectiveBlock.margins?.bottom;
33568
+ if (isFirstSection) {
33569
+ activeSectionBaseTopMargin = typeof blockTopMargin === "number" ? blockTopMargin : margins.top;
33570
+ activeSectionBaseBottomMargin = typeof blockBottomMargin === "number" ? blockBottomMargin : margins.bottom;
33571
+ } else if (blockTopMargin !== void 0 || blockBottomMargin !== void 0) {
33572
+ if (blockTopMargin !== void 0) {
33573
+ pendingSectionBaseTopMargin = typeof blockTopMargin === "number" ? blockTopMargin : margins.top;
33574
+ }
33575
+ if (blockBottomMargin !== void 0) {
33576
+ pendingSectionBaseBottomMargin = typeof blockBottomMargin === "number" ? blockBottomMargin : margins.bottom;
33577
+ }
33578
+ }
33437
33579
  if (effectiveBlock.vAlign) {
33438
33580
  const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
33439
33581
  if (isFirstSection2) {
@@ -33452,7 +33594,6 @@ function layoutDocument(blocks, measures, options = {}) {
33452
33594
  }
33453
33595
  const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
33454
33596
  const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
33455
- const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
33456
33597
  if (Number.isFinite(metadataIndex)) {
33457
33598
  if (isFirstSection) {
33458
33599
  activeSectionIndex = metadataIndex;
@@ -33776,10 +33917,6 @@ function layoutHeaderFooter(blocks, measures, constraints) {
33776
33917
  if (!Number.isFinite(height) || height <= 0) {
33777
33918
  return { pages: [], height: 0 };
33778
33919
  }
33779
- const overflowBase = typeof constraints.overflowBaseHeight === "number" && Number.isFinite(constraints.overflowBaseHeight) && constraints.overflowBaseHeight > 0 ? constraints.overflowBaseHeight : height;
33780
- const maxBehindDocOverflow = Math.max(192, overflowBase * 4);
33781
- const minBehindDocY = -maxBehindDocOverflow;
33782
- const maxBehindDocY = height + maxBehindDocOverflow;
33783
33920
  const marginLeft = constraints.margins?.left ?? 0;
33784
33921
  const transformedBlocks = marginLeft > 0 ? blocks.map((block) => {
33785
33922
  const hasPageRelativeAnchor = (block.kind === "image" || block.kind === "drawing") && block.anchor?.hRelativeFrom === "page" && block.anchor.offsetH != null;
@@ -33818,7 +33955,7 @@ function layoutHeaderFooter(blocks, measures, constraints) {
33818
33955
  );
33819
33956
  }
33820
33957
  const anchoredBlock = block;
33821
- if (anchoredBlock.anchor?.behindDoc && (fragment.y < minBehindDocY || fragment.y > maxBehindDocY)) {
33958
+ if (anchoredBlock.anchor?.behindDoc) {
33822
33959
  continue;
33823
33960
  }
33824
33961
  }
@@ -35640,6 +35777,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35640
35777
  `[Perf] 4.1 Measure all blocks: ${(measureEnd - measureStart).toFixed(2)}ms (${cacheMisses} measured, ${cacheHits} cached)`
35641
35778
  );
35642
35779
  let headerContentHeights;
35780
+ let headerContentHeightsByRId;
35643
35781
  const hasHeaderBlocks = headerFooter?.headerBlocks && Object.keys(headerFooter.headerBlocks).length > 0;
35644
35782
  const hasHeaderBlocksByRId = headerFooter?.headerBlocksByRId && headerFooter.headerBlocksByRId.size > 0;
35645
35783
  if (headerFooter?.constraints && (hasHeaderBlocks || hasHeaderBlocksByRId)) {
@@ -35679,7 +35817,8 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35679
35817
  }
35680
35818
  }
35681
35819
  if (hasHeaderBlocksByRId && headerFooter.headerBlocksByRId) {
35682
- for (const [_rId, blocks] of headerFooter.headerBlocksByRId) {
35820
+ headerContentHeightsByRId = /* @__PURE__ */ new Map();
35821
+ for (const [rId, blocks] of headerFooter.headerBlocksByRId) {
35683
35822
  if (!blocks || blocks.length === 0) continue;
35684
35823
  const measureConstraints = {
35685
35824
  maxWidth: headerFooter.constraints.width,
@@ -35691,8 +35830,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35691
35830
  height: headerFooter.constraints.height
35692
35831
  });
35693
35832
  if (layout2.height > 0) {
35694
- const currentDefault = headerContentHeights.default ?? 0;
35695
- headerContentHeights.default = Math.max(currentDefault, layout2.height);
35833
+ headerContentHeightsByRId.set(rId, layout2.height);
35696
35834
  }
35697
35835
  }
35698
35836
  }
@@ -35700,6 +35838,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35700
35838
  perfLog(`[Perf] 4.1.5 Pre-layout headers for height: ${(hfPreEnd - hfPreStart).toFixed(2)}ms`);
35701
35839
  }
35702
35840
  let footerContentHeights;
35841
+ let footerContentHeightsByRId;
35703
35842
  const hasFooterBlocks = headerFooter?.footerBlocks && Object.keys(headerFooter.footerBlocks).length > 0;
35704
35843
  const hasFooterBlocksByRId = headerFooter?.footerBlocksByRId && headerFooter.footerBlocksByRId.size > 0;
35705
35844
  if (headerFooter?.constraints && (hasFooterBlocks || hasFooterBlocksByRId)) {
@@ -35742,7 +35881,8 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35742
35881
  }
35743
35882
  }
35744
35883
  if (hasFooterBlocksByRId && headerFooter.footerBlocksByRId) {
35745
- for (const [_rId, blocks] of headerFooter.footerBlocksByRId) {
35884
+ footerContentHeightsByRId = /* @__PURE__ */ new Map();
35885
+ for (const [rId, blocks] of headerFooter.footerBlocksByRId) {
35746
35886
  if (!blocks || blocks.length === 0) continue;
35747
35887
  const measureConstraints = {
35748
35888
  maxWidth: headerFooter.constraints.width,
@@ -35754,8 +35894,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35754
35894
  height: headerFooter.constraints.height
35755
35895
  });
35756
35896
  if (layout2.height > 0) {
35757
- const currentDefault = footerContentHeights.default ?? 0;
35758
- footerContentHeights.default = Math.max(currentDefault, layout2.height);
35897
+ footerContentHeightsByRId.set(rId, layout2.height);
35759
35898
  }
35760
35899
  }
35761
35900
  }
@@ -35770,9 +35909,13 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35770
35909
  let layout = layoutDocument(nextBlocks, measures, {
35771
35910
  ...options,
35772
35911
  headerContentHeights,
35773
- // Pass header heights to prevent overlap
35912
+ // Pass header heights to prevent overlap (per-variant)
35774
35913
  footerContentHeights,
35775
- // Pass footer heights to prevent overlap
35914
+ // Pass footer heights to prevent overlap (per-variant)
35915
+ headerContentHeightsByRId,
35916
+ // Pass header heights by rId for per-page margin calculation
35917
+ footerContentHeightsByRId,
35918
+ // Pass footer heights by rId for per-page margin calculation
35776
35919
  remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
35777
35920
  });
35778
35921
  const layoutEnd = performance.now();
@@ -35820,9 +35963,13 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
35820
35963
  layout = layoutDocument(currentBlocks, currentMeasures, {
35821
35964
  ...options,
35822
35965
  headerContentHeights,
35823
- // Pass header heights to prevent overlap
35966
+ // Pass header heights to prevent overlap (per-variant)
35824
35967
  footerContentHeights,
35825
- // Pass footer heights to prevent overlap
35968
+ // Pass footer heights to prevent overlap (per-variant)
35969
+ headerContentHeightsByRId,
35970
+ // Pass header heights by rId for per-page margin calculation
35971
+ footerContentHeightsByRId,
35972
+ // Pass footer heights by rId for per-page margin calculation
35826
35973
  remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
35827
35974
  });
35828
35975
  const relayoutEnd = performance.now();
@@ -53403,7 +53550,26 @@ class PresentationEditor extends EventEmitter {
53403
53550
  const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
53404
53551
  const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
53405
53552
  const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
53406
- const sectionRId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
53553
+ let sectionRId;
53554
+ if (page?.sectionRefs && kind === "header") {
53555
+ sectionRId = page.sectionRefs.headerRefs?.[headerFooterType];
53556
+ if (!sectionRId && headerFooterType && headerFooterType !== "default" && sectionIndex > 0 && multiSectionId) {
53557
+ const prevSectionIds = multiSectionId.sectionHeaderIds.get(sectionIndex - 1);
53558
+ sectionRId = prevSectionIds?.[headerFooterType] ?? void 0;
53559
+ }
53560
+ if (!sectionRId && headerFooterType !== "default") {
53561
+ sectionRId = page.sectionRefs.headerRefs?.default;
53562
+ }
53563
+ } else if (page?.sectionRefs && kind === "footer") {
53564
+ sectionRId = page.sectionRefs.footerRefs?.[headerFooterType];
53565
+ if (!sectionRId && headerFooterType && headerFooterType !== "default" && sectionIndex > 0 && multiSectionId) {
53566
+ const prevSectionIds = multiSectionId.sectionFooterIds.get(sectionIndex - 1);
53567
+ sectionRId = prevSectionIds?.[headerFooterType] ?? void 0;
53568
+ }
53569
+ if (!sectionRId && headerFooterType !== "default") {
53570
+ sectionRId = page.sectionRefs.footerRefs?.default;
53571
+ }
53572
+ }
53407
53573
  if (!headerFooterType) {
53408
53574
  return null;
53409
53575
  }
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../chunks/jszip-C8_CqJxM.cjs");
4
4
  require("../chunks/helpers-nOdwpmwb.cjs");
5
- const superEditor_converter = require("../chunks/SuperConverter-tcg6NQjY.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-BIrkxV37.cjs");
6
6
  require("../chunks/uuid-R7L08bOx.cjs");
7
7
  exports.SuperConverter = superEditor_converter.SuperConverter;
@@ -1,6 +1,6 @@
1
1
  import "../chunks/jszip-B1fkPkPJ.es.js";
2
2
  import "../chunks/helpers-C8e9wR5l.es.js";
3
- import { S } from "../chunks/SuperConverter-DMbipzpl.es.js";
3
+ import { S } from "../chunks/SuperConverter-Bc9dM-qO.es.js";
4
4
  import "../chunks/uuid-CjlX8hrF.es.js";
5
5
  export {
6
6
  S as SuperConverter
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-BHIGTNEQ.cjs");
3
+ const index = require("./chunks/index-CmmcvSxn.cjs");
4
4
  const superEditor_docxZipper = require("./super-editor/docx-zipper.cjs");
5
5
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
6
6
  const vue = require("./chunks/vue-De9wkgLl.cjs");
7
- const superEditor_converter = require("./chunks/SuperConverter-tcg6NQjY.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-BIrkxV37.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { ax as Node, ay as Mark } from "./chunks/index-BSxlafD_.es.js";
2
- import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-BSxlafD_.es.js";
1
+ import { ax as Node, ay as Mark } from "./chunks/index-BuT4cwmK.es.js";
2
+ import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-BuT4cwmK.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, E as createElementBlock, G as openBlock, K as createBaseVNode } from "./chunks/vue-BnBKJwCW.es.js";
6
- import { S, r } from "./chunks/SuperConverter-DMbipzpl.es.js";
6
+ import { S, r } from "./chunks/SuperConverter-Bc9dM-qO.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-BHIGTNEQ.cjs");
4
- const superdoc = require("./chunks/index-79lZpkMi.cjs");
5
- const superEditor_converter = require("./chunks/SuperConverter-tcg6NQjY.cjs");
3
+ const index = require("./chunks/index-CmmcvSxn.cjs");
4
+ const superdoc = require("./chunks/index-CKi-JNoY.cjs");
5
+ const superEditor_converter = require("./chunks/SuperConverter-BIrkxV37.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  require("./chunks/jszip-C8_CqJxM.cjs");
8
8
  require("./chunks/helpers-nOdwpmwb.cjs");
@@ -1,6 +1,6 @@
1
- import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-BSxlafD_.es.js";
2
- import { D, H, P, S, c } from "./chunks/index-B697vddF.es.js";
3
- import { S as S2, r } from "./chunks/SuperConverter-DMbipzpl.es.js";
1
+ import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-BuT4cwmK.es.js";
2
+ import { D, H, P, S, c } from "./chunks/index-C0irsRkX.es.js";
3
+ import { S as S2, r } from "./chunks/SuperConverter-Bc9dM-qO.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  import "./chunks/jszip-B1fkPkPJ.es.js";
6
6
  import "./chunks/helpers-C8e9wR5l.es.js";