superdoc 1.0.0-beta.22 → 1.0.0-beta.24

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.
Files changed (27) hide show
  1. package/dist/chunks/{PdfViewer-CswYWp1h.cjs → PdfViewer-CK4E4ACv.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-B42JCeYb.es.js → PdfViewer-CiBsNO1v.es.js} +1 -1
  3. package/dist/chunks/{index-DBmh710D.es.js → index-6o2OEd1U.es.js} +3 -3
  4. package/dist/chunks/{index-CK4eX_iu.cjs → index-B50-Rjff.cjs} +3 -3
  5. package/dist/chunks/{index-895wSAjT-C4ksiI6n.es.js → index-CL73U2p8-BdN7dtTr.es.js} +1 -1
  6. package/dist/chunks/{index-895wSAjT-CWlZl8zz.cjs → index-CL73U2p8-D3kkjumx.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-V792hb-6.es.js → super-editor.es-DMX5nMSJ.es.js} +5825 -153
  8. package/dist/chunks/{super-editor.es-BkRizaIE.cjs → super-editor.es-Dry7yajX.cjs} +5825 -153
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-DhkZt4Pv.js → converter-C_ULWSY6.js} +5537 -69
  11. package/dist/super-editor/chunks/{docx-zipper-Bajmc-RM.js → docx-zipper-Be0umi4U.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-oZjoYNA0.js → editor-CtOkDN-3.js} +271 -55
  13. package/dist/super-editor/chunks/{index-895wSAjT.js → index-CL73U2p8.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-Bn5LTbq9.js → toolbar-COfsDMDg.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +5866 -194
  26. package/dist/superdoc.umd.js.map +1 -1
  27. 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, _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;
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, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, hideDimmingOverlay_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 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";
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-C_ULWSY6.js";
16
+ import { D as DocxZipper } from "./docx-zipper-Be0umi4U.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() {
@@ -13905,7 +13905,7 @@ const isHeadless = (editor) => {
13905
13905
  const shouldSkipNodeView = (editor) => {
13906
13906
  return isHeadless(editor);
13907
13907
  };
13908
- const summaryVersion = "1.0.0-beta.22";
13908
+ const summaryVersion = "1.0.0-beta.24";
13909
13909
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
13910
13910
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
13911
13911
  function mapAttributes(attrs) {
@@ -14697,7 +14697,7 @@ const _Editor = class _Editor extends EventEmitter {
14697
14697
  { default: remarkStringify },
14698
14698
  { default: remarkGfm }
14699
14699
  ] = await Promise.all([
14700
- import("./index-895wSAjT.js"),
14700
+ import("./index-CL73U2p8.js"),
14701
14701
  import("./index-DRCvimau.js"),
14702
14702
  import("./index-C_x_N6Uh.js"),
14703
14703
  import("./index-D_sWOSiG.js"),
@@ -14902,7 +14902,7 @@ const _Editor = class _Editor extends EventEmitter {
14902
14902
  * Process collaboration migrations
14903
14903
  */
14904
14904
  processCollaborationMigrations() {
14905
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.22");
14905
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.24");
14906
14906
  if (!this.options.ydoc) return;
14907
14907
  const metaMap = this.options.ydoc.getMap("meta");
14908
14908
  let docVersion = metaMap.get("version");
@@ -15258,7 +15258,9 @@ createConverter_fn = function() {
15258
15258
  debug: true,
15259
15259
  telemetry: this.options.telemetry,
15260
15260
  fileSource: this.options.fileSource,
15261
- documentId: this.options.documentId
15261
+ documentId: this.options.documentId,
15262
+ mockWindow: this.options.mockWindow ?? null,
15263
+ mockDocument: this.options.mockDocument ?? null
15262
15264
  });
15263
15265
  }
15264
15266
  };
@@ -17442,6 +17444,11 @@ const normalizeAlignment = (value) => {
17442
17444
  case "right":
17443
17445
  case "justify":
17444
17446
  return value;
17447
+ case "both":
17448
+ case "distribute":
17449
+ case "numTab":
17450
+ case "thaiDistribute":
17451
+ return "justify";
17445
17452
  case "end":
17446
17453
  return "right";
17447
17454
  case "start":
@@ -19656,6 +19663,11 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
19656
19663
  } else if (computed2.paragraph.alignment) {
19657
19664
  paragraphAttrs.alignment = computed2.paragraph.alignment;
19658
19665
  }
19666
+ const isJustified = paragraphAttrs.alignment === "justify" || paragraphAttrs.alignment === "both";
19667
+ const hasFirstLineIndent = normalizedIndent?.firstLine && normalizedIndent.firstLine > 0;
19668
+ if (isJustified && hasFirstLineIndent) {
19669
+ paragraphAttrs.suppressFirstLineIndent = true;
19670
+ }
19659
19671
  const spacingPx = spacingPtToPx(spacing, normalizedSpacing);
19660
19672
  if (spacingPx) paragraphAttrs.spacing = spacingPx;
19661
19673
  if (normalizedSpacing?.beforeAutospacing != null || normalizedSpacing?.afterAutospacing != null) {
@@ -19873,7 +19885,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
19873
19885
  }
19874
19886
  }
19875
19887
  paragraphAttrs.wordLayout = wordLayout;
19876
- if (enrichedNumberingProps.resolvedLevelIndent) {
19888
+ if (enrichedNumberingProps.resolvedLevelIndent && !hasExplicitIndent) {
19877
19889
  const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
19878
19890
  paragraphAttrs.indent = {
19879
19891
  ...paragraphAttrs.indent,
@@ -20505,10 +20517,18 @@ function isInlineImage(node) {
20505
20517
  const attrs = node.attrs ?? {};
20506
20518
  const wrap = attrs.wrap;
20507
20519
  const rawWrapType = wrap?.type;
20508
- if (rawWrapType === "Inline") return true;
20509
- if (rawWrapType && rawWrapType !== "Inline") return false;
20510
- if (attrs.inline === true) return true;
20511
- if (attrs.display === "inline") return true;
20520
+ if (rawWrapType === "Inline") {
20521
+ return true;
20522
+ }
20523
+ if (rawWrapType && rawWrapType !== "Inline") {
20524
+ return false;
20525
+ }
20526
+ if (attrs.inline === true) {
20527
+ return true;
20528
+ }
20529
+ if (attrs.display === "inline") {
20530
+ return true;
20531
+ }
20512
20532
  return false;
20513
20533
  }
20514
20534
  function imageNodeToRun(node, positions, activeSdt) {
@@ -20965,7 +20985,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
20965
20985
  return;
20966
20986
  }
20967
20987
  if (node.type === "image") {
20968
- if (isInlineImage(node)) {
20988
+ const isInline2 = isInlineImage(node);
20989
+ if (isInline2) {
20969
20990
  const imageRun = imageNodeToRun(node, positions, activeSdt);
20970
20991
  if (imageRun) {
20971
20992
  currentRuns.push(imageRun);
@@ -23239,8 +23260,14 @@ function computeNextSectionPropsAtBreak(blocks) {
23239
23260
  });
23240
23261
  return nextSectionPropsAtBreak;
23241
23262
  }
23242
- function scheduleSectionBreak(block, state, baseMargins) {
23263
+ function scheduleSectionBreak(block, state, baseMargins, maxHeaderContentHeight = 0) {
23243
23264
  const next = { ...state };
23265
+ const calcRequiredTopMargin = (headerDistance, baseTop) => {
23266
+ if (maxHeaderContentHeight > 0) {
23267
+ return Math.max(baseTop, headerDistance + maxHeaderContentHeight);
23268
+ }
23269
+ return Math.max(baseTop, headerDistance);
23270
+ };
23244
23271
  if (block.attrs?.isFirstSection && !next.hasAnyPages) {
23245
23272
  if (block.pageSize) {
23246
23273
  next.activePageSize = { w: block.pageSize.w, h: block.pageSize.h };
@@ -23254,7 +23281,7 @@ function scheduleSectionBreak(block, state, baseMargins) {
23254
23281
  const headerDistance = Math.max(0, block.margins.header);
23255
23282
  next.activeHeaderDistance = headerDistance;
23256
23283
  next.pendingHeaderDistance = headerDistance;
23257
- next.activeTopMargin = Math.max(baseMargins.top, headerDistance);
23284
+ next.activeTopMargin = calcRequiredTopMargin(headerDistance, baseMargins.top);
23258
23285
  next.pendingTopMargin = next.activeTopMargin;
23259
23286
  }
23260
23287
  if (block.margins?.footer !== void 0) {
@@ -23276,9 +23303,15 @@ function scheduleSectionBreak(block, state, baseMargins) {
23276
23303
  const nextBottom = next.pendingBottomMargin ?? next.activeBottomMargin;
23277
23304
  const nextHeader = next.pendingHeaderDistance ?? next.activeHeaderDistance;
23278
23305
  const nextFooter = next.pendingFooterDistance ?? next.activeFooterDistance;
23279
- next.pendingTopMargin = typeof headerPx === "number" ? Math.max(baseMargins.top, headerPx) : nextTop;
23306
+ if (typeof headerPx === "number") {
23307
+ const newHeaderDist = Math.max(0, headerPx);
23308
+ next.pendingHeaderDistance = newHeaderDist;
23309
+ next.pendingTopMargin = calcRequiredTopMargin(newHeaderDist, baseMargins.top);
23310
+ } else {
23311
+ next.pendingTopMargin = nextTop;
23312
+ next.pendingHeaderDistance = nextHeader;
23313
+ }
23280
23314
  next.pendingBottomMargin = typeof footerPx === "number" ? Math.max(baseMargins.bottom, footerPx) : nextBottom;
23281
- next.pendingHeaderDistance = typeof headerPx === "number" ? Math.max(0, headerPx) : nextHeader;
23282
23315
  next.pendingFooterDistance = typeof footerPx === "number" ? Math.max(0, footerPx) : nextFooter;
23283
23316
  if (block.pageSize) {
23284
23317
  next.pendingPageSize = { w: block.pageSize.w, h: block.pageSize.h };
@@ -24743,7 +24776,22 @@ function layoutDocument(blocks, measures, options = {}) {
24743
24776
  if (contentWidth <= 0) {
24744
24777
  throw new Error("layoutDocument: pageSize and margins yield non-positive content area");
24745
24778
  }
24746
- let activeTopMargin = margins.top;
24779
+ const validateHeaderHeight = (height) => {
24780
+ if (height === void 0) return 0;
24781
+ if (!Number.isFinite(height) || height < 0) return 0;
24782
+ return height;
24783
+ };
24784
+ const headerContentHeights = options.headerContentHeights;
24785
+ const maxHeaderContentHeight = headerContentHeights ? Math.max(
24786
+ 0,
24787
+ validateHeaderHeight(headerContentHeights.default),
24788
+ validateHeaderHeight(headerContentHeights.first),
24789
+ validateHeaderHeight(headerContentHeights.even),
24790
+ validateHeaderHeight(headerContentHeights.odd)
24791
+ ) : 0;
24792
+ const headerDistance = margins.header ?? margins.top;
24793
+ const effectiveTopMargin = maxHeaderContentHeight > 0 ? Math.max(margins.top, headerDistance + maxHeaderContentHeight) : margins.top;
24794
+ let activeTopMargin = effectiveTopMargin;
24747
24795
  let activeBottomMargin = margins.bottom;
24748
24796
  let pendingTopMargin = null;
24749
24797
  let pendingBottomMargin = null;
@@ -24767,7 +24815,7 @@ function layoutDocument(blocks, measures, options = {}) {
24767
24815
  const nextSectionPropsAtBreak = computeNextSectionPropsAtBreak(blocks);
24768
24816
  const scheduleSectionBreakCompat = (block, state, baseMargins) => {
24769
24817
  if (typeof scheduleSectionBreak === "function") {
24770
- return scheduleSectionBreak(block, state, baseMargins);
24818
+ return scheduleSectionBreak(block, state, baseMargins, maxHeaderContentHeight);
24771
24819
  }
24772
24820
  const next = { ...state };
24773
24821
  if (block.attrs?.isFirstSection && !next.hasAnyPages) {
@@ -24780,10 +24828,11 @@ function layoutDocument(blocks, measures, options = {}) {
24780
24828
  next.pendingOrientation = null;
24781
24829
  }
24782
24830
  if (block.margins?.header !== void 0) {
24783
- const headerDistance = Math.max(0, block.margins.header);
24784
- next.activeHeaderDistance = headerDistance;
24785
- next.pendingHeaderDistance = headerDistance;
24786
- next.activeTopMargin = Math.max(baseMargins.top, headerDistance);
24831
+ const headerDist = Math.max(0, block.margins.header);
24832
+ next.activeHeaderDistance = headerDist;
24833
+ next.pendingHeaderDistance = headerDist;
24834
+ const requiredTop = maxHeaderContentHeight > 0 ? headerDist + maxHeaderContentHeight : headerDist;
24835
+ next.activeTopMargin = Math.max(baseMargins.top, requiredTop);
24787
24836
  next.pendingTopMargin = next.activeTopMargin;
24788
24837
  }
24789
24838
  if (block.margins?.footer !== void 0) {
@@ -24820,14 +24869,22 @@ function layoutDocument(blocks, measures, options = {}) {
24820
24869
  }
24821
24870
  const headerPx = block.margins?.header;
24822
24871
  const footerPx = block.margins?.footer;
24872
+ const topPx = block.margins?.top;
24823
24873
  const nextTop = next.pendingTopMargin ?? next.activeTopMargin;
24824
24874
  const nextBottom = next.pendingBottomMargin ?? next.activeBottomMargin;
24825
24875
  const nextHeader = next.pendingHeaderDistance ?? next.activeHeaderDistance;
24826
24876
  const nextFooter = next.pendingFooterDistance ?? next.activeFooterDistance;
24827
- next.pendingTopMargin = typeof headerPx === "number" ? Math.max(baseMargins.top, headerPx) : nextTop;
24828
- next.pendingBottomMargin = typeof footerPx === "number" ? Math.max(baseMargins.bottom, footerPx) : nextBottom;
24829
24877
  next.pendingHeaderDistance = typeof headerPx === "number" ? Math.max(0, headerPx) : nextHeader;
24830
24878
  next.pendingFooterDistance = typeof footerPx === "number" ? Math.max(0, footerPx) : nextFooter;
24879
+ if (typeof headerPx === "number" || typeof topPx === "number") {
24880
+ const sectionTop = topPx ?? baseMargins.top;
24881
+ const sectionHeader = next.pendingHeaderDistance;
24882
+ const requiredTop = maxHeaderContentHeight > 0 ? sectionHeader + maxHeaderContentHeight : sectionHeader;
24883
+ next.pendingTopMargin = Math.max(sectionTop, requiredTop);
24884
+ } else {
24885
+ next.pendingTopMargin = nextTop;
24886
+ }
24887
+ next.pendingBottomMargin = typeof footerPx === "number" ? Math.max(baseMargins.bottom, footerPx) : nextBottom;
24831
24888
  if (block.pageSize) next.pendingPageSize = { w: block.pageSize.w, h: block.pageSize.h };
24832
24889
  if (block.orientation) next.pendingOrientation = block.orientation;
24833
24890
  const sectionType = block.type ?? "continuous";
@@ -25107,7 +25164,7 @@ function layoutDocument(blocks, measures, options = {}) {
25107
25164
  let effectiveBlock = block;
25108
25165
  const ahead = nextSectionPropsAtBreak.get(index2);
25109
25166
  const hasSectionIndex = typeof effectiveBlock.attrs?.sectionIndex === "number";
25110
- if (ahead && effectiveBlock.attrs?.source === "sectPr" && !hasSectionIndex) {
25167
+ if (ahead && effectiveBlock.attrs?.source === "sectPr" && !hasSectionIndex && ahead) {
25111
25168
  effectiveBlock = {
25112
25169
  ...effectiveBlock,
25113
25170
  margins: ahead.margins ? { ...effectiveBlock.margins ?? {}, ...ahead.margins } : effectiveBlock.margins ?? {},
@@ -25578,7 +25635,7 @@ const resolveTrackedChangesEnabled = (attrs, defaultEnabled = true) => {
25578
25635
  }
25579
25636
  return attrs.trackedChangesEnabled !== false;
25580
25637
  };
25581
- const MAX_CACHE_SIZE = 1e4;
25638
+ const MAX_CACHE_SIZE$1 = 1e4;
25582
25639
  const BYTES_PER_ENTRY_ESTIMATE = 5e3;
25583
25640
  const NORMALIZED_WHITESPACE = /\s+/g;
25584
25641
  const normalizeText = (text) => text.replace(NORMALIZED_WHITESPACE, " ");
@@ -25587,6 +25644,11 @@ const hashRuns = (block) => {
25587
25644
  const trackedMode = block.attrs && "trackedChangesMode" in block.attrs && block.attrs.trackedChangesMode || "review";
25588
25645
  const trackedEnabled = resolveTrackedChangesEnabled(block.attrs, true);
25589
25646
  const runsHash = block.runs.map((run) => {
25647
+ if (run.kind === "image") {
25648
+ const imgRun = run;
25649
+ const srcHash = imgRun.src.slice(0, 50);
25650
+ return `img:${srcHash}:${imgRun.width}x${imgRun.height}`;
25651
+ }
25590
25652
  const text = normalizeText(
25591
25653
  "src" in run || run.kind === "lineBreak" || run.kind === "break" ? "" : run.text ?? ""
25592
25654
  );
@@ -25678,7 +25740,7 @@ class MeasureCache {
25678
25740
  if (this.cache.has(key2)) {
25679
25741
  this.cache.delete(key2);
25680
25742
  }
25681
- if (this.cache.size >= MAX_CACHE_SIZE) {
25743
+ if (this.cache.size >= MAX_CACHE_SIZE$1) {
25682
25744
  const oldestKey = this.cache.keys().next().value;
25683
25745
  if (oldestKey !== void 0) {
25684
25746
  this.cache.delete(oldestKey);
@@ -25752,13 +25814,13 @@ class MeasureCache {
25752
25814
  * Get maximum cache size
25753
25815
  */
25754
25816
  getMaxSize() {
25755
- return MAX_CACHE_SIZE;
25817
+ return MAX_CACHE_SIZE$1;
25756
25818
  }
25757
25819
  /**
25758
25820
  * Check if cache is near capacity
25759
25821
  */
25760
25822
  isNearCapacity(threshold = 0.9) {
25761
- return this.cache.size >= MAX_CACHE_SIZE * threshold;
25823
+ return this.cache.size >= MAX_CACHE_SIZE$1 * threshold;
25762
25824
  }
25763
25825
  /**
25764
25826
  * Update size statistics
@@ -26770,9 +26832,46 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
26770
26832
  perfLog(
26771
26833
  `[Perf] 4.1 Measure all blocks: ${(measureEnd - measureStart).toFixed(2)}ms (${cacheMisses} measured, ${cacheHits} cached)`
26772
26834
  );
26835
+ let headerContentHeights;
26836
+ if (headerFooter?.constraints && headerFooter.headerBlocks) {
26837
+ const hfPreStart = performance.now();
26838
+ const measureFn = headerFooter.measure ?? measureBlock2;
26839
+ invalidateHeaderFooterCache(
26840
+ headerMeasureCache,
26841
+ headerFooterCacheState,
26842
+ headerFooter.headerBlocks,
26843
+ headerFooter.footerBlocks,
26844
+ headerFooter.constraints,
26845
+ options.sectionMetadata
26846
+ );
26847
+ const HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT = 1;
26848
+ const preHeaderLayouts = await layoutHeaderFooterWithCache(
26849
+ headerFooter.headerBlocks,
26850
+ headerFooter.constraints,
26851
+ measureFn,
26852
+ headerMeasureCache,
26853
+ HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
26854
+ void 0
26855
+ // No page resolver needed for height calculation
26856
+ );
26857
+ const isValidHeaderType = (key2) => {
26858
+ return ["default", "first", "even", "odd"].includes(key2);
26859
+ };
26860
+ headerContentHeights = {};
26861
+ for (const [type, value] of Object.entries(preHeaderLayouts)) {
26862
+ if (!isValidHeaderType(type)) continue;
26863
+ if (value?.layout && typeof value.layout.height === "number") {
26864
+ headerContentHeights[type] = value.layout.height;
26865
+ }
26866
+ }
26867
+ const hfPreEnd = performance.now();
26868
+ perfLog(`[Perf] 4.1.5 Pre-layout headers for height: ${(hfPreEnd - hfPreStart).toFixed(2)}ms`);
26869
+ }
26773
26870
  const layoutStart = performance.now();
26774
26871
  let layout = layoutDocument(nextBlocks, measures, {
26775
26872
  ...options,
26873
+ headerContentHeights,
26874
+ // Pass header heights to prevent overlap
26776
26875
  remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
26777
26876
  });
26778
26877
  const layoutEnd = performance.now();
@@ -26819,6 +26918,8 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
26819
26918
  const relayoutStart = performance.now();
26820
26919
  layout = layoutDocument(currentBlocks, currentMeasures, {
26821
26920
  ...options,
26921
+ headerContentHeights,
26922
+ // Pass header heights to prevent overlap
26822
26923
  remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
26823
26924
  });
26824
26925
  const relayoutEnd = performance.now();
@@ -29868,7 +29969,12 @@ const lineStyles = (lineHeight) => ({
29868
29969
  height: `${lineHeight}px`,
29869
29970
  position: "relative",
29870
29971
  display: "block",
29871
- whiteSpace: "pre"
29972
+ whiteSpace: "pre",
29973
+ // Allow text to overflow the line container as a safety net.
29974
+ // The primary fix uses accurate font metrics from Canvas API, but this
29975
+ // provides defense-in-depth against any remaining sub-pixel rendering
29976
+ // differences between measurement and display.
29977
+ overflow: "visible"
29872
29978
  });
29873
29979
  const PRINT_STYLES = `
29874
29980
  @media print {
@@ -31434,7 +31540,8 @@ const _DomPainter = class _DomPainter {
31434
31540
  const paraIndent = block.attrs?.indent;
31435
31541
  const paraIndentLeft = paraIndent?.left ?? 0;
31436
31542
  const paraIndentRight = paraIndent?.right ?? 0;
31437
- const firstLineOffset = (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
31543
+ const suppressFirstLineIndent = block.attrs?.suppressFirstLineIndent === true;
31544
+ const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
31438
31545
  lines.forEach((line, index2) => {
31439
31546
  const lineEl = this.renderLine(block, line, context);
31440
31547
  const isListFirstLine = index2 === 0 && !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
@@ -33623,6 +33730,61 @@ function evictIfNeeded() {
33623
33730
  cache$1.delete(oldestKey);
33624
33731
  }
33625
33732
  }
33733
+ const fontMetricsCache = /* @__PURE__ */ new Map();
33734
+ const MAX_CACHE_SIZE = 1e3;
33735
+ const METRICS_TEST_STRING = "MHgypbdlÁÉÍ";
33736
+ function getFontKey(fontInfo) {
33737
+ return `${fontInfo.fontFamily}|${fontInfo.fontSize}|${fontInfo.bold ?? false}|${fontInfo.italic ?? false}`;
33738
+ }
33739
+ function buildFontStringForMetrics(fontInfo, mode, fonts) {
33740
+ const parts = [];
33741
+ if (fontInfo.italic) parts.push("italic");
33742
+ if (fontInfo.bold) parts.push("bold");
33743
+ parts.push(`${fontInfo.fontSize}px`);
33744
+ {
33745
+ parts.push(fontInfo.fontFamily);
33746
+ }
33747
+ return parts.join(" ");
33748
+ }
33749
+ function getFontMetrics(ctx2, fontInfo, mode, fonts) {
33750
+ if (!ctx2 || typeof ctx2 !== "object") {
33751
+ throw new TypeError("Canvas context must be a valid CanvasRenderingContext2D object");
33752
+ }
33753
+ if (typeof fontInfo.fontSize !== "number" || !Number.isFinite(fontInfo.fontSize) || fontInfo.fontSize <= 0) {
33754
+ throw new TypeError(
33755
+ `Font size must be a positive finite number, got: ${typeof fontInfo.fontSize === "number" ? fontInfo.fontSize : typeof fontInfo.fontSize}`
33756
+ );
33757
+ }
33758
+ if (typeof fontInfo.fontFamily !== "string" || fontInfo.fontFamily.trim().length === 0) {
33759
+ throw new TypeError("Font family must be a non-empty string");
33760
+ }
33761
+ const key2 = getFontKey(fontInfo);
33762
+ const cached = fontMetricsCache.get(key2);
33763
+ if (cached) {
33764
+ return cached;
33765
+ }
33766
+ const font = buildFontStringForMetrics(fontInfo);
33767
+ ctx2.font = font;
33768
+ const textMetrics = ctx2.measureText(METRICS_TEST_STRING);
33769
+ let ascent;
33770
+ let descent;
33771
+ if (typeof textMetrics.actualBoundingBoxAscent === "number" && typeof textMetrics.actualBoundingBoxDescent === "number" && textMetrics.actualBoundingBoxAscent > 0) {
33772
+ ascent = textMetrics.actualBoundingBoxAscent;
33773
+ descent = textMetrics.actualBoundingBoxDescent;
33774
+ } else {
33775
+ ascent = fontInfo.fontSize * 0.8;
33776
+ descent = fontInfo.fontSize * 0.2;
33777
+ }
33778
+ const result = { ascent, descent };
33779
+ if (fontMetricsCache.size >= MAX_CACHE_SIZE) {
33780
+ const firstKey = fontMetricsCache.keys().next().value;
33781
+ if (firstKey) {
33782
+ fontMetricsCache.delete(firstKey);
33783
+ }
33784
+ }
33785
+ fontMetricsCache.set(key2, result);
33786
+ return result;
33787
+ }
33626
33788
  const { computeTabStops } = Engines;
33627
33789
  let canvasContext = null;
33628
33790
  const DEFAULT_TAB_INTERVAL_TWIPS = 720;
@@ -33670,10 +33832,20 @@ function measureText(text, font, ctx2, _fontFamily, _letterSpacing) {
33670
33832
  return Math.max(advanceWidth, paintedWidth);
33671
33833
  }
33672
33834
  const MIN_SINGLE_LINE_PX = 12 * 96 / 72;
33673
- function calculateTypographyMetrics(fontSize, spacing) {
33674
- const ascent = roundValue(fontSize * 0.8);
33675
- const descent = roundValue(fontSize * 0.2);
33676
- const baseLineHeight = Math.max(fontSize, MIN_SINGLE_LINE_PX);
33835
+ const LINE_HEIGHT_SAFETY_MARGIN_PX = 1;
33836
+ function calculateTypographyMetrics(fontSize, spacing, fontInfo) {
33837
+ let ascent;
33838
+ let descent;
33839
+ if (fontInfo) {
33840
+ const ctx2 = getCanvasContext();
33841
+ const metrics = getFontMetrics(ctx2, fontInfo);
33842
+ ascent = roundValue(metrics.ascent);
33843
+ descent = roundValue(metrics.descent);
33844
+ } else {
33845
+ ascent = roundValue(fontSize * 0.8);
33846
+ descent = roundValue(fontSize * 0.2);
33847
+ }
33848
+ const baseLineHeight = Math.max(ascent + descent + LINE_HEIGHT_SAFETY_MARGIN_PX, MIN_SINGLE_LINE_PX);
33677
33849
  const lineHeight = roundValue(resolveLineHeight(spacing, baseLineHeight));
33678
33850
  return {
33679
33851
  ascent,
@@ -33681,6 +33853,20 @@ function calculateTypographyMetrics(fontSize, spacing) {
33681
33853
  lineHeight
33682
33854
  };
33683
33855
  }
33856
+ function getFontInfoFromRun(run) {
33857
+ return {
33858
+ fontFamily: run.fontFamily,
33859
+ fontSize: run.fontSize,
33860
+ bold: run.bold,
33861
+ italic: run.italic
33862
+ };
33863
+ }
33864
+ function updateMaxFontInfo(currentMaxSize, currentMaxInfo, newRun) {
33865
+ if (newRun.fontSize >= currentMaxSize) {
33866
+ return getFontInfoFromRun(newRun);
33867
+ }
33868
+ return currentMaxInfo;
33869
+ }
33684
33870
  function isTabRun(run) {
33685
33871
  return run.kind === "tab";
33686
33872
  }
@@ -33726,7 +33912,8 @@ async function measureParagraphBlock(block, maxWidth) {
33726
33912
  const indentRight = sanitizePositive(indent?.right);
33727
33913
  const firstLine = indent?.firstLine ?? 0;
33728
33914
  const hanging = indent?.hanging ?? 0;
33729
- const firstLineOffset = firstLine - hanging;
33915
+ const suppressFirstLine = block.attrs?.suppressFirstLineIndent === true;
33916
+ const firstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
33730
33917
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
33731
33918
  const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
33732
33919
  const tabStops = buildTabStopsPx(
@@ -33862,7 +34049,7 @@ async function measureParagraphBlock(block, maxWidth) {
33862
34049
  const run = runsToProcess[runIndex];
33863
34050
  if (run.kind === "break") {
33864
34051
  if (currentLine) {
33865
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34052
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
33866
34053
  const completedLine = { ...currentLine, ...metrics };
33867
34054
  addBarTabsToLine(completedLine);
33868
34055
  lines.push(completedLine);
@@ -33892,7 +34079,7 @@ async function measureParagraphBlock(block, maxWidth) {
33892
34079
  }
33893
34080
  if (isLineBreakRun(run)) {
33894
34081
  if (currentLine) {
33895
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34082
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
33896
34083
  const completedLine = {
33897
34084
  ...currentLine,
33898
34085
  ...metrics
@@ -34005,7 +34192,7 @@ async function measureParagraphBlock(block, maxWidth) {
34005
34192
  }
34006
34193
  const appliedTabAlign = lastAppliedTabAlign;
34007
34194
  if (currentLine.width + imageWidth > currentLine.maxWidth && currentLine.width > 0) {
34008
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34195
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
34009
34196
  const completedLine = {
34010
34197
  ...currentLine,
34011
34198
  ...metrics
@@ -34093,6 +34280,7 @@ async function measureParagraphBlock(block, maxWidth) {
34093
34280
  toChar: wordEndNoSpace,
34094
34281
  width: wordOnlyWidth,
34095
34282
  maxFontSize: run.fontSize,
34283
+ maxFontInfo: getFontInfoFromRun(run),
34096
34284
  maxWidth: getEffectiveWidth(initialAvailableWidth),
34097
34285
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }]
34098
34286
  };
@@ -34109,7 +34297,7 @@ async function measureParagraphBlock(block, maxWidth) {
34109
34297
  const isTocEntry = block.attrs?.isTocEntry;
34110
34298
  const boundarySpacing = currentLine.width > 0 ? run.letterSpacing ?? 0 : 0;
34111
34299
  if (currentLine.width + boundarySpacing + wordOnlyWidth > currentLine.maxWidth - WIDTH_FUDGE_PX && currentLine.width > 0 && !isTocEntry) {
34112
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34300
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
34113
34301
  const completedLine = {
34114
34302
  ...currentLine,
34115
34303
  ...metrics
@@ -34125,6 +34313,7 @@ async function measureParagraphBlock(block, maxWidth) {
34125
34313
  toChar: wordEndNoSpace,
34126
34314
  width: wordOnlyWidth,
34127
34315
  maxFontSize: run.fontSize,
34316
+ maxFontInfo: getFontInfoFromRun(run),
34128
34317
  maxWidth: getEffectiveWidth(contentWidth),
34129
34318
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }]
34130
34319
  };
@@ -34140,9 +34329,10 @@ async function measureParagraphBlock(block, maxWidth) {
34140
34329
  if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX) {
34141
34330
  currentLine.toChar = wordEndNoSpace;
34142
34331
  currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
34332
+ currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
34143
34333
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run.fontSize);
34144
34334
  appendSegment(currentLine.segments, runIndex, wordStartChar, wordEndNoSpace, wordOnlyWidth, segmentStartX);
34145
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34335
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
34146
34336
  const completedLine = { ...currentLine, ...metrics };
34147
34337
  addBarTabsToLine(completedLine);
34148
34338
  lines.push(completedLine);
@@ -34159,6 +34349,7 @@ async function measureParagraphBlock(block, maxWidth) {
34159
34349
  currentLine.width = roundValue(
34160
34350
  currentLine.width + boundarySpacing + wordCommitWidth + (isLastWord ? 0 : run.letterSpacing ?? 0)
34161
34351
  );
34352
+ currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
34162
34353
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run.fontSize);
34163
34354
  appendSegment(currentLine.segments, runIndex, wordStartChar, newToChar, wordCommitWidth, explicitX);
34164
34355
  }
@@ -34181,6 +34372,7 @@ async function measureParagraphBlock(block, maxWidth) {
34181
34372
  toChar: charPosInRun,
34182
34373
  width: 0,
34183
34374
  maxFontSize: run.fontSize,
34375
+ maxFontInfo: getFontInfoFromRun(run),
34184
34376
  maxWidth: getEffectiveWidth(initialAvailableWidth),
34185
34377
  segments: []
34186
34378
  };
@@ -34190,6 +34382,7 @@ async function measureParagraphBlock(block, maxWidth) {
34190
34382
  tabStopCursor = nextIndex;
34191
34383
  const tabAdvance = Math.max(0, target - currentLine.width);
34192
34384
  currentLine.width = roundValue(currentLine.width + tabAdvance);
34385
+ currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
34193
34386
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run.fontSize);
34194
34387
  currentLine.toRun = runIndex;
34195
34388
  currentLine.toChar = charPosInRun;
@@ -34226,7 +34419,7 @@ async function measureParagraphBlock(block, maxWidth) {
34226
34419
  lines.push(fallbackLine);
34227
34420
  }
34228
34421
  if (currentLine) {
34229
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34422
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
34230
34423
  const finalLine = {
34231
34424
  ...currentLine,
34232
34425
  ...metrics
@@ -35756,7 +35949,7 @@ class EditorOverlayManager {
35756
35949
  * @throws {Error} If painterHost is not connected to the DOM
35757
35950
  * @throws {Error} If visibleHost is not connected to the DOM
35758
35951
  */
35759
- constructor(painterHost, visibleHost, selectionOverlay = null) {
35952
+ constructor(_painterHost2, _visibleHost2, selectionOverlay = null) {
35760
35953
  __privateAdd(this, _EditorOverlayManager_instances);
35761
35954
  /** Selection overlay element (for hiding during editing) */
35762
35955
  __privateAdd(this, _selectionOverlay);
@@ -35768,19 +35961,21 @@ class EditorOverlayManager {
35768
35961
  __privateAdd(this, _activeRegion, null);
35769
35962
  /** Full-width border line element (MS Word style) */
35770
35963
  __privateAdd(this, _borderLine, null);
35771
- if (!(painterHost instanceof HTMLElement)) {
35964
+ /** Dimming overlay element (for dimming body content during editing) */
35965
+ __privateAdd(this, _dimmingOverlay, null);
35966
+ if (!(_painterHost2 instanceof HTMLElement)) {
35772
35967
  throw new TypeError("painterHost must be an HTMLElement");
35773
35968
  }
35774
- if (!(visibleHost instanceof HTMLElement)) {
35969
+ if (!(_visibleHost2 instanceof HTMLElement)) {
35775
35970
  throw new TypeError("visibleHost must be an HTMLElement");
35776
35971
  }
35777
35972
  if (selectionOverlay !== null && !(selectionOverlay instanceof HTMLElement)) {
35778
35973
  throw new TypeError("selectionOverlay must be an HTMLElement or null");
35779
35974
  }
35780
- if (!painterHost.isConnected) {
35975
+ if (!_painterHost2.isConnected) {
35781
35976
  throw new Error("painterHost must be connected to the DOM");
35782
35977
  }
35783
- if (!visibleHost.isConnected) {
35978
+ if (!_visibleHost2.isConnected) {
35784
35979
  throw new Error("visibleHost must be connected to the DOM");
35785
35980
  }
35786
35981
  __privateSet(this, _selectionOverlay, selectionOverlay);
@@ -35967,6 +36162,7 @@ _activeEditorHost = new WeakMap();
35967
36162
  _activeDecorationContainer = new WeakMap();
35968
36163
  _activeRegion = new WeakMap();
35969
36164
  _borderLine = new WeakMap();
36165
+ _dimmingOverlay = new WeakMap();
35970
36166
  _EditorOverlayManager_instances = new WeakSet();
35971
36167
  /**
35972
36168
  * Finds the decoration container element for a given region kind.
@@ -36054,6 +36250,17 @@ positionEditorHost_fn = function(editorHost, region, decorationContainer, _zoom)
36054
36250
  }
36055
36251
  }
36056
36252
  };
36253
+ /**
36254
+ * Hides and removes the dimming overlay.
36255
+ * @internal Reserved for future implementation of body dimming during header/footer editing.
36256
+ */
36257
+ // eslint-disable-next-line no-unused-private-class-members
36258
+ hideDimmingOverlay_fn = function() {
36259
+ if (__privateGet(this, _dimmingOverlay)) {
36260
+ __privateGet(this, _dimmingOverlay).remove();
36261
+ __privateSet(this, _dimmingOverlay, null);
36262
+ }
36263
+ };
36057
36264
  /**
36058
36265
  * Shows a full-width border line at the bottom of the header or top of the footer.
36059
36266
  * This creates the MS Word style visual indicator spanning edge-to-edge of the page.
@@ -49886,7 +50093,14 @@ function addImageRelationship({ editor, path }) {
49886
50093
  }
49887
50094
  }
49888
50095
  const key = new PluginKey("ImageRegistration");
49889
- const WORD_MEDIA_PREFIX = "word/";
50096
+ const needsImageRegistration = (node) => {
50097
+ if (!node || node.type?.name !== "image") return false;
50098
+ const src = node.attrs?.src;
50099
+ if (typeof src !== "string" || src.length === 0) return false;
50100
+ if (src.startsWith("word/media")) return false;
50101
+ if (src.startsWith("data:") && node.attrs?.rId) return false;
50102
+ return true;
50103
+ };
49890
50104
  const ImageRegistrationPlugin = ({ editor }) => {
49891
50105
  const { view } = editor;
49892
50106
  return new Plugin({
@@ -49921,7 +50135,7 @@ const ImageRegistrationPlugin = ({ editor }) => {
49921
50135
  stepMap.map(step.from, -1),
49922
50136
  stepMap.map(step.to, 1),
49923
50137
  (node, pos) => {
49924
- if (node.type.name === "image" && !node.attrs.src.startsWith("word/media")) {
50138
+ if (node.type.name === "image" && needsImageRegistration(node)) {
49925
50139
  const id = {};
49926
50140
  foundImages.push({ node, pos, id });
49927
50141
  } else {
@@ -49974,7 +50188,7 @@ const handleNodePath = (foundImages, editor, state) => {
49974
50188
  existingFileNames.add(uniqueFileName);
49975
50189
  const mediaPath = buildMediaPath(uniqueFileName);
49976
50190
  mediaStore[mediaPath] = src;
49977
- const path = mediaPath.startsWith(WORD_MEDIA_PREFIX) ? mediaPath.slice(WORD_MEDIA_PREFIX.length) : mediaPath;
50191
+ const path = mediaPath.startsWith("word/") ? mediaPath.slice(5) : mediaPath;
49978
50192
  const rId = addImageRelationship({ editor, path });
49979
50193
  tr.setNodeMarkup(pos, void 0, {
49980
50194
  ...node.attrs,
@@ -50386,19 +50600,21 @@ const Image = Node$1.create({
50386
50600
  */
50387
50601
  simplePos: { rendered: false },
50388
50602
  extension: { rendered: false },
50603
+ // Preserve original EMF/WMF format info when converting to SVG for display.
50604
+ // Used during DOCX export to restore the original metafile format.
50605
+ originalExtension: { rendered: false },
50606
+ originalSrc: { rendered: false },
50389
50607
  shouldStretch: {
50390
50608
  default: false,
50391
50609
  rendered: false
50392
50610
  },
50393
50611
  size: {
50394
50612
  default: {},
50395
- renderDOM: ({ size, extension, shouldStretch }) => {
50613
+ renderDOM: ({ size, shouldStretch }) => {
50396
50614
  let style = "";
50397
50615
  let { width, height } = size ?? {};
50398
50616
  if (width) style += `width: ${width}px;`;
50399
- if (height && ["emf", "wmf"].includes(extension))
50400
- style += `height: ${height}px; border: 1px solid black; position: absolute;`;
50401
- else if (height && shouldStretch) {
50617
+ if (height && shouldStretch) {
50402
50618
  style += `height: ${height}px; object-fit: fill;`;
50403
50619
  } else if (height) style += "height: auto;";
50404
50620
  return { style };