@harbour-enterprises/superdoc 1.0.0-beta.30 → 1.0.0-beta.31

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-BADCvUNL.cjs → PdfViewer-C8iiBtQt.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-C2nY5qD8.es.js → PdfViewer-jGctuklH.es.js} +1 -1
  3. package/dist/chunks/{index-DmelLGEj.es.js → index-Bu5UUj9S.es.js} +3 -3
  4. package/dist/chunks/{index-DTgPk1zO.cjs → index-ELjoBC86.cjs} +3 -3
  5. package/dist/chunks/{index-DUzV7kkk-CM3uwGCb.cjs → index-eG-VYUeN-CG3M1n5T.cjs} +1 -1
  6. package/dist/chunks/{index-DUzV7kkk-BvBMF_lo.es.js → index-eG-VYUeN-CIuOnW8W.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-Be9785LD.es.js → super-editor.es-BAKZgAuj.es.js} +424 -52
  8. package/dist/chunks/{super-editor.es-463G9jKM.cjs → super-editor.es-DatOA_vA.cjs} +424 -52
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-U59bT3FO.js → converter-CRKt1TG_.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-DSnoGkju.js → docx-zipper-CgVw58T-.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-DRHVtMIR.js → editor-COQCS1pn.js} +423 -37
  13. package/dist/super-editor/chunks/{index-DUzV7kkk.js → index-eG-VYUeN.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-DbBLxo6N.js → toolbar-B3CSV2yT.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 +410 -38
  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, _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;
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, _dragAnchor, _isDragging, _dragExtensionMode, _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, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _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-U59bT3FO.js";
16
- import { D as DocxZipper } from "./docx-zipper-DSnoGkju.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-CRKt1TG_.js";
16
+ import { D as DocxZipper } from "./docx-zipper-CgVw58T-.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() {
@@ -13913,7 +13913,7 @@ const isHeadless = (editor) => {
13913
13913
  const shouldSkipNodeView = (editor) => {
13914
13914
  return isHeadless(editor);
13915
13915
  };
13916
- const summaryVersion = "1.0.0-beta.30";
13916
+ const summaryVersion = "1.0.0-beta.31";
13917
13917
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
13918
13918
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
13919
13919
  function mapAttributes(attrs) {
@@ -14705,7 +14705,7 @@ const _Editor = class _Editor extends EventEmitter {
14705
14705
  { default: remarkStringify },
14706
14706
  { default: remarkGfm }
14707
14707
  ] = await Promise.all([
14708
- import("./index-DUzV7kkk.js"),
14708
+ import("./index-eG-VYUeN.js"),
14709
14709
  import("./index-DRCvimau.js"),
14710
14710
  import("./index-C_x_N6Uh.js"),
14711
14711
  import("./index-D_sWOSiG.js"),
@@ -14910,7 +14910,7 @@ const _Editor = class _Editor extends EventEmitter {
14910
14910
  * Process collaboration migrations
14911
14911
  */
14912
14912
  processCollaborationMigrations() {
14913
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.30");
14913
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.31");
14914
14914
  if (!this.options.ydoc) return;
14915
14915
  const metaMap = this.options.ydoc.getMap("meta");
14916
14916
  let docVersion = metaMap.get("version");
@@ -17035,9 +17035,11 @@ const applyMarksToRun = (run, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG,
17035
17035
  case TRACK_INSERT_MARK:
17036
17036
  case TRACK_DELETE_MARK:
17037
17037
  case TRACK_FORMAT_MARK: {
17038
- const tracked = buildTrackedChangeMetaFromMark(mark);
17039
- if (tracked) {
17040
- run.trackedChange = selectTrackedChangeMeta(run.trackedChange, tracked);
17038
+ if (!isTabRun2) {
17039
+ const tracked = buildTrackedChangeMetaFromMark(mark);
17040
+ if (tracked) {
17041
+ run.trackedChange = selectTrackedChangeMeta(run.trackedChange, tracked);
17042
+ }
17041
17043
  }
17042
17044
  break;
17043
17045
  }
@@ -22577,6 +22579,38 @@ function measureCharacterXSegmentBased(block, line, charOffset, ctx2) {
22577
22579
  }
22578
22580
  return line.width;
22579
22581
  }
22582
+ function charOffsetToPm(block, line, charOffset, fallbackPmStart) {
22583
+ if (!Number.isFinite(charOffset) || !Number.isFinite(fallbackPmStart)) {
22584
+ console.warn("[charOffsetToPm] Invalid input:", { charOffset, fallbackPmStart });
22585
+ return fallbackPmStart;
22586
+ }
22587
+ const safeCharOffset = Math.max(0, charOffset);
22588
+ if (block.kind !== "paragraph") {
22589
+ return fallbackPmStart + safeCharOffset;
22590
+ }
22591
+ const runs = sliceRunsForLine$1(block, line);
22592
+ let cursor = 0;
22593
+ let lastPm = fallbackPmStart;
22594
+ for (const run of runs) {
22595
+ const isTab = isTabRun$1(run);
22596
+ const text = "src" in run || run.kind === "lineBreak" || run.kind === "break" ? "" : run.text ?? "";
22597
+ const runLength = isTab ? TAB_CHAR_LENGTH : text.length;
22598
+ const runPmStart = typeof run.pmStart === "number" ? run.pmStart : null;
22599
+ const runPmEnd = typeof run.pmEnd === "number" ? run.pmEnd : runPmStart != null ? runPmStart + runLength : null;
22600
+ if (runPmStart != null) {
22601
+ lastPm = runPmStart;
22602
+ }
22603
+ if (safeCharOffset <= cursor + runLength) {
22604
+ const offsetInRun = Math.max(0, safeCharOffset - cursor);
22605
+ return runPmStart != null ? runPmStart + Math.min(offsetInRun, runLength) : fallbackPmStart + safeCharOffset;
22606
+ }
22607
+ if (runPmEnd != null) {
22608
+ lastPm = runPmEnd;
22609
+ }
22610
+ cursor += runLength;
22611
+ }
22612
+ return lastPm;
22613
+ }
22580
22614
  function findCharacterAtX(block, line, x, pmStart) {
22581
22615
  const ctx2 = getMeasurementContext();
22582
22616
  if (!ctx2) {
@@ -22591,9 +22625,10 @@ function findCharacterAtX(block, line, x, pmStart) {
22591
22625
  );
22592
22626
  const ratio = Math.max(0, Math.min(1, x / line.width));
22593
22627
  const charOffset = Math.round(ratio * charsInLine);
22628
+ const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
22594
22629
  return {
22595
22630
  charOffset,
22596
- pmPosition: pmStart + charOffset
22631
+ pmPosition: pmPosition2
22597
22632
  };
22598
22633
  }
22599
22634
  const runs = sliceRunsForLine$1(block, line);
@@ -22609,11 +22644,10 @@ function findCharacterAtX(block, line, x, pmStart) {
22609
22644
  const midpoint = startX + tabWidth / 2;
22610
22645
  const offsetInRun = safeX < midpoint ? 0 : TAB_CHAR_LENGTH;
22611
22646
  const charOffset = currentCharOffset + offsetInRun;
22612
- const pmBase = run.pmStart ?? pmStart + currentCharOffset;
22613
- const pmPosition = pmBase + offsetInRun;
22647
+ const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
22614
22648
  return {
22615
22649
  charOffset,
22616
- pmPosition
22650
+ pmPosition: pmPosition2
22617
22651
  };
22618
22652
  }
22619
22653
  currentX = endX;
@@ -22630,9 +22664,10 @@ function findCharacterAtX(block, line, x, pmStart) {
22630
22664
  const charX = currentX + measured2.width + computeLetterSpacingWidth(run, i, runLength);
22631
22665
  if (charX >= safeX) {
22632
22666
  if (i === 0) {
22667
+ const pmPosition3 = charOffsetToPm(block, line, currentCharOffset, pmStart);
22633
22668
  return {
22634
22669
  charOffset: currentCharOffset,
22635
- pmPosition: pmStart + currentCharOffset
22670
+ pmPosition: pmPosition3
22636
22671
  };
22637
22672
  }
22638
22673
  const prevText = text.slice(0, i - 1);
@@ -22641,9 +22676,10 @@ function findCharacterAtX(block, line, x, pmStart) {
22641
22676
  const distToPrev = Math.abs(safeX - prevX);
22642
22677
  const distToCurrent = Math.abs(safeX - charX);
22643
22678
  const charOffset = distToPrev < distToCurrent ? currentCharOffset + i - 1 : currentCharOffset + i;
22679
+ const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
22644
22680
  return {
22645
22681
  charOffset,
22646
- pmPosition: pmStart + charOffset
22682
+ pmPosition: pmPosition2
22647
22683
  };
22648
22684
  }
22649
22685
  }
@@ -22651,9 +22687,10 @@ function findCharacterAtX(block, line, x, pmStart) {
22651
22687
  currentX += measured.width + computeLetterSpacingWidth(run, runLength, runLength);
22652
22688
  currentCharOffset += runLength;
22653
22689
  }
22690
+ const pmPosition = charOffsetToPm(block, line, currentCharOffset, pmStart);
22654
22691
  return {
22655
22692
  charOffset: currentCharOffset,
22656
- pmPosition: pmStart + currentCharOffset
22693
+ pmPosition
22657
22694
  };
22658
22695
  }
22659
22696
  const computeLetterSpacingWidth = (run, precedingChars, runLength) => {
@@ -22859,7 +22896,9 @@ function processFragment(fragmentEl, viewX, viewY) {
22859
22896
  pmEnd: spanEnd,
22860
22897
  text: targetEl.textContent?.substring(0, 30),
22861
22898
  visibility: targetEl.style.visibility,
22862
- rect: { left: targetRect.left, right: targetRect.right, width: targetRect.width }
22899
+ rect: { left: targetRect.left, right: targetRect.right, width: targetRect.width },
22900
+ pageX: viewX,
22901
+ pageY: viewY
22863
22902
  });
22864
22903
  if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd)) {
22865
22904
  return null;
@@ -26425,6 +26464,88 @@ async function layoutHeaderFooterWithCache(sections, constraints, measureBlock2,
26425
26464
  }
26426
26465
  return result;
26427
26466
  }
26467
+ function findWordBoundaries(blocks, pos) {
26468
+ const blockInfo = findBlockAtPosition(blocks, pos);
26469
+ if (!blockInfo) return null;
26470
+ const { block, localPos } = blockInfo;
26471
+ if (block.kind !== "paragraph") return null;
26472
+ const { text, pmStart } = extractBlockText(block);
26473
+ if (text.length === 0) return null;
26474
+ const clampedPos = Math.max(0, Math.min(localPos, text.length));
26475
+ let wordStart = clampedPos;
26476
+ while (wordStart > 0 && isWordChar(text[wordStart - 1])) {
26477
+ wordStart--;
26478
+ }
26479
+ let wordEnd = clampedPos;
26480
+ while (wordEnd < text.length && isWordChar(text[wordEnd])) {
26481
+ wordEnd++;
26482
+ }
26483
+ if (wordStart === wordEnd) {
26484
+ while (wordStart > 0 && isWhitespace(text[wordStart - 1])) {
26485
+ wordStart--;
26486
+ }
26487
+ while (wordEnd < text.length && isWhitespace(text[wordEnd])) {
26488
+ wordEnd++;
26489
+ }
26490
+ if (wordStart === wordEnd) {
26491
+ return null;
26492
+ }
26493
+ }
26494
+ return {
26495
+ from: pmStart + wordStart,
26496
+ to: pmStart + wordEnd
26497
+ };
26498
+ }
26499
+ function findParagraphBoundaries(blocks, pos) {
26500
+ const blockInfo = findBlockAtPosition(blocks, pos);
26501
+ if (!blockInfo) return null;
26502
+ const { block } = blockInfo;
26503
+ if (block.kind === "paragraph") {
26504
+ const { pmStart, pmEnd } = extractBlockText(block);
26505
+ return { from: pmStart, to: pmEnd };
26506
+ }
26507
+ if (block.kind === "image") {
26508
+ return { from: pos, to: pos + 1 };
26509
+ }
26510
+ return null;
26511
+ }
26512
+ function extractBlockText(block) {
26513
+ if (block.kind !== "paragraph") {
26514
+ return { text: "", pmStart: 0, pmEnd: 0 };
26515
+ }
26516
+ let text = "";
26517
+ let pmStart = Infinity;
26518
+ let pmEnd = 0;
26519
+ for (const run of block.runs) {
26520
+ text += "src" in run || run.kind === "lineBreak" || run.kind === "break" ? "" : run.text;
26521
+ if (run.pmStart !== void 0) {
26522
+ pmStart = Math.min(pmStart, run.pmStart);
26523
+ }
26524
+ if (run.pmEnd !== void 0) {
26525
+ pmEnd = Math.max(pmEnd, run.pmEnd);
26526
+ }
26527
+ }
26528
+ if (pmStart === Infinity) pmStart = 0;
26529
+ if (pmEnd === 0 && text.length > 0) pmEnd = pmStart + text.length;
26530
+ return { text, pmStart, pmEnd };
26531
+ }
26532
+ function findBlockAtPosition(blocks, pos) {
26533
+ for (const block of blocks) {
26534
+ if (block.kind === "paragraph") {
26535
+ const { pmStart, pmEnd } = extractBlockText(block);
26536
+ if (pos >= pmStart && pos <= pmEnd) {
26537
+ return { block, localPos: pos - pmStart };
26538
+ }
26539
+ }
26540
+ }
26541
+ return null;
26542
+ }
26543
+ function isWordChar(char) {
26544
+ return /[\p{L}\p{N}_]/u.test(char);
26545
+ }
26546
+ function isWhitespace(char) {
26547
+ return /\s/.test(char);
26548
+ }
26428
26549
  let canvas = null;
26429
26550
  let ctx = null;
26430
26551
  function getCtx() {
@@ -27218,6 +27339,12 @@ const isAtomicFragment = (fragment) => {
27218
27339
  };
27219
27340
  const logClickStage = (_level, _stage, _payload) => {
27220
27341
  };
27342
+ const logPositionDebug = (payload) => {
27343
+ return;
27344
+ };
27345
+ const logSelectionMapDebug = (payload) => {
27346
+ return;
27347
+ };
27221
27348
  const blockPmRangeFromAttrs = (block) => {
27222
27349
  const attrs = block?.attrs;
27223
27350
  const pmStart = typeof attrs?.pmStart === "number" ? attrs.pmStart : void 0;
@@ -27487,6 +27614,10 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
27487
27614
  return null;
27488
27615
  }
27489
27616
  const column = determineColumn(layout, fragment.x);
27617
+ logPositionDebug({
27618
+ blockId: fragment.blockId,
27619
+ x: pageRelativePoint.x - fragment.x
27620
+ });
27490
27621
  logClickStage("log", "success", {
27491
27622
  blockId: fragment.blockId
27492
27623
  });
@@ -27595,10 +27726,13 @@ function selectionToRects(layout, blocks, measures, from2, to) {
27595
27726
  const sliceFrom = Math.max(range.pmStart, from2);
27596
27727
  const sliceTo = Math.min(range.pmEnd, to);
27597
27728
  if (sliceFrom >= sliceTo) return;
27598
- const x1 = mapPmToX(block, line, sliceFrom - range.pmStart, fragment.width);
27599
- const x2 = mapPmToX(block, line, sliceTo - range.pmStart, fragment.width);
27600
- const rectX = fragment.x + Math.min(x1, x2);
27601
- const rectWidth = Math.max(1, Math.abs(x2 - x1));
27729
+ const charOffsetFrom = pmPosToCharOffset(block, line, sliceFrom);
27730
+ const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
27731
+ const startX = mapPmToX(block, line, charOffsetFrom, fragment.width);
27732
+ const endX = mapPmToX(block, line, charOffsetTo, fragment.width);
27733
+ const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
27734
+ const rectX = fragment.x + markerWidth + Math.min(startX, endX);
27735
+ const rectWidth = Math.max(1, Math.abs(endX - startX));
27602
27736
  const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
27603
27737
  const rectY = fragment.y + lineOffset;
27604
27738
  rects.push({
@@ -27756,6 +27890,57 @@ function computeLinePmRange$1(block, line) {
27756
27890
  }
27757
27891
  return { pmStart, pmEnd };
27758
27892
  }
27893
+ function pmPosToCharOffset(block, line, pmPos) {
27894
+ if (block.kind !== "paragraph") return 0;
27895
+ let charOffset = 0;
27896
+ for (let runIndex = line.fromRun; runIndex <= line.toRun; runIndex += 1) {
27897
+ const run = block.runs[runIndex];
27898
+ if (!run) continue;
27899
+ const text = "src" in run || run.kind === "lineBreak" || run.kind === "break" ? "" : run.text ?? "";
27900
+ const runTextLength = text.length;
27901
+ const runPmStart = run.pmStart ?? null;
27902
+ const runPmEnd = run.pmEnd ?? (runPmStart != null ? runPmStart + runTextLength : null);
27903
+ if (runPmStart == null || runPmEnd == null || runTextLength === 0) continue;
27904
+ const isFirstRun = runIndex === line.fromRun;
27905
+ const isLastRun = runIndex === line.toRun;
27906
+ const lineStartChar = isFirstRun ? line.fromChar : 0;
27907
+ const lineEndChar = isLastRun ? line.toChar : runTextLength;
27908
+ const runSliceCharCount = lineEndChar - lineStartChar;
27909
+ const runPmRange = runPmEnd - runPmStart;
27910
+ const runSlicePmStart = runPmStart + lineStartChar / runTextLength * runPmRange;
27911
+ const runSlicePmEnd = runPmStart + lineEndChar / runTextLength * runPmRange;
27912
+ if (pmPos >= runSlicePmStart && pmPos <= runSlicePmEnd) {
27913
+ const runSlicePmRange = runSlicePmEnd - runSlicePmStart;
27914
+ if (runSlicePmRange > 0) {
27915
+ const pmOffsetInSlice = pmPos - runSlicePmStart;
27916
+ const charOffsetInSlice = Math.round(pmOffsetInSlice / runSlicePmRange * runSliceCharCount);
27917
+ const result = charOffset + Math.min(charOffsetInSlice, runSliceCharCount);
27918
+ const runText2 = text;
27919
+ const offsetInRun = result - charOffset - (isFirstRun ? 0 : 0);
27920
+ logSelectionMapDebug({
27921
+ blockId: block.id,
27922
+ lineFromRun: line.fromRun,
27923
+ lineToRun: line.toRun,
27924
+ runTextPreview: runText2.slice(Math.max(0, offsetInRun - 10), Math.min(runText2.length, offsetInRun + 10))
27925
+ });
27926
+ return result;
27927
+ }
27928
+ logSelectionMapDebug({
27929
+ blockId: block.id
27930
+ });
27931
+ return charOffset;
27932
+ }
27933
+ if (pmPos > runSlicePmEnd) {
27934
+ charOffset += runSliceCharCount;
27935
+ }
27936
+ }
27937
+ logSelectionMapDebug({
27938
+ blockId: block.id,
27939
+ lineFromRun: line.fromRun,
27940
+ lineToRun: line.toRun
27941
+ });
27942
+ return charOffset;
27943
+ }
27759
27944
  const determineColumn = (layout, fragmentX) => {
27760
27945
  const columns = layout.columns;
27761
27946
  if (!columns || columns.count <= 1) return 0;
@@ -27800,8 +27985,8 @@ const mapPointToPm = (block, line, x, isRTL) => {
27800
27985
  if (isRTL) {
27801
27986
  const charOffset = result.charOffset;
27802
27987
  const charsInLine = Math.max(1, line.toChar - line.fromChar);
27803
- const reversedOffset = charsInLine - charOffset;
27804
- return range.pmStart + reversedOffset;
27988
+ const reversedOffset = Math.max(0, Math.min(charsInLine, charsInLine - charOffset));
27989
+ return charOffsetToPm(block, line, reversedOffset, range.pmStart);
27805
27990
  }
27806
27991
  return result.pmPosition;
27807
27992
  };
@@ -31658,8 +31843,22 @@ const _DomPainter = class _DomPainter {
31658
31843
  const paraIndentRight = paraIndent?.right ?? 0;
31659
31844
  const suppressFirstLineIndent = block.attrs?.suppressFirstLineIndent === true;
31660
31845
  const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
31846
+ const isListParagraph = !!(fragment.markerWidth && wordLayout?.marker);
31847
+ const lastRun = block.runs.length > 0 ? block.runs[block.runs.length - 1] : null;
31848
+ const paragraphEndsWithLineBreak = lastRun?.kind === "lineBreak";
31661
31849
  lines.forEach((line, index2) => {
31662
- const lineEl = this.renderLine(block, line, context);
31850
+ const availableWidthOverride = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
31851
+ const isLastLineOfFragment = index2 === lines.length - 1;
31852
+ const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
31853
+ const shouldSkipJustifyForLastLine = isLastLineOfParagraph && !paragraphEndsWithLineBreak;
31854
+ const lineEl = this.renderLine(
31855
+ block,
31856
+ line,
31857
+ context,
31858
+ availableWidthOverride,
31859
+ fragment.fromLine + index2,
31860
+ isListParagraph || shouldSkipJustifyForLastLine
31861
+ );
31663
31862
  const isListFirstLine = index2 === 0 && !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
31664
31863
  const hasExplicitSegmentPositioning = line.segments?.some((seg) => seg.x !== void 0);
31665
31864
  const isFirstLine = index2 === 0 && !fragment.continuesFromPrev;
@@ -31888,8 +32087,13 @@ const _DomPainter = class _DomPainter {
31888
32087
  const lines = itemMeasure.paragraph.lines.slice(fragment.fromLine, fragment.toLine);
31889
32088
  const contentAttrs = wordLayout ? item.paragraph.attrs : stripListIndent(item.paragraph.attrs);
31890
32089
  applyParagraphBlockStyles(contentEl, contentAttrs);
31891
- lines.forEach((line) => {
31892
- const lineEl = this.renderLine(item.paragraph, line, context);
32090
+ contentEl.style.textAlign = "left";
32091
+ const paraForList = {
32092
+ ...item.paragraph,
32093
+ attrs: { ...item.paragraph.attrs || {}, alignment: "left" }
32094
+ };
32095
+ lines.forEach((line, idx) => {
32096
+ const lineEl = this.renderLine(paraForList, line, context, fragment.width, fragment.fromLine + idx, true);
31893
32097
  contentEl.appendChild(lineEl);
31894
32098
  });
31895
32099
  fragmentEl.appendChild(contentEl);
@@ -32411,12 +32615,15 @@ const _DomPainter = class _DomPainter {
32411
32615
  const applyFragmentFrameWithSection = (el, frag) => {
32412
32616
  this.applyFragmentFrame(el, frag, context.section);
32413
32617
  };
32618
+ const renderLineForTableCell = (block, line, ctx2) => {
32619
+ return this.renderLine(block, line, ctx2, void 0, void 0, true);
32620
+ };
32414
32621
  return renderTableFragment({
32415
32622
  doc: this.doc,
32416
32623
  fragment,
32417
32624
  context,
32418
32625
  blockLookup: this.blockLookup,
32419
- renderLine: this.renderLine.bind(this),
32626
+ renderLine: renderLineForTableCell,
32420
32627
  applyFragmentFrame: applyFragmentFrameWithSection,
32421
32628
  applySdtDataset: this.applySdtDataset.bind(this),
32422
32629
  applyStyles: applyStyles$2
@@ -32751,7 +32958,18 @@ const _DomPainter = class _DomPainter {
32751
32958
  }
32752
32959
  return img;
32753
32960
  }
32754
- renderLine(block, line, context) {
32961
+ /**
32962
+ * Renders a single line of a paragraph block.
32963
+ *
32964
+ * @param block - The paragraph block containing the line
32965
+ * @param line - The line measurement data
32966
+ * @param context - Rendering context with fragment information
32967
+ * @param availableWidthOverride - Optional override for available width used in justification calculations
32968
+ * @param lineIndex - Optional zero-based index of the line within the fragment
32969
+ * @param skipJustify - When true, prevents justification even if alignment is 'justify'
32970
+ * @returns The rendered line element
32971
+ */
32972
+ renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify) {
32755
32973
  if (!this.doc) {
32756
32974
  throw new Error("DomPainter: document is not available");
32757
32975
  }
@@ -32763,8 +32981,10 @@ const _DomPainter = class _DomPainter {
32763
32981
  el.setAttribute("styleid", styleId);
32764
32982
  }
32765
32983
  const alignment = block.attrs?.alignment;
32766
- if (alignment === "center" || alignment === "right" || alignment === "justify") {
32767
- el.style.textAlign = alignment === "justify" ? "justify" : alignment;
32984
+ if (alignment === "center" || alignment === "right") {
32985
+ el.style.textAlign = alignment;
32986
+ } else if (alignment === "justify") {
32987
+ el.style.textAlign = "left";
32768
32988
  } else {
32769
32989
  el.style.textAlign = "left";
32770
32990
  }
@@ -32777,6 +32997,7 @@ const _DomPainter = class _DomPainter {
32777
32997
  }
32778
32998
  const runsForLine = sliceRunsForLine(block, line);
32779
32999
  const trackedConfig = this.resolveTrackedChangesConfig(block);
33000
+ const textSlices = runsForLine.length > 0 ? runsForLine.filter((r2) => (r2.kind === "text" || r2.kind === void 0) && "text" in r2 && r2.text != null).map((r2) => r2.text) : gatherTextSlicesForLine(block, line);
32780
33001
  if (runsForLine.length === 0) {
32781
33002
  const span = this.doc.createElement("span");
32782
33003
  span.innerHTML = "&nbsp;";
@@ -32823,6 +33044,19 @@ const _DomPainter = class _DomPainter {
32823
33044
  });
32824
33045
  }
32825
33046
  const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
33047
+ const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
33048
+ const shouldJustify = !skipJustify && alignment === "justify" && !hasExplicitPositioning;
33049
+ if (shouldJustify) {
33050
+ const spaceCount = textSlices.reduce(
33051
+ (sum, s2) => sum + Array.from(s2).filter((ch) => ch === " " || ch === " ").length,
33052
+ 0
33053
+ );
33054
+ const slack = Math.max(0, availableWidth - line.width);
33055
+ if (spaceCount > 0 && slack > 0) {
33056
+ const extraPerSpace = slack / spaceCount;
33057
+ el.style.wordSpacing = `${extraPerSpace}px`;
33058
+ }
33059
+ }
32826
33060
  if (hasExplicitPositioning && line.segments) {
32827
33061
  let cumulativeX = 0;
32828
33062
  const segmentsByRun = /* @__PURE__ */ new Map();
@@ -33606,6 +33840,23 @@ const applyParagraphShadingStyles = (element, shading) => {
33606
33840
  if (!shading?.fill) return;
33607
33841
  element.style.backgroundColor = shading.fill;
33608
33842
  };
33843
+ const gatherTextSlicesForLine = (block, line) => {
33844
+ const slices = [];
33845
+ const startRun = line.fromRun ?? 0;
33846
+ const endRun = line.toRun ?? startRun;
33847
+ for (let runIndex = startRun; runIndex <= endRun; runIndex += 1) {
33848
+ const run = block.runs[runIndex];
33849
+ if (!run || run.kind !== "text" && run.kind !== void 0 || !("text" in run) || !run.text) continue;
33850
+ const isFirst = runIndex === startRun;
33851
+ const isLast = runIndex === endRun;
33852
+ const start2 = isFirst ? line.fromChar ?? 0 : 0;
33853
+ const end2 = isLast ? line.toChar ?? run.text.length : run.text.length;
33854
+ if (start2 >= end2) continue;
33855
+ const slice2 = run.text.slice(start2, end2);
33856
+ if (slice2) slices.push(slice2);
33857
+ }
33858
+ return slices;
33859
+ };
33609
33860
  const sliceRunsForLine = (block, line) => {
33610
33861
  const result = [];
33611
33862
  for (let runIndex = line.fromRun; runIndex <= line.toRun; runIndex += 1) {
@@ -36529,6 +36780,10 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
36529
36780
  __privateAdd(this, _lastClickTime, 0);
36530
36781
  __privateAdd(this, _lastClickPosition, { x: 0, y: 0 });
36531
36782
  __privateAdd(this, _lastSelectedImageBlockId, null);
36783
+ // Drag selection state
36784
+ __privateAdd(this, _dragAnchor, null);
36785
+ __privateAdd(this, _isDragging, false);
36786
+ __privateAdd(this, _dragExtensionMode, "char");
36532
36787
  // Remote cursor/presence state management
36533
36788
  /** Map of clientId -> normalized remote cursor state */
36534
36789
  __privateAdd(this, _remoteCursorState, /* @__PURE__ */ new Map());
@@ -36680,13 +36935,56 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
36680
36935
  this.emit("imageDeselected", { blockId: __privateGet(this, _lastSelectedImageBlockId) });
36681
36936
  __privateSet(this, _lastSelectedImageBlockId, null);
36682
36937
  }
36938
+ if (event.shiftKey && __privateGet(this, _editor3).state.selection.$anchor) {
36939
+ const anchor = __privateGet(this, _editor3).state.selection.anchor;
36940
+ const head = hit.pos;
36941
+ const { selAnchor, selHead } = __privateMethod(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet(this, _dragExtensionMode));
36942
+ try {
36943
+ const tr = __privateGet(this, _editor3).state.tr.setSelection(TextSelection.create(__privateGet(this, _editor3).state.doc, selAnchor, selHead));
36944
+ __privateGet(this, _editor3).view?.dispatch(tr);
36945
+ __privateMethod(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
36946
+ } catch (error) {
36947
+ console.warn("[SELECTION] Failed to extend selection on shift+click:", {
36948
+ error,
36949
+ anchor,
36950
+ head,
36951
+ selAnchor,
36952
+ selHead,
36953
+ mode: __privateGet(this, _dragExtensionMode)
36954
+ });
36955
+ }
36956
+ if (document.activeElement instanceof HTMLElement) {
36957
+ document.activeElement.blur();
36958
+ }
36959
+ const editorDom2 = __privateGet(this, _editor3).view?.dom;
36960
+ if (editorDom2) {
36961
+ editorDom2.focus();
36962
+ __privateGet(this, _editor3).view?.focus();
36963
+ }
36964
+ return;
36965
+ }
36683
36966
  const clickDepth = __privateMethod(this, _PresentationEditor_instances, registerPointerClick_fn).call(this, event);
36967
+ if (clickDepth === 1) {
36968
+ __privateSet(this, _dragAnchor, hit.pos);
36969
+ }
36970
+ __privateSet(this, _isDragging, true);
36971
+ if (clickDepth >= 3) {
36972
+ __privateSet(this, _dragExtensionMode, "para");
36973
+ } else if (clickDepth === 2) {
36974
+ __privateSet(this, _dragExtensionMode, "word");
36975
+ } else {
36976
+ __privateSet(this, _dragExtensionMode, "char");
36977
+ }
36978
+ if (typeof __privateGet(this, _viewportHost).setPointerCapture === "function") {
36979
+ __privateGet(this, _viewportHost).setPointerCapture(event.pointerId);
36980
+ }
36684
36981
  let handledByDepth = false;
36685
36982
  if (__privateGet(this, _session).mode === "body") {
36983
+ const selectionPos = clickDepth >= 2 && __privateGet(this, _dragAnchor) !== null ? __privateGet(this, _dragAnchor) : hit.pos;
36686
36984
  if (clickDepth >= 3) {
36687
- handledByDepth = __privateMethod(this, _PresentationEditor_instances, selectParagraphAt_fn).call(this, hit.pos);
36985
+ handledByDepth = __privateMethod(this, _PresentationEditor_instances, selectParagraphAt_fn).call(this, selectionPos);
36688
36986
  } else if (clickDepth === 2) {
36689
- handledByDepth = __privateMethod(this, _PresentationEditor_instances, selectWordAt_fn).call(this, hit.pos);
36987
+ handledByDepth = __privateMethod(this, _PresentationEditor_instances, selectWordAt_fn).call(this, selectionPos);
36690
36988
  }
36691
36989
  }
36692
36990
  if (!handledByDepth) {
@@ -36711,6 +37009,36 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
36711
37009
  if (!__privateGet(this, _layoutState).layout) return;
36712
37010
  const normalized = __privateMethod(this, _PresentationEditor_instances, normalizeClientPoint_fn).call(this, event.clientX, event.clientY);
36713
37011
  if (!normalized) return;
37012
+ if (__privateGet(this, _isDragging) && __privateGet(this, _dragAnchor) !== null && event.buttons & 1) {
37013
+ const hit = clickToPosition(
37014
+ __privateGet(this, _layoutState).layout,
37015
+ __privateGet(this, _layoutState).blocks,
37016
+ __privateGet(this, _layoutState).measures,
37017
+ { x: normalized.x, y: normalized.y },
37018
+ __privateGet(this, _viewportHost),
37019
+ event.clientX,
37020
+ event.clientY
37021
+ );
37022
+ if (!hit) return;
37023
+ const anchor = __privateGet(this, _dragAnchor);
37024
+ const head = hit.pos;
37025
+ const { selAnchor, selHead } = __privateMethod(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet(this, _dragExtensionMode));
37026
+ try {
37027
+ const tr = __privateGet(this, _editor3).state.tr.setSelection(TextSelection.create(__privateGet(this, _editor3).state.doc, selAnchor, selHead));
37028
+ __privateGet(this, _editor3).view?.dispatch(tr);
37029
+ __privateMethod(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
37030
+ } catch (error) {
37031
+ console.warn("[SELECTION] Failed to extend selection during drag:", {
37032
+ error,
37033
+ anchor,
37034
+ head,
37035
+ selAnchor,
37036
+ selHead,
37037
+ mode: __privateGet(this, _dragExtensionMode)
37038
+ });
37039
+ }
37040
+ return;
37041
+ }
36714
37042
  if (__privateGet(this, _session).mode !== "body") {
36715
37043
  __privateMethod(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
36716
37044
  return;
@@ -36729,6 +37057,13 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
36729
37057
  __privateAdd(this, _handlePointerLeave, () => {
36730
37058
  __privateMethod(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
36731
37059
  });
37060
+ __privateAdd(this, _handlePointerUp, (event) => {
37061
+ if (!__privateGet(this, _isDragging)) return;
37062
+ if (typeof __privateGet(this, _viewportHost).hasPointerCapture === "function" && typeof __privateGet(this, _viewportHost).releasePointerCapture === "function" && __privateGet(this, _viewportHost).hasPointerCapture(event.pointerId)) {
37063
+ __privateGet(this, _viewportHost).releasePointerCapture(event.pointerId);
37064
+ }
37065
+ __privateSet(this, _isDragging, false);
37066
+ });
36732
37067
  __privateAdd(this, _handleDoubleClick, (event) => {
36733
37068
  if (event.button !== 0) return;
36734
37069
  if (!__privateGet(this, _layoutState).layout) return;
@@ -37648,6 +37983,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
37648
37983
  __privateGet(this, _viewportHost)?.removeEventListener("pointerdown", __privateGet(this, _handlePointerDown));
37649
37984
  __privateGet(this, _viewportHost)?.removeEventListener("dblclick", __privateGet(this, _handleDoubleClick));
37650
37985
  __privateGet(this, _viewportHost)?.removeEventListener("pointermove", __privateGet(this, _handlePointerMove));
37986
+ __privateGet(this, _viewportHost)?.removeEventListener("pointerup", __privateGet(this, _handlePointerUp));
37651
37987
  __privateGet(this, _viewportHost)?.removeEventListener("pointerleave", __privateGet(this, _handlePointerLeave));
37652
37988
  __privateGet(this, _visibleHost)?.removeEventListener("keydown", __privateGet(this, _handleKeyDown));
37653
37989
  __privateGet(this, _inputBridge)?.notifyTargetChanged();
@@ -37757,6 +38093,9 @@ _clickCount = new WeakMap();
37757
38093
  _lastClickTime = new WeakMap();
37758
38094
  _lastClickPosition = new WeakMap();
37759
38095
  _lastSelectedImageBlockId = new WeakMap();
38096
+ _dragAnchor = new WeakMap();
38097
+ _isDragging = new WeakMap();
38098
+ _dragExtensionMode = new WeakMap();
37760
38099
  _remoteCursorState = new WeakMap();
37761
38100
  _remoteCursorDirty = new WeakMap();
37762
38101
  _remoteCursorOverlay = new WeakMap();
@@ -38209,6 +38548,7 @@ setupPointerHandlers_fn = function() {
38209
38548
  __privateGet(this, _viewportHost).addEventListener("pointerdown", __privateGet(this, _handlePointerDown));
38210
38549
  __privateGet(this, _viewportHost).addEventListener("dblclick", __privateGet(this, _handleDoubleClick));
38211
38550
  __privateGet(this, _viewportHost).addEventListener("pointermove", __privateGet(this, _handlePointerMove));
38551
+ __privateGet(this, _viewportHost).addEventListener("pointerup", __privateGet(this, _handlePointerUp));
38212
38552
  __privateGet(this, _viewportHost).addEventListener("pointerleave", __privateGet(this, _handlePointerLeave));
38213
38553
  __privateGet(this, _visibleHost).addEventListener("keydown", __privateGet(this, _handleKeyDown));
38214
38554
  };
@@ -38309,8 +38649,11 @@ getFirstTextPosition_fn = function() {
38309
38649
  registerPointerClick_fn = function(event) {
38310
38650
  const MAX_CLICK_COUNT = 3;
38311
38651
  const time = event.timeStamp ?? performance.now();
38312
- const withinTime = time - __privateGet(this, _lastClickTime) <= MULTI_CLICK_TIME_THRESHOLD_MS;
38313
- const withinDistance = Math.abs(event.clientX - __privateGet(this, _lastClickPosition).x) <= MULTI_CLICK_DISTANCE_THRESHOLD_PX && Math.abs(event.clientY - __privateGet(this, _lastClickPosition).y) <= MULTI_CLICK_DISTANCE_THRESHOLD_PX;
38652
+ const timeDelta = time - __privateGet(this, _lastClickTime);
38653
+ const withinTime = timeDelta <= MULTI_CLICK_TIME_THRESHOLD_MS;
38654
+ const distanceX = Math.abs(event.clientX - __privateGet(this, _lastClickPosition).x);
38655
+ const distanceY = Math.abs(event.clientY - __privateGet(this, _lastClickPosition).y);
38656
+ const withinDistance = distanceX <= MULTI_CLICK_DISTANCE_THRESHOLD_PX && distanceY <= MULTI_CLICK_DISTANCE_THRESHOLD_PX;
38314
38657
  if (withinTime && withinDistance) {
38315
38658
  __privateSet(this, _clickCount, Math.min(__privateGet(this, _clickCount) + 1, MAX_CLICK_COUNT));
38316
38659
  } else {
@@ -38343,6 +38686,9 @@ selectWordAt_fn = function(pos) {
38343
38686
  if (!state?.doc) {
38344
38687
  return false;
38345
38688
  }
38689
+ if (pos < 0 || pos > state.doc.content.size) {
38690
+ return false;
38691
+ }
38346
38692
  const $pos = state.doc.resolve(pos);
38347
38693
  let textblockPos = $pos;
38348
38694
  while (textblockPos.depth > 0) {
@@ -38444,6 +38790,43 @@ selectParagraphAt_fn = function(pos) {
38444
38790
  return false;
38445
38791
  }
38446
38792
  };
38793
+ /**
38794
+ * Calculates extended selection boundaries based on the current extension mode.
38795
+ *
38796
+ * This helper method consolidates the logic for extending selections to word or paragraph
38797
+ * boundaries, used by both shift+click and drag selection handlers. It preserves selection
38798
+ * directionality by placing the head on the side where the user is clicking/dragging.
38799
+ *
38800
+ * @param anchor - The anchor position of the selection (fixed point)
38801
+ * @param head - The head position of the selection (moving point)
38802
+ * @param mode - The extension mode: 'char' (no extension), 'word', or 'para'
38803
+ * @returns Object with selAnchor and selHead positions after applying extension
38804
+ * @private
38805
+ */
38806
+ calculateExtendedSelection_fn = function(anchor, head, mode) {
38807
+ if (mode === "word") {
38808
+ const anchorBounds = findWordBoundaries(__privateGet(this, _layoutState).blocks, anchor);
38809
+ const headBounds = findWordBoundaries(__privateGet(this, _layoutState).blocks, head);
38810
+ if (anchorBounds && headBounds) {
38811
+ if (head >= anchor) {
38812
+ return { selAnchor: anchorBounds.from, selHead: headBounds.to };
38813
+ } else {
38814
+ return { selAnchor: anchorBounds.to, selHead: headBounds.from };
38815
+ }
38816
+ }
38817
+ } else if (mode === "para") {
38818
+ const anchorBounds = findParagraphBoundaries(__privateGet(this, _layoutState).blocks, anchor);
38819
+ const headBounds = findParagraphBoundaries(__privateGet(this, _layoutState).blocks, head);
38820
+ if (anchorBounds && headBounds) {
38821
+ if (head >= anchor) {
38822
+ return { selAnchor: anchorBounds.from, selHead: headBounds.to };
38823
+ } else {
38824
+ return { selAnchor: anchorBounds.to, selHead: headBounds.from };
38825
+ }
38826
+ }
38827
+ }
38828
+ return { selAnchor: anchor, selHead: head };
38829
+ };
38447
38830
  /**
38448
38831
  * Determines if a character is considered part of a word for selection purposes.
38449
38832
  *
@@ -38466,6 +38849,7 @@ isWordCharacter_fn = function(char) {
38466
38849
  };
38467
38850
  _handlePointerMove = new WeakMap();
38468
38851
  _handlePointerLeave = new WeakMap();
38852
+ _handlePointerUp = new WeakMap();
38469
38853
  _handleDoubleClick = new WeakMap();
38470
38854
  _handleKeyDown = new WeakMap();
38471
38855
  focusHeaderFooterShortcut_fn = function(kind) {
@@ -39681,10 +40065,12 @@ convertPageLocalToOverlayCoords_fn = function(pageIndex, pageLocalX, pageLocalY)
39681
40065
  }
39682
40066
  const pageRect = pageEl.getBoundingClientRect();
39683
40067
  const overlayRect = __privateGet(this, _selectionOverlay2).getBoundingClientRect();
39684
- const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
40068
+ const layoutPageSize = __privateGet(this, _layoutState).layout?.pageSize;
40069
+ const scaleX = layoutPageSize && typeof layoutPageSize.w === "number" && layoutPageSize.w > 0 ? pageRect.width / layoutPageSize.w : 1;
40070
+ const scaleY = layoutPageSize && typeof layoutPageSize.h === "number" && layoutPageSize.h > 0 ? pageRect.height / layoutPageSize.h : 1;
39685
40071
  return {
39686
- x: pageRect.left - overlayRect.left + pageLocalX * zoom,
39687
- y: pageRect.top - overlayRect.top + pageLocalY * zoom
40072
+ x: pageRect.left - overlayRect.left + pageLocalX * scaleX,
40073
+ y: pageRect.top - overlayRect.top + pageLocalY * scaleY
39688
40074
  };
39689
40075
  };
39690
40076
  normalizeClientPoint_fn = function(clientX, clientY) {