@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
|
@@ -9,11 +9,11 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
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;
|
|
12
|
+
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;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as
|
|
16
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName, $ as TrackInsertMarkName, a0 as v4, a1 as TrackFormatMarkName, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as encodeCSSFromPPr, at as twipsToPixels$2, au as resolveRunProperties, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-DhkZt4Pv.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-Bajmc-RM.js";
|
|
17
17
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
@@ -9916,6 +9916,59 @@ function skipTab(dir) {
|
|
|
9916
9916
|
return true;
|
|
9917
9917
|
};
|
|
9918
9918
|
}
|
|
9919
|
+
const decreaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
9920
|
+
const handled = changeListLevel(-1, editor, tr);
|
|
9921
|
+
if (handled && dispatch) {
|
|
9922
|
+
dispatch(tr);
|
|
9923
|
+
}
|
|
9924
|
+
return handled;
|
|
9925
|
+
};
|
|
9926
|
+
const removeNumberingProperties = ({ checkType = "startParagraph" } = {}) => (props) => {
|
|
9927
|
+
const { tr, state, editor, dispatch } = props;
|
|
9928
|
+
const { node: paragraph, pos } = findParentNode(isList)(state.selection) || {};
|
|
9929
|
+
if (!paragraph) return false;
|
|
9930
|
+
if (checkType === "empty" && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
9931
|
+
if (checkType === "startParagraph") {
|
|
9932
|
+
const { $from, empty: empty2 } = state.selection;
|
|
9933
|
+
if ((!empty2 || $from.parentOffset !== 0) && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
9934
|
+
}
|
|
9935
|
+
const ilvl = getResolvedParagraphProperties(paragraph).numberingProperties.ilvl;
|
|
9936
|
+
if (ilvl > 0) {
|
|
9937
|
+
const outdented = decreaseListIndent()(props);
|
|
9938
|
+
if (outdented) {
|
|
9939
|
+
tr.scrollIntoView();
|
|
9940
|
+
}
|
|
9941
|
+
return outdented;
|
|
9942
|
+
} else {
|
|
9943
|
+
updateNumberingProperties(null, paragraph, pos, editor, tr);
|
|
9944
|
+
}
|
|
9945
|
+
if (dispatch) dispatch(tr);
|
|
9946
|
+
return true;
|
|
9947
|
+
};
|
|
9948
|
+
function isVisuallyEmptyParagraph(node) {
|
|
9949
|
+
if (!node || node.type.name !== "paragraph") return false;
|
|
9950
|
+
let hasHardBreak = false;
|
|
9951
|
+
node.descendants((n) => {
|
|
9952
|
+
if (n.type && n.type.name === "hardBreak") {
|
|
9953
|
+
hasHardBreak = true;
|
|
9954
|
+
return false;
|
|
9955
|
+
}
|
|
9956
|
+
return true;
|
|
9957
|
+
});
|
|
9958
|
+
if (hasHardBreak) return false;
|
|
9959
|
+
const text = (node.textContent || "").replace(/\u200b/g, "").trim();
|
|
9960
|
+
if (text.length > 0) return false;
|
|
9961
|
+
let hasInlineLeaf = false;
|
|
9962
|
+
node.descendants((n) => {
|
|
9963
|
+
if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak" && n.type?.name !== "run") {
|
|
9964
|
+
hasInlineLeaf = true;
|
|
9965
|
+
return false;
|
|
9966
|
+
}
|
|
9967
|
+
return true;
|
|
9968
|
+
});
|
|
9969
|
+
if (hasInlineLeaf) return false;
|
|
9970
|
+
return true;
|
|
9971
|
+
}
|
|
9919
9972
|
const toggleList = (listType) => ({ editor, state, tr, dispatch }) => {
|
|
9920
9973
|
let predicate;
|
|
9921
9974
|
if (listType === "orderedList") {
|
|
@@ -9935,19 +9988,22 @@ const toggleList = (listType) => ({ editor, state, tr, dispatch }) => {
|
|
|
9935
9988
|
const { from: from2, to } = selection;
|
|
9936
9989
|
let firstListNode = null;
|
|
9937
9990
|
let hasNonListParagraphs = false;
|
|
9938
|
-
let
|
|
9991
|
+
let allParagraphsInSelection = [];
|
|
9939
9992
|
state.doc.nodesBetween(from2, to, (node, pos) => {
|
|
9940
9993
|
if (node.type.name === "paragraph") {
|
|
9941
|
-
|
|
9942
|
-
if (!firstListNode && predicate(node)) {
|
|
9943
|
-
firstListNode = node;
|
|
9944
|
-
} else if (!predicate(node)) {
|
|
9945
|
-
hasNonListParagraphs = true;
|
|
9946
|
-
}
|
|
9994
|
+
allParagraphsInSelection.push({ node, pos });
|
|
9947
9995
|
return false;
|
|
9948
9996
|
}
|
|
9949
9997
|
return true;
|
|
9950
9998
|
});
|
|
9999
|
+
let paragraphsInSelection = allParagraphsInSelection.length === 1 ? allParagraphsInSelection : allParagraphsInSelection.filter(({ node }) => !isVisuallyEmptyParagraph(node));
|
|
10000
|
+
for (const { node } of paragraphsInSelection) {
|
|
10001
|
+
if (!firstListNode && predicate(node)) {
|
|
10002
|
+
firstListNode = node;
|
|
10003
|
+
} else if (!predicate(node)) {
|
|
10004
|
+
hasNonListParagraphs = true;
|
|
10005
|
+
}
|
|
10006
|
+
}
|
|
9951
10007
|
if (!firstListNode && from2 > 0) {
|
|
9952
10008
|
const $from = state.doc.resolve(from2);
|
|
9953
10009
|
const parentIndex = $from.index(-1);
|
|
@@ -9991,11 +10047,30 @@ const toggleList = (listType) => ({ editor, state, tr, dispatch }) => {
|
|
|
9991
10047
|
}
|
|
9992
10048
|
updateNumberingProperties(sharedNumberingProperties, node, pos, editor, tr);
|
|
9993
10049
|
}
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
10050
|
+
if (paragraphsInSelection.length > 0) {
|
|
10051
|
+
const firstPara = paragraphsInSelection[0];
|
|
10052
|
+
const lastPara = paragraphsInSelection[paragraphsInSelection.length - 1];
|
|
10053
|
+
const mappedFirstPos = tr.mapping.map(firstPara.pos);
|
|
10054
|
+
const mappedLastPos = tr.mapping.map(lastPara.pos);
|
|
10055
|
+
const $firstPos = tr.doc.resolve(mappedFirstPos);
|
|
10056
|
+
const $lastPos = tr.doc.resolve(mappedLastPos);
|
|
10057
|
+
const firstNode = $firstPos.nodeAfter;
|
|
10058
|
+
const lastNode = $lastPos.nodeAfter;
|
|
10059
|
+
if (firstNode && lastNode) {
|
|
10060
|
+
let selFrom = mappedFirstPos + 1;
|
|
10061
|
+
let selTo = mappedLastPos + lastNode.nodeSize - 1;
|
|
10062
|
+
if (firstNode.firstChild && firstNode.firstChild.type.name === "run") {
|
|
10063
|
+
selFrom = mappedFirstPos + 2;
|
|
10064
|
+
}
|
|
10065
|
+
if (lastNode.lastChild && lastNode.lastChild.type.name === "run") {
|
|
10066
|
+
selTo = mappedLastPos + lastNode.nodeSize - 2;
|
|
10067
|
+
}
|
|
10068
|
+
if (selFrom >= 0 && selTo <= tr.doc.content.size && selFrom <= selTo) {
|
|
10069
|
+
try {
|
|
10070
|
+
tr.setSelection(TextSelection.create(tr.doc, selFrom, selTo));
|
|
10071
|
+
} catch {
|
|
10072
|
+
}
|
|
10073
|
+
}
|
|
9999
10074
|
}
|
|
10000
10075
|
}
|
|
10001
10076
|
if (dispatch) dispatch(tr);
|
|
@@ -10008,59 +10083,6 @@ const increaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
|
10008
10083
|
}
|
|
10009
10084
|
return handled;
|
|
10010
10085
|
};
|
|
10011
|
-
const decreaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
10012
|
-
const handled = changeListLevel(-1, editor, tr);
|
|
10013
|
-
if (handled && dispatch) {
|
|
10014
|
-
dispatch(tr);
|
|
10015
|
-
}
|
|
10016
|
-
return handled;
|
|
10017
|
-
};
|
|
10018
|
-
const removeNumberingProperties = ({ checkType = "startParagraph" } = {}) => (props) => {
|
|
10019
|
-
const { tr, state, editor, dispatch } = props;
|
|
10020
|
-
const { node: paragraph, pos } = findParentNode(isList)(state.selection) || {};
|
|
10021
|
-
if (!paragraph) return false;
|
|
10022
|
-
if (checkType === "empty" && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
10023
|
-
if (checkType === "startParagraph") {
|
|
10024
|
-
const { $from, empty: empty2 } = state.selection;
|
|
10025
|
-
if ((!empty2 || $from.parentOffset !== 0) && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
10026
|
-
}
|
|
10027
|
-
const ilvl = getResolvedParagraphProperties(paragraph).numberingProperties.ilvl;
|
|
10028
|
-
if (ilvl > 0) {
|
|
10029
|
-
const outdented = decreaseListIndent()(props);
|
|
10030
|
-
if (outdented) {
|
|
10031
|
-
tr.scrollIntoView();
|
|
10032
|
-
}
|
|
10033
|
-
return outdented;
|
|
10034
|
-
} else {
|
|
10035
|
-
updateNumberingProperties(null, paragraph, pos, editor, tr);
|
|
10036
|
-
}
|
|
10037
|
-
if (dispatch) dispatch(tr);
|
|
10038
|
-
return true;
|
|
10039
|
-
};
|
|
10040
|
-
function isVisuallyEmptyParagraph(node) {
|
|
10041
|
-
if (!node || node.type.name !== "paragraph") return false;
|
|
10042
|
-
let hasHardBreak = false;
|
|
10043
|
-
node.descendants((n) => {
|
|
10044
|
-
if (n.type && n.type.name === "hardBreak") {
|
|
10045
|
-
hasHardBreak = true;
|
|
10046
|
-
return false;
|
|
10047
|
-
}
|
|
10048
|
-
return true;
|
|
10049
|
-
});
|
|
10050
|
-
if (hasHardBreak) return false;
|
|
10051
|
-
const text = (node.textContent || "").replace(/\u200b/g, "").trim();
|
|
10052
|
-
if (text.length > 0) return false;
|
|
10053
|
-
let hasInlineLeaf = false;
|
|
10054
|
-
node.descendants((n) => {
|
|
10055
|
-
if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak" && n.type?.name !== "run") {
|
|
10056
|
-
hasInlineLeaf = true;
|
|
10057
|
-
return false;
|
|
10058
|
-
}
|
|
10059
|
-
return true;
|
|
10060
|
-
});
|
|
10061
|
-
if (hasInlineLeaf) return false;
|
|
10062
|
-
return true;
|
|
10063
|
-
}
|
|
10064
10086
|
const restoreSelection = () => ({ editor, state, tr }) => {
|
|
10065
10087
|
if (editor.options.lastSelection) {
|
|
10066
10088
|
const selectionTr = tr.setSelection(
|
|
@@ -10143,6 +10165,7 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
10143
10165
|
insertTabCharacter,
|
|
10144
10166
|
insertTabNode,
|
|
10145
10167
|
isStyleTokenEnabled,
|
|
10168
|
+
isVisuallyEmptyParagraph,
|
|
10146
10169
|
joinBackward,
|
|
10147
10170
|
joinDown,
|
|
10148
10171
|
joinForward,
|
|
@@ -10261,12 +10284,38 @@ const Keymap = Extension.create({
|
|
|
10261
10284
|
const Editable = Extension.create({
|
|
10262
10285
|
name: "editable",
|
|
10263
10286
|
addPmPlugins() {
|
|
10287
|
+
const editor = this.editor;
|
|
10264
10288
|
const editablePlugin = new Plugin({
|
|
10265
10289
|
key: new PluginKey("editable"),
|
|
10266
10290
|
props: {
|
|
10267
|
-
editable: () =>
|
|
10268
|
-
|
|
10269
|
-
|
|
10291
|
+
editable: () => editor.options.editable,
|
|
10292
|
+
handleDOMEvents: {
|
|
10293
|
+
beforeinput: (_view, event) => {
|
|
10294
|
+
if (!editor.options.editable) {
|
|
10295
|
+
event.preventDefault();
|
|
10296
|
+
return true;
|
|
10297
|
+
}
|
|
10298
|
+
return false;
|
|
10299
|
+
},
|
|
10300
|
+
mousedown: (_view, event) => {
|
|
10301
|
+
if (!editor.options.editable) {
|
|
10302
|
+
event.preventDefault();
|
|
10303
|
+
return true;
|
|
10304
|
+
}
|
|
10305
|
+
return false;
|
|
10306
|
+
},
|
|
10307
|
+
focus: (view, event) => {
|
|
10308
|
+
if (!editor.options.editable) {
|
|
10309
|
+
event.preventDefault();
|
|
10310
|
+
view.dom.blur();
|
|
10311
|
+
return true;
|
|
10312
|
+
}
|
|
10313
|
+
return false;
|
|
10314
|
+
}
|
|
10315
|
+
},
|
|
10316
|
+
handleClick: () => !editor.options.editable,
|
|
10317
|
+
handleDoubleClick: () => !editor.options.editable,
|
|
10318
|
+
handleTripleClick: () => !editor.options.editable
|
|
10270
10319
|
}
|
|
10271
10320
|
});
|
|
10272
10321
|
return [editablePlugin];
|
|
@@ -11213,7 +11262,6 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
11213
11262
|
comments.forEach((c) => {
|
|
11214
11263
|
commentMap.set(c.commentId, c);
|
|
11215
11264
|
});
|
|
11216
|
-
new Set(comments.filter((c) => c.parentCommentId).map((c) => c.parentCommentId));
|
|
11217
11265
|
const startNodes = [];
|
|
11218
11266
|
const endNodes = [];
|
|
11219
11267
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -13857,7 +13905,7 @@ const isHeadless = (editor) => {
|
|
|
13857
13905
|
const shouldSkipNodeView = (editor) => {
|
|
13858
13906
|
return isHeadless(editor);
|
|
13859
13907
|
};
|
|
13860
|
-
const summaryVersion = "1.0.0-beta.
|
|
13908
|
+
const summaryVersion = "1.0.0-beta.22";
|
|
13861
13909
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13862
13910
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13863
13911
|
function mapAttributes(attrs) {
|
|
@@ -14265,10 +14313,23 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14265
14313
|
this.view.updateState(this.state);
|
|
14266
14314
|
}
|
|
14267
14315
|
/**
|
|
14268
|
-
* Set whether the editor is editable
|
|
14316
|
+
* Set whether the editor is editable.
|
|
14317
|
+
*
|
|
14318
|
+
* When setting to non-editable, this method:
|
|
14319
|
+
* - Forces ProseMirror to re-evaluate the editable prop from the Editable plugin
|
|
14320
|
+
* - Blurs the editor to remove the cursor
|
|
14321
|
+
*
|
|
14322
|
+
* @param editable - Whether the editor should accept user input (default: true)
|
|
14323
|
+
* @param emitUpdate - Whether to emit an update event after changing editability (default: true)
|
|
14269
14324
|
*/
|
|
14270
14325
|
setEditable(editable = true, emitUpdate = true) {
|
|
14271
14326
|
this.setOptions({ editable });
|
|
14327
|
+
if (this.view) {
|
|
14328
|
+
this.view.setProps({});
|
|
14329
|
+
if (!editable && this.view.dom) {
|
|
14330
|
+
this.view.dom.blur();
|
|
14331
|
+
}
|
|
14332
|
+
}
|
|
14272
14333
|
if (emitUpdate) {
|
|
14273
14334
|
this.emit("update", { editor: this, transaction: this.state.tr });
|
|
14274
14335
|
}
|
|
@@ -14636,7 +14697,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14636
14697
|
{ default: remarkStringify },
|
|
14637
14698
|
{ default: remarkGfm }
|
|
14638
14699
|
] = await Promise.all([
|
|
14639
|
-
import("./index-
|
|
14700
|
+
import("./index-895wSAjT.js"),
|
|
14640
14701
|
import("./index-DRCvimau.js"),
|
|
14641
14702
|
import("./index-C_x_N6Uh.js"),
|
|
14642
14703
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14841,7 +14902,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14841
14902
|
* Process collaboration migrations
|
|
14842
14903
|
*/
|
|
14843
14904
|
processCollaborationMigrations() {
|
|
14844
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
14905
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.22");
|
|
14845
14906
|
if (!this.options.ydoc) return;
|
|
14846
14907
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14847
14908
|
let docVersion = metaMap.get("version");
|
|
@@ -15616,8 +15677,9 @@ function extractPageNumbering(elements) {
|
|
|
15616
15677
|
const fmt = validFormats.includes(fmtRaw) ? fmtRaw : void 0;
|
|
15617
15678
|
const startRaw = pgNumType.attributes["w:start"];
|
|
15618
15679
|
const startNum = startRaw != null ? Number(startRaw) : void 0;
|
|
15680
|
+
const effectiveFormat = fmt ?? (Number.isFinite(startNum) ? "decimal" : void 0);
|
|
15619
15681
|
return {
|
|
15620
|
-
format:
|
|
15682
|
+
format: effectiveFormat,
|
|
15621
15683
|
...Number.isFinite(startNum) ? { start: Number(startNum) } : {}
|
|
15622
15684
|
};
|
|
15623
15685
|
}
|
|
@@ -22839,6 +22901,84 @@ const getHeaderFooterType = (pageNumber, identifier, options) => {
|
|
|
22839
22901
|
}
|
|
22840
22902
|
return null;
|
|
22841
22903
|
};
|
|
22904
|
+
const defaultMultiSectionIdentifier = () => ({
|
|
22905
|
+
headerIds: { default: null, first: null, even: null, odd: null },
|
|
22906
|
+
footerIds: { default: null, first: null, even: null, odd: null },
|
|
22907
|
+
titlePg: false,
|
|
22908
|
+
alternateHeaders: false,
|
|
22909
|
+
sectionCount: 0,
|
|
22910
|
+
sectionHeaderIds: /* @__PURE__ */ new Map(),
|
|
22911
|
+
sectionFooterIds: /* @__PURE__ */ new Map(),
|
|
22912
|
+
sectionTitlePg: /* @__PURE__ */ new Map()
|
|
22913
|
+
});
|
|
22914
|
+
function buildMultiSectionIdentifier(sectionMetadata, pageStyles2) {
|
|
22915
|
+
const identifier = defaultMultiSectionIdentifier();
|
|
22916
|
+
identifier.alternateHeaders = Boolean(pageStyles2?.alternateHeaders ?? false);
|
|
22917
|
+
identifier.sectionCount = sectionMetadata.length;
|
|
22918
|
+
for (const section of sectionMetadata) {
|
|
22919
|
+
const idx = section.sectionIndex;
|
|
22920
|
+
if (section.headerRefs) {
|
|
22921
|
+
identifier.sectionHeaderIds.set(idx, {
|
|
22922
|
+
default: section.headerRefs.default ?? null,
|
|
22923
|
+
first: section.headerRefs.first ?? null,
|
|
22924
|
+
even: section.headerRefs.even ?? null,
|
|
22925
|
+
odd: section.headerRefs.odd ?? null
|
|
22926
|
+
});
|
|
22927
|
+
}
|
|
22928
|
+
if (section.footerRefs) {
|
|
22929
|
+
identifier.sectionFooterIds.set(idx, {
|
|
22930
|
+
default: section.footerRefs.default ?? null,
|
|
22931
|
+
first: section.footerRefs.first ?? null,
|
|
22932
|
+
even: section.footerRefs.even ?? null,
|
|
22933
|
+
odd: section.footerRefs.odd ?? null
|
|
22934
|
+
});
|
|
22935
|
+
}
|
|
22936
|
+
const hasFirstHeader = Boolean(section.headerRefs?.first);
|
|
22937
|
+
const hasFirstFooter = Boolean(section.footerRefs?.first);
|
|
22938
|
+
if (hasFirstHeader || hasFirstFooter) {
|
|
22939
|
+
identifier.sectionTitlePg.set(idx, true);
|
|
22940
|
+
}
|
|
22941
|
+
}
|
|
22942
|
+
const section0Headers = identifier.sectionHeaderIds.get(0);
|
|
22943
|
+
const section0Footers = identifier.sectionFooterIds.get(0);
|
|
22944
|
+
if (section0Headers) {
|
|
22945
|
+
identifier.headerIds = { ...section0Headers };
|
|
22946
|
+
}
|
|
22947
|
+
if (section0Footers) {
|
|
22948
|
+
identifier.footerIds = { ...section0Footers };
|
|
22949
|
+
}
|
|
22950
|
+
identifier.titlePg = identifier.sectionTitlePg.get(0) ?? false;
|
|
22951
|
+
return identifier;
|
|
22952
|
+
}
|
|
22953
|
+
function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, options) {
|
|
22954
|
+
if (pageNumber <= 0) return null;
|
|
22955
|
+
const kind = options?.kind ?? "header";
|
|
22956
|
+
const sectionPageNumber = options?.sectionPageNumber ?? pageNumber;
|
|
22957
|
+
const sectionIds = kind === "header" ? identifier.sectionHeaderIds.get(sectionIndex) : identifier.sectionFooterIds.get(sectionIndex);
|
|
22958
|
+
const ids = sectionIds ?? (kind === "header" ? identifier.headerIds : identifier.footerIds);
|
|
22959
|
+
const hasFirst = Boolean(ids.first);
|
|
22960
|
+
const hasEven = Boolean(ids.even);
|
|
22961
|
+
const hasOdd = Boolean(ids.odd);
|
|
22962
|
+
const hasDefault = Boolean(ids.default);
|
|
22963
|
+
const sectionTitlePg = identifier.sectionTitlePg.get(sectionIndex) ?? identifier.titlePg;
|
|
22964
|
+
const titlePgEnabled = sectionTitlePg && hasFirst;
|
|
22965
|
+
const isFirstPageOfSection = sectionPageNumber === 1;
|
|
22966
|
+
if (isFirstPageOfSection && titlePgEnabled) {
|
|
22967
|
+
return "first";
|
|
22968
|
+
}
|
|
22969
|
+
if (identifier.alternateHeaders) {
|
|
22970
|
+
if (pageNumber % 2 === 0 && (hasEven || hasDefault)) {
|
|
22971
|
+
return hasEven ? "even" : "default";
|
|
22972
|
+
}
|
|
22973
|
+
if (pageNumber % 2 === 1 && (hasOdd || hasDefault)) {
|
|
22974
|
+
return hasOdd ? "odd" : "default";
|
|
22975
|
+
}
|
|
22976
|
+
}
|
|
22977
|
+
if (hasDefault) {
|
|
22978
|
+
return "default";
|
|
22979
|
+
}
|
|
22980
|
+
return null;
|
|
22981
|
+
}
|
|
22842
22982
|
function createFloatingObjectManager(columns, margins, pageWidth) {
|
|
22843
22983
|
const zones = [];
|
|
22844
22984
|
const marginLeft = Math.max(0, margins?.left ?? 0);
|
|
@@ -23989,23 +24129,54 @@ function layoutTableBlock({
|
|
|
23989
24129
|
const headerCount = countHeaderRows(block);
|
|
23990
24130
|
const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
|
|
23991
24131
|
let state = ensurePage();
|
|
24132
|
+
const availableHeight = state.contentBottom - state.cursorY;
|
|
24133
|
+
let minRequiredHeight = 0;
|
|
24134
|
+
if (measure.rows.length > 0) {
|
|
24135
|
+
minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
|
|
24136
|
+
} else if (measure.totalHeight > 0) {
|
|
24137
|
+
minRequiredHeight = measure.totalHeight;
|
|
24138
|
+
}
|
|
24139
|
+
if (minRequiredHeight > availableHeight && state.page.fragments.length > 0) {
|
|
24140
|
+
state = advanceColumn(state);
|
|
24141
|
+
}
|
|
23992
24142
|
let currentRow = 0;
|
|
23993
24143
|
let isTableContinuation = false;
|
|
23994
24144
|
let pendingPartialRow = null;
|
|
24145
|
+
if (block.rows.length === 0 && measure.totalHeight > 0) {
|
|
24146
|
+
const height = Math.min(measure.totalHeight, state.contentBottom - state.cursorY);
|
|
24147
|
+
const metadata = {
|
|
24148
|
+
columnBoundaries: generateColumnBoundaries(measure),
|
|
24149
|
+
coordinateSystem: "fragment"
|
|
24150
|
+
};
|
|
24151
|
+
const fragment = {
|
|
24152
|
+
kind: "table",
|
|
24153
|
+
blockId: block.id,
|
|
24154
|
+
fromRow: 0,
|
|
24155
|
+
toRow: 0,
|
|
24156
|
+
x: columnX(state.columnIndex),
|
|
24157
|
+
y: state.cursorY,
|
|
24158
|
+
width: Math.min(columnWidth, measure.totalWidth || columnWidth),
|
|
24159
|
+
height,
|
|
24160
|
+
metadata
|
|
24161
|
+
};
|
|
24162
|
+
state.page.fragments.push(fragment);
|
|
24163
|
+
state.cursorY += height;
|
|
24164
|
+
return;
|
|
24165
|
+
}
|
|
23995
24166
|
while (currentRow < block.rows.length || pendingPartialRow !== null) {
|
|
23996
24167
|
state = ensurePage();
|
|
23997
|
-
const
|
|
24168
|
+
const availableHeight2 = state.contentBottom - state.cursorY;
|
|
23998
24169
|
let repeatHeaderCount = 0;
|
|
23999
24170
|
if (currentRow === 0 && !pendingPartialRow) {
|
|
24000
24171
|
repeatHeaderCount = 0;
|
|
24001
24172
|
} else {
|
|
24002
|
-
if (headerCount > 0 && headerHeight <=
|
|
24173
|
+
if (headerCount > 0 && headerHeight <= availableHeight2) {
|
|
24003
24174
|
repeatHeaderCount = headerCount;
|
|
24004
|
-
} else if (headerCount > 0 && headerHeight >
|
|
24175
|
+
} else if (headerCount > 0 && headerHeight > availableHeight2) {
|
|
24005
24176
|
repeatHeaderCount = 0;
|
|
24006
24177
|
}
|
|
24007
24178
|
}
|
|
24008
|
-
const availableForBody = repeatHeaderCount > 0 ?
|
|
24179
|
+
const availableForBody = repeatHeaderCount > 0 ? availableHeight2 - headerHeight : availableHeight2;
|
|
24009
24180
|
const fullPageHeight = state.contentBottom;
|
|
24010
24181
|
if (pendingPartialRow !== null) {
|
|
24011
24182
|
const rowIndex = pendingPartialRow.rowIndex;
|
|
@@ -24384,7 +24555,7 @@ function computeDisplayPageNumber(pages, sections) {
|
|
|
24384
24555
|
let currentSectionIndex = -1;
|
|
24385
24556
|
for (let i = 0; i < pages.length; i++) {
|
|
24386
24557
|
const page = pages[i];
|
|
24387
|
-
const pageSectionIndex = 0;
|
|
24558
|
+
const pageSectionIndex = page.sectionIndex ?? 0;
|
|
24388
24559
|
if (pageSectionIndex !== currentSectionIndex) {
|
|
24389
24560
|
const sectionMetadata2 = sectionMap.get(pageSectionIndex);
|
|
24390
24561
|
if (sectionMetadata2?.numbering?.start !== void 0) {
|
|
@@ -24633,6 +24804,18 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
24633
24804
|
};
|
|
24634
24805
|
layoutLog(`[Layout] First section: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
24635
24806
|
}
|
|
24807
|
+
const firstSectionIndexRaw = block.attrs?.sectionIndex;
|
|
24808
|
+
const firstMetadataIndex = typeof firstSectionIndexRaw === "number" ? firstSectionIndexRaw : Number(firstSectionIndexRaw ?? NaN);
|
|
24809
|
+
if (Number.isFinite(firstMetadataIndex)) {
|
|
24810
|
+
activeSectionIndex = firstMetadataIndex;
|
|
24811
|
+
}
|
|
24812
|
+
const firstSectionMetadata = Number.isFinite(firstMetadataIndex) ? sectionMetadataList[firstMetadataIndex] : void 0;
|
|
24813
|
+
if (firstSectionMetadata?.numbering) {
|
|
24814
|
+
if (firstSectionMetadata.numbering.format) activeNumberFormat = firstSectionMetadata.numbering.format;
|
|
24815
|
+
if (typeof firstSectionMetadata.numbering.start === "number") {
|
|
24816
|
+
activePageCounter = firstSectionMetadata.numbering.start;
|
|
24817
|
+
}
|
|
24818
|
+
}
|
|
24636
24819
|
return { decision: { forcePageBreak: false, forceMidPageRegion: false }, state: next };
|
|
24637
24820
|
}
|
|
24638
24821
|
const headerPx = block.margins?.header;
|
|
@@ -24649,7 +24832,15 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
24649
24832
|
if (block.orientation) next.pendingOrientation = block.orientation;
|
|
24650
24833
|
const sectionType = block.type ?? "continuous";
|
|
24651
24834
|
const isColumnsChanging = !!block.columns && (block.columns.count !== next.activeColumns.count || block.columns.gap !== next.activeColumns.gap);
|
|
24652
|
-
|
|
24835
|
+
const sectionIndexRaw = block.attrs?.sectionIndex;
|
|
24836
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
24837
|
+
if (Number.isFinite(metadataIndex)) {
|
|
24838
|
+
pendingSectionIndex = metadataIndex;
|
|
24839
|
+
}
|
|
24840
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
24841
|
+
if (sectionMetadata?.numbering) {
|
|
24842
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
24843
|
+
} else if (block.numbering) {
|
|
24653
24844
|
pendingNumbering = { ...block.numbering };
|
|
24654
24845
|
}
|
|
24655
24846
|
if (block.headerRefs || block.footerRefs) {
|
|
@@ -24718,6 +24909,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
24718
24909
|
...initialSectionMetadata.footerRefs && { footerRefs: initialSectionMetadata.footerRefs }
|
|
24719
24910
|
};
|
|
24720
24911
|
}
|
|
24912
|
+
let activeSectionIndex = initialSectionMetadata?.sectionIndex ?? 0;
|
|
24913
|
+
let pendingSectionIndex = null;
|
|
24721
24914
|
const paginator = createPaginator({
|
|
24722
24915
|
margins: { left: margins.left, right: margins.right },
|
|
24723
24916
|
getActiveTopMargin: () => activeTopMargin,
|
|
@@ -24774,6 +24967,10 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
24774
24967
|
activeSectionRefs = pendingSectionRefs;
|
|
24775
24968
|
pendingSectionRefs = null;
|
|
24776
24969
|
}
|
|
24970
|
+
if (pendingSectionIndex !== null) {
|
|
24971
|
+
activeSectionIndex = pendingSectionIndex;
|
|
24972
|
+
pendingSectionIndex = null;
|
|
24973
|
+
}
|
|
24777
24974
|
if (pendingVAlign !== null) {
|
|
24778
24975
|
activeVAlign = pendingVAlign;
|
|
24779
24976
|
pendingVAlign = null;
|
|
@@ -24783,6 +24980,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
24783
24980
|
}
|
|
24784
24981
|
if (state?.page) {
|
|
24785
24982
|
state.page.numberText = formatPageNumber(activePageCounter, activeNumberFormat);
|
|
24983
|
+
state.page.sectionIndex = activeSectionIndex;
|
|
24984
|
+
layoutLog(`[Layout] Page ${state.page.number}: Stamped sectionIndex:`, activeSectionIndex);
|
|
24786
24985
|
if (activeSectionRefs) {
|
|
24787
24986
|
state.page.sectionRefs = {
|
|
24788
24987
|
...activeSectionRefs.headerRefs && { headerRefs: activeSectionRefs.headerRefs },
|
|
@@ -24969,8 +25168,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
24969
25168
|
activeOrientation = updatedState.activeOrientation;
|
|
24970
25169
|
pendingOrientation = updatedState.pendingOrientation;
|
|
24971
25170
|
if (effectiveBlock.vAlign) {
|
|
24972
|
-
const
|
|
24973
|
-
if (
|
|
25171
|
+
const isFirstSection2 = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
25172
|
+
if (isFirstSection2) {
|
|
24974
25173
|
activeVAlign = effectiveBlock.vAlign;
|
|
24975
25174
|
pendingVAlign = null;
|
|
24976
25175
|
} else {
|
|
@@ -24984,6 +25183,36 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
24984
25183
|
};
|
|
24985
25184
|
layoutLog(`[Layout] After scheduleSectionBreakCompat: Scheduled pendingSectionRefs:`, pendingSectionRefs);
|
|
24986
25185
|
}
|
|
25186
|
+
const sectionIndexRaw = effectiveBlock.attrs?.sectionIndex;
|
|
25187
|
+
const metadataIndex = typeof sectionIndexRaw === "number" ? sectionIndexRaw : Number(sectionIndexRaw ?? NaN);
|
|
25188
|
+
const isFirstSection = effectiveBlock.attrs?.isFirstSection && states.length === 0;
|
|
25189
|
+
if (Number.isFinite(metadataIndex)) {
|
|
25190
|
+
if (isFirstSection) {
|
|
25191
|
+
activeSectionIndex = metadataIndex;
|
|
25192
|
+
} else {
|
|
25193
|
+
pendingSectionIndex = metadataIndex;
|
|
25194
|
+
}
|
|
25195
|
+
}
|
|
25196
|
+
const sectionMetadata = Number.isFinite(metadataIndex) ? sectionMetadataList[metadataIndex] : void 0;
|
|
25197
|
+
if (sectionMetadata?.numbering) {
|
|
25198
|
+
if (isFirstSection) {
|
|
25199
|
+
if (sectionMetadata.numbering.format) activeNumberFormat = sectionMetadata.numbering.format;
|
|
25200
|
+
if (typeof sectionMetadata.numbering.start === "number") {
|
|
25201
|
+
activePageCounter = sectionMetadata.numbering.start;
|
|
25202
|
+
}
|
|
25203
|
+
} else {
|
|
25204
|
+
pendingNumbering = { ...sectionMetadata.numbering };
|
|
25205
|
+
}
|
|
25206
|
+
} else if (effectiveBlock.numbering) {
|
|
25207
|
+
if (isFirstSection) {
|
|
25208
|
+
if (effectiveBlock.numbering.format) activeNumberFormat = effectiveBlock.numbering.format;
|
|
25209
|
+
if (typeof effectiveBlock.numbering.start === "number") {
|
|
25210
|
+
activePageCounter = effectiveBlock.numbering.start;
|
|
25211
|
+
}
|
|
25212
|
+
} else {
|
|
25213
|
+
pendingNumbering = { ...effectiveBlock.numbering };
|
|
25214
|
+
}
|
|
25215
|
+
}
|
|
24987
25216
|
if (breakInfo.forceMidPageRegion && block.columns) {
|
|
24988
25217
|
let state = paginator.ensurePage();
|
|
24989
25218
|
const columnIndexBefore = state.columnIndex;
|
|
@@ -25963,8 +26192,11 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
|
25963
26192
|
const { totalPages: docTotalPages } = pageResolver(1);
|
|
25964
26193
|
const useBucketing = FeatureFlags.HF_DIGIT_BUCKETING && docTotalPages >= MIN_PAGES_FOR_BUCKETING;
|
|
25965
26194
|
for (const [type, blocks] of Object.entries(sections)) {
|
|
25966
|
-
if (!blocks || blocks.length === 0)
|
|
25967
|
-
|
|
26195
|
+
if (!blocks || blocks.length === 0) {
|
|
26196
|
+
continue;
|
|
26197
|
+
}
|
|
26198
|
+
const hasTokens = hasPageTokens(blocks);
|
|
26199
|
+
if (!hasTokens) {
|
|
25968
26200
|
const measures = await cache2.measureBlocks(blocks, constraints, measureBlock2);
|
|
25969
26201
|
const layout = layoutHeaderFooter(blocks, measures, constraints);
|
|
25970
26202
|
result[type] = { blocks, measures, layout };
|
|
@@ -25986,7 +26218,8 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
|
|
|
25986
26218
|
for (const pageNum of pagesToLayout) {
|
|
25987
26219
|
const clonedBlocks = cloneHeaderFooterBlocks(blocks);
|
|
25988
26220
|
const { displayText, totalPages: totalPagesForPage } = pageResolver(pageNum);
|
|
25989
|
-
|
|
26221
|
+
const resolvedPageNum = parseInt(displayText, 10) || pageNum;
|
|
26222
|
+
resolveHeaderFooterTokens(clonedBlocks, resolvedPageNum, totalPagesForPage);
|
|
25990
26223
|
const measures = await cache2.measureBlocks(clonedBlocks, constraints, measureBlock2);
|
|
25991
26224
|
const pageLayout = layoutHeaderFooter(clonedBlocks, measures, constraints);
|
|
25992
26225
|
pages.push({
|
|
@@ -32828,9 +33061,36 @@ const fragmentSignature = (fragment, lookup) => {
|
|
|
32828
33061
|
}
|
|
32829
33062
|
return base2;
|
|
32830
33063
|
};
|
|
33064
|
+
const hasListMarkerProperties = (attrs) => {
|
|
33065
|
+
if (!attrs || typeof attrs !== "object") return false;
|
|
33066
|
+
const obj = attrs;
|
|
33067
|
+
if (!obj.numberingProperties || typeof obj.numberingProperties !== "object") return false;
|
|
33068
|
+
const numProps = obj.numberingProperties;
|
|
33069
|
+
if ("numId" in numProps) {
|
|
33070
|
+
const numId = numProps.numId;
|
|
33071
|
+
if (typeof numId !== "number" && typeof numId !== "string") return false;
|
|
33072
|
+
}
|
|
33073
|
+
if ("ilvl" in numProps) {
|
|
33074
|
+
const ilvl = numProps.ilvl;
|
|
33075
|
+
if (typeof ilvl !== "number") return false;
|
|
33076
|
+
}
|
|
33077
|
+
if ("wordLayout" in obj && obj.wordLayout !== void 0) {
|
|
33078
|
+
if (typeof obj.wordLayout !== "object" || obj.wordLayout === null) return false;
|
|
33079
|
+
const wordLayout = obj.wordLayout;
|
|
33080
|
+
if ("marker" in wordLayout && wordLayout.marker !== void 0) {
|
|
33081
|
+
if (typeof wordLayout.marker !== "object" || wordLayout.marker === null) return false;
|
|
33082
|
+
const marker = wordLayout.marker;
|
|
33083
|
+
if ("markerText" in marker && marker.markerText !== void 0) {
|
|
33084
|
+
if (typeof marker.markerText !== "string") return false;
|
|
33085
|
+
}
|
|
33086
|
+
}
|
|
33087
|
+
}
|
|
33088
|
+
return true;
|
|
33089
|
+
};
|
|
32831
33090
|
const deriveBlockVersion = (block) => {
|
|
32832
33091
|
if (block.kind === "paragraph") {
|
|
32833
|
-
|
|
33092
|
+
const markerVersion = hasListMarkerProperties(block.attrs) ? `marker:${block.attrs.numberingProperties.numId ?? ""}:${block.attrs.numberingProperties.ilvl ?? 0}:${block.attrs.wordLayout?.marker?.markerText ?? ""}` : "";
|
|
33093
|
+
const runsVersion = block.runs.map((run) => {
|
|
32834
33094
|
if (run.kind === "image") {
|
|
32835
33095
|
const imgRun = run;
|
|
32836
33096
|
return [
|
|
@@ -32873,6 +33133,7 @@ const deriveBlockVersion = (block) => {
|
|
|
32873
33133
|
textRun.token ?? ""
|
|
32874
33134
|
].join(",");
|
|
32875
33135
|
}).join("|");
|
|
33136
|
+
return markerVersion ? `${markerVersion}|${runsVersion}` : runsVersion;
|
|
32876
33137
|
}
|
|
32877
33138
|
if (block.kind === "list") {
|
|
32878
33139
|
return block.items.map((item) => `${item.id}:${item.marker.text}:${deriveBlockVersion(item.paragraph)}`).join("|");
|
|
@@ -35338,6 +35599,49 @@ class HeaderFooterLayoutAdapter {
|
|
|
35338
35599
|
});
|
|
35339
35600
|
return hasBlocks ? batch : void 0;
|
|
35340
35601
|
}
|
|
35602
|
+
/**
|
|
35603
|
+
* Retrieves FlowBlocks for ALL header/footer content, keyed by relationship ID.
|
|
35604
|
+
*
|
|
35605
|
+
* Unlike getBatch() which only returns content for variant-associated IDs,
|
|
35606
|
+
* this method returns content for ALL registered header/footer IDs. This is
|
|
35607
|
+
* essential for multi-section documents where different sections may use
|
|
35608
|
+
* different content for the same variant type.
|
|
35609
|
+
*
|
|
35610
|
+
* @param kind - The type of section to retrieve: 'header' or 'footer'
|
|
35611
|
+
* @returns A Map of rId to FlowBlock arrays, or undefined if no content exists
|
|
35612
|
+
*
|
|
35613
|
+
* @example
|
|
35614
|
+
* ```typescript
|
|
35615
|
+
* const footersByRId = adapter.getBlocksByRId('footer');
|
|
35616
|
+
* if (footersByRId) {
|
|
35617
|
+
* // footersByRId.get('rId14') - blocks for footer with rId14
|
|
35618
|
+
* // footersByRId.get('rId18') - blocks for footer with rId18 (different section)
|
|
35619
|
+
* }
|
|
35620
|
+
* ```
|
|
35621
|
+
*/
|
|
35622
|
+
getBlocksByRId(kind) {
|
|
35623
|
+
const descriptors = __privateGet(this, _manager).getDescriptors(kind);
|
|
35624
|
+
if (!descriptors.length) return void 0;
|
|
35625
|
+
const blocksMap = /* @__PURE__ */ new Map();
|
|
35626
|
+
descriptors.forEach((descriptor) => {
|
|
35627
|
+
const blocks = __privateMethod(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
35628
|
+
if (blocks && blocks.length > 0) {
|
|
35629
|
+
blocksMap.set(descriptor.id, blocks);
|
|
35630
|
+
}
|
|
35631
|
+
});
|
|
35632
|
+
return blocksMap.size > 0 ? blocksMap : void 0;
|
|
35633
|
+
}
|
|
35634
|
+
/**
|
|
35635
|
+
* Retrieves FlowBlocks for a specific header/footer by its relationship ID.
|
|
35636
|
+
*
|
|
35637
|
+
* @param rId - The relationship ID (e.g., 'rId14')
|
|
35638
|
+
* @returns FlowBlock array for the specified rId, or undefined if not found
|
|
35639
|
+
*/
|
|
35640
|
+
getBlocksForRId(rId) {
|
|
35641
|
+
const descriptor = __privateGet(this, _manager).getDescriptorById(rId);
|
|
35642
|
+
if (!descriptor) return void 0;
|
|
35643
|
+
return __privateMethod(this, _HeaderFooterLayoutAdapter_instances, getBlocks_fn).call(this, descriptor);
|
|
35644
|
+
}
|
|
35341
35645
|
/**
|
|
35342
35646
|
* Invalidates the cached FlowBlocks for a specific header/footer section.
|
|
35343
35647
|
*
|
|
@@ -35848,8 +36152,12 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
35848
36152
|
__privateAdd(this, _headerFooterManager, null);
|
|
35849
36153
|
__privateAdd(this, _headerFooterAdapter, null);
|
|
35850
36154
|
__privateAdd(this, _headerFooterIdentifier, null);
|
|
36155
|
+
__privateAdd(this, _multiSectionIdentifier, null);
|
|
35851
36156
|
__privateAdd(this, _headerLayoutResults, null);
|
|
35852
36157
|
__privateAdd(this, _footerLayoutResults, null);
|
|
36158
|
+
// Per-rId layout results for multi-section support
|
|
36159
|
+
__privateAdd(this, _headerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
36160
|
+
__privateAdd(this, _footerLayoutsByRId, /* @__PURE__ */ new Map());
|
|
35853
36161
|
__privateAdd(this, _headerDecorationProvider);
|
|
35854
36162
|
__privateAdd(this, _footerDecorationProvider);
|
|
35855
36163
|
__privateAdd(this, _headerFooterManagerCleanups, []);
|
|
@@ -37015,8 +37323,11 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
37015
37323
|
__privateSet(this, _headerFooterManager, null);
|
|
37016
37324
|
}, "Header/footer manager");
|
|
37017
37325
|
__privateSet(this, _headerFooterIdentifier, null);
|
|
37326
|
+
__privateSet(this, _multiSectionIdentifier, null);
|
|
37018
37327
|
__privateSet(this, _headerLayoutResults, null);
|
|
37019
37328
|
__privateSet(this, _footerLayoutResults, null);
|
|
37329
|
+
__privateGet(this, _headerLayoutsByRId).clear();
|
|
37330
|
+
__privateGet(this, _footerLayoutsByRId).clear();
|
|
37020
37331
|
__privateSet(this, _headerDecorationProvider, void 0);
|
|
37021
37332
|
__privateSet(this, _footerDecorationProvider, void 0);
|
|
37022
37333
|
__privateSet(this, _session, { mode: "body" });
|
|
@@ -37070,8 +37381,11 @@ _trackedChangesOverrides = new WeakMap();
|
|
|
37070
37381
|
_headerFooterManager = new WeakMap();
|
|
37071
37382
|
_headerFooterAdapter = new WeakMap();
|
|
37072
37383
|
_headerFooterIdentifier = new WeakMap();
|
|
37384
|
+
_multiSectionIdentifier = new WeakMap();
|
|
37073
37385
|
_headerLayoutResults = new WeakMap();
|
|
37074
37386
|
_footerLayoutResults = new WeakMap();
|
|
37387
|
+
_headerLayoutsByRId = new WeakMap();
|
|
37388
|
+
_footerLayoutsByRId = new WeakMap();
|
|
37075
37389
|
_headerDecorationProvider = new WeakMap();
|
|
37076
37390
|
_footerDecorationProvider = new WeakMap();
|
|
37077
37391
|
_headerFooterManagerCleanups = new WeakMap();
|
|
@@ -37547,7 +37861,12 @@ setupPointerHandlers_fn = function() {
|
|
|
37547
37861
|
setupInputBridge_fn = function() {
|
|
37548
37862
|
__privateGet(this, _inputBridge)?.destroy();
|
|
37549
37863
|
const win = __privateGet(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
37550
|
-
__privateSet(this, _inputBridge, new PresentationInputBridge(
|
|
37864
|
+
__privateSet(this, _inputBridge, new PresentationInputBridge(
|
|
37865
|
+
win,
|
|
37866
|
+
__privateGet(this, _visibleHost),
|
|
37867
|
+
() => __privateMethod(this, _PresentationEditor_instances, getActiveDomTarget_fn).call(this),
|
|
37868
|
+
() => __privateGet(this, _documentMode) !== "viewing"
|
|
37869
|
+
));
|
|
37551
37870
|
__privateGet(this, _inputBridge).bind();
|
|
37552
37871
|
};
|
|
37553
37872
|
initHeaderFooterRegistry_fn = function() {
|
|
@@ -37850,11 +38169,11 @@ rerender_fn = async function() {
|
|
|
37850
38169
|
const sectionMetadata = [];
|
|
37851
38170
|
let blocks;
|
|
37852
38171
|
try {
|
|
37853
|
-
const
|
|
37854
|
-
const converterContext =
|
|
37855
|
-
docx:
|
|
37856
|
-
numbering:
|
|
37857
|
-
linkedStyles:
|
|
38172
|
+
const converter2 = __privateGet(this, _editor3).converter;
|
|
38173
|
+
const converterContext = converter2 ? {
|
|
38174
|
+
docx: converter2.convertedXml,
|
|
38175
|
+
numbering: converter2.numbering,
|
|
38176
|
+
linkedStyles: converter2.linkedStyles
|
|
37858
38177
|
} : void 0;
|
|
37859
38178
|
const result = toFlowBlocks(docJson, {
|
|
37860
38179
|
mediaFiles: __privateGet(this, _options).mediaFiles,
|
|
@@ -37912,9 +38231,12 @@ rerender_fn = async function() {
|
|
|
37912
38231
|
return;
|
|
37913
38232
|
}
|
|
37914
38233
|
__privateSet(this, _sectionMetadata, sectionMetadata);
|
|
38234
|
+
const converter = __privateGet(this, _editor3).converter;
|
|
38235
|
+
__privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
|
|
37915
38236
|
__privateSet(this, _layoutState, { blocks, measures, layout });
|
|
37916
38237
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
37917
38238
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
38239
|
+
await __privateMethod(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
37918
38240
|
__privateMethod(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
|
|
37919
38241
|
const painter = __privateMethod(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks, measures);
|
|
37920
38242
|
if (typeof painter.setProviders === "function") {
|
|
@@ -37928,6 +38250,10 @@ rerender_fn = async function() {
|
|
|
37928
38250
|
headerMeasures.push(...headerResult.measures);
|
|
37929
38251
|
}
|
|
37930
38252
|
}
|
|
38253
|
+
for (const rIdResult of __privateGet(this, _headerLayoutsByRId).values()) {
|
|
38254
|
+
headerBlocks.push(...rIdResult.blocks);
|
|
38255
|
+
headerMeasures.push(...rIdResult.measures);
|
|
38256
|
+
}
|
|
37931
38257
|
const footerBlocks = [];
|
|
37932
38258
|
const footerMeasures = [];
|
|
37933
38259
|
if (footerLayouts) {
|
|
@@ -37936,6 +38262,10 @@ rerender_fn = async function() {
|
|
|
37936
38262
|
footerMeasures.push(...footerResult.measures);
|
|
37937
38263
|
}
|
|
37938
38264
|
}
|
|
38265
|
+
for (const rIdResult of __privateGet(this, _footerLayoutsByRId).values()) {
|
|
38266
|
+
footerBlocks.push(...rIdResult.blocks);
|
|
38267
|
+
footerMeasures.push(...rIdResult.measures);
|
|
38268
|
+
}
|
|
37939
38269
|
painter.setData?.(
|
|
37940
38270
|
blocks,
|
|
37941
38271
|
measures,
|
|
@@ -37992,6 +38322,10 @@ updateSelection_fn = function() {
|
|
|
37992
38322
|
if (!__privateGet(this, _localSelectionLayer)) {
|
|
37993
38323
|
return;
|
|
37994
38324
|
}
|
|
38325
|
+
if (__privateGet(this, _documentMode) === "viewing") {
|
|
38326
|
+
__privateGet(this, _localSelectionLayer).innerHTML = "";
|
|
38327
|
+
return;
|
|
38328
|
+
}
|
|
37995
38329
|
const layout = __privateGet(this, _layoutState).layout;
|
|
37996
38330
|
const selection = this.getActiveEditor().state?.selection;
|
|
37997
38331
|
__privateGet(this, _localSelectionLayer).innerHTML = "";
|
|
@@ -38041,7 +38375,9 @@ buildHeaderFooterInput_fn = function() {
|
|
|
38041
38375
|
}
|
|
38042
38376
|
const headerBlocks = __privateGet(this, _headerFooterAdapter).getBatch("header");
|
|
38043
38377
|
const footerBlocks = __privateGet(this, _headerFooterAdapter).getBatch("footer");
|
|
38044
|
-
|
|
38378
|
+
const headerBlocksByRId = __privateGet(this, _headerFooterAdapter).getBlocksByRId("header");
|
|
38379
|
+
const footerBlocksByRId = __privateGet(this, _headerFooterAdapter).getBlocksByRId("footer");
|
|
38380
|
+
if (!headerBlocks && !footerBlocks && !headerBlocksByRId && !footerBlocksByRId) {
|
|
38045
38381
|
return null;
|
|
38046
38382
|
}
|
|
38047
38383
|
const constraints = __privateMethod(this, _PresentationEditor_instances, computeHeaderFooterConstraints_fn).call(this);
|
|
@@ -38051,6 +38387,8 @@ buildHeaderFooterInput_fn = function() {
|
|
|
38051
38387
|
return {
|
|
38052
38388
|
headerBlocks,
|
|
38053
38389
|
footerBlocks,
|
|
38390
|
+
headerBlocksByRId,
|
|
38391
|
+
footerBlocksByRId,
|
|
38054
38392
|
constraints
|
|
38055
38393
|
};
|
|
38056
38394
|
};
|
|
@@ -38073,6 +38411,80 @@ computeHeaderFooterConstraints_fn = function() {
|
|
|
38073
38411
|
margins: { left: marginLeft, right: marginRight }
|
|
38074
38412
|
};
|
|
38075
38413
|
};
|
|
38414
|
+
layoutPerRIdHeaderFooters_fn = async function(headerFooterInput, layout, sectionMetadata) {
|
|
38415
|
+
__privateGet(this, _headerLayoutsByRId).clear();
|
|
38416
|
+
__privateGet(this, _footerLayoutsByRId).clear();
|
|
38417
|
+
if (!headerFooterInput) return;
|
|
38418
|
+
const { headerBlocksByRId, footerBlocksByRId, constraints } = headerFooterInput;
|
|
38419
|
+
const displayPages = computeDisplayPageNumber(layout.pages, sectionMetadata);
|
|
38420
|
+
const totalPages = layout.pages.length;
|
|
38421
|
+
const pageResolver = (pageNumber) => {
|
|
38422
|
+
const pageIndex = pageNumber - 1;
|
|
38423
|
+
const displayInfo = displayPages[pageIndex];
|
|
38424
|
+
return {
|
|
38425
|
+
displayText: displayInfo?.displayText ?? String(pageNumber),
|
|
38426
|
+
totalPages
|
|
38427
|
+
};
|
|
38428
|
+
};
|
|
38429
|
+
if (headerBlocksByRId) {
|
|
38430
|
+
for (const [rId, blocks] of headerBlocksByRId) {
|
|
38431
|
+
if (!blocks || blocks.length === 0) continue;
|
|
38432
|
+
try {
|
|
38433
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
38434
|
+
{ default: blocks },
|
|
38435
|
+
// Treat each rId as a 'default' variant
|
|
38436
|
+
constraints,
|
|
38437
|
+
(block, c) => measureBlock(block, c),
|
|
38438
|
+
void 0,
|
|
38439
|
+
// Use shared cache
|
|
38440
|
+
void 0,
|
|
38441
|
+
// No legacy totalPages
|
|
38442
|
+
pageResolver
|
|
38443
|
+
);
|
|
38444
|
+
if (batchResult.default) {
|
|
38445
|
+
__privateGet(this, _headerLayoutsByRId).set(rId, {
|
|
38446
|
+
kind: "header",
|
|
38447
|
+
type: "default",
|
|
38448
|
+
layout: batchResult.default.layout,
|
|
38449
|
+
blocks: batchResult.default.blocks,
|
|
38450
|
+
measures: batchResult.default.measures
|
|
38451
|
+
});
|
|
38452
|
+
}
|
|
38453
|
+
} catch (error) {
|
|
38454
|
+
console.warn(`[PresentationEditor] Failed to layout header rId=${rId}:`, error);
|
|
38455
|
+
}
|
|
38456
|
+
}
|
|
38457
|
+
}
|
|
38458
|
+
if (footerBlocksByRId) {
|
|
38459
|
+
for (const [rId, blocks] of footerBlocksByRId) {
|
|
38460
|
+
if (!blocks || blocks.length === 0) continue;
|
|
38461
|
+
try {
|
|
38462
|
+
const batchResult = await layoutHeaderFooterWithCache(
|
|
38463
|
+
{ default: blocks },
|
|
38464
|
+
// Treat each rId as a 'default' variant
|
|
38465
|
+
constraints,
|
|
38466
|
+
(block, c) => measureBlock(block, c),
|
|
38467
|
+
void 0,
|
|
38468
|
+
// Use shared cache
|
|
38469
|
+
void 0,
|
|
38470
|
+
// No legacy totalPages
|
|
38471
|
+
pageResolver
|
|
38472
|
+
);
|
|
38473
|
+
if (batchResult.default) {
|
|
38474
|
+
__privateGet(this, _footerLayoutsByRId).set(rId, {
|
|
38475
|
+
kind: "footer",
|
|
38476
|
+
type: "default",
|
|
38477
|
+
layout: batchResult.default.layout,
|
|
38478
|
+
blocks: batchResult.default.blocks,
|
|
38479
|
+
measures: batchResult.default.measures
|
|
38480
|
+
});
|
|
38481
|
+
}
|
|
38482
|
+
} catch (error) {
|
|
38483
|
+
console.warn(`[PresentationEditor] Failed to layout footer rId=${rId}:`, error);
|
|
38484
|
+
}
|
|
38485
|
+
}
|
|
38486
|
+
}
|
|
38487
|
+
};
|
|
38076
38488
|
updateDecorationProviders_fn = function(layout) {
|
|
38077
38489
|
__privateSet(this, _headerDecorationProvider, __privateMethod(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "header", layout));
|
|
38078
38490
|
__privateSet(this, _footerDecorationProvider, __privateMethod(this, _PresentationEditor_instances, createDecorationProvider_fn).call(this, "footer", layout));
|
|
@@ -38080,15 +38492,63 @@ updateDecorationProviders_fn = function(layout) {
|
|
|
38080
38492
|
};
|
|
38081
38493
|
createDecorationProvider_fn = function(kind, layout) {
|
|
38082
38494
|
const results = kind === "header" ? __privateGet(this, _headerLayoutResults) : __privateGet(this, _footerLayoutResults);
|
|
38083
|
-
|
|
38495
|
+
const layoutsByRId = kind === "header" ? __privateGet(this, _headerLayoutsByRId) : __privateGet(this, _footerLayoutsByRId);
|
|
38496
|
+
if ((!results || results.length === 0) && layoutsByRId.size === 0) {
|
|
38084
38497
|
return void 0;
|
|
38085
38498
|
}
|
|
38086
|
-
const
|
|
38499
|
+
const multiSectionId = __privateGet(this, _multiSectionIdentifier);
|
|
38500
|
+
const legacyIdentifier = __privateGet(this, _headerFooterIdentifier) ?? extractIdentifierFromConverter(__privateGet(this, _editor3).converter);
|
|
38501
|
+
const sectionFirstPageNumbers = /* @__PURE__ */ new Map();
|
|
38502
|
+
for (const p of layout.pages) {
|
|
38503
|
+
const idx = p.sectionIndex ?? 0;
|
|
38504
|
+
if (!sectionFirstPageNumbers.has(idx)) {
|
|
38505
|
+
sectionFirstPageNumbers.set(idx, p.number);
|
|
38506
|
+
}
|
|
38507
|
+
}
|
|
38087
38508
|
return (pageNumber, pageMargins, page) => {
|
|
38088
|
-
const
|
|
38509
|
+
const sectionIndex = page?.sectionIndex ?? 0;
|
|
38510
|
+
const firstPageInSection = sectionFirstPageNumbers.get(sectionIndex);
|
|
38511
|
+
const sectionPageNumber = typeof firstPageInSection === "number" ? pageNumber - firstPageInSection + 1 : pageNumber;
|
|
38512
|
+
const headerFooterType = multiSectionId ? getHeaderFooterTypeForSection(pageNumber, sectionIndex, multiSectionId, { kind, sectionPageNumber }) : getHeaderFooterType(pageNumber, legacyIdentifier, { kind });
|
|
38513
|
+
const sectionRId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
|
|
38089
38514
|
if (!headerFooterType) {
|
|
38090
38515
|
return null;
|
|
38091
38516
|
}
|
|
38517
|
+
if (sectionRId && layoutsByRId.has(sectionRId)) {
|
|
38518
|
+
const rIdLayout = layoutsByRId.get(sectionRId);
|
|
38519
|
+
const slotPage2 = __privateMethod(this, _PresentationEditor_instances, findHeaderFooterPageForPageNumber_fn).call(this, rIdLayout.layout.pages, pageNumber);
|
|
38520
|
+
if (slotPage2) {
|
|
38521
|
+
const fragments2 = slotPage2.fragments ?? [];
|
|
38522
|
+
const pageHeight2 = page?.size?.h ?? layout.pageSize?.h ?? __privateGet(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
38523
|
+
const margins2 = pageMargins ?? layout.pages[0]?.margins ?? __privateGet(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
38524
|
+
const box2 = __privateMethod(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins2, pageHeight2);
|
|
38525
|
+
return {
|
|
38526
|
+
fragments: fragments2,
|
|
38527
|
+
height: box2.height,
|
|
38528
|
+
contentHeight: rIdLayout.layout.height ?? box2.height,
|
|
38529
|
+
offset: box2.offset,
|
|
38530
|
+
marginLeft: box2.x,
|
|
38531
|
+
contentWidth: box2.width,
|
|
38532
|
+
headerId: sectionRId,
|
|
38533
|
+
sectionType: headerFooterType,
|
|
38534
|
+
box: {
|
|
38535
|
+
x: box2.x,
|
|
38536
|
+
y: box2.offset,
|
|
38537
|
+
width: box2.width,
|
|
38538
|
+
height: box2.height
|
|
38539
|
+
},
|
|
38540
|
+
hitRegion: {
|
|
38541
|
+
x: box2.x,
|
|
38542
|
+
y: box2.offset,
|
|
38543
|
+
width: box2.width,
|
|
38544
|
+
height: box2.height
|
|
38545
|
+
}
|
|
38546
|
+
};
|
|
38547
|
+
}
|
|
38548
|
+
}
|
|
38549
|
+
if (!results || results.length === 0) {
|
|
38550
|
+
return null;
|
|
38551
|
+
}
|
|
38092
38552
|
const variant = results.find((entry) => entry.type === headerFooterType);
|
|
38093
38553
|
if (!variant || !variant.layout?.pages?.length) {
|
|
38094
38554
|
return null;
|
|
@@ -38101,9 +38561,8 @@ createDecorationProvider_fn = function(kind, layout) {
|
|
|
38101
38561
|
const pageHeight = page?.size?.h ?? layout.pageSize?.h ?? __privateGet(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
38102
38562
|
const margins = pageMargins ?? layout.pages[0]?.margins ?? __privateGet(this, _layoutOptions).margins ?? DEFAULT_MARGINS;
|
|
38103
38563
|
const box = __privateMethod(this, _PresentationEditor_instances, computeDecorationBox_fn).call(this, kind, margins, pageHeight);
|
|
38104
|
-
const headerId = page?.sectionRefs && kind === "header" ? page.sectionRefs.headerRefs?.[headerFooterType] ?? void 0 : page?.sectionRefs && kind === "footer" ? page.sectionRefs.footerRefs?.[headerFooterType] ?? void 0 : void 0;
|
|
38105
38564
|
const fallbackId = __privateGet(this, _headerFooterManager)?.getVariantId(kind, headerFooterType);
|
|
38106
|
-
const finalHeaderId =
|
|
38565
|
+
const finalHeaderId = sectionRId ?? fallbackId ?? void 0;
|
|
38107
38566
|
return {
|
|
38108
38567
|
fragments,
|
|
38109
38568
|
height: box.height,
|
|
@@ -38351,7 +38810,8 @@ enterHeaderFooterMode_fn = async function(region) {
|
|
|
38351
38810
|
const doc2 = editor.state?.doc;
|
|
38352
38811
|
if (doc2) {
|
|
38353
38812
|
const endPos = doc2.content.size - 1;
|
|
38354
|
-
|
|
38813
|
+
const pos = Math.max(1, endPos);
|
|
38814
|
+
editor.commands?.setTextSelection?.({ from: pos, to: pos });
|
|
38355
38815
|
}
|
|
38356
38816
|
} catch (cursorError) {
|
|
38357
38817
|
console.warn("[PresentationEditor] Could not set cursor to end:", cursorError);
|
|
@@ -39227,11 +39687,28 @@ _PresentationEditor.CURSOR_STYLES = {
|
|
|
39227
39687
|
};
|
|
39228
39688
|
let PresentationEditor = _PresentationEditor;
|
|
39229
39689
|
class PresentationInputBridge {
|
|
39230
|
-
|
|
39690
|
+
/**
|
|
39691
|
+
* Creates a new PresentationInputBridge that forwards user input events from the visible layout
|
|
39692
|
+
* surface to the hidden editor DOM. This enables input handling when the actual editor is not
|
|
39693
|
+
* directly visible to the user.
|
|
39694
|
+
*
|
|
39695
|
+
* @param windowRoot - The window object containing the layout surface and editor target
|
|
39696
|
+
* @param layoutSurface - The visible HTML element that receives user input events (e.g., keyboard, mouse)
|
|
39697
|
+
* @param getTargetDom - Callback that returns the hidden editor's DOM element where events should be forwarded
|
|
39698
|
+
* @param isEditable - Callback that returns whether the editor is in an editable mode (editing/suggesting).
|
|
39699
|
+
* When this returns false (e.g., in viewing mode), keyboard, text, and composition
|
|
39700
|
+
* events will not be forwarded to prevent document modification.
|
|
39701
|
+
* @param onTargetChanged - Optional callback invoked when the target editor DOM element changes
|
|
39702
|
+
* @param options - Optional configuration including:
|
|
39703
|
+
* - useWindowFallback: Whether to attach window-level event listeners as fallback
|
|
39704
|
+
*/
|
|
39705
|
+
constructor(windowRoot, layoutSurface, getTargetDom, isEditable, onTargetChanged, options) {
|
|
39231
39706
|
__privateAdd(this, _PresentationInputBridge_instances);
|
|
39232
39707
|
__privateAdd(this, _windowRoot);
|
|
39233
39708
|
__privateAdd(this, _layoutSurfaces);
|
|
39234
39709
|
__privateAdd(this, _getTargetDom);
|
|
39710
|
+
/** Callback that returns whether the editor is in an editable mode (editing/suggesting vs viewing) */
|
|
39711
|
+
__privateAdd(this, _isEditable);
|
|
39235
39712
|
__privateAdd(this, _onTargetChanged);
|
|
39236
39713
|
__privateAdd(this, _listeners);
|
|
39237
39714
|
__privateAdd(this, _currentTarget, null);
|
|
@@ -39240,6 +39717,7 @@ class PresentationInputBridge {
|
|
|
39240
39717
|
__privateSet(this, _windowRoot, windowRoot);
|
|
39241
39718
|
__privateSet(this, _layoutSurfaces, /* @__PURE__ */ new Set([layoutSurface]));
|
|
39242
39719
|
__privateSet(this, _getTargetDom, getTargetDom);
|
|
39720
|
+
__privateSet(this, _isEditable, isEditable);
|
|
39243
39721
|
__privateSet(this, _onTargetChanged, onTargetChanged);
|
|
39244
39722
|
__privateSet(this, _listeners, []);
|
|
39245
39723
|
__privateSet(this, _useWindowFallback, options?.useWindowFallback ?? false);
|
|
@@ -39306,6 +39784,7 @@ class PresentationInputBridge {
|
|
|
39306
39784
|
_windowRoot = new WeakMap();
|
|
39307
39785
|
_layoutSurfaces = new WeakMap();
|
|
39308
39786
|
_getTargetDom = new WeakMap();
|
|
39787
|
+
_isEditable = new WeakMap();
|
|
39309
39788
|
_onTargetChanged = new WeakMap();
|
|
39310
39789
|
_listeners = new WeakMap();
|
|
39311
39790
|
_currentTarget = new WeakMap();
|
|
@@ -39343,6 +39822,9 @@ dispatchToTarget_fn = function(originalEvent, synthetic) {
|
|
|
39343
39822
|
* @param event - The keyboard event from the layout surface
|
|
39344
39823
|
*/
|
|
39345
39824
|
forwardKeyboardEvent_fn = function(event) {
|
|
39825
|
+
if (!__privateGet(this, _isEditable).call(this)) {
|
|
39826
|
+
return;
|
|
39827
|
+
}
|
|
39346
39828
|
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
39347
39829
|
return;
|
|
39348
39830
|
}
|
|
@@ -39376,6 +39858,9 @@ forwardKeyboardEvent_fn = function(event) {
|
|
|
39376
39858
|
* @param event - The input event from the layout surface
|
|
39377
39859
|
*/
|
|
39378
39860
|
forwardTextEvent_fn = function(event) {
|
|
39861
|
+
if (!__privateGet(this, _isEditable).call(this)) {
|
|
39862
|
+
return;
|
|
39863
|
+
}
|
|
39379
39864
|
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
39380
39865
|
return;
|
|
39381
39866
|
}
|
|
@@ -39412,6 +39897,9 @@ forwardTextEvent_fn = function(event) {
|
|
|
39412
39897
|
* @param event - The composition event from the layout surface
|
|
39413
39898
|
*/
|
|
39414
39899
|
forwardCompositionEvent_fn = function(event) {
|
|
39900
|
+
if (!__privateGet(this, _isEditable).call(this)) {
|
|
39901
|
+
return;
|
|
39902
|
+
}
|
|
39415
39903
|
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
39416
39904
|
return;
|
|
39417
39905
|
}
|
|
@@ -39436,6 +39924,9 @@ forwardCompositionEvent_fn = function(event) {
|
|
|
39436
39924
|
* @param event - The context menu event from the layout surface
|
|
39437
39925
|
*/
|
|
39438
39926
|
forwardContextMenu_fn = function(event) {
|
|
39927
|
+
if (!__privateGet(this, _isEditable).call(this)) {
|
|
39928
|
+
return;
|
|
39929
|
+
}
|
|
39439
39930
|
if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
|
|
39440
39931
|
return;
|
|
39441
39932
|
}
|