@harbour-enterprises/superdoc 1.0.0-beta.20 → 1.0.0-beta.22
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-B42JCeYb.es.js} +1 -1
- package/dist/chunks/{PdfViewer-DbSf6FKU.cjs → PdfViewer-CswYWp1h.cjs} +1 -1
- package/dist/chunks/{index-DHhKY9FZ-CyEU4GWR.es.js → index-895wSAjT-C4ksiI6n.es.js} +1 -1
- package/dist/chunks/{index-DHhKY9FZ-DORT-UR6.cjs → index-895wSAjT-CWlZl8zz.cjs} +1 -1
- package/dist/chunks/{index-DLco7m-w.cjs → index-CK4eX_iu.cjs} +7 -5
- package/dist/chunks/{index-BSHAWPko.es.js → index-DBmh710D.es.js} +7 -5
- package/dist/chunks/{super-editor.es-B6lsvAAY.cjs → super-editor.es-BkRizaIE.cjs} +594 -105
- package/dist/chunks/{super-editor.es-C0tdU_gq.es.js → super-editor.es-V792hb-6.es.js} +594 -105
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-m2x13P8G.js → converter-DhkZt4Pv.js} +9 -9
- package/dist/super-editor/chunks/{docx-zipper-CRSKJF-o.js → docx-zipper-Bajmc-RM.js} +1 -1
- package/dist/super-editor/chunks/{editor-C9r_Jbbg.js → editor-oZjoYNA0.js} +594 -103
- package/dist/super-editor/chunks/{index-DHhKY9FZ.js → index-895wSAjT.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-fnptYAcU.js → toolbar-Bn5LTbq9.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 +600 -109
- 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.22") {
|
|
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, _isEditable, _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
|
};
|
|
@@ -49596,6 +49596,59 @@ function skipTab(dir) {
|
|
|
49596
49596
|
return true;
|
|
49597
49597
|
};
|
|
49598
49598
|
}
|
|
49599
|
+
const decreaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
49600
|
+
const handled = changeListLevel(-1, editor, tr);
|
|
49601
|
+
if (handled && dispatch) {
|
|
49602
|
+
dispatch(tr);
|
|
49603
|
+
}
|
|
49604
|
+
return handled;
|
|
49605
|
+
};
|
|
49606
|
+
const removeNumberingProperties = ({ checkType = "startParagraph" } = {}) => (props) => {
|
|
49607
|
+
const { tr, state: state2, editor, dispatch } = props;
|
|
49608
|
+
const { node: paragraph, pos } = findParentNode(isList)(state2.selection) || {};
|
|
49609
|
+
if (!paragraph) return false;
|
|
49610
|
+
if (checkType === "empty" && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
49611
|
+
if (checkType === "startParagraph") {
|
|
49612
|
+
const { $from, empty: empty2 } = state2.selection;
|
|
49613
|
+
if ((!empty2 || $from.parentOffset !== 0) && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
49614
|
+
}
|
|
49615
|
+
const ilvl = getResolvedParagraphProperties(paragraph).numberingProperties.ilvl;
|
|
49616
|
+
if (ilvl > 0) {
|
|
49617
|
+
const outdented = decreaseListIndent()(props);
|
|
49618
|
+
if (outdented) {
|
|
49619
|
+
tr.scrollIntoView();
|
|
49620
|
+
}
|
|
49621
|
+
return outdented;
|
|
49622
|
+
} else {
|
|
49623
|
+
updateNumberingProperties(null, paragraph, pos, editor, tr);
|
|
49624
|
+
}
|
|
49625
|
+
if (dispatch) dispatch(tr);
|
|
49626
|
+
return true;
|
|
49627
|
+
};
|
|
49628
|
+
function isVisuallyEmptyParagraph(node) {
|
|
49629
|
+
if (!node || node.type.name !== "paragraph") return false;
|
|
49630
|
+
let hasHardBreak = false;
|
|
49631
|
+
node.descendants((n) => {
|
|
49632
|
+
if (n.type && n.type.name === "hardBreak") {
|
|
49633
|
+
hasHardBreak = true;
|
|
49634
|
+
return false;
|
|
49635
|
+
}
|
|
49636
|
+
return true;
|
|
49637
|
+
});
|
|
49638
|
+
if (hasHardBreak) return false;
|
|
49639
|
+
const text = (node.textContent || "").replace(/\u200b/g, "").trim();
|
|
49640
|
+
if (text.length > 0) return false;
|
|
49641
|
+
let hasInlineLeaf = false;
|
|
49642
|
+
node.descendants((n) => {
|
|
49643
|
+
if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak" && n.type?.name !== "run") {
|
|
49644
|
+
hasInlineLeaf = true;
|
|
49645
|
+
return false;
|
|
49646
|
+
}
|
|
49647
|
+
return true;
|
|
49648
|
+
});
|
|
49649
|
+
if (hasInlineLeaf) return false;
|
|
49650
|
+
return true;
|
|
49651
|
+
}
|
|
49599
49652
|
const toggleList = (listType) => ({ editor, state: state2, tr, dispatch }) => {
|
|
49600
49653
|
let predicate;
|
|
49601
49654
|
if (listType === "orderedList") {
|
|
@@ -49615,19 +49668,22 @@ const toggleList = (listType) => ({ editor, state: state2, tr, dispatch }) => {
|
|
|
49615
49668
|
const { from: from2, to } = selection;
|
|
49616
49669
|
let firstListNode = null;
|
|
49617
49670
|
let hasNonListParagraphs = false;
|
|
49618
|
-
let
|
|
49671
|
+
let allParagraphsInSelection = [];
|
|
49619
49672
|
state2.doc.nodesBetween(from2, to, (node, pos) => {
|
|
49620
49673
|
if (node.type.name === "paragraph") {
|
|
49621
|
-
|
|
49622
|
-
if (!firstListNode && predicate(node)) {
|
|
49623
|
-
firstListNode = node;
|
|
49624
|
-
} else if (!predicate(node)) {
|
|
49625
|
-
hasNonListParagraphs = true;
|
|
49626
|
-
}
|
|
49674
|
+
allParagraphsInSelection.push({ node, pos });
|
|
49627
49675
|
return false;
|
|
49628
49676
|
}
|
|
49629
49677
|
return true;
|
|
49630
49678
|
});
|
|
49679
|
+
let paragraphsInSelection = allParagraphsInSelection.length === 1 ? allParagraphsInSelection : allParagraphsInSelection.filter(({ node }) => !isVisuallyEmptyParagraph(node));
|
|
49680
|
+
for (const { node } of paragraphsInSelection) {
|
|
49681
|
+
if (!firstListNode && predicate(node)) {
|
|
49682
|
+
firstListNode = node;
|
|
49683
|
+
} else if (!predicate(node)) {
|
|
49684
|
+
hasNonListParagraphs = true;
|
|
49685
|
+
}
|
|
49686
|
+
}
|
|
49631
49687
|
if (!firstListNode && from2 > 0) {
|
|
49632
49688
|
const $from = state2.doc.resolve(from2);
|
|
49633
49689
|
const parentIndex = $from.index(-1);
|
|
@@ -49671,11 +49727,30 @@ const toggleList = (listType) => ({ editor, state: state2, tr, dispatch }) => {
|
|
|
49671
49727
|
}
|
|
49672
49728
|
updateNumberingProperties(sharedNumberingProperties, node, pos, editor, tr);
|
|
49673
49729
|
}
|
|
49674
|
-
|
|
49675
|
-
|
|
49676
|
-
|
|
49677
|
-
|
|
49678
|
-
|
|
49730
|
+
if (paragraphsInSelection.length > 0) {
|
|
49731
|
+
const firstPara = paragraphsInSelection[0];
|
|
49732
|
+
const lastPara = paragraphsInSelection[paragraphsInSelection.length - 1];
|
|
49733
|
+
const mappedFirstPos = tr.mapping.map(firstPara.pos);
|
|
49734
|
+
const mappedLastPos = tr.mapping.map(lastPara.pos);
|
|
49735
|
+
const $firstPos = tr.doc.resolve(mappedFirstPos);
|
|
49736
|
+
const $lastPos = tr.doc.resolve(mappedLastPos);
|
|
49737
|
+
const firstNode = $firstPos.nodeAfter;
|
|
49738
|
+
const lastNode = $lastPos.nodeAfter;
|
|
49739
|
+
if (firstNode && lastNode) {
|
|
49740
|
+
let selFrom = mappedFirstPos + 1;
|
|
49741
|
+
let selTo = mappedLastPos + lastNode.nodeSize - 1;
|
|
49742
|
+
if (firstNode.firstChild && firstNode.firstChild.type.name === "run") {
|
|
49743
|
+
selFrom = mappedFirstPos + 2;
|
|
49744
|
+
}
|
|
49745
|
+
if (lastNode.lastChild && lastNode.lastChild.type.name === "run") {
|
|
49746
|
+
selTo = mappedLastPos + lastNode.nodeSize - 2;
|
|
49747
|
+
}
|
|
49748
|
+
if (selFrom >= 0 && selTo <= tr.doc.content.size && selFrom <= selTo) {
|
|
49749
|
+
try {
|
|
49750
|
+
tr.setSelection(TextSelection$1.create(tr.doc, selFrom, selTo));
|
|
49751
|
+
} catch {
|
|
49752
|
+
}
|
|
49753
|
+
}
|
|
49679
49754
|
}
|
|
49680
49755
|
}
|
|
49681
49756
|
if (dispatch) dispatch(tr);
|
|
@@ -49688,59 +49763,6 @@ const increaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
|
49688
49763
|
}
|
|
49689
49764
|
return handled;
|
|
49690
49765
|
};
|
|
49691
|
-
const decreaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
49692
|
-
const handled = changeListLevel(-1, editor, tr);
|
|
49693
|
-
if (handled && dispatch) {
|
|
49694
|
-
dispatch(tr);
|
|
49695
|
-
}
|
|
49696
|
-
return handled;
|
|
49697
|
-
};
|
|
49698
|
-
const removeNumberingProperties = ({ checkType = "startParagraph" } = {}) => (props) => {
|
|
49699
|
-
const { tr, state: state2, editor, dispatch } = props;
|
|
49700
|
-
const { node: paragraph, pos } = findParentNode(isList)(state2.selection) || {};
|
|
49701
|
-
if (!paragraph) return false;
|
|
49702
|
-
if (checkType === "empty" && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
49703
|
-
if (checkType === "startParagraph") {
|
|
49704
|
-
const { $from, empty: empty2 } = state2.selection;
|
|
49705
|
-
if ((!empty2 || $from.parentOffset !== 0) && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
49706
|
-
}
|
|
49707
|
-
const ilvl = getResolvedParagraphProperties(paragraph).numberingProperties.ilvl;
|
|
49708
|
-
if (ilvl > 0) {
|
|
49709
|
-
const outdented = decreaseListIndent()(props);
|
|
49710
|
-
if (outdented) {
|
|
49711
|
-
tr.scrollIntoView();
|
|
49712
|
-
}
|
|
49713
|
-
return outdented;
|
|
49714
|
-
} else {
|
|
49715
|
-
updateNumberingProperties(null, paragraph, pos, editor, tr);
|
|
49716
|
-
}
|
|
49717
|
-
if (dispatch) dispatch(tr);
|
|
49718
|
-
return true;
|
|
49719
|
-
};
|
|
49720
|
-
function isVisuallyEmptyParagraph(node) {
|
|
49721
|
-
if (!node || node.type.name !== "paragraph") return false;
|
|
49722
|
-
let hasHardBreak = false;
|
|
49723
|
-
node.descendants((n) => {
|
|
49724
|
-
if (n.type && n.type.name === "hardBreak") {
|
|
49725
|
-
hasHardBreak = true;
|
|
49726
|
-
return false;
|
|
49727
|
-
}
|
|
49728
|
-
return true;
|
|
49729
|
-
});
|
|
49730
|
-
if (hasHardBreak) return false;
|
|
49731
|
-
const text = (node.textContent || "").replace(/\u200b/g, "").trim();
|
|
49732
|
-
if (text.length > 0) return false;
|
|
49733
|
-
let hasInlineLeaf = false;
|
|
49734
|
-
node.descendants((n) => {
|
|
49735
|
-
if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak" && n.type?.name !== "run") {
|
|
49736
|
-
hasInlineLeaf = true;
|
|
49737
|
-
return false;
|
|
49738
|
-
}
|
|
49739
|
-
return true;
|
|
49740
|
-
});
|
|
49741
|
-
if (hasInlineLeaf) return false;
|
|
49742
|
-
return true;
|
|
49743
|
-
}
|
|
49744
49766
|
const restoreSelection = () => ({ editor, state: state2, tr }) => {
|
|
49745
49767
|
if (editor.options.lastSelection) {
|
|
49746
49768
|
const selectionTr = tr.setSelection(
|
|
@@ -49823,6 +49845,7 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
49823
49845
|
insertTabCharacter,
|
|
49824
49846
|
insertTabNode,
|
|
49825
49847
|
isStyleTokenEnabled,
|
|
49848
|
+
isVisuallyEmptyParagraph,
|
|
49826
49849
|
joinBackward,
|
|
49827
49850
|
joinDown,
|
|
49828
49851
|
joinForward,
|
|
@@ -49941,12 +49964,38 @@ const Keymap = Extension.create({
|
|
|
49941
49964
|
const Editable = Extension.create({
|
|
49942
49965
|
name: "editable",
|
|
49943
49966
|
addPmPlugins() {
|
|
49967
|
+
const editor = this.editor;
|
|
49944
49968
|
const editablePlugin = new Plugin({
|
|
49945
49969
|
key: new PluginKey("editable"),
|
|
49946
49970
|
props: {
|
|
49947
|
-
editable: () =>
|
|
49948
|
-
|
|
49949
|
-
|
|
49971
|
+
editable: () => editor.options.editable,
|
|
49972
|
+
handleDOMEvents: {
|
|
49973
|
+
beforeinput: (_view, event) => {
|
|
49974
|
+
if (!editor.options.editable) {
|
|
49975
|
+
event.preventDefault();
|
|
49976
|
+
return true;
|
|
49977
|
+
}
|
|
49978
|
+
return false;
|
|
49979
|
+
},
|
|
49980
|
+
mousedown: (_view, event) => {
|
|
49981
|
+
if (!editor.options.editable) {
|
|
49982
|
+
event.preventDefault();
|
|
49983
|
+
return true;
|
|
49984
|
+
}
|
|
49985
|
+
return false;
|
|
49986
|
+
},
|
|
49987
|
+
focus: (view, event) => {
|
|
49988
|
+
if (!editor.options.editable) {
|
|
49989
|
+
event.preventDefault();
|
|
49990
|
+
view.dom.blur();
|
|
49991
|
+
return true;
|
|
49992
|
+
}
|
|
49993
|
+
return false;
|
|
49994
|
+
}
|
|
49995
|
+
},
|
|
49996
|
+
handleClick: () => !editor.options.editable,
|
|
49997
|
+
handleDoubleClick: () => !editor.options.editable,
|
|
49998
|
+
handleTripleClick: () => !editor.options.editable
|
|
49950
49999
|
}
|
|
49951
50000
|
});
|
|
49952
50001
|
return [editablePlugin];
|
|
@@ -50884,7 +50933,6 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
50884
50933
|
comments.forEach((c2) => {
|
|
50885
50934
|
commentMap.set(c2.commentId, c2);
|
|
50886
50935
|
});
|
|
50887
|
-
new Set(comments.filter((c2) => c2.parentCommentId).map((c2) => c2.parentCommentId));
|
|
50888
50936
|
const startNodes = [];
|
|
50889
50937
|
const endNodes = [];
|
|
50890
50938
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -53505,7 +53553,7 @@ const isHeadless = (editor) => {
|
|
|
53505
53553
|
const shouldSkipNodeView = (editor) => {
|
|
53506
53554
|
return isHeadless(editor);
|
|
53507
53555
|
};
|
|
53508
|
-
const summaryVersion = "1.0.0-beta.
|
|
53556
|
+
const summaryVersion = "1.0.0-beta.22";
|
|
53509
53557
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
53510
53558
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
53511
53559
|
function mapAttributes(attrs) {
|
|
@@ -53910,10 +53958,23 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53910
53958
|
this.view.updateState(this.state);
|
|
53911
53959
|
}
|
|
53912
53960
|
/**
|
|
53913
|
-
* Set whether the editor is editable
|
|
53961
|
+
* Set whether the editor is editable.
|
|
53962
|
+
*
|
|
53963
|
+
* When setting to non-editable, this method:
|
|
53964
|
+
* - Forces ProseMirror to re-evaluate the editable prop from the Editable plugin
|
|
53965
|
+
* - Blurs the editor to remove the cursor
|
|
53966
|
+
*
|
|
53967
|
+
* @param editable - Whether the editor should accept user input (default: true)
|
|
53968
|
+
* @param emitUpdate - Whether to emit an update event after changing editability (default: true)
|
|
53914
53969
|
*/
|
|
53915
53970
|
setEditable(editable = true, emitUpdate = true) {
|
|
53916
53971
|
this.setOptions({ editable });
|
|
53972
|
+
if (this.view) {
|
|
53973
|
+
this.view.setProps({});
|
|
53974
|
+
if (!editable && this.view.dom) {
|
|
53975
|
+
this.view.dom.blur();
|
|
53976
|
+
}
|
|
53977
|
+
}
|
|
53917
53978
|
if (emitUpdate) {
|
|
53918
53979
|
this.emit("update", { editor: this, transaction: this.state.tr });
|
|
53919
53980
|
}
|
|
@@ -54281,7 +54342,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54281
54342
|
{ default: remarkStringify },
|
|
54282
54343
|
{ default: remarkGfm }
|
|
54283
54344
|
] = await Promise.all([
|
|
54284
|
-
Promise.resolve().then(() => require("./index-
|
|
54345
|
+
Promise.resolve().then(() => require("./index-895wSAjT-CWlZl8zz.cjs")),
|
|
54285
54346
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
54286
54347
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
54287
54348
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -54486,7 +54547,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54486
54547
|
* Process collaboration migrations
|
|
54487
54548
|
*/
|
|
54488
54549
|
processCollaborationMigrations() {
|
|
54489
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
54550
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.22");
|
|
54490
54551
|
if (!this.options.ydoc) return;
|
|
54491
54552
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
54492
54553
|
let docVersion = metaMap.get("version");
|
|
@@ -55173,8 +55234,9 @@ function extractPageNumbering(elements) {
|
|
|
55173
55234
|
const fmt = validFormats.includes(fmtRaw) ? fmtRaw : void 0;
|
|
55174
55235
|
const startRaw = pgNumType.attributes["w:start"];
|
|
55175
55236
|
const startNum = startRaw != null ? Number(startRaw) : void 0;
|
|
55237
|
+
const effectiveFormat = fmt ?? (Number.isFinite(startNum) ? "decimal" : void 0);
|
|
55176
55238
|
return {
|
|
55177
|
-
format:
|
|
55239
|
+
format: effectiveFormat,
|
|
55178
55240
|
...Number.isFinite(startNum) ? { start: Number(startNum) } : {}
|
|
55179
55241
|
};
|
|
55180
55242
|
}
|
|
@@ -62396,6 +62458,84 @@ const getHeaderFooterType = (pageNumber, identifier, options) => {
|
|
|
62396
62458
|
}
|
|
62397
62459
|
return null;
|
|
62398
62460
|
};
|
|
62461
|
+
const defaultMultiSectionIdentifier = () => ({
|
|
62462
|
+
headerIds: { default: null, first: null, even: null, odd: null },
|
|
62463
|
+
footerIds: { default: null, first: null, even: null, odd: null },
|
|
62464
|
+
titlePg: false,
|
|
62465
|
+
alternateHeaders: false,
|
|
62466
|
+
sectionCount: 0,
|
|
62467
|
+
sectionHeaderIds: /* @__PURE__ */ new Map(),
|
|
62468
|
+
sectionFooterIds: /* @__PURE__ */ new Map(),
|
|
62469
|
+
sectionTitlePg: /* @__PURE__ */ new Map()
|
|
62470
|
+
});
|
|
62471
|
+
function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
|
|
62472
|
+
const identifier = defaultMultiSectionIdentifier();
|
|
62473
|
+
identifier.alternateHeaders = Boolean(pageStyles2?.alternateHeaders ?? false);
|
|
62474
|
+
identifier.sectionCount = sectionMetadata.length;
|
|
62475
|
+
for (const section of sectionMetadata) {
|
|
62476
|
+
const idx = section.sectionIndex;
|
|
62477
|
+
if (section.headerRefs) {
|
|
62478
|
+
identifier.sectionHeaderIds.set(idx, {
|
|
62479
|
+
default: section.headerRefs.default ?? null,
|
|
62480
|
+
first: section.headerRefs.first ?? null,
|
|
62481
|
+
even: section.headerRefs.even ?? null,
|
|
62482
|
+
odd: section.headerRefs.odd ?? null
|
|
62483
|
+
});
|
|
62484
|
+
}
|
|
62485
|
+
if (section.footerRefs) {
|
|
62486
|
+
identifier.sectionFooterIds.set(idx, {
|
|
62487
|
+
default: section.footerRefs.default ?? null,
|
|
62488
|
+
first: section.footerRefs.first ?? null,
|
|
62489
|
+
even: section.footerRefs.even ?? null,
|
|
62490
|
+
odd: section.footerRefs.odd ?? null
|
|
62491
|
+
});
|
|
62492
|
+
}
|
|
62493
|
+
const hasFirstHeader = Boolean(section.headerRefs?.first);
|
|
62494
|
+
const hasFirstFooter = Boolean(section.footerRefs?.first);
|
|
62495
|
+
if (hasFirstHeader || hasFirstFooter) {
|
|
62496
|
+
identifier.sectionTitlePg.set(idx, true);
|
|
62497
|
+
}
|
|
62498
|
+
}
|
|
62499
|
+
const section0Headers = identifier.sectionHeaderIds.get(0);
|
|
62500
|
+
const section0Footers = identifier.sectionFooterIds.get(0);
|
|
62501
|
+
if (section0Headers) {
|
|
62502
|
+
identifier.headerIds = { ...section0Headers };
|
|
62503
|
+
}
|
|
62504
|
+
if (section0Footers) {
|
|
62505
|
+
identifier.footerIds = { ...section0Footers };
|
|
62506
|
+
}
|
|
62507
|
+
identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
|
|
62508
|
+
return identifier;
|
|
62509
|
+
}
|
|
62510
|
+
function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, options) {
|
|
62511
|
+
if (pageNumber <= 0) return null;
|
|
62512
|
+
const kind = options?.kind ?? "header";
|
|
62513
|
+
const sectionPageNumber = options?.sectionPageNumber ?? pageNumber;
|
|
62514
|
+
const sectionIds = kind === "header" ? identifier.sectionHeaderIds.get(sectionIndex) : identifier.sectionFooterIds.get(sectionIndex);
|
|
62515
|
+
const ids = sectionIds ?? (kind === "header" ? identifier.headerIds : identifier.footerIds);
|
|
62516
|
+
const hasFirst = Boolean(ids.first);
|
|
62517
|
+
const hasEven = Boolean(ids.even);
|
|
62518
|
+
const hasOdd = Boolean(ids.odd);
|
|
62519
|
+
const hasDefault = Boolean(ids.default);
|
|
62520
|
+
const sectionTitlePg = identifier.sectionTitlePg.get(sectionIndex) ?? identifier.titlePg;
|
|
62521
|
+
const titlePgEnabled = sectionTitlePg && hasFirst;
|
|
62522
|
+
const isFirstPageOfSection = sectionPageNumber === 1;
|
|
62523
|
+
if (isFirstPageOfSection && titlePgEnabled) {
|
|
62524
|
+
return "first";
|
|
62525
|
+
}
|
|
62526
|
+
if (identifier.alternateHeaders) {
|
|
62527
|
+
if (pageNumber % 2 === 0 && (hasEven || hasDefault)) {
|
|
62528
|
+
return hasEven ? "even" : "default";
|
|
62529
|
+
}
|
|
62530
|
+
if (pageNumber % 2 === 1 && (hasOdd || hasDefault)) {
|
|
62531
|
+
return hasOdd ? "odd" : "default";
|
|
62532
|
+
}
|
|
62533
|
+
}
|
|
62534
|
+
if (hasDefault) {
|
|
62535
|
+
return "default";
|
|
62536
|
+
}
|
|
62537
|
+
return null;
|
|
62538
|
+
}
|
|
62399
62539
|
function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
62400
62540
|
const zones = [];
|
|
62401
62541
|
const marginLeft = Math.max(0, margins?.left ?? 0);
|
|
@@ -63546,23 +63686,54 @@ function layoutTableBlock({
|
|
|
63546
63686
|
const headerCount = countHeaderRows(block);
|
|
63547
63687
|
const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
|
|
63548
63688
|
let state2 = ensurePage();
|
|
63689
|
+
const availableHeight = state2.contentBottom - state2.cursorY;
|
|
63690
|
+
let minRequiredHeight = 0;
|
|
63691
|
+
if (measure.rows.length > 0) {
|
|
63692
|
+
minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
|
|
63693
|
+
} else if (measure.totalHeight > 0) {
|
|
63694
|
+
minRequiredHeight = measure.totalHeight;
|
|
63695
|
+
}
|
|
63696
|
+
if (minRequiredHeight > availableHeight && state2.page.fragments.length > 0) {
|
|
63697
|
+
state2 = advanceColumn(state2);
|
|
63698
|
+
}
|
|
63549
63699
|
let currentRow = 0;
|
|
63550
63700
|
let isTableContinuation = false;
|
|
63551
63701
|
let pendingPartialRow = null;
|
|
63702
|
+
if (block.rows.length === 0 && measure.totalHeight > 0) {
|
|
63703
|
+
const height = Math.min(measure.totalHeight, state2.contentBottom - state2.cursorY);
|
|
63704
|
+
const metadata = {
|
|
63705
|
+
columnBoundaries: generateColumnBoundaries(measure),
|
|
63706
|
+
coordinateSystem: "fragment"
|
|
63707
|
+
};
|
|
63708
|
+
const fragment = {
|
|
63709
|
+
kind: "table",
|
|
63710
|
+
blockId: block.id,
|
|
63711
|
+
fromRow: 0,
|
|
63712
|
+
toRow: 0,
|
|
63713
|
+
x: columnX(state2.columnIndex),
|
|
63714
|
+
y: state2.cursorY,
|
|
63715
|
+
width: Math.min(columnWidth, measure.totalWidth || columnWidth),
|
|
63716
|
+
height,
|
|
63717
|
+
metadata
|
|
63718
|
+
};
|
|
63719
|
+
state2.page.fragments.push(fragment);
|
|
63720
|
+
state2.cursorY += height;
|
|
63721
|
+
return;
|
|
63722
|
+
}
|
|
63552
63723
|
while (currentRow < block.rows.length || pendingPartialRow !== null) {
|
|
63553
63724
|
state2 = ensurePage();
|
|
63554
|
-
const
|
|
63725
|
+
const availableHeight2 = state2.contentBottom - state2.cursorY;
|
|
63555
63726
|
let repeatHeaderCount = 0;
|
|
63556
63727
|
if (currentRow === 0 && !pendingPartialRow) {
|
|
63557
63728
|
repeatHeaderCount = 0;
|
|
63558
63729
|
} else {
|
|
63559
|
-
if (headerCount > 0 && headerHeight <=
|
|
63730
|
+
if (headerCount > 0 && headerHeight <= availableHeight2) {
|
|
63560
63731
|
repeatHeaderCount = headerCount;
|
|
63561
|
-
} else if (headerCount > 0 && headerHeight >
|
|
63732
|
+
} else if (headerCount > 0 && headerHeight > availableHeight2) {
|
|
63562
63733
|
repeatHeaderCount = 0;
|
|
63563
63734
|
}
|
|
63564
63735
|
}
|
|
63565
|
-
const availableForBody = repeatHeaderCount > 0 ?
|
|
63736
|
+
const availableForBody = repeatHeaderCount > 0 ? availableHeight2 - headerHeight : availableHeight2;
|
|
63566
63737
|
const fullPageHeight = state2.contentBottom;
|
|
63567
63738
|
if (pendingPartialRow !== null) {
|
|
63568
63739
|
const rowIndex = pendingPartialRow.rowIndex;
|
|
@@ -63941,7 +64112,7 @@ function computeDisplayPageNumber(pages, sections) {
|
|
|
63941
64112
|
let currentSectionIndex = -1;
|
|
63942
64113
|
for (let i = 0; i < pages.length; i++) {
|
|
63943
64114
|
const page = pages[i];
|
|
63944
|
-
const pageSectionIndex = 0;
|
|
64115
|
+
const pageSectionIndex = page.sectionIndex ?? 0;
|
|
63945
64116
|
if (pageSectionIndex !== currentSectionIndex) {
|
|
63946
64117
|
const sectionMetadata2 = sectionMap.get(pageSectionIndex);
|
|
63947
64118
|
if (sectionMetadata2?.numbering?.start !== void 0) {
|
|
@@ -64190,6 +64361,18 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64190
64361
|
};
|
|
64191
64362
|
layoutLog(`[Layout] First section: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
64192
64363
|
}
|
|
64364
|
+
const firstSectionIndexRaw = block.attrs?.sectionIndex;
|
|
64365
|
+
const firstMetadataIndex = typeof firstSectionIndexRaw === "number" ? firstSectionIndexRaw : Number(firstSectionIndexRaw ?? NaN);
|
|
64366
|
+
if (Number.isFinite(firstMetadataIndex)) {
|
|
64367
|
+
activeSectionIndex = firstMetadataIndex;
|
|
64368
|
+
}
|
|
64369
|
+
const firstSectionMetadata = Number.isFinite(firstMetadataIndex) ? sectionMetadataList[firstMetadataIndex] : void 0;
|
|
64370
|
+
if (firstSectionMetadata?.numbering) {
|
|
64371
|
+
if (firstSectionMetadata.numbering.format) activeNumberFormat = firstSectionMetadata.numbering.format;
|
|
64372
|
+
if (typeof firstSectionMetadata.numbering.start === "number") {
|
|
64373
|
+
activePageCounter = firstSectionMetadata.numbering.start;
|
|
64374
|
+
}
|
|
64375
|
+
}
|
|
64193
64376
|
return { decision: { forcePageBreak: false, forceMidPageRegion: false }, state: next };
|
|
64194
64377
|
}
|
|
64195
64378
|
const headerPx = block.margins?.header;
|
|
@@ -64206,7 +64389,15 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64206
64389
|
if (block.orientation) next.pendingOrientation = block.orientation;
|
|
64207
64390
|
const sectionType = block.type ?? "continuous";
|
|
64208
64391
|
const isColumnsChanging = !!block.columns && (block.columns.count !== next.activeColumns.count || block.columns.gap !== next.activeColumns.gap);
|
|
64209
|
-
|
|
64392
|
+
const sectionIndexRaw = block.attrs?.sectionIndex;
|
|
64393
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
64394
|
+
if (Number.isFinite(metadataIndex)) {
|
|
64395
|
+
pendingSectionIndex = metadataIndex;
|
|
64396
|
+
}
|
|
64397
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
64398
|
+
if (sectionMetadata?.numbering) {
|
|
64399
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
64400
|
+
} else if (block.numbering) {
|
|
64210
64401
|
pendingNumbering = { ...block.numbering };
|
|
64211
64402
|
}
|
|
64212
64403
|
if (block.headerRefs || block.footerRefs) {
|
|
@@ -64275,6 +64466,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64275
64466
|
...initialSectionMetadata.footerRefs && { footerRefs: initialSectionMetadata.footerRefs }
|
|
64276
64467
|
};
|
|
64277
64468
|
}
|
|
64469
|
+
let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
|
|
64470
|
+
let pendingSectionIndex = null;
|
|
64278
64471
|
const paginator = createPaginator({
|
|
64279
64472
|
margins: { left: margins.left, right: margins.right },
|
|
64280
64473
|
getActiveTopMargin: () => activeTopMargin,
|
|
@@ -64331,6 +64524,10 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64331
64524
|
activeSectionRefs = pendingSectionRefs;
|
|
64332
64525
|
pendingSectionRefs = null;
|
|
64333
64526
|
}
|
|
64527
|
+
if (pendingSectionIndex !== null) {
|
|
64528
|
+
activeSectionIndex = pendingSectionIndex;
|
|
64529
|
+
pendingSectionIndex = null;
|
|
64530
|
+
}
|
|
64334
64531
|
if (pendingVAlign !== null) {
|
|
64335
64532
|
activeVAlign = pendingVAlign;
|
|
64336
64533
|
pendingVAlign = null;
|
|
@@ -64340,6 +64537,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64340
64537
|
}
|
|
64341
64538
|
if (state2?.page) {
|
|
64342
64539
|
state2.page.numberText = formatPageNumber(activePageCounter, activeNumberFormat);
|
|
64540
|
+
state2.page.sectionIndex = activeSectionIndex;
|
|
64541
|
+
layoutLog(`[Layout] Page ${state2.page.number}: Stamped sectionIndex:`, activeSectionIndex);
|
|
64343
64542
|
if (activeSectionRefs) {
|
|
64344
64543
|
state2.page.sectionRefs = {
|
|
64345
64544
|
...activeSectionRefs.headerRefs && { headerRefs: activeSectionRefs.headerRefs },
|
|
@@ -64526,8 +64725,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64526
64725
|
activeOrientation = updatedState.activeOrientation;
|
|
64527
64726
|
pendingOrientation = updatedState.pendingOrientation;
|
|
64528
64727
|
if (effectiveBlock.vAlign) {
|
|
64529
|
-
const
|
|
64530
|
-
if (
|
|
64728
|
+
const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
64729
|
+
if (isFirstSection2) {
|
|
64531
64730
|
activeVAlign = effectiveBlock.vAlign;
|
|
64532
64731
|
pendingVAlign = null;
|
|
64533
64732
|
} else {
|
|
@@ -64541,6 +64740,36 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64541
64740
|
};
|
|
64542
64741
|
layoutLog(`[Layout] After scheduleSectionBreakCompat: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
64543
64742
|
}
|
|
64743
|
+
const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
|
|
64744
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
64745
|
+
const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
64746
|
+
if (Number.isFinite(metadataIndex)) {
|
|
64747
|
+
if (isFirstSection) {
|
|
64748
|
+
activeSectionIndex = metadataIndex;
|
|
64749
|
+
} else {
|
|
64750
|
+
pendingSectionIndex = metadataIndex;
|
|
64751
|
+
}
|
|
64752
|
+
}
|
|
64753
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
64754
|
+
if (sectionMetadata?.numbering) {
|
|
64755
|
+
if (isFirstSection) {
|
|
64756
|
+
if (sectionMetadata.numbering.format) activeNumberFormat = sectionMetadata.numbering.format;
|
|
64757
|
+
if (typeof sectionMetadata.numbering.start === "number") {
|
|
64758
|
+
activePageCounter = sectionMetadata.numbering.start;
|
|
64759
|
+
}
|
|
64760
|
+
} else {
|
|
64761
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
64762
|
+
}
|
|
64763
|
+
} else if (effectiveBlock.numbering) {
|
|
64764
|
+
if (isFirstSection) {
|
|
64765
|
+
if (effectiveBlock.numbering.format) activeNumberFormat = effectiveBlock.numbering.format;
|
|
64766
|
+
if (typeof effectiveBlock.numbering.start === "number") {
|
|
64767
|
+
activePageCounter = effectiveBlock.numbering.start;
|
|
64768
|
+
}
|
|
64769
|
+
} else {
|
|
64770
|
+
pendingNumbering = { ...effectiveBlock.numbering };
|
|
64771
|
+
}
|
|
64772
|
+
}
|
|
64544
64773
|
if (breakInfo.forceMidPageRegion && block.columns) {
|
|
64545
64774
|
let state2 = paginator.ensurePage();
|
|
64546
64775
|
const columnIndexBefore = state2.columnIndex;
|
|
@@ -65520,8 +65749,11 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
|
65520
65749
|
const { totalPages: docTotalPages } = pageResolver(1);
|
|
65521
65750
|
const useBucketing = FeatureFlags.HF_DIGIT_BUCKETING && docTotalPages >= MIN_PAGES_FOR_BUCKETING;
|
|
65522
65751
|
for (const [type2, blocks] of Object.entries(sections)) {
|
|
65523
|
-
if (!blocks || blocks.length === 0)
|
|
65524
|
-
|
|
65752
|
+
if (!blocks || blocks.length === 0) {
|
|
65753
|
+
continue;
|
|
65754
|
+
}
|
|
65755
|
+
const hasTokens = hasPageTokens(blocks);
|
|
65756
|
+
if (!hasTokens) {
|
|
65525
65757
|
const measures = await cache2.measureBlocks(blocks, constraints, measureBlock2);
|
|
65526
65758
|
const layout = layoutHeaderFooter(blocks, measures, constraints);
|
|
65527
65759
|
result[type2] = { blocks, measures, layout };
|
|
@@ -65543,7 +65775,8 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
|
65543
65775
|
for (const pageNum of pagesToLayout) {
|
|
65544
65776
|
const clonedBlocks = cloneHeaderFooterBlocks(blocks);
|
|
65545
65777
|
const { displayText, totalPages: totalPagesForPage } = pageResolver(pageNum);
|
|
65546
|
-
|
|
65778
|
+
const resolvedPageNum = parseInt(displayText, 10) || pageNum;
|
|
65779
|
+
resolveHeaderFooterTokens(clonedBlocks, resolvedPageNum, totalPagesForPage);
|
|
65547
65780
|
const measures = await cache2.measureBlocks(clonedBlocks, constraints, measureBlock2);
|
|
65548
65781
|
const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints);
|
|
65549
65782
|
pages.push({
|
|
@@ -72385,9 +72618,36 @@ const fragmentSignature = (fragment, lookup2) => {
|
|
|
72385
72618
|
}
|
|
72386
72619
|
return base2;
|
|
72387
72620
|
};
|
|
72621
|
+
const hasListMarkerProperties = (attrs) => {
|
|
72622
|
+
if (!attrs || typeof attrs !== "object") return false;
|
|
72623
|
+
const obj = attrs;
|
|
72624
|
+
if (!obj.numberingProperties || typeof obj.numberingProperties !== "object") return false;
|
|
72625
|
+
const numProps = obj.numberingProperties;
|
|
72626
|
+
if ("numId" in numProps) {
|
|
72627
|
+
const numId = numProps.numId;
|
|
72628
|
+
if (typeof numId !== "number" && typeof numId !== "string") return false;
|
|
72629
|
+
}
|
|
72630
|
+
if ("ilvl" in numProps) {
|
|
72631
|
+
const ilvl = numProps.ilvl;
|
|
72632
|
+
if (typeof ilvl !== "number") return false;
|
|
72633
|
+
}
|
|
72634
|
+
if ("wordLayout" in obj && obj.wordLayout !== void 0) {
|
|
72635
|
+
if (typeof obj.wordLayout !== "object" || obj.wordLayout === null) return false;
|
|
72636
|
+
const wordLayout = obj.wordLayout;
|
|
72637
|
+
if ("marker" in wordLayout && wordLayout.marker !== void 0) {
|
|
72638
|
+
if (typeof wordLayout.marker !== "object" || wordLayout.marker === null) return false;
|
|
72639
|
+
const marker = wordLayout.marker;
|
|
72640
|
+
if ("markerText" in marker && marker.markerText !== void 0) {
|
|
72641
|
+
if (typeof marker.markerText !== "string") return false;
|
|
72642
|
+
}
|
|
72643
|
+
}
|
|
72644
|
+
}
|
|
72645
|
+
return true;
|
|
72646
|
+
};
|
|
72388
72647
|
const deriveBlockVersion = (block) => {
|
|
72389
72648
|
if (block.kind === "paragraph") {
|
|
72390
|
-
|
|
72649
|
+
const markerVersion = hasListMarkerProperties(block.attrs) ? `marker:${block.attrs.numberingProperties.numId ?? ""}:${block.attrs.numberingProperties.ilvl ?? 0}:${block.attrs.wordLayout?.marker?.markerText ?? ""}` : "";
|
|
72650
|
+
const runsVersion = block.runs.map((run2) => {
|
|
72391
72651
|
if (run2.kind === "image") {
|
|
72392
72652
|
const imgRun = run2;
|
|
72393
72653
|
return [
|
|
@@ -72430,6 +72690,7 @@ const deriveBlockVersion = (block) => {
|
|
|
72430
72690
|
textRun.token ?? ""
|
|
72431
72691
|
].join(",");
|
|
72432
72692
|
}).join("|");
|
|
72693
|
+
return markerVersion ? `${markerVersion}|${runsVersion}` : runsVersion;
|
|
72433
72694
|
}
|
|
72434
72695
|
if (block.kind === "list") {
|
|
72435
72696
|
return block.items.map((item) => `${item.id}:${item.marker.text}:${deriveBlockVersion(item.paragraph)}`).join("|");
|
|
@@ -74848,6 +75109,49 @@ class HeaderFooterLayoutAdapter {
|
|
|
74848
75109
|
});
|
|
74849
75110
|
return hasBlocks ? batch : void 0;
|
|
74850
75111
|
}
|
|
75112
|
+
/**
|
|
75113
|
+
* Retrieves FlowBlocks for ALL header/footer content, keyed by relationship ID.
|
|
75114
|
+
*
|
|
75115
|
+
* Unlike getBatch() which only returns content for variant-associated IDs,
|
|
75116
|
+
* this method returns content for ALL registered header/footer IDs. This is
|
|
75117
|
+
* essential for multi-section documents where different sections may use
|
|
75118
|
+
* different content for the same variant type.
|
|
75119
|
+
*
|
|
75120
|
+
* @param kind - The type of section to retrieve: 'header' or 'footer'
|
|
75121
|
+
* @returns A Map of rId to FlowBlock arrays, or undefined if no content exists
|
|
75122
|
+
*
|
|
75123
|
+
* @example
|
|
75124
|
+
* ```typescript
|
|
75125
|
+
* const footersByRId = adapter.getBlocksByRId('footer');
|
|
75126
|
+
* if (footersByRId) {
|
|
75127
|
+
* // footersByRId.get('rId14') - blocks for footer with rId14
|
|
75128
|
+
* // footersByRId.get('rId18') - blocks for footer with rId18 (different section)
|
|
75129
|
+
* }
|
|
75130
|
+
* ```
|
|
75131
|
+
*/
|
|
75132
|
+
getBlocksByRId(kind) {
|
|
75133
|
+
const descriptors = __privateGet$1(this, _manager).getDescriptors(kind);
|
|
75134
|
+
if (!descriptors.length) return void 0;
|
|
75135
|
+
const blocksMap = /* @__PURE__ */ new Map();
|
|
75136
|
+
descriptors.forEach((descriptor) => {
|
|
75137
|
+
const blocks = __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
75138
|
+
if (blocks && blocks.length > 0) {
|
|
75139
|
+
blocksMap.set(descriptor.id, blocks);
|
|
75140
|
+
}
|
|
75141
|
+
});
|
|
75142
|
+
return blocksMap.size > 0 ? blocksMap : void 0;
|
|
75143
|
+
}
|
|
75144
|
+
/**
|
|
75145
|
+
* Retrieves FlowBlocks for a specific header/footer by its relationship ID.
|
|
75146
|
+
*
|
|
75147
|
+
* @param rId - The relationship ID (e.g., 'rId14')
|
|
75148
|
+
* @returns FlowBlock array for the specified rId, or undefined if not found
|
|
75149
|
+
*/
|
|
75150
|
+
getBlocksForRId(rId) {
|
|
75151
|
+
const descriptor = __privateGet$1(this, _manager).getDescriptorById(rId);
|
|
75152
|
+
if (!descriptor) return void 0;
|
|
75153
|
+
return __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
75154
|
+
}
|
|
74851
75155
|
/**
|
|
74852
75156
|
* Invalidates the cached FlowBlocks for a specific header/footer section.
|
|
74853
75157
|
*
|
|
@@ -75308,8 +75612,11 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
75308
75612
|
__privateAdd$1(this, _headerFooterManager, null);
|
|
75309
75613
|
__privateAdd$1(this, _headerFooterAdapter, null);
|
|
75310
75614
|
__privateAdd$1(this, _headerFooterIdentifier, null);
|
|
75615
|
+
__privateAdd$1(this, _multiSectionIdentifier, null);
|
|
75311
75616
|
__privateAdd$1(this, _headerLayoutResults, null);
|
|
75312
75617
|
__privateAdd$1(this, _footerLayoutResults, null);
|
|
75618
|
+
__privateAdd$1(this, _headerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
75619
|
+
__privateAdd$1(this, _footerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
75313
75620
|
__privateAdd$1(this, _headerDecorationProvider);
|
|
75314
75621
|
__privateAdd$1(this, _footerDecorationProvider);
|
|
75315
75622
|
__privateAdd$1(this, _headerFooterManagerCleanups, []);
|
|
@@ -76466,8 +76773,11 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
76466
76773
|
__privateSet(this, _headerFooterManager, null);
|
|
76467
76774
|
}, "Header/footer manager");
|
|
76468
76775
|
__privateSet(this, _headerFooterIdentifier, null);
|
|
76776
|
+
__privateSet(this, _multiSectionIdentifier, null);
|
|
76469
76777
|
__privateSet(this, _headerLayoutResults, null);
|
|
76470
76778
|
__privateSet(this, _footerLayoutResults, null);
|
|
76779
|
+
__privateGet$1(this, _headerLayoutsByRId).clear();
|
|
76780
|
+
__privateGet$1(this, _footerLayoutsByRId).clear();
|
|
76471
76781
|
__privateSet(this, _headerDecorationProvider, void 0);
|
|
76472
76782
|
__privateSet(this, _footerDecorationProvider, void 0);
|
|
76473
76783
|
__privateSet(this, _session, { mode: "body" });
|
|
@@ -76521,8 +76831,11 @@ _trackedChangesOverrides = /* @__PURE__ */ new WeakMap();
|
|
|
76521
76831
|
_headerFooterManager = /* @__PURE__ */ new WeakMap();
|
|
76522
76832
|
_headerFooterAdapter = /* @__PURE__ */ new WeakMap();
|
|
76523
76833
|
_headerFooterIdentifier = /* @__PURE__ */ new WeakMap();
|
|
76834
|
+
_multiSectionIdentifier = /* @__PURE__ */ new WeakMap();
|
|
76524
76835
|
_headerLayoutResults = /* @__PURE__ */ new WeakMap();
|
|
76525
76836
|
_footerLayoutResults = /* @__PURE__ */ new WeakMap();
|
|
76837
|
+
_headerLayoutsByRId = /* @__PURE__ */ new WeakMap();
|
|
76838
|
+
_footerLayoutsByRId = /* @__PURE__ */ new WeakMap();
|
|
76526
76839
|
_headerDecorationProvider = /* @__PURE__ */ new WeakMap();
|
|
76527
76840
|
_footerDecorationProvider = /* @__PURE__ */ new WeakMap();
|
|
76528
76841
|
_headerFooterManagerCleanups = /* @__PURE__ */ new WeakMap();
|
|
@@ -76881,7 +77194,12 @@ setupPointerHandlers_fn = function() {
|
|
|
76881
77194
|
setupInputBridge_fn = function() {
|
|
76882
77195
|
__privateGet$1(this, _inputBridge)?.destroy();
|
|
76883
77196
|
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
76884
|
-
__privateSet(this, _inputBridge, new PresentationInputBridge(
|
|
77197
|
+
__privateSet(this, _inputBridge, new PresentationInputBridge(
|
|
77198
|
+
win,
|
|
77199
|
+
__privateGet$1(this, _visibleHost),
|
|
77200
|
+
() => __privateMethod$1(this, _PresentationEditor_instances, getActiveDomTarget_fn).call(this),
|
|
77201
|
+
() => __privateGet$1(this, _documentMode) !== "viewing"
|
|
77202
|
+
));
|
|
76885
77203
|
__privateGet$1(this, _inputBridge).bind();
|
|
76886
77204
|
};
|
|
76887
77205
|
initHeaderFooterRegistry_fn = function() {
|
|
@@ -77116,11 +77434,11 @@ rerender_fn = async function() {
|
|
|
77116
77434
|
const sectionMetadata = [];
|
|
77117
77435
|
let blocks;
|
|
77118
77436
|
try {
|
|
77119
|
-
const
|
|
77120
|
-
const converterContext =
|
|
77121
|
-
docx:
|
|
77122
|
-
numbering:
|
|
77123
|
-
linkedStyles:
|
|
77437
|
+
const converter2 = __privateGet$1(this, _editor3).converter;
|
|
77438
|
+
const converterContext = converter2 ? {
|
|
77439
|
+
docx: converter2.convertedXml,
|
|
77440
|
+
numbering: converter2.numbering,
|
|
77441
|
+
linkedStyles: converter2.linkedStyles
|
|
77124
77442
|
} : void 0;
|
|
77125
77443
|
const result = toFlowBlocks(docJson, {
|
|
77126
77444
|
mediaFiles: __privateGet$1(this, _options).mediaFiles,
|
|
@@ -77178,9 +77496,12 @@ rerender_fn = async function() {
|
|
|
77178
77496
|
return;
|
|
77179
77497
|
}
|
|
77180
77498
|
__privateSet(this, _sectionMetadata, sectionMetadata);
|
|
77499
|
+
const converter = __privateGet$1(this, _editor3).converter;
|
|
77500
|
+
__privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
|
|
77181
77501
|
__privateSet(this, _layoutState, { blocks, measures, layout });
|
|
77182
77502
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
77183
77503
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
77504
|
+
await __privateMethod$1(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
77184
77505
|
__privateMethod$1(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
|
|
77185
77506
|
const painter = __privateMethod$1(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks, measures);
|
|
77186
77507
|
if (typeof painter.setProviders === "function") {
|
|
@@ -77194,6 +77515,10 @@ rerender_fn = async function() {
|
|
|
77194
77515
|
headerMeasures.push(...headerResult.measures);
|
|
77195
77516
|
}
|
|
77196
77517
|
}
|
|
77518
|
+
for (const rIdResult of __privateGet$1(this, _headerLayoutsByRId).values()) {
|
|
77519
|
+
headerBlocks.push(...rIdResult.blocks);
|
|
77520
|
+
headerMeasures.push(...rIdResult.measures);
|
|
77521
|
+
}
|
|
77197
77522
|
const footerBlocks = [];
|
|
77198
77523
|
const footerMeasures = [];
|
|
77199
77524
|
if (footerLayouts) {
|
|
@@ -77202,6 +77527,10 @@ rerender_fn = async function() {
|
|
|
77202
77527
|
footerMeasures.push(...footerResult.measures);
|
|
77203
77528
|
}
|
|
77204
77529
|
}
|
|
77530
|
+
for (const rIdResult of __privateGet$1(this, _footerLayoutsByRId).values()) {
|
|
77531
|
+
footerBlocks.push(...rIdResult.blocks);
|
|
77532
|
+
footerMeasures.push(...rIdResult.measures);
|
|
77533
|
+
}
|
|
77205
77534
|
painter.setData?.(
|
|
77206
77535
|
blocks,
|
|
77207
77536
|
measures,
|
|
@@ -77258,6 +77587,10 @@ updateSelection_fn = function() {
|
|
|
77258
77587
|
if (!__privateGet$1(this, _localSelectionLayer)) {
|
|
77259
77588
|
return;
|
|
77260
77589
|
}
|
|
77590
|
+
if (__privateGet$1(this, _documentMode) === "viewing") {
|
|
77591
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
77592
|
+
return;
|
|
77593
|
+
}
|
|
77261
77594
|
const layout = __privateGet$1(this, _layoutState).layout;
|
|
77262
77595
|
const selection = this.getActiveEditor().state?.selection;
|
|
77263
77596
|
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
@@ -77307,7 +77640,9 @@ buildHeaderFooterInput_fn = function() {
|
|
|
77307
77640
|
}
|
|
77308
77641
|
const headerBlocks = __privateGet$1(this, _headerFooterAdapter).getBatch("header");
|
|
77309
77642
|
const footerBlocks = __privateGet$1(this, _headerFooterAdapter).getBatch("footer");
|
|
77310
|
-
|
|
77643
|
+
const headerBlocksByRId = __privateGet$1(this, _headerFooterAdapter).getBlocksByRId("header");
|
|
77644
|
+
const footerBlocksByRId = __privateGet$1(this, _headerFooterAdapter).getBlocksByRId("footer");
|
|
77645
|
+
if (!headerBlocks && !footerBlocks && !headerBlocksByRId && !footerBlocksByRId) {
|
|
77311
77646
|
return null;
|
|
77312
77647
|
}
|
|
77313
77648
|
const constraints = __privateMethod$1(this, _PresentationEditor_instances, computeHeaderFooterConstraints_fn).call(this);
|
|
@@ -77317,6 +77652,8 @@ buildHeaderFooterInput_fn = function() {
|
|
|
77317
77652
|
return {
|
|
77318
77653
|
headerBlocks,
|
|
77319
77654
|
footerBlocks,
|
|
77655
|
+
headerBlocksByRId,
|
|
77656
|
+
footerBlocksByRId,
|
|
77320
77657
|
constraints
|
|
77321
77658
|
};
|
|
77322
77659
|
};
|
|
@@ -77339,6 +77676,80 @@ computeHeaderFooterConstraints_fn = function() {
|
|
|
77339
77676
|
margins: { left: marginLeft, right: marginRight }
|
|
77340
77677
|
};
|
|
77341
77678
|
};
|
|
77679
|
+
layoutPerRIdHeaderFooters_fn = async function(headerFooterInput, layout, sectionMetadata) {
|
|
77680
|
+
__privateGet$1(this, _headerLayoutsByRId).clear();
|
|
77681
|
+
__privateGet$1(this, _footerLayoutsByRId).clear();
|
|
77682
|
+
if (!headerFooterInput) return;
|
|
77683
|
+
const { headerBlocksByRId, footerBlocksByRId, constraints } = headerFooterInput;
|
|
77684
|
+
const displayPages = computeDisplayPageNumber(layout.pages, sectionMetadata);
|
|
77685
|
+
const totalPages = layout.pages.length;
|
|
77686
|
+
const pageResolver = (pageNumber) => {
|
|
77687
|
+
const pageIndex = pageNumber - 1;
|
|
77688
|
+
const displayInfo = displayPages[pageIndex];
|
|
77689
|
+
return {
|
|
77690
|
+
displayText: displayInfo?.displayText ?? String(pageNumber),
|
|
77691
|
+
totalPages
|
|
77692
|
+
};
|
|
77693
|
+
};
|
|
77694
|
+
if (headerBlocksByRId) {
|
|
77695
|
+
for (const [rId, blocks] of headerBlocksByRId) {
|
|
77696
|
+
if (!blocks || blocks.length === 0) continue;
|
|
77697
|
+
try {
|
|
77698
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
77699
|
+
{ default: blocks },
|
|
77700
|
+
// Treat each rId as a 'default' variant
|
|
77701
|
+
constraints,
|
|
77702
|
+
(block, c2) => measureBlock(block, c2),
|
|
77703
|
+
void 0,
|
|
77704
|
+
// Use shared cache
|
|
77705
|
+
void 0,
|
|
77706
|
+
// No legacy totalPages
|
|
77707
|
+
pageResolver
|
|
77708
|
+
);
|
|
77709
|
+
if (batchResult.default) {
|
|
77710
|
+
__privateGet$1(this, _headerLayoutsByRId).set(rId, {
|
|
77711
|
+
kind: "header",
|
|
77712
|
+
type: "default",
|
|
77713
|
+
layout: batchResult.default.layout,
|
|
77714
|
+
blocks: batchResult.default.blocks,
|
|
77715
|
+
measures: batchResult.default.measures
|
|
77716
|
+
});
|
|
77717
|
+
}
|
|
77718
|
+
} catch (error) {
|
|
77719
|
+
console.warn(`[PresentationEditor] Failed to layout header rId=${rId}:`, error);
|
|
77720
|
+
}
|
|
77721
|
+
}
|
|
77722
|
+
}
|
|
77723
|
+
if (footerBlocksByRId) {
|
|
77724
|
+
for (const [rId, blocks] of footerBlocksByRId) {
|
|
77725
|
+
if (!blocks || blocks.length === 0) continue;
|
|
77726
|
+
try {
|
|
77727
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
77728
|
+
{ default: blocks },
|
|
77729
|
+
// Treat each rId as a 'default' variant
|
|
77730
|
+
constraints,
|
|
77731
|
+
(block, c2) => measureBlock(block, c2),
|
|
77732
|
+
void 0,
|
|
77733
|
+
// Use shared cache
|
|
77734
|
+
void 0,
|
|
77735
|
+
// No legacy totalPages
|
|
77736
|
+
pageResolver
|
|
77737
|
+
);
|
|
77738
|
+
if (batchResult.default) {
|
|
77739
|
+
__privateGet$1(this, _footerLayoutsByRId).set(rId, {
|
|
77740
|
+
kind: "footer",
|
|
77741
|
+
type: "default",
|
|
77742
|
+
layout: batchResult.default.layout,
|
|
77743
|
+
blocks: batchResult.default.blocks,
|
|
77744
|
+
measures: batchResult.default.measures
|
|
77745
|
+
});
|
|
77746
|
+
}
|
|
77747
|
+
} catch (error) {
|
|
77748
|
+
console.warn(`[PresentationEditor] Failed to layout footer rId=${rId}:`, error);
|
|
77749
|
+
}
|
|
77750
|
+
}
|
|
77751
|
+
}
|
|
77752
|
+
};
|
|
77342
77753
|
updateDecorationProviders_fn = function(layout) {
|
|
77343
77754
|
__privateSet(this, _headerDecorationProvider, __privateMethod$1(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "header", layout));
|
|
77344
77755
|
__privateSet(this, _footerDecorationProvider, __privateMethod$1(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "footer", layout));
|
|
@@ -77346,15 +77757,63 @@ updateDecorationProviders_fn = function(layout) {
|
|
|
77346
77757
|
};
|
|
77347
77758
|
createDecorationProvider_fn = function(kind, layout) {
|
|
77348
77759
|
const results = kind === "header" ? __privateGet$1(this, _headerLayoutResults) : __privateGet$1(this, _footerLayoutResults);
|
|
77349
|
-
|
|
77760
|
+
const layoutsByRId = kind === "header" ? __privateGet$1(this, _headerLayoutsByRId) : __privateGet$1(this, _footerLayoutsByRId);
|
|
77761
|
+
if ((!results || results.length === 0) && layoutsByRId.size === 0) {
|
|
77350
77762
|
return void 0;
|
|
77351
77763
|
}
|
|
77352
|
-
const
|
|
77764
|
+
const multiSectionId = __privateGet$1(this, _multiSectionIdentifier);
|
|
77765
|
+
const legacyIdentifier = __privateGet$1(this, _headerFooterIdentifier) ?? extractIdentifierFromConverter(__privateGet$1(this, _editor3).converter);
|
|
77766
|
+
const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
|
|
77767
|
+
for (const p of layout.pages) {
|
|
77768
|
+
const idx = p.sectionIndex ?? 0;
|
|
77769
|
+
if (!sectionFirstPageNumbers.has(idx)) {
|
|
77770
|
+
sectionFirstPageNumbers.set(idx, p.number);
|
|
77771
|
+
}
|
|
77772
|
+
}
|
|
77353
77773
|
return (pageNumber, pageMargins, page) => {
|
|
77354
|
-
const
|
|
77774
|
+
const sectionIndex = page?.sectionIndex ?? 0;
|
|
77775
|
+
const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
|
|
77776
|
+
const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
|
|
77777
|
+
const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
|
|
77778
|
+
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
77779
|
if (!headerFooterType) {
|
|
77356
77780
|
return null;
|
|
77357
77781
|
}
|
|
77782
|
+
if (sectionRId && layoutsByRId.has(sectionRId)) {
|
|
77783
|
+
const rIdLayout = layoutsByRId.get(sectionRId);
|
|
77784
|
+
const slotPage2 = __privateMethod$1(this, _PresentationEditor_instances, findHeaderFooterPageForPageNumber_fn).call(this, rIdLayout.layout.pages, pageNumber);
|
|
77785
|
+
if (slotPage2) {
|
|
77786
|
+
const fragments2 = slotPage2.fragments ?? [];
|
|
77787
|
+
const pageHeight2 = page?.size?.h ?? layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
77788
|
+
const margins2 = pageMargins ?? layout.pages[0]?.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
77789
|
+
const box2 = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins2, pageHeight2);
|
|
77790
|
+
return {
|
|
77791
|
+
fragments: fragments2,
|
|
77792
|
+
height: box2.height,
|
|
77793
|
+
contentHeight: rIdLayout.layout.height ?? box2.height,
|
|
77794
|
+
offset: box2.offset,
|
|
77795
|
+
marginLeft: box2.x,
|
|
77796
|
+
contentWidth: box2.width,
|
|
77797
|
+
headerId: sectionRId,
|
|
77798
|
+
sectionType: headerFooterType,
|
|
77799
|
+
box: {
|
|
77800
|
+
x: box2.x,
|
|
77801
|
+
y: box2.offset,
|
|
77802
|
+
width: box2.width,
|
|
77803
|
+
height: box2.height
|
|
77804
|
+
},
|
|
77805
|
+
hitRegion: {
|
|
77806
|
+
x: box2.x,
|
|
77807
|
+
y: box2.offset,
|
|
77808
|
+
width: box2.width,
|
|
77809
|
+
height: box2.height
|
|
77810
|
+
}
|
|
77811
|
+
};
|
|
77812
|
+
}
|
|
77813
|
+
}
|
|
77814
|
+
if (!results || results.length === 0) {
|
|
77815
|
+
return null;
|
|
77816
|
+
}
|
|
77358
77817
|
const variant = results.find((entry) => entry.type === headerFooterType);
|
|
77359
77818
|
if (!variant || !variant.layout?.pages?.length) {
|
|
77360
77819
|
return null;
|
|
@@ -77367,9 +77826,8 @@ createDecorationProvider_fn = function(kind, layout) {
|
|
|
77367
77826
|
const pageHeight = page?.size?.h ?? layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
77368
77827
|
const margins = pageMargins ?? layout.pages[0]?.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
77369
77828
|
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
77829
|
const fallbackId = __privateGet$1(this, _headerFooterManager)?.getVariantId(kind, headerFooterType);
|
|
77372
|
-
const finalHeaderId =
|
|
77830
|
+
const finalHeaderId = sectionRId ?? fallbackId ?? void 0;
|
|
77373
77831
|
return {
|
|
77374
77832
|
fragments,
|
|
77375
77833
|
height: box.height,
|
|
@@ -77599,7 +78057,8 @@ enterHeaderFooterMode_fn = async function(region) {
|
|
|
77599
78057
|
const doc2 = editor.state?.doc;
|
|
77600
78058
|
if (doc2) {
|
|
77601
78059
|
const endPos = doc2.content.size - 1;
|
|
77602
|
-
|
|
78060
|
+
const pos = Math.max(1, endPos);
|
|
78061
|
+
editor.commands?.setTextSelection?.({ from: pos, to: pos });
|
|
77603
78062
|
}
|
|
77604
78063
|
} catch (cursorError) {
|
|
77605
78064
|
console.warn("[PresentationEditor] Could not set cursor to end:", cursorError);
|
|
@@ -78437,11 +78896,27 @@ _PresentationEditor.CURSOR_STYLES = {
|
|
|
78437
78896
|
};
|
|
78438
78897
|
let PresentationEditor = _PresentationEditor;
|
|
78439
78898
|
class PresentationInputBridge {
|
|
78440
|
-
|
|
78899
|
+
/**
|
|
78900
|
+
* Creates a new PresentationInputBridge that forwards user input events from the visible layout
|
|
78901
|
+
* surface to the hidden editor DOM. This enables input handling when the actual editor is not
|
|
78902
|
+
* directly visible to the user.
|
|
78903
|
+
*
|
|
78904
|
+
* @param windowRoot - The window object containing the layout surface and editor target
|
|
78905
|
+
* @param layoutSurface - The visible HTML element that receives user input events (e.g., keyboard, mouse)
|
|
78906
|
+
* @param getTargetDom - Callback that returns the hidden editor's DOM element where events should be forwarded
|
|
78907
|
+
* @param isEditable - Callback that returns whether the editor is in an editable mode (editing/suggesting).
|
|
78908
|
+
* When this returns false (e.g., in viewing mode), keyboard, text, and composition
|
|
78909
|
+
* events will not be forwarded to prevent document modification.
|
|
78910
|
+
* @param onTargetChanged - Optional callback invoked when the target editor DOM element changes
|
|
78911
|
+
* @param options - Optional configuration including:
|
|
78912
|
+
* - useWindowFallback: Whether to attach window-level event listeners as fallback
|
|
78913
|
+
*/
|
|
78914
|
+
constructor(windowRoot, layoutSurface, getTargetDom, isEditable, onTargetChanged, options) {
|
|
78441
78915
|
__privateAdd$1(this, _PresentationInputBridge_instances);
|
|
78442
78916
|
__privateAdd$1(this, _windowRoot);
|
|
78443
78917
|
__privateAdd$1(this, _layoutSurfaces);
|
|
78444
78918
|
__privateAdd$1(this, _getTargetDom);
|
|
78919
|
+
__privateAdd$1(this, _isEditable);
|
|
78445
78920
|
__privateAdd$1(this, _onTargetChanged);
|
|
78446
78921
|
__privateAdd$1(this, _listeners);
|
|
78447
78922
|
__privateAdd$1(this, _currentTarget, null);
|
|
@@ -78450,6 +78925,7 @@ class PresentationInputBridge {
|
|
|
78450
78925
|
__privateSet(this, _windowRoot, windowRoot);
|
|
78451
78926
|
__privateSet(this, _layoutSurfaces, /* @__PURE__ */ new Set([layoutSurface]));
|
|
78452
78927
|
__privateSet(this, _getTargetDom, getTargetDom);
|
|
78928
|
+
__privateSet(this, _isEditable, isEditable);
|
|
78453
78929
|
__privateSet(this, _onTargetChanged, onTargetChanged);
|
|
78454
78930
|
__privateSet(this, _listeners, []);
|
|
78455
78931
|
__privateSet(this, _useWindowFallback, options?.useWindowFallback ?? false);
|
|
@@ -78516,6 +78992,7 @@ class PresentationInputBridge {
|
|
|
78516
78992
|
_windowRoot = /* @__PURE__ */ new WeakMap();
|
|
78517
78993
|
_layoutSurfaces = /* @__PURE__ */ new WeakMap();
|
|
78518
78994
|
_getTargetDom = /* @__PURE__ */ new WeakMap();
|
|
78995
|
+
_isEditable = /* @__PURE__ */ new WeakMap();
|
|
78519
78996
|
_onTargetChanged = /* @__PURE__ */ new WeakMap();
|
|
78520
78997
|
_listeners = /* @__PURE__ */ new WeakMap();
|
|
78521
78998
|
_currentTarget = /* @__PURE__ */ new WeakMap();
|
|
@@ -78546,6 +79023,9 @@ dispatchToTarget_fn = function(originalEvent, synthetic) {
|
|
|
78546
79023
|
}
|
|
78547
79024
|
};
|
|
78548
79025
|
forwardKeyboardEvent_fn = function(event) {
|
|
79026
|
+
if (!__privateGet$1(this, _isEditable).call(this)) {
|
|
79027
|
+
return;
|
|
79028
|
+
}
|
|
78549
79029
|
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
78550
79030
|
return;
|
|
78551
79031
|
}
|
|
@@ -78573,6 +79053,9 @@ forwardKeyboardEvent_fn = function(event) {
|
|
|
78573
79053
|
__privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
78574
79054
|
};
|
|
78575
79055
|
forwardTextEvent_fn = function(event) {
|
|
79056
|
+
if (!__privateGet$1(this, _isEditable).call(this)) {
|
|
79057
|
+
return;
|
|
79058
|
+
}
|
|
78576
79059
|
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
78577
79060
|
return;
|
|
78578
79061
|
}
|
|
@@ -78603,6 +79086,9 @@ forwardTextEvent_fn = function(event) {
|
|
|
78603
79086
|
});
|
|
78604
79087
|
};
|
|
78605
79088
|
forwardCompositionEvent_fn = function(event) {
|
|
79089
|
+
if (!__privateGet$1(this, _isEditable).call(this)) {
|
|
79090
|
+
return;
|
|
79091
|
+
}
|
|
78606
79092
|
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
78607
79093
|
return;
|
|
78608
79094
|
}
|
|
@@ -78622,6 +79108,9 @@ forwardCompositionEvent_fn = function(event) {
|
|
|
78622
79108
|
__privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
78623
79109
|
};
|
|
78624
79110
|
forwardContextMenu_fn = function(event) {
|
|
79111
|
+
if (!__privateGet$1(this, _isEditable).call(this)) {
|
|
79112
|
+
return;
|
|
79113
|
+
}
|
|
78625
79114
|
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
78626
79115
|
return;
|
|
78627
79116
|
}
|