@harbour-enterprises/superdoc 1.0.0-beta.65 → 1.0.0-beta.67
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-CPtbSOs5.cjs → PdfViewer-DTK306FZ.cjs} +1 -1
- package/dist/chunks/{PdfViewer-CqHxrRM3.es.js → PdfViewer-P0cvxvjh.es.js} +1 -1
- package/dist/chunks/{index-DWJXw-IX.cjs → index-BNGG0zf5.cjs} +3 -3
- package/dist/chunks/{index-YSWS94Jr-BeHINTZ9.es.js → index-Cixgd5bX-39fIJYpL.es.js} +1 -1
- package/dist/chunks/{index-YSWS94Jr-C7xFStTB.cjs → index-Cixgd5bX-ByqITVZq.cjs} +1 -1
- package/dist/chunks/{index-BUvQNe-T.es.js → index-U-bzTPNb.es.js} +3 -3
- package/dist/chunks/{super-editor.es-DaC-R5gx.es.js → super-editor.es-CIPQg4rG.es.js} +386 -158
- package/dist/chunks/{super-editor.es-BHjskxiY.cjs → super-editor.es-DKbuo7ju.cjs} +386 -158
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DIAStmht.js → converter-BLNx019v.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-DK-wWQD9.js → docx-zipper-BfQBQQz_.js} +1 -1
- package/dist/super-editor/chunks/{editor-CxKPNxhs.js → editor-5RSp-DNd.js} +536 -97
- package/dist/super-editor/chunks/{index-YSWS94Jr.js → index-Cixgd5bX.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-D7ZHiSKZ.js → toolbar-Db_-z4Fa.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 +388 -160
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -42327,7 +42327,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
42327
42327
|
static getStoredSuperdocVersion(docx) {
|
|
42328
42328
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42329
42329
|
}
|
|
42330
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42330
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.67") {
|
|
42331
42331
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42332
42332
|
}
|
|
42333
42333
|
/**
|
|
@@ -53496,7 +53496,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
53496
53496
|
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);
|
|
53497
53497
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
53498
53498
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
53499
|
-
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, _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, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _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, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _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, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn,
|
|
53499
|
+
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, _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, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _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, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _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, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, applyDomCorrectionToRects_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _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, _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;
|
|
53500
53500
|
var GOOD_LEAF_SIZE = 200;
|
|
53501
53501
|
var RopeSequence = function RopeSequence2() {
|
|
53502
53502
|
};
|
|
@@ -67373,7 +67373,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67373
67373
|
const shouldSkipNodeView = (editor) => {
|
|
67374
67374
|
return isHeadless(editor);
|
|
67375
67375
|
};
|
|
67376
|
-
const summaryVersion = "1.0.0-beta.
|
|
67376
|
+
const summaryVersion = "1.0.0-beta.67";
|
|
67377
67377
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
67378
67378
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
67379
67379
|
function mapAttributes(attrs) {
|
|
@@ -68162,7 +68162,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68162
68162
|
{ default: remarkStringify2 },
|
|
68163
68163
|
{ default: remarkGfm2 }
|
|
68164
68164
|
] = await Promise.all([
|
|
68165
|
-
Promise.resolve().then(() =>
|
|
68165
|
+
Promise.resolve().then(() => indexCixgd5bX),
|
|
68166
68166
|
Promise.resolve().then(() => indexDRCvimau),
|
|
68167
68167
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
68168
68168
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -68367,7 +68367,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68367
68367
|
* Process collaboration migrations
|
|
68368
68368
|
*/
|
|
68369
68369
|
processCollaborationMigrations() {
|
|
68370
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
68370
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.67");
|
|
68371
68371
|
if (!this.options.ydoc) return;
|
|
68372
68372
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
68373
68373
|
let docVersion = metaMap.get("version");
|
|
@@ -75872,6 +75872,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75872
75872
|
let measurementCanvas = null;
|
|
75873
75873
|
let measurementCtx = null;
|
|
75874
75874
|
const TAB_CHAR_LENGTH = 1;
|
|
75875
|
+
const SPACE_CHARS = /* @__PURE__ */ new Set([" ", " "]);
|
|
75875
75876
|
const isTabRun$1 = (run2) => run2?.kind === "tab";
|
|
75876
75877
|
function getMeasurementContext() {
|
|
75877
75878
|
if (measurementCtx) return measurementCtx;
|
|
@@ -75888,6 +75889,41 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75888
75889
|
}
|
|
75889
75890
|
return measurementCtx;
|
|
75890
75891
|
}
|
|
75892
|
+
const countSpaces = (text2) => {
|
|
75893
|
+
let spaces = 0;
|
|
75894
|
+
for (let i2 = 0; i2 < text2.length; i2 += 1) {
|
|
75895
|
+
if (SPACE_CHARS.has(text2[i2])) {
|
|
75896
|
+
spaces += 1;
|
|
75897
|
+
}
|
|
75898
|
+
}
|
|
75899
|
+
return spaces;
|
|
75900
|
+
};
|
|
75901
|
+
const getJustifyAdjustment = (block, line, availableWidthOverride) => {
|
|
75902
|
+
if (block.kind !== "paragraph") {
|
|
75903
|
+
return { extraPerSpace: 0, totalSpaces: 0 };
|
|
75904
|
+
}
|
|
75905
|
+
const alignment2 = block.attrs?.alignment;
|
|
75906
|
+
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
75907
|
+
const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
|
|
75908
|
+
const slack = Math.max(0, availableWidth - line.width);
|
|
75909
|
+
if (alignment2 !== "justify" || hasExplicitPositioning || slack <= 0) {
|
|
75910
|
+
return { extraPerSpace: 0, totalSpaces: 0 };
|
|
75911
|
+
}
|
|
75912
|
+
const runs2 = sliceRunsForLine$1(block, line);
|
|
75913
|
+
const totalSpaces = runs2.reduce((sum, run2) => {
|
|
75914
|
+
if (isTabRun$1(run2) || "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation") {
|
|
75915
|
+
return sum;
|
|
75916
|
+
}
|
|
75917
|
+
return sum + countSpaces(run2.text ?? "");
|
|
75918
|
+
}, 0);
|
|
75919
|
+
if (totalSpaces <= 0) {
|
|
75920
|
+
return { extraPerSpace: 0, totalSpaces: 0 };
|
|
75921
|
+
}
|
|
75922
|
+
return {
|
|
75923
|
+
extraPerSpace: slack / totalSpaces,
|
|
75924
|
+
totalSpaces
|
|
75925
|
+
};
|
|
75926
|
+
};
|
|
75891
75927
|
function getRunFontString(run2) {
|
|
75892
75928
|
if (run2.kind === "tab" || run2.kind === "lineBreak" || run2.kind === "break" || run2.kind === "fieldAnnotation" || "src" in run2) {
|
|
75893
75929
|
return "normal normal 16px Arial";
|
|
@@ -75945,9 +75981,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75945
75981
|
}
|
|
75946
75982
|
return result;
|
|
75947
75983
|
}
|
|
75948
|
-
function measureCharacterX(block, line, charOffset) {
|
|
75984
|
+
function measureCharacterX(block, line, charOffset, availableWidthOverride) {
|
|
75949
75985
|
const ctx2 = getMeasurementContext();
|
|
75986
|
+
const availableWidth = availableWidthOverride ?? line.maxWidth ?? // Fallback: if no maxWidth, approximate available width as line width (no slack)
|
|
75987
|
+
line.width;
|
|
75988
|
+
const justify = getJustifyAdjustment(block, line, availableWidth);
|
|
75989
|
+
const renderedLineWidth = line.width + Math.max(0, availableWidth - line.width);
|
|
75990
|
+
const alignment2 = block.kind === "paragraph" ? block.attrs?.alignment : void 0;
|
|
75950
75991
|
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
75992
|
+
const alignmentOffset = !hasExplicitPositioning && alignment2 === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment2 === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
|
|
75951
75993
|
if (hasExplicitPositioning && line.segments && ctx2) {
|
|
75952
75994
|
return measureCharacterXSegmentBased(block, line, charOffset, ctx2);
|
|
75953
75995
|
}
|
|
@@ -75962,11 +76004,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75962
76004
|
return sum + (run2.text ?? "").length;
|
|
75963
76005
|
}, 0)
|
|
75964
76006
|
);
|
|
75965
|
-
return charOffset / charsInLine *
|
|
76007
|
+
return charOffset / charsInLine * renderedLineWidth;
|
|
75966
76008
|
}
|
|
75967
76009
|
const runs2 = sliceRunsForLine$1(block, line);
|
|
75968
76010
|
let currentX = 0;
|
|
75969
76011
|
let currentCharOffset = 0;
|
|
76012
|
+
let spaceTally = 0;
|
|
75970
76013
|
for (const run2 of runs2) {
|
|
75971
76014
|
if (isTabRun$1(run2)) {
|
|
75972
76015
|
const runLength2 = TAB_CHAR_LENGTH;
|
|
@@ -75987,14 +76030,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75987
76030
|
const textUpToTarget = text2.slice(0, offsetInRun);
|
|
75988
76031
|
const measured2 = ctx2.measureText(textUpToTarget);
|
|
75989
76032
|
const spacingWidth = computeLetterSpacingWidth(run2, offsetInRun, runLength);
|
|
75990
|
-
|
|
76033
|
+
const spacesInPortion = justify.extraPerSpace > 0 ? countSpaces(textUpToTarget) : 0;
|
|
76034
|
+
return alignmentOffset + currentX + measured2.width + spacingWidth + justify.extraPerSpace * (spaceTally + spacesInPortion);
|
|
75991
76035
|
}
|
|
75992
76036
|
ctx2.font = getRunFontString(run2);
|
|
75993
76037
|
const measured = ctx2.measureText(text2);
|
|
75994
|
-
|
|
76038
|
+
const runLetterSpacing = computeLetterSpacingWidth(run2, runLength, runLength);
|
|
76039
|
+
const spacesInRun = justify.extraPerSpace > 0 ? countSpaces(text2) : 0;
|
|
76040
|
+
currentX += measured.width + runLetterSpacing + justify.extraPerSpace * spacesInRun;
|
|
76041
|
+
spaceTally += spacesInRun;
|
|
75995
76042
|
currentCharOffset += runLength;
|
|
75996
76043
|
}
|
|
75997
|
-
return currentX;
|
|
76044
|
+
return alignmentOffset + currentX;
|
|
75998
76045
|
}
|
|
75999
76046
|
function measureCharacterXSegmentBased(block, line, charOffset, ctx2) {
|
|
76000
76047
|
if (block.kind !== "paragraph" || !line.segments) return 0;
|
|
@@ -76069,8 +76116,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76069
76116
|
}
|
|
76070
76117
|
return lastPm;
|
|
76071
76118
|
}
|
|
76072
|
-
function findCharacterAtX(block, line, x2, pmStart) {
|
|
76119
|
+
function findCharacterAtX(block, line, x2, pmStart, availableWidthOverride) {
|
|
76073
76120
|
const ctx2 = getMeasurementContext();
|
|
76121
|
+
const availableWidth = availableWidthOverride ?? line.maxWidth ?? // Fallback: approximate with line width when no maxWidth is present
|
|
76122
|
+
line.width;
|
|
76123
|
+
const justify = getJustifyAdjustment(block, line, availableWidth);
|
|
76124
|
+
const renderedLineWidth = line.width + Math.max(0, availableWidth - line.width);
|
|
76125
|
+
const alignment2 = block.kind === "paragraph" ? block.attrs?.alignment : void 0;
|
|
76126
|
+
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
76127
|
+
const alignmentOffset = !hasExplicitPositioning && alignment2 === "center" ? Math.max(0, (availableWidth - renderedLineWidth) / 2) : !hasExplicitPositioning && alignment2 === "right" ? Math.max(0, availableWidth - renderedLineWidth) : 0;
|
|
76074
76128
|
if (!ctx2) {
|
|
76075
76129
|
const runs22 = sliceRunsForLine$1(block, line);
|
|
76076
76130
|
const charsInLine = Math.max(
|
|
@@ -76082,7 +76136,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76082
76136
|
return sum + (run2.text ?? "").length;
|
|
76083
76137
|
}, 0)
|
|
76084
76138
|
);
|
|
76085
|
-
const ratio = Math.max(0, Math.min(1, x2 /
|
|
76139
|
+
const ratio = Math.max(0, Math.min(1, (x2 - alignmentOffset) / renderedLineWidth));
|
|
76086
76140
|
const charOffset = Math.round(ratio * charsInLine);
|
|
76087
76141
|
const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
|
|
76088
76142
|
return {
|
|
@@ -76091,9 +76145,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76091
76145
|
};
|
|
76092
76146
|
}
|
|
76093
76147
|
const runs2 = sliceRunsForLine$1(block, line);
|
|
76094
|
-
const safeX = Math.max(0, Math.min(
|
|
76148
|
+
const safeX = Math.max(0, Math.min(renderedLineWidth, x2 - alignmentOffset));
|
|
76095
76149
|
let currentX = 0;
|
|
76096
76150
|
let currentCharOffset = 0;
|
|
76151
|
+
let spaceTally = 0;
|
|
76097
76152
|
for (const run2 of runs2) {
|
|
76098
76153
|
if (isTabRun$1(run2)) {
|
|
76099
76154
|
const tabWidth = run2.width ?? 0;
|
|
@@ -76120,7 +76175,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76120
76175
|
for (let i2 = 0; i2 <= runLength; i2++) {
|
|
76121
76176
|
const textUpToChar = text2.slice(0, i2);
|
|
76122
76177
|
const measured2 = ctx2.measureText(textUpToChar);
|
|
76123
|
-
const
|
|
76178
|
+
const spacesInPortion = justify.extraPerSpace > 0 ? countSpaces(textUpToChar) : 0;
|
|
76179
|
+
const charX = currentX + measured2.width + computeLetterSpacingWidth(run2, i2, runLength) + justify.extraPerSpace * (spaceTally + spacesInPortion);
|
|
76124
76180
|
if (charX >= safeX) {
|
|
76125
76181
|
if (i2 === 0) {
|
|
76126
76182
|
const pmPosition3 = charOffsetToPm(block, line, currentCharOffset, pmStart);
|
|
@@ -76143,7 +76199,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76143
76199
|
}
|
|
76144
76200
|
}
|
|
76145
76201
|
const measured = ctx2.measureText(text2);
|
|
76146
|
-
|
|
76202
|
+
const runLetterSpacing = computeLetterSpacingWidth(run2, runLength, runLength);
|
|
76203
|
+
const spacesInRun = justify.extraPerSpace > 0 ? countSpaces(text2) : 0;
|
|
76204
|
+
currentX += measured.width + runLetterSpacing + justify.extraPerSpace * spacesInRun;
|
|
76205
|
+
spaceTally += spacesInRun;
|
|
76147
76206
|
currentCharOffset += runLength;
|
|
76148
76207
|
}
|
|
76149
76208
|
const pmPosition = charOffsetToPm(block, line, currentCharOffset, pmStart);
|
|
@@ -88760,7 +88819,18 @@ ${l}
|
|
|
88760
88819
|
}
|
|
88761
88820
|
const line = measure.lines[lineIndex];
|
|
88762
88821
|
const isRTL = isRtlBlock(block);
|
|
88763
|
-
const
|
|
88822
|
+
const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
|
|
88823
|
+
const indentRight = typeof block.attrs?.indent?.right === "number" ? block.attrs.indent.right : 0;
|
|
88824
|
+
const paraIndentLeft = Number.isFinite(indentLeft) ? indentLeft : 0;
|
|
88825
|
+
const paraIndentRight = Number.isFinite(indentRight) ? indentRight : 0;
|
|
88826
|
+
const totalIndent = paraIndentLeft + paraIndentRight;
|
|
88827
|
+
const availableWidth = Math.max(0, fragment.width - totalIndent);
|
|
88828
|
+
if (totalIndent > fragment.width) {
|
|
88829
|
+
console.warn(
|
|
88830
|
+
`[clickToPosition] Paragraph indents (${totalIndent}px) exceed fragment width (${fragment.width}px) for block ${fragment.blockId}. This may indicate a layout miscalculation. Available width clamped to 0.`
|
|
88831
|
+
);
|
|
88832
|
+
}
|
|
88833
|
+
const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth);
|
|
88764
88834
|
if (pos == null) {
|
|
88765
88835
|
logClickStage("warn", "no-position", {
|
|
88766
88836
|
blockId: fragment.blockId
|
|
@@ -88791,7 +88861,18 @@ ${l}
|
|
|
88791
88861
|
if (lineIndex != null) {
|
|
88792
88862
|
const line = cellMeasure.lines[lineIndex];
|
|
88793
88863
|
const isRTL = isRtlBlock(cellBlock);
|
|
88794
|
-
const
|
|
88864
|
+
const indentLeft = typeof cellBlock.attrs?.indent?.left === "number" ? cellBlock.attrs.indent.left : 0;
|
|
88865
|
+
const indentRight = typeof cellBlock.attrs?.indent?.right === "number" ? cellBlock.attrs.indent.right : 0;
|
|
88866
|
+
const paraIndentLeft = Number.isFinite(indentLeft) ? indentLeft : 0;
|
|
88867
|
+
const paraIndentRight = Number.isFinite(indentRight) ? indentRight : 0;
|
|
88868
|
+
const totalIndent = paraIndentLeft + paraIndentRight;
|
|
88869
|
+
const availableWidth = Math.max(0, tableHit.fragment.width - totalIndent);
|
|
88870
|
+
if (totalIndent > tableHit.fragment.width) {
|
|
88871
|
+
console.warn(
|
|
88872
|
+
`[clickToPosition:table] Paragraph indents (${totalIndent}px) exceed fragment width (${tableHit.fragment.width}px) for block ${tableHit.fragment.blockId}. This may indicate a layout miscalculation. Available width clamped to 0.`
|
|
88873
|
+
);
|
|
88874
|
+
}
|
|
88875
|
+
const pos = mapPointToPm(cellBlock, line, localX, isRTL, availableWidth);
|
|
88795
88876
|
if (pos != null) {
|
|
88796
88877
|
logClickStage("log", "success", {
|
|
88797
88878
|
blockId: tableHit.fragment.blockId,
|
|
@@ -88950,7 +89031,15 @@ ${l}
|
|
|
88950
89031
|
const startX = mapPmToX(block, line, charOffsetFrom, fragment.width);
|
|
88951
89032
|
const endX = mapPmToX(block, line, charOffsetTo, fragment.width);
|
|
88952
89033
|
const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
88953
|
-
const
|
|
89034
|
+
const paraIndentLeft = block.attrs?.indent?.left ?? 0;
|
|
89035
|
+
const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
|
|
89036
|
+
const isFirstLine = index2 === fragment.fromLine;
|
|
89037
|
+
const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && (fragment.markerWidth ?? 0) > 0;
|
|
89038
|
+
let indentAdjust = 0;
|
|
89039
|
+
if (!isListFirstLine) {
|
|
89040
|
+
indentAdjust = paraIndentLeft + (isFirstLine ? firstLineOffset : 0);
|
|
89041
|
+
}
|
|
89042
|
+
const rectX = fragment.x + markerWidth + indentAdjust + Math.min(startX, endX);
|
|
88954
89043
|
const rectWidth = Math.max(1, Math.abs(endX - startX));
|
|
88955
89044
|
const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
|
|
88956
89045
|
const rectY = fragment.y + lineOffset;
|
|
@@ -89326,11 +89415,11 @@ ${l}
|
|
|
89326
89415
|
}
|
|
89327
89416
|
return height;
|
|
89328
89417
|
};
|
|
89329
|
-
const mapPointToPm = (block, line, x2, isRTL) => {
|
|
89418
|
+
const mapPointToPm = (block, line, x2, isRTL, availableWidthOverride) => {
|
|
89330
89419
|
if (block.kind !== "paragraph") return null;
|
|
89331
89420
|
const range2 = computeLinePmRange(block, line);
|
|
89332
89421
|
if (range2.pmStart == null || range2.pmEnd == null) return null;
|
|
89333
|
-
const result = findCharacterAtX(block, line, x2, range2.pmStart);
|
|
89422
|
+
const result = findCharacterAtX(block, line, x2, range2.pmStart, availableWidthOverride);
|
|
89334
89423
|
if (isRTL) {
|
|
89335
89424
|
const charOffset = result.charOffset;
|
|
89336
89425
|
const charsInLine = Math.max(1, line.toChar - line.fromChar);
|
|
@@ -89341,7 +89430,22 @@ ${l}
|
|
|
89341
89430
|
};
|
|
89342
89431
|
const mapPmToX = (block, line, offset2, fragmentWidth) => {
|
|
89343
89432
|
if (fragmentWidth <= 0 || line.width <= 0) return 0;
|
|
89344
|
-
|
|
89433
|
+
let paraIndentLeft = 0;
|
|
89434
|
+
let paraIndentRight = 0;
|
|
89435
|
+
if (block.kind === "paragraph") {
|
|
89436
|
+
const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
|
|
89437
|
+
const indentRight = typeof block.attrs?.indent?.right === "number" ? block.attrs.indent.right : 0;
|
|
89438
|
+
paraIndentLeft = Number.isFinite(indentLeft) ? indentLeft : 0;
|
|
89439
|
+
paraIndentRight = Number.isFinite(indentRight) ? indentRight : 0;
|
|
89440
|
+
}
|
|
89441
|
+
const totalIndent = paraIndentLeft + paraIndentRight;
|
|
89442
|
+
const availableWidth = Math.max(0, fragmentWidth - totalIndent);
|
|
89443
|
+
if (totalIndent > fragmentWidth) {
|
|
89444
|
+
console.warn(
|
|
89445
|
+
`[mapPmToX] Paragraph indents (${totalIndent}px) exceed fragment width (${fragmentWidth}px) for block ${block.id}. This may indicate a layout miscalculation. Available width clamped to 0.`
|
|
89446
|
+
);
|
|
89447
|
+
}
|
|
89448
|
+
return measureCharacterX(block, line, offset2, availableWidth);
|
|
89345
89449
|
};
|
|
89346
89450
|
const isRtlBlock = (block) => {
|
|
89347
89451
|
if (block.kind !== "paragraph") return false;
|
|
@@ -92006,29 +92110,16 @@ ${l}
|
|
|
92006
92110
|
}
|
|
92007
92111
|
return editorHost;
|
|
92008
92112
|
};
|
|
92009
|
-
positionEditorHost_fn = function(editorHost, region, decorationContainer,
|
|
92113
|
+
positionEditorHost_fn = function(editorHost, region, decorationContainer, _zoom) {
|
|
92010
92114
|
const pageElement = editorHost.parentElement;
|
|
92011
92115
|
if (!pageElement) {
|
|
92012
92116
|
console.error("[EditorOverlayManager] Editor host has no parent element");
|
|
92013
92117
|
return;
|
|
92014
92118
|
}
|
|
92015
|
-
|
|
92016
|
-
|
|
92017
|
-
|
|
92018
|
-
|
|
92019
|
-
if (decorationContainer) {
|
|
92020
|
-
const decorationRect = decorationContainer.getBoundingClientRect();
|
|
92021
|
-
const pageRect = pageElement.getBoundingClientRect();
|
|
92022
|
-
top2 = decorationRect.top - pageRect.top;
|
|
92023
|
-
left2 = decorationRect.left - pageRect.left;
|
|
92024
|
-
width = decorationRect.width;
|
|
92025
|
-
height = decorationRect.height;
|
|
92026
|
-
} else {
|
|
92027
|
-
top2 = region.localY * zoom;
|
|
92028
|
-
left2 = region.localX * zoom;
|
|
92029
|
-
width = region.width * zoom;
|
|
92030
|
-
height = region.height * zoom;
|
|
92031
|
-
}
|
|
92119
|
+
const top2 = decorationContainer?.offsetTop ?? region.localY;
|
|
92120
|
+
const left2 = decorationContainer?.offsetLeft ?? region.localX;
|
|
92121
|
+
const width = decorationContainer?.offsetWidth ?? region.width;
|
|
92122
|
+
const height = decorationContainer?.offsetHeight ?? region.height;
|
|
92032
92123
|
Object.assign(editorHost.style, {
|
|
92033
92124
|
top: `${top2}px`,
|
|
92034
92125
|
left: `${left2}px`,
|
|
@@ -92043,19 +92134,14 @@ ${l}
|
|
|
92043
92134
|
}
|
|
92044
92135
|
}
|
|
92045
92136
|
};
|
|
92046
|
-
showHeaderFooterBorder_fn = function(pageElement, region, decorationContainer,
|
|
92137
|
+
showHeaderFooterBorder_fn = function(pageElement, region, decorationContainer, _zoom) {
|
|
92047
92138
|
__privateMethod$1(this, _EditorOverlayManager_instances, hideHeaderFooterBorder_fn).call(this);
|
|
92048
92139
|
__privateSet(this, _borderLine, document.createElement("div"));
|
|
92049
92140
|
__privateGet$1(this, _borderLine).className = "superdoc-header-footer-border";
|
|
92050
|
-
let topPosition;
|
|
92051
92141
|
const isHeader = region.kind === "header";
|
|
92052
|
-
|
|
92053
|
-
|
|
92054
|
-
|
|
92055
|
-
topPosition = isHeader ? decorationRect.bottom - pageRect.top : decorationRect.top - pageRect.top;
|
|
92056
|
-
} else {
|
|
92057
|
-
topPosition = isHeader ? (region.localY + region.height) * zoom : region.localY * zoom;
|
|
92058
|
-
}
|
|
92142
|
+
const decorationTop = decorationContainer?.offsetTop;
|
|
92143
|
+
const decorationHeight = decorationContainer?.offsetHeight;
|
|
92144
|
+
const topPosition = isHeader ? decorationTop != null && decorationHeight != null ? decorationTop + decorationHeight : region.localY + region.height : decorationTop ?? region.localY;
|
|
92059
92145
|
Object.assign(__privateGet$1(this, _borderLine).style, {
|
|
92060
92146
|
position: "absolute",
|
|
92061
92147
|
left: "0",
|
|
@@ -93168,8 +93254,10 @@ ${l}
|
|
|
93168
93254
|
const start2 = Math.min(from2, to);
|
|
93169
93255
|
const end2 = Math.max(from2, to);
|
|
93170
93256
|
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
93171
|
-
const overlayRect = __privateGet$1(this, _selectionOverlay2).getBoundingClientRect();
|
|
93172
93257
|
const relativeRect = relativeTo?.getBoundingClientRect() ?? null;
|
|
93258
|
+
const containerRect = __privateGet$1(this, _visibleHost).getBoundingClientRect();
|
|
93259
|
+
const scrollLeft = __privateGet$1(this, _visibleHost).scrollLeft ?? 0;
|
|
93260
|
+
const scrollTop = __privateGet$1(this, _visibleHost).scrollTop ?? 0;
|
|
93173
93261
|
const layoutRectSource = () => {
|
|
93174
93262
|
if (__privateGet$1(this, _session).mode !== "body") {
|
|
93175
93263
|
return __privateMethod$1(this, _PresentationEditor_instances, computeHeaderFooterSelectionRects_fn).call(this, start2, end2);
|
|
@@ -93180,14 +93268,46 @@ ${l}
|
|
|
93180
93268
|
};
|
|
93181
93269
|
const rawRects = layoutRectSource();
|
|
93182
93270
|
if (!rawRects.length) return [];
|
|
93271
|
+
let domCaretStart = null;
|
|
93272
|
+
let domCaretEnd = null;
|
|
93273
|
+
try {
|
|
93274
|
+
domCaretStart = __privateMethod$1(this, _PresentationEditor_instances, computeDomCaretPageLocal_fn).call(this, start2);
|
|
93275
|
+
domCaretEnd = __privateMethod$1(this, _PresentationEditor_instances, computeDomCaretPageLocal_fn).call(this, end2);
|
|
93276
|
+
} catch (error) {
|
|
93277
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
93278
|
+
console.warn("[PresentationEditor] DOM caret computation failed in getRectsForRange:", error);
|
|
93279
|
+
}
|
|
93280
|
+
}
|
|
93281
|
+
const layoutCaretStart = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRectGeometry_fn).call(this, start2, false);
|
|
93282
|
+
__privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRectGeometry_fn).call(this, end2, false);
|
|
93283
|
+
const pageDelta = {};
|
|
93284
|
+
if (domCaretStart && layoutCaretStart && domCaretStart.pageIndex === layoutCaretStart.pageIndex) {
|
|
93285
|
+
pageDelta[domCaretStart.pageIndex] = {
|
|
93286
|
+
dx: domCaretStart.x - layoutCaretStart.x,
|
|
93287
|
+
dy: domCaretStart.y - layoutCaretStart.y
|
|
93288
|
+
};
|
|
93289
|
+
}
|
|
93183
93290
|
const pageHeight = __privateGet$1(this, _session).mode === "body" ? __privateMethod$1(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this) : __privateMethod$1(this, _PresentationEditor_instances, getHeaderFooterPageHeight_fn).call(this);
|
|
93184
93291
|
const pageGap = __privateGet$1(this, _layoutState).layout?.pageGap ?? 0;
|
|
93185
|
-
|
|
93186
|
-
const
|
|
93187
|
-
|
|
93292
|
+
const finalRects = rawRects.map((rect, idx, allRects) => {
|
|
93293
|
+
const delta = pageDelta[rect.pageIndex];
|
|
93294
|
+
let adjustedX = delta ? rect.x + delta.dx : rect.x;
|
|
93295
|
+
const adjustedY = delta ? rect.y + delta.dy : rect.y;
|
|
93296
|
+
const isFirstRect = idx === 0;
|
|
93297
|
+
const isLastRect = idx === allRects.length - 1;
|
|
93298
|
+
if (isFirstRect && domCaretStart && rect.pageIndex === domCaretStart.pageIndex) {
|
|
93299
|
+
adjustedX = domCaretStart.x;
|
|
93300
|
+
}
|
|
93301
|
+
if (isLastRect && domCaretEnd && rect.pageIndex === domCaretEnd.pageIndex) {
|
|
93302
|
+
const endX = domCaretEnd.x;
|
|
93303
|
+
const newWidth = Math.max(1, endX - adjustedX);
|
|
93304
|
+
rect = { ...rect, width: newWidth };
|
|
93305
|
+
}
|
|
93306
|
+
const pageLocalY = adjustedY - rect.pageIndex * (pageHeight + pageGap);
|
|
93307
|
+
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, adjustedX, pageLocalY);
|
|
93188
93308
|
if (!coords) return null;
|
|
93189
|
-
const absLeft = coords.x * zoom +
|
|
93190
|
-
const absTop = coords.y * zoom +
|
|
93309
|
+
const absLeft = coords.x * zoom - scrollLeft + containerRect.left;
|
|
93310
|
+
const absTop = coords.y * zoom - scrollTop + containerRect.top;
|
|
93191
93311
|
const left2 = relativeRect ? absLeft - relativeRect.left : absLeft;
|
|
93192
93312
|
const top2 = relativeRect ? absTop - relativeRect.top : absTop;
|
|
93193
93313
|
const width = Math.max(1, rect.width * zoom);
|
|
@@ -93202,6 +93322,7 @@ ${l}
|
|
|
93202
93322
|
height
|
|
93203
93323
|
};
|
|
93204
93324
|
}).filter((rect) => Boolean(rect));
|
|
93325
|
+
return finalRects;
|
|
93205
93326
|
}
|
|
93206
93327
|
/**
|
|
93207
93328
|
* Get selection bounds for a document range with aggregated bounding box.
|
|
@@ -93430,24 +93551,22 @@ ${l}
|
|
|
93430
93551
|
return null;
|
|
93431
93552
|
}
|
|
93432
93553
|
const rect2 = rects2[0];
|
|
93433
|
-
const
|
|
93434
|
-
|
|
93435
|
-
|
|
93436
|
-
|
|
93554
|
+
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
93555
|
+
const containerRect = __privateGet$1(this, _visibleHost).getBoundingClientRect();
|
|
93556
|
+
const scrollLeft = __privateGet$1(this, _visibleHost).scrollLeft ?? 0;
|
|
93557
|
+
const scrollTop = __privateGet$1(this, _visibleHost).scrollTop ?? 0;
|
|
93437
93558
|
const pageHeight = __privateMethod$1(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
93438
93559
|
const pageGap = __privateGet$1(this, _layoutState).layout?.pageGap ?? 0;
|
|
93439
93560
|
const pageLocalY = rect2.y - rect2.pageIndex * (pageHeight + pageGap);
|
|
93440
93561
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect2.pageIndex, rect2.x, pageLocalY);
|
|
93441
|
-
if (!coords)
|
|
93442
|
-
return null;
|
|
93443
|
-
}
|
|
93562
|
+
if (!coords) return null;
|
|
93444
93563
|
return {
|
|
93445
|
-
top: coords.y +
|
|
93446
|
-
bottom: coords.y +
|
|
93447
|
-
left: coords.x +
|
|
93448
|
-
right: coords.x +
|
|
93449
|
-
width: rect2.width,
|
|
93450
|
-
height: rect2.height
|
|
93564
|
+
top: coords.y * zoom - scrollTop + containerRect.top,
|
|
93565
|
+
bottom: coords.y * zoom - scrollTop + containerRect.top + rect2.height * zoom,
|
|
93566
|
+
left: coords.x * zoom - scrollLeft + containerRect.left,
|
|
93567
|
+
right: coords.x * zoom - scrollLeft + containerRect.left + rect2.width * zoom,
|
|
93568
|
+
width: rect2.width * zoom,
|
|
93569
|
+
height: rect2.height * zoom
|
|
93451
93570
|
};
|
|
93452
93571
|
}
|
|
93453
93572
|
const rects = this.getRangeRects(pos, pos);
|
|
@@ -94673,6 +94792,19 @@ ${l}
|
|
|
94673
94792
|
__privateSet(this, _layoutState, { blocks: blocks2, measures, layout, bookmarks, anchorMap });
|
|
94674
94793
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
94675
94794
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
94795
|
+
const pageWidth = layout.pageSize?.w ?? __privateGet$1(this, _layoutOptions).pageSize?.w ?? DEFAULT_PAGE_SIZE.w;
|
|
94796
|
+
if (__privateGet$1(this, _painterHost)) {
|
|
94797
|
+
__privateGet$1(this, _painterHost).style.width = `${pageWidth}px`;
|
|
94798
|
+
__privateGet$1(this, _painterHost).style.marginLeft = "0";
|
|
94799
|
+
__privateGet$1(this, _painterHost).style.marginRight = "0";
|
|
94800
|
+
}
|
|
94801
|
+
if (__privateGet$1(this, _selectionOverlay2)) {
|
|
94802
|
+
__privateGet$1(this, _selectionOverlay2).style.width = `${pageWidth}px`;
|
|
94803
|
+
__privateGet$1(this, _selectionOverlay2).style.left = "0";
|
|
94804
|
+
__privateGet$1(this, _selectionOverlay2).style.right = "";
|
|
94805
|
+
__privateGet$1(this, _selectionOverlay2).style.marginLeft = "0";
|
|
94806
|
+
__privateGet$1(this, _selectionOverlay2).style.marginRight = "0";
|
|
94807
|
+
}
|
|
94676
94808
|
await __privateMethod$1(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
94677
94809
|
__privateMethod$1(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
|
|
94678
94810
|
const painter = __privateMethod$1(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks2, measures);
|
|
@@ -94822,9 +94954,20 @@ ${l}
|
|
|
94822
94954
|
return;
|
|
94823
94955
|
}
|
|
94824
94956
|
const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, from2, to) ?? [];
|
|
94957
|
+
let domStart = null;
|
|
94958
|
+
let domEnd = null;
|
|
94959
|
+
try {
|
|
94960
|
+
domStart = __privateMethod$1(this, _PresentationEditor_instances, computeDomCaretPageLocal_fn).call(this, from2);
|
|
94961
|
+
domEnd = __privateMethod$1(this, _PresentationEditor_instances, computeDomCaretPageLocal_fn).call(this, to);
|
|
94962
|
+
} catch (error) {
|
|
94963
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
94964
|
+
console.warn("[PresentationEditor] DOM caret computation failed in #renderLocalSelection:", error);
|
|
94965
|
+
}
|
|
94966
|
+
}
|
|
94967
|
+
const correctedRects = __privateMethod$1(this, _PresentationEditor_instances, applyDomCorrectionToRects_fn).call(this, rects, domStart, domEnd);
|
|
94825
94968
|
try {
|
|
94826
94969
|
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
94827
|
-
__privateMethod$1(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this,
|
|
94970
|
+
__privateMethod$1(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this, correctedRects);
|
|
94828
94971
|
} catch (error) {
|
|
94829
94972
|
if (process$1$1.env.NODE_ENV === "development") {
|
|
94830
94973
|
console.warn("[PresentationEditor] Failed to render selection rects:", error);
|
|
@@ -95599,6 +95742,43 @@ ${l}
|
|
|
95599
95742
|
}
|
|
95600
95743
|
return context.layout.pageSize?.h ?? context.region.height ?? 1;
|
|
95601
95744
|
};
|
|
95745
|
+
applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
|
|
95746
|
+
if (rects.length === 0) return rects;
|
|
95747
|
+
const pageDelta = {};
|
|
95748
|
+
if (domStart && rects[0] && domStart.pageIndex === rects[0].pageIndex) {
|
|
95749
|
+
const pageHeight = __privateMethod$1(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
95750
|
+
const pageGap = __privateGet$1(this, _layoutState).layout?.pageGap ?? 0;
|
|
95751
|
+
const layoutY = rects[0].y - rects[0].pageIndex * (pageHeight + pageGap);
|
|
95752
|
+
pageDelta[domStart.pageIndex] = {
|
|
95753
|
+
dx: domStart.x - rects[0].x,
|
|
95754
|
+
dy: domStart.y - layoutY
|
|
95755
|
+
};
|
|
95756
|
+
}
|
|
95757
|
+
return rects.map((rect, idx) => {
|
|
95758
|
+
const delta = pageDelta[rect.pageIndex];
|
|
95759
|
+
let adjustedX = delta ? rect.x + delta.dx : rect.x;
|
|
95760
|
+
let adjustedY = delta ? rect.y + delta.dy : rect.y;
|
|
95761
|
+
let adjustedWidth = rect.width;
|
|
95762
|
+
const isFirstRect = idx === 0;
|
|
95763
|
+
const isLastRect = idx === rects.length - 1;
|
|
95764
|
+
if (isFirstRect && domStart && rect.pageIndex === domStart.pageIndex) {
|
|
95765
|
+
const pageHeight = __privateMethod$1(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
95766
|
+
const pageGap = __privateGet$1(this, _layoutState).layout?.pageGap ?? 0;
|
|
95767
|
+
adjustedX = domStart.x;
|
|
95768
|
+
adjustedY = domStart.y + rect.pageIndex * (pageHeight + pageGap);
|
|
95769
|
+
}
|
|
95770
|
+
if (isLastRect && domEnd && rect.pageIndex === domEnd.pageIndex) {
|
|
95771
|
+
const endX = domEnd.x;
|
|
95772
|
+
adjustedWidth = Math.max(1, endX - adjustedX);
|
|
95773
|
+
}
|
|
95774
|
+
return {
|
|
95775
|
+
...rect,
|
|
95776
|
+
x: adjustedX,
|
|
95777
|
+
y: adjustedY,
|
|
95778
|
+
width: adjustedWidth
|
|
95779
|
+
};
|
|
95780
|
+
});
|
|
95781
|
+
};
|
|
95602
95782
|
renderSelectionRects_fn = function(rects) {
|
|
95603
95783
|
const localSelectionLayer = __privateGet$1(this, _localSelectionLayer);
|
|
95604
95784
|
if (!localSelectionLayer) {
|
|
@@ -95606,7 +95786,7 @@ ${l}
|
|
|
95606
95786
|
}
|
|
95607
95787
|
const pageHeight = __privateMethod$1(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
95608
95788
|
const pageGap = __privateGet$1(this, _layoutState).layout?.pageGap ?? 0;
|
|
95609
|
-
rects.forEach((rect
|
|
95789
|
+
rects.forEach((rect) => {
|
|
95610
95790
|
const pageLocalY = rect.y - rect.pageIndex * (pageHeight + pageGap);
|
|
95611
95791
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
|
|
95612
95792
|
if (!coords) {
|
|
@@ -95845,6 +96025,20 @@ ${l}
|
|
|
95845
96025
|
pageCount: layout.pages?.length ?? 0
|
|
95846
96026
|
};
|
|
95847
96027
|
};
|
|
96028
|
+
getPageOffsetX_fn = function(pageIndex) {
|
|
96029
|
+
if (!__privateGet$1(this, _painterHost) || !__privateGet$1(this, _viewportHost)) {
|
|
96030
|
+
return null;
|
|
96031
|
+
}
|
|
96032
|
+
const pageEl = __privateGet$1(this, _painterHost).querySelector(
|
|
96033
|
+
`.superdoc-page[data-page-index="${pageIndex}"]`
|
|
96034
|
+
);
|
|
96035
|
+
if (!pageEl) return null;
|
|
96036
|
+
const pageRect = pageEl.getBoundingClientRect();
|
|
96037
|
+
const viewportRect = __privateGet$1(this, _viewportHost).getBoundingClientRect();
|
|
96038
|
+
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
96039
|
+
const offsetX = (pageRect.left - viewportRect.left) / zoom;
|
|
96040
|
+
return offsetX;
|
|
96041
|
+
};
|
|
95848
96042
|
convertPageLocalToOverlayCoords_fn = function(pageIndex, pageLocalX, pageLocalY) {
|
|
95849
96043
|
if (!Number.isFinite(pageIndex) || pageIndex < 0) {
|
|
95850
96044
|
console.warn(
|
|
@@ -95866,10 +96060,52 @@ ${l}
|
|
|
95866
96060
|
}
|
|
95867
96061
|
const pageHeight = __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
95868
96062
|
const pageGap = __privateGet$1(this, _layoutState).layout?.pageGap ?? 0;
|
|
95869
|
-
|
|
95870
|
-
|
|
96063
|
+
const pageOffsetX = __privateMethod$1(this, _PresentationEditor_instances, getPageOffsetX_fn).call(this, pageIndex) ?? 0;
|
|
96064
|
+
const coords = {
|
|
96065
|
+
x: pageOffsetX + pageLocalX,
|
|
95871
96066
|
y: pageIndex * (pageHeight + pageGap) + pageLocalY
|
|
95872
96067
|
};
|
|
96068
|
+
return coords;
|
|
96069
|
+
};
|
|
96070
|
+
computeDomCaretPageLocal_fn = function(pos) {
|
|
96071
|
+
__privateGet$1(this, _viewportHost).querySelector(`.superdoc-page span[data-pm-start][data-pm-end]`) ? __privateGet$1(this, _viewportHost).querySelector(`.superdoc-page`) : null;
|
|
96072
|
+
const spans = Array.from(__privateGet$1(this, _viewportHost).querySelectorAll("span[data-pm-start][data-pm-end]"));
|
|
96073
|
+
let targetSpan = null;
|
|
96074
|
+
for (const span of spans) {
|
|
96075
|
+
const pmStart2 = Number(span.dataset.pmStart ?? "NaN");
|
|
96076
|
+
const pmEnd = Number(span.dataset.pmEnd ?? "NaN");
|
|
96077
|
+
if (!Number.isFinite(pmStart2) || !Number.isFinite(pmEnd)) continue;
|
|
96078
|
+
if (pos < pmStart2 || pos > pmEnd) continue;
|
|
96079
|
+
targetSpan = span;
|
|
96080
|
+
break;
|
|
96081
|
+
}
|
|
96082
|
+
if (!targetSpan) return null;
|
|
96083
|
+
const page = targetSpan.closest(".superdoc-page");
|
|
96084
|
+
if (!page) return null;
|
|
96085
|
+
const pageRect = page.getBoundingClientRect();
|
|
96086
|
+
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
96087
|
+
const textNode = targetSpan.firstChild;
|
|
96088
|
+
if (!textNode || textNode.nodeType !== Node.TEXT_NODE) {
|
|
96089
|
+
const spanRect = targetSpan.getBoundingClientRect();
|
|
96090
|
+
return {
|
|
96091
|
+
pageIndex: Number(page.dataset.pageIndex ?? "0"),
|
|
96092
|
+
x: (spanRect.left - pageRect.left) / zoom,
|
|
96093
|
+
y: (spanRect.top - pageRect.top) / zoom
|
|
96094
|
+
};
|
|
96095
|
+
}
|
|
96096
|
+
const pmStart = Number(targetSpan.dataset.pmStart ?? "NaN");
|
|
96097
|
+
const charIndex = Math.min(pos - pmStart, textNode.length);
|
|
96098
|
+
const range2 = document.createRange();
|
|
96099
|
+
range2.setStart(textNode, Math.max(0, charIndex));
|
|
96100
|
+
range2.setEnd(textNode, Math.max(0, charIndex));
|
|
96101
|
+
const rangeRect = range2.getBoundingClientRect();
|
|
96102
|
+
const lineEl = targetSpan.closest(".superdoc-line");
|
|
96103
|
+
const lineRect = lineEl?.getBoundingClientRect() ?? rangeRect;
|
|
96104
|
+
return {
|
|
96105
|
+
pageIndex: Number(page.dataset.pageIndex ?? "0"),
|
|
96106
|
+
x: (rangeRect.left - pageRect.left) / zoom,
|
|
96107
|
+
y: (lineRect.top - pageRect.top) / zoom
|
|
96108
|
+
};
|
|
95873
96109
|
};
|
|
95874
96110
|
normalizeClientPoint_fn = function(clientX, clientY) {
|
|
95875
96111
|
if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {
|
|
@@ -95879,18 +96115,29 @@ ${l}
|
|
|
95879
96115
|
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
95880
96116
|
const scrollLeft = __privateGet$1(this, _visibleHost).scrollLeft ?? 0;
|
|
95881
96117
|
const scrollTop = __privateGet$1(this, _visibleHost).scrollTop ?? 0;
|
|
96118
|
+
const baseX = (clientX - rect.left + scrollLeft) / zoom;
|
|
96119
|
+
const baseY = (clientY - rect.top + scrollTop) / zoom;
|
|
96120
|
+
let adjustedX = baseX;
|
|
96121
|
+
const doc2 = __privateGet$1(this, _visibleHost).ownerDocument ?? document;
|
|
96122
|
+
const hitChain = typeof doc2.elementsFromPoint === "function" ? doc2.elementsFromPoint(clientX, clientY) : [];
|
|
96123
|
+
const pageEl = Array.isArray(hitChain) ? hitChain.find((el) => el?.classList?.contains("superdoc-page")) : null;
|
|
96124
|
+
if (pageEl) {
|
|
96125
|
+
const pageIndex = Number(pageEl.dataset.pageIndex ?? "NaN");
|
|
96126
|
+
if (Number.isFinite(pageIndex)) {
|
|
96127
|
+
const pageOffsetX = __privateMethod$1(this, _PresentationEditor_instances, getPageOffsetX_fn).call(this, pageIndex);
|
|
96128
|
+
if (pageOffsetX != null) {
|
|
96129
|
+
adjustedX = baseX - pageOffsetX;
|
|
96130
|
+
}
|
|
96131
|
+
}
|
|
96132
|
+
}
|
|
95882
96133
|
return {
|
|
95883
|
-
x:
|
|
95884
|
-
y:
|
|
96134
|
+
x: adjustedX,
|
|
96135
|
+
y: baseY
|
|
95885
96136
|
};
|
|
95886
96137
|
};
|
|
95887
|
-
|
|
96138
|
+
computeCaretLayoutRectGeometry_fn = function(pos, includeDomFallback = true) {
|
|
95888
96139
|
const layout = __privateGet$1(this, _layoutState).layout;
|
|
95889
96140
|
if (!layout) return null;
|
|
95890
|
-
const domResult = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRectFromDOM_fn).call(this, pos);
|
|
95891
|
-
if (domResult) {
|
|
95892
|
-
return domResult;
|
|
95893
|
-
}
|
|
95894
96141
|
const hit = getFragmentAtPosition(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, pos);
|
|
95895
96142
|
if (!hit) {
|
|
95896
96143
|
return null;
|
|
@@ -95912,101 +96159,82 @@ ${l}
|
|
|
95912
96159
|
const { line, index: index2 } = lineInfo;
|
|
95913
96160
|
const range2 = computeLinePmRange(block, line);
|
|
95914
96161
|
if (range2.pmStart == null || range2.pmEnd == null) return null;
|
|
95915
|
-
const
|
|
95916
|
-
const
|
|
95917
|
-
const
|
|
96162
|
+
const pmOffset = pmPosToCharOffset(block, line, pos);
|
|
96163
|
+
const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
96164
|
+
const paraIndentLeft = block.attrs?.indent?.left ?? 0;
|
|
96165
|
+
const paraIndentRight = block.attrs?.indent?.right ?? 0;
|
|
96166
|
+
const availableWidth = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
|
|
96167
|
+
const charX = measureCharacterX(block, line, pmOffset, availableWidth);
|
|
96168
|
+
const firstLineOffset = (block.attrs?.indent?.firstLine ?? 0) - (block.attrs?.indent?.hanging ?? 0);
|
|
96169
|
+
const isFirstLine = index2 === fragment.fromLine;
|
|
96170
|
+
const isListFirstLine = isFirstLine && !fragment.continuesFromPrev && (fragment.markerWidth ?? 0) > 0;
|
|
96171
|
+
let indentAdjust = 0;
|
|
96172
|
+
if (!isListFirstLine) {
|
|
96173
|
+
indentAdjust = paraIndentLeft + (isFirstLine ? firstLineOffset : 0);
|
|
96174
|
+
}
|
|
96175
|
+
const localX = fragment.x + markerWidth + indentAdjust + charX;
|
|
95918
96176
|
const lineOffset = __privateMethod$1(this, _PresentationEditor_instances, lineHeightBeforeIndex_fn).call(this, measure.lines, fragment.fromLine, index2);
|
|
95919
96177
|
const localY = fragment.y + lineOffset;
|
|
95920
|
-
|
|
96178
|
+
const result = {
|
|
95921
96179
|
pageIndex: hit.pageIndex,
|
|
95922
96180
|
x: localX,
|
|
95923
96181
|
y: localY,
|
|
95924
96182
|
height: line.lineHeight
|
|
95925
96183
|
};
|
|
95926
|
-
|
|
95927
|
-
|
|
96184
|
+
const pageEl = __privateGet$1(this, _painterHost)?.querySelector(
|
|
96185
|
+
`.superdoc-page[data-page-index="${hit.pageIndex}"]`
|
|
96186
|
+
);
|
|
96187
|
+
const pageRect = pageEl?.getBoundingClientRect();
|
|
95928
96188
|
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
95929
|
-
let
|
|
95930
|
-
|
|
95931
|
-
|
|
95932
|
-
|
|
95933
|
-
|
|
95934
|
-
|
|
95935
|
-
|
|
95936
|
-
|
|
95937
|
-
|
|
95938
|
-
const
|
|
95939
|
-
|
|
95940
|
-
);
|
|
95941
|
-
|
|
95942
|
-
|
|
96189
|
+
let domCaretX = null;
|
|
96190
|
+
let domCaretY = null;
|
|
96191
|
+
const spanEls = pageEl?.querySelectorAll("span[data-pm-start][data-pm-end]") ?? [];
|
|
96192
|
+
for (const spanEl of spanEls) {
|
|
96193
|
+
const pmStart = Number(spanEl.dataset.pmStart);
|
|
96194
|
+
const pmEnd = Number(spanEl.dataset.pmEnd);
|
|
96195
|
+
if (pos >= pmStart && pos <= pmEnd && spanEl.firstChild?.nodeType === Node.TEXT_NODE) {
|
|
96196
|
+
const textNode = spanEl.firstChild;
|
|
96197
|
+
const charIndex = Math.min(pos - pmStart, textNode.length);
|
|
96198
|
+
const rangeObj = document.createRange();
|
|
96199
|
+
rangeObj.setStart(textNode, charIndex);
|
|
96200
|
+
rangeObj.setEnd(textNode, charIndex);
|
|
96201
|
+
const rangeRect = rangeObj.getBoundingClientRect();
|
|
96202
|
+
if (pageRect) {
|
|
96203
|
+
domCaretX = (rangeRect.left - pageRect.left) / zoom;
|
|
96204
|
+
domCaretY = (rangeRect.top - pageRect.top) / zoom;
|
|
95943
96205
|
}
|
|
96206
|
+
break;
|
|
95944
96207
|
}
|
|
95945
96208
|
}
|
|
95946
|
-
|
|
95947
|
-
|
|
95948
|
-
|
|
95949
|
-
|
|
95950
|
-
|
|
95951
|
-
|
|
95952
|
-
|
|
95953
|
-
|
|
95954
|
-
|
|
95955
|
-
|
|
95956
|
-
|
|
95957
|
-
|
|
95958
|
-
|
|
95959
|
-
|
|
95960
|
-
|
|
95961
|
-
|
|
95962
|
-
|
|
95963
|
-
|
|
95964
|
-
pageIndex,
|
|
95965
|
-
x: (spanRect2.left - pageRect.left) / zoom,
|
|
95966
|
-
y: (spanRect2.top - pageRect.top) / zoom,
|
|
95967
|
-
height: spanRect2.height / zoom
|
|
95968
|
-
};
|
|
95969
|
-
}
|
|
95970
|
-
const text2 = textNode.textContent ?? "";
|
|
95971
|
-
const charOffset = Math.max(0, Math.min(text2.length, pos - pmStart));
|
|
95972
|
-
const range2 = document.createRange();
|
|
95973
|
-
try {
|
|
95974
|
-
range2.setStart(textNode, charOffset);
|
|
95975
|
-
range2.setEnd(textNode, charOffset);
|
|
95976
|
-
} catch (error) {
|
|
95977
|
-
if (process$1$1.env.NODE_ENV === "development") {
|
|
95978
|
-
console.warn("[PresentationEditor] Range.setStart/setEnd failed:", {
|
|
95979
|
-
error: error instanceof Error ? error.message : String(error),
|
|
95980
|
-
charOffset,
|
|
95981
|
-
textLength: text2.length,
|
|
95982
|
-
pos,
|
|
95983
|
-
pmStart,
|
|
95984
|
-
pmEnd
|
|
95985
|
-
});
|
|
95986
|
-
}
|
|
95987
|
-
const spanRect2 = spanEl.getBoundingClientRect();
|
|
95988
|
-
return {
|
|
95989
|
-
pageIndex,
|
|
95990
|
-
x: (spanRect2.left - pageRect.left) / zoom,
|
|
95991
|
-
y: (spanRect2.top - pageRect.top) / zoom,
|
|
95992
|
-
height: spanRect2.height / zoom
|
|
95993
|
-
};
|
|
96209
|
+
if (includeDomFallback && domCaretX != null && domCaretY != null) {
|
|
96210
|
+
return {
|
|
96211
|
+
pageIndex: hit.pageIndex,
|
|
96212
|
+
x: domCaretX,
|
|
96213
|
+
y: domCaretY,
|
|
96214
|
+
height: line.lineHeight
|
|
96215
|
+
};
|
|
96216
|
+
}
|
|
96217
|
+
return result;
|
|
96218
|
+
};
|
|
96219
|
+
computeCaretLayoutRect_fn = function(pos) {
|
|
96220
|
+
const geometry = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRectGeometry_fn).call(this, pos, true);
|
|
96221
|
+
let dom = null;
|
|
96222
|
+
try {
|
|
96223
|
+
dom = __privateMethod$1(this, _PresentationEditor_instances, computeDomCaretPageLocal_fn).call(this, pos);
|
|
96224
|
+
} catch (error) {
|
|
96225
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
96226
|
+
console.warn("[PresentationEditor] DOM caret computation failed in #computeCaretLayoutRect:", error);
|
|
95994
96227
|
}
|
|
95995
|
-
|
|
95996
|
-
|
|
95997
|
-
const lineEl = spanEl.closest(".superdoc-line");
|
|
95998
|
-
const lineRect = lineEl ? lineEl.getBoundingClientRect() : spanRect;
|
|
95999
|
-
const caretHeight = spanRect.height;
|
|
96000
|
-
const verticalOffset = (lineRect.height - caretHeight) / 2;
|
|
96001
|
-
const caretY = lineRect.top + verticalOffset;
|
|
96228
|
+
}
|
|
96229
|
+
if (dom && geometry) {
|
|
96002
96230
|
return {
|
|
96003
|
-
pageIndex,
|
|
96004
|
-
x:
|
|
96005
|
-
y:
|
|
96006
|
-
height:
|
|
96231
|
+
pageIndex: dom.pageIndex,
|
|
96232
|
+
x: dom.x,
|
|
96233
|
+
y: dom.y,
|
|
96234
|
+
height: geometry.height
|
|
96007
96235
|
};
|
|
96008
96236
|
}
|
|
96009
|
-
return
|
|
96237
|
+
return geometry;
|
|
96010
96238
|
};
|
|
96011
96239
|
computeTableCaretLayoutRect_fn = function(pos, _fragment, _tableBlock, _tableMeasure, pageIndex) {
|
|
96012
96240
|
const lineEls = Array.from(__privateGet$1(this, _viewportHost).querySelectorAll(".superdoc-line"));
|
|
@@ -149881,7 +150109,7 @@ ${style2}
|
|
|
149881
150109
|
this.config.colors = shuffleArray(this.config.colors);
|
|
149882
150110
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
149883
150111
|
this.colorIndex = 0;
|
|
149884
|
-
this.version = "1.0.0-beta.
|
|
150112
|
+
this.version = "1.0.0-beta.67";
|
|
149885
150113
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
149886
150114
|
this.superdocId = config2.superdocId || v4();
|
|
149887
150115
|
this.colors = this.config.colors;
|
|
@@ -152353,7 +152581,7 @@ ${style2}
|
|
|
152353
152581
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
152354
152582
|
);
|
|
152355
152583
|
}
|
|
152356
|
-
const
|
|
152584
|
+
const indexCixgd5bX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
152357
152585
|
__proto__: null,
|
|
152358
152586
|
unified
|
|
152359
152587
|
}, Symbol.toStringTag, { value: "Module" }));
|