@harbour-enterprises/superdoc 1.3.0-next.4 → 1.3.0-next.6
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-DkzZlntQ.cjs → PdfViewer-0pJuKd1x.cjs} +2 -2
- package/dist/chunks/{PdfViewer-BT0Whwl-.es.js → PdfViewer-oYYAvC47.es.js} +2 -2
- package/dist/chunks/{SuperConverter-qB6m0K1X.cjs → SuperConverter-BdOf8skU.cjs} +1 -1
- package/dist/chunks/{SuperConverter-D62X6P1R.es.js → SuperConverter-S9b1fFw5.es.js} +1 -1
- package/dist/chunks/{index-CiR7cacp.es.js → index-9qGjdWOS.es.js} +4 -4
- package/dist/chunks/{index-Buh63pW6.cjs → index-C4RVDXKX.cjs} +361 -43
- package/dist/chunks/{index-Dtd_PFUu.cjs → index-CEDW4NYV.cjs} +4 -4
- package/dist/chunks/{index-BgcNLeK9.es.js → index-CqbujvlE.es.js} +361 -43
- 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 +362 -44
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
|
|
2
2
|
import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
|
|
3
|
-
import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as _getReferencedTableStyles, a4 as decodeRPrFromMarks, a5 as calculateResolvedParagraphProperties, a6 as encodeCSSFromPPr, a7 as encodeCSSFromRPr, a8 as generateOrderedListIndex, a9 as docxNumberingHelpers, aa as InputRule, ab as insertNewRelationship, ac as kebabCase$1, ad as getUnderlineCssString } from "./SuperConverter-
|
|
3
|
+
import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as _getReferencedTableStyles, a4 as decodeRPrFromMarks, a5 as calculateResolvedParagraphProperties, a6 as encodeCSSFromPPr, a7 as encodeCSSFromRPr, a8 as generateOrderedListIndex, a9 as docxNumberingHelpers, aa as InputRule, ab as insertNewRelationship, ac as kebabCase$1, ad as getUnderlineCssString } from "./SuperConverter-S9b1fFw5.es.js";
|
|
4
4
|
import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
|
|
5
5
|
import "./jszip.min-DCl8qkFO.es.js";
|
|
6
6
|
import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
|
|
@@ -15334,7 +15334,7 @@ const canUseDOM = () => {
|
|
|
15334
15334
|
return false;
|
|
15335
15335
|
}
|
|
15336
15336
|
};
|
|
15337
|
-
const summaryVersion = "1.3.0-next.
|
|
15337
|
+
const summaryVersion = "1.3.0-next.6";
|
|
15338
15338
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
15339
15339
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
15340
15340
|
function mapAttributes(attrs) {
|
|
@@ -17967,7 +17967,7 @@ class Editor extends EventEmitter {
|
|
|
17967
17967
|
* Process collaboration migrations
|
|
17968
17968
|
*/
|
|
17969
17969
|
processCollaborationMigrations() {
|
|
17970
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.
|
|
17970
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.6");
|
|
17971
17971
|
if (!this.options.ydoc) return;
|
|
17972
17972
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
17973
17973
|
let docVersion = metaMap.get("version");
|
|
@@ -30842,8 +30842,7 @@ function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, opt
|
|
|
30842
30842
|
const titlePgEnabled = sectionTitlePg === true;
|
|
30843
30843
|
const isFirstPageOfSection = sectionPageNumber === 1;
|
|
30844
30844
|
if (isFirstPageOfSection && titlePgEnabled) {
|
|
30845
|
-
if (hasFirst) return "first";
|
|
30846
|
-
if (!hasDefault && !hasEven && !hasOdd) return null;
|
|
30845
|
+
if (hasFirst || hasDefault || hasEven || hasOdd) return "first";
|
|
30847
30846
|
return null;
|
|
30848
30847
|
}
|
|
30849
30848
|
if (identifier.alternateHeaders) {
|
|
@@ -32899,6 +32898,45 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
32899
32898
|
return height;
|
|
32900
32899
|
};
|
|
32901
32900
|
const headerContentHeights = options.headerContentHeights;
|
|
32901
|
+
const footerContentHeights = options.footerContentHeights;
|
|
32902
|
+
const headerContentHeightsByRId = options.headerContentHeightsByRId;
|
|
32903
|
+
const footerContentHeightsByRId = options.footerContentHeightsByRId;
|
|
32904
|
+
const getVariantTypeForPage = (sectionPageNumber, titlePgEnabled, alternateHeaders) => {
|
|
32905
|
+
if (sectionPageNumber === 1 && titlePgEnabled) {
|
|
32906
|
+
return "first";
|
|
32907
|
+
}
|
|
32908
|
+
return "default";
|
|
32909
|
+
};
|
|
32910
|
+
const getHeaderHeightForPage = (variantType, headerRef) => {
|
|
32911
|
+
if (headerRef && headerContentHeightsByRId?.has(headerRef)) {
|
|
32912
|
+
return validateContentHeight(headerContentHeightsByRId.get(headerRef));
|
|
32913
|
+
}
|
|
32914
|
+
if (headerContentHeights) {
|
|
32915
|
+
return validateContentHeight(headerContentHeights[variantType]);
|
|
32916
|
+
}
|
|
32917
|
+
return 0;
|
|
32918
|
+
};
|
|
32919
|
+
const getFooterHeightForPage = (variantType, footerRef) => {
|
|
32920
|
+
if (footerRef && footerContentHeightsByRId?.has(footerRef)) {
|
|
32921
|
+
return validateContentHeight(footerContentHeightsByRId.get(footerRef));
|
|
32922
|
+
}
|
|
32923
|
+
if (footerContentHeights) {
|
|
32924
|
+
return validateContentHeight(footerContentHeights[variantType]);
|
|
32925
|
+
}
|
|
32926
|
+
return 0;
|
|
32927
|
+
};
|
|
32928
|
+
const calculateEffectiveTopMargin = (headerContentHeight, currentHeaderDistance, baseTopMargin) => {
|
|
32929
|
+
if (headerContentHeight > 0) {
|
|
32930
|
+
return Math.max(baseTopMargin, currentHeaderDistance + headerContentHeight);
|
|
32931
|
+
}
|
|
32932
|
+
return baseTopMargin;
|
|
32933
|
+
};
|
|
32934
|
+
const calculateEffectiveBottomMargin = (footerContentHeight, currentFooterDistance, baseBottomMargin) => {
|
|
32935
|
+
if (footerContentHeight > 0) {
|
|
32936
|
+
return Math.max(baseBottomMargin, currentFooterDistance + footerContentHeight);
|
|
32937
|
+
}
|
|
32938
|
+
return baseBottomMargin;
|
|
32939
|
+
};
|
|
32902
32940
|
const maxHeaderContentHeight = headerContentHeights ? Math.max(
|
|
32903
32941
|
0,
|
|
32904
32942
|
validateContentHeight(headerContentHeights.default),
|
|
@@ -32906,9 +32944,6 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
32906
32944
|
validateContentHeight(headerContentHeights.even),
|
|
32907
32945
|
validateContentHeight(headerContentHeights.odd)
|
|
32908
32946
|
) : 0;
|
|
32909
|
-
const headerDistance = margins.header ?? margins.top;
|
|
32910
|
-
const effectiveTopMargin = maxHeaderContentHeight > 0 ? Math.max(margins.top, headerDistance + maxHeaderContentHeight) : margins.top;
|
|
32911
|
-
const footerContentHeights = options.footerContentHeights;
|
|
32912
32947
|
const maxFooterContentHeight = footerContentHeights ? Math.max(
|
|
32913
32948
|
0,
|
|
32914
32949
|
validateContentHeight(footerContentHeights.default),
|
|
@@ -32916,8 +32951,12 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
32916
32951
|
validateContentHeight(footerContentHeights.even),
|
|
32917
32952
|
validateContentHeight(footerContentHeights.odd)
|
|
32918
32953
|
) : 0;
|
|
32954
|
+
const headerDistance = margins.header ?? margins.top;
|
|
32919
32955
|
const footerDistance = margins.footer ?? margins.bottom;
|
|
32920
|
-
const
|
|
32956
|
+
const defaultHeaderHeight = getHeaderHeightForPage("default", void 0);
|
|
32957
|
+
const defaultFooterHeight = getFooterHeightForPage("default", void 0);
|
|
32958
|
+
const effectiveTopMargin = calculateEffectiveTopMargin(defaultHeaderHeight, headerDistance, margins.top);
|
|
32959
|
+
const effectiveBottomMargin = calculateEffectiveBottomMargin(defaultFooterHeight, footerDistance, margins.bottom);
|
|
32921
32960
|
let activeTopMargin = effectiveTopMargin;
|
|
32922
32961
|
let activeBottomMargin = effectiveBottomMargin;
|
|
32923
32962
|
let activeLeftMargin = margins.left;
|
|
@@ -32926,6 +32965,10 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
32926
32965
|
let pendingBottomMargin = null;
|
|
32927
32966
|
let pendingLeftMargin = null;
|
|
32928
32967
|
let pendingRightMargin = null;
|
|
32968
|
+
let activeSectionBaseTopMargin = margins.top;
|
|
32969
|
+
let activeSectionBaseBottomMargin = margins.bottom;
|
|
32970
|
+
let pendingSectionBaseTopMargin = null;
|
|
32971
|
+
let pendingSectionBaseBottomMargin = null;
|
|
32929
32972
|
let activeHeaderDistance = margins.header ?? margins.top;
|
|
32930
32973
|
let pendingHeaderDistance = null;
|
|
32931
32974
|
let activeFooterDistance = margins.footer ?? margins.bottom;
|
|
@@ -33131,6 +33174,7 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
33131
33174
|
}
|
|
33132
33175
|
let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
|
|
33133
33176
|
let pendingSectionIndex = null;
|
|
33177
|
+
const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
|
|
33134
33178
|
const paginator = createPaginator({
|
|
33135
33179
|
margins: paginatorMargins,
|
|
33136
33180
|
getActiveTopMargin: () => activeTopMargin,
|
|
@@ -33144,6 +33188,7 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
33144
33188
|
createPage,
|
|
33145
33189
|
onNewPage: (state) => {
|
|
33146
33190
|
if (!state) {
|
|
33191
|
+
const isEnteringNewSection = pendingSectionIndex !== null;
|
|
33147
33192
|
const applied = applyPendingToActive({
|
|
33148
33193
|
activeTopMargin,
|
|
33149
33194
|
activeBottomMargin,
|
|
@@ -33211,7 +33256,69 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
33211
33256
|
activeVAlign = pendingVAlign;
|
|
33212
33257
|
pendingVAlign = null;
|
|
33213
33258
|
}
|
|
33259
|
+
if (pendingSectionBaseTopMargin !== null) {
|
|
33260
|
+
activeSectionBaseTopMargin = pendingSectionBaseTopMargin;
|
|
33261
|
+
pendingSectionBaseTopMargin = null;
|
|
33262
|
+
}
|
|
33263
|
+
if (pendingSectionBaseBottomMargin !== null) {
|
|
33264
|
+
activeSectionBaseBottomMargin = pendingSectionBaseBottomMargin;
|
|
33265
|
+
pendingSectionBaseBottomMargin = null;
|
|
33266
|
+
}
|
|
33214
33267
|
pageCount += 1;
|
|
33268
|
+
const newPageNumber = pageCount;
|
|
33269
|
+
if (isEnteringNewSection || !sectionFirstPageNumbers.has(activeSectionIndex)) {
|
|
33270
|
+
sectionFirstPageNumbers.set(activeSectionIndex, newPageNumber);
|
|
33271
|
+
}
|
|
33272
|
+
const firstPageInSection = sectionFirstPageNumbers.get(activeSectionIndex) ?? newPageNumber;
|
|
33273
|
+
const sectionPageNumber = newPageNumber - firstPageInSection + 1;
|
|
33274
|
+
const sectionMetadata = sectionMetadataList[activeSectionIndex];
|
|
33275
|
+
const titlePgEnabled = sectionMetadata?.titlePg ?? false;
|
|
33276
|
+
const variantType = getVariantTypeForPage(sectionPageNumber, titlePgEnabled);
|
|
33277
|
+
let headerRef = activeSectionRefs?.headerRefs?.[variantType];
|
|
33278
|
+
let footerRef = activeSectionRefs?.footerRefs?.[variantType];
|
|
33279
|
+
let effectiveVariantType = variantType;
|
|
33280
|
+
if (!headerRef && variantType !== "default" && activeSectionIndex > 0) {
|
|
33281
|
+
const prevSectionMetadata = sectionMetadataList[activeSectionIndex - 1];
|
|
33282
|
+
if (prevSectionMetadata?.headerRefs?.[variantType]) {
|
|
33283
|
+
headerRef = prevSectionMetadata.headerRefs[variantType];
|
|
33284
|
+
layoutLog(
|
|
33285
|
+
`[Layout] Page ${newPageNumber}: Inheriting header '${variantType}' from section ${activeSectionIndex - 1}: ${headerRef}`
|
|
33286
|
+
);
|
|
33287
|
+
}
|
|
33288
|
+
}
|
|
33289
|
+
if (!footerRef && variantType !== "default" && activeSectionIndex > 0) {
|
|
33290
|
+
const prevSectionMetadata = sectionMetadataList[activeSectionIndex - 1];
|
|
33291
|
+
if (prevSectionMetadata?.footerRefs?.[variantType]) {
|
|
33292
|
+
footerRef = prevSectionMetadata.footerRefs[variantType];
|
|
33293
|
+
layoutLog(
|
|
33294
|
+
`[Layout] Page ${newPageNumber}: Inheriting footer '${variantType}' from section ${activeSectionIndex - 1}: ${footerRef}`
|
|
33295
|
+
);
|
|
33296
|
+
}
|
|
33297
|
+
}
|
|
33298
|
+
if (!headerRef && variantType !== "default" && activeSectionRefs?.headerRefs?.default) {
|
|
33299
|
+
headerRef = activeSectionRefs.headerRefs.default;
|
|
33300
|
+
effectiveVariantType = "default";
|
|
33301
|
+
}
|
|
33302
|
+
if (!footerRef && variantType !== "default" && activeSectionRefs?.footerRefs?.default) {
|
|
33303
|
+
footerRef = activeSectionRefs.footerRefs.default;
|
|
33304
|
+
}
|
|
33305
|
+
const headerHeight = getHeaderHeightForPage(effectiveVariantType, headerRef);
|
|
33306
|
+
const footerHeight = getFooterHeightForPage(
|
|
33307
|
+
variantType !== "default" && !activeSectionRefs?.footerRefs?.[variantType] ? "default" : variantType,
|
|
33308
|
+
footerRef
|
|
33309
|
+
);
|
|
33310
|
+
activeTopMargin = calculateEffectiveTopMargin(headerHeight, activeHeaderDistance, activeSectionBaseTopMargin);
|
|
33311
|
+
activeBottomMargin = calculateEffectiveBottomMargin(
|
|
33312
|
+
footerHeight,
|
|
33313
|
+
activeFooterDistance,
|
|
33314
|
+
activeSectionBaseBottomMargin
|
|
33315
|
+
);
|
|
33316
|
+
layoutLog(
|
|
33317
|
+
`[Layout] Page ${newPageNumber}: Using variant '${variantType}' - headerHeight: ${headerHeight}, footerHeight: ${footerHeight}`
|
|
33318
|
+
);
|
|
33319
|
+
layoutLog(
|
|
33320
|
+
`[Layout] Page ${newPageNumber}: Adjusted margins - top: ${activeTopMargin}, bottom: ${activeBottomMargin} (base: ${activeSectionBaseTopMargin}, ${activeSectionBaseBottomMargin})`
|
|
33321
|
+
);
|
|
33215
33322
|
return;
|
|
33216
33323
|
}
|
|
33217
33324
|
if (state?.page) {
|
|
@@ -33417,6 +33524,20 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
33417
33524
|
pendingColumns = updatedState.pendingColumns;
|
|
33418
33525
|
activeOrientation = updatedState.activeOrientation;
|
|
33419
33526
|
pendingOrientation = updatedState.pendingOrientation;
|
|
33527
|
+
const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
33528
|
+
const blockTopMargin = effectiveBlock.margins?.top;
|
|
33529
|
+
const blockBottomMargin = effectiveBlock.margins?.bottom;
|
|
33530
|
+
if (isFirstSection) {
|
|
33531
|
+
activeSectionBaseTopMargin = typeof blockTopMargin === "number" ? blockTopMargin : margins.top;
|
|
33532
|
+
activeSectionBaseBottomMargin = typeof blockBottomMargin === "number" ? blockBottomMargin : margins.bottom;
|
|
33533
|
+
} else if (blockTopMargin !== void 0 || blockBottomMargin !== void 0) {
|
|
33534
|
+
if (blockTopMargin !== void 0) {
|
|
33535
|
+
pendingSectionBaseTopMargin = typeof blockTopMargin === "number" ? blockTopMargin : margins.top;
|
|
33536
|
+
}
|
|
33537
|
+
if (blockBottomMargin !== void 0) {
|
|
33538
|
+
pendingSectionBaseBottomMargin = typeof blockBottomMargin === "number" ? blockBottomMargin : margins.bottom;
|
|
33539
|
+
}
|
|
33540
|
+
}
|
|
33420
33541
|
if (effectiveBlock.vAlign) {
|
|
33421
33542
|
const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
33422
33543
|
if (isFirstSection2) {
|
|
@@ -33435,7 +33556,6 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
33435
33556
|
}
|
|
33436
33557
|
const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
|
|
33437
33558
|
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
33438
|
-
const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
33439
33559
|
if (Number.isFinite(metadataIndex)) {
|
|
33440
33560
|
if (isFirstSection) {
|
|
33441
33561
|
activeSectionIndex = metadataIndex;
|
|
@@ -35623,6 +35743,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
35623
35743
|
`[Perf] 4.1 Measure all blocks: ${(measureEnd - measureStart).toFixed(2)}ms (${cacheMisses} measured, ${cacheHits} cached)`
|
|
35624
35744
|
);
|
|
35625
35745
|
let headerContentHeights;
|
|
35746
|
+
let headerContentHeightsByRId;
|
|
35626
35747
|
const hasHeaderBlocks = headerFooter?.headerBlocks && Object.keys(headerFooter.headerBlocks).length > 0;
|
|
35627
35748
|
const hasHeaderBlocksByRId = headerFooter?.headerBlocksByRId && headerFooter.headerBlocksByRId.size > 0;
|
|
35628
35749
|
if (headerFooter?.constraints && (hasHeaderBlocks || hasHeaderBlocksByRId)) {
|
|
@@ -35662,7 +35783,8 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
35662
35783
|
}
|
|
35663
35784
|
}
|
|
35664
35785
|
if (hasHeaderBlocksByRId && headerFooter.headerBlocksByRId) {
|
|
35665
|
-
|
|
35786
|
+
headerContentHeightsByRId = /* @__PURE__ */ new Map();
|
|
35787
|
+
for (const [rId, blocks] of headerFooter.headerBlocksByRId) {
|
|
35666
35788
|
if (!blocks || blocks.length === 0) continue;
|
|
35667
35789
|
const measureConstraints = {
|
|
35668
35790
|
maxWidth: headerFooter.constraints.width,
|
|
@@ -35674,8 +35796,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
35674
35796
|
height: headerFooter.constraints.height
|
|
35675
35797
|
});
|
|
35676
35798
|
if (layout2.height > 0) {
|
|
35677
|
-
|
|
35678
|
-
headerContentHeights.default = Math.max(currentDefault, layout2.height);
|
|
35799
|
+
headerContentHeightsByRId.set(rId, layout2.height);
|
|
35679
35800
|
}
|
|
35680
35801
|
}
|
|
35681
35802
|
}
|
|
@@ -35683,6 +35804,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
35683
35804
|
perfLog(`[Perf] 4.1.5 Pre-layout headers for height: ${(hfPreEnd - hfPreStart).toFixed(2)}ms`);
|
|
35684
35805
|
}
|
|
35685
35806
|
let footerContentHeights;
|
|
35807
|
+
let footerContentHeightsByRId;
|
|
35686
35808
|
const hasFooterBlocks = headerFooter?.footerBlocks && Object.keys(headerFooter.footerBlocks).length > 0;
|
|
35687
35809
|
const hasFooterBlocksByRId = headerFooter?.footerBlocksByRId && headerFooter.footerBlocksByRId.size > 0;
|
|
35688
35810
|
if (headerFooter?.constraints && (hasFooterBlocks || hasFooterBlocksByRId)) {
|
|
@@ -35725,7 +35847,8 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
35725
35847
|
}
|
|
35726
35848
|
}
|
|
35727
35849
|
if (hasFooterBlocksByRId && headerFooter.footerBlocksByRId) {
|
|
35728
|
-
|
|
35850
|
+
footerContentHeightsByRId = /* @__PURE__ */ new Map();
|
|
35851
|
+
for (const [rId, blocks] of headerFooter.footerBlocksByRId) {
|
|
35729
35852
|
if (!blocks || blocks.length === 0) continue;
|
|
35730
35853
|
const measureConstraints = {
|
|
35731
35854
|
maxWidth: headerFooter.constraints.width,
|
|
@@ -35737,8 +35860,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
35737
35860
|
height: headerFooter.constraints.height
|
|
35738
35861
|
});
|
|
35739
35862
|
if (layout2.height > 0) {
|
|
35740
|
-
|
|
35741
|
-
footerContentHeights.default = Math.max(currentDefault, layout2.height);
|
|
35863
|
+
footerContentHeightsByRId.set(rId, layout2.height);
|
|
35742
35864
|
}
|
|
35743
35865
|
}
|
|
35744
35866
|
}
|
|
@@ -35753,9 +35875,13 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
35753
35875
|
let layout = layoutDocument(nextBlocks, measures, {
|
|
35754
35876
|
...options,
|
|
35755
35877
|
headerContentHeights,
|
|
35756
|
-
// Pass header heights to prevent overlap
|
|
35878
|
+
// Pass header heights to prevent overlap (per-variant)
|
|
35757
35879
|
footerContentHeights,
|
|
35758
|
-
// Pass footer heights to prevent overlap
|
|
35880
|
+
// Pass footer heights to prevent overlap (per-variant)
|
|
35881
|
+
headerContentHeightsByRId,
|
|
35882
|
+
// Pass header heights by rId for per-page margin calculation
|
|
35883
|
+
footerContentHeightsByRId,
|
|
35884
|
+
// Pass footer heights by rId for per-page margin calculation
|
|
35759
35885
|
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
35760
35886
|
});
|
|
35761
35887
|
const layoutEnd = performance.now();
|
|
@@ -35803,9 +35929,13 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
35803
35929
|
layout = layoutDocument(currentBlocks, currentMeasures, {
|
|
35804
35930
|
...options,
|
|
35805
35931
|
headerContentHeights,
|
|
35806
|
-
// Pass header heights to prevent overlap
|
|
35932
|
+
// Pass header heights to prevent overlap (per-variant)
|
|
35807
35933
|
footerContentHeights,
|
|
35808
|
-
// Pass footer heights to prevent overlap
|
|
35934
|
+
// Pass footer heights to prevent overlap (per-variant)
|
|
35935
|
+
headerContentHeightsByRId,
|
|
35936
|
+
// Pass header heights by rId for per-page margin calculation
|
|
35937
|
+
footerContentHeightsByRId,
|
|
35938
|
+
// Pass footer heights by rId for per-page margin calculation
|
|
35809
35939
|
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
35810
35940
|
});
|
|
35811
35941
|
const relayoutEnd = performance.now();
|
|
@@ -41229,6 +41359,19 @@ function tokenNodeToRun(node, positions, defaultFont, defaultSize, inheritedMark
|
|
|
41229
41359
|
const effectiveMarks = nodeMarks.length > 0 ? nodeMarks : marksAsAttrs;
|
|
41230
41360
|
const marks = [...effectiveMarks, ...inheritedMarks ?? []];
|
|
41231
41361
|
applyMarksToRun(run, marks, hyperlinkConfig, themeColors);
|
|
41362
|
+
if (marksAsAttrs.length > 0) {
|
|
41363
|
+
run._explicitFont = true;
|
|
41364
|
+
}
|
|
41365
|
+
console.debug("[token-debug] tokenNodeToRun", {
|
|
41366
|
+
token,
|
|
41367
|
+
fontFamily: run.fontFamily,
|
|
41368
|
+
fontSize: run.fontSize,
|
|
41369
|
+
defaultFont,
|
|
41370
|
+
defaultSize,
|
|
41371
|
+
nodeMarksCount: nodeMarks.length,
|
|
41372
|
+
marksAsAttrsCount: marksAsAttrs.length,
|
|
41373
|
+
inheritedMarksCount: inheritedMarks?.length ?? 0
|
|
41374
|
+
});
|
|
41232
41375
|
return run;
|
|
41233
41376
|
}
|
|
41234
41377
|
const EIGHTHS_PER_POINT = 8;
|
|
@@ -44977,6 +45120,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
44977
45120
|
if (TOKEN_INLINE_TYPES.has(node.type)) {
|
|
44978
45121
|
const tokenKind = TOKEN_INLINE_TYPES.get(node.type);
|
|
44979
45122
|
if (tokenKind) {
|
|
45123
|
+
const marksAsAttrs = Array.isArray(node.attrs?.marksAsAttrs) ? node.attrs.marksAsAttrs : [];
|
|
45124
|
+
const nodeMarks = node.marks ?? [];
|
|
45125
|
+
const effectiveMarks = nodeMarks.length > 0 ? nodeMarks : marksAsAttrs;
|
|
45126
|
+
const mergedMarks = [...effectiveMarks, ...inheritedMarks ?? []];
|
|
44980
45127
|
const tokenRun = tokenNodeToRun(
|
|
44981
45128
|
node,
|
|
44982
45129
|
positions,
|
|
@@ -44993,6 +45140,23 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
44993
45140
|
const inlineStyleId = getInlineStyleId(inheritedMarks);
|
|
44994
45141
|
applyRunStyles2(tokenRun, inlineStyleId, activeRunStyleId);
|
|
44995
45142
|
applyBaseRunDefaults(tokenRun, baseRunDefaults, defaultFont, defaultSize);
|
|
45143
|
+
if (mergedMarks.length > 0) {
|
|
45144
|
+
applyMarksToRun(
|
|
45145
|
+
tokenRun,
|
|
45146
|
+
mergedMarks,
|
|
45147
|
+
hyperlinkConfig,
|
|
45148
|
+
themeColors,
|
|
45149
|
+
converterContext?.backgroundColor
|
|
45150
|
+
);
|
|
45151
|
+
}
|
|
45152
|
+
console.debug("[token-debug] paragraph-token-run", {
|
|
45153
|
+
token: tokenRun.token,
|
|
45154
|
+
fontFamily: tokenRun.fontFamily,
|
|
45155
|
+
fontSize: tokenRun.fontSize,
|
|
45156
|
+
inlineStyleId,
|
|
45157
|
+
runStyleId: activeRunStyleId,
|
|
45158
|
+
mergedMarksCount: mergedMarks.length
|
|
45159
|
+
});
|
|
44996
45160
|
currentRuns.push(tokenRun);
|
|
44997
45161
|
}
|
|
44998
45162
|
return;
|
|
@@ -47977,6 +48141,77 @@ function isLineBreakRun(run) {
|
|
|
47977
48141
|
function isFieldAnnotationRun(run) {
|
|
47978
48142
|
return run.kind === "fieldAnnotation";
|
|
47979
48143
|
}
|
|
48144
|
+
function measureTabAlignmentGroup(startRunIndex, runs, ctx2, decimalSeparator = ".") {
|
|
48145
|
+
const result = {
|
|
48146
|
+
totalWidth: 0,
|
|
48147
|
+
runs: [],
|
|
48148
|
+
endRunIndex: runs.length
|
|
48149
|
+
};
|
|
48150
|
+
let foundDecimal = false;
|
|
48151
|
+
for (let i = startRunIndex; i < runs.length; i++) {
|
|
48152
|
+
const run = runs[i];
|
|
48153
|
+
if (isTabRun(run)) {
|
|
48154
|
+
result.endRunIndex = i;
|
|
48155
|
+
break;
|
|
48156
|
+
}
|
|
48157
|
+
if (isLineBreakRun(run) || run.kind === "break" && run.breakType === "line") {
|
|
48158
|
+
result.endRunIndex = i;
|
|
48159
|
+
break;
|
|
48160
|
+
}
|
|
48161
|
+
if (run.kind === "text" || run.kind === void 0) {
|
|
48162
|
+
const textRun = run;
|
|
48163
|
+
const text = textRun.text || "";
|
|
48164
|
+
if (text.length > 0) {
|
|
48165
|
+
const { font } = buildFontString(textRun);
|
|
48166
|
+
const width = measureRunWidth(text, font, ctx2, textRun, 0);
|
|
48167
|
+
let beforeDecimalWidth;
|
|
48168
|
+
if (!foundDecimal) {
|
|
48169
|
+
const decimalIdx = text.indexOf(decimalSeparator);
|
|
48170
|
+
if (decimalIdx >= 0) {
|
|
48171
|
+
foundDecimal = true;
|
|
48172
|
+
const beforeText = text.slice(0, decimalIdx);
|
|
48173
|
+
beforeDecimalWidth = beforeText.length > 0 ? measureRunWidth(beforeText, font, ctx2, textRun, 0) : 0;
|
|
48174
|
+
result.beforeDecimalWidth = result.totalWidth + beforeDecimalWidth;
|
|
48175
|
+
}
|
|
48176
|
+
}
|
|
48177
|
+
result.runs.push({
|
|
48178
|
+
runIndex: i,
|
|
48179
|
+
width,
|
|
48180
|
+
text,
|
|
48181
|
+
beforeDecimalWidth
|
|
48182
|
+
});
|
|
48183
|
+
result.totalWidth += width;
|
|
48184
|
+
} else {
|
|
48185
|
+
result.runs.push({ runIndex: i, width: 0, text: "" });
|
|
48186
|
+
}
|
|
48187
|
+
continue;
|
|
48188
|
+
}
|
|
48189
|
+
if (isImageRun(run)) {
|
|
48190
|
+
const leftSpace = run.distLeft ?? 0;
|
|
48191
|
+
const rightSpace = run.distRight ?? 0;
|
|
48192
|
+
const imageWidth = run.width + leftSpace + rightSpace;
|
|
48193
|
+
result.runs.push({ runIndex: i, width: imageWidth });
|
|
48194
|
+
result.totalWidth += imageWidth;
|
|
48195
|
+
continue;
|
|
48196
|
+
}
|
|
48197
|
+
if (isFieldAnnotationRun(run)) {
|
|
48198
|
+
const fontSize2 = run.fontSize ?? DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
|
|
48199
|
+
const { font } = buildFontString({
|
|
48200
|
+
fontFamily: run.fontFamily ?? "Arial",
|
|
48201
|
+
fontSize: fontSize2,
|
|
48202
|
+
bold: run.bold,
|
|
48203
|
+
italic: run.italic
|
|
48204
|
+
});
|
|
48205
|
+
const textWidth = run.displayLabel ? measureRunWidth(run.displayLabel, font, ctx2, run, 0) : 0;
|
|
48206
|
+
const pillWidth = textWidth + FIELD_ANNOTATION_PILL_PADDING;
|
|
48207
|
+
result.runs.push({ runIndex: i, width: pillWidth });
|
|
48208
|
+
result.totalWidth += pillWidth;
|
|
48209
|
+
continue;
|
|
48210
|
+
}
|
|
48211
|
+
result.runs.push({ runIndex: i, width: 0 });
|
|
48212
|
+
}
|
|
48213
|
+
return result;
|
|
48214
|
+
}
|
|
47980
48215
|
async function measureBlock(block, constraints) {
|
|
47981
48216
|
const normalized = normalizeConstraints(constraints);
|
|
47982
48217
|
if (block.kind === "drawing") {
|
|
@@ -48100,6 +48335,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48100
48335
|
let pendingTabAlignment = null;
|
|
48101
48336
|
let lastAppliedTabAlign = null;
|
|
48102
48337
|
const warnedTabVals = /* @__PURE__ */ new Set();
|
|
48338
|
+
let activeTabGroup = null;
|
|
48103
48339
|
const validateTabStopVal = (stop) => {
|
|
48104
48340
|
if (!ALLOWED_TAB_VALS.has(stop.val) && !warnedTabVals.has(stop.val)) {
|
|
48105
48341
|
warnedTabVals.add(stop.val);
|
|
@@ -48279,6 +48515,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48279
48515
|
continue;
|
|
48280
48516
|
}
|
|
48281
48517
|
if (isTabRun(run)) {
|
|
48518
|
+
activeTabGroup = null;
|
|
48282
48519
|
if (!currentLine) {
|
|
48283
48520
|
currentLine = {
|
|
48284
48521
|
fromRun: runIndex,
|
|
@@ -48303,12 +48540,6 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48303
48540
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, 12);
|
|
48304
48541
|
currentLine.toRun = runIndex;
|
|
48305
48542
|
currentLine.toChar = 1;
|
|
48306
|
-
if (stop) {
|
|
48307
|
-
validateTabStopVal(stop);
|
|
48308
|
-
pendingTabAlignment = { target: clampedTarget, val: stop.val };
|
|
48309
|
-
} else {
|
|
48310
|
-
pendingTabAlignment = null;
|
|
48311
|
-
}
|
|
48312
48543
|
if (stop && stop.leader && stop.leader !== "none") {
|
|
48313
48544
|
const leaderStyle = stop.leader;
|
|
48314
48545
|
const from3 = Math.min(originX, clampedTarget);
|
|
@@ -48316,6 +48547,36 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48316
48547
|
if (!currentLine.leaders) currentLine.leaders = [];
|
|
48317
48548
|
currentLine.leaders.push({ from: from3, to, style: leaderStyle });
|
|
48318
48549
|
}
|
|
48550
|
+
if (stop) {
|
|
48551
|
+
validateTabStopVal(stop);
|
|
48552
|
+
if (stop.val === "end" || stop.val === "center" || stop.val === "decimal") {
|
|
48553
|
+
const groupMeasure = measureTabAlignmentGroup(runIndex + 1, runsToProcess, ctx2, decimalSeparator);
|
|
48554
|
+
if (groupMeasure.totalWidth > 0) {
|
|
48555
|
+
let groupStartX;
|
|
48556
|
+
if (stop.val === "end") {
|
|
48557
|
+
groupStartX = Math.max(0, clampedTarget - groupMeasure.totalWidth);
|
|
48558
|
+
} else if (stop.val === "center") {
|
|
48559
|
+
groupStartX = Math.max(0, clampedTarget - groupMeasure.totalWidth / 2);
|
|
48560
|
+
} else {
|
|
48561
|
+
const beforeDecimal = groupMeasure.beforeDecimalWidth ?? groupMeasure.totalWidth;
|
|
48562
|
+
groupStartX = Math.max(0, clampedTarget - beforeDecimal);
|
|
48563
|
+
}
|
|
48564
|
+
activeTabGroup = {
|
|
48565
|
+
measure: groupMeasure,
|
|
48566
|
+
startX: groupStartX,
|
|
48567
|
+
currentX: groupStartX,
|
|
48568
|
+
target: clampedTarget,
|
|
48569
|
+
val: stop.val
|
|
48570
|
+
};
|
|
48571
|
+
currentLine.width = roundValue(groupStartX);
|
|
48572
|
+
}
|
|
48573
|
+
pendingTabAlignment = null;
|
|
48574
|
+
} else {
|
|
48575
|
+
pendingTabAlignment = { target: clampedTarget, val: stop.val };
|
|
48576
|
+
}
|
|
48577
|
+
} else {
|
|
48578
|
+
pendingTabAlignment = null;
|
|
48579
|
+
}
|
|
48319
48580
|
continue;
|
|
48320
48581
|
}
|
|
48321
48582
|
if (isImageRun(run)) {
|
|
@@ -48326,7 +48587,10 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48326
48587
|
const bottomSpace = run.distBottom ?? 0;
|
|
48327
48588
|
const imageHeight = run.height + topSpace + bottomSpace;
|
|
48328
48589
|
let imageStartX;
|
|
48329
|
-
if (
|
|
48590
|
+
if (activeTabGroup && currentLine) {
|
|
48591
|
+
imageStartX = activeTabGroup.currentX;
|
|
48592
|
+
activeTabGroup.currentX = roundValue(activeTabGroup.currentX + imageWidth);
|
|
48593
|
+
} else if (pendingTabAlignment && currentLine) {
|
|
48330
48594
|
imageStartX = alignPendingTabForWidth(imageWidth);
|
|
48331
48595
|
}
|
|
48332
48596
|
if (!currentLine) {
|
|
@@ -48351,10 +48615,14 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48351
48615
|
}
|
|
48352
48616
|
]
|
|
48353
48617
|
};
|
|
48618
|
+
if (activeTabGroup && runIndex + 1 >= activeTabGroup.measure.endRunIndex) {
|
|
48619
|
+
activeTabGroup = null;
|
|
48620
|
+
}
|
|
48354
48621
|
continue;
|
|
48355
48622
|
}
|
|
48356
48623
|
const appliedTabAlign = lastAppliedTabAlign;
|
|
48357
|
-
|
|
48624
|
+
const skipFitCheck = activeTabGroup !== null;
|
|
48625
|
+
if (!skipFitCheck && currentLine.width + imageWidth > currentLine.maxWidth && currentLine.width > 0) {
|
|
48358
48626
|
trimTrailingWrapSpaces(currentLine);
|
|
48359
48627
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
48360
48628
|
const lineBase = currentLine;
|
|
@@ -48367,6 +48635,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48367
48635
|
tabStopCursor = 0;
|
|
48368
48636
|
pendingTabAlignment = null;
|
|
48369
48637
|
lastAppliedTabAlign = null;
|
|
48638
|
+
activeTabGroup = null;
|
|
48370
48639
|
currentLine = {
|
|
48371
48640
|
fromRun: runIndex,
|
|
48372
48641
|
fromChar: 0,
|
|
@@ -48399,6 +48668,9 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48399
48668
|
...imageStartX !== void 0 ? { x: imageStartX } : {}
|
|
48400
48669
|
});
|
|
48401
48670
|
}
|
|
48671
|
+
if (activeTabGroup && runIndex + 1 >= activeTabGroup.measure.endRunIndex) {
|
|
48672
|
+
activeTabGroup = null;
|
|
48673
|
+
}
|
|
48402
48674
|
const tabAlign = appliedTabAlign;
|
|
48403
48675
|
if (tabAlign && currentLine && tabAlign.val === "end") {
|
|
48404
48676
|
currentLine.width = roundValue(tabAlign.target);
|
|
@@ -48574,7 +48846,11 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48574
48846
|
}
|
|
48575
48847
|
}
|
|
48576
48848
|
let segmentStartX;
|
|
48577
|
-
|
|
48849
|
+
let inActiveTabGroup = false;
|
|
48850
|
+
if (activeTabGroup && currentLine) {
|
|
48851
|
+
segmentStartX = activeTabGroup.currentX;
|
|
48852
|
+
inActiveTabGroup = true;
|
|
48853
|
+
} else if (currentLine && pendingTabAlignment) {
|
|
48578
48854
|
segmentStartX = alignSegmentAtTab(segment, font, run, charPosInRun);
|
|
48579
48855
|
if (segmentStartX == null) {
|
|
48580
48856
|
segmentStartX = currentLine.width;
|
|
@@ -48611,6 +48887,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48611
48887
|
tabStopCursor = 0;
|
|
48612
48888
|
pendingTabAlignment = null;
|
|
48613
48889
|
lastAppliedTabAlign = null;
|
|
48890
|
+
activeTabGroup = null;
|
|
48614
48891
|
currentLine = {
|
|
48615
48892
|
fromRun: runIndex,
|
|
48616
48893
|
fromChar: spaceStartChar,
|
|
@@ -48629,7 +48906,19 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48629
48906
|
currentLine.width = roundValue(currentLine.width + boundarySpacing2 + singleSpaceWidth);
|
|
48630
48907
|
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
|
|
48631
48908
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run.fontSize);
|
|
48632
|
-
|
|
48909
|
+
let spaceExplicitX;
|
|
48910
|
+
if (inActiveTabGroup && activeTabGroup) {
|
|
48911
|
+
spaceExplicitX = activeTabGroup.currentX;
|
|
48912
|
+
activeTabGroup.currentX = roundValue(activeTabGroup.currentX + singleSpaceWidth);
|
|
48913
|
+
}
|
|
48914
|
+
appendSegment(
|
|
48915
|
+
currentLine.segments,
|
|
48916
|
+
runIndex,
|
|
48917
|
+
spaceStartChar,
|
|
48918
|
+
spaceEndChar,
|
|
48919
|
+
singleSpaceWidth,
|
|
48920
|
+
spaceExplicitX
|
|
48921
|
+
);
|
|
48633
48922
|
currentLine.spaceCount += 1;
|
|
48634
48923
|
}
|
|
48635
48924
|
}
|
|
@@ -48777,7 +49066,7 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48777
49066
|
const totalWidthWithWord = currentLine.width + boundarySpacing + wordCommitWidth + // Safe cast: only TextRuns produce word segments from split(), other run types are handled earlier
|
|
48778
49067
|
(shouldIncludeDelimiterSpace ? run.letterSpacing ?? 0 : 0);
|
|
48779
49068
|
const availableWidth = currentLine.maxWidth - WIDTH_FUDGE_PX2;
|
|
48780
|
-
let shouldBreak = currentLine.width + boundarySpacing + wordOnlyWidth > availableWidth && currentLine.width > 0 && !isTocEntry;
|
|
49069
|
+
let shouldBreak = !inActiveTabGroup && currentLine.width + boundarySpacing + wordOnlyWidth > availableWidth && currentLine.width > 0 && !isTocEntry;
|
|
48781
49070
|
let compressedWidth = null;
|
|
48782
49071
|
if (shouldBreak && justifyAlignment) {
|
|
48783
49072
|
const isLastNonEmptyWordInSegment = wordIndex === lastNonEmptyWordIndex;
|
|
@@ -48842,15 +49131,14 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48842
49131
|
currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
|
|
48843
49132
|
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
|
|
48844
49133
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run.fontSize);
|
|
48845
|
-
|
|
48846
|
-
|
|
48847
|
-
|
|
48848
|
-
|
|
48849
|
-
|
|
48850
|
-
|
|
48851
|
-
|
|
48852
|
-
|
|
48853
|
-
);
|
|
49134
|
+
let explicitXHere;
|
|
49135
|
+
if (inActiveTabGroup && activeTabGroup) {
|
|
49136
|
+
explicitXHere = activeTabGroup.currentX;
|
|
49137
|
+
activeTabGroup.currentX = roundValue(activeTabGroup.currentX + wordOnlyWidth);
|
|
49138
|
+
} else if (wordIndex === 0 && segmentStartX !== void 0) {
|
|
49139
|
+
explicitXHere = segmentStartX;
|
|
49140
|
+
}
|
|
49141
|
+
appendSegment(currentLine.segments, runIndex, wordStartChar, wordEndNoSpace, wordOnlyWidth, explicitXHere);
|
|
48854
49142
|
trimTrailingWrapSpaces(currentLine);
|
|
48855
49143
|
const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
|
|
48856
49144
|
const lineBase = currentLine;
|
|
@@ -48865,8 +49153,13 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48865
49153
|
}
|
|
48866
49154
|
const newToChar = shouldIncludeDelimiterSpace ? wordEndWithSpace : wordEndNoSpace;
|
|
48867
49155
|
currentLine.toChar = newToChar;
|
|
48868
|
-
|
|
48869
|
-
|
|
49156
|
+
let explicitX;
|
|
49157
|
+
if (inActiveTabGroup && activeTabGroup) {
|
|
49158
|
+
explicitX = activeTabGroup.currentX;
|
|
49159
|
+
activeTabGroup.currentX = roundValue(activeTabGroup.currentX + wordCommitWidth);
|
|
49160
|
+
} else if (wordIndex === 0 && segmentStartX !== void 0) {
|
|
49161
|
+
explicitX = segmentStartX;
|
|
49162
|
+
}
|
|
48870
49163
|
const targetWidth = compressedWidth != null ? compressedWidth : currentLine.width + boundarySpacing + wordCommitWidth + (shouldIncludeDelimiterSpace ? run.letterSpacing ?? 0 : 0);
|
|
48871
49164
|
if (compressedWidth != null) {
|
|
48872
49165
|
currentLine.naturalWidth = roundValue(totalWidthWithWord);
|
|
@@ -48888,6 +49181,12 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
48888
49181
|
}
|
|
48889
49182
|
}
|
|
48890
49183
|
lastAppliedTabAlign = null;
|
|
49184
|
+
if (activeTabGroup && runIndex + 1 >= activeTabGroup.measure.endRunIndex) {
|
|
49185
|
+
if (currentLine && activeTabGroup.val === "end") {
|
|
49186
|
+
currentLine.width = roundValue(activeTabGroup.target);
|
|
49187
|
+
}
|
|
49188
|
+
activeTabGroup = null;
|
|
49189
|
+
}
|
|
48891
49190
|
if (!isLastSegment) {
|
|
48892
49191
|
pendingTabAlignment = null;
|
|
48893
49192
|
if (!currentLine) {
|
|
@@ -53217,7 +53516,26 @@ class PresentationEditor extends EventEmitter {
|
|
|
53217
53516
|
const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
|
|
53218
53517
|
const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
|
|
53219
53518
|
const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
|
|
53220
|
-
|
|
53519
|
+
let sectionRId;
|
|
53520
|
+
if (page?.sectionRefs && kind === "header") {
|
|
53521
|
+
sectionRId = page.sectionRefs.headerRefs?.[headerFooterType];
|
|
53522
|
+
if (!sectionRId && headerFooterType && headerFooterType !== "default" && sectionIndex > 0 && multiSectionId) {
|
|
53523
|
+
const prevSectionIds = multiSectionId.sectionHeaderIds.get(sectionIndex - 1);
|
|
53524
|
+
sectionRId = prevSectionIds?.[headerFooterType] ?? void 0;
|
|
53525
|
+
}
|
|
53526
|
+
if (!sectionRId && headerFooterType !== "default") {
|
|
53527
|
+
sectionRId = page.sectionRefs.headerRefs?.default;
|
|
53528
|
+
}
|
|
53529
|
+
} else if (page?.sectionRefs && kind === "footer") {
|
|
53530
|
+
sectionRId = page.sectionRefs.footerRefs?.[headerFooterType];
|
|
53531
|
+
if (!sectionRId && headerFooterType && headerFooterType !== "default" && sectionIndex > 0 && multiSectionId) {
|
|
53532
|
+
const prevSectionIds = multiSectionId.sectionFooterIds.get(sectionIndex - 1);
|
|
53533
|
+
sectionRId = prevSectionIds?.[headerFooterType] ?? void 0;
|
|
53534
|
+
}
|
|
53535
|
+
if (!sectionRId && headerFooterType !== "default") {
|
|
53536
|
+
sectionRId = page.sectionRefs.footerRefs?.default;
|
|
53537
|
+
}
|
|
53538
|
+
}
|
|
53221
53539
|
if (!headerFooterType) {
|
|
53222
53540
|
return null;
|
|
53223
53541
|
}
|