@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
|
@@ -42410,7 +42410,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42410
42410
|
static getStoredSuperdocVersion(docx) {
|
|
42411
42411
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42412
42412
|
}
|
|
42413
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.
|
|
42413
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.12") {
|
|
42414
42414
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42415
42415
|
}
|
|
42416
42416
|
/**
|
|
@@ -45722,7 +45722,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
45722
45722
|
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);
|
|
45723
45723
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
45724
45724
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
45725
|
-
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;
|
|
45725
|
+
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;
|
|
45726
45726
|
var GOOD_LEAF_SIZE = 200;
|
|
45727
45727
|
var RopeSequence = function RopeSequence2() {
|
|
45728
45728
|
};
|
|
@@ -59640,7 +59640,7 @@ const isHeadless = (editor) => {
|
|
|
59640
59640
|
const shouldSkipNodeView = (editor) => {
|
|
59641
59641
|
return isHeadless(editor);
|
|
59642
59642
|
};
|
|
59643
|
-
const summaryVersion = "1.0.0-next.
|
|
59643
|
+
const summaryVersion = "1.0.0-next.12";
|
|
59644
59644
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59645
59645
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59646
59646
|
function mapAttributes(attrs) {
|
|
@@ -60429,7 +60429,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60429
60429
|
{ default: remarkStringify },
|
|
60430
60430
|
{ default: remarkGfm }
|
|
60431
60431
|
] = await Promise.all([
|
|
60432
|
-
import("./index-
|
|
60432
|
+
import("./index-lMJbwm6b-l7bjUagi.es.js"),
|
|
60433
60433
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
60434
60434
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
60435
60435
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -60634,7 +60634,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60634
60634
|
* Process collaboration migrations
|
|
60635
60635
|
*/
|
|
60636
60636
|
processCollaborationMigrations() {
|
|
60637
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.
|
|
60637
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.12");
|
|
60638
60638
|
if (!this.options.ydoc) return;
|
|
60639
60639
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60640
60640
|
let docVersion = metaMap.get("version");
|
|
@@ -71633,6 +71633,86 @@ const createDomPainter = (options) => {
|
|
|
71633
71633
|
}
|
|
71634
71634
|
};
|
|
71635
71635
|
};
|
|
71636
|
+
const DEFAULT_CONFIG = {
|
|
71637
|
+
logLevel: "off",
|
|
71638
|
+
hud: false,
|
|
71639
|
+
dumpRects: false,
|
|
71640
|
+
disableRectDedupe: false
|
|
71641
|
+
};
|
|
71642
|
+
const levelOrder = {
|
|
71643
|
+
error: 0,
|
|
71644
|
+
warn: 1,
|
|
71645
|
+
info: 2,
|
|
71646
|
+
verbose: 3
|
|
71647
|
+
};
|
|
71648
|
+
function getSelectionDebugConfig() {
|
|
71649
|
+
var _a2;
|
|
71650
|
+
if (typeof window === "undefined") {
|
|
71651
|
+
return DEFAULT_CONFIG;
|
|
71652
|
+
}
|
|
71653
|
+
window.superdocDebug ?? (window.superdocDebug = {});
|
|
71654
|
+
(_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
|
|
71655
|
+
const cfg = window.superdocDebug.selection;
|
|
71656
|
+
return {
|
|
71657
|
+
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
71658
|
+
hud: cfg.hud ?? DEFAULT_CONFIG.hud,
|
|
71659
|
+
dumpRects: cfg.dumpRects ?? DEFAULT_CONFIG.dumpRects,
|
|
71660
|
+
disableRectDedupe: cfg.disableRectDedupe ?? DEFAULT_CONFIG.disableRectDedupe
|
|
71661
|
+
};
|
|
71662
|
+
}
|
|
71663
|
+
function debugLog(level, message, data) {
|
|
71664
|
+
const cfg = getSelectionDebugConfig();
|
|
71665
|
+
if (cfg.logLevel === "off") return;
|
|
71666
|
+
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
71667
|
+
const prefix2 = "[Selection]";
|
|
71668
|
+
if (data) {
|
|
71669
|
+
console.log(prefix2, message, data);
|
|
71670
|
+
} else {
|
|
71671
|
+
console.log(prefix2, message);
|
|
71672
|
+
}
|
|
71673
|
+
}
|
|
71674
|
+
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
71675
|
+
function updateSelectionDebugHud(host, state2) {
|
|
71676
|
+
const cfg = getSelectionDebugConfig();
|
|
71677
|
+
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
71678
|
+
if (!doc2) return;
|
|
71679
|
+
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
71680
|
+
if (!cfg.hud) {
|
|
71681
|
+
existing?.remove();
|
|
71682
|
+
return;
|
|
71683
|
+
}
|
|
71684
|
+
const hud = existing ?? doc2.createElement("div");
|
|
71685
|
+
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
71686
|
+
hud.style.position = "absolute";
|
|
71687
|
+
hud.style.top = "8px";
|
|
71688
|
+
hud.style.left = "8px";
|
|
71689
|
+
hud.style.zIndex = "9999";
|
|
71690
|
+
hud.style.maxWidth = "420px";
|
|
71691
|
+
hud.style.padding = "6px 8px";
|
|
71692
|
+
hud.style.borderRadius = "6px";
|
|
71693
|
+
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
71694
|
+
hud.style.color = "white";
|
|
71695
|
+
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
71696
|
+
hud.style.fontSize = "12px";
|
|
71697
|
+
hud.style.lineHeight = "1.3";
|
|
71698
|
+
hud.style.pointerEvents = "none";
|
|
71699
|
+
hud.style.whiteSpace = "pre";
|
|
71700
|
+
const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
|
|
71701
|
+
const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
|
|
71702
|
+
const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
|
|
71703
|
+
state2.lastPointer.y
|
|
71704
|
+
)}` : "null";
|
|
71705
|
+
const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
|
|
71706
|
+
hud.textContent = [
|
|
71707
|
+
`docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
|
|
71708
|
+
`selection=${selectionText}`,
|
|
71709
|
+
`pointer=${pointerText}`,
|
|
71710
|
+
`hit=${hitText}`
|
|
71711
|
+
].join("\n");
|
|
71712
|
+
if (!existing) {
|
|
71713
|
+
host.appendChild(hud);
|
|
71714
|
+
}
|
|
71715
|
+
}
|
|
71636
71716
|
class DomPositionIndex {
|
|
71637
71717
|
constructor() {
|
|
71638
71718
|
__privateAdd$1(this, _entries, []);
|
|
@@ -71689,6 +71769,7 @@ class DomPositionIndex {
|
|
|
71689
71769
|
}
|
|
71690
71770
|
for (const node of pmNodes) {
|
|
71691
71771
|
if (node.classList.contains(DOM_CLASS_NAMES.INLINE_SDT_WRAPPER)) continue;
|
|
71772
|
+
if (node.closest(".superdoc-page-header, .superdoc-page-footer")) continue;
|
|
71692
71773
|
if (leafOnly && nonLeaf.has(node)) continue;
|
|
71693
71774
|
const pmStart = Number(node.dataset.pmStart ?? "NaN");
|
|
71694
71775
|
const pmEnd = Number(node.dataset.pmEnd ?? "NaN");
|
|
@@ -71698,6 +71779,60 @@ class DomPositionIndex {
|
|
|
71698
71779
|
}
|
|
71699
71780
|
entries.sort((a, b2) => a.pmStart - b2.pmStart !== 0 ? a.pmStart - b2.pmStart : a.pmEnd - b2.pmEnd);
|
|
71700
71781
|
__privateSet(this, _entries, entries);
|
|
71782
|
+
const isVerbose = getSelectionDebugConfig().logLevel === "verbose";
|
|
71783
|
+
if (isVerbose) {
|
|
71784
|
+
const counts = { total: entries.length, body: 0, header: 0, footer: 0 };
|
|
71785
|
+
const bodySamples = [];
|
|
71786
|
+
const headerSamples = [];
|
|
71787
|
+
const footerSamples = [];
|
|
71788
|
+
for (const entry of entries) {
|
|
71789
|
+
const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
|
|
71790
|
+
const pageIndex = pageEl?.dataset.pageIndex ?? null;
|
|
71791
|
+
const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
|
|
71792
|
+
if (section === "header") {
|
|
71793
|
+
counts.header += 1;
|
|
71794
|
+
if (headerSamples.length < 10) {
|
|
71795
|
+
headerSamples.push({
|
|
71796
|
+
pmStart: entry.pmStart,
|
|
71797
|
+
pmEnd: entry.pmEnd,
|
|
71798
|
+
pageIndex,
|
|
71799
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
71800
|
+
});
|
|
71801
|
+
}
|
|
71802
|
+
continue;
|
|
71803
|
+
}
|
|
71804
|
+
if (section === "footer") {
|
|
71805
|
+
counts.footer += 1;
|
|
71806
|
+
if (footerSamples.length < 10) {
|
|
71807
|
+
footerSamples.push({
|
|
71808
|
+
pmStart: entry.pmStart,
|
|
71809
|
+
pmEnd: entry.pmEnd,
|
|
71810
|
+
pageIndex,
|
|
71811
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
71812
|
+
});
|
|
71813
|
+
}
|
|
71814
|
+
continue;
|
|
71815
|
+
}
|
|
71816
|
+
counts.body += 1;
|
|
71817
|
+
if (bodySamples.length < 10) {
|
|
71818
|
+
bodySamples.push({
|
|
71819
|
+
pmStart: entry.pmStart,
|
|
71820
|
+
pmEnd: entry.pmEnd,
|
|
71821
|
+
pageIndex,
|
|
71822
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
71823
|
+
});
|
|
71824
|
+
}
|
|
71825
|
+
}
|
|
71826
|
+
debugLog(
|
|
71827
|
+
"verbose",
|
|
71828
|
+
`DomPositionIndex: rebuild summary ${JSON.stringify({
|
|
71829
|
+
counts,
|
|
71830
|
+
bodySamples,
|
|
71831
|
+
headerSamples,
|
|
71832
|
+
footerSamples
|
|
71833
|
+
})}`
|
|
71834
|
+
);
|
|
71835
|
+
}
|
|
71701
71836
|
}
|
|
71702
71837
|
/**
|
|
71703
71838
|
* Finds the index entry whose position range contains the given position.
|
|
@@ -71947,82 +72082,6 @@ _onRebuild = /* @__PURE__ */ new WeakMap();
|
|
|
71947
72082
|
_observer = /* @__PURE__ */ new WeakMap();
|
|
71948
72083
|
_rebuildScheduled = /* @__PURE__ */ new WeakMap();
|
|
71949
72084
|
_rebuildRafId = /* @__PURE__ */ new WeakMap();
|
|
71950
|
-
const DEFAULT_CONFIG = {
|
|
71951
|
-
logLevel: "off",
|
|
71952
|
-
hud: false
|
|
71953
|
-
};
|
|
71954
|
-
const levelOrder = {
|
|
71955
|
-
error: 0,
|
|
71956
|
-
warn: 1,
|
|
71957
|
-
info: 2,
|
|
71958
|
-
verbose: 3
|
|
71959
|
-
};
|
|
71960
|
-
function getSelectionDebugConfig() {
|
|
71961
|
-
var _a2;
|
|
71962
|
-
if (typeof window === "undefined") {
|
|
71963
|
-
return DEFAULT_CONFIG;
|
|
71964
|
-
}
|
|
71965
|
-
window.superdocDebug ?? (window.superdocDebug = {});
|
|
71966
|
-
(_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
|
|
71967
|
-
const cfg = window.superdocDebug.selection;
|
|
71968
|
-
return {
|
|
71969
|
-
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
71970
|
-
hud: cfg.hud ?? DEFAULT_CONFIG.hud
|
|
71971
|
-
};
|
|
71972
|
-
}
|
|
71973
|
-
function debugLog(level, message, data) {
|
|
71974
|
-
const cfg = getSelectionDebugConfig();
|
|
71975
|
-
if (cfg.logLevel === "off") return;
|
|
71976
|
-
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
71977
|
-
const prefix2 = "[Selection]";
|
|
71978
|
-
if (data) {
|
|
71979
|
-
console.log(prefix2, message, data);
|
|
71980
|
-
} else {
|
|
71981
|
-
console.log(prefix2, message);
|
|
71982
|
-
}
|
|
71983
|
-
}
|
|
71984
|
-
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
71985
|
-
function updateSelectionDebugHud(host, state2) {
|
|
71986
|
-
const cfg = getSelectionDebugConfig();
|
|
71987
|
-
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
71988
|
-
if (!doc2) return;
|
|
71989
|
-
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
71990
|
-
if (!cfg.hud) {
|
|
71991
|
-
existing?.remove();
|
|
71992
|
-
return;
|
|
71993
|
-
}
|
|
71994
|
-
const hud = existing ?? doc2.createElement("div");
|
|
71995
|
-
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
71996
|
-
hud.style.position = "absolute";
|
|
71997
|
-
hud.style.top = "8px";
|
|
71998
|
-
hud.style.left = "8px";
|
|
71999
|
-
hud.style.zIndex = "9999";
|
|
72000
|
-
hud.style.maxWidth = "420px";
|
|
72001
|
-
hud.style.padding = "6px 8px";
|
|
72002
|
-
hud.style.borderRadius = "6px";
|
|
72003
|
-
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
72004
|
-
hud.style.color = "white";
|
|
72005
|
-
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
72006
|
-
hud.style.fontSize = "12px";
|
|
72007
|
-
hud.style.lineHeight = "1.3";
|
|
72008
|
-
hud.style.pointerEvents = "none";
|
|
72009
|
-
hud.style.whiteSpace = "pre";
|
|
72010
|
-
const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
|
|
72011
|
-
const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
|
|
72012
|
-
const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
|
|
72013
|
-
state2.lastPointer.y
|
|
72014
|
-
)}` : "null";
|
|
72015
|
-
const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
|
|
72016
|
-
hud.textContent = [
|
|
72017
|
-
`docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
|
|
72018
|
-
`selection=${selectionText}`,
|
|
72019
|
-
`pointer=${pointerText}`,
|
|
72020
|
-
`hit=${hitText}`
|
|
72021
|
-
].join("\n");
|
|
72022
|
-
if (!existing) {
|
|
72023
|
-
host.appendChild(hud);
|
|
72024
|
-
}
|
|
72025
|
-
}
|
|
72026
72085
|
function computeSelectionRectsFromDom(options, from2, to) {
|
|
72027
72086
|
const painterHost = options.painterHost;
|
|
72028
72087
|
if (!painterHost) return null;
|
|
@@ -72043,6 +72102,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72043
72102
|
);
|
|
72044
72103
|
const out = [];
|
|
72045
72104
|
let rebuiltOnce = false;
|
|
72105
|
+
const debugConfig = getSelectionDebugConfig();
|
|
72106
|
+
const isVerbose = debugConfig.logLevel === "verbose";
|
|
72107
|
+
const dumpRects = isVerbose && debugConfig.dumpRects;
|
|
72108
|
+
const disableRectDedupe = debugConfig.disableRectDedupe;
|
|
72109
|
+
const entryDebugInfo = (entry) => {
|
|
72110
|
+
const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
|
|
72111
|
+
const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
|
|
72112
|
+
return {
|
|
72113
|
+
pmStart: entry.pmStart,
|
|
72114
|
+
pmEnd: entry.pmEnd,
|
|
72115
|
+
pageIndex: pageEl?.dataset.pageIndex ?? null,
|
|
72116
|
+
section,
|
|
72117
|
+
connected: entry.el.isConnected,
|
|
72118
|
+
layoutEpoch: entry.el.dataset.layoutEpoch ?? null,
|
|
72119
|
+
pageEpoch: pageEl?.dataset.layoutEpoch ?? null,
|
|
72120
|
+
text: (entry.el.textContent ?? "").slice(0, 80)
|
|
72121
|
+
};
|
|
72122
|
+
};
|
|
72123
|
+
const rectDebugInfo = (rect) => ({
|
|
72124
|
+
x: rect.x,
|
|
72125
|
+
y: rect.y,
|
|
72126
|
+
width: rect.width,
|
|
72127
|
+
height: rect.height,
|
|
72128
|
+
top: rect.top,
|
|
72129
|
+
left: rect.left,
|
|
72130
|
+
right: rect.right,
|
|
72131
|
+
bottom: rect.bottom
|
|
72132
|
+
});
|
|
72046
72133
|
for (const pageEl of pageEls) {
|
|
72047
72134
|
const pageIndex = Number(pageEl.dataset.pageIndex ?? "NaN");
|
|
72048
72135
|
if (!Number.isFinite(pageIndex)) continue;
|
|
@@ -72066,9 +72153,47 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72066
72153
|
if (sliceEntries.length === 0) {
|
|
72067
72154
|
continue;
|
|
72068
72155
|
}
|
|
72156
|
+
if (isVerbose) {
|
|
72157
|
+
debugLog(
|
|
72158
|
+
"verbose",
|
|
72159
|
+
`DOM selection rects: slice entries ${JSON.stringify({
|
|
72160
|
+
pageIndex,
|
|
72161
|
+
sliceFrom,
|
|
72162
|
+
sliceTo,
|
|
72163
|
+
entriesCount: sliceEntries.length,
|
|
72164
|
+
entriesPreview: sliceEntries.slice(0, 20).map(entryDebugInfo)
|
|
72165
|
+
})}`
|
|
72166
|
+
);
|
|
72167
|
+
}
|
|
72069
72168
|
let startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
72070
72169
|
let endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
72071
|
-
if (
|
|
72170
|
+
if (isVerbose) {
|
|
72171
|
+
debugLog(
|
|
72172
|
+
"verbose",
|
|
72173
|
+
`DOM selection rects: boundaries ${JSON.stringify({
|
|
72174
|
+
pageIndex,
|
|
72175
|
+
sliceFrom,
|
|
72176
|
+
sliceTo,
|
|
72177
|
+
start: entryDebugInfo(startEntry),
|
|
72178
|
+
end: entryDebugInfo(endEntry)
|
|
72179
|
+
})}`
|
|
72180
|
+
);
|
|
72181
|
+
}
|
|
72182
|
+
let startContained = pageEl.contains(startEntry.el);
|
|
72183
|
+
let endContained = pageEl.contains(endEntry.el);
|
|
72184
|
+
if (!startContained || !endContained) {
|
|
72185
|
+
if (isVerbose) {
|
|
72186
|
+
debugLog(
|
|
72187
|
+
"verbose",
|
|
72188
|
+
`DOM selection rects: boundary containment ${JSON.stringify({
|
|
72189
|
+
pageIndex,
|
|
72190
|
+
sliceFrom,
|
|
72191
|
+
sliceTo,
|
|
72192
|
+
startContained,
|
|
72193
|
+
endContained
|
|
72194
|
+
})}`
|
|
72195
|
+
);
|
|
72196
|
+
}
|
|
72072
72197
|
if (!rebuiltOnce) {
|
|
72073
72198
|
options.rebuildDomPositionIndex();
|
|
72074
72199
|
rebuiltOnce = true;
|
|
@@ -72076,9 +72201,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72076
72201
|
if (sliceEntries.length === 0) continue;
|
|
72077
72202
|
startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
72078
72203
|
endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
72204
|
+
startContained = pageEl.contains(startEntry.el);
|
|
72205
|
+
endContained = pageEl.contains(endEntry.el);
|
|
72206
|
+
if (isVerbose) {
|
|
72207
|
+
debugLog(
|
|
72208
|
+
"verbose",
|
|
72209
|
+
`DOM selection rects: boundary containment after rebuild ${JSON.stringify({
|
|
72210
|
+
pageIndex,
|
|
72211
|
+
sliceFrom,
|
|
72212
|
+
sliceTo,
|
|
72213
|
+
startContained,
|
|
72214
|
+
endContained,
|
|
72215
|
+
start: entryDebugInfo(startEntry),
|
|
72216
|
+
end: entryDebugInfo(endEntry)
|
|
72217
|
+
})}`
|
|
72218
|
+
);
|
|
72219
|
+
}
|
|
72079
72220
|
}
|
|
72080
|
-
if (!
|
|
72081
|
-
debugLog(
|
|
72221
|
+
if (!startContained || !endContained) {
|
|
72222
|
+
debugLog(
|
|
72223
|
+
"warn",
|
|
72224
|
+
`DOM selection rects: stale index after rebuild ${JSON.stringify({
|
|
72225
|
+
pageIndex,
|
|
72226
|
+
sliceFrom,
|
|
72227
|
+
sliceTo,
|
|
72228
|
+
start: entryDebugInfo(startEntry),
|
|
72229
|
+
end: entryDebugInfo(endEntry)
|
|
72230
|
+
})}`
|
|
72231
|
+
);
|
|
72082
72232
|
return null;
|
|
72083
72233
|
}
|
|
72084
72234
|
}
|
|
@@ -72093,8 +72243,83 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72093
72243
|
}
|
|
72094
72244
|
let clientRects = [];
|
|
72095
72245
|
try {
|
|
72096
|
-
|
|
72097
|
-
|
|
72246
|
+
let rawRects = Array.from(range2.getClientRects());
|
|
72247
|
+
if (dumpRects) {
|
|
72248
|
+
debugLog(
|
|
72249
|
+
"verbose",
|
|
72250
|
+
`DOM selection rects: raw rects ${JSON.stringify({
|
|
72251
|
+
pageIndex,
|
|
72252
|
+
sliceFrom,
|
|
72253
|
+
sliceTo,
|
|
72254
|
+
rects: rawRects.map(rectDebugInfo)
|
|
72255
|
+
})}`
|
|
72256
|
+
);
|
|
72257
|
+
}
|
|
72258
|
+
let missingEntries = null;
|
|
72259
|
+
if (typeof range2.intersectsNode === "function") {
|
|
72260
|
+
for (const entry of sliceEntries) {
|
|
72261
|
+
try {
|
|
72262
|
+
if (!range2.intersectsNode(entry.el)) {
|
|
72263
|
+
missingEntries ?? (missingEntries = []);
|
|
72264
|
+
missingEntries.push(entry);
|
|
72265
|
+
}
|
|
72266
|
+
} catch {
|
|
72267
|
+
}
|
|
72268
|
+
}
|
|
72269
|
+
}
|
|
72270
|
+
if (missingEntries && missingEntries.length > 0) {
|
|
72271
|
+
if (isVerbose) {
|
|
72272
|
+
debugLog(
|
|
72273
|
+
"verbose",
|
|
72274
|
+
`DOM selection rects: range missing entries ${JSON.stringify({
|
|
72275
|
+
pageIndex,
|
|
72276
|
+
sliceFrom,
|
|
72277
|
+
sliceTo,
|
|
72278
|
+
missingCount: missingEntries.length,
|
|
72279
|
+
missingPreview: missingEntries.slice(0, 20).map(entryDebugInfo)
|
|
72280
|
+
})}`
|
|
72281
|
+
);
|
|
72282
|
+
}
|
|
72283
|
+
rawRects = collectClientRectsByLine(doc2, sliceEntries, sliceFrom, sliceTo);
|
|
72284
|
+
if (dumpRects) {
|
|
72285
|
+
debugLog(
|
|
72286
|
+
"verbose",
|
|
72287
|
+
`DOM selection rects: fallback raw rects ${JSON.stringify({
|
|
72288
|
+
pageIndex,
|
|
72289
|
+
sliceFrom,
|
|
72290
|
+
sliceTo,
|
|
72291
|
+
rects: rawRects.map(rectDebugInfo)
|
|
72292
|
+
})}`
|
|
72293
|
+
);
|
|
72294
|
+
}
|
|
72295
|
+
}
|
|
72296
|
+
clientRects = disableRectDedupe ? rawRects : deduplicateOverlappingRects(rawRects);
|
|
72297
|
+
if (dumpRects) {
|
|
72298
|
+
debugLog(
|
|
72299
|
+
"verbose",
|
|
72300
|
+
`DOM selection rects: final rects ${JSON.stringify({
|
|
72301
|
+
pageIndex,
|
|
72302
|
+
sliceFrom,
|
|
72303
|
+
sliceTo,
|
|
72304
|
+
dedupeDisabled: disableRectDedupe,
|
|
72305
|
+
rects: clientRects.map(rectDebugInfo)
|
|
72306
|
+
})}`
|
|
72307
|
+
);
|
|
72308
|
+
const nonPositive = clientRects.filter(
|
|
72309
|
+
(rect) => !Number.isFinite(rect.width) || !Number.isFinite(rect.height) || rect.width <= 0 || rect.height <= 0
|
|
72310
|
+
);
|
|
72311
|
+
if (nonPositive.length > 0) {
|
|
72312
|
+
debugLog(
|
|
72313
|
+
"verbose",
|
|
72314
|
+
`DOM selection rects: non-positive rects ${JSON.stringify({
|
|
72315
|
+
pageIndex,
|
|
72316
|
+
sliceFrom,
|
|
72317
|
+
sliceTo,
|
|
72318
|
+
rects: nonPositive.map(rectDebugInfo)
|
|
72319
|
+
})}`
|
|
72320
|
+
);
|
|
72321
|
+
}
|
|
72322
|
+
}
|
|
72098
72323
|
} catch (error) {
|
|
72099
72324
|
debugLog("warn", "DOM selection rects: getClientRects failed", { error: String(error) });
|
|
72100
72325
|
return null;
|
|
@@ -72118,6 +72343,57 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72118
72343
|
}
|
|
72119
72344
|
return out;
|
|
72120
72345
|
}
|
|
72346
|
+
function collectClientRectsByLine(doc2, entries, sliceFrom, sliceTo) {
|
|
72347
|
+
const rects = [];
|
|
72348
|
+
const lineMap = /* @__PURE__ */ new Map();
|
|
72349
|
+
const looseEntries = [];
|
|
72350
|
+
for (const entry of entries) {
|
|
72351
|
+
const lineEl = entry.el.closest(".superdoc-line");
|
|
72352
|
+
if (!lineEl) {
|
|
72353
|
+
looseEntries.push(entry);
|
|
72354
|
+
continue;
|
|
72355
|
+
}
|
|
72356
|
+
const list = lineMap.get(lineEl);
|
|
72357
|
+
if (list) {
|
|
72358
|
+
list.push(entry);
|
|
72359
|
+
} else {
|
|
72360
|
+
lineMap.set(lineEl, [entry]);
|
|
72361
|
+
}
|
|
72362
|
+
}
|
|
72363
|
+
for (const [, lineEntries] of lineMap) {
|
|
72364
|
+
lineEntries.sort((a, b2) => a.pmStart - b2.pmStart !== 0 ? a.pmStart - b2.pmStart : a.pmEnd - b2.pmEnd);
|
|
72365
|
+
const linePmStart = lineEntries[0]?.pmStart ?? Infinity;
|
|
72366
|
+
const linePmEnd = lineEntries[lineEntries.length - 1]?.pmEnd ?? -Infinity;
|
|
72367
|
+
if (!Number.isFinite(linePmStart) || !Number.isFinite(linePmEnd) || linePmEnd <= linePmStart) continue;
|
|
72368
|
+
const lineFrom = Math.max(sliceFrom, linePmStart);
|
|
72369
|
+
const lineTo = Math.min(sliceTo, linePmEnd);
|
|
72370
|
+
if (lineFrom >= lineTo) continue;
|
|
72371
|
+
const startEntry = lineEntries.find((entry) => lineFrom >= entry.pmStart && lineFrom <= entry.pmEnd) ?? lineEntries[0];
|
|
72372
|
+
const endEntry = lineEntries.find((entry) => lineTo >= entry.pmStart && lineTo <= entry.pmEnd) ?? lineEntries[lineEntries.length - 1];
|
|
72373
|
+
const range2 = doc2.createRange();
|
|
72374
|
+
try {
|
|
72375
|
+
if (!setDomRangeStart(range2, startEntry, lineFrom)) continue;
|
|
72376
|
+
if (!setDomRangeEnd(range2, endEntry, lineTo)) continue;
|
|
72377
|
+
} catch {
|
|
72378
|
+
continue;
|
|
72379
|
+
}
|
|
72380
|
+
rects.push(...Array.from(range2.getClientRects()));
|
|
72381
|
+
}
|
|
72382
|
+
for (const entry of looseEntries) {
|
|
72383
|
+
const entryFrom = Math.max(sliceFrom, entry.pmStart);
|
|
72384
|
+
const entryTo = Math.min(sliceTo, entry.pmEnd);
|
|
72385
|
+
if (entryFrom >= entryTo) continue;
|
|
72386
|
+
const range2 = doc2.createRange();
|
|
72387
|
+
try {
|
|
72388
|
+
if (!setDomRangeStart(range2, entry, entryFrom)) continue;
|
|
72389
|
+
if (!setDomRangeEnd(range2, entry, entryTo)) continue;
|
|
72390
|
+
} catch {
|
|
72391
|
+
continue;
|
|
72392
|
+
}
|
|
72393
|
+
rects.push(...Array.from(range2.getClientRects()));
|
|
72394
|
+
}
|
|
72395
|
+
return rects;
|
|
72396
|
+
}
|
|
72121
72397
|
function setDomRangeStart(range2, entry, pos) {
|
|
72122
72398
|
const el = entry.el;
|
|
72123
72399
|
const pmStart = entry.pmStart;
|
|
@@ -72227,31 +72503,69 @@ function deduplicateOverlappingRects(rects) {
|
|
|
72227
72503
|
return a.x - b2.x;
|
|
72228
72504
|
});
|
|
72229
72505
|
const result = [];
|
|
72230
|
-
|
|
72231
|
-
|
|
72232
|
-
|
|
72233
|
-
|
|
72234
|
-
|
|
72235
|
-
|
|
72236
|
-
|
|
72237
|
-
|
|
72238
|
-
|
|
72239
|
-
|
|
72240
|
-
|
|
72241
|
-
|
|
72242
|
-
|
|
72243
|
-
|
|
72244
|
-
|
|
72245
|
-
|
|
72246
|
-
|
|
72247
|
-
|
|
72248
|
-
|
|
72249
|
-
|
|
72250
|
-
|
|
72506
|
+
const groups = [];
|
|
72507
|
+
let currentGroup = [];
|
|
72508
|
+
for (const rect of sorted) {
|
|
72509
|
+
if (currentGroup.length === 0) {
|
|
72510
|
+
currentGroup.push(rect);
|
|
72511
|
+
continue;
|
|
72512
|
+
}
|
|
72513
|
+
const groupY = currentGroup[0].y;
|
|
72514
|
+
if (Math.abs(rect.y - groupY) <= Y_SAME_LINE_THRESHOLD_PX) {
|
|
72515
|
+
currentGroup.push(rect);
|
|
72516
|
+
} else {
|
|
72517
|
+
groups.push(currentGroup);
|
|
72518
|
+
currentGroup = [rect];
|
|
72519
|
+
}
|
|
72520
|
+
}
|
|
72521
|
+
if (currentGroup.length > 0) {
|
|
72522
|
+
groups.push(currentGroup);
|
|
72523
|
+
}
|
|
72524
|
+
const SIZE_EPS_PX = 0.5;
|
|
72525
|
+
const X_DUPLICATE_EPS_PX = 1;
|
|
72526
|
+
const hasSignificantOverlap = (a, b2) => {
|
|
72527
|
+
const xOverlapStart = Math.max(a.x, b2.x);
|
|
72528
|
+
const xOverlapEnd = Math.min(a.x + a.width, b2.x + b2.width);
|
|
72529
|
+
const hasHorizontalOverlap = xOverlapEnd > xOverlapStart;
|
|
72530
|
+
if (!hasHorizontalOverlap) return false;
|
|
72531
|
+
const overlapWidth = Math.max(0, xOverlapEnd - xOverlapStart);
|
|
72532
|
+
const minWidth = Math.min(a.width, b2.width);
|
|
72533
|
+
return minWidth > 0 && overlapWidth / minWidth > HORIZONTAL_OVERLAP_THRESHOLD;
|
|
72534
|
+
};
|
|
72535
|
+
const isLargerRect = (a, b2) => {
|
|
72536
|
+
return a.width > b2.width + SIZE_EPS_PX || a.height > b2.height + SIZE_EPS_PX;
|
|
72537
|
+
};
|
|
72538
|
+
for (const group of groups) {
|
|
72539
|
+
const unique2 = [];
|
|
72540
|
+
for (const rect of group) {
|
|
72541
|
+
const isDuplicate = unique2.some((existing) => {
|
|
72542
|
+
const xClose = Math.abs(existing.x - rect.x) <= X_DUPLICATE_EPS_PX;
|
|
72543
|
+
const yClose = Math.abs(existing.y - rect.y) <= Y_SAME_LINE_THRESHOLD_PX;
|
|
72544
|
+
const widthClose = Math.abs(existing.width - rect.width) <= SIZE_EPS_PX;
|
|
72545
|
+
const heightClose = Math.abs(existing.height - rect.height) <= SIZE_EPS_PX;
|
|
72546
|
+
return xClose && yClose && widthClose && heightClose;
|
|
72547
|
+
});
|
|
72548
|
+
if (!isDuplicate) {
|
|
72549
|
+
unique2.push(rect);
|
|
72251
72550
|
}
|
|
72252
72551
|
}
|
|
72253
|
-
|
|
72254
|
-
|
|
72552
|
+
if (unique2.length <= 1) {
|
|
72553
|
+
result.push(...unique2);
|
|
72554
|
+
continue;
|
|
72555
|
+
}
|
|
72556
|
+
const containers = /* @__PURE__ */ new Set();
|
|
72557
|
+
for (const rect of unique2) {
|
|
72558
|
+
for (const other of unique2) {
|
|
72559
|
+
if (rect === other) continue;
|
|
72560
|
+
if (!hasSignificantOverlap(rect, other)) continue;
|
|
72561
|
+
if (isLargerRect(rect, other)) {
|
|
72562
|
+
containers.add(rect);
|
|
72563
|
+
break;
|
|
72564
|
+
}
|
|
72565
|
+
}
|
|
72566
|
+
}
|
|
72567
|
+
const filtered = unique2.filter((rect) => !containers.has(rect));
|
|
72568
|
+
result.push(...filtered.length > 0 ? filtered : unique2);
|
|
72255
72569
|
}
|
|
72256
72570
|
return result;
|
|
72257
72571
|
}
|
|
@@ -72375,10 +72689,11 @@ function safeCleanup(fn2, context) {
|
|
|
72375
72689
|
function createHiddenHost(doc2, widthPx) {
|
|
72376
72690
|
const host = doc2.createElement("div");
|
|
72377
72691
|
host.className = "presentation-editor__hidden-host";
|
|
72378
|
-
host.style.position = "
|
|
72692
|
+
host.style.position = "fixed";
|
|
72379
72693
|
host.style.left = "-9999px";
|
|
72380
72694
|
host.style.top = "0";
|
|
72381
72695
|
host.style.width = `${widthPx}px`;
|
|
72696
|
+
host.style.setProperty("overflow-anchor", "none");
|
|
72382
72697
|
host.style.pointerEvents = "none";
|
|
72383
72698
|
host.style.opacity = "0";
|
|
72384
72699
|
host.style.zIndex = "-1";
|
|
@@ -72852,7 +73167,8 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
72852
73167
|
});
|
|
72853
73168
|
let hitChain = [];
|
|
72854
73169
|
const doc2 = document;
|
|
72855
|
-
|
|
73170
|
+
const hasElementsFromPoint = typeof doc2.elementsFromPoint === "function";
|
|
73171
|
+
if (hasElementsFromPoint) {
|
|
72856
73172
|
try {
|
|
72857
73173
|
hitChain = doc2.elementsFromPoint(viewX, viewY) ?? [];
|
|
72858
73174
|
} catch {
|
|
@@ -72898,11 +73214,14 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
72898
73214
|
log("All fragments on page:", JSON.stringify(fragmentData, null, 2));
|
|
72899
73215
|
const fragmentEl = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.fragment));
|
|
72900
73216
|
if (!fragmentEl) {
|
|
73217
|
+
if (hasElementsFromPoint) {
|
|
73218
|
+
return null;
|
|
73219
|
+
}
|
|
72901
73220
|
const fallbackFragment = pageEl.querySelector(`.${CLASS_NAMES.fragment}`);
|
|
72902
73221
|
if (!fallbackFragment) {
|
|
72903
73222
|
return null;
|
|
72904
73223
|
}
|
|
72905
|
-
log("Using fallback fragment:", {
|
|
73224
|
+
log("Using fallback fragment (no elementsFromPoint):", {
|
|
72906
73225
|
blockId: fallbackFragment.dataset.blockId,
|
|
72907
73226
|
pmStart: fallbackFragment.dataset.pmStart,
|
|
72908
73227
|
pmEnd: fallbackFragment.dataset.pmEnd
|
|
@@ -91709,7 +92028,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91709
92028
|
}
|
|
91710
92029
|
}
|
|
91711
92030
|
}
|
|
91712
|
-
editorDom2.focus(
|
|
92031
|
+
editorDom2.focus();
|
|
91713
92032
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91714
92033
|
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
91715
92034
|
return;
|
|
@@ -91776,7 +92095,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91776
92095
|
}
|
|
91777
92096
|
}
|
|
91778
92097
|
}
|
|
91779
|
-
editorDom2.focus(
|
|
92098
|
+
editorDom2.focus();
|
|
91780
92099
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91781
92100
|
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
91782
92101
|
}
|
|
@@ -91899,7 +92218,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91899
92218
|
}
|
|
91900
92219
|
const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
|
|
91901
92220
|
if (editorDom2) {
|
|
91902
|
-
editorDom2.focus(
|
|
92221
|
+
editorDom2.focus();
|
|
91903
92222
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91904
92223
|
}
|
|
91905
92224
|
return;
|
|
@@ -91932,6 +92251,25 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91932
92251
|
} else {
|
|
91933
92252
|
__privateSet(this, _dragExtensionMode, "char");
|
|
91934
92253
|
}
|
|
92254
|
+
debugLog(
|
|
92255
|
+
"verbose",
|
|
92256
|
+
`Drag selection start ${JSON.stringify({
|
|
92257
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: x2, y: y2 },
|
|
92258
|
+
clickDepth,
|
|
92259
|
+
extensionMode: __privateGet$1(this, _dragExtensionMode),
|
|
92260
|
+
anchor: __privateGet$1(this, _dragAnchor),
|
|
92261
|
+
anchorPageIndex: __privateGet$1(this, _dragAnchorPageIndex),
|
|
92262
|
+
rawHit: rawHit ? {
|
|
92263
|
+
pos: rawHit.pos,
|
|
92264
|
+
pageIndex: rawHit.pageIndex,
|
|
92265
|
+
blockId: rawHit.blockId,
|
|
92266
|
+
lineIndex: rawHit.lineIndex,
|
|
92267
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
92268
|
+
} : null,
|
|
92269
|
+
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,
|
|
92270
|
+
hit: hit ? { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch } : null
|
|
92271
|
+
})}`
|
|
92272
|
+
);
|
|
91935
92273
|
if (typeof __privateGet$1(this, _viewportHost).setPointerCapture === "function") {
|
|
91936
92274
|
__privateGet$1(this, _viewportHost).setPointerCapture(event.pointerId);
|
|
91937
92275
|
}
|
|
@@ -91959,7 +92297,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91959
92297
|
if (!editorDom) {
|
|
91960
92298
|
return;
|
|
91961
92299
|
}
|
|
91962
|
-
editorDom.focus(
|
|
92300
|
+
editorDom.focus();
|
|
91963
92301
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91964
92302
|
});
|
|
91965
92303
|
__privateAdd$1(this, _handlePointerMove, (event) => {
|
|
@@ -91968,6 +92306,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91968
92306
|
if (!normalized) return;
|
|
91969
92307
|
if (__privateGet$1(this, _isDragging) && __privateGet$1(this, _dragAnchor) !== null && event.buttons & 1) {
|
|
91970
92308
|
__privateSet(this, _pendingMarginClick, null);
|
|
92309
|
+
const prevPointer = __privateGet$1(this, _dragLastPointer);
|
|
92310
|
+
const prevRawHit = __privateGet$1(this, _dragLastRawHit);
|
|
91971
92311
|
__privateSet(this, _dragLastPointer, { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y });
|
|
91972
92312
|
const rawHit = clickToPosition(
|
|
91973
92313
|
__privateGet$1(this, _layoutState).layout,
|
|
@@ -91979,7 +92319,17 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91979
92319
|
event.clientY,
|
|
91980
92320
|
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
91981
92321
|
);
|
|
91982
|
-
if (!rawHit)
|
|
92322
|
+
if (!rawHit) {
|
|
92323
|
+
debugLog(
|
|
92324
|
+
"verbose",
|
|
92325
|
+
`Drag selection update (no hit) ${JSON.stringify({
|
|
92326
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
92327
|
+
prevPointer,
|
|
92328
|
+
anchor: __privateGet$1(this, _dragAnchor)
|
|
92329
|
+
})}`
|
|
92330
|
+
);
|
|
92331
|
+
return;
|
|
92332
|
+
}
|
|
91983
92333
|
const doc22 = __privateGet$1(this, _editor3).state?.doc;
|
|
91984
92334
|
if (!doc22) return;
|
|
91985
92335
|
__privateSet(this, _dragLastRawHit, rawHit);
|
|
@@ -91992,6 +92342,27 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91992
92342
|
const mappedHead = __privateGet$1(this, _epochMapper).mapPosFromLayoutToCurrentDetailed(rawHit.pos, rawHit.layoutEpoch, 1);
|
|
91993
92343
|
if (!mappedHead.ok) {
|
|
91994
92344
|
debugLog("warn", "drag mapping failed", mappedHead);
|
|
92345
|
+
debugLog(
|
|
92346
|
+
"verbose",
|
|
92347
|
+
`Drag selection update (map failed) ${JSON.stringify({
|
|
92348
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
92349
|
+
prevPointer,
|
|
92350
|
+
anchor: __privateGet$1(this, _dragAnchor),
|
|
92351
|
+
rawHit: {
|
|
92352
|
+
pos: rawHit.pos,
|
|
92353
|
+
pageIndex: rawHit.pageIndex,
|
|
92354
|
+
blockId: rawHit.blockId,
|
|
92355
|
+
lineIndex: rawHit.lineIndex,
|
|
92356
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
92357
|
+
},
|
|
92358
|
+
mapped: {
|
|
92359
|
+
ok: false,
|
|
92360
|
+
reason: mappedHead.reason,
|
|
92361
|
+
fromEpoch: mappedHead.fromEpoch,
|
|
92362
|
+
toEpoch: mappedHead.toEpoch
|
|
92363
|
+
}
|
|
92364
|
+
})}`
|
|
92365
|
+
);
|
|
91995
92366
|
return;
|
|
91996
92367
|
}
|
|
91997
92368
|
const hit = {
|
|
@@ -92006,6 +92377,41 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92006
92377
|
mappedPos: hit.pos
|
|
92007
92378
|
});
|
|
92008
92379
|
__privateMethod$1(this, _PresentationEditor_instances, updateSelectionDebugHud_fn).call(this);
|
|
92380
|
+
const anchor = __privateGet$1(this, _dragAnchor);
|
|
92381
|
+
const head = hit.pos;
|
|
92382
|
+
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
92383
|
+
debugLog(
|
|
92384
|
+
"verbose",
|
|
92385
|
+
`Drag selection update ${JSON.stringify({
|
|
92386
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
92387
|
+
prevPointer,
|
|
92388
|
+
rawHit: {
|
|
92389
|
+
pos: rawHit.pos,
|
|
92390
|
+
pageIndex: rawHit.pageIndex,
|
|
92391
|
+
blockId: rawHit.blockId,
|
|
92392
|
+
lineIndex: rawHit.lineIndex,
|
|
92393
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
92394
|
+
},
|
|
92395
|
+
prevRawHit: prevRawHit ? {
|
|
92396
|
+
pos: prevRawHit.pos,
|
|
92397
|
+
pageIndex: prevRawHit.pageIndex,
|
|
92398
|
+
blockId: prevRawHit.blockId,
|
|
92399
|
+
lineIndex: prevRawHit.lineIndex,
|
|
92400
|
+
layoutEpoch: prevRawHit.layoutEpoch
|
|
92401
|
+
} : null,
|
|
92402
|
+
mappedHead: { pos: mappedHead.pos, fromEpoch: mappedHead.fromEpoch, toEpoch: mappedHead.toEpoch },
|
|
92403
|
+
hit: { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch },
|
|
92404
|
+
anchor,
|
|
92405
|
+
head,
|
|
92406
|
+
selAnchor,
|
|
92407
|
+
selHead,
|
|
92408
|
+
direction: head >= anchor ? "down" : "up",
|
|
92409
|
+
selectionDirection: selHead >= selAnchor ? "down" : "up",
|
|
92410
|
+
extensionMode: __privateGet$1(this, _dragExtensionMode),
|
|
92411
|
+
hitSource: pageMounted ? "dom" : "geometry",
|
|
92412
|
+
pageMounted
|
|
92413
|
+
})}`
|
|
92414
|
+
);
|
|
92009
92415
|
const currentTableHit = __privateMethod$1(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
|
|
92010
92416
|
const shouldUseCellSel = __privateMethod$1(this, _PresentationEditor_instances, shouldUseCellSelection_fn).call(this, currentTableHit);
|
|
92011
92417
|
if (shouldUseCellSel && __privateGet$1(this, _cellAnchor)) {
|
|
@@ -92040,9 +92446,6 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92040
92446
|
return;
|
|
92041
92447
|
}
|
|
92042
92448
|
}
|
|
92043
|
-
const anchor = __privateGet$1(this, _dragAnchor);
|
|
92044
|
-
const head = hit.pos;
|
|
92045
|
-
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
92046
92449
|
try {
|
|
92047
92450
|
const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
|
|
92048
92451
|
__privateGet$1(this, _editor3).view?.dispatch(tr);
|
|
@@ -92437,6 +92840,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92437
92840
|
editorProps: normalizedEditorProps,
|
|
92438
92841
|
documentMode: __privateGet$1(this, _documentMode)
|
|
92439
92842
|
}));
|
|
92843
|
+
__privateMethod$1(this, _PresentationEditor_instances, wrapHiddenEditorFocus_fn).call(this);
|
|
92440
92844
|
__privateGet$1(this, _editor3).presentationEditor = this;
|
|
92441
92845
|
__privateGet$1(this, _editor3)._presentationEditor = this;
|
|
92442
92846
|
__privateMethod$1(this, _PresentationEditor_instances, syncHiddenEditorA11yAttributes_fn).call(this);
|
|
@@ -93636,6 +94040,65 @@ _scrollTimeout = /* @__PURE__ */ new WeakMap();
|
|
|
93636
94040
|
_lastRemoteCursorRenderTime = /* @__PURE__ */ new WeakMap();
|
|
93637
94041
|
_remoteCursorThrottleTimeout = /* @__PURE__ */ new WeakMap();
|
|
93638
94042
|
_PresentationEditor_instances = /* @__PURE__ */ new WeakSet();
|
|
94043
|
+
wrapHiddenEditorFocus_fn = function() {
|
|
94044
|
+
const view = __privateGet$1(this, _editor3)?.view;
|
|
94045
|
+
if (!view || !view.dom || typeof view.focus !== "function") {
|
|
94046
|
+
return;
|
|
94047
|
+
}
|
|
94048
|
+
const viewWithFlag = view;
|
|
94049
|
+
if (viewWithFlag.__sdPreventScrollFocus) {
|
|
94050
|
+
return;
|
|
94051
|
+
}
|
|
94052
|
+
const focusFn = view.focus;
|
|
94053
|
+
if (focusFn.mock) {
|
|
94054
|
+
return;
|
|
94055
|
+
}
|
|
94056
|
+
viewWithFlag.__sdPreventScrollFocus = true;
|
|
94057
|
+
const originalFocus = view.focus.bind(view);
|
|
94058
|
+
view.focus = () => {
|
|
94059
|
+
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView;
|
|
94060
|
+
if (!win) {
|
|
94061
|
+
originalFocus();
|
|
94062
|
+
return;
|
|
94063
|
+
}
|
|
94064
|
+
const beforeX = win.scrollX;
|
|
94065
|
+
const beforeY = win.scrollY;
|
|
94066
|
+
let focused = false;
|
|
94067
|
+
try {
|
|
94068
|
+
view.dom.focus({ preventScroll: true });
|
|
94069
|
+
focused = true;
|
|
94070
|
+
} catch (error) {
|
|
94071
|
+
debugLog("warn", "Hidden editor focus: preventScroll failed", {
|
|
94072
|
+
error: String(error),
|
|
94073
|
+
strategy: "preventScroll"
|
|
94074
|
+
});
|
|
94075
|
+
}
|
|
94076
|
+
if (!focused) {
|
|
94077
|
+
try {
|
|
94078
|
+
view.dom.focus();
|
|
94079
|
+
focused = true;
|
|
94080
|
+
} catch (error) {
|
|
94081
|
+
debugLog("warn", "Hidden editor focus: standard focus failed", {
|
|
94082
|
+
error: String(error),
|
|
94083
|
+
strategy: "standard"
|
|
94084
|
+
});
|
|
94085
|
+
}
|
|
94086
|
+
}
|
|
94087
|
+
if (!focused) {
|
|
94088
|
+
try {
|
|
94089
|
+
originalFocus();
|
|
94090
|
+
} catch (error) {
|
|
94091
|
+
debugLog("error", "Hidden editor focus: all strategies failed", {
|
|
94092
|
+
error: String(error),
|
|
94093
|
+
strategy: "original"
|
|
94094
|
+
});
|
|
94095
|
+
}
|
|
94096
|
+
}
|
|
94097
|
+
if (win.scrollX !== beforeX || win.scrollY !== beforeY) {
|
|
94098
|
+
win.scrollTo(beforeX, beforeY);
|
|
94099
|
+
}
|
|
94100
|
+
};
|
|
94101
|
+
};
|
|
93639
94102
|
collectCommentPositions_fn = function() {
|
|
93640
94103
|
return collectCommentPositions(__privateGet$1(this, _editor3)?.state?.doc ?? null, {
|
|
93641
94104
|
commentMarkName: CommentMarkName,
|
|
@@ -94037,7 +94500,7 @@ focusEditorAfterImageSelection_fn = function() {
|
|
|
94037
94500
|
}
|
|
94038
94501
|
const editorDom = __privateGet$1(this, _editor3).view?.dom;
|
|
94039
94502
|
if (editorDom) {
|
|
94040
|
-
editorDom.focus(
|
|
94503
|
+
editorDom.focus();
|
|
94041
94504
|
__privateGet$1(this, _editor3).view?.focus();
|
|
94042
94505
|
}
|
|
94043
94506
|
};
|