@harbour-enterprises/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
|
@@ -34680,7 +34680,7 @@ const _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx) =
|
|
|
34680
34680
|
}
|
|
34681
34681
|
return { nodes: nodesToCombine, handled: false };
|
|
34682
34682
|
};
|
|
34683
|
-
const preProcessPageFieldsOnly = (nodes = []) => {
|
|
34683
|
+
const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
|
|
34684
34684
|
const processedNodes = [];
|
|
34685
34685
|
let i = 0;
|
|
34686
34686
|
while (i < nodes.length) {
|
|
@@ -34701,7 +34701,7 @@ const preProcessPageFieldsOnly = (nodes = []) => {
|
|
|
34701
34701
|
for (let j2 = i; j2 <= fieldInfo.endIndex; j2++) {
|
|
34702
34702
|
const passNode = nodes[j2];
|
|
34703
34703
|
if (Array.isArray(passNode.elements)) {
|
|
34704
|
-
const childResult = preProcessPageFieldsOnly(passNode.elements);
|
|
34704
|
+
const childResult = preProcessPageFieldsOnly(passNode.elements, depth + 1);
|
|
34705
34705
|
passNode.elements = childResult.processedNodes;
|
|
34706
34706
|
}
|
|
34707
34707
|
processedNodes.push(passNode);
|
|
@@ -34712,7 +34712,7 @@ const preProcessPageFieldsOnly = (nodes = []) => {
|
|
|
34712
34712
|
}
|
|
34713
34713
|
}
|
|
34714
34714
|
if (Array.isArray(node.elements)) {
|
|
34715
|
-
const childResult = preProcessPageFieldsOnly(node.elements);
|
|
34715
|
+
const childResult = preProcessPageFieldsOnly(node.elements, depth + 1);
|
|
34716
34716
|
node.elements = childResult.processedNodes;
|
|
34717
34717
|
}
|
|
34718
34718
|
processedNodes.push(node);
|
|
@@ -36388,7 +36388,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
36388
36388
|
static getStoredSuperdocVersion(docx) {
|
|
36389
36389
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
36390
36390
|
}
|
|
36391
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
36391
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.21") {
|
|
36392
36392
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
36393
36393
|
}
|
|
36394
36394
|
/**
|
|
@@ -39694,7 +39694,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
39694
39694
|
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);
|
|
39695
39695
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
39696
39696
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
39697
|
-
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;
|
|
39697
|
+
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;
|
|
39698
39698
|
var GOOD_LEAF_SIZE = 200;
|
|
39699
39699
|
var RopeSequence = function RopeSequence2() {
|
|
39700
39700
|
};
|
|
@@ -50884,7 +50884,6 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
50884
50884
|
comments.forEach((c2) => {
|
|
50885
50885
|
commentMap.set(c2.commentId, c2);
|
|
50886
50886
|
});
|
|
50887
|
-
new Set(comments.filter((c2) => c2.parentCommentId).map((c2) => c2.parentCommentId));
|
|
50888
50887
|
const startNodes = [];
|
|
50889
50888
|
const endNodes = [];
|
|
50890
50889
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -53505,7 +53504,7 @@ const isHeadless = (editor) => {
|
|
|
53505
53504
|
const shouldSkipNodeView = (editor) => {
|
|
53506
53505
|
return isHeadless(editor);
|
|
53507
53506
|
};
|
|
53508
|
-
const summaryVersion = "1.0.0-beta.
|
|
53507
|
+
const summaryVersion = "1.0.0-beta.21";
|
|
53509
53508
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
53510
53509
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
53511
53510
|
function mapAttributes(attrs) {
|
|
@@ -54281,7 +54280,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54281
54280
|
{ default: remarkStringify },
|
|
54282
54281
|
{ default: remarkGfm }
|
|
54283
54282
|
] = await Promise.all([
|
|
54284
|
-
Promise.resolve().then(() => require("./index-
|
|
54283
|
+
Promise.resolve().then(() => require("./index-DSuc12CK-Dpg5Hd9W.cjs")),
|
|
54285
54284
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
54286
54285
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
54287
54286
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -54486,7 +54485,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54486
54485
|
* Process collaboration migrations
|
|
54487
54486
|
*/
|
|
54488
54487
|
processCollaborationMigrations() {
|
|
54489
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
54488
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.21");
|
|
54490
54489
|
if (!this.options.ydoc) return;
|
|
54491
54490
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
54492
54491
|
let docVersion = metaMap.get("version");
|
|
@@ -55173,8 +55172,9 @@ function extractPageNumbering(elements) {
|
|
|
55173
55172
|
const fmt = validFormats.includes(fmtRaw) ? fmtRaw : void 0;
|
|
55174
55173
|
const startRaw = pgNumType.attributes["w:start"];
|
|
55175
55174
|
const startNum = startRaw != null ? Number(startRaw) : void 0;
|
|
55175
|
+
const effectiveFormat = fmt ?? (Number.isFinite(startNum) ? "decimal" : void 0);
|
|
55176
55176
|
return {
|
|
55177
|
-
format:
|
|
55177
|
+
format: effectiveFormat,
|
|
55178
55178
|
...Number.isFinite(startNum) ? { start: Number(startNum) } : {}
|
|
55179
55179
|
};
|
|
55180
55180
|
}
|
|
@@ -62396,6 +62396,84 @@ const getHeaderFooterType = (pageNumber, identifier, options) => {
|
|
|
62396
62396
|
}
|
|
62397
62397
|
return null;
|
|
62398
62398
|
};
|
|
62399
|
+
const defaultMultiSectionIdentifier = () => ({
|
|
62400
|
+
headerIds: { default: null, first: null, even: null, odd: null },
|
|
62401
|
+
footerIds: { default: null, first: null, even: null, odd: null },
|
|
62402
|
+
titlePg: false,
|
|
62403
|
+
alternateHeaders: false,
|
|
62404
|
+
sectionCount: 0,
|
|
62405
|
+
sectionHeaderIds: /* @__PURE__ */ new Map(),
|
|
62406
|
+
sectionFooterIds: /* @__PURE__ */ new Map(),
|
|
62407
|
+
sectionTitlePg: /* @__PURE__ */ new Map()
|
|
62408
|
+
});
|
|
62409
|
+
function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
|
|
62410
|
+
const identifier = defaultMultiSectionIdentifier();
|
|
62411
|
+
identifier.alternateHeaders = Boolean(pageStyles2?.alternateHeaders ?? false);
|
|
62412
|
+
identifier.sectionCount = sectionMetadata.length;
|
|
62413
|
+
for (const section of sectionMetadata) {
|
|
62414
|
+
const idx = section.sectionIndex;
|
|
62415
|
+
if (section.headerRefs) {
|
|
62416
|
+
identifier.sectionHeaderIds.set(idx, {
|
|
62417
|
+
default: section.headerRefs.default ?? null,
|
|
62418
|
+
first: section.headerRefs.first ?? null,
|
|
62419
|
+
even: section.headerRefs.even ?? null,
|
|
62420
|
+
odd: section.headerRefs.odd ?? null
|
|
62421
|
+
});
|
|
62422
|
+
}
|
|
62423
|
+
if (section.footerRefs) {
|
|
62424
|
+
identifier.sectionFooterIds.set(idx, {
|
|
62425
|
+
default: section.footerRefs.default ?? null,
|
|
62426
|
+
first: section.footerRefs.first ?? null,
|
|
62427
|
+
even: section.footerRefs.even ?? null,
|
|
62428
|
+
odd: section.footerRefs.odd ?? null
|
|
62429
|
+
});
|
|
62430
|
+
}
|
|
62431
|
+
const hasFirstHeader = Boolean(section.headerRefs?.first);
|
|
62432
|
+
const hasFirstFooter = Boolean(section.footerRefs?.first);
|
|
62433
|
+
if (hasFirstHeader || hasFirstFooter) {
|
|
62434
|
+
identifier.sectionTitlePg.set(idx, true);
|
|
62435
|
+
}
|
|
62436
|
+
}
|
|
62437
|
+
const section0Headers = identifier.sectionHeaderIds.get(0);
|
|
62438
|
+
const section0Footers = identifier.sectionFooterIds.get(0);
|
|
62439
|
+
if (section0Headers) {
|
|
62440
|
+
identifier.headerIds = { ...section0Headers };
|
|
62441
|
+
}
|
|
62442
|
+
if (section0Footers) {
|
|
62443
|
+
identifier.footerIds = { ...section0Footers };
|
|
62444
|
+
}
|
|
62445
|
+
identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
|
|
62446
|
+
return identifier;
|
|
62447
|
+
}
|
|
62448
|
+
function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, options) {
|
|
62449
|
+
if (pageNumber <= 0) return null;
|
|
62450
|
+
const kind = options?.kind ?? "header";
|
|
62451
|
+
const sectionPageNumber = options?.sectionPageNumber ?? pageNumber;
|
|
62452
|
+
const sectionIds = kind === "header" ? identifier.sectionHeaderIds.get(sectionIndex) : identifier.sectionFooterIds.get(sectionIndex);
|
|
62453
|
+
const ids = sectionIds ?? (kind === "header" ? identifier.headerIds : identifier.footerIds);
|
|
62454
|
+
const hasFirst = Boolean(ids.first);
|
|
62455
|
+
const hasEven = Boolean(ids.even);
|
|
62456
|
+
const hasOdd = Boolean(ids.odd);
|
|
62457
|
+
const hasDefault = Boolean(ids.default);
|
|
62458
|
+
const sectionTitlePg = identifier.sectionTitlePg.get(sectionIndex) ?? identifier.titlePg;
|
|
62459
|
+
const titlePgEnabled = sectionTitlePg && hasFirst;
|
|
62460
|
+
const isFirstPageOfSection = sectionPageNumber === 1;
|
|
62461
|
+
if (isFirstPageOfSection && titlePgEnabled) {
|
|
62462
|
+
return "first";
|
|
62463
|
+
}
|
|
62464
|
+
if (identifier.alternateHeaders) {
|
|
62465
|
+
if (pageNumber % 2 === 0 && (hasEven || hasDefault)) {
|
|
62466
|
+
return hasEven ? "even" : "default";
|
|
62467
|
+
}
|
|
62468
|
+
if (pageNumber % 2 === 1 && (hasOdd || hasDefault)) {
|
|
62469
|
+
return hasOdd ? "odd" : "default";
|
|
62470
|
+
}
|
|
62471
|
+
}
|
|
62472
|
+
if (hasDefault) {
|
|
62473
|
+
return "default";
|
|
62474
|
+
}
|
|
62475
|
+
return null;
|
|
62476
|
+
}
|
|
62399
62477
|
function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
62400
62478
|
const zones = [];
|
|
62401
62479
|
const marginLeft = Math.max(0, margins?.left ?? 0);
|
|
@@ -63546,23 +63624,54 @@ function layoutTableBlock({
|
|
|
63546
63624
|
const headerCount = countHeaderRows(block);
|
|
63547
63625
|
const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
|
|
63548
63626
|
let state2 = ensurePage();
|
|
63627
|
+
const availableHeight = state2.contentBottom - state2.cursorY;
|
|
63628
|
+
let minRequiredHeight = 0;
|
|
63629
|
+
if (measure.rows.length > 0) {
|
|
63630
|
+
minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
|
|
63631
|
+
} else if (measure.totalHeight > 0) {
|
|
63632
|
+
minRequiredHeight = measure.totalHeight;
|
|
63633
|
+
}
|
|
63634
|
+
if (minRequiredHeight > availableHeight && state2.page.fragments.length > 0) {
|
|
63635
|
+
state2 = advanceColumn(state2);
|
|
63636
|
+
}
|
|
63549
63637
|
let currentRow = 0;
|
|
63550
63638
|
let isTableContinuation = false;
|
|
63551
63639
|
let pendingPartialRow = null;
|
|
63640
|
+
if (block.rows.length === 0 && measure.totalHeight > 0) {
|
|
63641
|
+
const height = Math.min(measure.totalHeight, state2.contentBottom - state2.cursorY);
|
|
63642
|
+
const metadata = {
|
|
63643
|
+
columnBoundaries: generateColumnBoundaries(measure),
|
|
63644
|
+
coordinateSystem: "fragment"
|
|
63645
|
+
};
|
|
63646
|
+
const fragment = {
|
|
63647
|
+
kind: "table",
|
|
63648
|
+
blockId: block.id,
|
|
63649
|
+
fromRow: 0,
|
|
63650
|
+
toRow: 0,
|
|
63651
|
+
x: columnX(state2.columnIndex),
|
|
63652
|
+
y: state2.cursorY,
|
|
63653
|
+
width: Math.min(columnWidth, measure.totalWidth || columnWidth),
|
|
63654
|
+
height,
|
|
63655
|
+
metadata
|
|
63656
|
+
};
|
|
63657
|
+
state2.page.fragments.push(fragment);
|
|
63658
|
+
state2.cursorY += height;
|
|
63659
|
+
return;
|
|
63660
|
+
}
|
|
63552
63661
|
while (currentRow < block.rows.length || pendingPartialRow !== null) {
|
|
63553
63662
|
state2 = ensurePage();
|
|
63554
|
-
const
|
|
63663
|
+
const availableHeight2 = state2.contentBottom - state2.cursorY;
|
|
63555
63664
|
let repeatHeaderCount = 0;
|
|
63556
63665
|
if (currentRow === 0 && !pendingPartialRow) {
|
|
63557
63666
|
repeatHeaderCount = 0;
|
|
63558
63667
|
} else {
|
|
63559
|
-
if (headerCount > 0 && headerHeight <=
|
|
63668
|
+
if (headerCount > 0 && headerHeight <= availableHeight2) {
|
|
63560
63669
|
repeatHeaderCount = headerCount;
|
|
63561
|
-
} else if (headerCount > 0 && headerHeight >
|
|
63670
|
+
} else if (headerCount > 0 && headerHeight > availableHeight2) {
|
|
63562
63671
|
repeatHeaderCount = 0;
|
|
63563
63672
|
}
|
|
63564
63673
|
}
|
|
63565
|
-
const availableForBody = repeatHeaderCount > 0 ?
|
|
63674
|
+
const availableForBody = repeatHeaderCount > 0 ? availableHeight2 - headerHeight : availableHeight2;
|
|
63566
63675
|
const fullPageHeight = state2.contentBottom;
|
|
63567
63676
|
if (pendingPartialRow !== null) {
|
|
63568
63677
|
const rowIndex = pendingPartialRow.rowIndex;
|
|
@@ -63941,7 +64050,7 @@ function computeDisplayPageNumber(pages, sections) {
|
|
|
63941
64050
|
let currentSectionIndex = -1;
|
|
63942
64051
|
for (let i = 0; i < pages.length; i++) {
|
|
63943
64052
|
const page = pages[i];
|
|
63944
|
-
const pageSectionIndex = 0;
|
|
64053
|
+
const pageSectionIndex = page.sectionIndex ?? 0;
|
|
63945
64054
|
if (pageSectionIndex !== currentSectionIndex) {
|
|
63946
64055
|
const sectionMetadata2 = sectionMap.get(pageSectionIndex);
|
|
63947
64056
|
if (sectionMetadata2?.numbering?.start !== void 0) {
|
|
@@ -64190,6 +64299,18 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64190
64299
|
};
|
|
64191
64300
|
layoutLog(`[Layout] First section: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
64192
64301
|
}
|
|
64302
|
+
const firstSectionIndexRaw = block.attrs?.sectionIndex;
|
|
64303
|
+
const firstMetadataIndex = typeof firstSectionIndexRaw === "number" ? firstSectionIndexRaw : Number(firstSectionIndexRaw ?? NaN);
|
|
64304
|
+
if (Number.isFinite(firstMetadataIndex)) {
|
|
64305
|
+
activeSectionIndex = firstMetadataIndex;
|
|
64306
|
+
}
|
|
64307
|
+
const firstSectionMetadata = Number.isFinite(firstMetadataIndex) ? sectionMetadataList[firstMetadataIndex] : void 0;
|
|
64308
|
+
if (firstSectionMetadata?.numbering) {
|
|
64309
|
+
if (firstSectionMetadata.numbering.format) activeNumberFormat = firstSectionMetadata.numbering.format;
|
|
64310
|
+
if (typeof firstSectionMetadata.numbering.start === "number") {
|
|
64311
|
+
activePageCounter = firstSectionMetadata.numbering.start;
|
|
64312
|
+
}
|
|
64313
|
+
}
|
|
64193
64314
|
return { decision: { forcePageBreak: false, forceMidPageRegion: false }, state: next };
|
|
64194
64315
|
}
|
|
64195
64316
|
const headerPx = block.margins?.header;
|
|
@@ -64206,7 +64327,15 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64206
64327
|
if (block.orientation) next.pendingOrientation = block.orientation;
|
|
64207
64328
|
const sectionType = block.type ?? "continuous";
|
|
64208
64329
|
const isColumnsChanging = !!block.columns && (block.columns.count !== next.activeColumns.count || block.columns.gap !== next.activeColumns.gap);
|
|
64209
|
-
|
|
64330
|
+
const sectionIndexRaw = block.attrs?.sectionIndex;
|
|
64331
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
64332
|
+
if (Number.isFinite(metadataIndex)) {
|
|
64333
|
+
pendingSectionIndex = metadataIndex;
|
|
64334
|
+
}
|
|
64335
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
64336
|
+
if (sectionMetadata?.numbering) {
|
|
64337
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
64338
|
+
} else if (block.numbering) {
|
|
64210
64339
|
pendingNumbering = { ...block.numbering };
|
|
64211
64340
|
}
|
|
64212
64341
|
if (block.headerRefs || block.footerRefs) {
|
|
@@ -64275,6 +64404,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64275
64404
|
...initialSectionMetadata.footerRefs && { footerRefs: initialSectionMetadata.footerRefs }
|
|
64276
64405
|
};
|
|
64277
64406
|
}
|
|
64407
|
+
let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
|
|
64408
|
+
let pendingSectionIndex = null;
|
|
64278
64409
|
const paginator = createPaginator({
|
|
64279
64410
|
margins: { left: margins.left, right: margins.right },
|
|
64280
64411
|
getActiveTopMargin: () => activeTopMargin,
|
|
@@ -64331,6 +64462,10 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64331
64462
|
activeSectionRefs = pendingSectionRefs;
|
|
64332
64463
|
pendingSectionRefs = null;
|
|
64333
64464
|
}
|
|
64465
|
+
if (pendingSectionIndex !== null) {
|
|
64466
|
+
activeSectionIndex = pendingSectionIndex;
|
|
64467
|
+
pendingSectionIndex = null;
|
|
64468
|
+
}
|
|
64334
64469
|
if (pendingVAlign !== null) {
|
|
64335
64470
|
activeVAlign = pendingVAlign;
|
|
64336
64471
|
pendingVAlign = null;
|
|
@@ -64340,6 +64475,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64340
64475
|
}
|
|
64341
64476
|
if (state2?.page) {
|
|
64342
64477
|
state2.page.numberText = formatPageNumber(activePageCounter, activeNumberFormat);
|
|
64478
|
+
state2.page.sectionIndex = activeSectionIndex;
|
|
64479
|
+
layoutLog(`[Layout] Page ${state2.page.number}: Stamped sectionIndex:`, activeSectionIndex);
|
|
64343
64480
|
if (activeSectionRefs) {
|
|
64344
64481
|
state2.page.sectionRefs = {
|
|
64345
64482
|
...activeSectionRefs.headerRefs && { headerRefs: activeSectionRefs.headerRefs },
|
|
@@ -64526,8 +64663,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64526
64663
|
activeOrientation = updatedState.activeOrientation;
|
|
64527
64664
|
pendingOrientation = updatedState.pendingOrientation;
|
|
64528
64665
|
if (effectiveBlock.vAlign) {
|
|
64529
|
-
const
|
|
64530
|
-
if (
|
|
64666
|
+
const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
64667
|
+
if (isFirstSection2) {
|
|
64531
64668
|
activeVAlign = effectiveBlock.vAlign;
|
|
64532
64669
|
pendingVAlign = null;
|
|
64533
64670
|
} else {
|
|
@@ -64541,6 +64678,36 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64541
64678
|
};
|
|
64542
64679
|
layoutLog(`[Layout] After scheduleSectionBreakCompat: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
64543
64680
|
}
|
|
64681
|
+
const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
|
|
64682
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
64683
|
+
const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
64684
|
+
if (Number.isFinite(metadataIndex)) {
|
|
64685
|
+
if (isFirstSection) {
|
|
64686
|
+
activeSectionIndex = metadataIndex;
|
|
64687
|
+
} else {
|
|
64688
|
+
pendingSectionIndex = metadataIndex;
|
|
64689
|
+
}
|
|
64690
|
+
}
|
|
64691
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
64692
|
+
if (sectionMetadata?.numbering) {
|
|
64693
|
+
if (isFirstSection) {
|
|
64694
|
+
if (sectionMetadata.numbering.format) activeNumberFormat = sectionMetadata.numbering.format;
|
|
64695
|
+
if (typeof sectionMetadata.numbering.start === "number") {
|
|
64696
|
+
activePageCounter = sectionMetadata.numbering.start;
|
|
64697
|
+
}
|
|
64698
|
+
} else {
|
|
64699
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
64700
|
+
}
|
|
64701
|
+
} else if (effectiveBlock.numbering) {
|
|
64702
|
+
if (isFirstSection) {
|
|
64703
|
+
if (effectiveBlock.numbering.format) activeNumberFormat = effectiveBlock.numbering.format;
|
|
64704
|
+
if (typeof effectiveBlock.numbering.start === "number") {
|
|
64705
|
+
activePageCounter = effectiveBlock.numbering.start;
|
|
64706
|
+
}
|
|
64707
|
+
} else {
|
|
64708
|
+
pendingNumbering = { ...effectiveBlock.numbering };
|
|
64709
|
+
}
|
|
64710
|
+
}
|
|
64544
64711
|
if (breakInfo.forceMidPageRegion && block.columns) {
|
|
64545
64712
|
let state2 = paginator.ensurePage();
|
|
64546
64713
|
const columnIndexBefore = state2.columnIndex;
|
|
@@ -65520,8 +65687,11 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
|
65520
65687
|
const { totalPages: docTotalPages } = pageResolver(1);
|
|
65521
65688
|
const useBucketing = FeatureFlags.HF_DIGIT_BUCKETING && docTotalPages >= MIN_PAGES_FOR_BUCKETING;
|
|
65522
65689
|
for (const [type2, blocks] of Object.entries(sections)) {
|
|
65523
|
-
if (!blocks || blocks.length === 0)
|
|
65524
|
-
|
|
65690
|
+
if (!blocks || blocks.length === 0) {
|
|
65691
|
+
continue;
|
|
65692
|
+
}
|
|
65693
|
+
const hasTokens = hasPageTokens(blocks);
|
|
65694
|
+
if (!hasTokens) {
|
|
65525
65695
|
const measures = await cache2.measureBlocks(blocks, constraints, measureBlock2);
|
|
65526
65696
|
const layout = layoutHeaderFooter(blocks, measures, constraints);
|
|
65527
65697
|
result[type2] = { blocks, measures, layout };
|
|
@@ -65543,7 +65713,8 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
|
65543
65713
|
for (const pageNum of pagesToLayout) {
|
|
65544
65714
|
const clonedBlocks = cloneHeaderFooterBlocks(blocks);
|
|
65545
65715
|
const { displayText, totalPages: totalPagesForPage } = pageResolver(pageNum);
|
|
65546
|
-
|
|
65716
|
+
const resolvedPageNum = parseInt(displayText, 10) || pageNum;
|
|
65717
|
+
resolveHeaderFooterTokens(clonedBlocks, resolvedPageNum, totalPagesForPage);
|
|
65547
65718
|
const measures = await cache2.measureBlocks(clonedBlocks, constraints, measureBlock2);
|
|
65548
65719
|
const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints);
|
|
65549
65720
|
pages.push({
|
|
@@ -74848,6 +75019,49 @@ class HeaderFooterLayoutAdapter {
|
|
|
74848
75019
|
});
|
|
74849
75020
|
return hasBlocks ? batch : void 0;
|
|
74850
75021
|
}
|
|
75022
|
+
/**
|
|
75023
|
+
* Retrieves FlowBlocks for ALL header/footer content, keyed by relationship ID.
|
|
75024
|
+
*
|
|
75025
|
+
* Unlike getBatch() which only returns content for variant-associated IDs,
|
|
75026
|
+
* this method returns content for ALL registered header/footer IDs. This is
|
|
75027
|
+
* essential for multi-section documents where different sections may use
|
|
75028
|
+
* different content for the same variant type.
|
|
75029
|
+
*
|
|
75030
|
+
* @param kind - The type of section to retrieve: 'header' or 'footer'
|
|
75031
|
+
* @returns A Map of rId to FlowBlock arrays, or undefined if no content exists
|
|
75032
|
+
*
|
|
75033
|
+
* @example
|
|
75034
|
+
* ```typescript
|
|
75035
|
+
* const footersByRId = adapter.getBlocksByRId('footer');
|
|
75036
|
+
* if (footersByRId) {
|
|
75037
|
+
* // footersByRId.get('rId14') - blocks for footer with rId14
|
|
75038
|
+
* // footersByRId.get('rId18') - blocks for footer with rId18 (different section)
|
|
75039
|
+
* }
|
|
75040
|
+
* ```
|
|
75041
|
+
*/
|
|
75042
|
+
getBlocksByRId(kind) {
|
|
75043
|
+
const descriptors = __privateGet$1(this, _manager).getDescriptors(kind);
|
|
75044
|
+
if (!descriptors.length) return void 0;
|
|
75045
|
+
const blocksMap = /* @__PURE__ */ new Map();
|
|
75046
|
+
descriptors.forEach((descriptor) => {
|
|
75047
|
+
const blocks = __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
75048
|
+
if (blocks && blocks.length > 0) {
|
|
75049
|
+
blocksMap.set(descriptor.id, blocks);
|
|
75050
|
+
}
|
|
75051
|
+
});
|
|
75052
|
+
return blocksMap.size > 0 ? blocksMap : void 0;
|
|
75053
|
+
}
|
|
75054
|
+
/**
|
|
75055
|
+
* Retrieves FlowBlocks for a specific header/footer by its relationship ID.
|
|
75056
|
+
*
|
|
75057
|
+
* @param rId - The relationship ID (e.g., 'rId14')
|
|
75058
|
+
* @returns FlowBlock array for the specified rId, or undefined if not found
|
|
75059
|
+
*/
|
|
75060
|
+
getBlocksForRId(rId) {
|
|
75061
|
+
const descriptor = __privateGet$1(this, _manager).getDescriptorById(rId);
|
|
75062
|
+
if (!descriptor) return void 0;
|
|
75063
|
+
return __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
75064
|
+
}
|
|
74851
75065
|
/**
|
|
74852
75066
|
* Invalidates the cached FlowBlocks for a specific header/footer section.
|
|
74853
75067
|
*
|
|
@@ -75308,8 +75522,11 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
75308
75522
|
__privateAdd$1(this, _headerFooterManager, null);
|
|
75309
75523
|
__privateAdd$1(this, _headerFooterAdapter, null);
|
|
75310
75524
|
__privateAdd$1(this, _headerFooterIdentifier, null);
|
|
75525
|
+
__privateAdd$1(this, _multiSectionIdentifier, null);
|
|
75311
75526
|
__privateAdd$1(this, _headerLayoutResults, null);
|
|
75312
75527
|
__privateAdd$1(this, _footerLayoutResults, null);
|
|
75528
|
+
__privateAdd$1(this, _headerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
75529
|
+
__privateAdd$1(this, _footerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
75313
75530
|
__privateAdd$1(this, _headerDecorationProvider);
|
|
75314
75531
|
__privateAdd$1(this, _footerDecorationProvider);
|
|
75315
75532
|
__privateAdd$1(this, _headerFooterManagerCleanups, []);
|
|
@@ -76466,8 +76683,11 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
76466
76683
|
__privateSet(this, _headerFooterManager, null);
|
|
76467
76684
|
}, "Header/footer manager");
|
|
76468
76685
|
__privateSet(this, _headerFooterIdentifier, null);
|
|
76686
|
+
__privateSet(this, _multiSectionIdentifier, null);
|
|
76469
76687
|
__privateSet(this, _headerLayoutResults, null);
|
|
76470
76688
|
__privateSet(this, _footerLayoutResults, null);
|
|
76689
|
+
__privateGet$1(this, _headerLayoutsByRId).clear();
|
|
76690
|
+
__privateGet$1(this, _footerLayoutsByRId).clear();
|
|
76471
76691
|
__privateSet(this, _headerDecorationProvider, void 0);
|
|
76472
76692
|
__privateSet(this, _footerDecorationProvider, void 0);
|
|
76473
76693
|
__privateSet(this, _session, { mode: "body" });
|
|
@@ -76521,8 +76741,11 @@ _trackedChangesOverrides = /* @__PURE__ */ new WeakMap();
|
|
|
76521
76741
|
_headerFooterManager = /* @__PURE__ */ new WeakMap();
|
|
76522
76742
|
_headerFooterAdapter = /* @__PURE__ */ new WeakMap();
|
|
76523
76743
|
_headerFooterIdentifier = /* @__PURE__ */ new WeakMap();
|
|
76744
|
+
_multiSectionIdentifier = /* @__PURE__ */ new WeakMap();
|
|
76524
76745
|
_headerLayoutResults = /* @__PURE__ */ new WeakMap();
|
|
76525
76746
|
_footerLayoutResults = /* @__PURE__ */ new WeakMap();
|
|
76747
|
+
_headerLayoutsByRId = /* @__PURE__ */ new WeakMap();
|
|
76748
|
+
_footerLayoutsByRId = /* @__PURE__ */ new WeakMap();
|
|
76526
76749
|
_headerDecorationProvider = /* @__PURE__ */ new WeakMap();
|
|
76527
76750
|
_footerDecorationProvider = /* @__PURE__ */ new WeakMap();
|
|
76528
76751
|
_headerFooterManagerCleanups = /* @__PURE__ */ new WeakMap();
|
|
@@ -77116,11 +77339,11 @@ rerender_fn = async function() {
|
|
|
77116
77339
|
const sectionMetadata = [];
|
|
77117
77340
|
let blocks;
|
|
77118
77341
|
try {
|
|
77119
|
-
const
|
|
77120
|
-
const converterContext =
|
|
77121
|
-
docx:
|
|
77122
|
-
numbering:
|
|
77123
|
-
linkedStyles:
|
|
77342
|
+
const converter2 = __privateGet$1(this, _editor3).converter;
|
|
77343
|
+
const converterContext = converter2 ? {
|
|
77344
|
+
docx: converter2.convertedXml,
|
|
77345
|
+
numbering: converter2.numbering,
|
|
77346
|
+
linkedStyles: converter2.linkedStyles
|
|
77124
77347
|
} : void 0;
|
|
77125
77348
|
const result = toFlowBlocks(docJson, {
|
|
77126
77349
|
mediaFiles: __privateGet$1(this, _options).mediaFiles,
|
|
@@ -77178,9 +77401,12 @@ rerender_fn = async function() {
|
|
|
77178
77401
|
return;
|
|
77179
77402
|
}
|
|
77180
77403
|
__privateSet(this, _sectionMetadata, sectionMetadata);
|
|
77404
|
+
const converter = __privateGet$1(this, _editor3).converter;
|
|
77405
|
+
__privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
|
|
77181
77406
|
__privateSet(this, _layoutState, { blocks, measures, layout });
|
|
77182
77407
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
77183
77408
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
77409
|
+
await __privateMethod$1(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
77184
77410
|
__privateMethod$1(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
|
|
77185
77411
|
const painter = __privateMethod$1(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks, measures);
|
|
77186
77412
|
if (typeof painter.setProviders === "function") {
|
|
@@ -77194,6 +77420,10 @@ rerender_fn = async function() {
|
|
|
77194
77420
|
headerMeasures.push(...headerResult.measures);
|
|
77195
77421
|
}
|
|
77196
77422
|
}
|
|
77423
|
+
for (const rIdResult of __privateGet$1(this, _headerLayoutsByRId).values()) {
|
|
77424
|
+
headerBlocks.push(...rIdResult.blocks);
|
|
77425
|
+
headerMeasures.push(...rIdResult.measures);
|
|
77426
|
+
}
|
|
77197
77427
|
const footerBlocks = [];
|
|
77198
77428
|
const footerMeasures = [];
|
|
77199
77429
|
if (footerLayouts) {
|
|
@@ -77202,6 +77432,10 @@ rerender_fn = async function() {
|
|
|
77202
77432
|
footerMeasures.push(...footerResult.measures);
|
|
77203
77433
|
}
|
|
77204
77434
|
}
|
|
77435
|
+
for (const rIdResult of __privateGet$1(this, _footerLayoutsByRId).values()) {
|
|
77436
|
+
footerBlocks.push(...rIdResult.blocks);
|
|
77437
|
+
footerMeasures.push(...rIdResult.measures);
|
|
77438
|
+
}
|
|
77205
77439
|
painter.setData?.(
|
|
77206
77440
|
blocks,
|
|
77207
77441
|
measures,
|
|
@@ -77307,7 +77541,9 @@ buildHeaderFooterInput_fn = function() {
|
|
|
77307
77541
|
}
|
|
77308
77542
|
const headerBlocks = __privateGet$1(this, _headerFooterAdapter).getBatch("header");
|
|
77309
77543
|
const footerBlocks = __privateGet$1(this, _headerFooterAdapter).getBatch("footer");
|
|
77310
|
-
|
|
77544
|
+
const headerBlocksByRId = __privateGet$1(this, _headerFooterAdapter).getBlocksByRId("header");
|
|
77545
|
+
const footerBlocksByRId = __privateGet$1(this, _headerFooterAdapter).getBlocksByRId("footer");
|
|
77546
|
+
if (!headerBlocks && !footerBlocks && !headerBlocksByRId && !footerBlocksByRId) {
|
|
77311
77547
|
return null;
|
|
77312
77548
|
}
|
|
77313
77549
|
const constraints = __privateMethod$1(this, _PresentationEditor_instances, computeHeaderFooterConstraints_fn).call(this);
|
|
@@ -77317,6 +77553,8 @@ buildHeaderFooterInput_fn = function() {
|
|
|
77317
77553
|
return {
|
|
77318
77554
|
headerBlocks,
|
|
77319
77555
|
footerBlocks,
|
|
77556
|
+
headerBlocksByRId,
|
|
77557
|
+
footerBlocksByRId,
|
|
77320
77558
|
constraints
|
|
77321
77559
|
};
|
|
77322
77560
|
};
|
|
@@ -77339,6 +77577,80 @@ computeHeaderFooterConstraints_fn = function() {
|
|
|
77339
77577
|
margins: { left: marginLeft, right: marginRight }
|
|
77340
77578
|
};
|
|
77341
77579
|
};
|
|
77580
|
+
layoutPerRIdHeaderFooters_fn = async function(headerFooterInput, layout, sectionMetadata) {
|
|
77581
|
+
__privateGet$1(this, _headerLayoutsByRId).clear();
|
|
77582
|
+
__privateGet$1(this, _footerLayoutsByRId).clear();
|
|
77583
|
+
if (!headerFooterInput) return;
|
|
77584
|
+
const { headerBlocksByRId, footerBlocksByRId, constraints } = headerFooterInput;
|
|
77585
|
+
const displayPages = computeDisplayPageNumber(layout.pages, sectionMetadata);
|
|
77586
|
+
const totalPages = layout.pages.length;
|
|
77587
|
+
const pageResolver = (pageNumber) => {
|
|
77588
|
+
const pageIndex = pageNumber - 1;
|
|
77589
|
+
const displayInfo = displayPages[pageIndex];
|
|
77590
|
+
return {
|
|
77591
|
+
displayText: displayInfo?.displayText ?? String(pageNumber),
|
|
77592
|
+
totalPages
|
|
77593
|
+
};
|
|
77594
|
+
};
|
|
77595
|
+
if (headerBlocksByRId) {
|
|
77596
|
+
for (const [rId, blocks] of headerBlocksByRId) {
|
|
77597
|
+
if (!blocks || blocks.length === 0) continue;
|
|
77598
|
+
try {
|
|
77599
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
77600
|
+
{ default: blocks },
|
|
77601
|
+
// Treat each rId as a 'default' variant
|
|
77602
|
+
constraints,
|
|
77603
|
+
(block, c2) => measureBlock(block, c2),
|
|
77604
|
+
void 0,
|
|
77605
|
+
// Use shared cache
|
|
77606
|
+
void 0,
|
|
77607
|
+
// No legacy totalPages
|
|
77608
|
+
pageResolver
|
|
77609
|
+
);
|
|
77610
|
+
if (batchResult.default) {
|
|
77611
|
+
__privateGet$1(this, _headerLayoutsByRId).set(rId, {
|
|
77612
|
+
kind: "header",
|
|
77613
|
+
type: "default",
|
|
77614
|
+
layout: batchResult.default.layout,
|
|
77615
|
+
blocks: batchResult.default.blocks,
|
|
77616
|
+
measures: batchResult.default.measures
|
|
77617
|
+
});
|
|
77618
|
+
}
|
|
77619
|
+
} catch (error) {
|
|
77620
|
+
console.warn(`[PresentationEditor] Failed to layout header rId=${rId}:`, error);
|
|
77621
|
+
}
|
|
77622
|
+
}
|
|
77623
|
+
}
|
|
77624
|
+
if (footerBlocksByRId) {
|
|
77625
|
+
for (const [rId, blocks] of footerBlocksByRId) {
|
|
77626
|
+
if (!blocks || blocks.length === 0) continue;
|
|
77627
|
+
try {
|
|
77628
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
77629
|
+
{ default: blocks },
|
|
77630
|
+
// Treat each rId as a 'default' variant
|
|
77631
|
+
constraints,
|
|
77632
|
+
(block, c2) => measureBlock(block, c2),
|
|
77633
|
+
void 0,
|
|
77634
|
+
// Use shared cache
|
|
77635
|
+
void 0,
|
|
77636
|
+
// No legacy totalPages
|
|
77637
|
+
pageResolver
|
|
77638
|
+
);
|
|
77639
|
+
if (batchResult.default) {
|
|
77640
|
+
__privateGet$1(this, _footerLayoutsByRId).set(rId, {
|
|
77641
|
+
kind: "footer",
|
|
77642
|
+
type: "default",
|
|
77643
|
+
layout: batchResult.default.layout,
|
|
77644
|
+
blocks: batchResult.default.blocks,
|
|
77645
|
+
measures: batchResult.default.measures
|
|
77646
|
+
});
|
|
77647
|
+
}
|
|
77648
|
+
} catch (error) {
|
|
77649
|
+
console.warn(`[PresentationEditor] Failed to layout footer rId=${rId}:`, error);
|
|
77650
|
+
}
|
|
77651
|
+
}
|
|
77652
|
+
}
|
|
77653
|
+
};
|
|
77342
77654
|
updateDecorationProviders_fn = function(layout) {
|
|
77343
77655
|
__privateSet(this, _headerDecorationProvider, __privateMethod$1(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "header", layout));
|
|
77344
77656
|
__privateSet(this, _footerDecorationProvider, __privateMethod$1(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "footer", layout));
|
|
@@ -77346,15 +77658,63 @@ updateDecorationProviders_fn = function(layout) {
|
|
|
77346
77658
|
};
|
|
77347
77659
|
createDecorationProvider_fn = function(kind, layout) {
|
|
77348
77660
|
const results = kind === "header" ? __privateGet$1(this, _headerLayoutResults) : __privateGet$1(this, _footerLayoutResults);
|
|
77349
|
-
|
|
77661
|
+
const layoutsByRId = kind === "header" ? __privateGet$1(this, _headerLayoutsByRId) : __privateGet$1(this, _footerLayoutsByRId);
|
|
77662
|
+
if ((!results || results.length === 0) && layoutsByRId.size === 0) {
|
|
77350
77663
|
return void 0;
|
|
77351
77664
|
}
|
|
77352
|
-
const
|
|
77665
|
+
const multiSectionId = __privateGet$1(this, _multiSectionIdentifier);
|
|
77666
|
+
const legacyIdentifier = __privateGet$1(this, _headerFooterIdentifier) ?? extractIdentifierFromConverter(__privateGet$1(this, _editor3).converter);
|
|
77667
|
+
const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
|
|
77668
|
+
for (const p of layout.pages) {
|
|
77669
|
+
const idx = p.sectionIndex ?? 0;
|
|
77670
|
+
if (!sectionFirstPageNumbers.has(idx)) {
|
|
77671
|
+
sectionFirstPageNumbers.set(idx, p.number);
|
|
77672
|
+
}
|
|
77673
|
+
}
|
|
77353
77674
|
return (pageNumber, pageMargins, page) => {
|
|
77354
|
-
const
|
|
77675
|
+
const sectionIndex = page?.sectionIndex ?? 0;
|
|
77676
|
+
const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
|
|
77677
|
+
const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
|
|
77678
|
+
const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
|
|
77679
|
+
const sectionRId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
|
|
77355
77680
|
if (!headerFooterType) {
|
|
77356
77681
|
return null;
|
|
77357
77682
|
}
|
|
77683
|
+
if (sectionRId && layoutsByRId.has(sectionRId)) {
|
|
77684
|
+
const rIdLayout = layoutsByRId.get(sectionRId);
|
|
77685
|
+
const slotPage2 = __privateMethod$1(this, _PresentationEditor_instances, findHeaderFooterPageForPageNumber_fn).call(this, rIdLayout.layout.pages, pageNumber);
|
|
77686
|
+
if (slotPage2) {
|
|
77687
|
+
const fragments2 = slotPage2.fragments ?? [];
|
|
77688
|
+
const pageHeight2 = page?.size?.h ?? layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
77689
|
+
const margins2 = pageMargins ?? layout.pages[0]?.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
77690
|
+
const box2 = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins2, pageHeight2);
|
|
77691
|
+
return {
|
|
77692
|
+
fragments: fragments2,
|
|
77693
|
+
height: box2.height,
|
|
77694
|
+
contentHeight: rIdLayout.layout.height ?? box2.height,
|
|
77695
|
+
offset: box2.offset,
|
|
77696
|
+
marginLeft: box2.x,
|
|
77697
|
+
contentWidth: box2.width,
|
|
77698
|
+
headerId: sectionRId,
|
|
77699
|
+
sectionType: headerFooterType,
|
|
77700
|
+
box: {
|
|
77701
|
+
x: box2.x,
|
|
77702
|
+
y: box2.offset,
|
|
77703
|
+
width: box2.width,
|
|
77704
|
+
height: box2.height
|
|
77705
|
+
},
|
|
77706
|
+
hitRegion: {
|
|
77707
|
+
x: box2.x,
|
|
77708
|
+
y: box2.offset,
|
|
77709
|
+
width: box2.width,
|
|
77710
|
+
height: box2.height
|
|
77711
|
+
}
|
|
77712
|
+
};
|
|
77713
|
+
}
|
|
77714
|
+
}
|
|
77715
|
+
if (!results || results.length === 0) {
|
|
77716
|
+
return null;
|
|
77717
|
+
}
|
|
77358
77718
|
const variant = results.find((entry) => entry.type === headerFooterType);
|
|
77359
77719
|
if (!variant || !variant.layout?.pages?.length) {
|
|
77360
77720
|
return null;
|
|
@@ -77367,9 +77727,8 @@ createDecorationProvider_fn = function(kind, layout) {
|
|
|
77367
77727
|
const pageHeight = page?.size?.h ?? layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
77368
77728
|
const margins = pageMargins ?? layout.pages[0]?.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
77369
77729
|
const box = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins, pageHeight);
|
|
77370
|
-
const headerId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
|
|
77371
77730
|
const fallbackId = __privateGet$1(this, _headerFooterManager)?.getVariantId(kind, headerFooterType);
|
|
77372
|
-
const finalHeaderId =
|
|
77731
|
+
const finalHeaderId = sectionRId ?? fallbackId ?? void 0;
|
|
77373
77732
|
return {
|
|
77374
77733
|
fragments,
|
|
77375
77734
|
height: box.height,
|
|
@@ -77599,7 +77958,8 @@ enterHeaderFooterMode_fn = async function(region) {
|
|
|
77599
77958
|
const doc2 = editor.state?.doc;
|
|
77600
77959
|
if (doc2) {
|
|
77601
77960
|
const endPos = doc2.content.size - 1;
|
|
77602
|
-
|
|
77961
|
+
const pos = Math.max(1, endPos);
|
|
77962
|
+
editor.commands?.setTextSelection?.({ from: pos, to: pos });
|
|
77603
77963
|
}
|
|
77604
77964
|
} catch (cursorError) {
|
|
77605
77965
|
console.warn("[PresentationEditor] Could not set cursor to end:", cursorError);
|