@harbour-enterprises/superdoc 1.0.0-next.10 → 1.0.0-next.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-CZG4udaT.es.js → PdfViewer-DmfOe_Pf.es.js} +1 -1
- package/dist/chunks/{PdfViewer-B9LcTIm2.cjs → PdfViewer-w6pLbkxf.cjs} +1 -1
- package/dist/chunks/{index-4FiyZ-0E.cjs → index-DCu_3jpz.cjs} +3 -3
- package/dist/chunks/{index-1n6qegaQ.es.js → index-DSLlUITa.es.js} +3 -3
- package/dist/chunks/{index-DdTDm9oI-Duiy8M_G.cjs → index-lMJbwm6b-B4MxvqkR.cjs} +1 -1
- package/dist/chunks/{index-DdTDm9oI-BXzE00pk.es.js → index-lMJbwm6b-l7bjUagi.es.js} +1 -1
- package/dist/chunks/{super-editor.es-BQQuazyp.cjs → super-editor.es-CYIzx8D9.cjs} +589 -122
- package/dist/chunks/{super-editor.es-DKr759cY.es.js → super-editor.es-ajKYblrs.es.js} +589 -122
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BavE2jnW.js → converter-Bf6IlS43.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-CY4M19qa.js → docx-zipper-16dfai0y.js} +1 -1
- package/dist/super-editor/chunks/{editor-Cslr04KI.js → editor-DJbi9-qr.js} +619 -123
- package/dist/super-editor/chunks/{index-DdTDm9oI.js → index-lMJbwm6b.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-Zdgn--Js.js → toolbar-DpmycQmV.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +591 -124
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
};
|
|
@@ -57967,7 +57967,11 @@ const trackedTransaction = ({ tr, state: state2, user }) => {
|
|
|
57967
57967
|
const onlyInputTypeMeta = ["inputType", "uiEvent", "paste", "pointer"];
|
|
57968
57968
|
const notAllowedMeta = ["historyUndo", "historyRedo", "acceptReject"];
|
|
57969
57969
|
const isProgrammaticInput = tr.getMeta("inputType") === "programmatic";
|
|
57970
|
-
|
|
57970
|
+
const ySyncMeta = tr.getMeta(ySyncPluginKey);
|
|
57971
|
+
const allowedMeta = /* @__PURE__ */ new Set([...onlyInputTypeMeta, ySyncPluginKey.key]);
|
|
57972
|
+
const hasDisallowedMeta = tr.meta && Object.keys(tr.meta).some((meta) => !allowedMeta.has(meta));
|
|
57973
|
+
if (ySyncMeta?.isChangeOrigin || // Skip Yjs-origin transactions (remote/rehydration).
|
|
57974
|
+
!tr.steps.length || hasDisallowedMeta && !isProgrammaticInput || notAllowedMeta.includes(tr.getMeta("inputType")) || tr.getMeta(CommentsPluginKey)) {
|
|
57971
57975
|
return tr;
|
|
57972
57976
|
}
|
|
57973
57977
|
const newTr = state2.tr;
|
|
@@ -59636,7 +59640,7 @@ const isHeadless = (editor) => {
|
|
|
59636
59640
|
const shouldSkipNodeView = (editor) => {
|
|
59637
59641
|
return isHeadless(editor);
|
|
59638
59642
|
};
|
|
59639
|
-
const summaryVersion = "1.0.0-next.
|
|
59643
|
+
const summaryVersion = "1.0.0-next.12";
|
|
59640
59644
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59641
59645
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59642
59646
|
function mapAttributes(attrs) {
|
|
@@ -60425,7 +60429,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60425
60429
|
{ default: remarkStringify },
|
|
60426
60430
|
{ default: remarkGfm }
|
|
60427
60431
|
] = await Promise.all([
|
|
60428
|
-
import("./index-
|
|
60432
|
+
import("./index-lMJbwm6b-l7bjUagi.es.js"),
|
|
60429
60433
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
60430
60434
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
60431
60435
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -60630,7 +60634,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60630
60634
|
* Process collaboration migrations
|
|
60631
60635
|
*/
|
|
60632
60636
|
processCollaborationMigrations() {
|
|
60633
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.
|
|
60637
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.12");
|
|
60634
60638
|
if (!this.options.ydoc) return;
|
|
60635
60639
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60636
60640
|
let docVersion = metaMap.get("version");
|
|
@@ -71629,6 +71633,86 @@ const createDomPainter = (options) => {
|
|
|
71629
71633
|
}
|
|
71630
71634
|
};
|
|
71631
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
|
+
}
|
|
71632
71716
|
class DomPositionIndex {
|
|
71633
71717
|
constructor() {
|
|
71634
71718
|
__privateAdd$1(this, _entries, []);
|
|
@@ -71685,6 +71769,7 @@ class DomPositionIndex {
|
|
|
71685
71769
|
}
|
|
71686
71770
|
for (const node of pmNodes) {
|
|
71687
71771
|
if (node.classList.contains(DOM_CLASS_NAMES.INLINE_SDT_WRAPPER)) continue;
|
|
71772
|
+
if (node.closest(".superdoc-page-header, .superdoc-page-footer")) continue;
|
|
71688
71773
|
if (leafOnly && nonLeaf.has(node)) continue;
|
|
71689
71774
|
const pmStart = Number(node.dataset.pmStart ?? "NaN");
|
|
71690
71775
|
const pmEnd = Number(node.dataset.pmEnd ?? "NaN");
|
|
@@ -71694,6 +71779,60 @@ class DomPositionIndex {
|
|
|
71694
71779
|
}
|
|
71695
71780
|
entries.sort((a, b2) => a.pmStart - b2.pmStart !== 0 ? a.pmStart - b2.pmStart : a.pmEnd - b2.pmEnd);
|
|
71696
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
|
+
}
|
|
71697
71836
|
}
|
|
71698
71837
|
/**
|
|
71699
71838
|
* Finds the index entry whose position range contains the given position.
|
|
@@ -71943,82 +72082,6 @@ _onRebuild = /* @__PURE__ */ new WeakMap();
|
|
|
71943
72082
|
_observer = /* @__PURE__ */ new WeakMap();
|
|
71944
72083
|
_rebuildScheduled = /* @__PURE__ */ new WeakMap();
|
|
71945
72084
|
_rebuildRafId = /* @__PURE__ */ new WeakMap();
|
|
71946
|
-
const DEFAULT_CONFIG = {
|
|
71947
|
-
logLevel: "off",
|
|
71948
|
-
hud: false
|
|
71949
|
-
};
|
|
71950
|
-
const levelOrder = {
|
|
71951
|
-
error: 0,
|
|
71952
|
-
warn: 1,
|
|
71953
|
-
info: 2,
|
|
71954
|
-
verbose: 3
|
|
71955
|
-
};
|
|
71956
|
-
function getSelectionDebugConfig() {
|
|
71957
|
-
var _a2;
|
|
71958
|
-
if (typeof window === "undefined") {
|
|
71959
|
-
return DEFAULT_CONFIG;
|
|
71960
|
-
}
|
|
71961
|
-
window.superdocDebug ?? (window.superdocDebug = {});
|
|
71962
|
-
(_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
|
|
71963
|
-
const cfg = window.superdocDebug.selection;
|
|
71964
|
-
return {
|
|
71965
|
-
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
71966
|
-
hud: cfg.hud ?? DEFAULT_CONFIG.hud
|
|
71967
|
-
};
|
|
71968
|
-
}
|
|
71969
|
-
function debugLog(level, message, data) {
|
|
71970
|
-
const cfg = getSelectionDebugConfig();
|
|
71971
|
-
if (cfg.logLevel === "off") return;
|
|
71972
|
-
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
71973
|
-
const prefix2 = "[Selection]";
|
|
71974
|
-
if (data) {
|
|
71975
|
-
console.log(prefix2, message, data);
|
|
71976
|
-
} else {
|
|
71977
|
-
console.log(prefix2, message);
|
|
71978
|
-
}
|
|
71979
|
-
}
|
|
71980
|
-
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
71981
|
-
function updateSelectionDebugHud(host, state2) {
|
|
71982
|
-
const cfg = getSelectionDebugConfig();
|
|
71983
|
-
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
71984
|
-
if (!doc2) return;
|
|
71985
|
-
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
71986
|
-
if (!cfg.hud) {
|
|
71987
|
-
existing?.remove();
|
|
71988
|
-
return;
|
|
71989
|
-
}
|
|
71990
|
-
const hud = existing ?? doc2.createElement("div");
|
|
71991
|
-
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
71992
|
-
hud.style.position = "absolute";
|
|
71993
|
-
hud.style.top = "8px";
|
|
71994
|
-
hud.style.left = "8px";
|
|
71995
|
-
hud.style.zIndex = "9999";
|
|
71996
|
-
hud.style.maxWidth = "420px";
|
|
71997
|
-
hud.style.padding = "6px 8px";
|
|
71998
|
-
hud.style.borderRadius = "6px";
|
|
71999
|
-
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
72000
|
-
hud.style.color = "white";
|
|
72001
|
-
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
72002
|
-
hud.style.fontSize = "12px";
|
|
72003
|
-
hud.style.lineHeight = "1.3";
|
|
72004
|
-
hud.style.pointerEvents = "none";
|
|
72005
|
-
hud.style.whiteSpace = "pre";
|
|
72006
|
-
const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
|
|
72007
|
-
const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
|
|
72008
|
-
const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
|
|
72009
|
-
state2.lastPointer.y
|
|
72010
|
-
)}` : "null";
|
|
72011
|
-
const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
|
|
72012
|
-
hud.textContent = [
|
|
72013
|
-
`docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
|
|
72014
|
-
`selection=${selectionText}`,
|
|
72015
|
-
`pointer=${pointerText}`,
|
|
72016
|
-
`hit=${hitText}`
|
|
72017
|
-
].join("\n");
|
|
72018
|
-
if (!existing) {
|
|
72019
|
-
host.appendChild(hud);
|
|
72020
|
-
}
|
|
72021
|
-
}
|
|
72022
72085
|
function computeSelectionRectsFromDom(options, from2, to) {
|
|
72023
72086
|
const painterHost = options.painterHost;
|
|
72024
72087
|
if (!painterHost) return null;
|
|
@@ -72039,6 +72102,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72039
72102
|
);
|
|
72040
72103
|
const out = [];
|
|
72041
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
|
+
});
|
|
72042
72133
|
for (const pageEl of pageEls) {
|
|
72043
72134
|
const pageIndex = Number(pageEl.dataset.pageIndex ?? "NaN");
|
|
72044
72135
|
if (!Number.isFinite(pageIndex)) continue;
|
|
@@ -72062,9 +72153,47 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72062
72153
|
if (sliceEntries.length === 0) {
|
|
72063
72154
|
continue;
|
|
72064
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
|
+
}
|
|
72065
72168
|
let startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
72066
72169
|
let endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
72067
|
-
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
|
+
}
|
|
72068
72197
|
if (!rebuiltOnce) {
|
|
72069
72198
|
options.rebuildDomPositionIndex();
|
|
72070
72199
|
rebuiltOnce = true;
|
|
@@ -72072,9 +72201,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72072
72201
|
if (sliceEntries.length === 0) continue;
|
|
72073
72202
|
startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
72074
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
|
+
}
|
|
72075
72220
|
}
|
|
72076
|
-
if (!
|
|
72077
|
-
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
|
+
);
|
|
72078
72232
|
return null;
|
|
72079
72233
|
}
|
|
72080
72234
|
}
|
|
@@ -72089,8 +72243,83 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72089
72243
|
}
|
|
72090
72244
|
let clientRects = [];
|
|
72091
72245
|
try {
|
|
72092
|
-
|
|
72093
|
-
|
|
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
|
+
}
|
|
72094
72323
|
} catch (error) {
|
|
72095
72324
|
debugLog("warn", "DOM selection rects: getClientRects failed", { error: String(error) });
|
|
72096
72325
|
return null;
|
|
@@ -72114,6 +72343,57 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72114
72343
|
}
|
|
72115
72344
|
return out;
|
|
72116
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
|
+
}
|
|
72117
72397
|
function setDomRangeStart(range2, entry, pos) {
|
|
72118
72398
|
const el = entry.el;
|
|
72119
72399
|
const pmStart = entry.pmStart;
|
|
@@ -72223,31 +72503,69 @@ function deduplicateOverlappingRects(rects) {
|
|
|
72223
72503
|
return a.x - b2.x;
|
|
72224
72504
|
});
|
|
72225
72505
|
const result = [];
|
|
72226
|
-
|
|
72227
|
-
|
|
72228
|
-
|
|
72229
|
-
|
|
72230
|
-
|
|
72231
|
-
|
|
72232
|
-
|
|
72233
|
-
|
|
72234
|
-
|
|
72235
|
-
|
|
72236
|
-
|
|
72237
|
-
|
|
72238
|
-
|
|
72239
|
-
|
|
72240
|
-
|
|
72241
|
-
|
|
72242
|
-
|
|
72243
|
-
|
|
72244
|
-
|
|
72245
|
-
|
|
72246
|
-
|
|
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);
|
|
72247
72550
|
}
|
|
72248
72551
|
}
|
|
72249
|
-
|
|
72250
|
-
|
|
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);
|
|
72251
72569
|
}
|
|
72252
72570
|
return result;
|
|
72253
72571
|
}
|
|
@@ -72371,10 +72689,11 @@ function safeCleanup(fn2, context) {
|
|
|
72371
72689
|
function createHiddenHost(doc2, widthPx) {
|
|
72372
72690
|
const host = doc2.createElement("div");
|
|
72373
72691
|
host.className = "presentation-editor__hidden-host";
|
|
72374
|
-
host.style.position = "
|
|
72692
|
+
host.style.position = "fixed";
|
|
72375
72693
|
host.style.left = "-9999px";
|
|
72376
72694
|
host.style.top = "0";
|
|
72377
72695
|
host.style.width = `${widthPx}px`;
|
|
72696
|
+
host.style.setProperty("overflow-anchor", "none");
|
|
72378
72697
|
host.style.pointerEvents = "none";
|
|
72379
72698
|
host.style.opacity = "0";
|
|
72380
72699
|
host.style.zIndex = "-1";
|
|
@@ -72848,7 +73167,8 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
72848
73167
|
});
|
|
72849
73168
|
let hitChain = [];
|
|
72850
73169
|
const doc2 = document;
|
|
72851
|
-
|
|
73170
|
+
const hasElementsFromPoint = typeof doc2.elementsFromPoint === "function";
|
|
73171
|
+
if (hasElementsFromPoint) {
|
|
72852
73172
|
try {
|
|
72853
73173
|
hitChain = doc2.elementsFromPoint(viewX, viewY) ?? [];
|
|
72854
73174
|
} catch {
|
|
@@ -72894,11 +73214,14 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
72894
73214
|
log("All fragments on page:", JSON.stringify(fragmentData, null, 2));
|
|
72895
73215
|
const fragmentEl = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.fragment));
|
|
72896
73216
|
if (!fragmentEl) {
|
|
73217
|
+
if (hasElementsFromPoint) {
|
|
73218
|
+
return null;
|
|
73219
|
+
}
|
|
72897
73220
|
const fallbackFragment = pageEl.querySelector(`.${CLASS_NAMES.fragment}`);
|
|
72898
73221
|
if (!fallbackFragment) {
|
|
72899
73222
|
return null;
|
|
72900
73223
|
}
|
|
72901
|
-
log("Using fallback fragment:", {
|
|
73224
|
+
log("Using fallback fragment (no elementsFromPoint):", {
|
|
72902
73225
|
blockId: fallbackFragment.dataset.blockId,
|
|
72903
73226
|
pmStart: fallbackFragment.dataset.pmStart,
|
|
72904
73227
|
pmEnd: fallbackFragment.dataset.pmEnd
|
|
@@ -91705,7 +92028,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91705
92028
|
}
|
|
91706
92029
|
}
|
|
91707
92030
|
}
|
|
91708
|
-
editorDom2.focus(
|
|
92031
|
+
editorDom2.focus();
|
|
91709
92032
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91710
92033
|
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
91711
92034
|
return;
|
|
@@ -91772,7 +92095,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91772
92095
|
}
|
|
91773
92096
|
}
|
|
91774
92097
|
}
|
|
91775
|
-
editorDom2.focus(
|
|
92098
|
+
editorDom2.focus();
|
|
91776
92099
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91777
92100
|
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
91778
92101
|
}
|
|
@@ -91895,7 +92218,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91895
92218
|
}
|
|
91896
92219
|
const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
|
|
91897
92220
|
if (editorDom2) {
|
|
91898
|
-
editorDom2.focus(
|
|
92221
|
+
editorDom2.focus();
|
|
91899
92222
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91900
92223
|
}
|
|
91901
92224
|
return;
|
|
@@ -91928,6 +92251,25 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91928
92251
|
} else {
|
|
91929
92252
|
__privateSet(this, _dragExtensionMode, "char");
|
|
91930
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
|
+
);
|
|
91931
92273
|
if (typeof __privateGet$1(this, _viewportHost).setPointerCapture === "function") {
|
|
91932
92274
|
__privateGet$1(this, _viewportHost).setPointerCapture(event.pointerId);
|
|
91933
92275
|
}
|
|
@@ -91955,7 +92297,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91955
92297
|
if (!editorDom) {
|
|
91956
92298
|
return;
|
|
91957
92299
|
}
|
|
91958
|
-
editorDom.focus(
|
|
92300
|
+
editorDom.focus();
|
|
91959
92301
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91960
92302
|
});
|
|
91961
92303
|
__privateAdd$1(this, _handlePointerMove, (event) => {
|
|
@@ -91964,6 +92306,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91964
92306
|
if (!normalized) return;
|
|
91965
92307
|
if (__privateGet$1(this, _isDragging) && __privateGet$1(this, _dragAnchor) !== null && event.buttons & 1) {
|
|
91966
92308
|
__privateSet(this, _pendingMarginClick, null);
|
|
92309
|
+
const prevPointer = __privateGet$1(this, _dragLastPointer);
|
|
92310
|
+
const prevRawHit = __privateGet$1(this, _dragLastRawHit);
|
|
91967
92311
|
__privateSet(this, _dragLastPointer, { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y });
|
|
91968
92312
|
const rawHit = clickToPosition(
|
|
91969
92313
|
__privateGet$1(this, _layoutState).layout,
|
|
@@ -91975,7 +92319,17 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91975
92319
|
event.clientY,
|
|
91976
92320
|
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
91977
92321
|
);
|
|
91978
|
-
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
|
+
}
|
|
91979
92333
|
const doc22 = __privateGet$1(this, _editor3).state?.doc;
|
|
91980
92334
|
if (!doc22) return;
|
|
91981
92335
|
__privateSet(this, _dragLastRawHit, rawHit);
|
|
@@ -91988,6 +92342,27 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91988
92342
|
const mappedHead = __privateGet$1(this, _epochMapper).mapPosFromLayoutToCurrentDetailed(rawHit.pos, rawHit.layoutEpoch, 1);
|
|
91989
92343
|
if (!mappedHead.ok) {
|
|
91990
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
|
+
);
|
|
91991
92366
|
return;
|
|
91992
92367
|
}
|
|
91993
92368
|
const hit = {
|
|
@@ -92002,6 +92377,41 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92002
92377
|
mappedPos: hit.pos
|
|
92003
92378
|
});
|
|
92004
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
|
+
);
|
|
92005
92415
|
const currentTableHit = __privateMethod$1(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
|
|
92006
92416
|
const shouldUseCellSel = __privateMethod$1(this, _PresentationEditor_instances, shouldUseCellSelection_fn).call(this, currentTableHit);
|
|
92007
92417
|
if (shouldUseCellSel && __privateGet$1(this, _cellAnchor)) {
|
|
@@ -92036,9 +92446,6 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92036
92446
|
return;
|
|
92037
92447
|
}
|
|
92038
92448
|
}
|
|
92039
|
-
const anchor = __privateGet$1(this, _dragAnchor);
|
|
92040
|
-
const head = hit.pos;
|
|
92041
|
-
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
92042
92449
|
try {
|
|
92043
92450
|
const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
|
|
92044
92451
|
__privateGet$1(this, _editor3).view?.dispatch(tr);
|
|
@@ -92433,6 +92840,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92433
92840
|
editorProps: normalizedEditorProps,
|
|
92434
92841
|
documentMode: __privateGet$1(this, _documentMode)
|
|
92435
92842
|
}));
|
|
92843
|
+
__privateMethod$1(this, _PresentationEditor_instances, wrapHiddenEditorFocus_fn).call(this);
|
|
92436
92844
|
__privateGet$1(this, _editor3).presentationEditor = this;
|
|
92437
92845
|
__privateGet$1(this, _editor3)._presentationEditor = this;
|
|
92438
92846
|
__privateMethod$1(this, _PresentationEditor_instances, syncHiddenEditorA11yAttributes_fn).call(this);
|
|
@@ -93632,6 +94040,65 @@ _scrollTimeout = /* @__PURE__ */ new WeakMap();
|
|
|
93632
94040
|
_lastRemoteCursorRenderTime = /* @__PURE__ */ new WeakMap();
|
|
93633
94041
|
_remoteCursorThrottleTimeout = /* @__PURE__ */ new WeakMap();
|
|
93634
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
|
+
};
|
|
93635
94102
|
collectCommentPositions_fn = function() {
|
|
93636
94103
|
return collectCommentPositions(__privateGet$1(this, _editor3)?.state?.doc ?? null, {
|
|
93637
94104
|
commentMarkName: CommentMarkName,
|
|
@@ -94033,7 +94500,7 @@ focusEditorAfterImageSelection_fn = function() {
|
|
|
94033
94500
|
}
|
|
94034
94501
|
const editorDom = __privateGet$1(this, _editor3).view?.dom;
|
|
94035
94502
|
if (editorDom) {
|
|
94036
|
-
editorDom.focus(
|
|
94503
|
+
editorDom.focus();
|
|
94037
94504
|
__privateGet$1(this, _editor3).view?.focus();
|
|
94038
94505
|
}
|
|
94039
94506
|
};
|