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
package/dist/superdoc.umd.js
CHANGED
|
@@ -34681,7 +34681,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34681
34681
|
}
|
|
34682
34682
|
return { nodes: nodesToCombine, handled: false };
|
|
34683
34683
|
};
|
|
34684
|
-
const preProcessPageFieldsOnly = (nodes = []) => {
|
|
34684
|
+
const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
|
|
34685
34685
|
const processedNodes = [];
|
|
34686
34686
|
let i2 = 0;
|
|
34687
34687
|
while (i2 < nodes.length) {
|
|
@@ -34702,7 +34702,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34702
34702
|
for (let j2 = i2; j2 <= fieldInfo.endIndex; j2++) {
|
|
34703
34703
|
const passNode = nodes[j2];
|
|
34704
34704
|
if (Array.isArray(passNode.elements)) {
|
|
34705
|
-
const childResult = preProcessPageFieldsOnly(passNode.elements);
|
|
34705
|
+
const childResult = preProcessPageFieldsOnly(passNode.elements, depth + 1);
|
|
34706
34706
|
passNode.elements = childResult.processedNodes;
|
|
34707
34707
|
}
|
|
34708
34708
|
processedNodes.push(passNode);
|
|
@@ -34713,7 +34713,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34713
34713
|
}
|
|
34714
34714
|
}
|
|
34715
34715
|
if (Array.isArray(node2.elements)) {
|
|
34716
|
-
const childResult = preProcessPageFieldsOnly(node2.elements);
|
|
34716
|
+
const childResult = preProcessPageFieldsOnly(node2.elements, depth + 1);
|
|
34717
34717
|
node2.elements = childResult.processedNodes;
|
|
34718
34718
|
}
|
|
34719
34719
|
processedNodes.push(node2);
|
|
@@ -36389,7 +36389,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36389
36389
|
static getStoredSuperdocVersion(docx) {
|
|
36390
36390
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
36391
36391
|
}
|
|
36392
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
36392
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.21") {
|
|
36393
36393
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
36394
36394
|
}
|
|
36395
36395
|
/**
|
|
@@ -47552,7 +47552,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
47552
47552
|
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);
|
|
47553
47553
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
47554
47554
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
47555
|
-
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;
|
|
47555
|
+
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;
|
|
47556
47556
|
var GOOD_LEAF_SIZE = 200;
|
|
47557
47557
|
var RopeSequence = function RopeSequence2() {
|
|
47558
47558
|
};
|
|
@@ -58742,7 +58742,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58742
58742
|
comments.forEach((c2) => {
|
|
58743
58743
|
commentMap.set(c2.commentId, c2);
|
|
58744
58744
|
});
|
|
58745
|
-
new Set(comments.filter((c2) => c2.parentCommentId).map((c2) => c2.parentCommentId));
|
|
58746
58745
|
const startNodes = [];
|
|
58747
58746
|
const endNodes = [];
|
|
58748
58747
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -61363,7 +61362,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61363
61362
|
const shouldSkipNodeView = (editor) => {
|
|
61364
61363
|
return isHeadless(editor);
|
|
61365
61364
|
};
|
|
61366
|
-
const summaryVersion = "1.0.0-beta.
|
|
61365
|
+
const summaryVersion = "1.0.0-beta.21";
|
|
61367
61366
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
61368
61367
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
61369
61368
|
function mapAttributes(attrs) {
|
|
@@ -62139,7 +62138,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62139
62138
|
{ default: remarkStringify2 },
|
|
62140
62139
|
{ default: remarkGfm2 }
|
|
62141
62140
|
] = await Promise.all([
|
|
62142
|
-
Promise.resolve().then(() =>
|
|
62141
|
+
Promise.resolve().then(() => indexDSuc12CK),
|
|
62143
62142
|
Promise.resolve().then(() => indexDRCvimau),
|
|
62144
62143
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
62145
62144
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -62344,7 +62343,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62344
62343
|
* Process collaboration migrations
|
|
62345
62344
|
*/
|
|
62346
62345
|
processCollaborationMigrations() {
|
|
62347
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
62346
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.21");
|
|
62348
62347
|
if (!this.options.ydoc) return;
|
|
62349
62348
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
62350
62349
|
let docVersion = metaMap.get("version");
|
|
@@ -63031,8 +63030,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63031
63030
|
const fmt = validFormats.includes(fmtRaw) ? fmtRaw : void 0;
|
|
63032
63031
|
const startRaw = pgNumType.attributes["w:start"];
|
|
63033
63032
|
const startNum = startRaw != null ? Number(startRaw) : void 0;
|
|
63033
|
+
const effectiveFormat = fmt ?? (Number.isFinite(startNum) ? "decimal" : void 0);
|
|
63034
63034
|
return {
|
|
63035
|
-
format:
|
|
63035
|
+
format: effectiveFormat,
|
|
63036
63036
|
...Number.isFinite(startNum) ? { start: Number(startNum) } : {}
|
|
63037
63037
|
};
|
|
63038
63038
|
}
|
|
@@ -70254,6 +70254,84 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
70254
70254
|
}
|
|
70255
70255
|
return null;
|
|
70256
70256
|
};
|
|
70257
|
+
const defaultMultiSectionIdentifier = () => ({
|
|
70258
|
+
headerIds: { default: null, first: null, even: null, odd: null },
|
|
70259
|
+
footerIds: { default: null, first: null, even: null, odd: null },
|
|
70260
|
+
titlePg: false,
|
|
70261
|
+
alternateHeaders: false,
|
|
70262
|
+
sectionCount: 0,
|
|
70263
|
+
sectionHeaderIds: /* @__PURE__ */ new Map(),
|
|
70264
|
+
sectionFooterIds: /* @__PURE__ */ new Map(),
|
|
70265
|
+
sectionTitlePg: /* @__PURE__ */ new Map()
|
|
70266
|
+
});
|
|
70267
|
+
function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
|
|
70268
|
+
const identifier = defaultMultiSectionIdentifier();
|
|
70269
|
+
identifier.alternateHeaders = Boolean(pageStyles2?.alternateHeaders ?? false);
|
|
70270
|
+
identifier.sectionCount = sectionMetadata.length;
|
|
70271
|
+
for (const section of sectionMetadata) {
|
|
70272
|
+
const idx = section.sectionIndex;
|
|
70273
|
+
if (section.headerRefs) {
|
|
70274
|
+
identifier.sectionHeaderIds.set(idx, {
|
|
70275
|
+
default: section.headerRefs.default ?? null,
|
|
70276
|
+
first: section.headerRefs.first ?? null,
|
|
70277
|
+
even: section.headerRefs.even ?? null,
|
|
70278
|
+
odd: section.headerRefs.odd ?? null
|
|
70279
|
+
});
|
|
70280
|
+
}
|
|
70281
|
+
if (section.footerRefs) {
|
|
70282
|
+
identifier.sectionFooterIds.set(idx, {
|
|
70283
|
+
default: section.footerRefs.default ?? null,
|
|
70284
|
+
first: section.footerRefs.first ?? null,
|
|
70285
|
+
even: section.footerRefs.even ?? null,
|
|
70286
|
+
odd: section.footerRefs.odd ?? null
|
|
70287
|
+
});
|
|
70288
|
+
}
|
|
70289
|
+
const hasFirstHeader = Boolean(section.headerRefs?.first);
|
|
70290
|
+
const hasFirstFooter = Boolean(section.footerRefs?.first);
|
|
70291
|
+
if (hasFirstHeader || hasFirstFooter) {
|
|
70292
|
+
identifier.sectionTitlePg.set(idx, true);
|
|
70293
|
+
}
|
|
70294
|
+
}
|
|
70295
|
+
const section0Headers = identifier.sectionHeaderIds.get(0);
|
|
70296
|
+
const section0Footers = identifier.sectionFooterIds.get(0);
|
|
70297
|
+
if (section0Headers) {
|
|
70298
|
+
identifier.headerIds = { ...section0Headers };
|
|
70299
|
+
}
|
|
70300
|
+
if (section0Footers) {
|
|
70301
|
+
identifier.footerIds = { ...section0Footers };
|
|
70302
|
+
}
|
|
70303
|
+
identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
|
|
70304
|
+
return identifier;
|
|
70305
|
+
}
|
|
70306
|
+
function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, options) {
|
|
70307
|
+
if (pageNumber <= 0) return null;
|
|
70308
|
+
const kind = options?.kind ?? "header";
|
|
70309
|
+
const sectionPageNumber = options?.sectionPageNumber ?? pageNumber;
|
|
70310
|
+
const sectionIds = kind === "header" ? identifier.sectionHeaderIds.get(sectionIndex) : identifier.sectionFooterIds.get(sectionIndex);
|
|
70311
|
+
const ids = sectionIds ?? (kind === "header" ? identifier.headerIds : identifier.footerIds);
|
|
70312
|
+
const hasFirst = Boolean(ids.first);
|
|
70313
|
+
const hasEven = Boolean(ids.even);
|
|
70314
|
+
const hasOdd = Boolean(ids.odd);
|
|
70315
|
+
const hasDefault = Boolean(ids.default);
|
|
70316
|
+
const sectionTitlePg = identifier.sectionTitlePg.get(sectionIndex) ?? identifier.titlePg;
|
|
70317
|
+
const titlePgEnabled = sectionTitlePg && hasFirst;
|
|
70318
|
+
const isFirstPageOfSection = sectionPageNumber === 1;
|
|
70319
|
+
if (isFirstPageOfSection && titlePgEnabled) {
|
|
70320
|
+
return "first";
|
|
70321
|
+
}
|
|
70322
|
+
if (identifier.alternateHeaders) {
|
|
70323
|
+
if (pageNumber % 2 === 0 && (hasEven || hasDefault)) {
|
|
70324
|
+
return hasEven ? "even" : "default";
|
|
70325
|
+
}
|
|
70326
|
+
if (pageNumber % 2 === 1 && (hasOdd || hasDefault)) {
|
|
70327
|
+
return hasOdd ? "odd" : "default";
|
|
70328
|
+
}
|
|
70329
|
+
}
|
|
70330
|
+
if (hasDefault) {
|
|
70331
|
+
return "default";
|
|
70332
|
+
}
|
|
70333
|
+
return null;
|
|
70334
|
+
}
|
|
70257
70335
|
function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
70258
70336
|
const zones = [];
|
|
70259
70337
|
const marginLeft = Math.max(0, margins?.left ?? 0);
|
|
@@ -71404,23 +71482,54 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71404
71482
|
const headerCount = countHeaderRows(block);
|
|
71405
71483
|
const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
|
|
71406
71484
|
let state2 = ensurePage();
|
|
71485
|
+
const availableHeight = state2.contentBottom - state2.cursorY;
|
|
71486
|
+
let minRequiredHeight = 0;
|
|
71487
|
+
if (measure.rows.length > 0) {
|
|
71488
|
+
minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
|
|
71489
|
+
} else if (measure.totalHeight > 0) {
|
|
71490
|
+
minRequiredHeight = measure.totalHeight;
|
|
71491
|
+
}
|
|
71492
|
+
if (minRequiredHeight > availableHeight && state2.page.fragments.length > 0) {
|
|
71493
|
+
state2 = advanceColumn(state2);
|
|
71494
|
+
}
|
|
71407
71495
|
let currentRow = 0;
|
|
71408
71496
|
let isTableContinuation = false;
|
|
71409
71497
|
let pendingPartialRow = null;
|
|
71498
|
+
if (block.rows.length === 0 && measure.totalHeight > 0) {
|
|
71499
|
+
const height = Math.min(measure.totalHeight, state2.contentBottom - state2.cursorY);
|
|
71500
|
+
const metadata = {
|
|
71501
|
+
columnBoundaries: generateColumnBoundaries(measure),
|
|
71502
|
+
coordinateSystem: "fragment"
|
|
71503
|
+
};
|
|
71504
|
+
const fragment = {
|
|
71505
|
+
kind: "table",
|
|
71506
|
+
blockId: block.id,
|
|
71507
|
+
fromRow: 0,
|
|
71508
|
+
toRow: 0,
|
|
71509
|
+
x: columnX(state2.columnIndex),
|
|
71510
|
+
y: state2.cursorY,
|
|
71511
|
+
width: Math.min(columnWidth, measure.totalWidth || columnWidth),
|
|
71512
|
+
height,
|
|
71513
|
+
metadata
|
|
71514
|
+
};
|
|
71515
|
+
state2.page.fragments.push(fragment);
|
|
71516
|
+
state2.cursorY += height;
|
|
71517
|
+
return;
|
|
71518
|
+
}
|
|
71410
71519
|
while (currentRow < block.rows.length || pendingPartialRow !== null) {
|
|
71411
71520
|
state2 = ensurePage();
|
|
71412
|
-
const
|
|
71521
|
+
const availableHeight2 = state2.contentBottom - state2.cursorY;
|
|
71413
71522
|
let repeatHeaderCount = 0;
|
|
71414
71523
|
if (currentRow === 0 && !pendingPartialRow) {
|
|
71415
71524
|
repeatHeaderCount = 0;
|
|
71416
71525
|
} else {
|
|
71417
|
-
if (headerCount > 0 && headerHeight <=
|
|
71526
|
+
if (headerCount > 0 && headerHeight <= availableHeight2) {
|
|
71418
71527
|
repeatHeaderCount = headerCount;
|
|
71419
|
-
} else if (headerCount > 0 && headerHeight >
|
|
71528
|
+
} else if (headerCount > 0 && headerHeight > availableHeight2) {
|
|
71420
71529
|
repeatHeaderCount = 0;
|
|
71421
71530
|
}
|
|
71422
71531
|
}
|
|
71423
|
-
const availableForBody = repeatHeaderCount > 0 ?
|
|
71532
|
+
const availableForBody = repeatHeaderCount > 0 ? availableHeight2 - headerHeight : availableHeight2;
|
|
71424
71533
|
const fullPageHeight = state2.contentBottom;
|
|
71425
71534
|
if (pendingPartialRow !== null) {
|
|
71426
71535
|
const rowIndex = pendingPartialRow.rowIndex;
|
|
@@ -71799,7 +71908,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71799
71908
|
let currentSectionIndex = -1;
|
|
71800
71909
|
for (let i2 = 0; i2 < pages.length; i2++) {
|
|
71801
71910
|
const page = pages[i2];
|
|
71802
|
-
const pageSectionIndex = 0;
|
|
71911
|
+
const pageSectionIndex = page.sectionIndex ?? 0;
|
|
71803
71912
|
if (pageSectionIndex !== currentSectionIndex) {
|
|
71804
71913
|
const sectionMetadata2 = sectionMap.get(pageSectionIndex);
|
|
71805
71914
|
if (sectionMetadata2?.numbering?.start !== void 0) {
|
|
@@ -72048,6 +72157,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72048
72157
|
};
|
|
72049
72158
|
layoutLog(`[Layout] First section: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
72050
72159
|
}
|
|
72160
|
+
const firstSectionIndexRaw = block.attrs?.sectionIndex;
|
|
72161
|
+
const firstMetadataIndex = typeof firstSectionIndexRaw === "number" ? firstSectionIndexRaw : Number(firstSectionIndexRaw ?? NaN);
|
|
72162
|
+
if (Number.isFinite(firstMetadataIndex)) {
|
|
72163
|
+
activeSectionIndex = firstMetadataIndex;
|
|
72164
|
+
}
|
|
72165
|
+
const firstSectionMetadata = Number.isFinite(firstMetadataIndex) ? sectionMetadataList[firstMetadataIndex] : void 0;
|
|
72166
|
+
if (firstSectionMetadata?.numbering) {
|
|
72167
|
+
if (firstSectionMetadata.numbering.format) activeNumberFormat = firstSectionMetadata.numbering.format;
|
|
72168
|
+
if (typeof firstSectionMetadata.numbering.start === "number") {
|
|
72169
|
+
activePageCounter = firstSectionMetadata.numbering.start;
|
|
72170
|
+
}
|
|
72171
|
+
}
|
|
72051
72172
|
return { decision: { forcePageBreak: false, forceMidPageRegion: false }, state: next2 };
|
|
72052
72173
|
}
|
|
72053
72174
|
const headerPx = block.margins?.header;
|
|
@@ -72064,7 +72185,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72064
72185
|
if (block.orientation) next2.pendingOrientation = block.orientation;
|
|
72065
72186
|
const sectionType = block.type ?? "continuous";
|
|
72066
72187
|
const isColumnsChanging = !!block.columns && (block.columns.count !== next2.activeColumns.count || block.columns.gap !== next2.activeColumns.gap);
|
|
72067
|
-
|
|
72188
|
+
const sectionIndexRaw = block.attrs?.sectionIndex;
|
|
72189
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
72190
|
+
if (Number.isFinite(metadataIndex)) {
|
|
72191
|
+
pendingSectionIndex = metadataIndex;
|
|
72192
|
+
}
|
|
72193
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
72194
|
+
if (sectionMetadata?.numbering) {
|
|
72195
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
72196
|
+
} else if (block.numbering) {
|
|
72068
72197
|
pendingNumbering = { ...block.numbering };
|
|
72069
72198
|
}
|
|
72070
72199
|
if (block.headerRefs || block.footerRefs) {
|
|
@@ -72133,6 +72262,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72133
72262
|
...initialSectionMetadata.footerRefs && { footerRefs: initialSectionMetadata.footerRefs }
|
|
72134
72263
|
};
|
|
72135
72264
|
}
|
|
72265
|
+
let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
|
|
72266
|
+
let pendingSectionIndex = null;
|
|
72136
72267
|
const paginator = createPaginator({
|
|
72137
72268
|
margins: { left: margins.left, right: margins.right },
|
|
72138
72269
|
getActiveTopMargin: () => activeTopMargin,
|
|
@@ -72189,6 +72320,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72189
72320
|
activeSectionRefs = pendingSectionRefs;
|
|
72190
72321
|
pendingSectionRefs = null;
|
|
72191
72322
|
}
|
|
72323
|
+
if (pendingSectionIndex !== null) {
|
|
72324
|
+
activeSectionIndex = pendingSectionIndex;
|
|
72325
|
+
pendingSectionIndex = null;
|
|
72326
|
+
}
|
|
72192
72327
|
if (pendingVAlign !== null) {
|
|
72193
72328
|
activeVAlign = pendingVAlign;
|
|
72194
72329
|
pendingVAlign = null;
|
|
@@ -72198,6 +72333,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72198
72333
|
}
|
|
72199
72334
|
if (state2?.page) {
|
|
72200
72335
|
state2.page.numberText = formatPageNumber(activePageCounter, activeNumberFormat);
|
|
72336
|
+
state2.page.sectionIndex = activeSectionIndex;
|
|
72337
|
+
layoutLog(`[Layout] Page ${state2.page.number}: Stamped sectionIndex:`, activeSectionIndex);
|
|
72201
72338
|
if (activeSectionRefs) {
|
|
72202
72339
|
state2.page.sectionRefs = {
|
|
72203
72340
|
...activeSectionRefs.headerRefs && { headerRefs: activeSectionRefs.headerRefs },
|
|
@@ -72384,8 +72521,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72384
72521
|
activeOrientation = updatedState.activeOrientation;
|
|
72385
72522
|
pendingOrientation = updatedState.pendingOrientation;
|
|
72386
72523
|
if (effectiveBlock.vAlign) {
|
|
72387
|
-
const
|
|
72388
|
-
if (
|
|
72524
|
+
const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
72525
|
+
if (isFirstSection2) {
|
|
72389
72526
|
activeVAlign = effectiveBlock.vAlign;
|
|
72390
72527
|
pendingVAlign = null;
|
|
72391
72528
|
} else {
|
|
@@ -72399,6 +72536,36 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72399
72536
|
};
|
|
72400
72537
|
layoutLog(`[Layout] After scheduleSectionBreakCompat: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
72401
72538
|
}
|
|
72539
|
+
const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
|
|
72540
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
72541
|
+
const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
72542
|
+
if (Number.isFinite(metadataIndex)) {
|
|
72543
|
+
if (isFirstSection) {
|
|
72544
|
+
activeSectionIndex = metadataIndex;
|
|
72545
|
+
} else {
|
|
72546
|
+
pendingSectionIndex = metadataIndex;
|
|
72547
|
+
}
|
|
72548
|
+
}
|
|
72549
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
72550
|
+
if (sectionMetadata?.numbering) {
|
|
72551
|
+
if (isFirstSection) {
|
|
72552
|
+
if (sectionMetadata.numbering.format) activeNumberFormat = sectionMetadata.numbering.format;
|
|
72553
|
+
if (typeof sectionMetadata.numbering.start === "number") {
|
|
72554
|
+
activePageCounter = sectionMetadata.numbering.start;
|
|
72555
|
+
}
|
|
72556
|
+
} else {
|
|
72557
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
72558
|
+
}
|
|
72559
|
+
} else if (effectiveBlock.numbering) {
|
|
72560
|
+
if (isFirstSection) {
|
|
72561
|
+
if (effectiveBlock.numbering.format) activeNumberFormat = effectiveBlock.numbering.format;
|
|
72562
|
+
if (typeof effectiveBlock.numbering.start === "number") {
|
|
72563
|
+
activePageCounter = effectiveBlock.numbering.start;
|
|
72564
|
+
}
|
|
72565
|
+
} else {
|
|
72566
|
+
pendingNumbering = { ...effectiveBlock.numbering };
|
|
72567
|
+
}
|
|
72568
|
+
}
|
|
72402
72569
|
if (breakInfo.forceMidPageRegion && block.columns) {
|
|
72403
72570
|
let state2 = paginator.ensurePage();
|
|
72404
72571
|
const columnIndexBefore = state2.columnIndex;
|
|
@@ -73378,8 +73545,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
73378
73545
|
const { totalPages: docTotalPages } = pageResolver(1);
|
|
73379
73546
|
const useBucketing = FeatureFlags.HF_DIGIT_BUCKETING && docTotalPages >= MIN_PAGES_FOR_BUCKETING;
|
|
73380
73547
|
for (const [type2, blocks2] of Object.entries(sections)) {
|
|
73381
|
-
if (!blocks2 || blocks2.length === 0)
|
|
73382
|
-
|
|
73548
|
+
if (!blocks2 || blocks2.length === 0) {
|
|
73549
|
+
continue;
|
|
73550
|
+
}
|
|
73551
|
+
const hasTokens = hasPageTokens(blocks2);
|
|
73552
|
+
if (!hasTokens) {
|
|
73383
73553
|
const measures = await cache2.measureBlocks(blocks2, constraints, measureBlock2);
|
|
73384
73554
|
const layout = layoutHeaderFooter(blocks2, measures, constraints);
|
|
73385
73555
|
result[type2] = { blocks: blocks2, measures, layout };
|
|
@@ -73401,7 +73571,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
73401
73571
|
for (const pageNum of pagesToLayout) {
|
|
73402
73572
|
const clonedBlocks = cloneHeaderFooterBlocks(blocks2);
|
|
73403
73573
|
const { displayText, totalPages: totalPagesForPage } = pageResolver(pageNum);
|
|
73404
|
-
|
|
73574
|
+
const resolvedPageNum = parseInt(displayText, 10) || pageNum;
|
|
73575
|
+
resolveHeaderFooterTokens(clonedBlocks, resolvedPageNum, totalPagesForPage);
|
|
73405
73576
|
const measures = await cache2.measureBlocks(clonedBlocks, constraints, measureBlock2);
|
|
73406
73577
|
const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints);
|
|
73407
73578
|
pages.push({
|
|
@@ -82706,6 +82877,49 @@ ${l}
|
|
|
82706
82877
|
});
|
|
82707
82878
|
return hasBlocks ? batch2 : void 0;
|
|
82708
82879
|
}
|
|
82880
|
+
/**
|
|
82881
|
+
* Retrieves FlowBlocks for ALL header/footer content, keyed by relationship ID.
|
|
82882
|
+
*
|
|
82883
|
+
* Unlike getBatch() which only returns content for variant-associated IDs,
|
|
82884
|
+
* this method returns content for ALL registered header/footer IDs. This is
|
|
82885
|
+
* essential for multi-section documents where different sections may use
|
|
82886
|
+
* different content for the same variant type.
|
|
82887
|
+
*
|
|
82888
|
+
* @param kind - The type of section to retrieve: 'header' or 'footer'
|
|
82889
|
+
* @returns A Map of rId to FlowBlock arrays, or undefined if no content exists
|
|
82890
|
+
*
|
|
82891
|
+
* @example
|
|
82892
|
+
* ```typescript
|
|
82893
|
+
* const footersByRId = adapter.getBlocksByRId('footer');
|
|
82894
|
+
* if (footersByRId) {
|
|
82895
|
+
* // footersByRId.get('rId14') - blocks for footer with rId14
|
|
82896
|
+
* // footersByRId.get('rId18') - blocks for footer with rId18 (different section)
|
|
82897
|
+
* }
|
|
82898
|
+
* ```
|
|
82899
|
+
*/
|
|
82900
|
+
getBlocksByRId(kind) {
|
|
82901
|
+
const descriptors = __privateGet$1(this, _manager).getDescriptors(kind);
|
|
82902
|
+
if (!descriptors.length) return void 0;
|
|
82903
|
+
const blocksMap = /* @__PURE__ */ new Map();
|
|
82904
|
+
descriptors.forEach((descriptor) => {
|
|
82905
|
+
const blocks2 = __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
82906
|
+
if (blocks2 && blocks2.length > 0) {
|
|
82907
|
+
blocksMap.set(descriptor.id, blocks2);
|
|
82908
|
+
}
|
|
82909
|
+
});
|
|
82910
|
+
return blocksMap.size > 0 ? blocksMap : void 0;
|
|
82911
|
+
}
|
|
82912
|
+
/**
|
|
82913
|
+
* Retrieves FlowBlocks for a specific header/footer by its relationship ID.
|
|
82914
|
+
*
|
|
82915
|
+
* @param rId - The relationship ID (e.g., 'rId14')
|
|
82916
|
+
* @returns FlowBlock array for the specified rId, or undefined if not found
|
|
82917
|
+
*/
|
|
82918
|
+
getBlocksForRId(rId) {
|
|
82919
|
+
const descriptor = __privateGet$1(this, _manager).getDescriptorById(rId);
|
|
82920
|
+
if (!descriptor) return void 0;
|
|
82921
|
+
return __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
82922
|
+
}
|
|
82709
82923
|
/**
|
|
82710
82924
|
* Invalidates the cached FlowBlocks for a specific header/footer section.
|
|
82711
82925
|
*
|
|
@@ -83166,8 +83380,11 @@ ${l}
|
|
|
83166
83380
|
__privateAdd$1(this, _headerFooterManager, null);
|
|
83167
83381
|
__privateAdd$1(this, _headerFooterAdapter, null);
|
|
83168
83382
|
__privateAdd$1(this, _headerFooterIdentifier, null);
|
|
83383
|
+
__privateAdd$1(this, _multiSectionIdentifier, null);
|
|
83169
83384
|
__privateAdd$1(this, _headerLayoutResults, null);
|
|
83170
83385
|
__privateAdd$1(this, _footerLayoutResults, null);
|
|
83386
|
+
__privateAdd$1(this, _headerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
83387
|
+
__privateAdd$1(this, _footerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
83171
83388
|
__privateAdd$1(this, _headerDecorationProvider);
|
|
83172
83389
|
__privateAdd$1(this, _footerDecorationProvider);
|
|
83173
83390
|
__privateAdd$1(this, _headerFooterManagerCleanups, []);
|
|
@@ -84324,8 +84541,11 @@ ${l}
|
|
|
84324
84541
|
__privateSet(this, _headerFooterManager, null);
|
|
84325
84542
|
}, "Header/footer manager");
|
|
84326
84543
|
__privateSet(this, _headerFooterIdentifier, null);
|
|
84544
|
+
__privateSet(this, _multiSectionIdentifier, null);
|
|
84327
84545
|
__privateSet(this, _headerLayoutResults, null);
|
|
84328
84546
|
__privateSet(this, _footerLayoutResults, null);
|
|
84547
|
+
__privateGet$1(this, _headerLayoutsByRId).clear();
|
|
84548
|
+
__privateGet$1(this, _footerLayoutsByRId).clear();
|
|
84329
84549
|
__privateSet(this, _headerDecorationProvider, void 0);
|
|
84330
84550
|
__privateSet(this, _footerDecorationProvider, void 0);
|
|
84331
84551
|
__privateSet(this, _session, { mode: "body" });
|
|
@@ -84379,8 +84599,11 @@ ${l}
|
|
|
84379
84599
|
_headerFooterManager = /* @__PURE__ */ new WeakMap();
|
|
84380
84600
|
_headerFooterAdapter = /* @__PURE__ */ new WeakMap();
|
|
84381
84601
|
_headerFooterIdentifier = /* @__PURE__ */ new WeakMap();
|
|
84602
|
+
_multiSectionIdentifier = /* @__PURE__ */ new WeakMap();
|
|
84382
84603
|
_headerLayoutResults = /* @__PURE__ */ new WeakMap();
|
|
84383
84604
|
_footerLayoutResults = /* @__PURE__ */ new WeakMap();
|
|
84605
|
+
_headerLayoutsByRId = /* @__PURE__ */ new WeakMap();
|
|
84606
|
+
_footerLayoutsByRId = /* @__PURE__ */ new WeakMap();
|
|
84384
84607
|
_headerDecorationProvider = /* @__PURE__ */ new WeakMap();
|
|
84385
84608
|
_footerDecorationProvider = /* @__PURE__ */ new WeakMap();
|
|
84386
84609
|
_headerFooterManagerCleanups = /* @__PURE__ */ new WeakMap();
|
|
@@ -84974,11 +85197,11 @@ ${l}
|
|
|
84974
85197
|
const sectionMetadata = [];
|
|
84975
85198
|
let blocks2;
|
|
84976
85199
|
try {
|
|
84977
|
-
const
|
|
84978
|
-
const converterContext =
|
|
84979
|
-
docx:
|
|
84980
|
-
numbering:
|
|
84981
|
-
linkedStyles:
|
|
85200
|
+
const converter2 = __privateGet$1(this, _editor3).converter;
|
|
85201
|
+
const converterContext = converter2 ? {
|
|
85202
|
+
docx: converter2.convertedXml,
|
|
85203
|
+
numbering: converter2.numbering,
|
|
85204
|
+
linkedStyles: converter2.linkedStyles
|
|
84982
85205
|
} : void 0;
|
|
84983
85206
|
const result = toFlowBlocks(docJson, {
|
|
84984
85207
|
mediaFiles: __privateGet$1(this, _options).mediaFiles,
|
|
@@ -85036,9 +85259,12 @@ ${l}
|
|
|
85036
85259
|
return;
|
|
85037
85260
|
}
|
|
85038
85261
|
__privateSet(this, _sectionMetadata, sectionMetadata);
|
|
85262
|
+
const converter = __privateGet$1(this, _editor3).converter;
|
|
85263
|
+
__privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
|
|
85039
85264
|
__privateSet(this, _layoutState, { blocks: blocks2, measures, layout });
|
|
85040
85265
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
85041
85266
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
85267
|
+
await __privateMethod$1(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
85042
85268
|
__privateMethod$1(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
|
|
85043
85269
|
const painter = __privateMethod$1(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks2, measures);
|
|
85044
85270
|
if (typeof painter.setProviders === "function") {
|
|
@@ -85052,6 +85278,10 @@ ${l}
|
|
|
85052
85278
|
headerMeasures.push(...headerResult.measures);
|
|
85053
85279
|
}
|
|
85054
85280
|
}
|
|
85281
|
+
for (const rIdResult of __privateGet$1(this, _headerLayoutsByRId).values()) {
|
|
85282
|
+
headerBlocks.push(...rIdResult.blocks);
|
|
85283
|
+
headerMeasures.push(...rIdResult.measures);
|
|
85284
|
+
}
|
|
85055
85285
|
const footerBlocks = [];
|
|
85056
85286
|
const footerMeasures = [];
|
|
85057
85287
|
if (footerLayouts) {
|
|
@@ -85060,6 +85290,10 @@ ${l}
|
|
|
85060
85290
|
footerMeasures.push(...footerResult.measures);
|
|
85061
85291
|
}
|
|
85062
85292
|
}
|
|
85293
|
+
for (const rIdResult of __privateGet$1(this, _footerLayoutsByRId).values()) {
|
|
85294
|
+
footerBlocks.push(...rIdResult.blocks);
|
|
85295
|
+
footerMeasures.push(...rIdResult.measures);
|
|
85296
|
+
}
|
|
85063
85297
|
painter.setData?.(
|
|
85064
85298
|
blocks2,
|
|
85065
85299
|
measures,
|
|
@@ -85165,7 +85399,9 @@ ${l}
|
|
|
85165
85399
|
}
|
|
85166
85400
|
const headerBlocks = __privateGet$1(this, _headerFooterAdapter).getBatch("header");
|
|
85167
85401
|
const footerBlocks = __privateGet$1(this, _headerFooterAdapter).getBatch("footer");
|
|
85168
|
-
|
|
85402
|
+
const headerBlocksByRId = __privateGet$1(this, _headerFooterAdapter).getBlocksByRId("header");
|
|
85403
|
+
const footerBlocksByRId = __privateGet$1(this, _headerFooterAdapter).getBlocksByRId("footer");
|
|
85404
|
+
if (!headerBlocks && !footerBlocks && !headerBlocksByRId && !footerBlocksByRId) {
|
|
85169
85405
|
return null;
|
|
85170
85406
|
}
|
|
85171
85407
|
const constraints = __privateMethod$1(this, _PresentationEditor_instances, computeHeaderFooterConstraints_fn).call(this);
|
|
@@ -85175,6 +85411,8 @@ ${l}
|
|
|
85175
85411
|
return {
|
|
85176
85412
|
headerBlocks,
|
|
85177
85413
|
footerBlocks,
|
|
85414
|
+
headerBlocksByRId,
|
|
85415
|
+
footerBlocksByRId,
|
|
85178
85416
|
constraints
|
|
85179
85417
|
};
|
|
85180
85418
|
};
|
|
@@ -85197,6 +85435,80 @@ ${l}
|
|
|
85197
85435
|
margins: { left: marginLeft, right: marginRight }
|
|
85198
85436
|
};
|
|
85199
85437
|
};
|
|
85438
|
+
layoutPerRIdHeaderFooters_fn = async function(headerFooterInput, layout, sectionMetadata) {
|
|
85439
|
+
__privateGet$1(this, _headerLayoutsByRId).clear();
|
|
85440
|
+
__privateGet$1(this, _footerLayoutsByRId).clear();
|
|
85441
|
+
if (!headerFooterInput) return;
|
|
85442
|
+
const { headerBlocksByRId, footerBlocksByRId, constraints } = headerFooterInput;
|
|
85443
|
+
const displayPages = computeDisplayPageNumber(layout.pages, sectionMetadata);
|
|
85444
|
+
const totalPages = layout.pages.length;
|
|
85445
|
+
const pageResolver = (pageNumber) => {
|
|
85446
|
+
const pageIndex = pageNumber - 1;
|
|
85447
|
+
const displayInfo = displayPages[pageIndex];
|
|
85448
|
+
return {
|
|
85449
|
+
displayText: displayInfo?.displayText ?? String(pageNumber),
|
|
85450
|
+
totalPages
|
|
85451
|
+
};
|
|
85452
|
+
};
|
|
85453
|
+
if (headerBlocksByRId) {
|
|
85454
|
+
for (const [rId, blocks2] of headerBlocksByRId) {
|
|
85455
|
+
if (!blocks2 || blocks2.length === 0) continue;
|
|
85456
|
+
try {
|
|
85457
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
85458
|
+
{ default: blocks2 },
|
|
85459
|
+
// Treat each rId as a 'default' variant
|
|
85460
|
+
constraints,
|
|
85461
|
+
(block, c2) => measureBlock(block, c2),
|
|
85462
|
+
void 0,
|
|
85463
|
+
// Use shared cache
|
|
85464
|
+
void 0,
|
|
85465
|
+
// No legacy totalPages
|
|
85466
|
+
pageResolver
|
|
85467
|
+
);
|
|
85468
|
+
if (batchResult.default) {
|
|
85469
|
+
__privateGet$1(this, _headerLayoutsByRId).set(rId, {
|
|
85470
|
+
kind: "header",
|
|
85471
|
+
type: "default",
|
|
85472
|
+
layout: batchResult.default.layout,
|
|
85473
|
+
blocks: batchResult.default.blocks,
|
|
85474
|
+
measures: batchResult.default.measures
|
|
85475
|
+
});
|
|
85476
|
+
}
|
|
85477
|
+
} catch (error) {
|
|
85478
|
+
console.warn(`[PresentationEditor] Failed to layout header rId=${rId}:`, error);
|
|
85479
|
+
}
|
|
85480
|
+
}
|
|
85481
|
+
}
|
|
85482
|
+
if (footerBlocksByRId) {
|
|
85483
|
+
for (const [rId, blocks2] of footerBlocksByRId) {
|
|
85484
|
+
if (!blocks2 || blocks2.length === 0) continue;
|
|
85485
|
+
try {
|
|
85486
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
85487
|
+
{ default: blocks2 },
|
|
85488
|
+
// Treat each rId as a 'default' variant
|
|
85489
|
+
constraints,
|
|
85490
|
+
(block, c2) => measureBlock(block, c2),
|
|
85491
|
+
void 0,
|
|
85492
|
+
// Use shared cache
|
|
85493
|
+
void 0,
|
|
85494
|
+
// No legacy totalPages
|
|
85495
|
+
pageResolver
|
|
85496
|
+
);
|
|
85497
|
+
if (batchResult.default) {
|
|
85498
|
+
__privateGet$1(this, _footerLayoutsByRId).set(rId, {
|
|
85499
|
+
kind: "footer",
|
|
85500
|
+
type: "default",
|
|
85501
|
+
layout: batchResult.default.layout,
|
|
85502
|
+
blocks: batchResult.default.blocks,
|
|
85503
|
+
measures: batchResult.default.measures
|
|
85504
|
+
});
|
|
85505
|
+
}
|
|
85506
|
+
} catch (error) {
|
|
85507
|
+
console.warn(`[PresentationEditor] Failed to layout footer rId=${rId}:`, error);
|
|
85508
|
+
}
|
|
85509
|
+
}
|
|
85510
|
+
}
|
|
85511
|
+
};
|
|
85200
85512
|
updateDecorationProviders_fn = function(layout) {
|
|
85201
85513
|
__privateSet(this, _headerDecorationProvider, __privateMethod$1(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "header", layout));
|
|
85202
85514
|
__privateSet(this, _footerDecorationProvider, __privateMethod$1(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "footer", layout));
|
|
@@ -85204,15 +85516,63 @@ ${l}
|
|
|
85204
85516
|
};
|
|
85205
85517
|
createDecorationProvider_fn = function(kind, layout) {
|
|
85206
85518
|
const results = kind === "header" ? __privateGet$1(this, _headerLayoutResults) : __privateGet$1(this, _footerLayoutResults);
|
|
85207
|
-
|
|
85519
|
+
const layoutsByRId = kind === "header" ? __privateGet$1(this, _headerLayoutsByRId) : __privateGet$1(this, _footerLayoutsByRId);
|
|
85520
|
+
if ((!results || results.length === 0) && layoutsByRId.size === 0) {
|
|
85208
85521
|
return void 0;
|
|
85209
85522
|
}
|
|
85210
|
-
const
|
|
85523
|
+
const multiSectionId = __privateGet$1(this, _multiSectionIdentifier);
|
|
85524
|
+
const legacyIdentifier = __privateGet$1(this, _headerFooterIdentifier) ?? extractIdentifierFromConverter(__privateGet$1(this, _editor3).converter);
|
|
85525
|
+
const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
|
|
85526
|
+
for (const p2 of layout.pages) {
|
|
85527
|
+
const idx = p2.sectionIndex ?? 0;
|
|
85528
|
+
if (!sectionFirstPageNumbers.has(idx)) {
|
|
85529
|
+
sectionFirstPageNumbers.set(idx, p2.number);
|
|
85530
|
+
}
|
|
85531
|
+
}
|
|
85211
85532
|
return (pageNumber, pageMargins, page) => {
|
|
85212
|
-
const
|
|
85533
|
+
const sectionIndex = page?.sectionIndex ?? 0;
|
|
85534
|
+
const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
|
|
85535
|
+
const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
|
|
85536
|
+
const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
|
|
85537
|
+
const sectionRId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
|
|
85213
85538
|
if (!headerFooterType) {
|
|
85214
85539
|
return null;
|
|
85215
85540
|
}
|
|
85541
|
+
if (sectionRId && layoutsByRId.has(sectionRId)) {
|
|
85542
|
+
const rIdLayout = layoutsByRId.get(sectionRId);
|
|
85543
|
+
const slotPage2 = __privateMethod$1(this, _PresentationEditor_instances, findHeaderFooterPageForPageNumber_fn).call(this, rIdLayout.layout.pages, pageNumber);
|
|
85544
|
+
if (slotPage2) {
|
|
85545
|
+
const fragments2 = slotPage2.fragments ?? [];
|
|
85546
|
+
const pageHeight2 = page?.size?.h ?? layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
85547
|
+
const margins2 = pageMargins ?? layout.pages[0]?.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
85548
|
+
const box2 = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins2, pageHeight2);
|
|
85549
|
+
return {
|
|
85550
|
+
fragments: fragments2,
|
|
85551
|
+
height: box2.height,
|
|
85552
|
+
contentHeight: rIdLayout.layout.height ?? box2.height,
|
|
85553
|
+
offset: box2.offset,
|
|
85554
|
+
marginLeft: box2.x,
|
|
85555
|
+
contentWidth: box2.width,
|
|
85556
|
+
headerId: sectionRId,
|
|
85557
|
+
sectionType: headerFooterType,
|
|
85558
|
+
box: {
|
|
85559
|
+
x: box2.x,
|
|
85560
|
+
y: box2.offset,
|
|
85561
|
+
width: box2.width,
|
|
85562
|
+
height: box2.height
|
|
85563
|
+
},
|
|
85564
|
+
hitRegion: {
|
|
85565
|
+
x: box2.x,
|
|
85566
|
+
y: box2.offset,
|
|
85567
|
+
width: box2.width,
|
|
85568
|
+
height: box2.height
|
|
85569
|
+
}
|
|
85570
|
+
};
|
|
85571
|
+
}
|
|
85572
|
+
}
|
|
85573
|
+
if (!results || results.length === 0) {
|
|
85574
|
+
return null;
|
|
85575
|
+
}
|
|
85216
85576
|
const variant = results.find((entry) => entry.type === headerFooterType);
|
|
85217
85577
|
if (!variant || !variant.layout?.pages?.length) {
|
|
85218
85578
|
return null;
|
|
@@ -85225,9 +85585,8 @@ ${l}
|
|
|
85225
85585
|
const pageHeight = page?.size?.h ?? layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
85226
85586
|
const margins = pageMargins ?? layout.pages[0]?.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
85227
85587
|
const box = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins, pageHeight);
|
|
85228
|
-
const headerId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
|
|
85229
85588
|
const fallbackId = __privateGet$1(this, _headerFooterManager)?.getVariantId(kind, headerFooterType);
|
|
85230
|
-
const finalHeaderId =
|
|
85589
|
+
const finalHeaderId = sectionRId ?? fallbackId ?? void 0;
|
|
85231
85590
|
return {
|
|
85232
85591
|
fragments,
|
|
85233
85592
|
height: box.height,
|
|
@@ -85457,7 +85816,8 @@ ${l}
|
|
|
85457
85816
|
const doc2 = editor.state?.doc;
|
|
85458
85817
|
if (doc2) {
|
|
85459
85818
|
const endPos = doc2.content.size - 1;
|
|
85460
|
-
|
|
85819
|
+
const pos = Math.max(1, endPos);
|
|
85820
|
+
editor.commands?.setTextSelection?.({ from: pos, to: pos });
|
|
85461
85821
|
}
|
|
85462
85822
|
} catch (cursorError) {
|
|
85463
85823
|
console.warn("[PresentationEditor] Could not set cursor to end:", cursorError);
|
|
@@ -139476,7 +139836,7 @@ ${style2}
|
|
|
139476
139836
|
this.config.colors = shuffleArray(this.config.colors);
|
|
139477
139837
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
139478
139838
|
this.colorIndex = 0;
|
|
139479
|
-
this.version = "1.0.0-beta.
|
|
139839
|
+
this.version = "1.0.0-beta.21";
|
|
139480
139840
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
139481
139841
|
this.superdocId = config2.superdocId || v4();
|
|
139482
139842
|
this.colors = this.config.colors;
|
|
@@ -141919,7 +142279,7 @@ ${style2}
|
|
|
141919
142279
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
141920
142280
|
);
|
|
141921
142281
|
}
|
|
141922
|
-
const
|
|
142282
|
+
const indexDSuc12CK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
141923
142283
|
__proto__: null,
|
|
141924
142284
|
unified
|
|
141925
142285
|
}, Symbol.toStringTag, { value: "Module" }));
|