@harbour-enterprises/superdoc 1.0.0-next.10 → 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-CZG4udaT.es.js → PdfViewer-DmfOe_Pf.es.js} +1 -1
- package/dist/chunks/{PdfViewer-B9LcTIm2.cjs → PdfViewer-w6pLbkxf.cjs} +1 -1
- package/dist/chunks/{index-4FiyZ-0E.cjs → index-DCu_3jpz.cjs} +3 -3
- package/dist/chunks/{index-1n6qegaQ.es.js → index-DSLlUITa.es.js} +3 -3
- package/dist/chunks/{index-DdTDm9oI-Duiy8M_G.cjs → index-lMJbwm6b-B4MxvqkR.cjs} +1 -1
- package/dist/chunks/{index-DdTDm9oI-BXzE00pk.es.js → index-lMJbwm6b-l7bjUagi.es.js} +1 -1
- package/dist/chunks/{super-editor.es-BQQuazyp.cjs → super-editor.es-CYIzx8D9.cjs} +589 -122
- package/dist/chunks/{super-editor.es-DKr759cY.es.js → super-editor.es-ajKYblrs.es.js} +589 -122
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BavE2jnW.js → converter-Bf6IlS43.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-CY4M19qa.js → docx-zipper-16dfai0y.js} +1 -1
- package/dist/super-editor/chunks/{editor-Cslr04KI.js → editor-DJbi9-qr.js} +619 -123
- package/dist/super-editor/chunks/{index-DdTDm9oI.js → index-lMJbwm6b.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-Zdgn--Js.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 +591 -124
- 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() {
|
|
@@ -12268,7 +12268,11 @@ const trackedTransaction = ({ tr, state, user }) => {
|
|
|
12268
12268
|
const onlyInputTypeMeta = ["inputType", "uiEvent", "paste", "pointer"];
|
|
12269
12269
|
const notAllowedMeta = ["historyUndo", "historyRedo", "acceptReject"];
|
|
12270
12270
|
const isProgrammaticInput = tr.getMeta("inputType") === "programmatic";
|
|
12271
|
-
|
|
12271
|
+
const ySyncMeta = tr.getMeta(ySyncPluginKey);
|
|
12272
|
+
const allowedMeta = /* @__PURE__ */ new Set([...onlyInputTypeMeta, ySyncPluginKey.key]);
|
|
12273
|
+
const hasDisallowedMeta = tr.meta && Object.keys(tr.meta).some((meta) => !allowedMeta.has(meta));
|
|
12274
|
+
if (ySyncMeta?.isChangeOrigin || // Skip Yjs-origin transactions (remote/rehydration).
|
|
12275
|
+
!tr.steps.length || hasDisallowedMeta && !isProgrammaticInput || notAllowedMeta.includes(tr.getMeta("inputType")) || tr.getMeta(CommentsPluginKey)) {
|
|
12272
12276
|
return tr;
|
|
12273
12277
|
}
|
|
12274
12278
|
const newTr = state.tr;
|
|
@@ -13960,7 +13964,7 @@ const isHeadless = (editor) => {
|
|
|
13960
13964
|
const shouldSkipNodeView = (editor) => {
|
|
13961
13965
|
return isHeadless(editor);
|
|
13962
13966
|
};
|
|
13963
|
-
const summaryVersion = "1.0.0-next.
|
|
13967
|
+
const summaryVersion = "1.0.0-next.12";
|
|
13964
13968
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13965
13969
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13966
13970
|
function mapAttributes(attrs) {
|
|
@@ -14752,7 +14756,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14752
14756
|
{ default: remarkStringify },
|
|
14753
14757
|
{ default: remarkGfm }
|
|
14754
14758
|
] = await Promise.all([
|
|
14755
|
-
import("./index-
|
|
14759
|
+
import("./index-lMJbwm6b.js"),
|
|
14756
14760
|
import("./index-DRCvimau.js"),
|
|
14757
14761
|
import("./index-C_x_N6Uh.js"),
|
|
14758
14762
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14957,7 +14961,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14957
14961
|
* Process collaboration migrations
|
|
14958
14962
|
*/
|
|
14959
14963
|
processCollaborationMigrations() {
|
|
14960
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.
|
|
14964
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.12");
|
|
14961
14965
|
if (!this.options.ydoc) return;
|
|
14962
14966
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14963
14967
|
let docVersion = metaMap.get("version");
|
|
@@ -26044,6 +26048,86 @@ const createDomPainter = (options) => {
|
|
|
26044
26048
|
}
|
|
26045
26049
|
};
|
|
26046
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
|
+
}
|
|
26047
26131
|
class DomPositionIndex {
|
|
26048
26132
|
constructor() {
|
|
26049
26133
|
__privateAdd(this, _entries, []);
|
|
@@ -26100,6 +26184,7 @@ class DomPositionIndex {
|
|
|
26100
26184
|
}
|
|
26101
26185
|
for (const node of pmNodes) {
|
|
26102
26186
|
if (node.classList.contains(DOM_CLASS_NAMES.INLINE_SDT_WRAPPER)) continue;
|
|
26187
|
+
if (node.closest(".superdoc-page-header, .superdoc-page-footer")) continue;
|
|
26103
26188
|
if (leafOnly && nonLeaf.has(node)) continue;
|
|
26104
26189
|
const pmStart = Number(node.dataset.pmStart ?? "NaN");
|
|
26105
26190
|
const pmEnd = Number(node.dataset.pmEnd ?? "NaN");
|
|
@@ -26109,6 +26194,60 @@ class DomPositionIndex {
|
|
|
26109
26194
|
}
|
|
26110
26195
|
entries.sort((a, b) => a.pmStart - b.pmStart !== 0 ? a.pmStart - b.pmStart : a.pmEnd - b.pmEnd);
|
|
26111
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
|
+
}
|
|
26112
26251
|
}
|
|
26113
26252
|
/**
|
|
26114
26253
|
* Finds the index entry whose position range contains the given position.
|
|
@@ -26358,82 +26497,6 @@ _onRebuild = new WeakMap();
|
|
|
26358
26497
|
_observer = new WeakMap();
|
|
26359
26498
|
_rebuildScheduled = new WeakMap();
|
|
26360
26499
|
_rebuildRafId = new WeakMap();
|
|
26361
|
-
const DEFAULT_CONFIG = {
|
|
26362
|
-
logLevel: "off",
|
|
26363
|
-
hud: false
|
|
26364
|
-
};
|
|
26365
|
-
const levelOrder = {
|
|
26366
|
-
error: 0,
|
|
26367
|
-
warn: 1,
|
|
26368
|
-
info: 2,
|
|
26369
|
-
verbose: 3
|
|
26370
|
-
};
|
|
26371
|
-
function getSelectionDebugConfig() {
|
|
26372
|
-
var _a;
|
|
26373
|
-
if (typeof window === "undefined") {
|
|
26374
|
-
return DEFAULT_CONFIG;
|
|
26375
|
-
}
|
|
26376
|
-
window.superdocDebug ?? (window.superdocDebug = {});
|
|
26377
|
-
(_a = window.superdocDebug).selection ?? (_a.selection = {});
|
|
26378
|
-
const cfg = window.superdocDebug.selection;
|
|
26379
|
-
return {
|
|
26380
|
-
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
26381
|
-
hud: cfg.hud ?? DEFAULT_CONFIG.hud
|
|
26382
|
-
};
|
|
26383
|
-
}
|
|
26384
|
-
function debugLog(level, message, data) {
|
|
26385
|
-
const cfg = getSelectionDebugConfig();
|
|
26386
|
-
if (cfg.logLevel === "off") return;
|
|
26387
|
-
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
26388
|
-
const prefix = "[Selection]";
|
|
26389
|
-
if (data) {
|
|
26390
|
-
console.log(prefix, message, data);
|
|
26391
|
-
} else {
|
|
26392
|
-
console.log(prefix, message);
|
|
26393
|
-
}
|
|
26394
|
-
}
|
|
26395
|
-
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
26396
|
-
function updateSelectionDebugHud(host, state) {
|
|
26397
|
-
const cfg = getSelectionDebugConfig();
|
|
26398
|
-
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
26399
|
-
if (!doc2) return;
|
|
26400
|
-
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
26401
|
-
if (!cfg.hud) {
|
|
26402
|
-
existing?.remove();
|
|
26403
|
-
return;
|
|
26404
|
-
}
|
|
26405
|
-
const hud = existing ?? doc2.createElement("div");
|
|
26406
|
-
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
26407
|
-
hud.style.position = "absolute";
|
|
26408
|
-
hud.style.top = "8px";
|
|
26409
|
-
hud.style.left = "8px";
|
|
26410
|
-
hud.style.zIndex = "9999";
|
|
26411
|
-
hud.style.maxWidth = "420px";
|
|
26412
|
-
hud.style.padding = "6px 8px";
|
|
26413
|
-
hud.style.borderRadius = "6px";
|
|
26414
|
-
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
26415
|
-
hud.style.color = "white";
|
|
26416
|
-
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
26417
|
-
hud.style.fontSize = "12px";
|
|
26418
|
-
hud.style.lineHeight = "1.3";
|
|
26419
|
-
hud.style.pointerEvents = "none";
|
|
26420
|
-
hud.style.whiteSpace = "pre";
|
|
26421
|
-
const behind = Math.max(0, state.docEpoch - state.layoutEpoch);
|
|
26422
|
-
const selectionText = state.selection ? `${state.selection.from}..${state.selection.to}` : "null";
|
|
26423
|
-
const pointerText = state.lastPointer ? `${state.lastPointer.clientX},${state.lastPointer.clientY} -> ${Math.round(state.lastPointer.x)},${Math.round(
|
|
26424
|
-
state.lastPointer.y
|
|
26425
|
-
)}` : "null";
|
|
26426
|
-
const hitText = state.lastHit ? `${state.lastHit.source} pos=${state.lastHit.pos ?? "null"} epoch=${state.lastHit.layoutEpoch ?? "null"} mapped=${state.lastHit.mappedPos ?? "null"}` : "null";
|
|
26427
|
-
hud.textContent = [
|
|
26428
|
-
`docEpoch=${state.docEpoch} layoutEpoch=${state.layoutEpoch} behind=${behind}`,
|
|
26429
|
-
`selection=${selectionText}`,
|
|
26430
|
-
`pointer=${pointerText}`,
|
|
26431
|
-
`hit=${hitText}`
|
|
26432
|
-
].join("\n");
|
|
26433
|
-
if (!existing) {
|
|
26434
|
-
host.appendChild(hud);
|
|
26435
|
-
}
|
|
26436
|
-
}
|
|
26437
26500
|
function computeSelectionRectsFromDom(options, from2, to) {
|
|
26438
26501
|
const painterHost = options.painterHost;
|
|
26439
26502
|
if (!painterHost) return null;
|
|
@@ -26454,6 +26517,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
26454
26517
|
);
|
|
26455
26518
|
const out = [];
|
|
26456
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
|
+
});
|
|
26457
26548
|
for (const pageEl of pageEls) {
|
|
26458
26549
|
const pageIndex = Number(pageEl.dataset.pageIndex ?? "NaN");
|
|
26459
26550
|
if (!Number.isFinite(pageIndex)) continue;
|
|
@@ -26477,9 +26568,47 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
26477
26568
|
if (sliceEntries.length === 0) {
|
|
26478
26569
|
continue;
|
|
26479
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
|
+
}
|
|
26480
26583
|
let startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
26481
26584
|
let endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
26482
|
-
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
|
+
}
|
|
26483
26612
|
if (!rebuiltOnce) {
|
|
26484
26613
|
options.rebuildDomPositionIndex();
|
|
26485
26614
|
rebuiltOnce = true;
|
|
@@ -26487,9 +26616,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
26487
26616
|
if (sliceEntries.length === 0) continue;
|
|
26488
26617
|
startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
26489
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
|
+
}
|
|
26490
26635
|
}
|
|
26491
|
-
if (!
|
|
26492
|
-
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
|
+
);
|
|
26493
26647
|
return null;
|
|
26494
26648
|
}
|
|
26495
26649
|
}
|
|
@@ -26504,8 +26658,83 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
26504
26658
|
}
|
|
26505
26659
|
let clientRects = [];
|
|
26506
26660
|
try {
|
|
26507
|
-
|
|
26508
|
-
|
|
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
|
+
}
|
|
26509
26738
|
} catch (error) {
|
|
26510
26739
|
debugLog("warn", "DOM selection rects: getClientRects failed", { error: String(error) });
|
|
26511
26740
|
return null;
|
|
@@ -26529,6 +26758,57 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
26529
26758
|
}
|
|
26530
26759
|
return out;
|
|
26531
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
|
+
}
|
|
26532
26812
|
function setDomRangeStart(range, entry, pos) {
|
|
26533
26813
|
const el = entry.el;
|
|
26534
26814
|
const pmStart = entry.pmStart;
|
|
@@ -26638,31 +26918,69 @@ function deduplicateOverlappingRects(rects) {
|
|
|
26638
26918
|
return a.x - b.x;
|
|
26639
26919
|
});
|
|
26640
26920
|
const result = [];
|
|
26641
|
-
|
|
26642
|
-
|
|
26643
|
-
|
|
26644
|
-
|
|
26645
|
-
|
|
26646
|
-
|
|
26647
|
-
|
|
26648
|
-
|
|
26649
|
-
|
|
26650
|
-
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
26656
|
-
|
|
26657
|
-
|
|
26658
|
-
|
|
26659
|
-
|
|
26660
|
-
|
|
26661
|
-
|
|
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);
|
|
26662
26965
|
}
|
|
26663
26966
|
}
|
|
26664
|
-
|
|
26665
|
-
|
|
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);
|
|
26666
26984
|
}
|
|
26667
26985
|
return result;
|
|
26668
26986
|
}
|
|
@@ -26786,10 +27104,11 @@ function safeCleanup(fn2, context) {
|
|
|
26786
27104
|
function createHiddenHost(doc2, widthPx) {
|
|
26787
27105
|
const host = doc2.createElement("div");
|
|
26788
27106
|
host.className = "presentation-editor__hidden-host";
|
|
26789
|
-
host.style.position = "
|
|
27107
|
+
host.style.position = "fixed";
|
|
26790
27108
|
host.style.left = "-9999px";
|
|
26791
27109
|
host.style.top = "0";
|
|
26792
27110
|
host.style.width = `${widthPx}px`;
|
|
27111
|
+
host.style.setProperty("overflow-anchor", "none");
|
|
26793
27112
|
host.style.pointerEvents = "none";
|
|
26794
27113
|
host.style.opacity = "0";
|
|
26795
27114
|
host.style.zIndex = "-1";
|
|
@@ -27263,7 +27582,8 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
27263
27582
|
});
|
|
27264
27583
|
let hitChain = [];
|
|
27265
27584
|
const doc2 = document;
|
|
27266
|
-
|
|
27585
|
+
const hasElementsFromPoint = typeof doc2.elementsFromPoint === "function";
|
|
27586
|
+
if (hasElementsFromPoint) {
|
|
27267
27587
|
try {
|
|
27268
27588
|
hitChain = doc2.elementsFromPoint(viewX, viewY) ?? [];
|
|
27269
27589
|
} catch {
|
|
@@ -27309,11 +27629,14 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
27309
27629
|
log("All fragments on page:", JSON.stringify(fragmentData, null, 2));
|
|
27310
27630
|
const fragmentEl = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.fragment));
|
|
27311
27631
|
if (!fragmentEl) {
|
|
27632
|
+
if (hasElementsFromPoint) {
|
|
27633
|
+
return null;
|
|
27634
|
+
}
|
|
27312
27635
|
const fallbackFragment = pageEl.querySelector(`.${CLASS_NAMES.fragment}`);
|
|
27313
27636
|
if (!fallbackFragment) {
|
|
27314
27637
|
return null;
|
|
27315
27638
|
}
|
|
27316
|
-
log("Using fallback fragment:", {
|
|
27639
|
+
log("Using fallback fragment (no elementsFromPoint):", {
|
|
27317
27640
|
blockId: fallbackFragment.dataset.blockId,
|
|
27318
27641
|
pmStart: fallbackFragment.dataset.pmStart,
|
|
27319
27642
|
pmEnd: fallbackFragment.dataset.pmEnd
|
|
@@ -46316,7 +46639,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46316
46639
|
}
|
|
46317
46640
|
}
|
|
46318
46641
|
}
|
|
46319
|
-
editorDom2.focus(
|
|
46642
|
+
editorDom2.focus();
|
|
46320
46643
|
__privateGet(this, _editor3).view?.focus();
|
|
46321
46644
|
__privateMethod(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
46322
46645
|
return;
|
|
@@ -46383,7 +46706,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46383
46706
|
}
|
|
46384
46707
|
}
|
|
46385
46708
|
}
|
|
46386
|
-
editorDom2.focus(
|
|
46709
|
+
editorDom2.focus();
|
|
46387
46710
|
__privateGet(this, _editor3).view?.focus();
|
|
46388
46711
|
__privateMethod(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
46389
46712
|
}
|
|
@@ -46506,7 +46829,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46506
46829
|
}
|
|
46507
46830
|
const editorDom2 = __privateGet(this, _editor3).view?.dom;
|
|
46508
46831
|
if (editorDom2) {
|
|
46509
|
-
editorDom2.focus(
|
|
46832
|
+
editorDom2.focus();
|
|
46510
46833
|
__privateGet(this, _editor3).view?.focus();
|
|
46511
46834
|
}
|
|
46512
46835
|
return;
|
|
@@ -46539,6 +46862,25 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46539
46862
|
} else {
|
|
46540
46863
|
__privateSet(this, _dragExtensionMode, "char");
|
|
46541
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
|
+
);
|
|
46542
46884
|
if (typeof __privateGet(this, _viewportHost).setPointerCapture === "function") {
|
|
46543
46885
|
__privateGet(this, _viewportHost).setPointerCapture(event.pointerId);
|
|
46544
46886
|
}
|
|
@@ -46566,7 +46908,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46566
46908
|
if (!editorDom) {
|
|
46567
46909
|
return;
|
|
46568
46910
|
}
|
|
46569
|
-
editorDom.focus(
|
|
46911
|
+
editorDom.focus();
|
|
46570
46912
|
__privateGet(this, _editor3).view?.focus();
|
|
46571
46913
|
});
|
|
46572
46914
|
__privateAdd(this, _handlePointerMove, (event) => {
|
|
@@ -46575,6 +46917,8 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46575
46917
|
if (!normalized) return;
|
|
46576
46918
|
if (__privateGet(this, _isDragging) && __privateGet(this, _dragAnchor) !== null && event.buttons & 1) {
|
|
46577
46919
|
__privateSet(this, _pendingMarginClick, null);
|
|
46920
|
+
const prevPointer = __privateGet(this, _dragLastPointer);
|
|
46921
|
+
const prevRawHit = __privateGet(this, _dragLastRawHit);
|
|
46578
46922
|
__privateSet(this, _dragLastPointer, { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y });
|
|
46579
46923
|
const rawHit = clickToPosition(
|
|
46580
46924
|
__privateGet(this, _layoutState).layout,
|
|
@@ -46586,7 +46930,17 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46586
46930
|
event.clientY,
|
|
46587
46931
|
__privateGet(this, _pageGeometryHelper) ?? void 0
|
|
46588
46932
|
);
|
|
46589
|
-
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
|
+
}
|
|
46590
46944
|
const doc2 = __privateGet(this, _editor3).state?.doc;
|
|
46591
46945
|
if (!doc2) return;
|
|
46592
46946
|
__privateSet(this, _dragLastRawHit, rawHit);
|
|
@@ -46599,6 +46953,27 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46599
46953
|
const mappedHead = __privateGet(this, _epochMapper).mapPosFromLayoutToCurrentDetailed(rawHit.pos, rawHit.layoutEpoch, 1);
|
|
46600
46954
|
if (!mappedHead.ok) {
|
|
46601
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
|
+
);
|
|
46602
46977
|
return;
|
|
46603
46978
|
}
|
|
46604
46979
|
const hit = {
|
|
@@ -46613,6 +46988,41 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46613
46988
|
mappedPos: hit.pos
|
|
46614
46989
|
});
|
|
46615
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
|
+
);
|
|
46616
47026
|
const currentTableHit = __privateMethod(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
|
|
46617
47027
|
const shouldUseCellSel = __privateMethod(this, _PresentationEditor_instances, shouldUseCellSelection_fn).call(this, currentTableHit);
|
|
46618
47028
|
if (shouldUseCellSel && __privateGet(this, _cellAnchor)) {
|
|
@@ -46647,9 +47057,6 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
46647
47057
|
return;
|
|
46648
47058
|
}
|
|
46649
47059
|
}
|
|
46650
|
-
const anchor = __privateGet(this, _dragAnchor);
|
|
46651
|
-
const head = hit.pos;
|
|
46652
|
-
const { selAnchor, selHead } = __privateMethod(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet(this, _dragExtensionMode));
|
|
46653
47060
|
try {
|
|
46654
47061
|
const tr = __privateGet(this, _editor3).state.tr.setSelection(TextSelection.create(__privateGet(this, _editor3).state.doc, selAnchor, selHead));
|
|
46655
47062
|
__privateGet(this, _editor3).view?.dispatch(tr);
|
|
@@ -47044,6 +47451,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
47044
47451
|
editorProps: normalizedEditorProps,
|
|
47045
47452
|
documentMode: __privateGet(this, _documentMode)
|
|
47046
47453
|
}));
|
|
47454
|
+
__privateMethod(this, _PresentationEditor_instances, wrapHiddenEditorFocus_fn).call(this);
|
|
47047
47455
|
__privateGet(this, _editor3).presentationEditor = this;
|
|
47048
47456
|
__privateGet(this, _editor3)._presentationEditor = this;
|
|
47049
47457
|
__privateMethod(this, _PresentationEditor_instances, syncHiddenEditorA11yAttributes_fn).call(this);
|
|
@@ -48243,6 +48651,94 @@ _scrollTimeout = new WeakMap();
|
|
|
48243
48651
|
_lastRemoteCursorRenderTime = new WeakMap();
|
|
48244
48652
|
_remoteCursorThrottleTimeout = new WeakMap();
|
|
48245
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
|
+
};
|
|
48246
48742
|
/**
|
|
48247
48743
|
* Collect all comment and tracked change positions from the PM document.
|
|
48248
48744
|
*
|
|
@@ -48748,7 +49244,7 @@ focusEditorAfterImageSelection_fn = function() {
|
|
|
48748
49244
|
}
|
|
48749
49245
|
const editorDom = __privateGet(this, _editor3).view?.dom;
|
|
48750
49246
|
if (editorDom) {
|
|
48751
|
-
editorDom.focus(
|
|
49247
|
+
editorDom.focus();
|
|
48752
49248
|
__privateGet(this, _editor3).view?.focus();
|
|
48753
49249
|
}
|
|
48754
49250
|
};
|