@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
|
@@ -42427,7 +42427,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42427
42427
|
static getStoredSuperdocVersion(docx) {
|
|
42428
42428
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42429
42429
|
}
|
|
42430
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.
|
|
42430
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.12") {
|
|
42431
42431
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42432
42432
|
}
|
|
42433
42433
|
/**
|
|
@@ -45739,7 +45739,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
45739
45739
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
45740
45740
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
45741
45741
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
45742
|
-
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, 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;
|
|
45742
|
+
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, 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;
|
|
45743
45743
|
var GOOD_LEAF_SIZE = 200;
|
|
45744
45744
|
var RopeSequence = function RopeSequence2() {
|
|
45745
45745
|
};
|
|
@@ -59657,7 +59657,7 @@ const isHeadless = (editor) => {
|
|
|
59657
59657
|
const shouldSkipNodeView = (editor) => {
|
|
59658
59658
|
return isHeadless(editor);
|
|
59659
59659
|
};
|
|
59660
|
-
const summaryVersion = "1.0.0-next.
|
|
59660
|
+
const summaryVersion = "1.0.0-next.12";
|
|
59661
59661
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59662
59662
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59663
59663
|
function mapAttributes(attrs) {
|
|
@@ -60446,7 +60446,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60446
60446
|
{ default: remarkStringify },
|
|
60447
60447
|
{ default: remarkGfm }
|
|
60448
60448
|
] = await Promise.all([
|
|
60449
|
-
Promise.resolve().then(() => require("./index-
|
|
60449
|
+
Promise.resolve().then(() => require("./index-lMJbwm6b-B4MxvqkR.cjs")),
|
|
60450
60450
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
60451
60451
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
60452
60452
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -60651,7 +60651,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60651
60651
|
* Process collaboration migrations
|
|
60652
60652
|
*/
|
|
60653
60653
|
processCollaborationMigrations() {
|
|
60654
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.
|
|
60654
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.12");
|
|
60655
60655
|
if (!this.options.ydoc) return;
|
|
60656
60656
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60657
60657
|
let docVersion = metaMap.get("version");
|
|
@@ -71650,6 +71650,86 @@ const createDomPainter = (options) => {
|
|
|
71650
71650
|
}
|
|
71651
71651
|
};
|
|
71652
71652
|
};
|
|
71653
|
+
const DEFAULT_CONFIG = {
|
|
71654
|
+
logLevel: "off",
|
|
71655
|
+
hud: false,
|
|
71656
|
+
dumpRects: false,
|
|
71657
|
+
disableRectDedupe: false
|
|
71658
|
+
};
|
|
71659
|
+
const levelOrder = {
|
|
71660
|
+
error: 0,
|
|
71661
|
+
warn: 1,
|
|
71662
|
+
info: 2,
|
|
71663
|
+
verbose: 3
|
|
71664
|
+
};
|
|
71665
|
+
function getSelectionDebugConfig() {
|
|
71666
|
+
var _a2;
|
|
71667
|
+
if (typeof window === "undefined") {
|
|
71668
|
+
return DEFAULT_CONFIG;
|
|
71669
|
+
}
|
|
71670
|
+
window.superdocDebug ?? (window.superdocDebug = {});
|
|
71671
|
+
(_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
|
|
71672
|
+
const cfg = window.superdocDebug.selection;
|
|
71673
|
+
return {
|
|
71674
|
+
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
71675
|
+
hud: cfg.hud ?? DEFAULT_CONFIG.hud,
|
|
71676
|
+
dumpRects: cfg.dumpRects ?? DEFAULT_CONFIG.dumpRects,
|
|
71677
|
+
disableRectDedupe: cfg.disableRectDedupe ?? DEFAULT_CONFIG.disableRectDedupe
|
|
71678
|
+
};
|
|
71679
|
+
}
|
|
71680
|
+
function debugLog(level, message, data) {
|
|
71681
|
+
const cfg = getSelectionDebugConfig();
|
|
71682
|
+
if (cfg.logLevel === "off") return;
|
|
71683
|
+
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
71684
|
+
const prefix2 = "[Selection]";
|
|
71685
|
+
if (data) {
|
|
71686
|
+
console.log(prefix2, message, data);
|
|
71687
|
+
} else {
|
|
71688
|
+
console.log(prefix2, message);
|
|
71689
|
+
}
|
|
71690
|
+
}
|
|
71691
|
+
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
71692
|
+
function updateSelectionDebugHud(host, state2) {
|
|
71693
|
+
const cfg = getSelectionDebugConfig();
|
|
71694
|
+
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
71695
|
+
if (!doc2) return;
|
|
71696
|
+
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
71697
|
+
if (!cfg.hud) {
|
|
71698
|
+
existing?.remove();
|
|
71699
|
+
return;
|
|
71700
|
+
}
|
|
71701
|
+
const hud = existing ?? doc2.createElement("div");
|
|
71702
|
+
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
71703
|
+
hud.style.position = "absolute";
|
|
71704
|
+
hud.style.top = "8px";
|
|
71705
|
+
hud.style.left = "8px";
|
|
71706
|
+
hud.style.zIndex = "9999";
|
|
71707
|
+
hud.style.maxWidth = "420px";
|
|
71708
|
+
hud.style.padding = "6px 8px";
|
|
71709
|
+
hud.style.borderRadius = "6px";
|
|
71710
|
+
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
71711
|
+
hud.style.color = "white";
|
|
71712
|
+
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
71713
|
+
hud.style.fontSize = "12px";
|
|
71714
|
+
hud.style.lineHeight = "1.3";
|
|
71715
|
+
hud.style.pointerEvents = "none";
|
|
71716
|
+
hud.style.whiteSpace = "pre";
|
|
71717
|
+
const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
|
|
71718
|
+
const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
|
|
71719
|
+
const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
|
|
71720
|
+
state2.lastPointer.y
|
|
71721
|
+
)}` : "null";
|
|
71722
|
+
const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
|
|
71723
|
+
hud.textContent = [
|
|
71724
|
+
`docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
|
|
71725
|
+
`selection=${selectionText}`,
|
|
71726
|
+
`pointer=${pointerText}`,
|
|
71727
|
+
`hit=${hitText}`
|
|
71728
|
+
].join("\n");
|
|
71729
|
+
if (!existing) {
|
|
71730
|
+
host.appendChild(hud);
|
|
71731
|
+
}
|
|
71732
|
+
}
|
|
71653
71733
|
class DomPositionIndex {
|
|
71654
71734
|
constructor() {
|
|
71655
71735
|
__privateAdd$1(this, _entries, []);
|
|
@@ -71706,6 +71786,7 @@ class DomPositionIndex {
|
|
|
71706
71786
|
}
|
|
71707
71787
|
for (const node of pmNodes) {
|
|
71708
71788
|
if (node.classList.contains(DOM_CLASS_NAMES.INLINE_SDT_WRAPPER)) continue;
|
|
71789
|
+
if (node.closest(".superdoc-page-header, .superdoc-page-footer")) continue;
|
|
71709
71790
|
if (leafOnly && nonLeaf.has(node)) continue;
|
|
71710
71791
|
const pmStart = Number(node.dataset.pmStart ?? "NaN");
|
|
71711
71792
|
const pmEnd = Number(node.dataset.pmEnd ?? "NaN");
|
|
@@ -71715,6 +71796,60 @@ class DomPositionIndex {
|
|
|
71715
71796
|
}
|
|
71716
71797
|
entries.sort((a, b2) => a.pmStart - b2.pmStart !== 0 ? a.pmStart - b2.pmStart : a.pmEnd - b2.pmEnd);
|
|
71717
71798
|
__privateSet(this, _entries, entries);
|
|
71799
|
+
const isVerbose = getSelectionDebugConfig().logLevel === "verbose";
|
|
71800
|
+
if (isVerbose) {
|
|
71801
|
+
const counts = { total: entries.length, body: 0, header: 0, footer: 0 };
|
|
71802
|
+
const bodySamples = [];
|
|
71803
|
+
const headerSamples = [];
|
|
71804
|
+
const footerSamples = [];
|
|
71805
|
+
for (const entry of entries) {
|
|
71806
|
+
const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
|
|
71807
|
+
const pageIndex = pageEl?.dataset.pageIndex ?? null;
|
|
71808
|
+
const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
|
|
71809
|
+
if (section === "header") {
|
|
71810
|
+
counts.header += 1;
|
|
71811
|
+
if (headerSamples.length < 10) {
|
|
71812
|
+
headerSamples.push({
|
|
71813
|
+
pmStart: entry.pmStart,
|
|
71814
|
+
pmEnd: entry.pmEnd,
|
|
71815
|
+
pageIndex,
|
|
71816
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
71817
|
+
});
|
|
71818
|
+
}
|
|
71819
|
+
continue;
|
|
71820
|
+
}
|
|
71821
|
+
if (section === "footer") {
|
|
71822
|
+
counts.footer += 1;
|
|
71823
|
+
if (footerSamples.length < 10) {
|
|
71824
|
+
footerSamples.push({
|
|
71825
|
+
pmStart: entry.pmStart,
|
|
71826
|
+
pmEnd: entry.pmEnd,
|
|
71827
|
+
pageIndex,
|
|
71828
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
71829
|
+
});
|
|
71830
|
+
}
|
|
71831
|
+
continue;
|
|
71832
|
+
}
|
|
71833
|
+
counts.body += 1;
|
|
71834
|
+
if (bodySamples.length < 10) {
|
|
71835
|
+
bodySamples.push({
|
|
71836
|
+
pmStart: entry.pmStart,
|
|
71837
|
+
pmEnd: entry.pmEnd,
|
|
71838
|
+
pageIndex,
|
|
71839
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
71840
|
+
});
|
|
71841
|
+
}
|
|
71842
|
+
}
|
|
71843
|
+
debugLog(
|
|
71844
|
+
"verbose",
|
|
71845
|
+
`DomPositionIndex: rebuild summary ${JSON.stringify({
|
|
71846
|
+
counts,
|
|
71847
|
+
bodySamples,
|
|
71848
|
+
headerSamples,
|
|
71849
|
+
footerSamples
|
|
71850
|
+
})}`
|
|
71851
|
+
);
|
|
71852
|
+
}
|
|
71718
71853
|
}
|
|
71719
71854
|
/**
|
|
71720
71855
|
* Finds the index entry whose position range contains the given position.
|
|
@@ -71964,82 +72099,6 @@ _onRebuild = /* @__PURE__ */ new WeakMap();
|
|
|
71964
72099
|
_observer = /* @__PURE__ */ new WeakMap();
|
|
71965
72100
|
_rebuildScheduled = /* @__PURE__ */ new WeakMap();
|
|
71966
72101
|
_rebuildRafId = /* @__PURE__ */ new WeakMap();
|
|
71967
|
-
const DEFAULT_CONFIG = {
|
|
71968
|
-
logLevel: "off",
|
|
71969
|
-
hud: false
|
|
71970
|
-
};
|
|
71971
|
-
const levelOrder = {
|
|
71972
|
-
error: 0,
|
|
71973
|
-
warn: 1,
|
|
71974
|
-
info: 2,
|
|
71975
|
-
verbose: 3
|
|
71976
|
-
};
|
|
71977
|
-
function getSelectionDebugConfig() {
|
|
71978
|
-
var _a2;
|
|
71979
|
-
if (typeof window === "undefined") {
|
|
71980
|
-
return DEFAULT_CONFIG;
|
|
71981
|
-
}
|
|
71982
|
-
window.superdocDebug ?? (window.superdocDebug = {});
|
|
71983
|
-
(_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
|
|
71984
|
-
const cfg = window.superdocDebug.selection;
|
|
71985
|
-
return {
|
|
71986
|
-
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
71987
|
-
hud: cfg.hud ?? DEFAULT_CONFIG.hud
|
|
71988
|
-
};
|
|
71989
|
-
}
|
|
71990
|
-
function debugLog(level, message, data) {
|
|
71991
|
-
const cfg = getSelectionDebugConfig();
|
|
71992
|
-
if (cfg.logLevel === "off") return;
|
|
71993
|
-
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
71994
|
-
const prefix2 = "[Selection]";
|
|
71995
|
-
if (data) {
|
|
71996
|
-
console.log(prefix2, message, data);
|
|
71997
|
-
} else {
|
|
71998
|
-
console.log(prefix2, message);
|
|
71999
|
-
}
|
|
72000
|
-
}
|
|
72001
|
-
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
72002
|
-
function updateSelectionDebugHud(host, state2) {
|
|
72003
|
-
const cfg = getSelectionDebugConfig();
|
|
72004
|
-
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
72005
|
-
if (!doc2) return;
|
|
72006
|
-
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
72007
|
-
if (!cfg.hud) {
|
|
72008
|
-
existing?.remove();
|
|
72009
|
-
return;
|
|
72010
|
-
}
|
|
72011
|
-
const hud = existing ?? doc2.createElement("div");
|
|
72012
|
-
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
72013
|
-
hud.style.position = "absolute";
|
|
72014
|
-
hud.style.top = "8px";
|
|
72015
|
-
hud.style.left = "8px";
|
|
72016
|
-
hud.style.zIndex = "9999";
|
|
72017
|
-
hud.style.maxWidth = "420px";
|
|
72018
|
-
hud.style.padding = "6px 8px";
|
|
72019
|
-
hud.style.borderRadius = "6px";
|
|
72020
|
-
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
72021
|
-
hud.style.color = "white";
|
|
72022
|
-
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
72023
|
-
hud.style.fontSize = "12px";
|
|
72024
|
-
hud.style.lineHeight = "1.3";
|
|
72025
|
-
hud.style.pointerEvents = "none";
|
|
72026
|
-
hud.style.whiteSpace = "pre";
|
|
72027
|
-
const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
|
|
72028
|
-
const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
|
|
72029
|
-
const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
|
|
72030
|
-
state2.lastPointer.y
|
|
72031
|
-
)}` : "null";
|
|
72032
|
-
const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
|
|
72033
|
-
hud.textContent = [
|
|
72034
|
-
`docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
|
|
72035
|
-
`selection=${selectionText}`,
|
|
72036
|
-
`pointer=${pointerText}`,
|
|
72037
|
-
`hit=${hitText}`
|
|
72038
|
-
].join("\n");
|
|
72039
|
-
if (!existing) {
|
|
72040
|
-
host.appendChild(hud);
|
|
72041
|
-
}
|
|
72042
|
-
}
|
|
72043
72102
|
function computeSelectionRectsFromDom(options, from2, to) {
|
|
72044
72103
|
const painterHost = options.painterHost;
|
|
72045
72104
|
if (!painterHost) return null;
|
|
@@ -72060,6 +72119,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72060
72119
|
);
|
|
72061
72120
|
const out = [];
|
|
72062
72121
|
let rebuiltOnce = false;
|
|
72122
|
+
const debugConfig = getSelectionDebugConfig();
|
|
72123
|
+
const isVerbose = debugConfig.logLevel === "verbose";
|
|
72124
|
+
const dumpRects = isVerbose && debugConfig.dumpRects;
|
|
72125
|
+
const disableRectDedupe = debugConfig.disableRectDedupe;
|
|
72126
|
+
const entryDebugInfo = (entry) => {
|
|
72127
|
+
const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
|
|
72128
|
+
const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
|
|
72129
|
+
return {
|
|
72130
|
+
pmStart: entry.pmStart,
|
|
72131
|
+
pmEnd: entry.pmEnd,
|
|
72132
|
+
pageIndex: pageEl?.dataset.pageIndex ?? null,
|
|
72133
|
+
section,
|
|
72134
|
+
connected: entry.el.isConnected,
|
|
72135
|
+
layoutEpoch: entry.el.dataset.layoutEpoch ?? null,
|
|
72136
|
+
pageEpoch: pageEl?.dataset.layoutEpoch ?? null,
|
|
72137
|
+
text: (entry.el.textContent ?? "").slice(0, 80)
|
|
72138
|
+
};
|
|
72139
|
+
};
|
|
72140
|
+
const rectDebugInfo = (rect) => ({
|
|
72141
|
+
x: rect.x,
|
|
72142
|
+
y: rect.y,
|
|
72143
|
+
width: rect.width,
|
|
72144
|
+
height: rect.height,
|
|
72145
|
+
top: rect.top,
|
|
72146
|
+
left: rect.left,
|
|
72147
|
+
right: rect.right,
|
|
72148
|
+
bottom: rect.bottom
|
|
72149
|
+
});
|
|
72063
72150
|
for (const pageEl of pageEls) {
|
|
72064
72151
|
const pageIndex = Number(pageEl.dataset.pageIndex ?? "NaN");
|
|
72065
72152
|
if (!Number.isFinite(pageIndex)) continue;
|
|
@@ -72083,9 +72170,47 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72083
72170
|
if (sliceEntries.length === 0) {
|
|
72084
72171
|
continue;
|
|
72085
72172
|
}
|
|
72173
|
+
if (isVerbose) {
|
|
72174
|
+
debugLog(
|
|
72175
|
+
"verbose",
|
|
72176
|
+
`DOM selection rects: slice entries ${JSON.stringify({
|
|
72177
|
+
pageIndex,
|
|
72178
|
+
sliceFrom,
|
|
72179
|
+
sliceTo,
|
|
72180
|
+
entriesCount: sliceEntries.length,
|
|
72181
|
+
entriesPreview: sliceEntries.slice(0, 20).map(entryDebugInfo)
|
|
72182
|
+
})}`
|
|
72183
|
+
);
|
|
72184
|
+
}
|
|
72086
72185
|
let startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
72087
72186
|
let endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
72088
|
-
if (
|
|
72187
|
+
if (isVerbose) {
|
|
72188
|
+
debugLog(
|
|
72189
|
+
"verbose",
|
|
72190
|
+
`DOM selection rects: boundaries ${JSON.stringify({
|
|
72191
|
+
pageIndex,
|
|
72192
|
+
sliceFrom,
|
|
72193
|
+
sliceTo,
|
|
72194
|
+
start: entryDebugInfo(startEntry),
|
|
72195
|
+
end: entryDebugInfo(endEntry)
|
|
72196
|
+
})}`
|
|
72197
|
+
);
|
|
72198
|
+
}
|
|
72199
|
+
let startContained = pageEl.contains(startEntry.el);
|
|
72200
|
+
let endContained = pageEl.contains(endEntry.el);
|
|
72201
|
+
if (!startContained || !endContained) {
|
|
72202
|
+
if (isVerbose) {
|
|
72203
|
+
debugLog(
|
|
72204
|
+
"verbose",
|
|
72205
|
+
`DOM selection rects: boundary containment ${JSON.stringify({
|
|
72206
|
+
pageIndex,
|
|
72207
|
+
sliceFrom,
|
|
72208
|
+
sliceTo,
|
|
72209
|
+
startContained,
|
|
72210
|
+
endContained
|
|
72211
|
+
})}`
|
|
72212
|
+
);
|
|
72213
|
+
}
|
|
72089
72214
|
if (!rebuiltOnce) {
|
|
72090
72215
|
options.rebuildDomPositionIndex();
|
|
72091
72216
|
rebuiltOnce = true;
|
|
@@ -72093,9 +72218,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72093
72218
|
if (sliceEntries.length === 0) continue;
|
|
72094
72219
|
startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
72095
72220
|
endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
72221
|
+
startContained = pageEl.contains(startEntry.el);
|
|
72222
|
+
endContained = pageEl.contains(endEntry.el);
|
|
72223
|
+
if (isVerbose) {
|
|
72224
|
+
debugLog(
|
|
72225
|
+
"verbose",
|
|
72226
|
+
`DOM selection rects: boundary containment after rebuild ${JSON.stringify({
|
|
72227
|
+
pageIndex,
|
|
72228
|
+
sliceFrom,
|
|
72229
|
+
sliceTo,
|
|
72230
|
+
startContained,
|
|
72231
|
+
endContained,
|
|
72232
|
+
start: entryDebugInfo(startEntry),
|
|
72233
|
+
end: entryDebugInfo(endEntry)
|
|
72234
|
+
})}`
|
|
72235
|
+
);
|
|
72236
|
+
}
|
|
72096
72237
|
}
|
|
72097
|
-
if (!
|
|
72098
|
-
debugLog(
|
|
72238
|
+
if (!startContained || !endContained) {
|
|
72239
|
+
debugLog(
|
|
72240
|
+
"warn",
|
|
72241
|
+
`DOM selection rects: stale index after rebuild ${JSON.stringify({
|
|
72242
|
+
pageIndex,
|
|
72243
|
+
sliceFrom,
|
|
72244
|
+
sliceTo,
|
|
72245
|
+
start: entryDebugInfo(startEntry),
|
|
72246
|
+
end: entryDebugInfo(endEntry)
|
|
72247
|
+
})}`
|
|
72248
|
+
);
|
|
72099
72249
|
return null;
|
|
72100
72250
|
}
|
|
72101
72251
|
}
|
|
@@ -72110,8 +72260,83 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72110
72260
|
}
|
|
72111
72261
|
let clientRects = [];
|
|
72112
72262
|
try {
|
|
72113
|
-
|
|
72114
|
-
|
|
72263
|
+
let rawRects = Array.from(range2.getClientRects());
|
|
72264
|
+
if (dumpRects) {
|
|
72265
|
+
debugLog(
|
|
72266
|
+
"verbose",
|
|
72267
|
+
`DOM selection rects: raw rects ${JSON.stringify({
|
|
72268
|
+
pageIndex,
|
|
72269
|
+
sliceFrom,
|
|
72270
|
+
sliceTo,
|
|
72271
|
+
rects: rawRects.map(rectDebugInfo)
|
|
72272
|
+
})}`
|
|
72273
|
+
);
|
|
72274
|
+
}
|
|
72275
|
+
let missingEntries = null;
|
|
72276
|
+
if (typeof range2.intersectsNode === "function") {
|
|
72277
|
+
for (const entry of sliceEntries) {
|
|
72278
|
+
try {
|
|
72279
|
+
if (!range2.intersectsNode(entry.el)) {
|
|
72280
|
+
missingEntries ?? (missingEntries = []);
|
|
72281
|
+
missingEntries.push(entry);
|
|
72282
|
+
}
|
|
72283
|
+
} catch {
|
|
72284
|
+
}
|
|
72285
|
+
}
|
|
72286
|
+
}
|
|
72287
|
+
if (missingEntries && missingEntries.length > 0) {
|
|
72288
|
+
if (isVerbose) {
|
|
72289
|
+
debugLog(
|
|
72290
|
+
"verbose",
|
|
72291
|
+
`DOM selection rects: range missing entries ${JSON.stringify({
|
|
72292
|
+
pageIndex,
|
|
72293
|
+
sliceFrom,
|
|
72294
|
+
sliceTo,
|
|
72295
|
+
missingCount: missingEntries.length,
|
|
72296
|
+
missingPreview: missingEntries.slice(0, 20).map(entryDebugInfo)
|
|
72297
|
+
})}`
|
|
72298
|
+
);
|
|
72299
|
+
}
|
|
72300
|
+
rawRects = collectClientRectsByLine(doc2, sliceEntries, sliceFrom, sliceTo);
|
|
72301
|
+
if (dumpRects) {
|
|
72302
|
+
debugLog(
|
|
72303
|
+
"verbose",
|
|
72304
|
+
`DOM selection rects: fallback raw rects ${JSON.stringify({
|
|
72305
|
+
pageIndex,
|
|
72306
|
+
sliceFrom,
|
|
72307
|
+
sliceTo,
|
|
72308
|
+
rects: rawRects.map(rectDebugInfo)
|
|
72309
|
+
})}`
|
|
72310
|
+
);
|
|
72311
|
+
}
|
|
72312
|
+
}
|
|
72313
|
+
clientRects = disableRectDedupe ? rawRects : deduplicateOverlappingRects(rawRects);
|
|
72314
|
+
if (dumpRects) {
|
|
72315
|
+
debugLog(
|
|
72316
|
+
"verbose",
|
|
72317
|
+
`DOM selection rects: final rects ${JSON.stringify({
|
|
72318
|
+
pageIndex,
|
|
72319
|
+
sliceFrom,
|
|
72320
|
+
sliceTo,
|
|
72321
|
+
dedupeDisabled: disableRectDedupe,
|
|
72322
|
+
rects: clientRects.map(rectDebugInfo)
|
|
72323
|
+
})}`
|
|
72324
|
+
);
|
|
72325
|
+
const nonPositive = clientRects.filter(
|
|
72326
|
+
(rect) => !Number.isFinite(rect.width) || !Number.isFinite(rect.height) || rect.width <= 0 || rect.height <= 0
|
|
72327
|
+
);
|
|
72328
|
+
if (nonPositive.length > 0) {
|
|
72329
|
+
debugLog(
|
|
72330
|
+
"verbose",
|
|
72331
|
+
`DOM selection rects: non-positive rects ${JSON.stringify({
|
|
72332
|
+
pageIndex,
|
|
72333
|
+
sliceFrom,
|
|
72334
|
+
sliceTo,
|
|
72335
|
+
rects: nonPositive.map(rectDebugInfo)
|
|
72336
|
+
})}`
|
|
72337
|
+
);
|
|
72338
|
+
}
|
|
72339
|
+
}
|
|
72115
72340
|
} catch (error) {
|
|
72116
72341
|
debugLog("warn", "DOM selection rects: getClientRects failed", { error: String(error) });
|
|
72117
72342
|
return null;
|
|
@@ -72135,6 +72360,57 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72135
72360
|
}
|
|
72136
72361
|
return out;
|
|
72137
72362
|
}
|
|
72363
|
+
function collectClientRectsByLine(doc2, entries, sliceFrom, sliceTo) {
|
|
72364
|
+
const rects = [];
|
|
72365
|
+
const lineMap = /* @__PURE__ */ new Map();
|
|
72366
|
+
const looseEntries = [];
|
|
72367
|
+
for (const entry of entries) {
|
|
72368
|
+
const lineEl = entry.el.closest(".superdoc-line");
|
|
72369
|
+
if (!lineEl) {
|
|
72370
|
+
looseEntries.push(entry);
|
|
72371
|
+
continue;
|
|
72372
|
+
}
|
|
72373
|
+
const list = lineMap.get(lineEl);
|
|
72374
|
+
if (list) {
|
|
72375
|
+
list.push(entry);
|
|
72376
|
+
} else {
|
|
72377
|
+
lineMap.set(lineEl, [entry]);
|
|
72378
|
+
}
|
|
72379
|
+
}
|
|
72380
|
+
for (const [, lineEntries] of lineMap) {
|
|
72381
|
+
lineEntries.sort((a, b2) => a.pmStart - b2.pmStart !== 0 ? a.pmStart - b2.pmStart : a.pmEnd - b2.pmEnd);
|
|
72382
|
+
const linePmStart = lineEntries[0]?.pmStart ?? Infinity;
|
|
72383
|
+
const linePmEnd = lineEntries[lineEntries.length - 1]?.pmEnd ?? -Infinity;
|
|
72384
|
+
if (!Number.isFinite(linePmStart) || !Number.isFinite(linePmEnd) || linePmEnd <= linePmStart) continue;
|
|
72385
|
+
const lineFrom = Math.max(sliceFrom, linePmStart);
|
|
72386
|
+
const lineTo = Math.min(sliceTo, linePmEnd);
|
|
72387
|
+
if (lineFrom >= lineTo) continue;
|
|
72388
|
+
const startEntry = lineEntries.find((entry) => lineFrom >= entry.pmStart && lineFrom <= entry.pmEnd) ?? lineEntries[0];
|
|
72389
|
+
const endEntry = lineEntries.find((entry) => lineTo >= entry.pmStart && lineTo <= entry.pmEnd) ?? lineEntries[lineEntries.length - 1];
|
|
72390
|
+
const range2 = doc2.createRange();
|
|
72391
|
+
try {
|
|
72392
|
+
if (!setDomRangeStart(range2, startEntry, lineFrom)) continue;
|
|
72393
|
+
if (!setDomRangeEnd(range2, endEntry, lineTo)) continue;
|
|
72394
|
+
} catch {
|
|
72395
|
+
continue;
|
|
72396
|
+
}
|
|
72397
|
+
rects.push(...Array.from(range2.getClientRects()));
|
|
72398
|
+
}
|
|
72399
|
+
for (const entry of looseEntries) {
|
|
72400
|
+
const entryFrom = Math.max(sliceFrom, entry.pmStart);
|
|
72401
|
+
const entryTo = Math.min(sliceTo, entry.pmEnd);
|
|
72402
|
+
if (entryFrom >= entryTo) continue;
|
|
72403
|
+
const range2 = doc2.createRange();
|
|
72404
|
+
try {
|
|
72405
|
+
if (!setDomRangeStart(range2, entry, entryFrom)) continue;
|
|
72406
|
+
if (!setDomRangeEnd(range2, entry, entryTo)) continue;
|
|
72407
|
+
} catch {
|
|
72408
|
+
continue;
|
|
72409
|
+
}
|
|
72410
|
+
rects.push(...Array.from(range2.getClientRects()));
|
|
72411
|
+
}
|
|
72412
|
+
return rects;
|
|
72413
|
+
}
|
|
72138
72414
|
function setDomRangeStart(range2, entry, pos) {
|
|
72139
72415
|
const el = entry.el;
|
|
72140
72416
|
const pmStart = entry.pmStart;
|
|
@@ -72244,31 +72520,69 @@ function deduplicateOverlappingRects(rects) {
|
|
|
72244
72520
|
return a.x - b2.x;
|
|
72245
72521
|
});
|
|
72246
72522
|
const result = [];
|
|
72247
|
-
|
|
72248
|
-
|
|
72249
|
-
|
|
72250
|
-
|
|
72251
|
-
|
|
72252
|
-
|
|
72253
|
-
|
|
72254
|
-
|
|
72255
|
-
|
|
72256
|
-
|
|
72257
|
-
|
|
72258
|
-
|
|
72259
|
-
|
|
72260
|
-
|
|
72261
|
-
|
|
72262
|
-
|
|
72263
|
-
|
|
72264
|
-
|
|
72265
|
-
|
|
72266
|
-
|
|
72267
|
-
|
|
72523
|
+
const groups = [];
|
|
72524
|
+
let currentGroup = [];
|
|
72525
|
+
for (const rect of sorted) {
|
|
72526
|
+
if (currentGroup.length === 0) {
|
|
72527
|
+
currentGroup.push(rect);
|
|
72528
|
+
continue;
|
|
72529
|
+
}
|
|
72530
|
+
const groupY = currentGroup[0].y;
|
|
72531
|
+
if (Math.abs(rect.y - groupY) <= Y_SAME_LINE_THRESHOLD_PX) {
|
|
72532
|
+
currentGroup.push(rect);
|
|
72533
|
+
} else {
|
|
72534
|
+
groups.push(currentGroup);
|
|
72535
|
+
currentGroup = [rect];
|
|
72536
|
+
}
|
|
72537
|
+
}
|
|
72538
|
+
if (currentGroup.length > 0) {
|
|
72539
|
+
groups.push(currentGroup);
|
|
72540
|
+
}
|
|
72541
|
+
const SIZE_EPS_PX = 0.5;
|
|
72542
|
+
const X_DUPLICATE_EPS_PX = 1;
|
|
72543
|
+
const hasSignificantOverlap = (a, b2) => {
|
|
72544
|
+
const xOverlapStart = Math.max(a.x, b2.x);
|
|
72545
|
+
const xOverlapEnd = Math.min(a.x + a.width, b2.x + b2.width);
|
|
72546
|
+
const hasHorizontalOverlap = xOverlapEnd > xOverlapStart;
|
|
72547
|
+
if (!hasHorizontalOverlap) return false;
|
|
72548
|
+
const overlapWidth = Math.max(0, xOverlapEnd - xOverlapStart);
|
|
72549
|
+
const minWidth = Math.min(a.width, b2.width);
|
|
72550
|
+
return minWidth > 0 && overlapWidth / minWidth > HORIZONTAL_OVERLAP_THRESHOLD;
|
|
72551
|
+
};
|
|
72552
|
+
const isLargerRect = (a, b2) => {
|
|
72553
|
+
return a.width > b2.width + SIZE_EPS_PX || a.height > b2.height + SIZE_EPS_PX;
|
|
72554
|
+
};
|
|
72555
|
+
for (const group of groups) {
|
|
72556
|
+
const unique2 = [];
|
|
72557
|
+
for (const rect of group) {
|
|
72558
|
+
const isDuplicate = unique2.some((existing) => {
|
|
72559
|
+
const xClose = Math.abs(existing.x - rect.x) <= X_DUPLICATE_EPS_PX;
|
|
72560
|
+
const yClose = Math.abs(existing.y - rect.y) <= Y_SAME_LINE_THRESHOLD_PX;
|
|
72561
|
+
const widthClose = Math.abs(existing.width - rect.width) <= SIZE_EPS_PX;
|
|
72562
|
+
const heightClose = Math.abs(existing.height - rect.height) <= SIZE_EPS_PX;
|
|
72563
|
+
return xClose && yClose && widthClose && heightClose;
|
|
72564
|
+
});
|
|
72565
|
+
if (!isDuplicate) {
|
|
72566
|
+
unique2.push(rect);
|
|
72268
72567
|
}
|
|
72269
72568
|
}
|
|
72270
|
-
|
|
72271
|
-
|
|
72569
|
+
if (unique2.length <= 1) {
|
|
72570
|
+
result.push(...unique2);
|
|
72571
|
+
continue;
|
|
72572
|
+
}
|
|
72573
|
+
const containers = /* @__PURE__ */ new Set();
|
|
72574
|
+
for (const rect of unique2) {
|
|
72575
|
+
for (const other of unique2) {
|
|
72576
|
+
if (rect === other) continue;
|
|
72577
|
+
if (!hasSignificantOverlap(rect, other)) continue;
|
|
72578
|
+
if (isLargerRect(rect, other)) {
|
|
72579
|
+
containers.add(rect);
|
|
72580
|
+
break;
|
|
72581
|
+
}
|
|
72582
|
+
}
|
|
72583
|
+
}
|
|
72584
|
+
const filtered = unique2.filter((rect) => !containers.has(rect));
|
|
72585
|
+
result.push(...filtered.length > 0 ? filtered : unique2);
|
|
72272
72586
|
}
|
|
72273
72587
|
return result;
|
|
72274
72588
|
}
|
|
@@ -72392,10 +72706,11 @@ function safeCleanup(fn2, context) {
|
|
|
72392
72706
|
function createHiddenHost(doc2, widthPx) {
|
|
72393
72707
|
const host = doc2.createElement("div");
|
|
72394
72708
|
host.className = "presentation-editor__hidden-host";
|
|
72395
|
-
host.style.position = "
|
|
72709
|
+
host.style.position = "fixed";
|
|
72396
72710
|
host.style.left = "-9999px";
|
|
72397
72711
|
host.style.top = "0";
|
|
72398
72712
|
host.style.width = `${widthPx}px`;
|
|
72713
|
+
host.style.setProperty("overflow-anchor", "none");
|
|
72399
72714
|
host.style.pointerEvents = "none";
|
|
72400
72715
|
host.style.opacity = "0";
|
|
72401
72716
|
host.style.zIndex = "-1";
|
|
@@ -72869,7 +73184,8 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
72869
73184
|
});
|
|
72870
73185
|
let hitChain = [];
|
|
72871
73186
|
const doc2 = document;
|
|
72872
|
-
|
|
73187
|
+
const hasElementsFromPoint = typeof doc2.elementsFromPoint === "function";
|
|
73188
|
+
if (hasElementsFromPoint) {
|
|
72873
73189
|
try {
|
|
72874
73190
|
hitChain = doc2.elementsFromPoint(viewX, viewY) ?? [];
|
|
72875
73191
|
} catch {
|
|
@@ -72915,11 +73231,14 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
72915
73231
|
log("All fragments on page:", JSON.stringify(fragmentData, null, 2));
|
|
72916
73232
|
const fragmentEl = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.fragment));
|
|
72917
73233
|
if (!fragmentEl) {
|
|
73234
|
+
if (hasElementsFromPoint) {
|
|
73235
|
+
return null;
|
|
73236
|
+
}
|
|
72918
73237
|
const fallbackFragment = pageEl.querySelector(`.${CLASS_NAMES.fragment}`);
|
|
72919
73238
|
if (!fallbackFragment) {
|
|
72920
73239
|
return null;
|
|
72921
73240
|
}
|
|
72922
|
-
log("Using fallback fragment:", {
|
|
73241
|
+
log("Using fallback fragment (no elementsFromPoint):", {
|
|
72923
73242
|
blockId: fallbackFragment.dataset.blockId,
|
|
72924
73243
|
pmStart: fallbackFragment.dataset.pmStart,
|
|
72925
73244
|
pmEnd: fallbackFragment.dataset.pmEnd
|
|
@@ -91726,7 +92045,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91726
92045
|
}
|
|
91727
92046
|
}
|
|
91728
92047
|
}
|
|
91729
|
-
editorDom2.focus(
|
|
92048
|
+
editorDom2.focus();
|
|
91730
92049
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91731
92050
|
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
91732
92051
|
return;
|
|
@@ -91793,7 +92112,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91793
92112
|
}
|
|
91794
92113
|
}
|
|
91795
92114
|
}
|
|
91796
|
-
editorDom2.focus(
|
|
92115
|
+
editorDom2.focus();
|
|
91797
92116
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91798
92117
|
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
91799
92118
|
}
|
|
@@ -91916,7 +92235,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91916
92235
|
}
|
|
91917
92236
|
const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
|
|
91918
92237
|
if (editorDom2) {
|
|
91919
|
-
editorDom2.focus(
|
|
92238
|
+
editorDom2.focus();
|
|
91920
92239
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91921
92240
|
}
|
|
91922
92241
|
return;
|
|
@@ -91949,6 +92268,25 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91949
92268
|
} else {
|
|
91950
92269
|
__privateSet(this, _dragExtensionMode, "char");
|
|
91951
92270
|
}
|
|
92271
|
+
debugLog(
|
|
92272
|
+
"verbose",
|
|
92273
|
+
`Drag selection start ${JSON.stringify({
|
|
92274
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: x2, y: y2 },
|
|
92275
|
+
clickDepth,
|
|
92276
|
+
extensionMode: __privateGet$1(this, _dragExtensionMode),
|
|
92277
|
+
anchor: __privateGet$1(this, _dragAnchor),
|
|
92278
|
+
anchorPageIndex: __privateGet$1(this, _dragAnchorPageIndex),
|
|
92279
|
+
rawHit: rawHit ? {
|
|
92280
|
+
pos: rawHit.pos,
|
|
92281
|
+
pageIndex: rawHit.pageIndex,
|
|
92282
|
+
blockId: rawHit.blockId,
|
|
92283
|
+
lineIndex: rawHit.lineIndex,
|
|
92284
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
92285
|
+
} : null,
|
|
92286
|
+
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,
|
|
92287
|
+
hit: hit ? { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch } : null
|
|
92288
|
+
})}`
|
|
92289
|
+
);
|
|
91952
92290
|
if (typeof __privateGet$1(this, _viewportHost).setPointerCapture === "function") {
|
|
91953
92291
|
__privateGet$1(this, _viewportHost).setPointerCapture(event.pointerId);
|
|
91954
92292
|
}
|
|
@@ -91976,7 +92314,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91976
92314
|
if (!editorDom) {
|
|
91977
92315
|
return;
|
|
91978
92316
|
}
|
|
91979
|
-
editorDom.focus(
|
|
92317
|
+
editorDom.focus();
|
|
91980
92318
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91981
92319
|
});
|
|
91982
92320
|
__privateAdd$1(this, _handlePointerMove, (event) => {
|
|
@@ -91985,6 +92323,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91985
92323
|
if (!normalized) return;
|
|
91986
92324
|
if (__privateGet$1(this, _isDragging) && __privateGet$1(this, _dragAnchor) !== null && event.buttons & 1) {
|
|
91987
92325
|
__privateSet(this, _pendingMarginClick, null);
|
|
92326
|
+
const prevPointer = __privateGet$1(this, _dragLastPointer);
|
|
92327
|
+
const prevRawHit = __privateGet$1(this, _dragLastRawHit);
|
|
91988
92328
|
__privateSet(this, _dragLastPointer, { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y });
|
|
91989
92329
|
const rawHit = clickToPosition(
|
|
91990
92330
|
__privateGet$1(this, _layoutState).layout,
|
|
@@ -91996,7 +92336,17 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91996
92336
|
event.clientY,
|
|
91997
92337
|
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
91998
92338
|
);
|
|
91999
|
-
if (!rawHit)
|
|
92339
|
+
if (!rawHit) {
|
|
92340
|
+
debugLog(
|
|
92341
|
+
"verbose",
|
|
92342
|
+
`Drag selection update (no hit) ${JSON.stringify({
|
|
92343
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
92344
|
+
prevPointer,
|
|
92345
|
+
anchor: __privateGet$1(this, _dragAnchor)
|
|
92346
|
+
})}`
|
|
92347
|
+
);
|
|
92348
|
+
return;
|
|
92349
|
+
}
|
|
92000
92350
|
const doc22 = __privateGet$1(this, _editor3).state?.doc;
|
|
92001
92351
|
if (!doc22) return;
|
|
92002
92352
|
__privateSet(this, _dragLastRawHit, rawHit);
|
|
@@ -92009,6 +92359,27 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92009
92359
|
const mappedHead = __privateGet$1(this, _epochMapper).mapPosFromLayoutToCurrentDetailed(rawHit.pos, rawHit.layoutEpoch, 1);
|
|
92010
92360
|
if (!mappedHead.ok) {
|
|
92011
92361
|
debugLog("warn", "drag mapping failed", mappedHead);
|
|
92362
|
+
debugLog(
|
|
92363
|
+
"verbose",
|
|
92364
|
+
`Drag selection update (map failed) ${JSON.stringify({
|
|
92365
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
92366
|
+
prevPointer,
|
|
92367
|
+
anchor: __privateGet$1(this, _dragAnchor),
|
|
92368
|
+
rawHit: {
|
|
92369
|
+
pos: rawHit.pos,
|
|
92370
|
+
pageIndex: rawHit.pageIndex,
|
|
92371
|
+
blockId: rawHit.blockId,
|
|
92372
|
+
lineIndex: rawHit.lineIndex,
|
|
92373
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
92374
|
+
},
|
|
92375
|
+
mapped: {
|
|
92376
|
+
ok: false,
|
|
92377
|
+
reason: mappedHead.reason,
|
|
92378
|
+
fromEpoch: mappedHead.fromEpoch,
|
|
92379
|
+
toEpoch: mappedHead.toEpoch
|
|
92380
|
+
}
|
|
92381
|
+
})}`
|
|
92382
|
+
);
|
|
92012
92383
|
return;
|
|
92013
92384
|
}
|
|
92014
92385
|
const hit = {
|
|
@@ -92023,6 +92394,41 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92023
92394
|
mappedPos: hit.pos
|
|
92024
92395
|
});
|
|
92025
92396
|
__privateMethod$1(this, _PresentationEditor_instances, updateSelectionDebugHud_fn).call(this);
|
|
92397
|
+
const anchor = __privateGet$1(this, _dragAnchor);
|
|
92398
|
+
const head = hit.pos;
|
|
92399
|
+
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
92400
|
+
debugLog(
|
|
92401
|
+
"verbose",
|
|
92402
|
+
`Drag selection update ${JSON.stringify({
|
|
92403
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
92404
|
+
prevPointer,
|
|
92405
|
+
rawHit: {
|
|
92406
|
+
pos: rawHit.pos,
|
|
92407
|
+
pageIndex: rawHit.pageIndex,
|
|
92408
|
+
blockId: rawHit.blockId,
|
|
92409
|
+
lineIndex: rawHit.lineIndex,
|
|
92410
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
92411
|
+
},
|
|
92412
|
+
prevRawHit: prevRawHit ? {
|
|
92413
|
+
pos: prevRawHit.pos,
|
|
92414
|
+
pageIndex: prevRawHit.pageIndex,
|
|
92415
|
+
blockId: prevRawHit.blockId,
|
|
92416
|
+
lineIndex: prevRawHit.lineIndex,
|
|
92417
|
+
layoutEpoch: prevRawHit.layoutEpoch
|
|
92418
|
+
} : null,
|
|
92419
|
+
mappedHead: { pos: mappedHead.pos, fromEpoch: mappedHead.fromEpoch, toEpoch: mappedHead.toEpoch },
|
|
92420
|
+
hit: { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch },
|
|
92421
|
+
anchor,
|
|
92422
|
+
head,
|
|
92423
|
+
selAnchor,
|
|
92424
|
+
selHead,
|
|
92425
|
+
direction: head >= anchor ? "down" : "up",
|
|
92426
|
+
selectionDirection: selHead >= selAnchor ? "down" : "up",
|
|
92427
|
+
extensionMode: __privateGet$1(this, _dragExtensionMode),
|
|
92428
|
+
hitSource: pageMounted ? "dom" : "geometry",
|
|
92429
|
+
pageMounted
|
|
92430
|
+
})}`
|
|
92431
|
+
);
|
|
92026
92432
|
const currentTableHit = __privateMethod$1(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
|
|
92027
92433
|
const shouldUseCellSel = __privateMethod$1(this, _PresentationEditor_instances, shouldUseCellSelection_fn).call(this, currentTableHit);
|
|
92028
92434
|
if (shouldUseCellSel && __privateGet$1(this, _cellAnchor)) {
|
|
@@ -92057,9 +92463,6 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92057
92463
|
return;
|
|
92058
92464
|
}
|
|
92059
92465
|
}
|
|
92060
|
-
const anchor = __privateGet$1(this, _dragAnchor);
|
|
92061
|
-
const head = hit.pos;
|
|
92062
|
-
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
92063
92466
|
try {
|
|
92064
92467
|
const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
|
|
92065
92468
|
__privateGet$1(this, _editor3).view?.dispatch(tr);
|
|
@@ -92454,6 +92857,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92454
92857
|
editorProps: normalizedEditorProps,
|
|
92455
92858
|
documentMode: __privateGet$1(this, _documentMode)
|
|
92456
92859
|
}));
|
|
92860
|
+
__privateMethod$1(this, _PresentationEditor_instances, wrapHiddenEditorFocus_fn).call(this);
|
|
92457
92861
|
__privateGet$1(this, _editor3).presentationEditor = this;
|
|
92458
92862
|
__privateGet$1(this, _editor3)._presentationEditor = this;
|
|
92459
92863
|
__privateMethod$1(this, _PresentationEditor_instances, syncHiddenEditorA11yAttributes_fn).call(this);
|
|
@@ -93653,6 +94057,65 @@ _scrollTimeout = /* @__PURE__ */ new WeakMap();
|
|
|
93653
94057
|
_lastRemoteCursorRenderTime = /* @__PURE__ */ new WeakMap();
|
|
93654
94058
|
_remoteCursorThrottleTimeout = /* @__PURE__ */ new WeakMap();
|
|
93655
94059
|
_PresentationEditor_instances = /* @__PURE__ */ new WeakSet();
|
|
94060
|
+
wrapHiddenEditorFocus_fn = function() {
|
|
94061
|
+
const view = __privateGet$1(this, _editor3)?.view;
|
|
94062
|
+
if (!view || !view.dom || typeof view.focus !== "function") {
|
|
94063
|
+
return;
|
|
94064
|
+
}
|
|
94065
|
+
const viewWithFlag = view;
|
|
94066
|
+
if (viewWithFlag.__sdPreventScrollFocus) {
|
|
94067
|
+
return;
|
|
94068
|
+
}
|
|
94069
|
+
const focusFn = view.focus;
|
|
94070
|
+
if (focusFn.mock) {
|
|
94071
|
+
return;
|
|
94072
|
+
}
|
|
94073
|
+
viewWithFlag.__sdPreventScrollFocus = true;
|
|
94074
|
+
const originalFocus = view.focus.bind(view);
|
|
94075
|
+
view.focus = () => {
|
|
94076
|
+
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView;
|
|
94077
|
+
if (!win) {
|
|
94078
|
+
originalFocus();
|
|
94079
|
+
return;
|
|
94080
|
+
}
|
|
94081
|
+
const beforeX = win.scrollX;
|
|
94082
|
+
const beforeY = win.scrollY;
|
|
94083
|
+
let focused = false;
|
|
94084
|
+
try {
|
|
94085
|
+
view.dom.focus({ preventScroll: true });
|
|
94086
|
+
focused = true;
|
|
94087
|
+
} catch (error) {
|
|
94088
|
+
debugLog("warn", "Hidden editor focus: preventScroll failed", {
|
|
94089
|
+
error: String(error),
|
|
94090
|
+
strategy: "preventScroll"
|
|
94091
|
+
});
|
|
94092
|
+
}
|
|
94093
|
+
if (!focused) {
|
|
94094
|
+
try {
|
|
94095
|
+
view.dom.focus();
|
|
94096
|
+
focused = true;
|
|
94097
|
+
} catch (error) {
|
|
94098
|
+
debugLog("warn", "Hidden editor focus: standard focus failed", {
|
|
94099
|
+
error: String(error),
|
|
94100
|
+
strategy: "standard"
|
|
94101
|
+
});
|
|
94102
|
+
}
|
|
94103
|
+
}
|
|
94104
|
+
if (!focused) {
|
|
94105
|
+
try {
|
|
94106
|
+
originalFocus();
|
|
94107
|
+
} catch (error) {
|
|
94108
|
+
debugLog("error", "Hidden editor focus: all strategies failed", {
|
|
94109
|
+
error: String(error),
|
|
94110
|
+
strategy: "original"
|
|
94111
|
+
});
|
|
94112
|
+
}
|
|
94113
|
+
}
|
|
94114
|
+
if (win.scrollX !== beforeX || win.scrollY !== beforeY) {
|
|
94115
|
+
win.scrollTo(beforeX, beforeY);
|
|
94116
|
+
}
|
|
94117
|
+
};
|
|
94118
|
+
};
|
|
93656
94119
|
collectCommentPositions_fn = function() {
|
|
93657
94120
|
return collectCommentPositions(__privateGet$1(this, _editor3)?.state?.doc ?? null, {
|
|
93658
94121
|
commentMarkName: CommentMarkName,
|
|
@@ -94054,7 +94517,7 @@ focusEditorAfterImageSelection_fn = function() {
|
|
|
94054
94517
|
}
|
|
94055
94518
|
const editorDom = __privateGet$1(this, _editor3).view?.dom;
|
|
94056
94519
|
if (editorDom) {
|
|
94057
|
-
editorDom.focus(
|
|
94520
|
+
editorDom.focus();
|
|
94058
94521
|
__privateGet$1(this, _editor3).view?.focus();
|
|
94059
94522
|
}
|
|
94060
94523
|
};
|