@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
|
@@ -42427,7 +42427,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42427
42427
|
static getStoredSuperdocVersion(docx) {
|
|
42428
42428
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42429
42429
|
}
|
|
42430
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.
|
|
42430
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.12") {
|
|
42431
42431
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42432
42432
|
}
|
|
42433
42433
|
/**
|
|
@@ -45739,7 +45739,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
45739
45739
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
45740
45740
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
45741
45741
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
45742
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, computeExpectedSectionType_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
45742
|
+
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, wrapHiddenEditorFocus_fn, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, computeExpectedSectionType_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
45743
45743
|
var GOOD_LEAF_SIZE = 200;
|
|
45744
45744
|
var RopeSequence = function RopeSequence2() {
|
|
45745
45745
|
};
|
|
@@ -57984,7 +57984,11 @@ const trackedTransaction = ({ tr, state: state2, user }) => {
|
|
|
57984
57984
|
const onlyInputTypeMeta = ["inputType", "uiEvent", "paste", "pointer"];
|
|
57985
57985
|
const notAllowedMeta = ["historyUndo", "historyRedo", "acceptReject"];
|
|
57986
57986
|
const isProgrammaticInput = tr.getMeta("inputType") === "programmatic";
|
|
57987
|
-
|
|
57987
|
+
const ySyncMeta = tr.getMeta(ySyncPluginKey);
|
|
57988
|
+
const allowedMeta = /* @__PURE__ */ new Set([...onlyInputTypeMeta, ySyncPluginKey.key]);
|
|
57989
|
+
const hasDisallowedMeta = tr.meta && Object.keys(tr.meta).some((meta) => !allowedMeta.has(meta));
|
|
57990
|
+
if (ySyncMeta?.isChangeOrigin || // Skip Yjs-origin transactions (remote/rehydration).
|
|
57991
|
+
!tr.steps.length || hasDisallowedMeta && !isProgrammaticInput || notAllowedMeta.includes(tr.getMeta("inputType")) || tr.getMeta(CommentsPluginKey)) {
|
|
57988
57992
|
return tr;
|
|
57989
57993
|
}
|
|
57990
57994
|
const newTr = state2.tr;
|
|
@@ -59653,7 +59657,7 @@ const isHeadless = (editor) => {
|
|
|
59653
59657
|
const shouldSkipNodeView = (editor) => {
|
|
59654
59658
|
return isHeadless(editor);
|
|
59655
59659
|
};
|
|
59656
|
-
const summaryVersion = "1.0.0-next.
|
|
59660
|
+
const summaryVersion = "1.0.0-next.12";
|
|
59657
59661
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59658
59662
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59659
59663
|
function mapAttributes(attrs) {
|
|
@@ -60442,7 +60446,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60442
60446
|
{ default: remarkStringify },
|
|
60443
60447
|
{ default: remarkGfm }
|
|
60444
60448
|
] = await Promise.all([
|
|
60445
|
-
Promise.resolve().then(() => require("./index-
|
|
60449
|
+
Promise.resolve().then(() => require("./index-lMJbwm6b-B4MxvqkR.cjs")),
|
|
60446
60450
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
60447
60451
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
60448
60452
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -60647,7 +60651,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60647
60651
|
* Process collaboration migrations
|
|
60648
60652
|
*/
|
|
60649
60653
|
processCollaborationMigrations() {
|
|
60650
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.
|
|
60654
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.12");
|
|
60651
60655
|
if (!this.options.ydoc) return;
|
|
60652
60656
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60653
60657
|
let docVersion = metaMap.get("version");
|
|
@@ -71646,6 +71650,86 @@ const createDomPainter = (options) => {
|
|
|
71646
71650
|
}
|
|
71647
71651
|
};
|
|
71648
71652
|
};
|
|
71653
|
+
const DEFAULT_CONFIG = {
|
|
71654
|
+
logLevel: "off",
|
|
71655
|
+
hud: false,
|
|
71656
|
+
dumpRects: false,
|
|
71657
|
+
disableRectDedupe: false
|
|
71658
|
+
};
|
|
71659
|
+
const levelOrder = {
|
|
71660
|
+
error: 0,
|
|
71661
|
+
warn: 1,
|
|
71662
|
+
info: 2,
|
|
71663
|
+
verbose: 3
|
|
71664
|
+
};
|
|
71665
|
+
function getSelectionDebugConfig() {
|
|
71666
|
+
var _a2;
|
|
71667
|
+
if (typeof window === "undefined") {
|
|
71668
|
+
return DEFAULT_CONFIG;
|
|
71669
|
+
}
|
|
71670
|
+
window.superdocDebug ?? (window.superdocDebug = {});
|
|
71671
|
+
(_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
|
|
71672
|
+
const cfg = window.superdocDebug.selection;
|
|
71673
|
+
return {
|
|
71674
|
+
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
71675
|
+
hud: cfg.hud ?? DEFAULT_CONFIG.hud,
|
|
71676
|
+
dumpRects: cfg.dumpRects ?? DEFAULT_CONFIG.dumpRects,
|
|
71677
|
+
disableRectDedupe: cfg.disableRectDedupe ?? DEFAULT_CONFIG.disableRectDedupe
|
|
71678
|
+
};
|
|
71679
|
+
}
|
|
71680
|
+
function debugLog(level, message, data) {
|
|
71681
|
+
const cfg = getSelectionDebugConfig();
|
|
71682
|
+
if (cfg.logLevel === "off") return;
|
|
71683
|
+
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
71684
|
+
const prefix2 = "[Selection]";
|
|
71685
|
+
if (data) {
|
|
71686
|
+
console.log(prefix2, message, data);
|
|
71687
|
+
} else {
|
|
71688
|
+
console.log(prefix2, message);
|
|
71689
|
+
}
|
|
71690
|
+
}
|
|
71691
|
+
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
71692
|
+
function updateSelectionDebugHud(host, state2) {
|
|
71693
|
+
const cfg = getSelectionDebugConfig();
|
|
71694
|
+
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
71695
|
+
if (!doc2) return;
|
|
71696
|
+
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
71697
|
+
if (!cfg.hud) {
|
|
71698
|
+
existing?.remove();
|
|
71699
|
+
return;
|
|
71700
|
+
}
|
|
71701
|
+
const hud = existing ?? doc2.createElement("div");
|
|
71702
|
+
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
71703
|
+
hud.style.position = "absolute";
|
|
71704
|
+
hud.style.top = "8px";
|
|
71705
|
+
hud.style.left = "8px";
|
|
71706
|
+
hud.style.zIndex = "9999";
|
|
71707
|
+
hud.style.maxWidth = "420px";
|
|
71708
|
+
hud.style.padding = "6px 8px";
|
|
71709
|
+
hud.style.borderRadius = "6px";
|
|
71710
|
+
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
71711
|
+
hud.style.color = "white";
|
|
71712
|
+
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
71713
|
+
hud.style.fontSize = "12px";
|
|
71714
|
+
hud.style.lineHeight = "1.3";
|
|
71715
|
+
hud.style.pointerEvents = "none";
|
|
71716
|
+
hud.style.whiteSpace = "pre";
|
|
71717
|
+
const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
|
|
71718
|
+
const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
|
|
71719
|
+
const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
|
|
71720
|
+
state2.lastPointer.y
|
|
71721
|
+
)}` : "null";
|
|
71722
|
+
const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
|
|
71723
|
+
hud.textContent = [
|
|
71724
|
+
`docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
|
|
71725
|
+
`selection=${selectionText}`,
|
|
71726
|
+
`pointer=${pointerText}`,
|
|
71727
|
+
`hit=${hitText}`
|
|
71728
|
+
].join("\n");
|
|
71729
|
+
if (!existing) {
|
|
71730
|
+
host.appendChild(hud);
|
|
71731
|
+
}
|
|
71732
|
+
}
|
|
71649
71733
|
class DomPositionIndex {
|
|
71650
71734
|
constructor() {
|
|
71651
71735
|
__privateAdd$1(this, _entries, []);
|
|
@@ -71702,6 +71786,7 @@ class DomPositionIndex {
|
|
|
71702
71786
|
}
|
|
71703
71787
|
for (const node of pmNodes) {
|
|
71704
71788
|
if (node.classList.contains(DOM_CLASS_NAMES.INLINE_SDT_WRAPPER)) continue;
|
|
71789
|
+
if (node.closest(".superdoc-page-header, .superdoc-page-footer")) continue;
|
|
71705
71790
|
if (leafOnly && nonLeaf.has(node)) continue;
|
|
71706
71791
|
const pmStart = Number(node.dataset.pmStart ?? "NaN");
|
|
71707
71792
|
const pmEnd = Number(node.dataset.pmEnd ?? "NaN");
|
|
@@ -71711,6 +71796,60 @@ class DomPositionIndex {
|
|
|
71711
71796
|
}
|
|
71712
71797
|
entries.sort((a, b2) => a.pmStart - b2.pmStart !== 0 ? a.pmStart - b2.pmStart : a.pmEnd - b2.pmEnd);
|
|
71713
71798
|
__privateSet(this, _entries, entries);
|
|
71799
|
+
const isVerbose = getSelectionDebugConfig().logLevel === "verbose";
|
|
71800
|
+
if (isVerbose) {
|
|
71801
|
+
const counts = { total: entries.length, body: 0, header: 0, footer: 0 };
|
|
71802
|
+
const bodySamples = [];
|
|
71803
|
+
const headerSamples = [];
|
|
71804
|
+
const footerSamples = [];
|
|
71805
|
+
for (const entry of entries) {
|
|
71806
|
+
const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
|
|
71807
|
+
const pageIndex = pageEl?.dataset.pageIndex ?? null;
|
|
71808
|
+
const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
|
|
71809
|
+
if (section === "header") {
|
|
71810
|
+
counts.header += 1;
|
|
71811
|
+
if (headerSamples.length < 10) {
|
|
71812
|
+
headerSamples.push({
|
|
71813
|
+
pmStart: entry.pmStart,
|
|
71814
|
+
pmEnd: entry.pmEnd,
|
|
71815
|
+
pageIndex,
|
|
71816
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
71817
|
+
});
|
|
71818
|
+
}
|
|
71819
|
+
continue;
|
|
71820
|
+
}
|
|
71821
|
+
if (section === "footer") {
|
|
71822
|
+
counts.footer += 1;
|
|
71823
|
+
if (footerSamples.length < 10) {
|
|
71824
|
+
footerSamples.push({
|
|
71825
|
+
pmStart: entry.pmStart,
|
|
71826
|
+
pmEnd: entry.pmEnd,
|
|
71827
|
+
pageIndex,
|
|
71828
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
71829
|
+
});
|
|
71830
|
+
}
|
|
71831
|
+
continue;
|
|
71832
|
+
}
|
|
71833
|
+
counts.body += 1;
|
|
71834
|
+
if (bodySamples.length < 10) {
|
|
71835
|
+
bodySamples.push({
|
|
71836
|
+
pmStart: entry.pmStart,
|
|
71837
|
+
pmEnd: entry.pmEnd,
|
|
71838
|
+
pageIndex,
|
|
71839
|
+
text: (entry.el.textContent ?? "").slice(0, 40)
|
|
71840
|
+
});
|
|
71841
|
+
}
|
|
71842
|
+
}
|
|
71843
|
+
debugLog(
|
|
71844
|
+
"verbose",
|
|
71845
|
+
`DomPositionIndex: rebuild summary ${JSON.stringify({
|
|
71846
|
+
counts,
|
|
71847
|
+
bodySamples,
|
|
71848
|
+
headerSamples,
|
|
71849
|
+
footerSamples
|
|
71850
|
+
})}`
|
|
71851
|
+
);
|
|
71852
|
+
}
|
|
71714
71853
|
}
|
|
71715
71854
|
/**
|
|
71716
71855
|
* Finds the index entry whose position range contains the given position.
|
|
@@ -71960,82 +72099,6 @@ _onRebuild = /* @__PURE__ */ new WeakMap();
|
|
|
71960
72099
|
_observer = /* @__PURE__ */ new WeakMap();
|
|
71961
72100
|
_rebuildScheduled = /* @__PURE__ */ new WeakMap();
|
|
71962
72101
|
_rebuildRafId = /* @__PURE__ */ new WeakMap();
|
|
71963
|
-
const DEFAULT_CONFIG = {
|
|
71964
|
-
logLevel: "off",
|
|
71965
|
-
hud: false
|
|
71966
|
-
};
|
|
71967
|
-
const levelOrder = {
|
|
71968
|
-
error: 0,
|
|
71969
|
-
warn: 1,
|
|
71970
|
-
info: 2,
|
|
71971
|
-
verbose: 3
|
|
71972
|
-
};
|
|
71973
|
-
function getSelectionDebugConfig() {
|
|
71974
|
-
var _a2;
|
|
71975
|
-
if (typeof window === "undefined") {
|
|
71976
|
-
return DEFAULT_CONFIG;
|
|
71977
|
-
}
|
|
71978
|
-
window.superdocDebug ?? (window.superdocDebug = {});
|
|
71979
|
-
(_a2 = window.superdocDebug).selection ?? (_a2.selection = {});
|
|
71980
|
-
const cfg = window.superdocDebug.selection;
|
|
71981
|
-
return {
|
|
71982
|
-
logLevel: cfg.logLevel ?? DEFAULT_CONFIG.logLevel,
|
|
71983
|
-
hud: cfg.hud ?? DEFAULT_CONFIG.hud
|
|
71984
|
-
};
|
|
71985
|
-
}
|
|
71986
|
-
function debugLog(level, message, data) {
|
|
71987
|
-
const cfg = getSelectionDebugConfig();
|
|
71988
|
-
if (cfg.logLevel === "off") return;
|
|
71989
|
-
if (levelOrder[level] > levelOrder[cfg.logLevel]) return;
|
|
71990
|
-
const prefix2 = "[Selection]";
|
|
71991
|
-
if (data) {
|
|
71992
|
-
console.log(prefix2, message, data);
|
|
71993
|
-
} else {
|
|
71994
|
-
console.log(prefix2, message);
|
|
71995
|
-
}
|
|
71996
|
-
}
|
|
71997
|
-
const HUD_DATA_ATTR = "data-superdoc-selection-debug-hud";
|
|
71998
|
-
function updateSelectionDebugHud(host, state2) {
|
|
71999
|
-
const cfg = getSelectionDebugConfig();
|
|
72000
|
-
const doc2 = host.ownerDocument ?? (typeof document !== "undefined" ? document : null);
|
|
72001
|
-
if (!doc2) return;
|
|
72002
|
-
const existing = host.querySelector(`[${HUD_DATA_ATTR}="true"]`);
|
|
72003
|
-
if (!cfg.hud) {
|
|
72004
|
-
existing?.remove();
|
|
72005
|
-
return;
|
|
72006
|
-
}
|
|
72007
|
-
const hud = existing ?? doc2.createElement("div");
|
|
72008
|
-
hud.setAttribute(HUD_DATA_ATTR, "true");
|
|
72009
|
-
hud.style.position = "absolute";
|
|
72010
|
-
hud.style.top = "8px";
|
|
72011
|
-
hud.style.left = "8px";
|
|
72012
|
-
hud.style.zIndex = "9999";
|
|
72013
|
-
hud.style.maxWidth = "420px";
|
|
72014
|
-
hud.style.padding = "6px 8px";
|
|
72015
|
-
hud.style.borderRadius = "6px";
|
|
72016
|
-
hud.style.background = "rgba(0, 0, 0, 0.72)";
|
|
72017
|
-
hud.style.color = "white";
|
|
72018
|
-
hud.style.fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
72019
|
-
hud.style.fontSize = "12px";
|
|
72020
|
-
hud.style.lineHeight = "1.3";
|
|
72021
|
-
hud.style.pointerEvents = "none";
|
|
72022
|
-
hud.style.whiteSpace = "pre";
|
|
72023
|
-
const behind = Math.max(0, state2.docEpoch - state2.layoutEpoch);
|
|
72024
|
-
const selectionText = state2.selection ? `${state2.selection.from}..${state2.selection.to}` : "null";
|
|
72025
|
-
const pointerText = state2.lastPointer ? `${state2.lastPointer.clientX},${state2.lastPointer.clientY} -> ${Math.round(state2.lastPointer.x)},${Math.round(
|
|
72026
|
-
state2.lastPointer.y
|
|
72027
|
-
)}` : "null";
|
|
72028
|
-
const hitText = state2.lastHit ? `${state2.lastHit.source} pos=${state2.lastHit.pos ?? "null"} epoch=${state2.lastHit.layoutEpoch ?? "null"} mapped=${state2.lastHit.mappedPos ?? "null"}` : "null";
|
|
72029
|
-
hud.textContent = [
|
|
72030
|
-
`docEpoch=${state2.docEpoch} layoutEpoch=${state2.layoutEpoch} behind=${behind}`,
|
|
72031
|
-
`selection=${selectionText}`,
|
|
72032
|
-
`pointer=${pointerText}`,
|
|
72033
|
-
`hit=${hitText}`
|
|
72034
|
-
].join("\n");
|
|
72035
|
-
if (!existing) {
|
|
72036
|
-
host.appendChild(hud);
|
|
72037
|
-
}
|
|
72038
|
-
}
|
|
72039
72102
|
function computeSelectionRectsFromDom(options, from2, to) {
|
|
72040
72103
|
const painterHost = options.painterHost;
|
|
72041
72104
|
if (!painterHost) return null;
|
|
@@ -72056,6 +72119,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72056
72119
|
);
|
|
72057
72120
|
const out = [];
|
|
72058
72121
|
let rebuiltOnce = false;
|
|
72122
|
+
const debugConfig = getSelectionDebugConfig();
|
|
72123
|
+
const isVerbose = debugConfig.logLevel === "verbose";
|
|
72124
|
+
const dumpRects = isVerbose && debugConfig.dumpRects;
|
|
72125
|
+
const disableRectDedupe = debugConfig.disableRectDedupe;
|
|
72126
|
+
const entryDebugInfo = (entry) => {
|
|
72127
|
+
const pageEl = entry.el.closest(`.${DOM_CLASS_NAMES.PAGE}`);
|
|
72128
|
+
const section = entry.el.closest(".superdoc-page-header") ? "header" : entry.el.closest(".superdoc-page-footer") ? "footer" : "body";
|
|
72129
|
+
return {
|
|
72130
|
+
pmStart: entry.pmStart,
|
|
72131
|
+
pmEnd: entry.pmEnd,
|
|
72132
|
+
pageIndex: pageEl?.dataset.pageIndex ?? null,
|
|
72133
|
+
section,
|
|
72134
|
+
connected: entry.el.isConnected,
|
|
72135
|
+
layoutEpoch: entry.el.dataset.layoutEpoch ?? null,
|
|
72136
|
+
pageEpoch: pageEl?.dataset.layoutEpoch ?? null,
|
|
72137
|
+
text: (entry.el.textContent ?? "").slice(0, 80)
|
|
72138
|
+
};
|
|
72139
|
+
};
|
|
72140
|
+
const rectDebugInfo = (rect) => ({
|
|
72141
|
+
x: rect.x,
|
|
72142
|
+
y: rect.y,
|
|
72143
|
+
width: rect.width,
|
|
72144
|
+
height: rect.height,
|
|
72145
|
+
top: rect.top,
|
|
72146
|
+
left: rect.left,
|
|
72147
|
+
right: rect.right,
|
|
72148
|
+
bottom: rect.bottom
|
|
72149
|
+
});
|
|
72059
72150
|
for (const pageEl of pageEls) {
|
|
72060
72151
|
const pageIndex = Number(pageEl.dataset.pageIndex ?? "NaN");
|
|
72061
72152
|
if (!Number.isFinite(pageIndex)) continue;
|
|
@@ -72079,9 +72170,47 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72079
72170
|
if (sliceEntries.length === 0) {
|
|
72080
72171
|
continue;
|
|
72081
72172
|
}
|
|
72173
|
+
if (isVerbose) {
|
|
72174
|
+
debugLog(
|
|
72175
|
+
"verbose",
|
|
72176
|
+
`DOM selection rects: slice entries ${JSON.stringify({
|
|
72177
|
+
pageIndex,
|
|
72178
|
+
sliceFrom,
|
|
72179
|
+
sliceTo,
|
|
72180
|
+
entriesCount: sliceEntries.length,
|
|
72181
|
+
entriesPreview: sliceEntries.slice(0, 20).map(entryDebugInfo)
|
|
72182
|
+
})}`
|
|
72183
|
+
);
|
|
72184
|
+
}
|
|
72082
72185
|
let startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
72083
72186
|
let endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
72084
|
-
if (
|
|
72187
|
+
if (isVerbose) {
|
|
72188
|
+
debugLog(
|
|
72189
|
+
"verbose",
|
|
72190
|
+
`DOM selection rects: boundaries ${JSON.stringify({
|
|
72191
|
+
pageIndex,
|
|
72192
|
+
sliceFrom,
|
|
72193
|
+
sliceTo,
|
|
72194
|
+
start: entryDebugInfo(startEntry),
|
|
72195
|
+
end: entryDebugInfo(endEntry)
|
|
72196
|
+
})}`
|
|
72197
|
+
);
|
|
72198
|
+
}
|
|
72199
|
+
let startContained = pageEl.contains(startEntry.el);
|
|
72200
|
+
let endContained = pageEl.contains(endEntry.el);
|
|
72201
|
+
if (!startContained || !endContained) {
|
|
72202
|
+
if (isVerbose) {
|
|
72203
|
+
debugLog(
|
|
72204
|
+
"verbose",
|
|
72205
|
+
`DOM selection rects: boundary containment ${JSON.stringify({
|
|
72206
|
+
pageIndex,
|
|
72207
|
+
sliceFrom,
|
|
72208
|
+
sliceTo,
|
|
72209
|
+
startContained,
|
|
72210
|
+
endContained
|
|
72211
|
+
})}`
|
|
72212
|
+
);
|
|
72213
|
+
}
|
|
72085
72214
|
if (!rebuiltOnce) {
|
|
72086
72215
|
options.rebuildDomPositionIndex();
|
|
72087
72216
|
rebuiltOnce = true;
|
|
@@ -72089,9 +72218,34 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72089
72218
|
if (sliceEntries.length === 0) continue;
|
|
72090
72219
|
startEntry = options.domPositionIndex.findEntryAtPosition(sliceFrom) ?? sliceEntries[0];
|
|
72091
72220
|
endEntry = options.domPositionIndex.findEntryAtPosition(sliceTo) ?? sliceEntries[sliceEntries.length - 1];
|
|
72221
|
+
startContained = pageEl.contains(startEntry.el);
|
|
72222
|
+
endContained = pageEl.contains(endEntry.el);
|
|
72223
|
+
if (isVerbose) {
|
|
72224
|
+
debugLog(
|
|
72225
|
+
"verbose",
|
|
72226
|
+
`DOM selection rects: boundary containment after rebuild ${JSON.stringify({
|
|
72227
|
+
pageIndex,
|
|
72228
|
+
sliceFrom,
|
|
72229
|
+
sliceTo,
|
|
72230
|
+
startContained,
|
|
72231
|
+
endContained,
|
|
72232
|
+
start: entryDebugInfo(startEntry),
|
|
72233
|
+
end: entryDebugInfo(endEntry)
|
|
72234
|
+
})}`
|
|
72235
|
+
);
|
|
72236
|
+
}
|
|
72092
72237
|
}
|
|
72093
|
-
if (!
|
|
72094
|
-
debugLog(
|
|
72238
|
+
if (!startContained || !endContained) {
|
|
72239
|
+
debugLog(
|
|
72240
|
+
"warn",
|
|
72241
|
+
`DOM selection rects: stale index after rebuild ${JSON.stringify({
|
|
72242
|
+
pageIndex,
|
|
72243
|
+
sliceFrom,
|
|
72244
|
+
sliceTo,
|
|
72245
|
+
start: entryDebugInfo(startEntry),
|
|
72246
|
+
end: entryDebugInfo(endEntry)
|
|
72247
|
+
})}`
|
|
72248
|
+
);
|
|
72095
72249
|
return null;
|
|
72096
72250
|
}
|
|
72097
72251
|
}
|
|
@@ -72106,8 +72260,83 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72106
72260
|
}
|
|
72107
72261
|
let clientRects = [];
|
|
72108
72262
|
try {
|
|
72109
|
-
|
|
72110
|
-
|
|
72263
|
+
let rawRects = Array.from(range2.getClientRects());
|
|
72264
|
+
if (dumpRects) {
|
|
72265
|
+
debugLog(
|
|
72266
|
+
"verbose",
|
|
72267
|
+
`DOM selection rects: raw rects ${JSON.stringify({
|
|
72268
|
+
pageIndex,
|
|
72269
|
+
sliceFrom,
|
|
72270
|
+
sliceTo,
|
|
72271
|
+
rects: rawRects.map(rectDebugInfo)
|
|
72272
|
+
})}`
|
|
72273
|
+
);
|
|
72274
|
+
}
|
|
72275
|
+
let missingEntries = null;
|
|
72276
|
+
if (typeof range2.intersectsNode === "function") {
|
|
72277
|
+
for (const entry of sliceEntries) {
|
|
72278
|
+
try {
|
|
72279
|
+
if (!range2.intersectsNode(entry.el)) {
|
|
72280
|
+
missingEntries ?? (missingEntries = []);
|
|
72281
|
+
missingEntries.push(entry);
|
|
72282
|
+
}
|
|
72283
|
+
} catch {
|
|
72284
|
+
}
|
|
72285
|
+
}
|
|
72286
|
+
}
|
|
72287
|
+
if (missingEntries && missingEntries.length > 0) {
|
|
72288
|
+
if (isVerbose) {
|
|
72289
|
+
debugLog(
|
|
72290
|
+
"verbose",
|
|
72291
|
+
`DOM selection rects: range missing entries ${JSON.stringify({
|
|
72292
|
+
pageIndex,
|
|
72293
|
+
sliceFrom,
|
|
72294
|
+
sliceTo,
|
|
72295
|
+
missingCount: missingEntries.length,
|
|
72296
|
+
missingPreview: missingEntries.slice(0, 20).map(entryDebugInfo)
|
|
72297
|
+
})}`
|
|
72298
|
+
);
|
|
72299
|
+
}
|
|
72300
|
+
rawRects = collectClientRectsByLine(doc2, sliceEntries, sliceFrom, sliceTo);
|
|
72301
|
+
if (dumpRects) {
|
|
72302
|
+
debugLog(
|
|
72303
|
+
"verbose",
|
|
72304
|
+
`DOM selection rects: fallback raw rects ${JSON.stringify({
|
|
72305
|
+
pageIndex,
|
|
72306
|
+
sliceFrom,
|
|
72307
|
+
sliceTo,
|
|
72308
|
+
rects: rawRects.map(rectDebugInfo)
|
|
72309
|
+
})}`
|
|
72310
|
+
);
|
|
72311
|
+
}
|
|
72312
|
+
}
|
|
72313
|
+
clientRects = disableRectDedupe ? rawRects : deduplicateOverlappingRects(rawRects);
|
|
72314
|
+
if (dumpRects) {
|
|
72315
|
+
debugLog(
|
|
72316
|
+
"verbose",
|
|
72317
|
+
`DOM selection rects: final rects ${JSON.stringify({
|
|
72318
|
+
pageIndex,
|
|
72319
|
+
sliceFrom,
|
|
72320
|
+
sliceTo,
|
|
72321
|
+
dedupeDisabled: disableRectDedupe,
|
|
72322
|
+
rects: clientRects.map(rectDebugInfo)
|
|
72323
|
+
})}`
|
|
72324
|
+
);
|
|
72325
|
+
const nonPositive = clientRects.filter(
|
|
72326
|
+
(rect) => !Number.isFinite(rect.width) || !Number.isFinite(rect.height) || rect.width <= 0 || rect.height <= 0
|
|
72327
|
+
);
|
|
72328
|
+
if (nonPositive.length > 0) {
|
|
72329
|
+
debugLog(
|
|
72330
|
+
"verbose",
|
|
72331
|
+
`DOM selection rects: non-positive rects ${JSON.stringify({
|
|
72332
|
+
pageIndex,
|
|
72333
|
+
sliceFrom,
|
|
72334
|
+
sliceTo,
|
|
72335
|
+
rects: nonPositive.map(rectDebugInfo)
|
|
72336
|
+
})}`
|
|
72337
|
+
);
|
|
72338
|
+
}
|
|
72339
|
+
}
|
|
72111
72340
|
} catch (error) {
|
|
72112
72341
|
debugLog("warn", "DOM selection rects: getClientRects failed", { error: String(error) });
|
|
72113
72342
|
return null;
|
|
@@ -72131,6 +72360,57 @@ function computeSelectionRectsFromDom(options, from2, to) {
|
|
|
72131
72360
|
}
|
|
72132
72361
|
return out;
|
|
72133
72362
|
}
|
|
72363
|
+
function collectClientRectsByLine(doc2, entries, sliceFrom, sliceTo) {
|
|
72364
|
+
const rects = [];
|
|
72365
|
+
const lineMap = /* @__PURE__ */ new Map();
|
|
72366
|
+
const looseEntries = [];
|
|
72367
|
+
for (const entry of entries) {
|
|
72368
|
+
const lineEl = entry.el.closest(".superdoc-line");
|
|
72369
|
+
if (!lineEl) {
|
|
72370
|
+
looseEntries.push(entry);
|
|
72371
|
+
continue;
|
|
72372
|
+
}
|
|
72373
|
+
const list = lineMap.get(lineEl);
|
|
72374
|
+
if (list) {
|
|
72375
|
+
list.push(entry);
|
|
72376
|
+
} else {
|
|
72377
|
+
lineMap.set(lineEl, [entry]);
|
|
72378
|
+
}
|
|
72379
|
+
}
|
|
72380
|
+
for (const [, lineEntries] of lineMap) {
|
|
72381
|
+
lineEntries.sort((a, b2) => a.pmStart - b2.pmStart !== 0 ? a.pmStart - b2.pmStart : a.pmEnd - b2.pmEnd);
|
|
72382
|
+
const linePmStart = lineEntries[0]?.pmStart ?? Infinity;
|
|
72383
|
+
const linePmEnd = lineEntries[lineEntries.length - 1]?.pmEnd ?? -Infinity;
|
|
72384
|
+
if (!Number.isFinite(linePmStart) || !Number.isFinite(linePmEnd) || linePmEnd <= linePmStart) continue;
|
|
72385
|
+
const lineFrom = Math.max(sliceFrom, linePmStart);
|
|
72386
|
+
const lineTo = Math.min(sliceTo, linePmEnd);
|
|
72387
|
+
if (lineFrom >= lineTo) continue;
|
|
72388
|
+
const startEntry = lineEntries.find((entry) => lineFrom >= entry.pmStart && lineFrom <= entry.pmEnd) ?? lineEntries[0];
|
|
72389
|
+
const endEntry = lineEntries.find((entry) => lineTo >= entry.pmStart && lineTo <= entry.pmEnd) ?? lineEntries[lineEntries.length - 1];
|
|
72390
|
+
const range2 = doc2.createRange();
|
|
72391
|
+
try {
|
|
72392
|
+
if (!setDomRangeStart(range2, startEntry, lineFrom)) continue;
|
|
72393
|
+
if (!setDomRangeEnd(range2, endEntry, lineTo)) continue;
|
|
72394
|
+
} catch {
|
|
72395
|
+
continue;
|
|
72396
|
+
}
|
|
72397
|
+
rects.push(...Array.from(range2.getClientRects()));
|
|
72398
|
+
}
|
|
72399
|
+
for (const entry of looseEntries) {
|
|
72400
|
+
const entryFrom = Math.max(sliceFrom, entry.pmStart);
|
|
72401
|
+
const entryTo = Math.min(sliceTo, entry.pmEnd);
|
|
72402
|
+
if (entryFrom >= entryTo) continue;
|
|
72403
|
+
const range2 = doc2.createRange();
|
|
72404
|
+
try {
|
|
72405
|
+
if (!setDomRangeStart(range2, entry, entryFrom)) continue;
|
|
72406
|
+
if (!setDomRangeEnd(range2, entry, entryTo)) continue;
|
|
72407
|
+
} catch {
|
|
72408
|
+
continue;
|
|
72409
|
+
}
|
|
72410
|
+
rects.push(...Array.from(range2.getClientRects()));
|
|
72411
|
+
}
|
|
72412
|
+
return rects;
|
|
72413
|
+
}
|
|
72134
72414
|
function setDomRangeStart(range2, entry, pos) {
|
|
72135
72415
|
const el = entry.el;
|
|
72136
72416
|
const pmStart = entry.pmStart;
|
|
@@ -72240,31 +72520,69 @@ function deduplicateOverlappingRects(rects) {
|
|
|
72240
72520
|
return a.x - b2.x;
|
|
72241
72521
|
});
|
|
72242
72522
|
const result = [];
|
|
72243
|
-
|
|
72244
|
-
|
|
72245
|
-
|
|
72246
|
-
|
|
72247
|
-
|
|
72248
|
-
|
|
72249
|
-
|
|
72250
|
-
|
|
72251
|
-
|
|
72252
|
-
|
|
72253
|
-
|
|
72254
|
-
|
|
72255
|
-
|
|
72256
|
-
|
|
72257
|
-
|
|
72258
|
-
|
|
72259
|
-
|
|
72260
|
-
|
|
72261
|
-
|
|
72262
|
-
|
|
72263
|
-
|
|
72523
|
+
const groups = [];
|
|
72524
|
+
let currentGroup = [];
|
|
72525
|
+
for (const rect of sorted) {
|
|
72526
|
+
if (currentGroup.length === 0) {
|
|
72527
|
+
currentGroup.push(rect);
|
|
72528
|
+
continue;
|
|
72529
|
+
}
|
|
72530
|
+
const groupY = currentGroup[0].y;
|
|
72531
|
+
if (Math.abs(rect.y - groupY) <= Y_SAME_LINE_THRESHOLD_PX) {
|
|
72532
|
+
currentGroup.push(rect);
|
|
72533
|
+
} else {
|
|
72534
|
+
groups.push(currentGroup);
|
|
72535
|
+
currentGroup = [rect];
|
|
72536
|
+
}
|
|
72537
|
+
}
|
|
72538
|
+
if (currentGroup.length > 0) {
|
|
72539
|
+
groups.push(currentGroup);
|
|
72540
|
+
}
|
|
72541
|
+
const SIZE_EPS_PX = 0.5;
|
|
72542
|
+
const X_DUPLICATE_EPS_PX = 1;
|
|
72543
|
+
const hasSignificantOverlap = (a, b2) => {
|
|
72544
|
+
const xOverlapStart = Math.max(a.x, b2.x);
|
|
72545
|
+
const xOverlapEnd = Math.min(a.x + a.width, b2.x + b2.width);
|
|
72546
|
+
const hasHorizontalOverlap = xOverlapEnd > xOverlapStart;
|
|
72547
|
+
if (!hasHorizontalOverlap) return false;
|
|
72548
|
+
const overlapWidth = Math.max(0, xOverlapEnd - xOverlapStart);
|
|
72549
|
+
const minWidth = Math.min(a.width, b2.width);
|
|
72550
|
+
return minWidth > 0 && overlapWidth / minWidth > HORIZONTAL_OVERLAP_THRESHOLD;
|
|
72551
|
+
};
|
|
72552
|
+
const isLargerRect = (a, b2) => {
|
|
72553
|
+
return a.width > b2.width + SIZE_EPS_PX || a.height > b2.height + SIZE_EPS_PX;
|
|
72554
|
+
};
|
|
72555
|
+
for (const group of groups) {
|
|
72556
|
+
const unique2 = [];
|
|
72557
|
+
for (const rect of group) {
|
|
72558
|
+
const isDuplicate = unique2.some((existing) => {
|
|
72559
|
+
const xClose = Math.abs(existing.x - rect.x) <= X_DUPLICATE_EPS_PX;
|
|
72560
|
+
const yClose = Math.abs(existing.y - rect.y) <= Y_SAME_LINE_THRESHOLD_PX;
|
|
72561
|
+
const widthClose = Math.abs(existing.width - rect.width) <= SIZE_EPS_PX;
|
|
72562
|
+
const heightClose = Math.abs(existing.height - rect.height) <= SIZE_EPS_PX;
|
|
72563
|
+
return xClose && yClose && widthClose && heightClose;
|
|
72564
|
+
});
|
|
72565
|
+
if (!isDuplicate) {
|
|
72566
|
+
unique2.push(rect);
|
|
72264
72567
|
}
|
|
72265
72568
|
}
|
|
72266
|
-
|
|
72267
|
-
|
|
72569
|
+
if (unique2.length <= 1) {
|
|
72570
|
+
result.push(...unique2);
|
|
72571
|
+
continue;
|
|
72572
|
+
}
|
|
72573
|
+
const containers = /* @__PURE__ */ new Set();
|
|
72574
|
+
for (const rect of unique2) {
|
|
72575
|
+
for (const other of unique2) {
|
|
72576
|
+
if (rect === other) continue;
|
|
72577
|
+
if (!hasSignificantOverlap(rect, other)) continue;
|
|
72578
|
+
if (isLargerRect(rect, other)) {
|
|
72579
|
+
containers.add(rect);
|
|
72580
|
+
break;
|
|
72581
|
+
}
|
|
72582
|
+
}
|
|
72583
|
+
}
|
|
72584
|
+
const filtered = unique2.filter((rect) => !containers.has(rect));
|
|
72585
|
+
result.push(...filtered.length > 0 ? filtered : unique2);
|
|
72268
72586
|
}
|
|
72269
72587
|
return result;
|
|
72270
72588
|
}
|
|
@@ -72388,10 +72706,11 @@ function safeCleanup(fn2, context) {
|
|
|
72388
72706
|
function createHiddenHost(doc2, widthPx) {
|
|
72389
72707
|
const host = doc2.createElement("div");
|
|
72390
72708
|
host.className = "presentation-editor__hidden-host";
|
|
72391
|
-
host.style.position = "
|
|
72709
|
+
host.style.position = "fixed";
|
|
72392
72710
|
host.style.left = "-9999px";
|
|
72393
72711
|
host.style.top = "0";
|
|
72394
72712
|
host.style.width = `${widthPx}px`;
|
|
72713
|
+
host.style.setProperty("overflow-anchor", "none");
|
|
72395
72714
|
host.style.pointerEvents = "none";
|
|
72396
72715
|
host.style.opacity = "0";
|
|
72397
72716
|
host.style.zIndex = "-1";
|
|
@@ -72865,7 +73184,8 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
72865
73184
|
});
|
|
72866
73185
|
let hitChain = [];
|
|
72867
73186
|
const doc2 = document;
|
|
72868
|
-
|
|
73187
|
+
const hasElementsFromPoint = typeof doc2.elementsFromPoint === "function";
|
|
73188
|
+
if (hasElementsFromPoint) {
|
|
72869
73189
|
try {
|
|
72870
73190
|
hitChain = doc2.elementsFromPoint(viewX, viewY) ?? [];
|
|
72871
73191
|
} catch {
|
|
@@ -72911,11 +73231,14 @@ function clickToPositionDom(domContainer, clientX, clientY) {
|
|
|
72911
73231
|
log("All fragments on page:", JSON.stringify(fragmentData, null, 2));
|
|
72912
73232
|
const fragmentEl = hitChain.find((el) => el.classList?.contains?.(CLASS_NAMES.fragment));
|
|
72913
73233
|
if (!fragmentEl) {
|
|
73234
|
+
if (hasElementsFromPoint) {
|
|
73235
|
+
return null;
|
|
73236
|
+
}
|
|
72914
73237
|
const fallbackFragment = pageEl.querySelector(`.${CLASS_NAMES.fragment}`);
|
|
72915
73238
|
if (!fallbackFragment) {
|
|
72916
73239
|
return null;
|
|
72917
73240
|
}
|
|
72918
|
-
log("Using fallback fragment:", {
|
|
73241
|
+
log("Using fallback fragment (no elementsFromPoint):", {
|
|
72919
73242
|
blockId: fallbackFragment.dataset.blockId,
|
|
72920
73243
|
pmStart: fallbackFragment.dataset.pmStart,
|
|
72921
73244
|
pmEnd: fallbackFragment.dataset.pmEnd
|
|
@@ -91722,7 +92045,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91722
92045
|
}
|
|
91723
92046
|
}
|
|
91724
92047
|
}
|
|
91725
|
-
editorDom2.focus(
|
|
92048
|
+
editorDom2.focus();
|
|
91726
92049
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91727
92050
|
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
91728
92051
|
return;
|
|
@@ -91789,7 +92112,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91789
92112
|
}
|
|
91790
92113
|
}
|
|
91791
92114
|
}
|
|
91792
|
-
editorDom2.focus(
|
|
92115
|
+
editorDom2.focus();
|
|
91793
92116
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91794
92117
|
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
91795
92118
|
}
|
|
@@ -91912,7 +92235,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91912
92235
|
}
|
|
91913
92236
|
const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
|
|
91914
92237
|
if (editorDom2) {
|
|
91915
|
-
editorDom2.focus(
|
|
92238
|
+
editorDom2.focus();
|
|
91916
92239
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91917
92240
|
}
|
|
91918
92241
|
return;
|
|
@@ -91945,6 +92268,25 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91945
92268
|
} else {
|
|
91946
92269
|
__privateSet(this, _dragExtensionMode, "char");
|
|
91947
92270
|
}
|
|
92271
|
+
debugLog(
|
|
92272
|
+
"verbose",
|
|
92273
|
+
`Drag selection start ${JSON.stringify({
|
|
92274
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: x2, y: y2 },
|
|
92275
|
+
clickDepth,
|
|
92276
|
+
extensionMode: __privateGet$1(this, _dragExtensionMode),
|
|
92277
|
+
anchor: __privateGet$1(this, _dragAnchor),
|
|
92278
|
+
anchorPageIndex: __privateGet$1(this, _dragAnchorPageIndex),
|
|
92279
|
+
rawHit: rawHit ? {
|
|
92280
|
+
pos: rawHit.pos,
|
|
92281
|
+
pageIndex: rawHit.pageIndex,
|
|
92282
|
+
blockId: rawHit.blockId,
|
|
92283
|
+
lineIndex: rawHit.lineIndex,
|
|
92284
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
92285
|
+
} : null,
|
|
92286
|
+
mapped: mapped ? mapped.ok ? { ok: true, pos: mapped.pos, fromEpoch: mapped.fromEpoch, toEpoch: mapped.toEpoch } : { ok: false, reason: mapped.reason, fromEpoch: mapped.fromEpoch, toEpoch: mapped.toEpoch } : null,
|
|
92287
|
+
hit: hit ? { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch } : null
|
|
92288
|
+
})}`
|
|
92289
|
+
);
|
|
91948
92290
|
if (typeof __privateGet$1(this, _viewportHost).setPointerCapture === "function") {
|
|
91949
92291
|
__privateGet$1(this, _viewportHost).setPointerCapture(event.pointerId);
|
|
91950
92292
|
}
|
|
@@ -91972,7 +92314,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91972
92314
|
if (!editorDom) {
|
|
91973
92315
|
return;
|
|
91974
92316
|
}
|
|
91975
|
-
editorDom.focus(
|
|
92317
|
+
editorDom.focus();
|
|
91976
92318
|
__privateGet$1(this, _editor3).view?.focus();
|
|
91977
92319
|
});
|
|
91978
92320
|
__privateAdd$1(this, _handlePointerMove, (event) => {
|
|
@@ -91981,6 +92323,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91981
92323
|
if (!normalized) return;
|
|
91982
92324
|
if (__privateGet$1(this, _isDragging) && __privateGet$1(this, _dragAnchor) !== null && event.buttons & 1) {
|
|
91983
92325
|
__privateSet(this, _pendingMarginClick, null);
|
|
92326
|
+
const prevPointer = __privateGet$1(this, _dragLastPointer);
|
|
92327
|
+
const prevRawHit = __privateGet$1(this, _dragLastRawHit);
|
|
91984
92328
|
__privateSet(this, _dragLastPointer, { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y });
|
|
91985
92329
|
const rawHit = clickToPosition(
|
|
91986
92330
|
__privateGet$1(this, _layoutState).layout,
|
|
@@ -91992,7 +92336,17 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
91992
92336
|
event.clientY,
|
|
91993
92337
|
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
91994
92338
|
);
|
|
91995
|
-
if (!rawHit)
|
|
92339
|
+
if (!rawHit) {
|
|
92340
|
+
debugLog(
|
|
92341
|
+
"verbose",
|
|
92342
|
+
`Drag selection update (no hit) ${JSON.stringify({
|
|
92343
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
92344
|
+
prevPointer,
|
|
92345
|
+
anchor: __privateGet$1(this, _dragAnchor)
|
|
92346
|
+
})}`
|
|
92347
|
+
);
|
|
92348
|
+
return;
|
|
92349
|
+
}
|
|
91996
92350
|
const doc22 = __privateGet$1(this, _editor3).state?.doc;
|
|
91997
92351
|
if (!doc22) return;
|
|
91998
92352
|
__privateSet(this, _dragLastRawHit, rawHit);
|
|
@@ -92005,6 +92359,27 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92005
92359
|
const mappedHead = __privateGet$1(this, _epochMapper).mapPosFromLayoutToCurrentDetailed(rawHit.pos, rawHit.layoutEpoch, 1);
|
|
92006
92360
|
if (!mappedHead.ok) {
|
|
92007
92361
|
debugLog("warn", "drag mapping failed", mappedHead);
|
|
92362
|
+
debugLog(
|
|
92363
|
+
"verbose",
|
|
92364
|
+
`Drag selection update (map failed) ${JSON.stringify({
|
|
92365
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
92366
|
+
prevPointer,
|
|
92367
|
+
anchor: __privateGet$1(this, _dragAnchor),
|
|
92368
|
+
rawHit: {
|
|
92369
|
+
pos: rawHit.pos,
|
|
92370
|
+
pageIndex: rawHit.pageIndex,
|
|
92371
|
+
blockId: rawHit.blockId,
|
|
92372
|
+
lineIndex: rawHit.lineIndex,
|
|
92373
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
92374
|
+
},
|
|
92375
|
+
mapped: {
|
|
92376
|
+
ok: false,
|
|
92377
|
+
reason: mappedHead.reason,
|
|
92378
|
+
fromEpoch: mappedHead.fromEpoch,
|
|
92379
|
+
toEpoch: mappedHead.toEpoch
|
|
92380
|
+
}
|
|
92381
|
+
})}`
|
|
92382
|
+
);
|
|
92008
92383
|
return;
|
|
92009
92384
|
}
|
|
92010
92385
|
const hit = {
|
|
@@ -92019,6 +92394,41 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92019
92394
|
mappedPos: hit.pos
|
|
92020
92395
|
});
|
|
92021
92396
|
__privateMethod$1(this, _PresentationEditor_instances, updateSelectionDebugHud_fn).call(this);
|
|
92397
|
+
const anchor = __privateGet$1(this, _dragAnchor);
|
|
92398
|
+
const head = hit.pos;
|
|
92399
|
+
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
92400
|
+
debugLog(
|
|
92401
|
+
"verbose",
|
|
92402
|
+
`Drag selection update ${JSON.stringify({
|
|
92403
|
+
pointer: { clientX: event.clientX, clientY: event.clientY, x: normalized.x, y: normalized.y },
|
|
92404
|
+
prevPointer,
|
|
92405
|
+
rawHit: {
|
|
92406
|
+
pos: rawHit.pos,
|
|
92407
|
+
pageIndex: rawHit.pageIndex,
|
|
92408
|
+
blockId: rawHit.blockId,
|
|
92409
|
+
lineIndex: rawHit.lineIndex,
|
|
92410
|
+
layoutEpoch: rawHit.layoutEpoch
|
|
92411
|
+
},
|
|
92412
|
+
prevRawHit: prevRawHit ? {
|
|
92413
|
+
pos: prevRawHit.pos,
|
|
92414
|
+
pageIndex: prevRawHit.pageIndex,
|
|
92415
|
+
blockId: prevRawHit.blockId,
|
|
92416
|
+
lineIndex: prevRawHit.lineIndex,
|
|
92417
|
+
layoutEpoch: prevRawHit.layoutEpoch
|
|
92418
|
+
} : null,
|
|
92419
|
+
mappedHead: { pos: mappedHead.pos, fromEpoch: mappedHead.fromEpoch, toEpoch: mappedHead.toEpoch },
|
|
92420
|
+
hit: { pos: hit.pos, pageIndex: hit.pageIndex, layoutEpoch: hit.layoutEpoch },
|
|
92421
|
+
anchor,
|
|
92422
|
+
head,
|
|
92423
|
+
selAnchor,
|
|
92424
|
+
selHead,
|
|
92425
|
+
direction: head >= anchor ? "down" : "up",
|
|
92426
|
+
selectionDirection: selHead >= selAnchor ? "down" : "up",
|
|
92427
|
+
extensionMode: __privateGet$1(this, _dragExtensionMode),
|
|
92428
|
+
hitSource: pageMounted ? "dom" : "geometry",
|
|
92429
|
+
pageMounted
|
|
92430
|
+
})}`
|
|
92431
|
+
);
|
|
92022
92432
|
const currentTableHit = __privateMethod$1(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
|
|
92023
92433
|
const shouldUseCellSel = __privateMethod$1(this, _PresentationEditor_instances, shouldUseCellSelection_fn).call(this, currentTableHit);
|
|
92024
92434
|
if (shouldUseCellSel && __privateGet$1(this, _cellAnchor)) {
|
|
@@ -92053,9 +92463,6 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92053
92463
|
return;
|
|
92054
92464
|
}
|
|
92055
92465
|
}
|
|
92056
|
-
const anchor = __privateGet$1(this, _dragAnchor);
|
|
92057
|
-
const head = hit.pos;
|
|
92058
|
-
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
92059
92466
|
try {
|
|
92060
92467
|
const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
|
|
92061
92468
|
__privateGet$1(this, _editor3).view?.dispatch(tr);
|
|
@@ -92450,6 +92857,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
92450
92857
|
editorProps: normalizedEditorProps,
|
|
92451
92858
|
documentMode: __privateGet$1(this, _documentMode)
|
|
92452
92859
|
}));
|
|
92860
|
+
__privateMethod$1(this, _PresentationEditor_instances, wrapHiddenEditorFocus_fn).call(this);
|
|
92453
92861
|
__privateGet$1(this, _editor3).presentationEditor = this;
|
|
92454
92862
|
__privateGet$1(this, _editor3)._presentationEditor = this;
|
|
92455
92863
|
__privateMethod$1(this, _PresentationEditor_instances, syncHiddenEditorA11yAttributes_fn).call(this);
|
|
@@ -93649,6 +94057,65 @@ _scrollTimeout = /* @__PURE__ */ new WeakMap();
|
|
|
93649
94057
|
_lastRemoteCursorRenderTime = /* @__PURE__ */ new WeakMap();
|
|
93650
94058
|
_remoteCursorThrottleTimeout = /* @__PURE__ */ new WeakMap();
|
|
93651
94059
|
_PresentationEditor_instances = /* @__PURE__ */ new WeakSet();
|
|
94060
|
+
wrapHiddenEditorFocus_fn = function() {
|
|
94061
|
+
const view = __privateGet$1(this, _editor3)?.view;
|
|
94062
|
+
if (!view || !view.dom || typeof view.focus !== "function") {
|
|
94063
|
+
return;
|
|
94064
|
+
}
|
|
94065
|
+
const viewWithFlag = view;
|
|
94066
|
+
if (viewWithFlag.__sdPreventScrollFocus) {
|
|
94067
|
+
return;
|
|
94068
|
+
}
|
|
94069
|
+
const focusFn = view.focus;
|
|
94070
|
+
if (focusFn.mock) {
|
|
94071
|
+
return;
|
|
94072
|
+
}
|
|
94073
|
+
viewWithFlag.__sdPreventScrollFocus = true;
|
|
94074
|
+
const originalFocus = view.focus.bind(view);
|
|
94075
|
+
view.focus = () => {
|
|
94076
|
+
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView;
|
|
94077
|
+
if (!win) {
|
|
94078
|
+
originalFocus();
|
|
94079
|
+
return;
|
|
94080
|
+
}
|
|
94081
|
+
const beforeX = win.scrollX;
|
|
94082
|
+
const beforeY = win.scrollY;
|
|
94083
|
+
let focused = false;
|
|
94084
|
+
try {
|
|
94085
|
+
view.dom.focus({ preventScroll: true });
|
|
94086
|
+
focused = true;
|
|
94087
|
+
} catch (error) {
|
|
94088
|
+
debugLog("warn", "Hidden editor focus: preventScroll failed", {
|
|
94089
|
+
error: String(error),
|
|
94090
|
+
strategy: "preventScroll"
|
|
94091
|
+
});
|
|
94092
|
+
}
|
|
94093
|
+
if (!focused) {
|
|
94094
|
+
try {
|
|
94095
|
+
view.dom.focus();
|
|
94096
|
+
focused = true;
|
|
94097
|
+
} catch (error) {
|
|
94098
|
+
debugLog("warn", "Hidden editor focus: standard focus failed", {
|
|
94099
|
+
error: String(error),
|
|
94100
|
+
strategy: "standard"
|
|
94101
|
+
});
|
|
94102
|
+
}
|
|
94103
|
+
}
|
|
94104
|
+
if (!focused) {
|
|
94105
|
+
try {
|
|
94106
|
+
originalFocus();
|
|
94107
|
+
} catch (error) {
|
|
94108
|
+
debugLog("error", "Hidden editor focus: all strategies failed", {
|
|
94109
|
+
error: String(error),
|
|
94110
|
+
strategy: "original"
|
|
94111
|
+
});
|
|
94112
|
+
}
|
|
94113
|
+
}
|
|
94114
|
+
if (win.scrollX !== beforeX || win.scrollY !== beforeY) {
|
|
94115
|
+
win.scrollTo(beforeX, beforeY);
|
|
94116
|
+
}
|
|
94117
|
+
};
|
|
94118
|
+
};
|
|
93652
94119
|
collectCommentPositions_fn = function() {
|
|
93653
94120
|
return collectCommentPositions(__privateGet$1(this, _editor3)?.state?.doc ?? null, {
|
|
93654
94121
|
commentMarkName: CommentMarkName,
|
|
@@ -94050,7 +94517,7 @@ focusEditorAfterImageSelection_fn = function() {
|
|
|
94050
94517
|
}
|
|
94051
94518
|
const editorDom = __privateGet$1(this, _editor3).view?.dom;
|
|
94052
94519
|
if (editorDom) {
|
|
94053
|
-
editorDom.focus(
|
|
94520
|
+
editorDom.focus();
|
|
94054
94521
|
__privateGet$1(this, _editor3).view?.focus();
|
|
94055
94522
|
}
|
|
94056
94523
|
};
|