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
|
@@ -34663,7 +34663,7 @@ const _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx) =
|
|
|
34663
34663
|
}
|
|
34664
34664
|
return { nodes: nodesToCombine, handled: false };
|
|
34665
34665
|
};
|
|
34666
|
-
const preProcessPageFieldsOnly = (nodes = []) => {
|
|
34666
|
+
const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
|
|
34667
34667
|
const processedNodes = [];
|
|
34668
34668
|
let i = 0;
|
|
34669
34669
|
while (i < nodes.length) {
|
|
@@ -34684,7 +34684,7 @@ const preProcessPageFieldsOnly = (nodes = []) => {
|
|
|
34684
34684
|
for (let j2 = i; j2 <= fieldInfo.endIndex; j2++) {
|
|
34685
34685
|
const passNode = nodes[j2];
|
|
34686
34686
|
if (Array.isArray(passNode.elements)) {
|
|
34687
|
-
const childResult = preProcessPageFieldsOnly(passNode.elements);
|
|
34687
|
+
const childResult = preProcessPageFieldsOnly(passNode.elements, depth + 1);
|
|
34688
34688
|
passNode.elements = childResult.processedNodes;
|
|
34689
34689
|
}
|
|
34690
34690
|
processedNodes.push(passNode);
|
|
@@ -34695,7 +34695,7 @@ const preProcessPageFieldsOnly = (nodes = []) => {
|
|
|
34695
34695
|
}
|
|
34696
34696
|
}
|
|
34697
34697
|
if (Array.isArray(node.elements)) {
|
|
34698
|
-
const childResult = preProcessPageFieldsOnly(node.elements);
|
|
34698
|
+
const childResult = preProcessPageFieldsOnly(node.elements, depth + 1);
|
|
34699
34699
|
node.elements = childResult.processedNodes;
|
|
34700
34700
|
}
|
|
34701
34701
|
processedNodes.push(node);
|
|
@@ -36371,7 +36371,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
36371
36371
|
static getStoredSuperdocVersion(docx) {
|
|
36372
36372
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
36373
36373
|
}
|
|
36374
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
36374
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.22") {
|
|
36375
36375
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
36376
36376
|
}
|
|
36377
36377
|
/**
|
|
@@ -39677,7 +39677,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
39677
39677
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
39678
39678
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
39679
39679
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
39680
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _headerLayoutResults, _footerLayoutResults, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
39680
|
+
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _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;
|
|
39681
39681
|
var GOOD_LEAF_SIZE = 200;
|
|
39682
39682
|
var RopeSequence = function RopeSequence2() {
|
|
39683
39683
|
};
|
|
@@ -49579,6 +49579,59 @@ function skipTab(dir) {
|
|
|
49579
49579
|
return true;
|
|
49580
49580
|
};
|
|
49581
49581
|
}
|
|
49582
|
+
const decreaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
49583
|
+
const handled = changeListLevel(-1, editor, tr);
|
|
49584
|
+
if (handled && dispatch) {
|
|
49585
|
+
dispatch(tr);
|
|
49586
|
+
}
|
|
49587
|
+
return handled;
|
|
49588
|
+
};
|
|
49589
|
+
const removeNumberingProperties = ({ checkType = "startParagraph" } = {}) => (props) => {
|
|
49590
|
+
const { tr, state: state2, editor, dispatch } = props;
|
|
49591
|
+
const { node: paragraph, pos } = findParentNode(isList)(state2.selection) || {};
|
|
49592
|
+
if (!paragraph) return false;
|
|
49593
|
+
if (checkType === "empty" && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
49594
|
+
if (checkType === "startParagraph") {
|
|
49595
|
+
const { $from, empty: empty2 } = state2.selection;
|
|
49596
|
+
if ((!empty2 || $from.parentOffset !== 0) && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
49597
|
+
}
|
|
49598
|
+
const ilvl = getResolvedParagraphProperties(paragraph).numberingProperties.ilvl;
|
|
49599
|
+
if (ilvl > 0) {
|
|
49600
|
+
const outdented = decreaseListIndent()(props);
|
|
49601
|
+
if (outdented) {
|
|
49602
|
+
tr.scrollIntoView();
|
|
49603
|
+
}
|
|
49604
|
+
return outdented;
|
|
49605
|
+
} else {
|
|
49606
|
+
updateNumberingProperties(null, paragraph, pos, editor, tr);
|
|
49607
|
+
}
|
|
49608
|
+
if (dispatch) dispatch(tr);
|
|
49609
|
+
return true;
|
|
49610
|
+
};
|
|
49611
|
+
function isVisuallyEmptyParagraph(node) {
|
|
49612
|
+
if (!node || node.type.name !== "paragraph") return false;
|
|
49613
|
+
let hasHardBreak = false;
|
|
49614
|
+
node.descendants((n) => {
|
|
49615
|
+
if (n.type && n.type.name === "hardBreak") {
|
|
49616
|
+
hasHardBreak = true;
|
|
49617
|
+
return false;
|
|
49618
|
+
}
|
|
49619
|
+
return true;
|
|
49620
|
+
});
|
|
49621
|
+
if (hasHardBreak) return false;
|
|
49622
|
+
const text = (node.textContent || "").replace(/\u200b/g, "").trim();
|
|
49623
|
+
if (text.length > 0) return false;
|
|
49624
|
+
let hasInlineLeaf = false;
|
|
49625
|
+
node.descendants((n) => {
|
|
49626
|
+
if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak" && n.type?.name !== "run") {
|
|
49627
|
+
hasInlineLeaf = true;
|
|
49628
|
+
return false;
|
|
49629
|
+
}
|
|
49630
|
+
return true;
|
|
49631
|
+
});
|
|
49632
|
+
if (hasInlineLeaf) return false;
|
|
49633
|
+
return true;
|
|
49634
|
+
}
|
|
49582
49635
|
const toggleList = (listType) => ({ editor, state: state2, tr, dispatch }) => {
|
|
49583
49636
|
let predicate;
|
|
49584
49637
|
if (listType === "orderedList") {
|
|
@@ -49598,19 +49651,22 @@ const toggleList = (listType) => ({ editor, state: state2, tr, dispatch }) => {
|
|
|
49598
49651
|
const { from: from2, to } = selection;
|
|
49599
49652
|
let firstListNode = null;
|
|
49600
49653
|
let hasNonListParagraphs = false;
|
|
49601
|
-
let
|
|
49654
|
+
let allParagraphsInSelection = [];
|
|
49602
49655
|
state2.doc.nodesBetween(from2, to, (node, pos) => {
|
|
49603
49656
|
if (node.type.name === "paragraph") {
|
|
49604
|
-
|
|
49605
|
-
if (!firstListNode && predicate(node)) {
|
|
49606
|
-
firstListNode = node;
|
|
49607
|
-
} else if (!predicate(node)) {
|
|
49608
|
-
hasNonListParagraphs = true;
|
|
49609
|
-
}
|
|
49657
|
+
allParagraphsInSelection.push({ node, pos });
|
|
49610
49658
|
return false;
|
|
49611
49659
|
}
|
|
49612
49660
|
return true;
|
|
49613
49661
|
});
|
|
49662
|
+
let paragraphsInSelection = allParagraphsInSelection.length === 1 ? allParagraphsInSelection : allParagraphsInSelection.filter(({ node }) => !isVisuallyEmptyParagraph(node));
|
|
49663
|
+
for (const { node } of paragraphsInSelection) {
|
|
49664
|
+
if (!firstListNode && predicate(node)) {
|
|
49665
|
+
firstListNode = node;
|
|
49666
|
+
} else if (!predicate(node)) {
|
|
49667
|
+
hasNonListParagraphs = true;
|
|
49668
|
+
}
|
|
49669
|
+
}
|
|
49614
49670
|
if (!firstListNode && from2 > 0) {
|
|
49615
49671
|
const $from = state2.doc.resolve(from2);
|
|
49616
49672
|
const parentIndex = $from.index(-1);
|
|
@@ -49654,11 +49710,30 @@ const toggleList = (listType) => ({ editor, state: state2, tr, dispatch }) => {
|
|
|
49654
49710
|
}
|
|
49655
49711
|
updateNumberingProperties(sharedNumberingProperties, node, pos, editor, tr);
|
|
49656
49712
|
}
|
|
49657
|
-
|
|
49658
|
-
|
|
49659
|
-
|
|
49660
|
-
|
|
49661
|
-
|
|
49713
|
+
if (paragraphsInSelection.length > 0) {
|
|
49714
|
+
const firstPara = paragraphsInSelection[0];
|
|
49715
|
+
const lastPara = paragraphsInSelection[paragraphsInSelection.length - 1];
|
|
49716
|
+
const mappedFirstPos = tr.mapping.map(firstPara.pos);
|
|
49717
|
+
const mappedLastPos = tr.mapping.map(lastPara.pos);
|
|
49718
|
+
const $firstPos = tr.doc.resolve(mappedFirstPos);
|
|
49719
|
+
const $lastPos = tr.doc.resolve(mappedLastPos);
|
|
49720
|
+
const firstNode = $firstPos.nodeAfter;
|
|
49721
|
+
const lastNode = $lastPos.nodeAfter;
|
|
49722
|
+
if (firstNode && lastNode) {
|
|
49723
|
+
let selFrom = mappedFirstPos + 1;
|
|
49724
|
+
let selTo = mappedLastPos + lastNode.nodeSize - 1;
|
|
49725
|
+
if (firstNode.firstChild && firstNode.firstChild.type.name === "run") {
|
|
49726
|
+
selFrom = mappedFirstPos + 2;
|
|
49727
|
+
}
|
|
49728
|
+
if (lastNode.lastChild && lastNode.lastChild.type.name === "run") {
|
|
49729
|
+
selTo = mappedLastPos + lastNode.nodeSize - 2;
|
|
49730
|
+
}
|
|
49731
|
+
if (selFrom >= 0 && selTo <= tr.doc.content.size && selFrom <= selTo) {
|
|
49732
|
+
try {
|
|
49733
|
+
tr.setSelection(TextSelection$1.create(tr.doc, selFrom, selTo));
|
|
49734
|
+
} catch {
|
|
49735
|
+
}
|
|
49736
|
+
}
|
|
49662
49737
|
}
|
|
49663
49738
|
}
|
|
49664
49739
|
if (dispatch) dispatch(tr);
|
|
@@ -49671,59 +49746,6 @@ const increaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
|
49671
49746
|
}
|
|
49672
49747
|
return handled;
|
|
49673
49748
|
};
|
|
49674
|
-
const decreaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
49675
|
-
const handled = changeListLevel(-1, editor, tr);
|
|
49676
|
-
if (handled && dispatch) {
|
|
49677
|
-
dispatch(tr);
|
|
49678
|
-
}
|
|
49679
|
-
return handled;
|
|
49680
|
-
};
|
|
49681
|
-
const removeNumberingProperties = ({ checkType = "startParagraph" } = {}) => (props) => {
|
|
49682
|
-
const { tr, state: state2, editor, dispatch } = props;
|
|
49683
|
-
const { node: paragraph, pos } = findParentNode(isList)(state2.selection) || {};
|
|
49684
|
-
if (!paragraph) return false;
|
|
49685
|
-
if (checkType === "empty" && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
49686
|
-
if (checkType === "startParagraph") {
|
|
49687
|
-
const { $from, empty: empty2 } = state2.selection;
|
|
49688
|
-
if ((!empty2 || $from.parentOffset !== 0) && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
49689
|
-
}
|
|
49690
|
-
const ilvl = getResolvedParagraphProperties(paragraph).numberingProperties.ilvl;
|
|
49691
|
-
if (ilvl > 0) {
|
|
49692
|
-
const outdented = decreaseListIndent()(props);
|
|
49693
|
-
if (outdented) {
|
|
49694
|
-
tr.scrollIntoView();
|
|
49695
|
-
}
|
|
49696
|
-
return outdented;
|
|
49697
|
-
} else {
|
|
49698
|
-
updateNumberingProperties(null, paragraph, pos, editor, tr);
|
|
49699
|
-
}
|
|
49700
|
-
if (dispatch) dispatch(tr);
|
|
49701
|
-
return true;
|
|
49702
|
-
};
|
|
49703
|
-
function isVisuallyEmptyParagraph(node) {
|
|
49704
|
-
if (!node || node.type.name !== "paragraph") return false;
|
|
49705
|
-
let hasHardBreak = false;
|
|
49706
|
-
node.descendants((n) => {
|
|
49707
|
-
if (n.type && n.type.name === "hardBreak") {
|
|
49708
|
-
hasHardBreak = true;
|
|
49709
|
-
return false;
|
|
49710
|
-
}
|
|
49711
|
-
return true;
|
|
49712
|
-
});
|
|
49713
|
-
if (hasHardBreak) return false;
|
|
49714
|
-
const text = (node.textContent || "").replace(/\u200b/g, "").trim();
|
|
49715
|
-
if (text.length > 0) return false;
|
|
49716
|
-
let hasInlineLeaf = false;
|
|
49717
|
-
node.descendants((n) => {
|
|
49718
|
-
if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak" && n.type?.name !== "run") {
|
|
49719
|
-
hasInlineLeaf = true;
|
|
49720
|
-
return false;
|
|
49721
|
-
}
|
|
49722
|
-
return true;
|
|
49723
|
-
});
|
|
49724
|
-
if (hasInlineLeaf) return false;
|
|
49725
|
-
return true;
|
|
49726
|
-
}
|
|
49727
49749
|
const restoreSelection = () => ({ editor, state: state2, tr }) => {
|
|
49728
49750
|
if (editor.options.lastSelection) {
|
|
49729
49751
|
const selectionTr = tr.setSelection(
|
|
@@ -49806,6 +49828,7 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
49806
49828
|
insertTabCharacter,
|
|
49807
49829
|
insertTabNode,
|
|
49808
49830
|
isStyleTokenEnabled,
|
|
49831
|
+
isVisuallyEmptyParagraph,
|
|
49809
49832
|
joinBackward,
|
|
49810
49833
|
joinDown,
|
|
49811
49834
|
joinForward,
|
|
@@ -49924,12 +49947,38 @@ const Keymap = Extension.create({
|
|
|
49924
49947
|
const Editable = Extension.create({
|
|
49925
49948
|
name: "editable",
|
|
49926
49949
|
addPmPlugins() {
|
|
49950
|
+
const editor = this.editor;
|
|
49927
49951
|
const editablePlugin = new Plugin({
|
|
49928
49952
|
key: new PluginKey("editable"),
|
|
49929
49953
|
props: {
|
|
49930
|
-
editable: () =>
|
|
49931
|
-
|
|
49932
|
-
|
|
49954
|
+
editable: () => editor.options.editable,
|
|
49955
|
+
handleDOMEvents: {
|
|
49956
|
+
beforeinput: (_view, event) => {
|
|
49957
|
+
if (!editor.options.editable) {
|
|
49958
|
+
event.preventDefault();
|
|
49959
|
+
return true;
|
|
49960
|
+
}
|
|
49961
|
+
return false;
|
|
49962
|
+
},
|
|
49963
|
+
mousedown: (_view, event) => {
|
|
49964
|
+
if (!editor.options.editable) {
|
|
49965
|
+
event.preventDefault();
|
|
49966
|
+
return true;
|
|
49967
|
+
}
|
|
49968
|
+
return false;
|
|
49969
|
+
},
|
|
49970
|
+
focus: (view, event) => {
|
|
49971
|
+
if (!editor.options.editable) {
|
|
49972
|
+
event.preventDefault();
|
|
49973
|
+
view.dom.blur();
|
|
49974
|
+
return true;
|
|
49975
|
+
}
|
|
49976
|
+
return false;
|
|
49977
|
+
}
|
|
49978
|
+
},
|
|
49979
|
+
handleClick: () => !editor.options.editable,
|
|
49980
|
+
handleDoubleClick: () => !editor.options.editable,
|
|
49981
|
+
handleTripleClick: () => !editor.options.editable
|
|
49933
49982
|
}
|
|
49934
49983
|
});
|
|
49935
49984
|
return [editablePlugin];
|
|
@@ -50867,7 +50916,6 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
50867
50916
|
comments.forEach((c2) => {
|
|
50868
50917
|
commentMap.set(c2.commentId, c2);
|
|
50869
50918
|
});
|
|
50870
|
-
new Set(comments.filter((c2) => c2.parentCommentId).map((c2) => c2.parentCommentId));
|
|
50871
50919
|
const startNodes = [];
|
|
50872
50920
|
const endNodes = [];
|
|
50873
50921
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -53488,7 +53536,7 @@ const isHeadless = (editor) => {
|
|
|
53488
53536
|
const shouldSkipNodeView = (editor) => {
|
|
53489
53537
|
return isHeadless(editor);
|
|
53490
53538
|
};
|
|
53491
|
-
const summaryVersion = "1.0.0-beta.
|
|
53539
|
+
const summaryVersion = "1.0.0-beta.22";
|
|
53492
53540
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
53493
53541
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
53494
53542
|
function mapAttributes(attrs) {
|
|
@@ -53893,10 +53941,23 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
53893
53941
|
this.view.updateState(this.state);
|
|
53894
53942
|
}
|
|
53895
53943
|
/**
|
|
53896
|
-
* Set whether the editor is editable
|
|
53944
|
+
* Set whether the editor is editable.
|
|
53945
|
+
*
|
|
53946
|
+
* When setting to non-editable, this method:
|
|
53947
|
+
* - Forces ProseMirror to re-evaluate the editable prop from the Editable plugin
|
|
53948
|
+
* - Blurs the editor to remove the cursor
|
|
53949
|
+
*
|
|
53950
|
+
* @param editable - Whether the editor should accept user input (default: true)
|
|
53951
|
+
* @param emitUpdate - Whether to emit an update event after changing editability (default: true)
|
|
53897
53952
|
*/
|
|
53898
53953
|
setEditable(editable = true, emitUpdate = true) {
|
|
53899
53954
|
this.setOptions({ editable });
|
|
53955
|
+
if (this.view) {
|
|
53956
|
+
this.view.setProps({});
|
|
53957
|
+
if (!editable && this.view.dom) {
|
|
53958
|
+
this.view.dom.blur();
|
|
53959
|
+
}
|
|
53960
|
+
}
|
|
53900
53961
|
if (emitUpdate) {
|
|
53901
53962
|
this.emit("update", { editor: this, transaction: this.state.tr });
|
|
53902
53963
|
}
|
|
@@ -54264,7 +54325,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54264
54325
|
{ default: remarkStringify },
|
|
54265
54326
|
{ default: remarkGfm }
|
|
54266
54327
|
] = await Promise.all([
|
|
54267
|
-
import("./index-
|
|
54328
|
+
import("./index-895wSAjT-C4ksiI6n.es.js"),
|
|
54268
54329
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
54269
54330
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
54270
54331
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -54469,7 +54530,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
54469
54530
|
* Process collaboration migrations
|
|
54470
54531
|
*/
|
|
54471
54532
|
processCollaborationMigrations() {
|
|
54472
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
54533
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.22");
|
|
54473
54534
|
if (!this.options.ydoc) return;
|
|
54474
54535
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
54475
54536
|
let docVersion = metaMap.get("version");
|
|
@@ -55156,8 +55217,9 @@ function extractPageNumbering(elements) {
|
|
|
55156
55217
|
const fmt = validFormats.includes(fmtRaw) ? fmtRaw : void 0;
|
|
55157
55218
|
const startRaw = pgNumType.attributes["w:start"];
|
|
55158
55219
|
const startNum = startRaw != null ? Number(startRaw) : void 0;
|
|
55220
|
+
const effectiveFormat = fmt ?? (Number.isFinite(startNum) ? "decimal" : void 0);
|
|
55159
55221
|
return {
|
|
55160
|
-
format:
|
|
55222
|
+
format: effectiveFormat,
|
|
55161
55223
|
...Number.isFinite(startNum) ? { start: Number(startNum) } : {}
|
|
55162
55224
|
};
|
|
55163
55225
|
}
|
|
@@ -62379,6 +62441,84 @@ const getHeaderFooterType = (pageNumber, identifier, options) => {
|
|
|
62379
62441
|
}
|
|
62380
62442
|
return null;
|
|
62381
62443
|
};
|
|
62444
|
+
const defaultMultiSectionIdentifier = () => ({
|
|
62445
|
+
headerIds: { default: null, first: null, even: null, odd: null },
|
|
62446
|
+
footerIds: { default: null, first: null, even: null, odd: null },
|
|
62447
|
+
titlePg: false,
|
|
62448
|
+
alternateHeaders: false,
|
|
62449
|
+
sectionCount: 0,
|
|
62450
|
+
sectionHeaderIds: /* @__PURE__ */ new Map(),
|
|
62451
|
+
sectionFooterIds: /* @__PURE__ */ new Map(),
|
|
62452
|
+
sectionTitlePg: /* @__PURE__ */ new Map()
|
|
62453
|
+
});
|
|
62454
|
+
function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
|
|
62455
|
+
const identifier = defaultMultiSectionIdentifier();
|
|
62456
|
+
identifier.alternateHeaders = Boolean(pageStyles2?.alternateHeaders ?? false);
|
|
62457
|
+
identifier.sectionCount = sectionMetadata.length;
|
|
62458
|
+
for (const section of sectionMetadata) {
|
|
62459
|
+
const idx = section.sectionIndex;
|
|
62460
|
+
if (section.headerRefs) {
|
|
62461
|
+
identifier.sectionHeaderIds.set(idx, {
|
|
62462
|
+
default: section.headerRefs.default ?? null,
|
|
62463
|
+
first: section.headerRefs.first ?? null,
|
|
62464
|
+
even: section.headerRefs.even ?? null,
|
|
62465
|
+
odd: section.headerRefs.odd ?? null
|
|
62466
|
+
});
|
|
62467
|
+
}
|
|
62468
|
+
if (section.footerRefs) {
|
|
62469
|
+
identifier.sectionFooterIds.set(idx, {
|
|
62470
|
+
default: section.footerRefs.default ?? null,
|
|
62471
|
+
first: section.footerRefs.first ?? null,
|
|
62472
|
+
even: section.footerRefs.even ?? null,
|
|
62473
|
+
odd: section.footerRefs.odd ?? null
|
|
62474
|
+
});
|
|
62475
|
+
}
|
|
62476
|
+
const hasFirstHeader = Boolean(section.headerRefs?.first);
|
|
62477
|
+
const hasFirstFooter = Boolean(section.footerRefs?.first);
|
|
62478
|
+
if (hasFirstHeader || hasFirstFooter) {
|
|
62479
|
+
identifier.sectionTitlePg.set(idx, true);
|
|
62480
|
+
}
|
|
62481
|
+
}
|
|
62482
|
+
const section0Headers = identifier.sectionHeaderIds.get(0);
|
|
62483
|
+
const section0Footers = identifier.sectionFooterIds.get(0);
|
|
62484
|
+
if (section0Headers) {
|
|
62485
|
+
identifier.headerIds = { ...section0Headers };
|
|
62486
|
+
}
|
|
62487
|
+
if (section0Footers) {
|
|
62488
|
+
identifier.footerIds = { ...section0Footers };
|
|
62489
|
+
}
|
|
62490
|
+
identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
|
|
62491
|
+
return identifier;
|
|
62492
|
+
}
|
|
62493
|
+
function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, options) {
|
|
62494
|
+
if (pageNumber <= 0) return null;
|
|
62495
|
+
const kind = options?.kind ?? "header";
|
|
62496
|
+
const sectionPageNumber = options?.sectionPageNumber ?? pageNumber;
|
|
62497
|
+
const sectionIds = kind === "header" ? identifier.sectionHeaderIds.get(sectionIndex) : identifier.sectionFooterIds.get(sectionIndex);
|
|
62498
|
+
const ids = sectionIds ?? (kind === "header" ? identifier.headerIds : identifier.footerIds);
|
|
62499
|
+
const hasFirst = Boolean(ids.first);
|
|
62500
|
+
const hasEven = Boolean(ids.even);
|
|
62501
|
+
const hasOdd = Boolean(ids.odd);
|
|
62502
|
+
const hasDefault = Boolean(ids.default);
|
|
62503
|
+
const sectionTitlePg = identifier.sectionTitlePg.get(sectionIndex) ?? identifier.titlePg;
|
|
62504
|
+
const titlePgEnabled = sectionTitlePg && hasFirst;
|
|
62505
|
+
const isFirstPageOfSection = sectionPageNumber === 1;
|
|
62506
|
+
if (isFirstPageOfSection && titlePgEnabled) {
|
|
62507
|
+
return "first";
|
|
62508
|
+
}
|
|
62509
|
+
if (identifier.alternateHeaders) {
|
|
62510
|
+
if (pageNumber % 2 === 0 && (hasEven || hasDefault)) {
|
|
62511
|
+
return hasEven ? "even" : "default";
|
|
62512
|
+
}
|
|
62513
|
+
if (pageNumber % 2 === 1 && (hasOdd || hasDefault)) {
|
|
62514
|
+
return hasOdd ? "odd" : "default";
|
|
62515
|
+
}
|
|
62516
|
+
}
|
|
62517
|
+
if (hasDefault) {
|
|
62518
|
+
return "default";
|
|
62519
|
+
}
|
|
62520
|
+
return null;
|
|
62521
|
+
}
|
|
62382
62522
|
function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
62383
62523
|
const zones = [];
|
|
62384
62524
|
const marginLeft = Math.max(0, margins?.left ?? 0);
|
|
@@ -63529,23 +63669,54 @@ function layoutTableBlock({
|
|
|
63529
63669
|
const headerCount = countHeaderRows(block);
|
|
63530
63670
|
const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
|
|
63531
63671
|
let state2 = ensurePage();
|
|
63672
|
+
const availableHeight = state2.contentBottom - state2.cursorY;
|
|
63673
|
+
let minRequiredHeight = 0;
|
|
63674
|
+
if (measure.rows.length > 0) {
|
|
63675
|
+
minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
|
|
63676
|
+
} else if (measure.totalHeight > 0) {
|
|
63677
|
+
minRequiredHeight = measure.totalHeight;
|
|
63678
|
+
}
|
|
63679
|
+
if (minRequiredHeight > availableHeight && state2.page.fragments.length > 0) {
|
|
63680
|
+
state2 = advanceColumn(state2);
|
|
63681
|
+
}
|
|
63532
63682
|
let currentRow = 0;
|
|
63533
63683
|
let isTableContinuation = false;
|
|
63534
63684
|
let pendingPartialRow = null;
|
|
63685
|
+
if (block.rows.length === 0 && measure.totalHeight > 0) {
|
|
63686
|
+
const height = Math.min(measure.totalHeight, state2.contentBottom - state2.cursorY);
|
|
63687
|
+
const metadata = {
|
|
63688
|
+
columnBoundaries: generateColumnBoundaries(measure),
|
|
63689
|
+
coordinateSystem: "fragment"
|
|
63690
|
+
};
|
|
63691
|
+
const fragment = {
|
|
63692
|
+
kind: "table",
|
|
63693
|
+
blockId: block.id,
|
|
63694
|
+
fromRow: 0,
|
|
63695
|
+
toRow: 0,
|
|
63696
|
+
x: columnX(state2.columnIndex),
|
|
63697
|
+
y: state2.cursorY,
|
|
63698
|
+
width: Math.min(columnWidth, measure.totalWidth || columnWidth),
|
|
63699
|
+
height,
|
|
63700
|
+
metadata
|
|
63701
|
+
};
|
|
63702
|
+
state2.page.fragments.push(fragment);
|
|
63703
|
+
state2.cursorY += height;
|
|
63704
|
+
return;
|
|
63705
|
+
}
|
|
63535
63706
|
while (currentRow < block.rows.length || pendingPartialRow !== null) {
|
|
63536
63707
|
state2 = ensurePage();
|
|
63537
|
-
const
|
|
63708
|
+
const availableHeight2 = state2.contentBottom - state2.cursorY;
|
|
63538
63709
|
let repeatHeaderCount = 0;
|
|
63539
63710
|
if (currentRow === 0 && !pendingPartialRow) {
|
|
63540
63711
|
repeatHeaderCount = 0;
|
|
63541
63712
|
} else {
|
|
63542
|
-
if (headerCount > 0 && headerHeight <=
|
|
63713
|
+
if (headerCount > 0 && headerHeight <= availableHeight2) {
|
|
63543
63714
|
repeatHeaderCount = headerCount;
|
|
63544
|
-
} else if (headerCount > 0 && headerHeight >
|
|
63715
|
+
} else if (headerCount > 0 && headerHeight > availableHeight2) {
|
|
63545
63716
|
repeatHeaderCount = 0;
|
|
63546
63717
|
}
|
|
63547
63718
|
}
|
|
63548
|
-
const availableForBody = repeatHeaderCount > 0 ?
|
|
63719
|
+
const availableForBody = repeatHeaderCount > 0 ? availableHeight2 - headerHeight : availableHeight2;
|
|
63549
63720
|
const fullPageHeight = state2.contentBottom;
|
|
63550
63721
|
if (pendingPartialRow !== null) {
|
|
63551
63722
|
const rowIndex = pendingPartialRow.rowIndex;
|
|
@@ -63924,7 +64095,7 @@ function computeDisplayPageNumber(pages, sections) {
|
|
|
63924
64095
|
let currentSectionIndex = -1;
|
|
63925
64096
|
for (let i = 0; i < pages.length; i++) {
|
|
63926
64097
|
const page = pages[i];
|
|
63927
|
-
const pageSectionIndex = 0;
|
|
64098
|
+
const pageSectionIndex = page.sectionIndex ?? 0;
|
|
63928
64099
|
if (pageSectionIndex !== currentSectionIndex) {
|
|
63929
64100
|
const sectionMetadata2 = sectionMap.get(pageSectionIndex);
|
|
63930
64101
|
if (sectionMetadata2?.numbering?.start !== void 0) {
|
|
@@ -64173,6 +64344,18 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64173
64344
|
};
|
|
64174
64345
|
layoutLog(`[Layout] First section: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
64175
64346
|
}
|
|
64347
|
+
const firstSectionIndexRaw = block.attrs?.sectionIndex;
|
|
64348
|
+
const firstMetadataIndex = typeof firstSectionIndexRaw === "number" ? firstSectionIndexRaw : Number(firstSectionIndexRaw ?? NaN);
|
|
64349
|
+
if (Number.isFinite(firstMetadataIndex)) {
|
|
64350
|
+
activeSectionIndex = firstMetadataIndex;
|
|
64351
|
+
}
|
|
64352
|
+
const firstSectionMetadata = Number.isFinite(firstMetadataIndex) ? sectionMetadataList[firstMetadataIndex] : void 0;
|
|
64353
|
+
if (firstSectionMetadata?.numbering) {
|
|
64354
|
+
if (firstSectionMetadata.numbering.format) activeNumberFormat = firstSectionMetadata.numbering.format;
|
|
64355
|
+
if (typeof firstSectionMetadata.numbering.start === "number") {
|
|
64356
|
+
activePageCounter = firstSectionMetadata.numbering.start;
|
|
64357
|
+
}
|
|
64358
|
+
}
|
|
64176
64359
|
return { decision: { forcePageBreak: false, forceMidPageRegion: false }, state: next };
|
|
64177
64360
|
}
|
|
64178
64361
|
const headerPx = block.margins?.header;
|
|
@@ -64189,7 +64372,15 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64189
64372
|
if (block.orientation) next.pendingOrientation = block.orientation;
|
|
64190
64373
|
const sectionType = block.type ?? "continuous";
|
|
64191
64374
|
const isColumnsChanging = !!block.columns && (block.columns.count !== next.activeColumns.count || block.columns.gap !== next.activeColumns.gap);
|
|
64192
|
-
|
|
64375
|
+
const sectionIndexRaw = block.attrs?.sectionIndex;
|
|
64376
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
64377
|
+
if (Number.isFinite(metadataIndex)) {
|
|
64378
|
+
pendingSectionIndex = metadataIndex;
|
|
64379
|
+
}
|
|
64380
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
64381
|
+
if (sectionMetadata?.numbering) {
|
|
64382
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
64383
|
+
} else if (block.numbering) {
|
|
64193
64384
|
pendingNumbering = { ...block.numbering };
|
|
64194
64385
|
}
|
|
64195
64386
|
if (block.headerRefs || block.footerRefs) {
|
|
@@ -64258,6 +64449,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64258
64449
|
...initialSectionMetadata.footerRefs && { footerRefs: initialSectionMetadata.footerRefs }
|
|
64259
64450
|
};
|
|
64260
64451
|
}
|
|
64452
|
+
let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
|
|
64453
|
+
let pendingSectionIndex = null;
|
|
64261
64454
|
const paginator = createPaginator({
|
|
64262
64455
|
margins: { left: margins.left, right: margins.right },
|
|
64263
64456
|
getActiveTopMargin: () => activeTopMargin,
|
|
@@ -64314,6 +64507,10 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64314
64507
|
activeSectionRefs = pendingSectionRefs;
|
|
64315
64508
|
pendingSectionRefs = null;
|
|
64316
64509
|
}
|
|
64510
|
+
if (pendingSectionIndex !== null) {
|
|
64511
|
+
activeSectionIndex = pendingSectionIndex;
|
|
64512
|
+
pendingSectionIndex = null;
|
|
64513
|
+
}
|
|
64317
64514
|
if (pendingVAlign !== null) {
|
|
64318
64515
|
activeVAlign = pendingVAlign;
|
|
64319
64516
|
pendingVAlign = null;
|
|
@@ -64323,6 +64520,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64323
64520
|
}
|
|
64324
64521
|
if (state2?.page) {
|
|
64325
64522
|
state2.page.numberText = formatPageNumber(activePageCounter, activeNumberFormat);
|
|
64523
|
+
state2.page.sectionIndex = activeSectionIndex;
|
|
64524
|
+
layoutLog(`[Layout] Page ${state2.page.number}: Stamped sectionIndex:`, activeSectionIndex);
|
|
64326
64525
|
if (activeSectionRefs) {
|
|
64327
64526
|
state2.page.sectionRefs = {
|
|
64328
64527
|
...activeSectionRefs.headerRefs && { headerRefs: activeSectionRefs.headerRefs },
|
|
@@ -64509,8 +64708,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64509
64708
|
activeOrientation = updatedState.activeOrientation;
|
|
64510
64709
|
pendingOrientation = updatedState.pendingOrientation;
|
|
64511
64710
|
if (effectiveBlock.vAlign) {
|
|
64512
|
-
const
|
|
64513
|
-
if (
|
|
64711
|
+
const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
64712
|
+
if (isFirstSection2) {
|
|
64514
64713
|
activeVAlign = effectiveBlock.vAlign;
|
|
64515
64714
|
pendingVAlign = null;
|
|
64516
64715
|
} else {
|
|
@@ -64524,6 +64723,36 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
64524
64723
|
};
|
|
64525
64724
|
layoutLog(`[Layout] After scheduleSectionBreakCompat: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
64526
64725
|
}
|
|
64726
|
+
const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
|
|
64727
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
64728
|
+
const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
64729
|
+
if (Number.isFinite(metadataIndex)) {
|
|
64730
|
+
if (isFirstSection) {
|
|
64731
|
+
activeSectionIndex = metadataIndex;
|
|
64732
|
+
} else {
|
|
64733
|
+
pendingSectionIndex = metadataIndex;
|
|
64734
|
+
}
|
|
64735
|
+
}
|
|
64736
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
64737
|
+
if (sectionMetadata?.numbering) {
|
|
64738
|
+
if (isFirstSection) {
|
|
64739
|
+
if (sectionMetadata.numbering.format) activeNumberFormat = sectionMetadata.numbering.format;
|
|
64740
|
+
if (typeof sectionMetadata.numbering.start === "number") {
|
|
64741
|
+
activePageCounter = sectionMetadata.numbering.start;
|
|
64742
|
+
}
|
|
64743
|
+
} else {
|
|
64744
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
64745
|
+
}
|
|
64746
|
+
} else if (effectiveBlock.numbering) {
|
|
64747
|
+
if (isFirstSection) {
|
|
64748
|
+
if (effectiveBlock.numbering.format) activeNumberFormat = effectiveBlock.numbering.format;
|
|
64749
|
+
if (typeof effectiveBlock.numbering.start === "number") {
|
|
64750
|
+
activePageCounter = effectiveBlock.numbering.start;
|
|
64751
|
+
}
|
|
64752
|
+
} else {
|
|
64753
|
+
pendingNumbering = { ...effectiveBlock.numbering };
|
|
64754
|
+
}
|
|
64755
|
+
}
|
|
64527
64756
|
if (breakInfo.forceMidPageRegion && block.columns) {
|
|
64528
64757
|
let state2 = paginator.ensurePage();
|
|
64529
64758
|
const columnIndexBefore = state2.columnIndex;
|
|
@@ -65503,8 +65732,11 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
|
65503
65732
|
const { totalPages: docTotalPages } = pageResolver(1);
|
|
65504
65733
|
const useBucketing = FeatureFlags.HF_DIGIT_BUCKETING && docTotalPages >= MIN_PAGES_FOR_BUCKETING;
|
|
65505
65734
|
for (const [type2, blocks] of Object.entries(sections)) {
|
|
65506
|
-
if (!blocks || blocks.length === 0)
|
|
65507
|
-
|
|
65735
|
+
if (!blocks || blocks.length === 0) {
|
|
65736
|
+
continue;
|
|
65737
|
+
}
|
|
65738
|
+
const hasTokens = hasPageTokens(blocks);
|
|
65739
|
+
if (!hasTokens) {
|
|
65508
65740
|
const measures = await cache2.measureBlocks(blocks, constraints, measureBlock2);
|
|
65509
65741
|
const layout = layoutHeaderFooter(blocks, measures, constraints);
|
|
65510
65742
|
result[type2] = { blocks, measures, layout };
|
|
@@ -65526,7 +65758,8 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
|
65526
65758
|
for (const pageNum of pagesToLayout) {
|
|
65527
65759
|
const clonedBlocks = cloneHeaderFooterBlocks(blocks);
|
|
65528
65760
|
const { displayText, totalPages: totalPagesForPage } = pageResolver(pageNum);
|
|
65529
|
-
|
|
65761
|
+
const resolvedPageNum = parseInt(displayText, 10) || pageNum;
|
|
65762
|
+
resolveHeaderFooterTokens(clonedBlocks, resolvedPageNum, totalPagesForPage);
|
|
65530
65763
|
const measures = await cache2.measureBlocks(clonedBlocks, constraints, measureBlock2);
|
|
65531
65764
|
const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints);
|
|
65532
65765
|
pages.push({
|
|
@@ -72368,9 +72601,36 @@ const fragmentSignature = (fragment, lookup2) => {
|
|
|
72368
72601
|
}
|
|
72369
72602
|
return base2;
|
|
72370
72603
|
};
|
|
72604
|
+
const hasListMarkerProperties = (attrs) => {
|
|
72605
|
+
if (!attrs || typeof attrs !== "object") return false;
|
|
72606
|
+
const obj = attrs;
|
|
72607
|
+
if (!obj.numberingProperties || typeof obj.numberingProperties !== "object") return false;
|
|
72608
|
+
const numProps = obj.numberingProperties;
|
|
72609
|
+
if ("numId" in numProps) {
|
|
72610
|
+
const numId = numProps.numId;
|
|
72611
|
+
if (typeof numId !== "number" && typeof numId !== "string") return false;
|
|
72612
|
+
}
|
|
72613
|
+
if ("ilvl" in numProps) {
|
|
72614
|
+
const ilvl = numProps.ilvl;
|
|
72615
|
+
if (typeof ilvl !== "number") return false;
|
|
72616
|
+
}
|
|
72617
|
+
if ("wordLayout" in obj && obj.wordLayout !== void 0) {
|
|
72618
|
+
if (typeof obj.wordLayout !== "object" || obj.wordLayout === null) return false;
|
|
72619
|
+
const wordLayout = obj.wordLayout;
|
|
72620
|
+
if ("marker" in wordLayout && wordLayout.marker !== void 0) {
|
|
72621
|
+
if (typeof wordLayout.marker !== "object" || wordLayout.marker === null) return false;
|
|
72622
|
+
const marker = wordLayout.marker;
|
|
72623
|
+
if ("markerText" in marker && marker.markerText !== void 0) {
|
|
72624
|
+
if (typeof marker.markerText !== "string") return false;
|
|
72625
|
+
}
|
|
72626
|
+
}
|
|
72627
|
+
}
|
|
72628
|
+
return true;
|
|
72629
|
+
};
|
|
72371
72630
|
const deriveBlockVersion = (block) => {
|
|
72372
72631
|
if (block.kind === "paragraph") {
|
|
72373
|
-
|
|
72632
|
+
const markerVersion = hasListMarkerProperties(block.attrs) ? `marker:${block.attrs.numberingProperties.numId ?? ""}:${block.attrs.numberingProperties.ilvl ?? 0}:${block.attrs.wordLayout?.marker?.markerText ?? ""}` : "";
|
|
72633
|
+
const runsVersion = block.runs.map((run2) => {
|
|
72374
72634
|
if (run2.kind === "image") {
|
|
72375
72635
|
const imgRun = run2;
|
|
72376
72636
|
return [
|
|
@@ -72413,6 +72673,7 @@ const deriveBlockVersion = (block) => {
|
|
|
72413
72673
|
textRun.token ?? ""
|
|
72414
72674
|
].join(",");
|
|
72415
72675
|
}).join("|");
|
|
72676
|
+
return markerVersion ? `${markerVersion}|${runsVersion}` : runsVersion;
|
|
72416
72677
|
}
|
|
72417
72678
|
if (block.kind === "list") {
|
|
72418
72679
|
return block.items.map((item) => `${item.id}:${item.marker.text}:${deriveBlockVersion(item.paragraph)}`).join("|");
|
|
@@ -74831,6 +75092,49 @@ class HeaderFooterLayoutAdapter {
|
|
|
74831
75092
|
});
|
|
74832
75093
|
return hasBlocks ? batch : void 0;
|
|
74833
75094
|
}
|
|
75095
|
+
/**
|
|
75096
|
+
* Retrieves FlowBlocks for ALL header/footer content, keyed by relationship ID.
|
|
75097
|
+
*
|
|
75098
|
+
* Unlike getBatch() which only returns content for variant-associated IDs,
|
|
75099
|
+
* this method returns content for ALL registered header/footer IDs. This is
|
|
75100
|
+
* essential for multi-section documents where different sections may use
|
|
75101
|
+
* different content for the same variant type.
|
|
75102
|
+
*
|
|
75103
|
+
* @param kind - The type of section to retrieve: 'header' or 'footer'
|
|
75104
|
+
* @returns A Map of rId to FlowBlock arrays, or undefined if no content exists
|
|
75105
|
+
*
|
|
75106
|
+
* @example
|
|
75107
|
+
* ```typescript
|
|
75108
|
+
* const footersByRId = adapter.getBlocksByRId('footer');
|
|
75109
|
+
* if (footersByRId) {
|
|
75110
|
+
* // footersByRId.get('rId14') - blocks for footer with rId14
|
|
75111
|
+
* // footersByRId.get('rId18') - blocks for footer with rId18 (different section)
|
|
75112
|
+
* }
|
|
75113
|
+
* ```
|
|
75114
|
+
*/
|
|
75115
|
+
getBlocksByRId(kind) {
|
|
75116
|
+
const descriptors = __privateGet$1(this, _manager).getDescriptors(kind);
|
|
75117
|
+
if (!descriptors.length) return void 0;
|
|
75118
|
+
const blocksMap = /* @__PURE__ */ new Map();
|
|
75119
|
+
descriptors.forEach((descriptor) => {
|
|
75120
|
+
const blocks = __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
75121
|
+
if (blocks && blocks.length > 0) {
|
|
75122
|
+
blocksMap.set(descriptor.id, blocks);
|
|
75123
|
+
}
|
|
75124
|
+
});
|
|
75125
|
+
return blocksMap.size > 0 ? blocksMap : void 0;
|
|
75126
|
+
}
|
|
75127
|
+
/**
|
|
75128
|
+
* Retrieves FlowBlocks for a specific header/footer by its relationship ID.
|
|
75129
|
+
*
|
|
75130
|
+
* @param rId - The relationship ID (e.g., 'rId14')
|
|
75131
|
+
* @returns FlowBlock array for the specified rId, or undefined if not found
|
|
75132
|
+
*/
|
|
75133
|
+
getBlocksForRId(rId) {
|
|
75134
|
+
const descriptor = __privateGet$1(this, _manager).getDescriptorById(rId);
|
|
75135
|
+
if (!descriptor) return void 0;
|
|
75136
|
+
return __privateMethod$1(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
75137
|
+
}
|
|
74834
75138
|
/**
|
|
74835
75139
|
* Invalidates the cached FlowBlocks for a specific header/footer section.
|
|
74836
75140
|
*
|
|
@@ -75291,8 +75595,11 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
75291
75595
|
__privateAdd$1(this, _headerFooterManager, null);
|
|
75292
75596
|
__privateAdd$1(this, _headerFooterAdapter, null);
|
|
75293
75597
|
__privateAdd$1(this, _headerFooterIdentifier, null);
|
|
75598
|
+
__privateAdd$1(this, _multiSectionIdentifier, null);
|
|
75294
75599
|
__privateAdd$1(this, _headerLayoutResults, null);
|
|
75295
75600
|
__privateAdd$1(this, _footerLayoutResults, null);
|
|
75601
|
+
__privateAdd$1(this, _headerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
75602
|
+
__privateAdd$1(this, _footerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
75296
75603
|
__privateAdd$1(this, _headerDecorationProvider);
|
|
75297
75604
|
__privateAdd$1(this, _footerDecorationProvider);
|
|
75298
75605
|
__privateAdd$1(this, _headerFooterManagerCleanups, []);
|
|
@@ -76449,8 +76756,11 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
76449
76756
|
__privateSet(this, _headerFooterManager, null);
|
|
76450
76757
|
}, "Header/footer manager");
|
|
76451
76758
|
__privateSet(this, _headerFooterIdentifier, null);
|
|
76759
|
+
__privateSet(this, _multiSectionIdentifier, null);
|
|
76452
76760
|
__privateSet(this, _headerLayoutResults, null);
|
|
76453
76761
|
__privateSet(this, _footerLayoutResults, null);
|
|
76762
|
+
__privateGet$1(this, _headerLayoutsByRId).clear();
|
|
76763
|
+
__privateGet$1(this, _footerLayoutsByRId).clear();
|
|
76454
76764
|
__privateSet(this, _headerDecorationProvider, void 0);
|
|
76455
76765
|
__privateSet(this, _footerDecorationProvider, void 0);
|
|
76456
76766
|
__privateSet(this, _session, { mode: "body" });
|
|
@@ -76504,8 +76814,11 @@ _trackedChangesOverrides = /* @__PURE__ */ new WeakMap();
|
|
|
76504
76814
|
_headerFooterManager = /* @__PURE__ */ new WeakMap();
|
|
76505
76815
|
_headerFooterAdapter = /* @__PURE__ */ new WeakMap();
|
|
76506
76816
|
_headerFooterIdentifier = /* @__PURE__ */ new WeakMap();
|
|
76817
|
+
_multiSectionIdentifier = /* @__PURE__ */ new WeakMap();
|
|
76507
76818
|
_headerLayoutResults = /* @__PURE__ */ new WeakMap();
|
|
76508
76819
|
_footerLayoutResults = /* @__PURE__ */ new WeakMap();
|
|
76820
|
+
_headerLayoutsByRId = /* @__PURE__ */ new WeakMap();
|
|
76821
|
+
_footerLayoutsByRId = /* @__PURE__ */ new WeakMap();
|
|
76509
76822
|
_headerDecorationProvider = /* @__PURE__ */ new WeakMap();
|
|
76510
76823
|
_footerDecorationProvider = /* @__PURE__ */ new WeakMap();
|
|
76511
76824
|
_headerFooterManagerCleanups = /* @__PURE__ */ new WeakMap();
|
|
@@ -76864,7 +77177,12 @@ setupPointerHandlers_fn = function() {
|
|
|
76864
77177
|
setupInputBridge_fn = function() {
|
|
76865
77178
|
__privateGet$1(this, _inputBridge)?.destroy();
|
|
76866
77179
|
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
76867
|
-
__privateSet(this, _inputBridge, new PresentationInputBridge(
|
|
77180
|
+
__privateSet(this, _inputBridge, new PresentationInputBridge(
|
|
77181
|
+
win,
|
|
77182
|
+
__privateGet$1(this, _visibleHost),
|
|
77183
|
+
() => __privateMethod$1(this, _PresentationEditor_instances, getActiveDomTarget_fn).call(this),
|
|
77184
|
+
() => __privateGet$1(this, _documentMode) !== "viewing"
|
|
77185
|
+
));
|
|
76868
77186
|
__privateGet$1(this, _inputBridge).bind();
|
|
76869
77187
|
};
|
|
76870
77188
|
initHeaderFooterRegistry_fn = function() {
|
|
@@ -77099,11 +77417,11 @@ rerender_fn = async function() {
|
|
|
77099
77417
|
const sectionMetadata = [];
|
|
77100
77418
|
let blocks;
|
|
77101
77419
|
try {
|
|
77102
|
-
const
|
|
77103
|
-
const converterContext =
|
|
77104
|
-
docx:
|
|
77105
|
-
numbering:
|
|
77106
|
-
linkedStyles:
|
|
77420
|
+
const converter2 = __privateGet$1(this, _editor3).converter;
|
|
77421
|
+
const converterContext = converter2 ? {
|
|
77422
|
+
docx: converter2.convertedXml,
|
|
77423
|
+
numbering: converter2.numbering,
|
|
77424
|
+
linkedStyles: converter2.linkedStyles
|
|
77107
77425
|
} : void 0;
|
|
77108
77426
|
const result = toFlowBlocks(docJson, {
|
|
77109
77427
|
mediaFiles: __privateGet$1(this, _options).mediaFiles,
|
|
@@ -77161,9 +77479,12 @@ rerender_fn = async function() {
|
|
|
77161
77479
|
return;
|
|
77162
77480
|
}
|
|
77163
77481
|
__privateSet(this, _sectionMetadata, sectionMetadata);
|
|
77482
|
+
const converter = __privateGet$1(this, _editor3).converter;
|
|
77483
|
+
__privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
|
|
77164
77484
|
__privateSet(this, _layoutState, { blocks, measures, layout });
|
|
77165
77485
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
77166
77486
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
77487
|
+
await __privateMethod$1(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
77167
77488
|
__privateMethod$1(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
|
|
77168
77489
|
const painter = __privateMethod$1(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks, measures);
|
|
77169
77490
|
if (typeof painter.setProviders === "function") {
|
|
@@ -77177,6 +77498,10 @@ rerender_fn = async function() {
|
|
|
77177
77498
|
headerMeasures.push(...headerResult.measures);
|
|
77178
77499
|
}
|
|
77179
77500
|
}
|
|
77501
|
+
for (const rIdResult of __privateGet$1(this, _headerLayoutsByRId).values()) {
|
|
77502
|
+
headerBlocks.push(...rIdResult.blocks);
|
|
77503
|
+
headerMeasures.push(...rIdResult.measures);
|
|
77504
|
+
}
|
|
77180
77505
|
const footerBlocks = [];
|
|
77181
77506
|
const footerMeasures = [];
|
|
77182
77507
|
if (footerLayouts) {
|
|
@@ -77185,6 +77510,10 @@ rerender_fn = async function() {
|
|
|
77185
77510
|
footerMeasures.push(...footerResult.measures);
|
|
77186
77511
|
}
|
|
77187
77512
|
}
|
|
77513
|
+
for (const rIdResult of __privateGet$1(this, _footerLayoutsByRId).values()) {
|
|
77514
|
+
footerBlocks.push(...rIdResult.blocks);
|
|
77515
|
+
footerMeasures.push(...rIdResult.measures);
|
|
77516
|
+
}
|
|
77188
77517
|
painter.setData?.(
|
|
77189
77518
|
blocks,
|
|
77190
77519
|
measures,
|
|
@@ -77241,6 +77570,10 @@ updateSelection_fn = function() {
|
|
|
77241
77570
|
if (!__privateGet$1(this, _localSelectionLayer)) {
|
|
77242
77571
|
return;
|
|
77243
77572
|
}
|
|
77573
|
+
if (__privateGet$1(this, _documentMode) === "viewing") {
|
|
77574
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
77575
|
+
return;
|
|
77576
|
+
}
|
|
77244
77577
|
const layout = __privateGet$1(this, _layoutState).layout;
|
|
77245
77578
|
const selection = this.getActiveEditor().state?.selection;
|
|
77246
77579
|
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
@@ -77290,7 +77623,9 @@ buildHeaderFooterInput_fn = function() {
|
|
|
77290
77623
|
}
|
|
77291
77624
|
const headerBlocks = __privateGet$1(this, _headerFooterAdapter).getBatch("header");
|
|
77292
77625
|
const footerBlocks = __privateGet$1(this, _headerFooterAdapter).getBatch("footer");
|
|
77293
|
-
|
|
77626
|
+
const headerBlocksByRId = __privateGet$1(this, _headerFooterAdapter).getBlocksByRId("header");
|
|
77627
|
+
const footerBlocksByRId = __privateGet$1(this, _headerFooterAdapter).getBlocksByRId("footer");
|
|
77628
|
+
if (!headerBlocks && !footerBlocks && !headerBlocksByRId && !footerBlocksByRId) {
|
|
77294
77629
|
return null;
|
|
77295
77630
|
}
|
|
77296
77631
|
const constraints = __privateMethod$1(this, _PresentationEditor_instances, computeHeaderFooterConstraints_fn).call(this);
|
|
@@ -77300,6 +77635,8 @@ buildHeaderFooterInput_fn = function() {
|
|
|
77300
77635
|
return {
|
|
77301
77636
|
headerBlocks,
|
|
77302
77637
|
footerBlocks,
|
|
77638
|
+
headerBlocksByRId,
|
|
77639
|
+
footerBlocksByRId,
|
|
77303
77640
|
constraints
|
|
77304
77641
|
};
|
|
77305
77642
|
};
|
|
@@ -77322,6 +77659,80 @@ computeHeaderFooterConstraints_fn = function() {
|
|
|
77322
77659
|
margins: { left: marginLeft, right: marginRight }
|
|
77323
77660
|
};
|
|
77324
77661
|
};
|
|
77662
|
+
layoutPerRIdHeaderFooters_fn = async function(headerFooterInput, layout, sectionMetadata) {
|
|
77663
|
+
__privateGet$1(this, _headerLayoutsByRId).clear();
|
|
77664
|
+
__privateGet$1(this, _footerLayoutsByRId).clear();
|
|
77665
|
+
if (!headerFooterInput) return;
|
|
77666
|
+
const { headerBlocksByRId, footerBlocksByRId, constraints } = headerFooterInput;
|
|
77667
|
+
const displayPages = computeDisplayPageNumber(layout.pages, sectionMetadata);
|
|
77668
|
+
const totalPages = layout.pages.length;
|
|
77669
|
+
const pageResolver = (pageNumber) => {
|
|
77670
|
+
const pageIndex = pageNumber - 1;
|
|
77671
|
+
const displayInfo = displayPages[pageIndex];
|
|
77672
|
+
return {
|
|
77673
|
+
displayText: displayInfo?.displayText ?? String(pageNumber),
|
|
77674
|
+
totalPages
|
|
77675
|
+
};
|
|
77676
|
+
};
|
|
77677
|
+
if (headerBlocksByRId) {
|
|
77678
|
+
for (const [rId, blocks] of headerBlocksByRId) {
|
|
77679
|
+
if (!blocks || blocks.length === 0) continue;
|
|
77680
|
+
try {
|
|
77681
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
77682
|
+
{ default: blocks },
|
|
77683
|
+
// Treat each rId as a 'default' variant
|
|
77684
|
+
constraints,
|
|
77685
|
+
(block, c2) => measureBlock(block, c2),
|
|
77686
|
+
void 0,
|
|
77687
|
+
// Use shared cache
|
|
77688
|
+
void 0,
|
|
77689
|
+
// No legacy totalPages
|
|
77690
|
+
pageResolver
|
|
77691
|
+
);
|
|
77692
|
+
if (batchResult.default) {
|
|
77693
|
+
__privateGet$1(this, _headerLayoutsByRId).set(rId, {
|
|
77694
|
+
kind: "header",
|
|
77695
|
+
type: "default",
|
|
77696
|
+
layout: batchResult.default.layout,
|
|
77697
|
+
blocks: batchResult.default.blocks,
|
|
77698
|
+
measures: batchResult.default.measures
|
|
77699
|
+
});
|
|
77700
|
+
}
|
|
77701
|
+
} catch (error) {
|
|
77702
|
+
console.warn(`[PresentationEditor] Failed to layout header rId=${rId}:`, error);
|
|
77703
|
+
}
|
|
77704
|
+
}
|
|
77705
|
+
}
|
|
77706
|
+
if (footerBlocksByRId) {
|
|
77707
|
+
for (const [rId, blocks] of footerBlocksByRId) {
|
|
77708
|
+
if (!blocks || blocks.length === 0) continue;
|
|
77709
|
+
try {
|
|
77710
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
77711
|
+
{ default: blocks },
|
|
77712
|
+
// Treat each rId as a 'default' variant
|
|
77713
|
+
constraints,
|
|
77714
|
+
(block, c2) => measureBlock(block, c2),
|
|
77715
|
+
void 0,
|
|
77716
|
+
// Use shared cache
|
|
77717
|
+
void 0,
|
|
77718
|
+
// No legacy totalPages
|
|
77719
|
+
pageResolver
|
|
77720
|
+
);
|
|
77721
|
+
if (batchResult.default) {
|
|
77722
|
+
__privateGet$1(this, _footerLayoutsByRId).set(rId, {
|
|
77723
|
+
kind: "footer",
|
|
77724
|
+
type: "default",
|
|
77725
|
+
layout: batchResult.default.layout,
|
|
77726
|
+
blocks: batchResult.default.blocks,
|
|
77727
|
+
measures: batchResult.default.measures
|
|
77728
|
+
});
|
|
77729
|
+
}
|
|
77730
|
+
} catch (error) {
|
|
77731
|
+
console.warn(`[PresentationEditor] Failed to layout footer rId=${rId}:`, error);
|
|
77732
|
+
}
|
|
77733
|
+
}
|
|
77734
|
+
}
|
|
77735
|
+
};
|
|
77325
77736
|
updateDecorationProviders_fn = function(layout) {
|
|
77326
77737
|
__privateSet(this, _headerDecorationProvider, __privateMethod$1(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "header", layout));
|
|
77327
77738
|
__privateSet(this, _footerDecorationProvider, __privateMethod$1(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "footer", layout));
|
|
@@ -77329,15 +77740,63 @@ updateDecorationProviders_fn = function(layout) {
|
|
|
77329
77740
|
};
|
|
77330
77741
|
createDecorationProvider_fn = function(kind, layout) {
|
|
77331
77742
|
const results = kind === "header" ? __privateGet$1(this, _headerLayoutResults) : __privateGet$1(this, _footerLayoutResults);
|
|
77332
|
-
|
|
77743
|
+
const layoutsByRId = kind === "header" ? __privateGet$1(this, _headerLayoutsByRId) : __privateGet$1(this, _footerLayoutsByRId);
|
|
77744
|
+
if ((!results || results.length === 0) && layoutsByRId.size === 0) {
|
|
77333
77745
|
return void 0;
|
|
77334
77746
|
}
|
|
77335
|
-
const
|
|
77747
|
+
const multiSectionId = __privateGet$1(this, _multiSectionIdentifier);
|
|
77748
|
+
const legacyIdentifier = __privateGet$1(this, _headerFooterIdentifier) ?? extractIdentifierFromConverter(__privateGet$1(this, _editor3).converter);
|
|
77749
|
+
const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
|
|
77750
|
+
for (const p of layout.pages) {
|
|
77751
|
+
const idx = p.sectionIndex ?? 0;
|
|
77752
|
+
if (!sectionFirstPageNumbers.has(idx)) {
|
|
77753
|
+
sectionFirstPageNumbers.set(idx, p.number);
|
|
77754
|
+
}
|
|
77755
|
+
}
|
|
77336
77756
|
return (pageNumber, pageMargins, page) => {
|
|
77337
|
-
const
|
|
77757
|
+
const sectionIndex = page?.sectionIndex ?? 0;
|
|
77758
|
+
const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
|
|
77759
|
+
const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
|
|
77760
|
+
const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
|
|
77761
|
+
const sectionRId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
|
|
77338
77762
|
if (!headerFooterType) {
|
|
77339
77763
|
return null;
|
|
77340
77764
|
}
|
|
77765
|
+
if (sectionRId && layoutsByRId.has(sectionRId)) {
|
|
77766
|
+
const rIdLayout = layoutsByRId.get(sectionRId);
|
|
77767
|
+
const slotPage2 = __privateMethod$1(this, _PresentationEditor_instances, findHeaderFooterPageForPageNumber_fn).call(this, rIdLayout.layout.pages, pageNumber);
|
|
77768
|
+
if (slotPage2) {
|
|
77769
|
+
const fragments2 = slotPage2.fragments ?? [];
|
|
77770
|
+
const pageHeight2 = page?.size?.h ?? layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
77771
|
+
const margins2 = pageMargins ?? layout.pages[0]?.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
77772
|
+
const box2 = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins2, pageHeight2);
|
|
77773
|
+
return {
|
|
77774
|
+
fragments: fragments2,
|
|
77775
|
+
height: box2.height,
|
|
77776
|
+
contentHeight: rIdLayout.layout.height ?? box2.height,
|
|
77777
|
+
offset: box2.offset,
|
|
77778
|
+
marginLeft: box2.x,
|
|
77779
|
+
contentWidth: box2.width,
|
|
77780
|
+
headerId: sectionRId,
|
|
77781
|
+
sectionType: headerFooterType,
|
|
77782
|
+
box: {
|
|
77783
|
+
x: box2.x,
|
|
77784
|
+
y: box2.offset,
|
|
77785
|
+
width: box2.width,
|
|
77786
|
+
height: box2.height
|
|
77787
|
+
},
|
|
77788
|
+
hitRegion: {
|
|
77789
|
+
x: box2.x,
|
|
77790
|
+
y: box2.offset,
|
|
77791
|
+
width: box2.width,
|
|
77792
|
+
height: box2.height
|
|
77793
|
+
}
|
|
77794
|
+
};
|
|
77795
|
+
}
|
|
77796
|
+
}
|
|
77797
|
+
if (!results || results.length === 0) {
|
|
77798
|
+
return null;
|
|
77799
|
+
}
|
|
77341
77800
|
const variant = results.find((entry) => entry.type === headerFooterType);
|
|
77342
77801
|
if (!variant || !variant.layout?.pages?.length) {
|
|
77343
77802
|
return null;
|
|
@@ -77350,9 +77809,8 @@ createDecorationProvider_fn = function(kind, layout) {
|
|
|
77350
77809
|
const pageHeight = page?.size?.h ?? layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
77351
77810
|
const margins = pageMargins ?? layout.pages[0]?.margins ?? __privateGet$1(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
77352
77811
|
const box = __privateMethod$1(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins, pageHeight);
|
|
77353
|
-
const headerId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
|
|
77354
77812
|
const fallbackId = __privateGet$1(this, _headerFooterManager)?.getVariantId(kind, headerFooterType);
|
|
77355
|
-
const finalHeaderId =
|
|
77813
|
+
const finalHeaderId = sectionRId ?? fallbackId ?? void 0;
|
|
77356
77814
|
return {
|
|
77357
77815
|
fragments,
|
|
77358
77816
|
height: box.height,
|
|
@@ -77582,7 +78040,8 @@ enterHeaderFooterMode_fn = async function(region) {
|
|
|
77582
78040
|
const doc2 = editor.state?.doc;
|
|
77583
78041
|
if (doc2) {
|
|
77584
78042
|
const endPos = doc2.content.size - 1;
|
|
77585
|
-
|
|
78043
|
+
const pos = Math.max(1, endPos);
|
|
78044
|
+
editor.commands?.setTextSelection?.({ from: pos, to: pos });
|
|
77586
78045
|
}
|
|
77587
78046
|
} catch (cursorError) {
|
|
77588
78047
|
console.warn("[PresentationEditor] Could not set cursor to end:", cursorError);
|
|
@@ -78420,11 +78879,27 @@ _PresentationEditor.CURSOR_STYLES = {
|
|
|
78420
78879
|
};
|
|
78421
78880
|
let PresentationEditor = _PresentationEditor;
|
|
78422
78881
|
class PresentationInputBridge {
|
|
78423
|
-
|
|
78882
|
+
/**
|
|
78883
|
+
* Creates a new PresentationInputBridge that forwards user input events from the visible layout
|
|
78884
|
+
* surface to the hidden editor DOM. This enables input handling when the actual editor is not
|
|
78885
|
+
* directly visible to the user.
|
|
78886
|
+
*
|
|
78887
|
+
* @param windowRoot - The window object containing the layout surface and editor target
|
|
78888
|
+
* @param layoutSurface - The visible HTML element that receives user input events (e.g., keyboard, mouse)
|
|
78889
|
+
* @param getTargetDom - Callback that returns the hidden editor's DOM element where events should be forwarded
|
|
78890
|
+
* @param isEditable - Callback that returns whether the editor is in an editable mode (editing/suggesting).
|
|
78891
|
+
* When this returns false (e.g., in viewing mode), keyboard, text, and composition
|
|
78892
|
+
* events will not be forwarded to prevent document modification.
|
|
78893
|
+
* @param onTargetChanged - Optional callback invoked when the target editor DOM element changes
|
|
78894
|
+
* @param options - Optional configuration including:
|
|
78895
|
+
* - useWindowFallback: Whether to attach window-level event listeners as fallback
|
|
78896
|
+
*/
|
|
78897
|
+
constructor(windowRoot, layoutSurface, getTargetDom, isEditable, onTargetChanged, options) {
|
|
78424
78898
|
__privateAdd$1(this, _PresentationInputBridge_instances);
|
|
78425
78899
|
__privateAdd$1(this, _windowRoot);
|
|
78426
78900
|
__privateAdd$1(this, _layoutSurfaces);
|
|
78427
78901
|
__privateAdd$1(this, _getTargetDom);
|
|
78902
|
+
__privateAdd$1(this, _isEditable);
|
|
78428
78903
|
__privateAdd$1(this, _onTargetChanged);
|
|
78429
78904
|
__privateAdd$1(this, _listeners);
|
|
78430
78905
|
__privateAdd$1(this, _currentTarget, null);
|
|
@@ -78433,6 +78908,7 @@ class PresentationInputBridge {
|
|
|
78433
78908
|
__privateSet(this, _windowRoot, windowRoot);
|
|
78434
78909
|
__privateSet(this, _layoutSurfaces, /* @__PURE__ */ new Set([layoutSurface]));
|
|
78435
78910
|
__privateSet(this, _getTargetDom, getTargetDom);
|
|
78911
|
+
__privateSet(this, _isEditable, isEditable);
|
|
78436
78912
|
__privateSet(this, _onTargetChanged, onTargetChanged);
|
|
78437
78913
|
__privateSet(this, _listeners, []);
|
|
78438
78914
|
__privateSet(this, _useWindowFallback, options?.useWindowFallback ?? false);
|
|
@@ -78499,6 +78975,7 @@ class PresentationInputBridge {
|
|
|
78499
78975
|
_windowRoot = /* @__PURE__ */ new WeakMap();
|
|
78500
78976
|
_layoutSurfaces = /* @__PURE__ */ new WeakMap();
|
|
78501
78977
|
_getTargetDom = /* @__PURE__ */ new WeakMap();
|
|
78978
|
+
_isEditable = /* @__PURE__ */ new WeakMap();
|
|
78502
78979
|
_onTargetChanged = /* @__PURE__ */ new WeakMap();
|
|
78503
78980
|
_listeners = /* @__PURE__ */ new WeakMap();
|
|
78504
78981
|
_currentTarget = /* @__PURE__ */ new WeakMap();
|
|
@@ -78529,6 +79006,9 @@ dispatchToTarget_fn = function(originalEvent, synthetic) {
|
|
|
78529
79006
|
}
|
|
78530
79007
|
};
|
|
78531
79008
|
forwardKeyboardEvent_fn = function(event) {
|
|
79009
|
+
if (!__privateGet$1(this, _isEditable).call(this)) {
|
|
79010
|
+
return;
|
|
79011
|
+
}
|
|
78532
79012
|
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
78533
79013
|
return;
|
|
78534
79014
|
}
|
|
@@ -78556,6 +79036,9 @@ forwardKeyboardEvent_fn = function(event) {
|
|
|
78556
79036
|
__privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
78557
79037
|
};
|
|
78558
79038
|
forwardTextEvent_fn = function(event) {
|
|
79039
|
+
if (!__privateGet$1(this, _isEditable).call(this)) {
|
|
79040
|
+
return;
|
|
79041
|
+
}
|
|
78559
79042
|
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
78560
79043
|
return;
|
|
78561
79044
|
}
|
|
@@ -78586,6 +79069,9 @@ forwardTextEvent_fn = function(event) {
|
|
|
78586
79069
|
});
|
|
78587
79070
|
};
|
|
78588
79071
|
forwardCompositionEvent_fn = function(event) {
|
|
79072
|
+
if (!__privateGet$1(this, _isEditable).call(this)) {
|
|
79073
|
+
return;
|
|
79074
|
+
}
|
|
78589
79075
|
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
78590
79076
|
return;
|
|
78591
79077
|
}
|
|
@@ -78605,6 +79091,9 @@ forwardCompositionEvent_fn = function(event) {
|
|
|
78605
79091
|
__privateMethod$1(this, _PresentationInputBridge_instances, dispatchToTarget_fn).call(this, event, synthetic);
|
|
78606
79092
|
};
|
|
78607
79093
|
forwardContextMenu_fn = function(event) {
|
|
79094
|
+
if (!__privateGet$1(this, _isEditable).call(this)) {
|
|
79095
|
+
return;
|
|
79096
|
+
}
|
|
78608
79097
|
if (__privateMethod$1(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
78609
79098
|
return;
|
|
78610
79099
|
}
|