@harbour-enterprises/superdoc 1.0.0-next.11 → 1.0.0-next.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-BHQAIor9.es.js → PdfViewer-DmfOe_Pf.es.js} +1 -1
- package/dist/chunks/{PdfViewer-65m-1Mif.cjs → PdfViewer-w6pLbkxf.cjs} +1 -1
- package/dist/chunks/{index-_29uRtgq.cjs → index-DCu_3jpz.cjs} +3 -3
- package/dist/chunks/{index-DPqUx7-1.es.js → index-DSLlUITa.es.js} +3 -3
- package/dist/chunks/{index-C5orVGCQ-CW6wugb7.cjs → index-lMJbwm6b-B4MxvqkR.cjs} +1 -1
- package/dist/chunks/{index-C5orVGCQ-DVgjx_eq.es.js → index-lMJbwm6b-l7bjUagi.es.js} +1 -1
- package/dist/chunks/{super-editor.es-DxgyliBv.cjs → super-editor.es-CYIzx8D9.cjs} +584 -121
- package/dist/chunks/{super-editor.es-rK6HtVpO.es.js → super-editor.es-ajKYblrs.es.js} +584 -121
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DmUVsRfa.js → converter-Bf6IlS43.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-DFJkPgao.js → docx-zipper-16dfai0y.js} +1 -1
- package/dist/super-editor/chunks/{editor-BRJH9CNT.js → editor-DJbi9-qr.js} +614 -122
- package/dist/super-editor/chunks/{index-C5orVGCQ.js → index-lMJbwm6b.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DRBey7KI.js → toolbar-DpmycQmV.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +586 -123
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,11 +9,11 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _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, _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, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _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, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _handlePointerUp, _handleDragOver, _handleDrop, _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, computeExpectedSectionType_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, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_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, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _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, _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, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _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, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, wrapHiddenEditorFocus_fn, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _handlePointerUp, _handleDragOver, _handleDrop, _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, computeExpectedSectionType_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, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_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$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, 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 SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-
|
|
16
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, 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 SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-Bf6IlS43.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-16dfai0y.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() {
|
|
@@ -13964,7 +13964,7 @@ const isHeadless = (editor) => {
|
|
|
13964
13964
|
const shouldSkipNodeView = (editor) => {
|
|
13965
13965
|
return isHeadless(editor);
|
|
13966
13966
|
};
|
|
13967
|
-
const summaryVersion = "1.0.0-next.
|
|
13967
|
+
const summaryVersion = "1.0.0-next.12";
|
|
13968
13968
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13969
13969
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13970
13970
|
function mapAttributes(attrs) {
|
|
@@ -14756,7 +14756,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14756
14756
|
{ default: remarkStringify },
|
|
14757
14757
|
{ default: remarkGfm }
|
|
14758
14758
|
] = await Promise.all([
|
|
14759
|
-
import("./index-
|
|
14759
|
+
import("./index-lMJbwm6b.js"),
|
|
14760
14760
|
import("./index-DRCvimau.js"),
|
|
14761
14761
|
import("./index-C_x_N6Uh.js"),
|
|
14762
14762
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14961,7 +14961,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14961
14961
|
* Process collaboration migrations
|
|
14962
14962
|
*/
|
|
14963
14963
|
processCollaborationMigrations() {
|
|
14964
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.
|
|
14964
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.12");
|
|
14965
14965
|
if (!this.options.ydoc) return;
|
|
14966
14966
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14967
14967
|
let docVersion = metaMap.get("version");
|
|
@@ -26048,6 +26048,86 @@ const createDomPainter = (options) => {
|
|
|
26048
26048
|
}
|
|
26049
26049
|
};
|
|
26050
26050
|
};
|
|
26051
|
+
const DEFAULT_CONFIG = {
|
|
26052
|
+
logLevel: "off",
|
|
26053
|
+
hud: false,
|
|
26054
|
+
dumpRects: false,
|
|
26055
|
+
disableRectDedupe: false
|
|
26056
|
+
};
|
|
26057
|
+
const levelOrder = {
|
|
26058
|
+
error: 0,
|
|
26059
|
+
warn: 1,
|
|
26060
|
+
info: 2,
|
|
26061
|
+
verbose: 3
|
|
26062
|
+
};
|
|
26063
|
+
function getSelectionDebugConfig() {
|
|
26064
|
+
var _a;
|
|
26065
|
+
if (typeof window === "undefined") {
|
|
26066
|
+
return DEFAULT_CONFIG;
|
|
26067
|
+
}
|
|
26068
|
+
window.superdocDebug ?? (window.superdocDebug = {});
|
|
26069
|
+
(_a = window.superdocDebug).selection ?? (_a.selection = {});
|
|
26070
|
+
const cfg = window.superdocDebug.selection;
|
|
26071
|
+
return {
|
|
26072
|
+
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
26073
|
+
hud: cfg.hud ?? DEFAULT_CONFIG.hud,
|
|
26074
|
+
dumpRects: cfg.dumpRects ?? DEFAULT_CONFIG.dumpRects,
|
|
26075
|
+
disableRectDedupe: cfg.disableRectDedupe ?? DEFAULT_CONFIG.disableRectDedupe
|
|
26076
|
+
};
|
|
26077
|
+
}
|
|
26078
|
+
function debugLog(level, message, data) {
|
|
26079
|
+
const cfg = getSelectionDebugConfig();
|
|
26080
|
+
if (cfg.logLevel === "off") return;
|
|
26081
|
+
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
26082
|
+
const prefix = "[Selection]";
|
|
26083
|
+
if (data) {
|
|
26084
|
+
console.log(prefix, message, data);
|
|
26085
|
+
} else {
|
|
26086
|
+
console.log(prefix, message);
|
|
26087
|
+
}
|
|
26088
|
+
}
|
|
26089
|
+
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
26090
|
+
function updateSelectionDebugHud(host, state) {
|
|
26091
|
+
const cfg = getSelectionDebugConfig();
|
|
26092
|
+
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
26093
|
+
if (!doc2) return;
|
|
26094
|
+
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
26095
|
+
if (!cfg.hud) {
|
|
26096
|
+
existing?.remove();
|
|
26097
|
+
return;
|
|
26098
|
+
}
|
|
26099
|
+
const hud = existing ?? doc2.createElement("div");
|
|
26100
|
+
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
26101
|
+
hud.style.position = "absolute";
|
|
26102
|
+
hud.style.top = "8px";
|
|
26103
|
+
hud.style.left = "8px";
|
|
26104
|
+
hud.style.zIndex = "9999";
|
|
26105
|
+
hud.style.maxWidth = "420px";
|
|
26106
|
+
hud.style.padding = "6px 8px";
|
|
26107
|
+
hud.style.borderRadius = "6px";
|
|
26108
|
+
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
26109
|
+
hud.style.color = "white";
|
|
26110
|
+
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
26111
|
+
hud.style.fontSize = "12px";
|
|
26112
|
+
hud.style.lineHeight = "1.3";
|
|
26113
|
+
hud.style.pointerEvents = "none";
|
|
26114
|
+
hud.style.whiteSpace = "pre";
|
|
26115
|
+
const behind = Math.max(0, state.docEpoch - state.layoutEpoch);
|
|
26116
|
+
const selectionText = state.selection ? `${state.selection.from}..${state.selection.to}` : "null";
|
|
26117
|
+
const pointerText = state.lastPointer ? `${state.lastPointer.clientX},${state.lastPointer.clientY} -> ${Math.round(state.lastPointer.x)},${Math.round(
|
|
26118
|
+
state.lastPointer.y
|
|
26119
|
+
)}` : "null";
|
|
26120
|
+
const hitText = state.lastHit ? `${state.lastHit.source} pos=${state.lastHit.pos ?? "null"} epoch=${state.lastHit.layoutEpoch ?? "null"} mapped=${state.lastHit.mappedPos ?? "null"}` : "null";
|
|
26121
|
+
hud.textContent = [
|
|
26122
|
+
`docEpoch=${state.docEpoch} layoutEpoch=${state.layoutEpoch} behind=${behind}`,
|
|
26123
|
+
`selection=${selectionText}`,
|
|
26124
|
+
`pointer=${pointerText}`,
|
|
26125
|
+
`hit=${hitText}`
|
|
26126
|
+
].join("\n");
|
|
26127
|
+
if (!existing) {
|
|
26128
|
+
host.appendChild(hud);
|
|
26129
|
+
}
|
|
26130
|
+
}
|
|
26051
26131
|
class DomPositionIndex {
|
|
26052
26132
|
constructor() {
|
|
26053
26133
|
__privateAdd(this, _entries, []);
|
|
@@ -26104,6 +26184,7 @@ class DomPositionIndex {
|
|
|
26104
26184
|
}
|
|
26105
26185
|
for (const node of pmNodes) {
|
|
26106
26186
|
if (node.classList.contains(DOM_CLASS_NAMES.INLINE_SDT_WRAPPER)) continue;
|
|
26187
|
+
if (node.closest(".superdoc-page-header, .superdoc-page-footer")) continue;
|
|
26107
26188
|
if (leafOnly && nonLeaf.has(node)) continue;
|
|
26108
26189
|
const pmStart = Number(node.dataset.pmStart ?? "NaN");
|
|
26109
26190
|
const pmEnd = Number(node.dataset.pmEnd ?? "NaN");
|
|
@@ -26113,6 +26194,60 @@ class DomPositionIndex {
|
|
|
26113
26194
|
}
|
|
26114
26195
|
entries.sort((a, b) => a.pmStart - b.pmStart !== 0 ? a.pmStart - b.pmStart : a.pmEnd - b.pmEnd);
|
|
26115
26196
|
__privateSet(this, _entries, entries);
|
|
26197
|
+
const isVerbose = getSelectionDebugConfig().logLevel === "verbose";
|
|
26198
|
+
if (isVerbose) {
|
|
26199
|
+
const counts = { total: entries.length, body: 0, header: 0, footer: 0 };
|
|
26200
|
+
const bodySamples = [];
|
|
26201
|
+
const headerSamples = [];
|
|
26202
|
+
const footerSamples = [];
|
|
26203
|
+
for (const entry of entries) {
|
|
26204
|
+
const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
|
|
26205
|
+
const pageIndex = pageEl?.dataset.pageIndex ?? null;
|
|
26206
|
+
const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
|
|
26207
|
+
if (section === "header") {
|
|
26208
|
+
counts.header += 1;
|
|
26209
|
+
if (headerSamples.length < 10) {
|
|
26210
|
+
headerSamples.push({
|
|
26211
|
+
pmStart: entry.pmStart,
|
|
26212
|
+
pmEnd: entry.pmEnd,
|
|
26213
|
+
pageIndex,
|
|
26214
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
26215
|
+
});
|
|
26216
|
+
}
|
|
26217
|
+
continue;
|
|
26218
|
+
}
|
|
26219
|
+
if (section === "footer") {
|
|
26220
|
+
counts.footer += 1;
|
|
26221
|
+
if (footerSamples.length < 10) {
|
|
26222
|
+
footerSamples.push({
|
|
26223
|
+
pmStart: entry.pmStart,
|
|
26224
|
+
pmEnd: entry.pmEnd,
|
|
26225
|
+
pageIndex,
|
|
26226
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
26227
|
+
});
|
|
26228
|
+
}
|
|
26229
|
+
continue;
|
|
26230
|
+
}
|
|
26231
|
+
counts.body += 1;
|
|
26232
|
+
if (bodySamples.length < 10) {
|
|
26233
|
+
bodySamples.push({
|
|
26234
|
+
pmStart: entry.pmStart,
|
|
26235
|
+
pmEnd: entry.pmEnd,
|
|
26236
|
+
pageIndex,
|
|
26237
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
26238
|
+
});
|
|
26239
|
+
}
|
|
26240
|
+
}
|
|
26241
|
+
debugLog(
|
|
26242
|
+
"verbose",
|
|
26243
|
+
`DomPositionIndex: rebuild summary ${JSON.stringify({
|
|
26244
|
+
counts,
|
|
26245
|
+
bodySamples,
|
|
26246
|
+
headerSamples,
|
|
26247
|
+
footerSamples
|
|
26248
|
+
})}`
|
|
26249
|
+
);
|
|
26250
|
+
}
|
|
26116
26251
|
}
|
|
26117
26252
|
/**
|
|
26118
26253
|
* Finds the index entry whose position range contains the given position.
|
|
@@ -26362,82 +26497,6 @@ _onRebuild = new WeakMap();
|
|
|
26362
26497
|
_observer = new WeakMap();
|
|
26363
26498
|
_rebuildScheduled = new WeakMap();
|
|
26364
26499
|
_rebuildRafId = new WeakMap();
|
|
26365
|
-
const DEFAULT_CONFIG = {
|
|
26366
|
-
logLevel: "off",
|
|
26367
|
-
hud: false
|
|
26368
|
-
};
|
|
26369
|
-
const levelOrder = {
|
|
26370
|
-
error: 0,
|
|
26371
|
-
warn: 1,
|
|
26372
|
-
info: 2,
|
|
26373
|
-
verbose: 3
|
|
26374
|
-
};
|
|
26375
|
-
function getSelectionDebugConfig() {
|
|
26376
|
-
var _a;
|
|
26377
|
-
if (typeof window === "undefined") {
|
|
26378
|
-
return DEFAULT_CONFIG;
|
|
26379
|
-
}
|
|
26380
|
-
window.superdocDebug ?? (window.superdocDebug = {});
|
|
26381
|
-
(_a = window.superdocDebug).selection ?? (_a.selection = {});
|
|
26382
|
-
const cfg = window.superdocDebug.selection;
|
|
26383
|
-
return {
|
|
26384
|
-
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
26385
|
-
hud: cfg.hud ?? DEFAULT_CONFIG.hud
|
|
26386
|
-
};
|
|
26387
|
-
}
|
|
26388
|
-
function debugLog(level, message, data) {
|
|
26389
|
-
const cfg = getSelectionDebugConfig();
|
|
26390
|
-
if (cfg.logLevel === "off") return;
|
|
26391
|
-
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
26392
|
-
const prefix = "[Selection]";
|
|
26393
|
-
if (data) {
|
|
26394
|
-
console.log(prefix, message, data);
|
|
26395
|
-
} else {
|
|
26396
|
-
console.log(prefix, message);
|
|
26397
|
-
}
|
|
26398
|
-
}
|
|
26399
|
-
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
26400
|
-
function updateSelectionDebugHud(host, state) {
|
|
26401
|
-
const cfg = getSelectionDebugConfig();
|
|
26402
|
-
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
26403
|
-
if (!doc2) return;
|
|
26404
|
-
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
26405
|
-
if (!cfg.hud) {
|
|
26406
|
-
existing?.remove();
|
|
26407
|
-
return;
|
|
26408
|
-
}
|
|
26409
|
-
const hud = existing ?? doc2.createElement("div");
|
|
26410
|
-
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
26411
|
-
hud.style.position = "absolute";
|
|
26412
|
-
hud.style.top = "8px";
|
|
26413
|
-
hud.style.left = "8px";
|
|
26414
|
-
hud.style.zIndex = "9999";
|
|
26415
|
-
hud.style.maxWidth = "420px";
|
|
26416
|
-
hud.style.padding = "6px 8px";
|
|
26417
|
-
hud.style.borderRadius = "6px";
|
|
26418
|
-
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
26419
|
-
hud.style.color = "white";
|
|
26420
|
-
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
26421
|
-
hud.style.fontSize = "12px";
|
|
26422
|
-
hud.style.lineHeight = "1.3";
|
|
26423
|
-
hud.style.pointerEvents = "none";
|
|
26424
|
-
hud.style.whiteSpace = "pre";
|
|
26425
|
-
const behind = Math.max(0, state.docEpoch - state.layoutEpoch);
|
|
26426
|
-
const selectionText = state.selection ? `${state.selection.from}..${state.selection.to}` : "null";
|
|
26427
|
-
const pointerText = state.lastPointer ? `${state.lastPointer.clientX},${state.lastPointer.clientY} -> ${Math.round(state.lastPointer.x)},${Math.round(
|
|
26428
|
-
state.lastPointer.y
|
|
26429
|
-
)}` : "null";
|
|
26430
|
-
const hitText = state.lastHit ? `${state.lastHit.source} pos=${state.lastHit.pos ?? "null"} epoch=${state.lastHit.layoutEpoch ?? "null"} mapped=${state.lastHit.mappedPos ?? "null"}` : "null";
|
|
26431
|
-
hud.textContent = [
|
|
26432
|
-
`docEpoch=${state.docEpoch} layoutEpoch=${state.layoutEpoch} behind=${behind}`,
|
|
26433
|
-
`selection=${selectionText}`,
|
|
26434
|
-
`pointer=${pointerText}`,
|
|
26435
|
-
`hit=${hitText}`
|
|
26436
|
-
].join("\n");
|
|
26437
|
-
if (!existing) {
|
|
26438
|
-
host.appendChild(hud);
|
|
26439
|
-
}
|
|
26440
|
-
}
|
|
26441
26500
|
function computeSelectionRectsFromDom(options, from2, to) {
|
|
26442
26501
|
const painterHost = options.painterHost;
|
|
26443
26502
|
if (!painterHost) return null;
|
|
@@ -26458,6 +26517,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
26458
26517
|
);
|
|
26459
26518
|
const out = [];
|
|
26460
26519
|
let rebuiltOnce = false;
|
|
26520
|
+
const debugConfig = getSelectionDebugConfig();
|
|
26521
|
+
const isVerbose = debugConfig.logLevel === "verbose";
|
|
26522
|
+
const dumpRects = isVerbose && debugConfig.dumpRects;
|
|
26523
|
+
const disableRectDedupe = debugConfig.disableRectDedupe;
|
|
26524
|
+
const entryDebugInfo = (entry) => {
|
|
26525
|
+
const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
|
|
26526
|
+
const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
|
|
26527
|
+
return {
|
|
26528
|
+
pmStart: entry.pmStart,
|
|
26529
|
+
pmEnd: entry.pmEnd,
|
|
26530
|
+
pageIndex: pageEl?.dataset.pageIndex ?? null,
|
|
26531
|
+
section,
|
|
26532
|
+
connected: entry.el.isConnected,
|
|
26533
|
+
layoutEpoch: entry.el.dataset.layoutEpoch ?? null,
|
|
26534
|
+
pageEpoch: pageEl?.dataset.layoutEpoch ?? null,
|
|
26535
|
+
text: (entry.el.textContent ?? "").slice(0, 80)
|
|
26536
|
+
};
|
|
26537
|
+
};
|
|
26538
|
+
const rectDebugInfo = (rect) => ({
|
|
26539
|
+
x: rect.x,
|
|
26540
|
+
y: rect.y,
|
|
26541
|
+
width: rect.width,
|
|
26542
|
+
height: rect.height,
|
|
26543
|
+
top: rect.top,
|
|
26544
|
+
left: rect.left,
|
|
26545
|
+
right: rect.right,
|
|
26546
|
+
bottom: rect.bottom
|
|
26547
|
+
});
|
|
26461
26548
|
for (const pageEl of pageEls) {
|
|
26462
26549
|
const pageIndex = Number(pageEl.dataset.pageIndex ?? "NaN");
|
|
26463
26550
|
if (!Number.isFinite(pageIndex)) continue;
|
|
@@ -26481,9 +26568,47 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
26481
26568
|
if (sliceEntries.length === 0) {
|
|
26482
26569
|
continue;
|
|
26483
26570
|
}
|
|
26571
|
+
if (isVerbose) {
|
|
26572
|
+
debugLog(
|
|
26573
|
+
"verbose",
|
|
26574
|
+
`DOM selection rects: slice entries ${JSON.stringify({
|
|
26575
|
+
pageIndex,
|
|
26576
|
+
sliceFrom,
|
|
26577
|
+
sliceTo,
|
|
26578
|
+
entriesCount: sliceEntries.length,
|
|
26579
|
+
entriesPreview: sliceEntries.slice(0, 20).map(entryDebugInfo)
|
|
26580
|
+
})}`
|
|
26581
|
+
);
|
|
26582
|
+
}
|
|
26484
26583
|
let startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
26485
26584
|
let endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
26486
|
-
if (
|
|
26585
|
+
if (isVerbose) {
|
|
26586
|
+
debugLog(
|
|
26587
|
+
"verbose",
|
|
26588
|
+
`DOM selection rects: boundaries ${JSON.stringify({
|
|
26589
|
+
pageIndex,
|
|
26590
|
+
sliceFrom,
|
|
26591
|
+
sliceTo,
|
|
26592
|
+
start: entryDebugInfo(startEntry),
|
|
26593
|
+
end: entryDebugInfo(endEntry)
|
|
26594
|
+
})}`
|
|
26595
|
+
);
|
|
26596
|
+
}
|
|
26597
|
+
let startContained = pageEl.contains(startEntry.el);
|
|
26598
|
+
let endContained = pageEl.contains(endEntry.el);
|
|
26599
|
+
if (!startContained || !endContained) {
|
|
26600
|
+
if (isVerbose) {
|
|
26601
|
+
debugLog(
|
|
26602
|
+
"verbose",
|
|
26603
|
+
`DOM selection rects: boundary containment ${JSON.stringify({
|
|
26604
|
+
pageIndex,
|
|
26605
|
+
sliceFrom,
|
|
26606
|
+
sliceTo,
|
|
26607
|
+
startContained,
|
|
26608
|
+
endContained
|
|
26609
|
+
})}`
|
|
26610
|
+
);
|
|
26611
|
+
}
|
|
26487
26612
|
if (!rebuiltOnce) {
|
|
26488
26613
|
options.rebuildDomPositionIndex();
|
|
26489
26614
|
rebuiltOnce = true;
|
|
@@ -26491,9 +26616,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
26491
26616
|
if (sliceEntries.length === 0) continue;
|
|
26492
26617
|
startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
26493
26618
|
endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
26619
|
+
startContained = pageEl.contains(startEntry.el);
|
|
26620
|
+
endContained = pageEl.contains(endEntry.el);
|
|
26621
|
+
if (isVerbose) {
|
|
26622
|
+
debugLog(
|
|
26623
|
+
"verbose",
|
|
26624
|
+
`DOM selection rects: boundary containment after rebuild ${JSON.stringify({
|
|
26625
|
+
pageIndex,
|
|
26626
|
+
sliceFrom,
|
|
26627
|
+
sliceTo,
|
|
26628
|
+
startContained,
|
|
26629
|
+
endContained,
|
|
26630
|
+
start: entryDebugInfo(startEntry),
|
|
26631
|
+
end: entryDebugInfo(endEntry)
|
|
26632
|
+
})}`
|
|
26633
|
+
);
|
|
26634
|
+
}
|
|
26494
26635
|
}
|
|
26495
|
-
if (!
|
|
26496
|
-
debugLog(
|
|
26636
|
+
if (!startContained || !endContained) {
|
|
26637
|
+
debugLog(
|
|
26638
|
+
"warn",
|
|
26639
|
+
`DOM selection rects: stale index after rebuild ${JSON.stringify({
|
|
26640
|
+
pageIndex,
|
|
26641
|
+
sliceFrom,
|
|
26642
|
+
sliceTo,
|
|
26643
|
+
start: entryDebugInfo(startEntry),
|
|
26644
|
+
end: entryDebugInfo(endEntry)
|
|
26645
|
+
})}`
|
|
26646
|
+
);
|
|
26497
26647
|
return null;
|
|
26498
26648
|
}
|
|
26499
26649
|
}
|
|
@@ -26508,8 +26658,83 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
26508
26658
|
}
|
|
26509
26659
|
let clientRects = [];
|
|
26510
26660
|
try {
|
|
26511
|
-
|
|
26512
|
-
|
|
26661
|
+
let rawRects = Array.from(range.getClientRects());
|
|
26662
|
+
if (dumpRects) {
|
|
26663
|
+
debugLog(
|
|
26664
|
+
"verbose",
|
|
26665
|
+
`DOM selection rects: raw rects ${JSON.stringify({
|
|
26666
|
+
pageIndex,
|
|
26667
|
+
sliceFrom,
|
|
26668
|
+
sliceTo,
|
|
26669
|
+
rects: rawRects.map(rectDebugInfo)
|
|
26670
|
+
})}`
|
|
26671
|
+
);
|
|
26672
|
+
}
|
|
26673
|
+
let missingEntries = null;
|
|
26674
|
+
if (typeof range.intersectsNode === "function") {
|
|
26675
|
+
for (const entry of sliceEntries) {
|
|
26676
|
+
try {
|
|
26677
|
+
if (!range.intersectsNode(entry.el)) {
|
|
26678
|
+
missingEntries ?? (missingEntries = []);
|
|
26679
|
+
missingEntries.push(entry);
|
|
26680
|
+
}
|
|
26681
|
+
} catch {
|
|
26682
|
+
}
|
|
26683
|
+
}
|
|
26684
|
+
}
|
|
26685
|
+
if (missingEntries && missingEntries.length > 0) {
|
|
26686
|
+
if (isVerbose) {
|
|
26687
|
+
debugLog(
|
|
26688
|
+
"verbose",
|
|
26689
|
+
`DOM selection rects: range missing entries ${JSON.stringify({
|
|
26690
|
+
pageIndex,
|
|
26691
|
+
sliceFrom,
|
|
26692
|
+
sliceTo,
|
|
26693
|
+
missingCount: missingEntries.length,
|
|
26694
|
+
missingPreview: missingEntries.slice(0, 20).map(entryDebugInfo)
|
|
26695
|
+
})}`
|
|
26696
|
+
);
|
|
26697
|
+
}
|
|
26698
|
+
rawRects = collectClientRectsByLine(doc2, sliceEntries, sliceFrom, sliceTo);
|
|
26699
|
+
if (dumpRects) {
|
|
26700
|
+
debugLog(
|
|
26701
|
+
"verbose",
|
|
26702
|
+
`DOM selection rects: fallback raw rects ${JSON.stringify({
|
|
26703
|
+
pageIndex,
|
|
26704
|
+
sliceFrom,
|
|
26705
|
+
sliceTo,
|
|
26706
|
+
rects: rawRects.map(rectDebugInfo)
|
|
26707
|
+
})}`
|
|
26708
|
+
);
|
|
26709
|
+
}
|
|
26710
|
+
}
|
|
26711
|
+
clientRects = disableRectDedupe ? rawRects : deduplicateOverlappingRects(rawRects);
|
|
26712
|
+
if (dumpRects) {
|
|
26713
|
+
debugLog(
|
|
26714
|
+
"verbose",
|
|
26715
|
+
`DOM selection rects: final rects ${JSON.stringify({
|
|
26716
|
+
pageIndex,
|
|
26717
|
+
sliceFrom,
|
|
26718
|
+
sliceTo,
|
|
26719
|
+
dedupeDisabled: disableRectDedupe,
|
|
26720
|
+
rects: clientRects.map(rectDebugInfo)
|
|
26721
|
+
})}`
|
|
26722
|
+
);
|
|
26723
|
+
const nonPositive = clientRects.filter(
|
|
26724
|
+
(rect) => !Number.isFinite(rect.width) || !Number.isFinite(rect.height) || rect.width <= 0 || rect.height <= 0
|
|
26725
|
+
);
|
|
26726
|
+
if (nonPositive.length > 0) {
|
|
26727
|
+
debugLog(
|
|
26728
|
+
"verbose",
|
|
26729
|
+
`DOM selection rects: non-positive rects ${JSON.stringify({
|
|
26730
|
+
pageIndex,
|
|
26731
|
+
sliceFrom,
|
|
26732
|
+
sliceTo,
|
|
26733
|
+
rects: nonPositive.map(rectDebugInfo)
|
|
26734
|
+
})}`
|
|
26735
|
+
);
|
|
26736
|
+
}
|
|
26737
|
+
}
|
|
26513
26738
|
} catch (error) {
|
|
26514
26739
|
debugLog("warn", "DOM selection rects: getClientRects failed", { error: String(error) });
|
|
26515
26740
|
return null;
|
|
@@ -26533,6 +26758,57 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
26533
26758
|
}
|
|
26534
26759
|
return out;
|
|
26535
26760
|
}
|
|
26761
|
+
function collectClientRectsByLine(doc2, entries, sliceFrom, sliceTo) {
|
|
26762
|
+
const rects = [];
|
|
26763
|
+
const lineMap = /* @__PURE__ */ new Map();
|
|
26764
|
+
const looseEntries = [];
|
|
26765
|
+
for (const entry of entries) {
|
|
26766
|
+
const lineEl = entry.el.closest(".superdoc-line");
|
|
26767
|
+
if (!lineEl) {
|
|
26768
|
+
looseEntries.push(entry);
|
|
26769
|
+
continue;
|
|
26770
|
+
}
|
|
26771
|
+
const list = lineMap.get(lineEl);
|
|
26772
|
+
if (list) {
|
|
26773
|
+
list.push(entry);
|
|
26774
|
+
} else {
|
|
26775
|
+
lineMap.set(lineEl, [entry]);
|
|
26776
|
+
}
|
|
26777
|
+
}
|
|
26778
|
+
for (const [, lineEntries] of lineMap) {
|
|
26779
|
+
lineEntries.sort((a, b) => a.pmStart - b.pmStart !== 0 ? a.pmStart - b.pmStart : a.pmEnd - b.pmEnd);
|
|
26780
|
+
const linePmStart = lineEntries[0]?.pmStart ?? Infinity;
|
|
26781
|
+
const linePmEnd = lineEntries[lineEntries.length - 1]?.pmEnd ?? -Infinity;
|
|
26782
|
+
if (!Number.isFinite(linePmStart) || !Number.isFinite(linePmEnd) || linePmEnd <= linePmStart) continue;
|
|
26783
|
+
const lineFrom = Math.max(sliceFrom, linePmStart);
|
|
26784
|
+
const lineTo = Math.min(sliceTo, linePmEnd);
|
|
26785
|
+
if (lineFrom >= lineTo) continue;
|
|
26786
|
+
const startEntry = lineEntries.find((entry) => lineFrom >= entry.pmStart && lineFrom <= entry.pmEnd) ?? lineEntries[0];
|
|
26787
|
+
const endEntry = lineEntries.find((entry) => lineTo >= entry.pmStart && lineTo <= entry.pmEnd) ?? lineEntries[lineEntries.length - 1];
|
|
26788
|
+
const range = doc2.createRange();
|
|
26789
|
+
try {
|
|
26790
|
+
if (!setDomRangeStart(range, startEntry, lineFrom)) continue;
|
|
26791
|
+
if (!setDomRangeEnd(range, endEntry, lineTo)) continue;
|
|
26792
|
+
} catch {
|
|
26793
|
+
continue;
|
|
26794
|
+
}
|
|
26795
|
+
rects.push(...Array.from(range.getClientRects()));
|
|
26796
|
+
}
|
|
26797
|
+
for (const entry of looseEntries) {
|
|
26798
|
+
const entryFrom = Math.max(sliceFrom, entry.pmStart);
|
|
26799
|
+
const entryTo = Math.min(sliceTo, entry.pmEnd);
|
|
26800
|
+
if (entryFrom >= entryTo) continue;
|
|
26801
|
+
const range = doc2.createRange();
|
|
26802
|
+
try {
|
|
26803
|
+
if (!setDomRangeStart(range, entry, entryFrom)) continue;
|
|
26804
|
+
if (!setDomRangeEnd(range, entry, entryTo)) continue;
|
|
26805
|
+
} catch {
|
|
26806
|
+
continue;
|
|
26807
|
+
}
|
|
26808
|
+
rects.push(...Array.from(range.getClientRects()));
|
|
26809
|
+
}
|
|
26810
|
+
return rects;
|
|
26811
|
+
}
|
|
26536
26812
|
function setDomRangeStart(range, entry, pos) {
|
|
26537
26813
|
const el = entry.el;
|
|
26538
26814
|
const pmStart = entry.pmStart;
|
|
@@ -26642,31 +26918,69 @@ function deduplicateOverlappingRects(rects) {
|
|
|
26642
26918
|
return a.x - b.x;
|
|
26643
26919
|
});
|
|
26644
26920
|
const result = [];
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
26656
|
-
|
|
26657
|
-
|
|
26658
|
-
|
|
26659
|
-
|
|
26660
|
-
|
|
26661
|
-
|
|
26662
|
-
|
|
26663
|
-
|
|
26664
|
-
|
|
26665
|
-
|
|
26921
|
+
const groups = [];
|
|
26922
|
+
let currentGroup = [];
|
|
26923
|
+
for (const rect of sorted) {
|
|
26924
|
+
if (currentGroup.length === 0) {
|
|
26925
|
+
currentGroup.push(rect);
|
|
26926
|
+
continue;
|
|
26927
|
+
}
|
|
26928
|
+
const groupY = currentGroup[0].y;
|
|
26929
|
+
if (Math.abs(rect.y - groupY) <= Y_SAME_LINE_THRESHOLD_PX) {
|
|
26930
|
+
currentGroup.push(rect);
|
|
26931
|
+
} else {
|
|
26932
|
+
groups.push(currentGroup);
|
|
26933
|
+
currentGroup = [rect];
|
|
26934
|
+
}
|
|
26935
|
+
}
|
|
26936
|
+
if (currentGroup.length > 0) {
|
|
26937
|
+
groups.push(currentGroup);
|
|
26938
|
+
}
|
|
26939
|
+
const SIZE_EPS_PX = 0.5;
|
|
26940
|
+
const X_DUPLICATE_EPS_PX = 1;
|
|
26941
|
+
const hasSignificantOverlap = (a, b) => {
|
|
26942
|
+
const xOverlapStart = Math.max(a.x, b.x);
|
|
26943
|
+
const xOverlapEnd = Math.min(a.x + a.width, b.x + b.width);
|
|
26944
|
+
const hasHorizontalOverlap = xOverlapEnd > xOverlapStart;
|
|
26945
|
+
if (!hasHorizontalOverlap) return false;
|
|
26946
|
+
const overlapWidth = Math.max(0, xOverlapEnd - xOverlapStart);
|
|
26947
|
+
const minWidth = Math.min(a.width, b.width);
|
|
26948
|
+
return minWidth > 0 && overlapWidth / minWidth > HORIZONTAL_OVERLAP_THRESHOLD;
|
|
26949
|
+
};
|
|
26950
|
+
const isLargerRect = (a, b) => {
|
|
26951
|
+
return a.width > b.width + SIZE_EPS_PX || a.height > b.height + SIZE_EPS_PX;
|
|
26952
|
+
};
|
|
26953
|
+
for (const group of groups) {
|
|
26954
|
+
const unique2 = [];
|
|
26955
|
+
for (const rect of group) {
|
|
26956
|
+
const isDuplicate = unique2.some((existing) => {
|
|
26957
|
+
const xClose = Math.abs(existing.x - rect.x) <= X_DUPLICATE_EPS_PX;
|
|
26958
|
+
const yClose = Math.abs(existing.y - rect.y) <= Y_SAME_LINE_THRESHOLD_PX;
|
|
26959
|
+
const widthClose = Math.abs(existing.width - rect.width) <= SIZE_EPS_PX;
|
|
26960
|
+
const heightClose = Math.abs(existing.height - rect.height) <= SIZE_EPS_PX;
|
|
26961
|
+
return xClose && yClose && widthClose && heightClose;
|
|
26962
|
+
});
|
|
26963
|
+
if (!isDuplicate) {
|
|
26964
|
+
unique2.push(rect);
|
|
26666
26965
|
}
|
|
26667
26966
|
}
|
|
26668
|
-
|
|
26669
|
-
|
|
26967
|
+
if (unique2.length <= 1) {
|
|
26968
|
+
result.push(...unique2);
|
|
26969
|
+
continue;
|
|
26970
|
+
}
|
|
26971
|
+
const containers = /* @__PURE__ */ new Set();
|
|
26972
|
+
for (const rect of unique2) {
|
|
26973
|
+
for (const other of unique2) {
|
|
26974
|
+
if (rect === other) continue;
|
|
26975
|
+
if (!hasSignificantOverlap(rect, other)) continue;
|
|
26976
|
+
if (isLargerRect(rect, other)) {
|
|
26977
|
+
containers.add(rect);
|
|
26978
|
+
break;
|
|
26979
|
+
}
|
|
26980
|
+
}
|
|
26981
|
+
}
|
|
26982
|
+
const filtered = unique2.filter((rect) => !containers.has(rect));
|
|
26983
|
+
result.push(...filtered.length > 0 ? filtered : unique2);
|
|
26670
26984
|
}
|
|
26671
26985
|
return result;
|
|
26672
26986
|
}
|
|
@@ -26790,10 +27104,11 @@ function safeCleanup(fn2, context) {
|
|
|
26790
27104
|
function createHiddenHost(doc2, widthPx) {
|
|
26791
27105
|
const host = doc2.createElement("div");
|
|
26792
27106
|
host.className = "presentation-editor__hidden-host";
|
|
26793
|
-
host.style.position = "
|
|
27107
|
+
host.style.position = "fixed";
|
|
26794
27108
|
host.style.left = "-9999px";
|
|
26795
27109
|
host.style.top = "0";
|
|
26796
27110
|
host.style.width = `${widthPx}px`;
|
|
27111
|
+
host.style.setProperty("overflow-anchor", "none");
|
|
26797
27112
|
host.style.pointerEvents = "none";
|
|
26798
27113
|
host.style.opacity = "0";
|
|
26799
27114
|
host.style.zIndex = "-1";
|
|
@@ -27267,7 +27582,8 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
27267
27582
|
});
|
|
27268
27583
|
let hitChain = [];
|
|
27269
27584
|
const doc2 = document;
|
|
27270
|
-
|
|
27585
|
+
const hasElementsFromPoint = typeof doc2.elementsFromPoint === "function";
|
|
27586
|
+
if (hasElementsFromPoint) {
|
|
27271
27587
|
try {
|
|
27272
27588
|
hitChain = doc2.elementsFromPoint(viewX, viewY) ?? [];
|
|
27273
27589
|
} catch {
|
|
@@ -27313,11 +27629,14 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
27313
27629
|
log("All fragments on page:", JSON.stringify(fragmentData, null, 2));
|
|
27314
27630
|
const fragmentEl = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.fragment));
|
|
27315
27631
|
if (!fragmentEl) {
|
|
27632
|
+
if (hasElementsFromPoint) {
|
|
27633
|
+
return null;
|
|
27634
|
+
}
|
|
27316
27635
|
const fallbackFragment = pageEl.querySelector(`.${CLASS_NAMES.fragment}`);
|
|
27317
27636
|
if (!fallbackFragment) {
|
|
27318
27637
|
return null;
|
|
27319
27638
|
}
|
|
27320
|
-
log("Using fallback fragment:", {
|
|
27639
|
+
log("Using fallback fragment (no elementsFromPoint):", {
|
|
27321
27640
|
blockId: fallbackFragment.dataset.blockId,
|
|
27322
27641
|
pmStart: fallbackFragment.dataset.pmStart,
|
|
27323
27642
|
pmEnd: fallbackFragment.dataset.pmEnd
|
|
@@ -46320,7 +46639,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46320
46639
|
}
|
|
46321
46640
|
}
|
|
46322
46641
|
}
|
|
46323
|
-
editorDom2.focus(
|
|
46642
|
+
editorDom2.focus();
|
|
46324
46643
|
__privateGet(this, _editor3).view?.focus();
|
|
46325
46644
|
__privateMethod(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
46326
46645
|
return;
|
|
@@ -46387,7 +46706,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46387
46706
|
}
|
|
46388
46707
|
}
|
|
46389
46708
|
}
|
|
46390
|
-
editorDom2.focus(
|
|
46709
|
+
editorDom2.focus();
|
|
46391
46710
|
__privateGet(this, _editor3).view?.focus();
|
|
46392
46711
|
__privateMethod(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
46393
46712
|
}
|
|
@@ -46510,7 +46829,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46510
46829
|
}
|
|
46511
46830
|
const editorDom2 = __privateGet(this, _editor3).view?.dom;
|
|
46512
46831
|
if (editorDom2) {
|
|
46513
|
-
editorDom2.focus(
|
|
46832
|
+
editorDom2.focus();
|
|
46514
46833
|
__privateGet(this, _editor3).view?.focus();
|
|
46515
46834
|
}
|
|
46516
46835
|
return;
|
|
@@ -46543,6 +46862,25 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46543
46862
|
} else {
|
|
46544
46863
|
__privateSet(this, _dragExtensionMode, "char");
|
|
46545
46864
|
}
|
|
46865
|
+
debugLog(
|
|
46866
|
+
"verbose",
|
|
46867
|
+
`Drag selection start ${JSON.stringify({
|
|
46868
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x, y },
|
|
46869
|
+
clickDepth,
|
|
46870
|
+
extensionMode: __privateGet(this, _dragExtensionMode),
|
|
46871
|
+
anchor: __privateGet(this, _dragAnchor),
|
|
46872
|
+
anchorPageIndex: __privateGet(this, _dragAnchorPageIndex),
|
|
46873
|
+
rawHit: rawHit ? {
|
|
46874
|
+
pos: rawHit.pos,
|
|
46875
|
+
pageIndex: rawHit.pageIndex,
|
|
46876
|
+
blockId: rawHit.blockId,
|
|
46877
|
+
lineIndex: rawHit.lineIndex,
|
|
46878
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
46879
|
+
} : null,
|
|
46880
|
+
mapped: mapped ? mapped.ok ? { ok: true, pos: mapped.pos, fromEpoch: mapped.fromEpoch, toEpoch: mapped.toEpoch } : { ok: false, reason: mapped.reason, fromEpoch: mapped.fromEpoch, toEpoch: mapped.toEpoch } : null,
|
|
46881
|
+
hit: hit ? { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch } : null
|
|
46882
|
+
})}`
|
|
46883
|
+
);
|
|
46546
46884
|
if (typeof __privateGet(this, _viewportHost).setPointerCapture === "function") {
|
|
46547
46885
|
__privateGet(this, _viewportHost).setPointerCapture(event.pointerId);
|
|
46548
46886
|
}
|
|
@@ -46570,7 +46908,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46570
46908
|
if (!editorDom) {
|
|
46571
46909
|
return;
|
|
46572
46910
|
}
|
|
46573
|
-
editorDom.focus(
|
|
46911
|
+
editorDom.focus();
|
|
46574
46912
|
__privateGet(this, _editor3).view?.focus();
|
|
46575
46913
|
});
|
|
46576
46914
|
__privateAdd(this, _handlePointerMove, (event) => {
|
|
@@ -46579,6 +46917,8 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46579
46917
|
if (!normalized) return;
|
|
46580
46918
|
if (__privateGet(this, _isDragging) && __privateGet(this, _dragAnchor) !== null && event.buttons & 1) {
|
|
46581
46919
|
__privateSet(this, _pendingMarginClick, null);
|
|
46920
|
+
const prevPointer = __privateGet(this, _dragLastPointer);
|
|
46921
|
+
const prevRawHit = __privateGet(this, _dragLastRawHit);
|
|
46582
46922
|
__privateSet(this, _dragLastPointer, { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y });
|
|
46583
46923
|
const rawHit = clickToPosition(
|
|
46584
46924
|
__privateGet(this, _layoutState).layout,
|
|
@@ -46590,7 +46930,17 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46590
46930
|
event.clientY,
|
|
46591
46931
|
__privateGet(this, _pageGeometryHelper) ?? void 0
|
|
46592
46932
|
);
|
|
46593
|
-
if (!rawHit)
|
|
46933
|
+
if (!rawHit) {
|
|
46934
|
+
debugLog(
|
|
46935
|
+
"verbose",
|
|
46936
|
+
`Drag selection update (no hit) ${JSON.stringify({
|
|
46937
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
46938
|
+
prevPointer,
|
|
46939
|
+
anchor: __privateGet(this, _dragAnchor)
|
|
46940
|
+
})}`
|
|
46941
|
+
);
|
|
46942
|
+
return;
|
|
46943
|
+
}
|
|
46594
46944
|
const doc2 = __privateGet(this, _editor3).state?.doc;
|
|
46595
46945
|
if (!doc2) return;
|
|
46596
46946
|
__privateSet(this, _dragLastRawHit, rawHit);
|
|
@@ -46603,6 +46953,27 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46603
46953
|
const mappedHead = __privateGet(this, _epochMapper).mapPosFromLayoutToCurrentDetailed(rawHit.pos, rawHit.layoutEpoch, 1);
|
|
46604
46954
|
if (!mappedHead.ok) {
|
|
46605
46955
|
debugLog("warn", "drag mapping failed", mappedHead);
|
|
46956
|
+
debugLog(
|
|
46957
|
+
"verbose",
|
|
46958
|
+
`Drag selection update (map failed) ${JSON.stringify({
|
|
46959
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
46960
|
+
prevPointer,
|
|
46961
|
+
anchor: __privateGet(this, _dragAnchor),
|
|
46962
|
+
rawHit: {
|
|
46963
|
+
pos: rawHit.pos,
|
|
46964
|
+
pageIndex: rawHit.pageIndex,
|
|
46965
|
+
blockId: rawHit.blockId,
|
|
46966
|
+
lineIndex: rawHit.lineIndex,
|
|
46967
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
46968
|
+
},
|
|
46969
|
+
mapped: {
|
|
46970
|
+
ok: false,
|
|
46971
|
+
reason: mappedHead.reason,
|
|
46972
|
+
fromEpoch: mappedHead.fromEpoch,
|
|
46973
|
+
toEpoch: mappedHead.toEpoch
|
|
46974
|
+
}
|
|
46975
|
+
})}`
|
|
46976
|
+
);
|
|
46606
46977
|
return;
|
|
46607
46978
|
}
|
|
46608
46979
|
const hit = {
|
|
@@ -46617,6 +46988,41 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46617
46988
|
mappedPos: hit.pos
|
|
46618
46989
|
});
|
|
46619
46990
|
__privateMethod(this, _PresentationEditor_instances, updateSelectionDebugHud_fn).call(this);
|
|
46991
|
+
const anchor = __privateGet(this, _dragAnchor);
|
|
46992
|
+
const head = hit.pos;
|
|
46993
|
+
const { selAnchor, selHead } = __privateMethod(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet(this, _dragExtensionMode));
|
|
46994
|
+
debugLog(
|
|
46995
|
+
"verbose",
|
|
46996
|
+
`Drag selection update ${JSON.stringify({
|
|
46997
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
46998
|
+
prevPointer,
|
|
46999
|
+
rawHit: {
|
|
47000
|
+
pos: rawHit.pos,
|
|
47001
|
+
pageIndex: rawHit.pageIndex,
|
|
47002
|
+
blockId: rawHit.blockId,
|
|
47003
|
+
lineIndex: rawHit.lineIndex,
|
|
47004
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
47005
|
+
},
|
|
47006
|
+
prevRawHit: prevRawHit ? {
|
|
47007
|
+
pos: prevRawHit.pos,
|
|
47008
|
+
pageIndex: prevRawHit.pageIndex,
|
|
47009
|
+
blockId: prevRawHit.blockId,
|
|
47010
|
+
lineIndex: prevRawHit.lineIndex,
|
|
47011
|
+
layoutEpoch: prevRawHit.layoutEpoch
|
|
47012
|
+
} : null,
|
|
47013
|
+
mappedHead: { pos: mappedHead.pos, fromEpoch: mappedHead.fromEpoch, toEpoch: mappedHead.toEpoch },
|
|
47014
|
+
hit: { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch },
|
|
47015
|
+
anchor,
|
|
47016
|
+
head,
|
|
47017
|
+
selAnchor,
|
|
47018
|
+
selHead,
|
|
47019
|
+
direction: head >= anchor ? "down" : "up",
|
|
47020
|
+
selectionDirection: selHead >= selAnchor ? "down" : "up",
|
|
47021
|
+
extensionMode: __privateGet(this, _dragExtensionMode),
|
|
47022
|
+
hitSource: pageMounted ? "dom" : "geometry",
|
|
47023
|
+
pageMounted
|
|
47024
|
+
})}`
|
|
47025
|
+
);
|
|
46620
47026
|
const currentTableHit = __privateMethod(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
|
|
46621
47027
|
const shouldUseCellSel = __privateMethod(this, _PresentationEditor_instances, shouldUseCellSelection_fn).call(this, currentTableHit);
|
|
46622
47028
|
if (shouldUseCellSel && __privateGet(this, _cellAnchor)) {
|
|
@@ -46651,9 +47057,6 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46651
47057
|
return;
|
|
46652
47058
|
}
|
|
46653
47059
|
}
|
|
46654
|
-
const anchor = __privateGet(this, _dragAnchor);
|
|
46655
|
-
const head = hit.pos;
|
|
46656
|
-
const { selAnchor, selHead } = __privateMethod(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet(this, _dragExtensionMode));
|
|
46657
47060
|
try {
|
|
46658
47061
|
const tr = __privateGet(this, _editor3).state.tr.setSelection(TextSelection.create(__privateGet(this, _editor3).state.doc, selAnchor, selHead));
|
|
46659
47062
|
__privateGet(this, _editor3).view?.dispatch(tr);
|
|
@@ -47048,6 +47451,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
47048
47451
|
editorProps: normalizedEditorProps,
|
|
47049
47452
|
documentMode: __privateGet(this, _documentMode)
|
|
47050
47453
|
}));
|
|
47454
|
+
__privateMethod(this, _PresentationEditor_instances, wrapHiddenEditorFocus_fn).call(this);
|
|
47051
47455
|
__privateGet(this, _editor3).presentationEditor = this;
|
|
47052
47456
|
__privateGet(this, _editor3)._presentationEditor = this;
|
|
47053
47457
|
__privateMethod(this, _PresentationEditor_instances, syncHiddenEditorA11yAttributes_fn).call(this);
|
|
@@ -48247,6 +48651,94 @@ _scrollTimeout = new WeakMap();
|
|
|
48247
48651
|
_lastRemoteCursorRenderTime = new WeakMap();
|
|
48248
48652
|
_remoteCursorThrottleTimeout = new WeakMap();
|
|
48249
48653
|
_PresentationEditor_instances = new WeakSet();
|
|
48654
|
+
/**
|
|
48655
|
+
* Wraps the hidden editor's focus method to prevent unwanted scrolling when it receives focus.
|
|
48656
|
+
*
|
|
48657
|
+
* The hidden ProseMirror editor is positioned off-screen but must remain focusable for
|
|
48658
|
+
* accessibility. When it receives focus, browsers may attempt to scroll it into view,
|
|
48659
|
+
* disrupting the user's viewport position. This method wraps the view's focus function
|
|
48660
|
+
* to prevent that scroll behavior using multiple fallback strategies.
|
|
48661
|
+
*
|
|
48662
|
+
* @remarks
|
|
48663
|
+
* **Why this exists:**
|
|
48664
|
+
* - The hidden editor provides semantic document structure for screen readers
|
|
48665
|
+
* - It must be focusable, but is positioned off-screen with `left: -9999px`
|
|
48666
|
+
* - Some browsers scroll to bring focused elements into view, breaking the user experience
|
|
48667
|
+
* - This wrapper prevents that scroll while maintaining focus behavior
|
|
48668
|
+
*
|
|
48669
|
+
* **Fallback strategies (in order):**
|
|
48670
|
+
* 1. Try `view.dom.focus({ preventScroll: true })` - the standard approach
|
|
48671
|
+
* 2. If that fails, try `view.dom.focus()` without options and restore scroll position
|
|
48672
|
+
* 3. If both fail, call the original ProseMirror focus method as last resort
|
|
48673
|
+
* 4. Always restore scroll position if it changed during any focus attempt
|
|
48674
|
+
*
|
|
48675
|
+
* **Idempotency:**
|
|
48676
|
+
* - Safe to call multiple times - checks `__sdPreventScrollFocus` flag to avoid re-wrapping
|
|
48677
|
+
* - The flag is set on the view object after first successful wrap
|
|
48678
|
+
*
|
|
48679
|
+
* **Test awareness:**
|
|
48680
|
+
* - Skips wrapping if the focus function has a `mock` property (Vitest/Jest mocks)
|
|
48681
|
+
* - Prevents interference with test assertions and mock function tracking
|
|
48682
|
+
*/
|
|
48683
|
+
wrapHiddenEditorFocus_fn = function() {
|
|
48684
|
+
const view = __privateGet(this, _editor3)?.view;
|
|
48685
|
+
if (!view || !view.dom || typeof view.focus !== "function") {
|
|
48686
|
+
return;
|
|
48687
|
+
}
|
|
48688
|
+
const viewWithFlag = view;
|
|
48689
|
+
if (viewWithFlag.__sdPreventScrollFocus) {
|
|
48690
|
+
return;
|
|
48691
|
+
}
|
|
48692
|
+
const focusFn = view.focus;
|
|
48693
|
+
if (focusFn.mock) {
|
|
48694
|
+
return;
|
|
48695
|
+
}
|
|
48696
|
+
viewWithFlag.__sdPreventScrollFocus = true;
|
|
48697
|
+
const originalFocus = view.focus.bind(view);
|
|
48698
|
+
view.focus = () => {
|
|
48699
|
+
const win = __privateGet(this, _visibleHost).ownerDocument?.defaultView;
|
|
48700
|
+
if (!win) {
|
|
48701
|
+
originalFocus();
|
|
48702
|
+
return;
|
|
48703
|
+
}
|
|
48704
|
+
const beforeX = win.scrollX;
|
|
48705
|
+
const beforeY = win.scrollY;
|
|
48706
|
+
let focused = false;
|
|
48707
|
+
try {
|
|
48708
|
+
view.dom.focus({ preventScroll: true });
|
|
48709
|
+
focused = true;
|
|
48710
|
+
} catch (error) {
|
|
48711
|
+
debugLog("warn", "Hidden editor focus: preventScroll failed", {
|
|
48712
|
+
error: String(error),
|
|
48713
|
+
strategy: "preventScroll"
|
|
48714
|
+
});
|
|
48715
|
+
}
|
|
48716
|
+
if (!focused) {
|
|
48717
|
+
try {
|
|
48718
|
+
view.dom.focus();
|
|
48719
|
+
focused = true;
|
|
48720
|
+
} catch (error) {
|
|
48721
|
+
debugLog("warn", "Hidden editor focus: standard focus failed", {
|
|
48722
|
+
error: String(error),
|
|
48723
|
+
strategy: "standard"
|
|
48724
|
+
});
|
|
48725
|
+
}
|
|
48726
|
+
}
|
|
48727
|
+
if (!focused) {
|
|
48728
|
+
try {
|
|
48729
|
+
originalFocus();
|
|
48730
|
+
} catch (error) {
|
|
48731
|
+
debugLog("error", "Hidden editor focus: all strategies failed", {
|
|
48732
|
+
error: String(error),
|
|
48733
|
+
strategy: "original"
|
|
48734
|
+
});
|
|
48735
|
+
}
|
|
48736
|
+
}
|
|
48737
|
+
if (win.scrollX !== beforeX || win.scrollY !== beforeY) {
|
|
48738
|
+
win.scrollTo(beforeX, beforeY);
|
|
48739
|
+
}
|
|
48740
|
+
};
|
|
48741
|
+
};
|
|
48250
48742
|
/**
|
|
48251
48743
|
* Collect all comment and tracked change positions from the PM document.
|
|
48252
48744
|
*
|
|
@@ -48752,7 +49244,7 @@ focusEditorAfterImageSelection_fn = function() {
|
|
|
48752
49244
|
}
|
|
48753
49245
|
const editorDom = __privateGet(this, _editor3).view?.dom;
|
|
48754
49246
|
if (editorDom) {
|
|
48755
|
-
editorDom.focus(
|
|
49247
|
+
editorDom.focus();
|
|
48756
49248
|
__privateGet(this, _editor3).view?.focus();
|
|
48757
49249
|
}
|
|
48758
49250
|
};
|