superdoc 1.0.0-beta.20 → 1.0.0-beta.21
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-CPnD95lv.es.js → PdfViewer-CEwbF85g.es.js} +1 -1
- package/dist/chunks/{PdfViewer-DbSf6FKU.cjs → PdfViewer-CqAQvFv3.cjs} +1 -1
- package/dist/chunks/{index-BSHAWPko.es.js → index-BFobqgP4.es.js} +3 -3
- package/dist/chunks/{index-DHhKY9FZ-CyEU4GWR.es.js → index-DSuc12CK-DH_DeF0B.es.js} +1 -1
- package/dist/chunks/{index-DHhKY9FZ-DORT-UR6.cjs → index-DSuc12CK-Dpg5Hd9W.cjs} +1 -1
- package/dist/chunks/{index-DLco7m-w.cjs → index-Dy-eAVHL.cjs} +3 -3
- package/dist/chunks/{super-editor.es-C0tdU_gq.es.js → super-editor.es-B5YJmpPg.es.js} +393 -33
- package/dist/chunks/{super-editor.es-B6lsvAAY.cjs → super-editor.es-C2UuUFg3.cjs} +393 -33
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-m2x13P8G.js → converter-Cw0V00On.js} +4 -4
- package/dist/super-editor/chunks/{docx-zipper-CRSKJF-o.js → docx-zipper-D7k6lS5l.js} +1 -1
- package/dist/super-editor/chunks/{editor-C9r_Jbbg.js → editor-CDWzRc4H.js} +392 -31
- package/dist/super-editor/chunks/{index-DHhKY9FZ.js → index-DSuc12CK.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-fnptYAcU.js → toolbar-CHJspeuY.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +395 -35
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -34663,7 +34663,7 @@ const _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx) =
|
|
|
34663
34663
|
}
|
|
34664
34664
|
return { nodes: nodesToCombine, handled: false };
|
|
34665
34665
|
};
|
|
34666
|
-
const preProcessPageFieldsOnly = (nodes = []) => {
|
|
34666
|
+
const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
|
|
34667
34667
|
const processedNodes = [];
|
|
34668
34668
|
let i = 0;
|
|
34669
34669
|
while (i < nodes.length) {
|
|
@@ -34684,7 +34684,7 @@ const preProcessPageFieldsOnly = (nodes = []) => {
|
|
|
34684
34684
|
for (let j2 = i; j2 <= fieldInfo.endIndex; j2++) {
|
|
34685
34685
|
const passNode = nodes[j2];
|
|
34686
34686
|
if (Array.isArray(passNode.elements)) {
|
|
34687
|
-
const childResult = preProcessPageFieldsOnly(passNode.elements);
|
|
34687
|
+
const childResult = preProcessPageFieldsOnly(passNode.elements, depth + 1);
|
|
34688
34688
|
passNode.elements = childResult.processedNodes;
|
|
34689
34689
|
}
|
|
34690
34690
|
processedNodes.push(passNode);
|
|
@@ -34695,7 +34695,7 @@ const preProcessPageFieldsOnly = (nodes = []) => {
|
|
|
34695
34695
|
}
|
|
34696
34696
|
}
|
|
34697
34697
|
if (Array.isArray(node.elements)) {
|
|
34698
|
-
const childResult = preProcessPageFieldsOnly(node.elements);
|
|
34698
|
+
const childResult = preProcessPageFieldsOnly(node.elements, depth + 1);
|
|
34699
34699
|
node.elements = childResult.processedNodes;
|
|
34700
34700
|
}
|
|
34701
34701
|
processedNodes.push(node);
|
|
@@ -36371,7 +36371,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
36371
36371
|
static getStoredSuperdocVersion(docx) {
|
|
36372
36372
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
36373
36373
|
}
|
|
36374
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
36374
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.21") {
|
|
36375
36375
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
36376
36376
|
}
|
|
36377
36377
|
/**
|
|
@@ -39677,7 +39677,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
39677
39677
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
39678
39678
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
39679
39679
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
39680
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _headerLayoutResults, _footerLayoutResults, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
39680
|
+
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
39681
39681
|
var GOOD_LEAF_SIZE = 200;
|
|
39682
39682
|
var RopeSequence = function RopeSequence2() {
|
|
39683
39683
|
};
|
|
@@ -50867,7 +50867,6 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
50867
50867
|
comments.forEach((c2) => {
|
|
50868
50868
|
commentMap.set(c2.commentId, c2);
|
|
50869
50869
|
});
|
|
50870
|
-
new Set(comments.filter((c2) => c2.parentCommentId).map((c2) => c2.parentCommentId));
|
|
50871
50870
|
const startNodes = [];
|
|
50872
50871
|
const endNodes = [];
|
|
50873
50872
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -53488,7 +53487,7 @@ const isHeadless = (editor) => {
|
|
|
53488
53487
|
const shouldSkipNodeView = (editor) => {
|
|
53489
53488
|
return isHeadless(editor);
|
|
53490
53489
|
};
|
|
53491
|
-
const summaryVersion = "1.0.0-beta.
|
|
53490
|
+
const summaryVersion = "1.0.0-beta.21";
|
|
53492
53491
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
53493
53492
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
53494
53493
|
function mapAttributes(attrs) {
|
|
@@ -54264,7 +54263,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54264
54263
|
{ default: remarkStringify },
|
|
54265
54264
|
{ default: remarkGfm }
|
|
54266
54265
|
] = await Promise.all([
|
|
54267
|
-
import("./index-
|
|
54266
|
+
import("./index-DSuc12CK-DH_DeF0B.es.js"),
|
|
54268
54267
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
54269
54268
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
54270
54269
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -54469,7 +54468,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54469
54468
|
* Process collaboration migrations
|
|
54470
54469
|
*/
|
|
54471
54470
|
processCollaborationMigrations() {
|
|
54472
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
54471
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.21");
|
|
54473
54472
|
if (!this.options.ydoc) return;
|
|
54474
54473
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
54475
54474
|
let docVersion = metaMap.get("version");
|
|
@@ -55156,8 +55155,9 @@ function extractPageNumbering(elements) {
|
|
|
55156
55155
|
const fmt = validFormats.includes(fmtRaw) ? fmtRaw : void 0;
|
|
55157
55156
|
const startRaw = pgNumType.attributes["w:start"];
|
|
55158
55157
|
const startNum = startRaw != null ? Number(startRaw) : void 0;
|
|
55158
|
+
const effectiveFormat = fmt ?? (Number.isFinite(startNum) ? "decimal" : void 0);
|
|
55159
55159
|
return {
|
|
55160
|
-
format:
|
|
55160
|
+
format: effectiveFormat,
|
|
55161
55161
|
...Number.isFinite(startNum) ? { start: Number(startNum) } : {}
|
|
55162
55162
|
};
|
|
55163
55163
|
}
|
|
@@ -62379,6 +62379,84 @@ const getHeaderFooterType = (pageNumber, identifier, options) => {
|
|
|
62379
62379
|
}
|
|
62380
62380
|
return null;
|
|
62381
62381
|
};
|
|
62382
|
+
const defaultMultiSectionIdentifier = () => ({
|
|
62383
|
+
headerIds: { default: null, first: null, even: null, odd: null },
|
|
62384
|
+
footerIds: { default: null, first: null, even: null, odd: null },
|
|
62385
|
+
titlePg: false,
|
|
62386
|
+
alternateHeaders: false,
|
|
62387
|
+
sectionCount: 0,
|
|
62388
|
+
sectionHeaderIds: /* @__PURE__ */ new Map(),
|
|
62389
|
+
sectionFooterIds: /* @__PURE__ */ new Map(),
|
|
62390
|
+
sectionTitlePg: /* @__PURE__ */ new Map()
|
|
62391
|
+
});
|
|
62392
|
+
function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
|
|
62393
|
+
const identifier = defaultMultiSectionIdentifier();
|
|
62394
|
+
identifier.alternateHeaders = Boolean(pageStyles2?.alternateHeaders ?? false);
|
|
62395
|
+
identifier.sectionCount = sectionMetadata.length;
|
|
62396
|
+
for (const section of sectionMetadata) {
|
|
62397
|
+
const idx = section.sectionIndex;
|
|
62398
|
+
if (section.headerRefs) {
|
|
62399
|
+
identifier.sectionHeaderIds.set(idx, {
|
|
62400
|
+
default: section.headerRefs.default ?? null,
|
|
62401
|
+
first: section.headerRefs.first ?? null,
|
|
62402
|
+
even: section.headerRefs.even ?? null,
|
|
62403
|
+
odd: section.headerRefs.odd ?? null
|
|
62404
|
+
});
|
|
62405
|
+
}
|
|
62406
|
+
if (section.footerRefs) {
|
|
62407
|
+
identifier.sectionFooterIds.set(idx, {
|
|
62408
|
+
default: section.footerRefs.default ?? null,
|
|
62409
|
+
first: section.footerRefs.first ?? null,
|
|
62410
|
+
even: section.footerRefs.even ?? null,
|
|
62411
|
+
odd: section.footerRefs.odd ?? null
|
|
62412
|
+
});
|
|
62413
|
+
}
|
|
62414
|
+
const hasFirstHeader = Boolean(section.headerRefs?.first);
|
|
62415
|
+
const hasFirstFooter = Boolean(section.footerRefs?.first);
|
|
62416
|
+
if (hasFirstHeader || hasFirstFooter) {
|
|
62417
|
+
identifier.sectionTitlePg.set(idx, true);
|
|
62418
|
+
}
|
|
62419
|
+
}
|
|
62420
|
+
const section0Headers = identifier.sectionHeaderIds.get(0);
|
|
62421
|
+
const section0Footers = identifier.sectionFooterIds.get(0);
|
|
62422
|
+
if (section0Headers) {
|
|
62423
|
+
identifier.headerIds = { ...section0Headers };
|
|
62424
|
+
}
|
|
62425
|
+
if (section0Footers) {
|
|
62426
|
+
identifier.footerIds = { ...section0Footers };
|
|
62427
|
+
}
|
|
62428
|
+
identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
|
|
62429
|
+
return identifier;
|
|
62430
|
+
}
|
|
62431
|
+
function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, options) {
|
|
62432
|
+
if (pageNumber <= 0) return null;
|
|
62433
|
+
const kind = options?.kind ?? "header";
|
|
62434
|
+
const sectionPageNumber = options?.sectionPageNumber ?? pageNumber;
|
|
62435
|
+
const sectionIds = kind === "header" ? identifier.sectionHeaderIds.get(sectionIndex) : identifier.sectionFooterIds.get(sectionIndex);
|
|
62436
|
+
const ids = sectionIds ?? (kind === "header" ? identifier.headerIds : identifier.footerIds);
|
|
62437
|
+
const hasFirst = Boolean(ids.first);
|
|
62438
|
+
const hasEven = Boolean(ids.even);
|
|
62439
|
+
const hasOdd = Boolean(ids.odd);
|
|
62440
|
+
const hasDefault = Boolean(ids.default);
|
|
62441
|
+
const sectionTitlePg = identifier.sectionTitlePg.get(sectionIndex) ?? identifier.titlePg;
|
|
62442
|
+
const titlePgEnabled = sectionTitlePg && hasFirst;
|
|
62443
|
+
const isFirstPageOfSection = sectionPageNumber === 1;
|
|
62444
|
+
if (isFirstPageOfSection && titlePgEnabled) {
|
|
62445
|
+
return "first";
|
|
62446
|
+
}
|
|
62447
|
+
if (identifier.alternateHeaders) {
|
|
62448
|
+
if (pageNumber % 2 === 0 && (hasEven || hasDefault)) {
|
|
62449
|
+
return hasEven ? "even" : "default";
|
|
62450
|
+
}
|
|
62451
|
+
if (pageNumber % 2 === 1 && (hasOdd || hasDefault)) {
|
|
62452
|
+
return hasOdd ? "odd" : "default";
|
|
62453
|
+
}
|
|
62454
|
+
}
|
|
62455
|
+
if (hasDefault) {
|
|
62456
|
+
return "default";
|
|
62457
|
+
}
|
|
62458
|
+
return null;
|
|
62459
|
+
}
|
|
62382
62460
|
function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
62383
62461
|
const zones = [];
|
|
62384
62462
|
const marginLeft = Math.max(0, margins?.left ?? 0);
|
|
@@ -63529,23 +63607,54 @@ function layoutTableBlock({
|
|
|
63529
63607
|
const headerCount = countHeaderRows(block);
|
|
63530
63608
|
const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
|
|
63531
63609
|
let state2 = ensurePage();
|
|
63610
|
+
const availableHeight = state2.contentBottom - state2.cursorY;
|
|
63611
|
+
let minRequiredHeight = 0;
|
|
63612
|
+
if (measure.rows.length > 0) {
|
|
63613
|
+
minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
|
|
63614
|
+
} else if (measure.totalHeight > 0) {
|
|
63615
|
+
minRequiredHeight = measure.totalHeight;
|
|
63616
|
+
}
|
|
63617
|
+
if (minRequiredHeight > availableHeight && state2.page.fragments.length > 0) {
|
|
63618
|
+
state2 = advanceColumn(state2);
|
|
63619
|
+
}
|
|
63532
63620
|
let currentRow = 0;
|
|
63533
63621
|
let isTableContinuation = false;
|
|
63534
63622
|
let pendingPartialRow = null;
|
|
63623
|
+
if (block.rows.length === 0 && measure.totalHeight > 0) {
|
|
63624
|
+
const height = Math.min(measure.totalHeight, state2.contentBottom - state2.cursorY);
|
|
63625
|
+
const metadata = {
|
|
63626
|
+
columnBoundaries: generateColumnBoundaries(measure),
|
|
63627
|
+
coordinateSystem: "fragment"
|
|
63628
|
+
};
|
|
63629
|
+
const fragment = {
|
|
63630
|
+
kind: "table",
|
|
63631
|
+
blockId: block.id,
|
|
63632
|
+
fromRow: 0,
|
|
63633
|
+
toRow: 0,
|
|
63634
|
+
x: columnX(state2.columnIndex),
|
|
63635
|
+
y: state2.cursorY,
|
|
63636
|
+
width: Math.min(columnWidth, measure.totalWidth || columnWidth),
|
|
63637
|
+
height,
|
|
63638
|
+
metadata
|
|
63639
|
+
};
|
|
63640
|
+
state2.page.fragments.push(fragment);
|
|
63641
|
+
state2.cursorY += height;
|
|
63642
|
+
return;
|
|
63643
|
+
}
|
|
63535
63644
|
while (currentRow < block.rows.length || pendingPartialRow !== null) {
|
|
63536
63645
|
state2 = ensurePage();
|
|
63537
|
-
const
|
|
63646
|
+
const availableHeight2 = state2.contentBottom - state2.cursorY;
|
|
63538
63647
|
let repeatHeaderCount = 0;
|
|
63539
63648
|
if (currentRow === 0 && !pendingPartialRow) {
|
|
63540
63649
|
repeatHeaderCount = 0;
|
|
63541
63650
|
} else {
|
|
63542
|
-
if (headerCount > 0 && headerHeight <=
|
|
63651
|
+
if (headerCount > 0 && headerHeight <= availableHeight2) {
|
|
63543
63652
|
repeatHeaderCount = headerCount;
|
|
63544
|
-
} else if (headerCount > 0 && headerHeight >
|
|
63653
|
+
} else if (headerCount > 0 && headerHeight > availableHeight2) {
|
|
63545
63654
|
repeatHeaderCount = 0;
|
|
63546
63655
|
}
|
|
63547
63656
|
}
|
|
63548
|
-
const availableForBody = repeatHeaderCount > 0 ?
|
|
63657
|
+
const availableForBody = repeatHeaderCount > 0 ? availableHeight2 - headerHeight : availableHeight2;
|
|
63549
63658
|
const fullPageHeight = state2.contentBottom;
|
|
63550
63659
|
if (pendingPartialRow !== null) {
|
|
63551
63660
|
const rowIndex = pendingPartialRow.rowIndex;
|
|
@@ -63924,7 +64033,7 @@ function computeDisplayPageNumber(pages, sections) {
|
|
|
63924
64033
|
let currentSectionIndex = -1;
|
|
63925
64034
|
for (let i = 0; i < pages.length; i++) {
|
|
63926
64035
|
const page = pages[i];
|
|
63927
|
-
const pageSectionIndex = 0;
|
|
64036
|
+
const pageSectionIndex = page.sectionIndex ?? 0;
|
|
63928
64037
|
if (pageSectionIndex !== currentSectionIndex) {
|
|
63929
64038
|
const sectionMetadata2 = sectionMap.get(pageSectionIndex);
|
|
63930
64039
|
if (sectionMetadata2?.numbering?.start !== void 0) {
|
|
@@ -64173,6 +64282,18 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64173
64282
|
};
|
|
64174
64283
|
layoutLog(`[Layout] First section: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
64175
64284
|
}
|
|
64285
|
+
const firstSectionIndexRaw = block.attrs?.sectionIndex;
|
|
64286
|
+
const firstMetadataIndex = typeof firstSectionIndexRaw === "number" ? firstSectionIndexRaw : Number(firstSectionIndexRaw ?? NaN);
|
|
64287
|
+
if (Number.isFinite(firstMetadataIndex)) {
|
|
64288
|
+
activeSectionIndex = firstMetadataIndex;
|
|
64289
|
+
}
|
|
64290
|
+
const firstSectionMetadata = Number.isFinite(firstMetadataIndex) ? sectionMetadataList[firstMetadataIndex] : void 0;
|
|
64291
|
+
if (firstSectionMetadata?.numbering) {
|
|
64292
|
+
if (firstSectionMetadata.numbering.format) activeNumberFormat = firstSectionMetadata.numbering.format;
|
|
64293
|
+
if (typeof firstSectionMetadata.numbering.start === "number") {
|
|
64294
|
+
activePageCounter = firstSectionMetadata.numbering.start;
|
|
64295
|
+
}
|
|
64296
|
+
}
|
|
64176
64297
|
return { decision: { forcePageBreak: false, forceMidPageRegion: false }, state: next };
|
|
64177
64298
|
}
|
|
64178
64299
|
const headerPx = block.margins?.header;
|
|
@@ -64189,7 +64310,15 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64189
64310
|
if (block.orientation) next.pendingOrientation = block.orientation;
|
|
64190
64311
|
const sectionType = block.type ?? "continuous";
|
|
64191
64312
|
const isColumnsChanging = !!block.columns && (block.columns.count !== next.activeColumns.count || block.columns.gap !== next.activeColumns.gap);
|
|
64192
|
-
|
|
64313
|
+
const sectionIndexRaw = block.attrs?.sectionIndex;
|
|
64314
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
64315
|
+
if (Number.isFinite(metadataIndex)) {
|
|
64316
|
+
pendingSectionIndex = metadataIndex;
|
|
64317
|
+
}
|
|
64318
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
64319
|
+
if (sectionMetadata?.numbering) {
|
|
64320
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
64321
|
+
} else if (block.numbering) {
|
|
64193
64322
|
pendingNumbering = { ...block.numbering };
|
|
64194
64323
|
}
|
|
64195
64324
|
if (block.headerRefs || block.footerRefs) {
|
|
@@ -64258,6 +64387,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64258
64387
|
...initialSectionMetadata.footerRefs && { footerRefs: initialSectionMetadata.footerRefs }
|
|
64259
64388
|
};
|
|
64260
64389
|
}
|
|
64390
|
+
let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
|
|
64391
|
+
let pendingSectionIndex = null;
|
|
64261
64392
|
const paginator = createPaginator({
|
|
64262
64393
|
margins: { left: margins.left, right: margins.right },
|
|
64263
64394
|
getActiveTopMargin: () => activeTopMargin,
|
|
@@ -64314,6 +64445,10 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64314
64445
|
activeSectionRefs = pendingSectionRefs;
|
|
64315
64446
|
pendingSectionRefs = null;
|
|
64316
64447
|
}
|
|
64448
|
+
if (pendingSectionIndex !== null) {
|
|
64449
|
+
activeSectionIndex = pendingSectionIndex;
|
|
64450
|
+
pendingSectionIndex = null;
|
|
64451
|
+
}
|
|
64317
64452
|
if (pendingVAlign !== null) {
|
|
64318
64453
|
activeVAlign = pendingVAlign;
|
|
64319
64454
|
pendingVAlign = null;
|
|
@@ -64323,6 +64458,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64323
64458
|
}
|
|
64324
64459
|
if (state2?.page) {
|
|
64325
64460
|
state2.page.numberText = formatPageNumber(activePageCounter, activeNumberFormat);
|
|
64461
|
+
state2.page.sectionIndex = activeSectionIndex;
|
|
64462
|
+
layoutLog(`[Layout] Page ${state2.page.number}: Stamped sectionIndex:`, activeSectionIndex);
|
|
64326
64463
|
if (activeSectionRefs) {
|
|
64327
64464
|
state2.page.sectionRefs = {
|
|
64328
64465
|
...activeSectionRefs.headerRefs && { headerRefs: activeSectionRefs.headerRefs },
|
|
@@ -64509,8 +64646,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64509
64646
|
activeOrientation = updatedState.activeOrientation;
|
|
64510
64647
|
pendingOrientation = updatedState.pendingOrientation;
|
|
64511
64648
|
if (effectiveBlock.vAlign) {
|
|
64512
|
-
const
|
|
64513
|
-
if (
|
|
64649
|
+
const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
64650
|
+
if (isFirstSection2) {
|
|
64514
64651
|
activeVAlign = effectiveBlock.vAlign;
|
|
64515
64652
|
pendingVAlign = null;
|
|
64516
64653
|
} else {
|
|
@@ -64524,6 +64661,36 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64524
64661
|
};
|
|
64525
64662
|
layoutLog(`[Layout] After scheduleSectionBreakCompat: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
64526
64663
|
}
|
|
64664
|
+
const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
|
|
64665
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
64666
|
+
const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
64667
|
+
if (Number.isFinite(metadataIndex)) {
|
|
64668
|
+
if (isFirstSection) {
|
|
64669
|
+
activeSectionIndex = metadataIndex;
|
|
64670
|
+
} else {
|
|
64671
|
+
pendingSectionIndex = metadataIndex;
|
|
64672
|
+
}
|
|
64673
|
+
}
|
|
64674
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
64675
|
+
if (sectionMetadata?.numbering) {
|
|
64676
|
+
if (isFirstSection) {
|
|
64677
|
+
if (sectionMetadata.numbering.format) activeNumberFormat = sectionMetadata.numbering.format;
|
|
64678
|
+
if (typeof sectionMetadata.numbering.start === "number") {
|
|
64679
|
+
activePageCounter = sectionMetadata.numbering.start;
|
|
64680
|
+
}
|
|
64681
|
+
} else {
|
|
64682
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
64683
|
+
}
|
|
64684
|
+
} else if (effectiveBlock.numbering) {
|
|
64685
|
+
if (isFirstSection) {
|
|
64686
|
+
if (effectiveBlock.numbering.format) activeNumberFormat = effectiveBlock.numbering.format;
|
|
64687
|
+
if (typeof effectiveBlock.numbering.start === "number") {
|
|
64688
|
+
activePageCounter = effectiveBlock.numbering.start;
|
|
64689
|
+
}
|
|
64690
|
+
} else {
|
|
64691
|
+
pendingNumbering = { ...effectiveBlock.numbering };
|
|
64692
|
+
}
|
|
64693
|
+
}
|
|
64527
64694
|
if (breakInfo.forceMidPageRegion && block.columns) {
|
|
64528
64695
|
let state2 = paginator.ensurePage();
|
|
64529
64696
|
const columnIndexBefore = state2.columnIndex;
|
|
@@ -65503,8 +65670,11 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
|
65503
65670
|
const { totalPages: docTotalPages } = pageResolver(1);
|
|
65504
65671
|
const useBucketing = FeatureFlags.HF_DIGIT_BUCKETING && docTotalPages >= MIN_PAGES_FOR_BUCKETING;
|
|
65505
65672
|
for (const [type2, blocks] of Object.entries(sections)) {
|
|
65506
|
-
if (!blocks || blocks.length === 0)
|
|
65507
|
-
|
|
65673
|
+
if (!blocks || blocks.length === 0) {
|
|
65674
|
+
continue;
|
|
65675
|
+
}
|
|
65676
|
+
const hasTokens = hasPageTokens(blocks);
|
|
65677
|
+
if (!hasTokens) {
|
|
65508
65678
|
const measures = await cache2.measureBlocks(blocks, constraints, measureBlock2);
|
|
65509
65679
|
const layout = layoutHeaderFooter(blocks, measures, constraints);
|
|
65510
65680
|
result[type2] = { blocks, measures, layout };
|
|
@@ -65526,7 +65696,8 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
|
65526
65696
|
for (const pageNum of pagesToLayout) {
|
|
65527
65697
|
const clonedBlocks = cloneHeaderFooterBlocks(blocks);
|
|
65528
65698
|
const { displayText, totalPages: totalPagesForPage } = pageResolver(pageNum);
|
|
65529
|
-
|
|
65699
|
+
const resolvedPageNum = parseInt(displayText, 10) || pageNum;
|
|
65700
|
+
resolveHeaderFooterTokens(clonedBlocks, resolvedPageNum, totalPagesForPage);
|
|
65530
65701
|
const measures = await cache2.measureBlocks(clonedBlocks, constraints, measureBlock2);
|
|
65531
65702
|
const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints);
|
|
65532
65703
|
pages.push({
|
|
@@ -74831,6 +75002,49 @@ class HeaderFooterLayoutAdapter {
|
|
|
74831
75002
|
});
|
|
74832
75003
|
return hasBlocks ? batch : void 0;
|
|
74833
75004
|
}
|
|
75005
|
+
/**
|
|
75006
|
+
* Retrieves FlowBlocks for ALL header/footer content, keyed by relationship ID.
|
|
75007
|
+
*
|
|
75008
|
+
* Unlike getBatch() which only returns content for variant-associated IDs,
|
|
75009
|
+
* this method returns content for ALL registered header/footer IDs. This is
|
|
75010
|
+
* essential for multi-section documents where different sections may use
|
|
75011
|
+
* different content for the same variant type.
|
|
75012
|
+
*
|
|
75013
|
+
* @param kind - The type of section to retrieve: 'header' or 'footer'
|
|
75014
|
+
* @returns A Map of rId to FlowBlock arrays, or undefined if no content exists
|
|
75015
|
+
*
|
|
75016
|
+
* @example
|
|
75017
|
+
* ```typescript
|
|
75018
|
+
* const footersByRId = adapter.getBlocksByRId('footer');
|
|
75019
|
+
* if (footersByRId) {
|
|
75020
|
+
* // footersByRId.get('rId14') - blocks for footer with rId14
|
|
75021
|
+
* // footersByRId.get('rId18') - blocks for footer with rId18 (different section)
|
|
75022
|
+
* }
|
|
75023
|
+
* ```
|
|
75024
|
+
*/
|
|
75025
|
+
getBlocksByRId(kind) {
|
|
75026
|
+
const descriptors = __privateGet$1(this, _manager).getDescriptors(kind);
|
|
75027
|
+
if (!descriptors.length) return void 0;
|
|
75028
|
+
const blocksMap = /* @__PURE__ */ new Map();
|
|
75029
|
+
descriptors.forEach((descriptor) => {
|
|
75030
|
+
const blocks = __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
75031
|
+
if (blocks && blocks.length > 0) {
|
|
75032
|
+
blocksMap.set(descriptor.id, blocks);
|
|
75033
|
+
}
|
|
75034
|
+
});
|
|
75035
|
+
return blocksMap.size > 0 ? blocksMap : void 0;
|
|
75036
|
+
}
|
|
75037
|
+
/**
|
|
75038
|
+
* Retrieves FlowBlocks for a specific header/footer by its relationship ID.
|
|
75039
|
+
*
|
|
75040
|
+
* @param rId - The relationship ID (e.g., 'rId14')
|
|
75041
|
+
* @returns FlowBlock array for the specified rId, or undefined if not found
|
|
75042
|
+
*/
|
|
75043
|
+
getBlocksForRId(rId) {
|
|
75044
|
+
const descriptor = __privateGet$1(this, _manager).getDescriptorById(rId);
|
|
75045
|
+
if (!descriptor) return void 0;
|
|
75046
|
+
return __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
75047
|
+
}
|
|
74834
75048
|
/**
|
|
74835
75049
|
* Invalidates the cached FlowBlocks for a specific header/footer section.
|
|
74836
75050
|
*
|
|
@@ -75291,8 +75505,11 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
75291
75505
|
__privateAdd$1(this, _headerFooterManager, null);
|
|
75292
75506
|
__privateAdd$1(this, _headerFooterAdapter, null);
|
|
75293
75507
|
__privateAdd$1(this, _headerFooterIdentifier, null);
|
|
75508
|
+
__privateAdd$1(this, _multiSectionIdentifier, null);
|
|
75294
75509
|
__privateAdd$1(this, _headerLayoutResults, null);
|
|
75295
75510
|
__privateAdd$1(this, _footerLayoutResults, null);
|
|
75511
|
+
__privateAdd$1(this, _headerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
75512
|
+
__privateAdd$1(this, _footerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
75296
75513
|
__privateAdd$1(this, _headerDecorationProvider);
|
|
75297
75514
|
__privateAdd$1(this, _footerDecorationProvider);
|
|
75298
75515
|
__privateAdd$1(this, _headerFooterManagerCleanups, []);
|
|
@@ -76449,8 +76666,11 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
76449
76666
|
__privateSet(this, _headerFooterManager, null);
|
|
76450
76667
|
}, "Header/footer manager");
|
|
76451
76668
|
__privateSet(this, _headerFooterIdentifier, null);
|
|
76669
|
+
__privateSet(this, _multiSectionIdentifier, null);
|
|
76452
76670
|
__privateSet(this, _headerLayoutResults, null);
|
|
76453
76671
|
__privateSet(this, _footerLayoutResults, null);
|
|
76672
|
+
__privateGet$1(this, _headerLayoutsByRId).clear();
|
|
76673
|
+
__privateGet$1(this, _footerLayoutsByRId).clear();
|
|
76454
76674
|
__privateSet(this, _headerDecorationProvider, void 0);
|
|
76455
76675
|
__privateSet(this, _footerDecorationProvider, void 0);
|
|
76456
76676
|
__privateSet(this, _session, { mode: "body" });
|
|
@@ -76504,8 +76724,11 @@ _trackedChangesOverrides = /* @__PURE__ */ new WeakMap();
|
|
|
76504
76724
|
_headerFooterManager = /* @__PURE__ */ new WeakMap();
|
|
76505
76725
|
_headerFooterAdapter = /* @__PURE__ */ new WeakMap();
|
|
76506
76726
|
_headerFooterIdentifier = /* @__PURE__ */ new WeakMap();
|
|
76727
|
+
_multiSectionIdentifier = /* @__PURE__ */ new WeakMap();
|
|
76507
76728
|
_headerLayoutResults = /* @__PURE__ */ new WeakMap();
|
|
76508
76729
|
_footerLayoutResults = /* @__PURE__ */ new WeakMap();
|
|
76730
|
+
_headerLayoutsByRId = /* @__PURE__ */ new WeakMap();
|
|
76731
|
+
_footerLayoutsByRId = /* @__PURE__ */ new WeakMap();
|
|
76509
76732
|
_headerDecorationProvider = /* @__PURE__ */ new WeakMap();
|
|
76510
76733
|
_footerDecorationProvider = /* @__PURE__ */ new WeakMap();
|
|
76511
76734
|
_headerFooterManagerCleanups = /* @__PURE__ */ new WeakMap();
|
|
@@ -77099,11 +77322,11 @@ rerender_fn = async function() {
|
|
|
77099
77322
|
const sectionMetadata = [];
|
|
77100
77323
|
let blocks;
|
|
77101
77324
|
try {
|
|
77102
|
-
const
|
|
77103
|
-
const converterContext =
|
|
77104
|
-
docx:
|
|
77105
|
-
numbering:
|
|
77106
|
-
linkedStyles:
|
|
77325
|
+
const converter2 = __privateGet$1(this, _editor3).converter;
|
|
77326
|
+
const converterContext = converter2 ? {
|
|
77327
|
+
docx: converter2.convertedXml,
|
|
77328
|
+
numbering: converter2.numbering,
|
|
77329
|
+
linkedStyles: converter2.linkedStyles
|
|
77107
77330
|
} : void 0;
|
|
77108
77331
|
const result = toFlowBlocks(docJson, {
|
|
77109
77332
|
mediaFiles: __privateGet$1(this, _options).mediaFiles,
|
|
@@ -77161,9 +77384,12 @@ rerender_fn = async function() {
|
|
|
77161
77384
|
return;
|
|
77162
77385
|
}
|
|
77163
77386
|
__privateSet(this, _sectionMetadata, sectionMetadata);
|
|
77387
|
+
const converter = __privateGet$1(this, _editor3).converter;
|
|
77388
|
+
__privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
|
|
77164
77389
|
__privateSet(this, _layoutState, { blocks, measures, layout });
|
|
77165
77390
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
77166
77391
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
77392
|
+
await __privateMethod$1(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
77167
77393
|
__privateMethod$1(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
|
|
77168
77394
|
const painter = __privateMethod$1(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks, measures);
|
|
77169
77395
|
if (typeof painter.setProviders === "function") {
|
|
@@ -77177,6 +77403,10 @@ rerender_fn = async function() {
|
|
|
77177
77403
|
headerMeasures.push(...headerResult.measures);
|
|
77178
77404
|
}
|
|
77179
77405
|
}
|
|
77406
|
+
for (const rIdResult of __privateGet$1(this, _headerLayoutsByRId).values()) {
|
|
77407
|
+
headerBlocks.push(...rIdResult.blocks);
|
|
77408
|
+
headerMeasures.push(...rIdResult.measures);
|
|
77409
|
+
}
|
|
77180
77410
|
const footerBlocks = [];
|
|
77181
77411
|
const footerMeasures = [];
|
|
77182
77412
|
if (footerLayouts) {
|
|
@@ -77185,6 +77415,10 @@ rerender_fn = async function() {
|
|
|
77185
77415
|
footerMeasures.push(...footerResult.measures);
|
|
77186
77416
|
}
|
|
77187
77417
|
}
|
|
77418
|
+
for (const rIdResult of __privateGet$1(this, _footerLayoutsByRId).values()) {
|
|
77419
|
+
footerBlocks.push(...rIdResult.blocks);
|
|
77420
|
+
footerMeasures.push(...rIdResult.measures);
|
|
77421
|
+
}
|
|
77188
77422
|
painter.setData?.(
|
|
77189
77423
|
blocks,
|
|
77190
77424
|
measures,
|
|
@@ -77290,7 +77524,9 @@ buildHeaderFooterInput_fn = function() {
|
|
|
77290
77524
|
}
|
|
77291
77525
|
const headerBlocks = __privateGet$1(this, _headerFooterAdapter).getBatch("header");
|
|
77292
77526
|
const footerBlocks = __privateGet$1(this, _headerFooterAdapter).getBatch("footer");
|
|
77293
|
-
|
|
77527
|
+
const headerBlocksByRId = __privateGet$1(this, _headerFooterAdapter).getBlocksByRId("header");
|
|
77528
|
+
const footerBlocksByRId = __privateGet$1(this, _headerFooterAdapter).getBlocksByRId("footer");
|
|
77529
|
+
if (!headerBlocks && !footerBlocks && !headerBlocksByRId && !footerBlocksByRId) {
|
|
77294
77530
|
return null;
|
|
77295
77531
|
}
|
|
77296
77532
|
const constraints = __privateMethod$1(this, _PresentationEditor_instances, computeHeaderFooterConstraints_fn).call(this);
|
|
@@ -77300,6 +77536,8 @@ buildHeaderFooterInput_fn = function() {
|
|
|
77300
77536
|
return {
|
|
77301
77537
|
headerBlocks,
|
|
77302
77538
|
footerBlocks,
|
|
77539
|
+
headerBlocksByRId,
|
|
77540
|
+
footerBlocksByRId,
|
|
77303
77541
|
constraints
|
|
77304
77542
|
};
|
|
77305
77543
|
};
|
|
@@ -77322,6 +77560,80 @@ computeHeaderFooterConstraints_fn = function() {
|
|
|
77322
77560
|
margins: { left: marginLeft, right: marginRight }
|
|
77323
77561
|
};
|
|
77324
77562
|
};
|
|
77563
|
+
layoutPerRIdHeaderFooters_fn = async function(headerFooterInput, layout, sectionMetadata) {
|
|
77564
|
+
__privateGet$1(this, _headerLayoutsByRId).clear();
|
|
77565
|
+
__privateGet$1(this, _footerLayoutsByRId).clear();
|
|
77566
|
+
if (!headerFooterInput) return;
|
|
77567
|
+
const { headerBlocksByRId, footerBlocksByRId, constraints } = headerFooterInput;
|
|
77568
|
+
const displayPages = computeDisplayPageNumber(layout.pages, sectionMetadata);
|
|
77569
|
+
const totalPages = layout.pages.length;
|
|
77570
|
+
const pageResolver = (pageNumber) => {
|
|
77571
|
+
const pageIndex = pageNumber - 1;
|
|
77572
|
+
const displayInfo = displayPages[pageIndex];
|
|
77573
|
+
return {
|
|
77574
|
+
displayText: displayInfo?.displayText ?? String(pageNumber),
|
|
77575
|
+
totalPages
|
|
77576
|
+
};
|
|
77577
|
+
};
|
|
77578
|
+
if (headerBlocksByRId) {
|
|
77579
|
+
for (const [rId, blocks] of headerBlocksByRId) {
|
|
77580
|
+
if (!blocks || blocks.length === 0) continue;
|
|
77581
|
+
try {
|
|
77582
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
77583
|
+
{ default: blocks },
|
|
77584
|
+
// Treat each rId as a 'default' variant
|
|
77585
|
+
constraints,
|
|
77586
|
+
(block, c2) => measureBlock(block, c2),
|
|
77587
|
+
void 0,
|
|
77588
|
+
// Use shared cache
|
|
77589
|
+
void 0,
|
|
77590
|
+
// No legacy totalPages
|
|
77591
|
+
pageResolver
|
|
77592
|
+
);
|
|
77593
|
+
if (batchResult.default) {
|
|
77594
|
+
__privateGet$1(this, _headerLayoutsByRId).set(rId, {
|
|
77595
|
+
kind: "header",
|
|
77596
|
+
type: "default",
|
|
77597
|
+
layout: batchResult.default.layout,
|
|
77598
|
+
blocks: batchResult.default.blocks,
|
|
77599
|
+
measures: batchResult.default.measures
|
|
77600
|
+
});
|
|
77601
|
+
}
|
|
77602
|
+
} catch (error) {
|
|
77603
|
+
console.warn(`[PresentationEditor] Failed to layout header rId=${rId}:`, error);
|
|
77604
|
+
}
|
|
77605
|
+
}
|
|
77606
|
+
}
|
|
77607
|
+
if (footerBlocksByRId) {
|
|
77608
|
+
for (const [rId, blocks] of footerBlocksByRId) {
|
|
77609
|
+
if (!blocks || blocks.length === 0) continue;
|
|
77610
|
+
try {
|
|
77611
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
77612
|
+
{ default: blocks },
|
|
77613
|
+
// Treat each rId as a 'default' variant
|
|
77614
|
+
constraints,
|
|
77615
|
+
(block, c2) => measureBlock(block, c2),
|
|
77616
|
+
void 0,
|
|
77617
|
+
// Use shared cache
|
|
77618
|
+
void 0,
|
|
77619
|
+
// No legacy totalPages
|
|
77620
|
+
pageResolver
|
|
77621
|
+
);
|
|
77622
|
+
if (batchResult.default) {
|
|
77623
|
+
__privateGet$1(this, _footerLayoutsByRId).set(rId, {
|
|
77624
|
+
kind: "footer",
|
|
77625
|
+
type: "default",
|
|
77626
|
+
layout: batchResult.default.layout,
|
|
77627
|
+
blocks: batchResult.default.blocks,
|
|
77628
|
+
measures: batchResult.default.measures
|
|
77629
|
+
});
|
|
77630
|
+
}
|
|
77631
|
+
} catch (error) {
|
|
77632
|
+
console.warn(`[PresentationEditor] Failed to layout footer rId=${rId}:`, error);
|
|
77633
|
+
}
|
|
77634
|
+
}
|
|
77635
|
+
}
|
|
77636
|
+
};
|
|
77325
77637
|
updateDecorationProviders_fn = function(layout) {
|
|
77326
77638
|
__privateSet(this, _headerDecorationProvider, __privateMethod$1(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "header", layout));
|
|
77327
77639
|
__privateSet(this, _footerDecorationProvider, __privateMethod$1(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "footer", layout));
|
|
@@ -77329,15 +77641,63 @@ updateDecorationProviders_fn = function(layout) {
|
|
|
77329
77641
|
};
|
|
77330
77642
|
createDecorationProvider_fn = function(kind, layout) {
|
|
77331
77643
|
const results = kind === "header" ? __privateGet$1(this, _headerLayoutResults) : __privateGet$1(this, _footerLayoutResults);
|
|
77332
|
-
|
|
77644
|
+
const layoutsByRId = kind === "header" ? __privateGet$1(this, _headerLayoutsByRId) : __privateGet$1(this, _footerLayoutsByRId);
|
|
77645
|
+
if ((!results || results.length === 0) && layoutsByRId.size === 0) {
|
|
77333
77646
|
return void 0;
|
|
77334
77647
|
}
|
|
77335
|
-
const
|
|
77648
|
+
const multiSectionId = __privateGet$1(this, _multiSectionIdentifier);
|
|
77649
|
+
const legacyIdentifier = __privateGet$1(this, _headerFooterIdentifier) ?? extractIdentifierFromConverter(__privateGet$1(this, _editor3).converter);
|
|
77650
|
+
const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
|
|
77651
|
+
for (const p of layout.pages) {
|
|
77652
|
+
const idx = p.sectionIndex ?? 0;
|
|
77653
|
+
if (!sectionFirstPageNumbers.has(idx)) {
|
|
77654
|
+
sectionFirstPageNumbers.set(idx, p.number);
|
|
77655
|
+
}
|
|
77656
|
+
}
|
|
77336
77657
|
return (pageNumber, pageMargins, page) => {
|
|
77337
|
-
const
|
|
77658
|
+
const sectionIndex = page?.sectionIndex ?? 0;
|
|
77659
|
+
const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
|
|
77660
|
+
const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
|
|
77661
|
+
const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
|
|
77662
|
+
const sectionRId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
|
|
77338
77663
|
if (!headerFooterType) {
|
|
77339
77664
|
return null;
|
|
77340
77665
|
}
|
|
77666
|
+
if (sectionRId && layoutsByRId.has(sectionRId)) {
|
|
77667
|
+
const rIdLayout = layoutsByRId.get(sectionRId);
|
|
77668
|
+
const slotPage2 = __privateMethod$1(this, _PresentationEditor_instances, findHeaderFooterPageForPageNumber_fn).call(this, rIdLayout.layout.pages, pageNumber);
|
|
77669
|
+
if (slotPage2) {
|
|
77670
|
+
const fragments2 = slotPage2.fragments ?? [];
|
|
77671
|
+
const pageHeight2 = page?.size?.h ?? layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
77672
|
+
const margins2 = pageMargins ?? layout.pages[0]?.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
77673
|
+
const box2 = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins2, pageHeight2);
|
|
77674
|
+
return {
|
|
77675
|
+
fragments: fragments2,
|
|
77676
|
+
height: box2.height,
|
|
77677
|
+
contentHeight: rIdLayout.layout.height ?? box2.height,
|
|
77678
|
+
offset: box2.offset,
|
|
77679
|
+
marginLeft: box2.x,
|
|
77680
|
+
contentWidth: box2.width,
|
|
77681
|
+
headerId: sectionRId,
|
|
77682
|
+
sectionType: headerFooterType,
|
|
77683
|
+
box: {
|
|
77684
|
+
x: box2.x,
|
|
77685
|
+
y: box2.offset,
|
|
77686
|
+
width: box2.width,
|
|
77687
|
+
height: box2.height
|
|
77688
|
+
},
|
|
77689
|
+
hitRegion: {
|
|
77690
|
+
x: box2.x,
|
|
77691
|
+
y: box2.offset,
|
|
77692
|
+
width: box2.width,
|
|
77693
|
+
height: box2.height
|
|
77694
|
+
}
|
|
77695
|
+
};
|
|
77696
|
+
}
|
|
77697
|
+
}
|
|
77698
|
+
if (!results || results.length === 0) {
|
|
77699
|
+
return null;
|
|
77700
|
+
}
|
|
77341
77701
|
const variant = results.find((entry) => entry.type === headerFooterType);
|
|
77342
77702
|
if (!variant || !variant.layout?.pages?.length) {
|
|
77343
77703
|
return null;
|
|
@@ -77350,9 +77710,8 @@ createDecorationProvider_fn = function(kind, layout) {
|
|
|
77350
77710
|
const pageHeight = page?.size?.h ?? layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
77351
77711
|
const margins = pageMargins ?? layout.pages[0]?.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
77352
77712
|
const box = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins, pageHeight);
|
|
77353
|
-
const headerId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
|
|
77354
77713
|
const fallbackId = __privateGet$1(this, _headerFooterManager)?.getVariantId(kind, headerFooterType);
|
|
77355
|
-
const finalHeaderId =
|
|
77714
|
+
const finalHeaderId = sectionRId ?? fallbackId ?? void 0;
|
|
77356
77715
|
return {
|
|
77357
77716
|
fragments,
|
|
77358
77717
|
height: box.height,
|
|
@@ -77582,7 +77941,8 @@ enterHeaderFooterMode_fn = async function(region) {
|
|
|
77582
77941
|
const doc2 = editor.state?.doc;
|
|
77583
77942
|
if (doc2) {
|
|
77584
77943
|
const endPos = doc2.content.size - 1;
|
|
77585
|
-
|
|
77944
|
+
const pos = Math.max(1, endPos);
|
|
77945
|
+
editor.commands?.setTextSelection?.({ from: pos, to: pos });
|
|
77586
77946
|
}
|
|
77587
77947
|
} catch (cursorError) {
|
|
77588
77948
|
console.warn("[PresentationEditor] Could not set cursor to end:", cursorError);
|