superdoc 1.0.0-beta.21 → 1.0.0-beta.23

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 (28) hide show
  1. package/dist/chunks/{PdfViewer-CqAQvFv3.cjs → PdfViewer-C9mryfp4.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CEwbF85g.es.js → PdfViewer-umOKwA1g.es.js} +1 -1
  3. package/dist/chunks/{index-DSuc12CK-Dpg5Hd9W.cjs → index-DYBG7Xab-CoI6fike.cjs} +1 -1
  4. package/dist/chunks/{index-DSuc12CK-DH_DeF0B.es.js → index-DYBG7Xab-mIeLdlWI.es.js} +1 -1
  5. package/dist/chunks/{index-BFobqgP4.es.js → index-DyY842H4.es.js} +7 -5
  6. package/dist/chunks/{index-Dy-eAVHL.cjs → index-Q-l_lwcU.cjs} +7 -5
  7. package/dist/chunks/{super-editor.es-C2UuUFg3.cjs → super-editor.es-49DW4_-r.cjs} +445 -135
  8. package/dist/chunks/{super-editor.es-B5YJmpPg.es.js → super-editor.es-Cj9Sb-Qv.es.js} +445 -135
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-Cw0V00On.js → converter-DJyfDFNm.js} +38 -34
  12. package/dist/super-editor/chunks/{docx-zipper-D7k6lS5l.js → docx-zipper-C-9Tqy8I.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-CDWzRc4H.js → editor-f37DOCIX.js} +415 -108
  14. package/dist/super-editor/chunks/{index-DSuc12CK.js → index-DYBG7Xab.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-CHJspeuY.js → toolbar-Devgq8w3.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor.es.js +6 -6
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +2 -2
  25. package/dist/superdoc.es.js +2 -2
  26. package/dist/superdoc.umd.js +451 -139
  27. package/dist/superdoc.umd.js.map +1 -1
  28. 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, _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 ListHelpers, O as updateNumberingProperties, Q as changeListLevel, U as findParentNode, V as isList, 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-Cw0V00On.js";
16
- import { D as DocxZipper } from "./docx-zipper-D7k6lS5l.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-DJyfDFNm.js";
16
+ import { D as DocxZipper } from "./docx-zipper-C-9Tqy8I.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 paragraphsInSelection = [];
9991
+ let allParagraphsInSelection = [];
9939
9992
  state.doc.nodesBetween(from2, to, (node, pos) => {
9940
9993
  if (node.type.name === "paragraph") {
9941
- paragraphsInSelection.push({ node, pos });
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
- const newTo = tr.mapping.map(to);
9995
- if (newTo >= 0 && newTo <= tr.doc.content.size) {
9996
- try {
9997
- tr.setSelection(state.selection.constructor.near(tr.doc.resolve(newTo)));
9998
- } catch {
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
- return this.editor.options.editable;
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];
@@ -13856,7 +13905,7 @@ const isHeadless = (editor) => {
13856
13905
  const shouldSkipNodeView = (editor) => {
13857
13906
  return isHeadless(editor);
13858
13907
  };
13859
- const summaryVersion = "1.0.0-beta.21";
13908
+ const summaryVersion = "1.0.0-beta.23";
13860
13909
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
13861
13910
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
13862
13911
  function mapAttributes(attrs) {
@@ -14264,10 +14313,23 @@ const _Editor = class _Editor extends EventEmitter {
14264
14313
  this.view.updateState(this.state);
14265
14314
  }
14266
14315
  /**
14267
- * 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)
14268
14324
  */
14269
14325
  setEditable(editable = true, emitUpdate = true) {
14270
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
+ }
14271
14333
  if (emitUpdate) {
14272
14334
  this.emit("update", { editor: this, transaction: this.state.tr });
14273
14335
  }
@@ -14635,7 +14697,7 @@ const _Editor = class _Editor extends EventEmitter {
14635
14697
  { default: remarkStringify },
14636
14698
  { default: remarkGfm }
14637
14699
  ] = await Promise.all([
14638
- import("./index-DSuc12CK.js"),
14700
+ import("./index-DYBG7Xab.js"),
14639
14701
  import("./index-DRCvimau.js"),
14640
14702
  import("./index-C_x_N6Uh.js"),
14641
14703
  import("./index-D_sWOSiG.js"),
@@ -14840,7 +14902,7 @@ const _Editor = class _Editor extends EventEmitter {
14840
14902
  * Process collaboration migrations
14841
14903
  */
14842
14904
  processCollaborationMigrations() {
14843
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.21");
14905
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.23");
14844
14906
  if (!this.options.ydoc) return;
14845
14907
  const metaMap = this.options.ydoc.getMap("meta");
14846
14908
  let docVersion = metaMap.get("version");
@@ -17380,6 +17442,11 @@ const normalizeAlignment = (value) => {
17380
17442
  case "right":
17381
17443
  case "justify":
17382
17444
  return value;
17445
+ case "both":
17446
+ case "distribute":
17447
+ case "numTab":
17448
+ case "thaiDistribute":
17449
+ return "justify";
17383
17450
  case "end":
17384
17451
  return "right";
17385
17452
  case "start":
@@ -19594,6 +19661,11 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
19594
19661
  } else if (computed2.paragraph.alignment) {
19595
19662
  paragraphAttrs.alignment = computed2.paragraph.alignment;
19596
19663
  }
19664
+ const isJustified = paragraphAttrs.alignment === "justify" || paragraphAttrs.alignment === "both";
19665
+ const hasFirstLineIndent = normalizedIndent?.firstLine && normalizedIndent.firstLine > 0;
19666
+ if (isJustified && hasFirstLineIndent) {
19667
+ paragraphAttrs.suppressFirstLineIndent = true;
19668
+ }
19597
19669
  const spacingPx = spacingPtToPx(spacing, normalizedSpacing);
19598
19670
  if (spacingPx) paragraphAttrs.spacing = spacingPx;
19599
19671
  if (normalizedSpacing?.beforeAutospacing != null || normalizedSpacing?.afterAutospacing != null) {
@@ -19811,7 +19883,7 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
19811
19883
  }
19812
19884
  }
19813
19885
  paragraphAttrs.wordLayout = wordLayout;
19814
- if (enrichedNumberingProps.resolvedLevelIndent) {
19886
+ if (enrichedNumberingProps.resolvedLevelIndent && !hasExplicitIndent) {
19815
19887
  const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
19816
19888
  paragraphAttrs.indent = {
19817
19889
  ...paragraphAttrs.indent,
@@ -23177,8 +23249,14 @@ function computeNextSectionPropsAtBreak(blocks) {
23177
23249
  });
23178
23250
  return nextSectionPropsAtBreak;
23179
23251
  }
23180
- function scheduleSectionBreak(block, state, baseMargins) {
23252
+ function scheduleSectionBreak(block, state, baseMargins, maxHeaderContentHeight = 0) {
23181
23253
  const next = { ...state };
23254
+ const calcRequiredTopMargin = (headerDistance, baseTop) => {
23255
+ if (maxHeaderContentHeight > 0) {
23256
+ return Math.max(baseTop, headerDistance + maxHeaderContentHeight);
23257
+ }
23258
+ return Math.max(baseTop, headerDistance);
23259
+ };
23182
23260
  if (block.attrs?.isFirstSection && !next.hasAnyPages) {
23183
23261
  if (block.pageSize) {
23184
23262
  next.activePageSize = { w: block.pageSize.w, h: block.pageSize.h };
@@ -23192,7 +23270,7 @@ function scheduleSectionBreak(block, state, baseMargins) {
23192
23270
  const headerDistance = Math.max(0, block.margins.header);
23193
23271
  next.activeHeaderDistance = headerDistance;
23194
23272
  next.pendingHeaderDistance = headerDistance;
23195
- next.activeTopMargin = Math.max(baseMargins.top, headerDistance);
23273
+ next.activeTopMargin = calcRequiredTopMargin(headerDistance, baseMargins.top);
23196
23274
  next.pendingTopMargin = next.activeTopMargin;
23197
23275
  }
23198
23276
  if (block.margins?.footer !== void 0) {
@@ -23214,9 +23292,15 @@ function scheduleSectionBreak(block, state, baseMargins) {
23214
23292
  const nextBottom = next.pendingBottomMargin ?? next.activeBottomMargin;
23215
23293
  const nextHeader = next.pendingHeaderDistance ?? next.activeHeaderDistance;
23216
23294
  const nextFooter = next.pendingFooterDistance ?? next.activeFooterDistance;
23217
- next.pendingTopMargin = typeof headerPx === "number" ? Math.max(baseMargins.top, headerPx) : nextTop;
23295
+ if (typeof headerPx === "number") {
23296
+ const newHeaderDist = Math.max(0, headerPx);
23297
+ next.pendingHeaderDistance = newHeaderDist;
23298
+ next.pendingTopMargin = calcRequiredTopMargin(newHeaderDist, baseMargins.top);
23299
+ } else {
23300
+ next.pendingTopMargin = nextTop;
23301
+ next.pendingHeaderDistance = nextHeader;
23302
+ }
23218
23303
  next.pendingBottomMargin = typeof footerPx === "number" ? Math.max(baseMargins.bottom, footerPx) : nextBottom;
23219
- next.pendingHeaderDistance = typeof headerPx === "number" ? Math.max(0, headerPx) : nextHeader;
23220
23304
  next.pendingFooterDistance = typeof footerPx === "number" ? Math.max(0, footerPx) : nextFooter;
23221
23305
  if (block.pageSize) {
23222
23306
  next.pendingPageSize = { w: block.pageSize.w, h: block.pageSize.h };
@@ -24681,7 +24765,22 @@ function layoutDocument(blocks, measures, options = {}) {
24681
24765
  if (contentWidth <= 0) {
24682
24766
  throw new Error("layoutDocument: pageSize and margins yield non-positive content area");
24683
24767
  }
24684
- let activeTopMargin = margins.top;
24768
+ const validateHeaderHeight = (height) => {
24769
+ if (height === void 0) return 0;
24770
+ if (!Number.isFinite(height) || height < 0) return 0;
24771
+ return height;
24772
+ };
24773
+ const headerContentHeights = options.headerContentHeights;
24774
+ const maxHeaderContentHeight = headerContentHeights ? Math.max(
24775
+ 0,
24776
+ validateHeaderHeight(headerContentHeights.default),
24777
+ validateHeaderHeight(headerContentHeights.first),
24778
+ validateHeaderHeight(headerContentHeights.even),
24779
+ validateHeaderHeight(headerContentHeights.odd)
24780
+ ) : 0;
24781
+ const headerDistance = margins.header ?? margins.top;
24782
+ const effectiveTopMargin = maxHeaderContentHeight > 0 ? Math.max(margins.top, headerDistance + maxHeaderContentHeight) : margins.top;
24783
+ let activeTopMargin = effectiveTopMargin;
24685
24784
  let activeBottomMargin = margins.bottom;
24686
24785
  let pendingTopMargin = null;
24687
24786
  let pendingBottomMargin = null;
@@ -24705,7 +24804,7 @@ function layoutDocument(blocks, measures, options = {}) {
24705
24804
  const nextSectionPropsAtBreak = computeNextSectionPropsAtBreak(blocks);
24706
24805
  const scheduleSectionBreakCompat = (block, state, baseMargins) => {
24707
24806
  if (typeof scheduleSectionBreak === "function") {
24708
- return scheduleSectionBreak(block, state, baseMargins);
24807
+ return scheduleSectionBreak(block, state, baseMargins, maxHeaderContentHeight);
24709
24808
  }
24710
24809
  const next = { ...state };
24711
24810
  if (block.attrs?.isFirstSection && !next.hasAnyPages) {
@@ -24718,10 +24817,11 @@ function layoutDocument(blocks, measures, options = {}) {
24718
24817
  next.pendingOrientation = null;
24719
24818
  }
24720
24819
  if (block.margins?.header !== void 0) {
24721
- const headerDistance = Math.max(0, block.margins.header);
24722
- next.activeHeaderDistance = headerDistance;
24723
- next.pendingHeaderDistance = headerDistance;
24724
- next.activeTopMargin = Math.max(baseMargins.top, headerDistance);
24820
+ const headerDist = Math.max(0, block.margins.header);
24821
+ next.activeHeaderDistance = headerDist;
24822
+ next.pendingHeaderDistance = headerDist;
24823
+ const requiredTop = maxHeaderContentHeight > 0 ? headerDist + maxHeaderContentHeight : headerDist;
24824
+ next.activeTopMargin = Math.max(baseMargins.top, requiredTop);
24725
24825
  next.pendingTopMargin = next.activeTopMargin;
24726
24826
  }
24727
24827
  if (block.margins?.footer !== void 0) {
@@ -24758,14 +24858,22 @@ function layoutDocument(blocks, measures, options = {}) {
24758
24858
  }
24759
24859
  const headerPx = block.margins?.header;
24760
24860
  const footerPx = block.margins?.footer;
24861
+ const topPx = block.margins?.top;
24761
24862
  const nextTop = next.pendingTopMargin ?? next.activeTopMargin;
24762
24863
  const nextBottom = next.pendingBottomMargin ?? next.activeBottomMargin;
24763
24864
  const nextHeader = next.pendingHeaderDistance ?? next.activeHeaderDistance;
24764
24865
  const nextFooter = next.pendingFooterDistance ?? next.activeFooterDistance;
24765
- next.pendingTopMargin = typeof headerPx === "number" ? Math.max(baseMargins.top, headerPx) : nextTop;
24766
- next.pendingBottomMargin = typeof footerPx === "number" ? Math.max(baseMargins.bottom, footerPx) : nextBottom;
24767
24866
  next.pendingHeaderDistance = typeof headerPx === "number" ? Math.max(0, headerPx) : nextHeader;
24768
24867
  next.pendingFooterDistance = typeof footerPx === "number" ? Math.max(0, footerPx) : nextFooter;
24868
+ if (typeof headerPx === "number" || typeof topPx === "number") {
24869
+ const sectionTop = topPx ?? baseMargins.top;
24870
+ const sectionHeader = next.pendingHeaderDistance;
24871
+ const requiredTop = maxHeaderContentHeight > 0 ? sectionHeader + maxHeaderContentHeight : sectionHeader;
24872
+ next.pendingTopMargin = Math.max(sectionTop, requiredTop);
24873
+ } else {
24874
+ next.pendingTopMargin = nextTop;
24875
+ }
24876
+ next.pendingBottomMargin = typeof footerPx === "number" ? Math.max(baseMargins.bottom, footerPx) : nextBottom;
24769
24877
  if (block.pageSize) next.pendingPageSize = { w: block.pageSize.w, h: block.pageSize.h };
24770
24878
  if (block.orientation) next.pendingOrientation = block.orientation;
24771
24879
  const sectionType = block.type ?? "continuous";
@@ -25516,7 +25624,7 @@ const resolveTrackedChangesEnabled = (attrs, defaultEnabled = true) => {
25516
25624
  }
25517
25625
  return attrs.trackedChangesEnabled !== false;
25518
25626
  };
25519
- const MAX_CACHE_SIZE = 1e4;
25627
+ const MAX_CACHE_SIZE$1 = 1e4;
25520
25628
  const BYTES_PER_ENTRY_ESTIMATE = 5e3;
25521
25629
  const NORMALIZED_WHITESPACE = /\s+/g;
25522
25630
  const normalizeText = (text) => text.replace(NORMALIZED_WHITESPACE, " ");
@@ -25616,7 +25724,7 @@ class MeasureCache {
25616
25724
  if (this.cache.has(key2)) {
25617
25725
  this.cache.delete(key2);
25618
25726
  }
25619
- if (this.cache.size >= MAX_CACHE_SIZE) {
25727
+ if (this.cache.size >= MAX_CACHE_SIZE$1) {
25620
25728
  const oldestKey = this.cache.keys().next().value;
25621
25729
  if (oldestKey !== void 0) {
25622
25730
  this.cache.delete(oldestKey);
@@ -25690,13 +25798,13 @@ class MeasureCache {
25690
25798
  * Get maximum cache size
25691
25799
  */
25692
25800
  getMaxSize() {
25693
- return MAX_CACHE_SIZE;
25801
+ return MAX_CACHE_SIZE$1;
25694
25802
  }
25695
25803
  /**
25696
25804
  * Check if cache is near capacity
25697
25805
  */
25698
25806
  isNearCapacity(threshold = 0.9) {
25699
- return this.cache.size >= MAX_CACHE_SIZE * threshold;
25807
+ return this.cache.size >= MAX_CACHE_SIZE$1 * threshold;
25700
25808
  }
25701
25809
  /**
25702
25810
  * Update size statistics
@@ -26708,9 +26816,46 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
26708
26816
  perfLog(
26709
26817
  `[Perf] 4.1 Measure all blocks: ${(measureEnd - measureStart).toFixed(2)}ms (${cacheMisses} measured, ${cacheHits} cached)`
26710
26818
  );
26819
+ let headerContentHeights;
26820
+ if (headerFooter?.constraints && headerFooter.headerBlocks) {
26821
+ const hfPreStart = performance.now();
26822
+ const measureFn = headerFooter.measure ?? measureBlock2;
26823
+ invalidateHeaderFooterCache(
26824
+ headerMeasureCache,
26825
+ headerFooterCacheState,
26826
+ headerFooter.headerBlocks,
26827
+ headerFooter.footerBlocks,
26828
+ headerFooter.constraints,
26829
+ options.sectionMetadata
26830
+ );
26831
+ const HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT = 1;
26832
+ const preHeaderLayouts = await layoutHeaderFooterWithCache(
26833
+ headerFooter.headerBlocks,
26834
+ headerFooter.constraints,
26835
+ measureFn,
26836
+ headerMeasureCache,
26837
+ HEADER_PRELAYOUT_PLACEHOLDER_PAGE_COUNT,
26838
+ void 0
26839
+ // No page resolver needed for height calculation
26840
+ );
26841
+ const isValidHeaderType = (key2) => {
26842
+ return ["default", "first", "even", "odd"].includes(key2);
26843
+ };
26844
+ headerContentHeights = {};
26845
+ for (const [type, value] of Object.entries(preHeaderLayouts)) {
26846
+ if (!isValidHeaderType(type)) continue;
26847
+ if (value?.layout && typeof value.layout.height === "number") {
26848
+ headerContentHeights[type] = value.layout.height;
26849
+ }
26850
+ }
26851
+ const hfPreEnd = performance.now();
26852
+ perfLog(`[Perf] 4.1.5 Pre-layout headers for height: ${(hfPreEnd - hfPreStart).toFixed(2)}ms`);
26853
+ }
26711
26854
  const layoutStart = performance.now();
26712
26855
  let layout = layoutDocument(nextBlocks, measures, {
26713
26856
  ...options,
26857
+ headerContentHeights,
26858
+ // Pass header heights to prevent overlap
26714
26859
  remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
26715
26860
  });
26716
26861
  const layoutEnd = performance.now();
@@ -26757,6 +26902,8 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
26757
26902
  const relayoutStart = performance.now();
26758
26903
  layout = layoutDocument(currentBlocks, currentMeasures, {
26759
26904
  ...options,
26905
+ headerContentHeights,
26906
+ // Pass header heights to prevent overlap
26760
26907
  remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
26761
26908
  });
26762
26909
  const relayoutEnd = performance.now();
@@ -29806,7 +29953,12 @@ const lineStyles = (lineHeight) => ({
29806
29953
  height: `${lineHeight}px`,
29807
29954
  position: "relative",
29808
29955
  display: "block",
29809
- whiteSpace: "pre"
29956
+ whiteSpace: "pre",
29957
+ // Allow text to overflow the line container as a safety net.
29958
+ // The primary fix uses accurate font metrics from Canvas API, but this
29959
+ // provides defense-in-depth against any remaining sub-pixel rendering
29960
+ // differences between measurement and display.
29961
+ overflow: "visible"
29810
29962
  });
29811
29963
  const PRINT_STYLES = `
29812
29964
  @media print {
@@ -31372,7 +31524,8 @@ const _DomPainter = class _DomPainter {
31372
31524
  const paraIndent = block.attrs?.indent;
31373
31525
  const paraIndentLeft = paraIndent?.left ?? 0;
31374
31526
  const paraIndentRight = paraIndent?.right ?? 0;
31375
- const firstLineOffset = (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
31527
+ const suppressFirstLineIndent = block.attrs?.suppressFirstLineIndent === true;
31528
+ const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
31376
31529
  lines.forEach((line, index2) => {
31377
31530
  const lineEl = this.renderLine(block, line, context);
31378
31531
  const isListFirstLine = index2 === 0 && !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
@@ -32999,9 +33152,36 @@ const fragmentSignature = (fragment, lookup) => {
32999
33152
  }
33000
33153
  return base2;
33001
33154
  };
33155
+ const hasListMarkerProperties = (attrs) => {
33156
+ if (!attrs || typeof attrs !== "object") return false;
33157
+ const obj = attrs;
33158
+ if (!obj.numberingProperties || typeof obj.numberingProperties !== "object") return false;
33159
+ const numProps = obj.numberingProperties;
33160
+ if ("numId" in numProps) {
33161
+ const numId = numProps.numId;
33162
+ if (typeof numId !== "number" && typeof numId !== "string") return false;
33163
+ }
33164
+ if ("ilvl" in numProps) {
33165
+ const ilvl = numProps.ilvl;
33166
+ if (typeof ilvl !== "number") return false;
33167
+ }
33168
+ if ("wordLayout" in obj && obj.wordLayout !== void 0) {
33169
+ if (typeof obj.wordLayout !== "object" || obj.wordLayout === null) return false;
33170
+ const wordLayout = obj.wordLayout;
33171
+ if ("marker" in wordLayout && wordLayout.marker !== void 0) {
33172
+ if (typeof wordLayout.marker !== "object" || wordLayout.marker === null) return false;
33173
+ const marker = wordLayout.marker;
33174
+ if ("markerText" in marker && marker.markerText !== void 0) {
33175
+ if (typeof marker.markerText !== "string") return false;
33176
+ }
33177
+ }
33178
+ }
33179
+ return true;
33180
+ };
33002
33181
  const deriveBlockVersion = (block) => {
33003
33182
  if (block.kind === "paragraph") {
33004
- return block.runs.map((run) => {
33183
+ const markerVersion = hasListMarkerProperties(block.attrs) ? `marker:${block.attrs.numberingProperties.numId ?? ""}:${block.attrs.numberingProperties.ilvl ?? 0}:${block.attrs.wordLayout?.marker?.markerText ?? ""}` : "";
33184
+ const runsVersion = block.runs.map((run) => {
33005
33185
  if (run.kind === "image") {
33006
33186
  const imgRun = run;
33007
33187
  return [
@@ -33044,6 +33224,7 @@ const deriveBlockVersion = (block) => {
33044
33224
  textRun.token ?? ""
33045
33225
  ].join(",");
33046
33226
  }).join("|");
33227
+ return markerVersion ? `${markerVersion}|${runsVersion}` : runsVersion;
33047
33228
  }
33048
33229
  if (block.kind === "list") {
33049
33230
  return block.items.map((item) => `${item.id}:${item.marker.text}:${deriveBlockVersion(item.paragraph)}`).join("|");
@@ -33533,6 +33714,61 @@ function evictIfNeeded() {
33533
33714
  cache$1.delete(oldestKey);
33534
33715
  }
33535
33716
  }
33717
+ const fontMetricsCache = /* @__PURE__ */ new Map();
33718
+ const MAX_CACHE_SIZE = 1e3;
33719
+ const METRICS_TEST_STRING = "MHgypbdlÁÉÍ";
33720
+ function getFontKey(fontInfo) {
33721
+ return `${fontInfo.fontFamily}|${fontInfo.fontSize}|${fontInfo.bold ?? false}|${fontInfo.italic ?? false}`;
33722
+ }
33723
+ function buildFontStringForMetrics(fontInfo, mode, fonts) {
33724
+ const parts = [];
33725
+ if (fontInfo.italic) parts.push("italic");
33726
+ if (fontInfo.bold) parts.push("bold");
33727
+ parts.push(`${fontInfo.fontSize}px`);
33728
+ {
33729
+ parts.push(fontInfo.fontFamily);
33730
+ }
33731
+ return parts.join(" ");
33732
+ }
33733
+ function getFontMetrics(ctx2, fontInfo, mode, fonts) {
33734
+ if (!ctx2 || typeof ctx2 !== "object") {
33735
+ throw new TypeError("Canvas context must be a valid CanvasRenderingContext2D object");
33736
+ }
33737
+ if (typeof fontInfo.fontSize !== "number" || !Number.isFinite(fontInfo.fontSize) || fontInfo.fontSize <= 0) {
33738
+ throw new TypeError(
33739
+ `Font size must be a positive finite number, got: ${typeof fontInfo.fontSize === "number" ? fontInfo.fontSize : typeof fontInfo.fontSize}`
33740
+ );
33741
+ }
33742
+ if (typeof fontInfo.fontFamily !== "string" || fontInfo.fontFamily.trim().length === 0) {
33743
+ throw new TypeError("Font family must be a non-empty string");
33744
+ }
33745
+ const key2 = getFontKey(fontInfo);
33746
+ const cached = fontMetricsCache.get(key2);
33747
+ if (cached) {
33748
+ return cached;
33749
+ }
33750
+ const font = buildFontStringForMetrics(fontInfo);
33751
+ ctx2.font = font;
33752
+ const textMetrics = ctx2.measureText(METRICS_TEST_STRING);
33753
+ let ascent;
33754
+ let descent;
33755
+ if (typeof textMetrics.actualBoundingBoxAscent === "number" && typeof textMetrics.actualBoundingBoxDescent === "number" && textMetrics.actualBoundingBoxAscent > 0) {
33756
+ ascent = textMetrics.actualBoundingBoxAscent;
33757
+ descent = textMetrics.actualBoundingBoxDescent;
33758
+ } else {
33759
+ ascent = fontInfo.fontSize * 0.8;
33760
+ descent = fontInfo.fontSize * 0.2;
33761
+ }
33762
+ const result = { ascent, descent };
33763
+ if (fontMetricsCache.size >= MAX_CACHE_SIZE) {
33764
+ const firstKey = fontMetricsCache.keys().next().value;
33765
+ if (firstKey) {
33766
+ fontMetricsCache.delete(firstKey);
33767
+ }
33768
+ }
33769
+ fontMetricsCache.set(key2, result);
33770
+ return result;
33771
+ }
33536
33772
  const { computeTabStops } = Engines;
33537
33773
  let canvasContext = null;
33538
33774
  const DEFAULT_TAB_INTERVAL_TWIPS = 720;
@@ -33580,10 +33816,20 @@ function measureText(text, font, ctx2, _fontFamily, _letterSpacing) {
33580
33816
  return Math.max(advanceWidth, paintedWidth);
33581
33817
  }
33582
33818
  const MIN_SINGLE_LINE_PX = 12 * 96 / 72;
33583
- function calculateTypographyMetrics(fontSize, spacing) {
33584
- const ascent = roundValue(fontSize * 0.8);
33585
- const descent = roundValue(fontSize * 0.2);
33586
- const baseLineHeight = Math.max(fontSize, MIN_SINGLE_LINE_PX);
33819
+ const LINE_HEIGHT_SAFETY_MARGIN_PX = 1;
33820
+ function calculateTypographyMetrics(fontSize, spacing, fontInfo) {
33821
+ let ascent;
33822
+ let descent;
33823
+ if (fontInfo) {
33824
+ const ctx2 = getCanvasContext();
33825
+ const metrics = getFontMetrics(ctx2, fontInfo);
33826
+ ascent = roundValue(metrics.ascent);
33827
+ descent = roundValue(metrics.descent);
33828
+ } else {
33829
+ ascent = roundValue(fontSize * 0.8);
33830
+ descent = roundValue(fontSize * 0.2);
33831
+ }
33832
+ const baseLineHeight = Math.max(ascent + descent + LINE_HEIGHT_SAFETY_MARGIN_PX, MIN_SINGLE_LINE_PX);
33587
33833
  const lineHeight = roundValue(resolveLineHeight(spacing, baseLineHeight));
33588
33834
  return {
33589
33835
  ascent,
@@ -33591,6 +33837,20 @@ function calculateTypographyMetrics(fontSize, spacing) {
33591
33837
  lineHeight
33592
33838
  };
33593
33839
  }
33840
+ function getFontInfoFromRun(run) {
33841
+ return {
33842
+ fontFamily: run.fontFamily,
33843
+ fontSize: run.fontSize,
33844
+ bold: run.bold,
33845
+ italic: run.italic
33846
+ };
33847
+ }
33848
+ function updateMaxFontInfo(currentMaxSize, currentMaxInfo, newRun) {
33849
+ if (newRun.fontSize >= currentMaxSize) {
33850
+ return getFontInfoFromRun(newRun);
33851
+ }
33852
+ return currentMaxInfo;
33853
+ }
33594
33854
  function isTabRun(run) {
33595
33855
  return run.kind === "tab";
33596
33856
  }
@@ -33636,7 +33896,8 @@ async function measureParagraphBlock(block, maxWidth) {
33636
33896
  const indentRight = sanitizePositive(indent?.right);
33637
33897
  const firstLine = indent?.firstLine ?? 0;
33638
33898
  const hanging = indent?.hanging ?? 0;
33639
- const firstLineOffset = firstLine - hanging;
33899
+ const suppressFirstLine = block.attrs?.suppressFirstLineIndent === true;
33900
+ const firstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
33640
33901
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
33641
33902
  const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
33642
33903
  const tabStops = buildTabStopsPx(
@@ -33772,7 +34033,7 @@ async function measureParagraphBlock(block, maxWidth) {
33772
34033
  const run = runsToProcess[runIndex];
33773
34034
  if (run.kind === "break") {
33774
34035
  if (currentLine) {
33775
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34036
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
33776
34037
  const completedLine = { ...currentLine, ...metrics };
33777
34038
  addBarTabsToLine(completedLine);
33778
34039
  lines.push(completedLine);
@@ -33802,7 +34063,7 @@ async function measureParagraphBlock(block, maxWidth) {
33802
34063
  }
33803
34064
  if (isLineBreakRun(run)) {
33804
34065
  if (currentLine) {
33805
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34066
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
33806
34067
  const completedLine = {
33807
34068
  ...currentLine,
33808
34069
  ...metrics
@@ -33915,7 +34176,7 @@ async function measureParagraphBlock(block, maxWidth) {
33915
34176
  }
33916
34177
  const appliedTabAlign = lastAppliedTabAlign;
33917
34178
  if (currentLine.width + imageWidth > currentLine.maxWidth && currentLine.width > 0) {
33918
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34179
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
33919
34180
  const completedLine = {
33920
34181
  ...currentLine,
33921
34182
  ...metrics
@@ -34003,6 +34264,7 @@ async function measureParagraphBlock(block, maxWidth) {
34003
34264
  toChar: wordEndNoSpace,
34004
34265
  width: wordOnlyWidth,
34005
34266
  maxFontSize: run.fontSize,
34267
+ maxFontInfo: getFontInfoFromRun(run),
34006
34268
  maxWidth: getEffectiveWidth(initialAvailableWidth),
34007
34269
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }]
34008
34270
  };
@@ -34019,7 +34281,7 @@ async function measureParagraphBlock(block, maxWidth) {
34019
34281
  const isTocEntry = block.attrs?.isTocEntry;
34020
34282
  const boundarySpacing = currentLine.width > 0 ? run.letterSpacing ?? 0 : 0;
34021
34283
  if (currentLine.width + boundarySpacing + wordOnlyWidth > currentLine.maxWidth - WIDTH_FUDGE_PX && currentLine.width > 0 && !isTocEntry) {
34022
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34284
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
34023
34285
  const completedLine = {
34024
34286
  ...currentLine,
34025
34287
  ...metrics
@@ -34035,6 +34297,7 @@ async function measureParagraphBlock(block, maxWidth) {
34035
34297
  toChar: wordEndNoSpace,
34036
34298
  width: wordOnlyWidth,
34037
34299
  maxFontSize: run.fontSize,
34300
+ maxFontInfo: getFontInfoFromRun(run),
34038
34301
  maxWidth: getEffectiveWidth(contentWidth),
34039
34302
  segments: [{ runIndex, fromChar: wordStartChar, toChar: wordEndNoSpace, width: wordOnlyWidth }]
34040
34303
  };
@@ -34050,9 +34313,10 @@ async function measureParagraphBlock(block, maxWidth) {
34050
34313
  if (!isLastWord && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX) {
34051
34314
  currentLine.toChar = wordEndNoSpace;
34052
34315
  currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
34316
+ currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
34053
34317
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run.fontSize);
34054
34318
  appendSegment(currentLine.segments, runIndex, wordStartChar, wordEndNoSpace, wordOnlyWidth, segmentStartX);
34055
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34319
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
34056
34320
  const completedLine = { ...currentLine, ...metrics };
34057
34321
  addBarTabsToLine(completedLine);
34058
34322
  lines.push(completedLine);
@@ -34069,6 +34333,7 @@ async function measureParagraphBlock(block, maxWidth) {
34069
34333
  currentLine.width = roundValue(
34070
34334
  currentLine.width + boundarySpacing + wordCommitWidth + (isLastWord ? 0 : run.letterSpacing ?? 0)
34071
34335
  );
34336
+ currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
34072
34337
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run.fontSize);
34073
34338
  appendSegment(currentLine.segments, runIndex, wordStartChar, newToChar, wordCommitWidth, explicitX);
34074
34339
  }
@@ -34091,6 +34356,7 @@ async function measureParagraphBlock(block, maxWidth) {
34091
34356
  toChar: charPosInRun,
34092
34357
  width: 0,
34093
34358
  maxFontSize: run.fontSize,
34359
+ maxFontInfo: getFontInfoFromRun(run),
34094
34360
  maxWidth: getEffectiveWidth(initialAvailableWidth),
34095
34361
  segments: []
34096
34362
  };
@@ -34100,6 +34366,7 @@ async function measureParagraphBlock(block, maxWidth) {
34100
34366
  tabStopCursor = nextIndex;
34101
34367
  const tabAdvance = Math.max(0, target - currentLine.width);
34102
34368
  currentLine.width = roundValue(currentLine.width + tabAdvance);
34369
+ currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run);
34103
34370
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run.fontSize);
34104
34371
  currentLine.toRun = runIndex;
34105
34372
  currentLine.toChar = charPosInRun;
@@ -34136,7 +34403,7 @@ async function measureParagraphBlock(block, maxWidth) {
34136
34403
  lines.push(fallbackLine);
34137
34404
  }
34138
34405
  if (currentLine) {
34139
- const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing);
34406
+ const metrics = calculateTypographyMetrics(currentLine.maxFontSize, spacing, currentLine.maxFontInfo);
34140
34407
  const finalLine = {
34141
34408
  ...currentLine,
34142
34409
  ...metrics
@@ -37771,7 +38038,12 @@ setupPointerHandlers_fn = function() {
37771
38038
  setupInputBridge_fn = function() {
37772
38039
  __privateGet(this, _inputBridge)?.destroy();
37773
38040
  const win = __privateGet(this, _visibleHost).ownerDocument?.defaultView ?? window;
37774
- __privateSet(this, _inputBridge, new PresentationInputBridge(win, __privateGet(this, _visibleHost), () => __privateMethod(this, _PresentationEditor_instances, getActiveDomTarget_fn).call(this)));
38041
+ __privateSet(this, _inputBridge, new PresentationInputBridge(
38042
+ win,
38043
+ __privateGet(this, _visibleHost),
38044
+ () => __privateMethod(this, _PresentationEditor_instances, getActiveDomTarget_fn).call(this),
38045
+ () => __privateGet(this, _documentMode) !== "viewing"
38046
+ ));
37775
38047
  __privateGet(this, _inputBridge).bind();
37776
38048
  };
37777
38049
  initHeaderFooterRegistry_fn = function() {
@@ -38227,6 +38499,10 @@ updateSelection_fn = function() {
38227
38499
  if (!__privateGet(this, _localSelectionLayer)) {
38228
38500
  return;
38229
38501
  }
38502
+ if (__privateGet(this, _documentMode) === "viewing") {
38503
+ __privateGet(this, _localSelectionLayer).innerHTML = "";
38504
+ return;
38505
+ }
38230
38506
  const layout = __privateGet(this, _layoutState).layout;
38231
38507
  const selection = this.getActiveEditor().state?.selection;
38232
38508
  __privateGet(this, _localSelectionLayer).innerHTML = "";
@@ -39588,11 +39864,28 @@ _PresentationEditor.CURSOR_STYLES = {
39588
39864
  };
39589
39865
  let PresentationEditor = _PresentationEditor;
39590
39866
  class PresentationInputBridge {
39591
- constructor(windowRoot, layoutSurface, getTargetDom, onTargetChanged, options) {
39867
+ /**
39868
+ * Creates a new PresentationInputBridge that forwards user input events from the visible layout
39869
+ * surface to the hidden editor DOM. This enables input handling when the actual editor is not
39870
+ * directly visible to the user.
39871
+ *
39872
+ * @param windowRoot - The window object containing the layout surface and editor target
39873
+ * @param layoutSurface - The visible HTML element that receives user input events (e.g., keyboard, mouse)
39874
+ * @param getTargetDom - Callback that returns the hidden editor's DOM element where events should be forwarded
39875
+ * @param isEditable - Callback that returns whether the editor is in an editable mode (editing/suggesting).
39876
+ * When this returns false (e.g., in viewing mode), keyboard, text, and composition
39877
+ * events will not be forwarded to prevent document modification.
39878
+ * @param onTargetChanged - Optional callback invoked when the target editor DOM element changes
39879
+ * @param options - Optional configuration including:
39880
+ * - useWindowFallback: Whether to attach window-level event listeners as fallback
39881
+ */
39882
+ constructor(windowRoot, layoutSurface, getTargetDom, isEditable, onTargetChanged, options) {
39592
39883
  __privateAdd(this, _PresentationInputBridge_instances);
39593
39884
  __privateAdd(this, _windowRoot);
39594
39885
  __privateAdd(this, _layoutSurfaces);
39595
39886
  __privateAdd(this, _getTargetDom);
39887
+ /** Callback that returns whether the editor is in an editable mode (editing/suggesting vs viewing) */
39888
+ __privateAdd(this, _isEditable);
39596
39889
  __privateAdd(this, _onTargetChanged);
39597
39890
  __privateAdd(this, _listeners);
39598
39891
  __privateAdd(this, _currentTarget, null);
@@ -39601,6 +39894,7 @@ class PresentationInputBridge {
39601
39894
  __privateSet(this, _windowRoot, windowRoot);
39602
39895
  __privateSet(this, _layoutSurfaces, /* @__PURE__ */ new Set([layoutSurface]));
39603
39896
  __privateSet(this, _getTargetDom, getTargetDom);
39897
+ __privateSet(this, _isEditable, isEditable);
39604
39898
  __privateSet(this, _onTargetChanged, onTargetChanged);
39605
39899
  __privateSet(this, _listeners, []);
39606
39900
  __privateSet(this, _useWindowFallback, options?.useWindowFallback ?? false);
@@ -39667,6 +39961,7 @@ class PresentationInputBridge {
39667
39961
  _windowRoot = new WeakMap();
39668
39962
  _layoutSurfaces = new WeakMap();
39669
39963
  _getTargetDom = new WeakMap();
39964
+ _isEditable = new WeakMap();
39670
39965
  _onTargetChanged = new WeakMap();
39671
39966
  _listeners = new WeakMap();
39672
39967
  _currentTarget = new WeakMap();
@@ -39704,6 +39999,9 @@ dispatchToTarget_fn = function(originalEvent, synthetic) {
39704
39999
  * @param event - The keyboard event from the layout surface
39705
40000
  */
39706
40001
  forwardKeyboardEvent_fn = function(event) {
40002
+ if (!__privateGet(this, _isEditable).call(this)) {
40003
+ return;
40004
+ }
39707
40005
  if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
39708
40006
  return;
39709
40007
  }
@@ -39737,6 +40035,9 @@ forwardKeyboardEvent_fn = function(event) {
39737
40035
  * @param event - The input event from the layout surface
39738
40036
  */
39739
40037
  forwardTextEvent_fn = function(event) {
40038
+ if (!__privateGet(this, _isEditable).call(this)) {
40039
+ return;
40040
+ }
39740
40041
  if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
39741
40042
  return;
39742
40043
  }
@@ -39773,6 +40074,9 @@ forwardTextEvent_fn = function(event) {
39773
40074
  * @param event - The composition event from the layout surface
39774
40075
  */
39775
40076
  forwardCompositionEvent_fn = function(event) {
40077
+ if (!__privateGet(this, _isEditable).call(this)) {
40078
+ return;
40079
+ }
39776
40080
  if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
39777
40081
  return;
39778
40082
  }
@@ -39797,6 +40101,9 @@ forwardCompositionEvent_fn = function(event) {
39797
40101
  * @param event - The context menu event from the layout surface
39798
40102
  */
39799
40103
  forwardContextMenu_fn = function(event) {
40104
+ if (!__privateGet(this, _isEditable).call(this)) {
40105
+ return;
40106
+ }
39800
40107
  if (__privateMethod(this, _PresentationInputBridge_instances, shouldSkipSurface_fn).call(this, event)) {
39801
40108
  return;
39802
40109
  }