@harbour-enterprises/superdoc 1.0.0-beta.100 → 1.0.0-beta.101
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-DBk7W90L.es.js → PdfViewer-Cd9VR_tI.es.js} +1 -1
- package/dist/chunks/{PdfViewer-Bl_KAt28.cjs → PdfViewer-DZWkMtTG.cjs} +1 -1
- package/dist/chunks/{index-UIImjS8C.cjs → index-BavMv0sW.cjs} +3 -3
- package/dist/chunks/{index-BtLZer3S.es.js → index-BzQ_CQ_p.es.js} +3 -3
- package/dist/chunks/{index-Bd5TMBeR-D31VShf3.cjs → index-N8gZUeSO-BneVBXkH.cjs} +1 -1
- package/dist/chunks/{index-Bd5TMBeR-DcY3xcTG.es.js → index-N8gZUeSO-Dxit0pPr.es.js} +1 -1
- package/dist/chunks/{super-editor.es-oszwJ36j.es.js → super-editor.es-0IwuILla.es.js} +579 -99
- package/dist/chunks/{super-editor.es-BLGnf9gI.cjs → super-editor.es-BGncr3MA.cjs} +579 -99
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-B6-fwuLp.js → converter---tUwTA4.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-DXUMayjk.js → docx-zipper-B8zS8jbu.js} +1 -1
- package/dist/super-editor/chunks/{editor-BAK8u8dm.js → editor-3H6s48L7.js} +584 -100
- package/dist/super-editor/chunks/{index-Bd5TMBeR.js → index-N8gZUeSO.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DCCbbUQz.js → toolbar-FxiK-_cI.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 +581 -101
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +10 -1
|
@@ -42404,7 +42404,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42404
42404
|
static getStoredSuperdocVersion(docx) {
|
|
42405
42405
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42406
42406
|
}
|
|
42407
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42407
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.101") {
|
|
42408
42408
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42409
42409
|
}
|
|
42410
42410
|
/**
|
|
@@ -45716,7 +45716,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
45716
45716
|
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);
|
|
45717
45717
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
45718
45718
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
45719
|
-
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, _cellAnchor, _cellDragMode, _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, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_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, renderCellSelectionOverlay_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;
|
|
45719
|
+
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, _pageGeometryHelper, _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, _cellAnchor, _cellDragMode, _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, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_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, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, applyDomCorrectionToRects_fn, renderCellSelectionOverlay_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;
|
|
45720
45720
|
var GOOD_LEAF_SIZE = 200;
|
|
45721
45721
|
var RopeSequence = function RopeSequence2() {
|
|
45722
45722
|
};
|
|
@@ -59622,7 +59622,7 @@ const isHeadless = (editor) => {
|
|
|
59622
59622
|
const shouldSkipNodeView = (editor) => {
|
|
59623
59623
|
return isHeadless(editor);
|
|
59624
59624
|
};
|
|
59625
|
-
const summaryVersion = "1.0.0-beta.
|
|
59625
|
+
const summaryVersion = "1.0.0-beta.101";
|
|
59626
59626
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59627
59627
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59628
59628
|
function mapAttributes(attrs) {
|
|
@@ -60411,7 +60411,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60411
60411
|
{ default: remarkStringify },
|
|
60412
60412
|
{ default: remarkGfm }
|
|
60413
60413
|
] = await Promise.all([
|
|
60414
|
-
import("./index-
|
|
60414
|
+
import("./index-N8gZUeSO-Dxit0pPr.es.js"),
|
|
60415
60415
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
60416
60416
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
60417
60417
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -60616,7 +60616,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60616
60616
|
* Process collaboration migrations
|
|
60617
60617
|
*/
|
|
60618
60618
|
processCollaborationMigrations() {
|
|
60619
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
60619
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.101");
|
|
60620
60620
|
if (!this.options.ydoc) return;
|
|
60621
60621
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60622
60622
|
let docVersion = metaMap.get("version");
|
|
@@ -72699,7 +72699,7 @@ const containerStyles = {
|
|
|
72699
72699
|
alignItems: "center",
|
|
72700
72700
|
background: "transparent",
|
|
72701
72701
|
padding: "0",
|
|
72702
|
-
gap:
|
|
72702
|
+
// gap is set dynamically by renderer based on pageGap option (default: 24px)
|
|
72703
72703
|
overflowY: "auto"
|
|
72704
72704
|
};
|
|
72705
72705
|
const containerStylesHorizontal = {
|
|
@@ -72709,7 +72709,7 @@ const containerStylesHorizontal = {
|
|
|
72709
72709
|
justifyContent: "safe center",
|
|
72710
72710
|
background: "transparent",
|
|
72711
72711
|
padding: "0",
|
|
72712
|
-
gap:
|
|
72712
|
+
// gap is set dynamically by renderer based on pageGap option (default: 20px for horizontal)
|
|
72713
72713
|
overflowX: "auto",
|
|
72714
72714
|
minHeight: "100%"
|
|
72715
72715
|
};
|
|
@@ -74512,6 +74512,7 @@ function isMinimalWordLayout(value) {
|
|
|
74512
74512
|
const LIST_MARKER_GAP$1 = 8;
|
|
74513
74513
|
const DEFAULT_TAB_INTERVAL_PX$1 = 48;
|
|
74514
74514
|
const DEFAULT_PAGE_HEIGHT_PX = 1056;
|
|
74515
|
+
const DEFAULT_VIRTUALIZED_PAGE_GAP$1 = 72;
|
|
74515
74516
|
const COMMENT_EXTERNAL_COLOR = "#B1124B";
|
|
74516
74517
|
const COMMENT_INTERNAL_COLOR = "#078383";
|
|
74517
74518
|
const COMMENT_INACTIVE_ALPHA = "22";
|
|
@@ -74641,10 +74642,11 @@ const _DomPainter = class _DomPainter2 {
|
|
|
74641
74642
|
this.totalPages = 0;
|
|
74642
74643
|
this.linkIdCounter = 0;
|
|
74643
74644
|
this.pendingTooltips = /* @__PURE__ */ new WeakMap();
|
|
74645
|
+
this.pageGap = 24;
|
|
74644
74646
|
this.virtualEnabled = false;
|
|
74645
74647
|
this.virtualWindow = 5;
|
|
74646
74648
|
this.virtualOverscan = 0;
|
|
74647
|
-
this.virtualGap =
|
|
74649
|
+
this.virtualGap = DEFAULT_VIRTUALIZED_PAGE_GAP$1;
|
|
74648
74650
|
this.virtualPaddingTop = null;
|
|
74649
74651
|
this.topSpacerEl = null;
|
|
74650
74652
|
this.bottomSpacerEl = null;
|
|
@@ -74663,13 +74665,14 @@ const _DomPainter = class _DomPainter2 {
|
|
|
74663
74665
|
this.blockLookup = this.buildBlockLookup(blocks, measures);
|
|
74664
74666
|
this.headerProvider = options.headerProvider;
|
|
74665
74667
|
this.footerProvider = options.footerProvider;
|
|
74668
|
+
const defaultGap = this.layoutMode === "horizontal" ? 20 : 24;
|
|
74669
|
+
this.pageGap = typeof options.pageGap === "number" && Number.isFinite(options.pageGap) ? Math.max(0, options.pageGap) : defaultGap;
|
|
74666
74670
|
if (this.layoutMode === "vertical" && options.virtualization?.enabled) {
|
|
74667
74671
|
this.virtualEnabled = true;
|
|
74668
74672
|
this.virtualWindow = Math.max(1, options.virtualization.window ?? 5);
|
|
74669
74673
|
this.virtualOverscan = Math.max(0, options.virtualization.overscan ?? 0);
|
|
74670
|
-
|
|
74671
|
-
|
|
74672
|
-
}
|
|
74674
|
+
const hasExplicitVirtualGap = typeof options.virtualization.gap === "number" && Number.isFinite(options.virtualization.gap);
|
|
74675
|
+
this.virtualGap = hasExplicitVirtualGap ? Math.max(0, options.virtualization.gap) : DEFAULT_VIRTUALIZED_PAGE_GAP$1;
|
|
74673
74676
|
if (typeof options.virtualization.paddingTop === "number" && Number.isFinite(options.virtualization.paddingTop)) {
|
|
74674
74677
|
this.virtualPaddingTop = Math.max(0, options.virtualization.paddingTop);
|
|
74675
74678
|
}
|
|
@@ -74770,6 +74773,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
74770
74773
|
const mode = this.layoutMode;
|
|
74771
74774
|
if (mode === "horizontal") {
|
|
74772
74775
|
applyStyles$2(mount2, containerStylesHorizontal);
|
|
74776
|
+
mount2.style.gap = `${this.pageGap}px`;
|
|
74773
74777
|
this.renderHorizontal(layout, mount2);
|
|
74774
74778
|
this.currentLayout = layout;
|
|
74775
74779
|
this.pageStates = [];
|
|
@@ -74792,6 +74796,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
74792
74796
|
this.changedBlocks.clear();
|
|
74793
74797
|
return;
|
|
74794
74798
|
}
|
|
74799
|
+
mount2.style.gap = `${this.pageGap}px`;
|
|
74795
74800
|
if (!this.currentLayout || this.pageStates.length === 0) {
|
|
74796
74801
|
this.fullRender(layout);
|
|
74797
74802
|
} else {
|
|
@@ -78011,6 +78016,7 @@ const createDomPainter = (options) => {
|
|
|
78011
78016
|
const painter = new DomPainter(options.blocks, options.measures, {
|
|
78012
78017
|
pageStyles: options.pageStyles,
|
|
78013
78018
|
layoutMode: options.layoutMode,
|
|
78019
|
+
pageGap: options.pageGap,
|
|
78014
78020
|
headerProvider: options.headerProvider,
|
|
78015
78021
|
footerProvider: options.footerProvider,
|
|
78016
78022
|
virtualization: options.virtualization,
|
|
@@ -83308,6 +83314,285 @@ async function remeasureAffectedBlocks(blocks, measures, affectedBlockIds, const
|
|
|
83308
83314
|
}
|
|
83309
83315
|
return updatedMeasures;
|
|
83310
83316
|
}
|
|
83317
|
+
class PageGeometryHelper {
|
|
83318
|
+
/**
|
|
83319
|
+
* Creates a new PageGeometryHelper instance.
|
|
83320
|
+
*
|
|
83321
|
+
* @param config - Page geometry configuration
|
|
83322
|
+
*/
|
|
83323
|
+
constructor(config2) {
|
|
83324
|
+
this.cache = null;
|
|
83325
|
+
this.config = config2;
|
|
83326
|
+
}
|
|
83327
|
+
/**
|
|
83328
|
+
* Updates the layout and invalidates the cache.
|
|
83329
|
+
*
|
|
83330
|
+
* Call this whenever the layout changes (new pages, different heights, etc.)
|
|
83331
|
+
*
|
|
83332
|
+
* @param layout - New layout data
|
|
83333
|
+
* @param pageGap - Optional new page gap (if not provided, uses current gap)
|
|
83334
|
+
*/
|
|
83335
|
+
updateLayout(layout, pageGap) {
|
|
83336
|
+
this.config.layout = layout;
|
|
83337
|
+
if (pageGap !== void 0) {
|
|
83338
|
+
this.config.pageGap = pageGap;
|
|
83339
|
+
}
|
|
83340
|
+
this.cache = null;
|
|
83341
|
+
}
|
|
83342
|
+
/**
|
|
83343
|
+
* Updates the page gap and invalidates the cache.
|
|
83344
|
+
*
|
|
83345
|
+
* @param pageGap - New gap between pages in pixels
|
|
83346
|
+
*/
|
|
83347
|
+
updatePageGap(pageGap) {
|
|
83348
|
+
if (this.config.pageGap !== pageGap) {
|
|
83349
|
+
this.config.pageGap = pageGap;
|
|
83350
|
+
this.cache = null;
|
|
83351
|
+
}
|
|
83352
|
+
}
|
|
83353
|
+
/**
|
|
83354
|
+
* Gets the cumulative Y position (top edge) of a page in container space.
|
|
83355
|
+
*
|
|
83356
|
+
* The returned value is the distance from the top of the container to the
|
|
83357
|
+
* top of the specified page, accounting for all previous pages and gaps.
|
|
83358
|
+
*
|
|
83359
|
+
* @param pageIndex - Zero-based page index
|
|
83360
|
+
* @returns Y position in pixels, or 0 if page index is invalid
|
|
83361
|
+
*
|
|
83362
|
+
* @example
|
|
83363
|
+
* ```typescript
|
|
83364
|
+
* // Get Y position of page 0 (first page)
|
|
83365
|
+
* const y0 = helper.getPageTop(0); // Returns 0
|
|
83366
|
+
*
|
|
83367
|
+
* // Get Y position of page 2 (third page)
|
|
83368
|
+
* // Assumes page 0 height = 1000, page 1 height = 1200, gap = 24
|
|
83369
|
+
* const y2 = helper.getPageTop(2); // Returns 1000 + 24 + 1200 + 24 = 2248
|
|
83370
|
+
* ```
|
|
83371
|
+
*/
|
|
83372
|
+
getPageTop(pageIndex) {
|
|
83373
|
+
this.ensureCache();
|
|
83374
|
+
if (pageIndex < 0 || pageIndex >= this.cache.cumulativeY.length) {
|
|
83375
|
+
return 0;
|
|
83376
|
+
}
|
|
83377
|
+
return this.cache.cumulativeY[pageIndex];
|
|
83378
|
+
}
|
|
83379
|
+
/**
|
|
83380
|
+
* Gets the height of a specific page.
|
|
83381
|
+
*
|
|
83382
|
+
* Uses per-page height if available (from layout.pages[i].size?.h),
|
|
83383
|
+
* otherwise falls back to layout.pageSize.h.
|
|
83384
|
+
*
|
|
83385
|
+
* @param pageIndex - Zero-based page index
|
|
83386
|
+
* @returns Page height in pixels, or 0 if page index is invalid
|
|
83387
|
+
*
|
|
83388
|
+
* @example
|
|
83389
|
+
* ```typescript
|
|
83390
|
+
* const height = helper.getPageHeight(0); // Returns page-specific height
|
|
83391
|
+
* ```
|
|
83392
|
+
*/
|
|
83393
|
+
getPageHeight(pageIndex) {
|
|
83394
|
+
this.ensureCache();
|
|
83395
|
+
if (pageIndex < 0 || pageIndex >= this.cache.pageHeights.length) {
|
|
83396
|
+
return 0;
|
|
83397
|
+
}
|
|
83398
|
+
return this.cache.pageHeights[pageIndex];
|
|
83399
|
+
}
|
|
83400
|
+
/**
|
|
83401
|
+
* Gets the gap between pages.
|
|
83402
|
+
*
|
|
83403
|
+
* @returns Gap in pixels
|
|
83404
|
+
*
|
|
83405
|
+
* @example
|
|
83406
|
+
* ```typescript
|
|
83407
|
+
* const gap = helper.getPageGap(); // Returns 24
|
|
83408
|
+
* ```
|
|
83409
|
+
*/
|
|
83410
|
+
getPageGap() {
|
|
83411
|
+
this.ensureCache();
|
|
83412
|
+
return this.cache.pageGap;
|
|
83413
|
+
}
|
|
83414
|
+
/**
|
|
83415
|
+
* Gets the total height of all pages including gaps.
|
|
83416
|
+
*
|
|
83417
|
+
* Total height = sum of all page heights + (pageCount - 1) * gap
|
|
83418
|
+
*
|
|
83419
|
+
* @returns Total height in pixels
|
|
83420
|
+
*
|
|
83421
|
+
* @example
|
|
83422
|
+
* ```typescript
|
|
83423
|
+
* // 3 pages: heights [1000, 1200, 1000], gap = 24
|
|
83424
|
+
* const total = helper.getTotalHeight();
|
|
83425
|
+
* // Returns 1000 + 24 + 1200 + 24 + 1000 = 3248
|
|
83426
|
+
* ```
|
|
83427
|
+
*/
|
|
83428
|
+
getTotalHeight() {
|
|
83429
|
+
this.ensureCache();
|
|
83430
|
+
return this.cache.totalHeight;
|
|
83431
|
+
}
|
|
83432
|
+
/**
|
|
83433
|
+
* Gets the number of pages in the layout.
|
|
83434
|
+
*
|
|
83435
|
+
* @returns Page count
|
|
83436
|
+
*/
|
|
83437
|
+
getPageCount() {
|
|
83438
|
+
return this.config.layout.pages.length;
|
|
83439
|
+
}
|
|
83440
|
+
/**
|
|
83441
|
+
* Finds the page index containing a given Y coordinate.
|
|
83442
|
+
*
|
|
83443
|
+
* This performs a linear search through cached cumulative positions.
|
|
83444
|
+
* For large documents, consider adding binary search optimization.
|
|
83445
|
+
*
|
|
83446
|
+
* @param containerY - Y coordinate in container space
|
|
83447
|
+
* @returns Page index, or null if Y is outside all pages
|
|
83448
|
+
*
|
|
83449
|
+
* @example
|
|
83450
|
+
* ```typescript
|
|
83451
|
+
* // Find which page contains Y = 1500
|
|
83452
|
+
* const pageIndex = helper.getPageIndexAtY(1500);
|
|
83453
|
+
* // Returns 1 (second page) if first page ends at Y=1024
|
|
83454
|
+
* ```
|
|
83455
|
+
*/
|
|
83456
|
+
getPageIndexAtY(containerY) {
|
|
83457
|
+
this.ensureCache();
|
|
83458
|
+
const cache2 = this.cache;
|
|
83459
|
+
for (let i = 0; i < cache2.cumulativeY.length; i++) {
|
|
83460
|
+
const pageTop = cache2.cumulativeY[i];
|
|
83461
|
+
const pageBottom = pageTop + cache2.pageHeights[i];
|
|
83462
|
+
if (containerY >= pageTop && containerY < pageBottom) {
|
|
83463
|
+
return i;
|
|
83464
|
+
}
|
|
83465
|
+
}
|
|
83466
|
+
return null;
|
|
83467
|
+
}
|
|
83468
|
+
/**
|
|
83469
|
+
* Finds the nearest page index to a given Y coordinate (snap-to-nearest).
|
|
83470
|
+
*
|
|
83471
|
+
* Returns the page containing Y when inside a page; otherwise returns the
|
|
83472
|
+
* closest page based on distance to page center. Useful for dragging through
|
|
83473
|
+
* page gaps where getPageIndexAtY would return null.
|
|
83474
|
+
*
|
|
83475
|
+
* @param containerY - Y coordinate in container space
|
|
83476
|
+
* @returns Nearest page index, or null if there are no pages
|
|
83477
|
+
*/
|
|
83478
|
+
getNearestPageIndex(containerY) {
|
|
83479
|
+
this.ensureCache();
|
|
83480
|
+
const cache2 = this.cache;
|
|
83481
|
+
const pageCount = cache2.pageHeights.length;
|
|
83482
|
+
if (pageCount === 0) return null;
|
|
83483
|
+
const direct = this.getPageIndexAtY(containerY);
|
|
83484
|
+
if (direct !== null) return direct;
|
|
83485
|
+
let nearestIndex = 0;
|
|
83486
|
+
let nearestDistance = Infinity;
|
|
83487
|
+
for (let i = 0; i < pageCount; i++) {
|
|
83488
|
+
const top2 = cache2.cumulativeY[i];
|
|
83489
|
+
const height = cache2.pageHeights[i];
|
|
83490
|
+
const center = top2 + height / 2;
|
|
83491
|
+
const distance = Math.abs(containerY - center);
|
|
83492
|
+
if (distance < nearestDistance) {
|
|
83493
|
+
nearestDistance = distance;
|
|
83494
|
+
nearestIndex = i;
|
|
83495
|
+
}
|
|
83496
|
+
}
|
|
83497
|
+
return nearestIndex;
|
|
83498
|
+
}
|
|
83499
|
+
/**
|
|
83500
|
+
* Ensures the cache is built and up-to-date.
|
|
83501
|
+
* Validates cache state and rebuilds if needed.
|
|
83502
|
+
* @private
|
|
83503
|
+
* @throws Never throws - handles errors gracefully with fallback values
|
|
83504
|
+
*/
|
|
83505
|
+
ensureCache() {
|
|
83506
|
+
if (this.cache !== null) {
|
|
83507
|
+
if (!Array.isArray(this.cache.cumulativeY) || !Array.isArray(this.cache.pageHeights)) {
|
|
83508
|
+
console.warn("[PageGeometryHelper] Cache corruption detected, rebuilding cache");
|
|
83509
|
+
this.cache = null;
|
|
83510
|
+
} else {
|
|
83511
|
+
return;
|
|
83512
|
+
}
|
|
83513
|
+
}
|
|
83514
|
+
this.buildCache();
|
|
83515
|
+
}
|
|
83516
|
+
/**
|
|
83517
|
+
* Builds the geometry cache from current layout data.
|
|
83518
|
+
* Handles errors gracefully by providing fallback values.
|
|
83519
|
+
* @private
|
|
83520
|
+
* @throws Never throws - catches all errors and provides safe defaults
|
|
83521
|
+
*/
|
|
83522
|
+
buildCache() {
|
|
83523
|
+
try {
|
|
83524
|
+
const layout = this.config.layout;
|
|
83525
|
+
if (!layout || !Array.isArray(layout.pages)) {
|
|
83526
|
+
throw new Error("Invalid layout: missing or invalid pages array");
|
|
83527
|
+
}
|
|
83528
|
+
const pageGap = this.config.pageGap ?? layout.pageGap ?? 0;
|
|
83529
|
+
const pageCount = layout.pages.length;
|
|
83530
|
+
if (!Number.isFinite(pageGap) || pageGap < 0) {
|
|
83531
|
+
throw new Error(`Invalid pageGap: ${pageGap} (must be non-negative finite number)`);
|
|
83532
|
+
}
|
|
83533
|
+
const cumulativeY = new Array(pageCount);
|
|
83534
|
+
const pageHeights = new Array(pageCount);
|
|
83535
|
+
let currentY = 0;
|
|
83536
|
+
for (let i = 0; i < pageCount; i++) {
|
|
83537
|
+
const page = layout.pages[i];
|
|
83538
|
+
if (!page) {
|
|
83539
|
+
throw new Error(`Invalid page at index ${i}: page is null or undefined`);
|
|
83540
|
+
}
|
|
83541
|
+
const pageHeight = page.size?.h ?? layout.pageSize.h;
|
|
83542
|
+
if (!Number.isFinite(pageHeight) || pageHeight < 0) {
|
|
83543
|
+
throw new Error(`Invalid page height at index ${i}: ${pageHeight} (must be non-negative finite number)`);
|
|
83544
|
+
}
|
|
83545
|
+
cumulativeY[i] = currentY;
|
|
83546
|
+
pageHeights[i] = pageHeight;
|
|
83547
|
+
currentY += pageHeight;
|
|
83548
|
+
if (i < pageCount - 1) {
|
|
83549
|
+
currentY += pageGap;
|
|
83550
|
+
}
|
|
83551
|
+
}
|
|
83552
|
+
const totalHeight = currentY;
|
|
83553
|
+
this.cache = {
|
|
83554
|
+
cumulativeY,
|
|
83555
|
+
pageHeights,
|
|
83556
|
+
pageGap,
|
|
83557
|
+
totalHeight,
|
|
83558
|
+
layoutVersion: 0
|
|
83559
|
+
// Placeholder for future version tracking
|
|
83560
|
+
};
|
|
83561
|
+
} catch (error) {
|
|
83562
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
83563
|
+
console.error(`[PageGeometryHelper] Cache build failed: ${errorMessage}. Using fallback empty cache.`);
|
|
83564
|
+
this.cache = {
|
|
83565
|
+
cumulativeY: [],
|
|
83566
|
+
pageHeights: [],
|
|
83567
|
+
pageGap: 0,
|
|
83568
|
+
totalHeight: 0,
|
|
83569
|
+
layoutVersion: 0
|
|
83570
|
+
};
|
|
83571
|
+
}
|
|
83572
|
+
}
|
|
83573
|
+
/**
|
|
83574
|
+
* Clears the cache, forcing recalculation on next access.
|
|
83575
|
+
* Useful for testing or manual cache invalidation.
|
|
83576
|
+
*/
|
|
83577
|
+
clearCache() {
|
|
83578
|
+
this.cache = null;
|
|
83579
|
+
}
|
|
83580
|
+
/**
|
|
83581
|
+
* Gets debug information about the current cache state.
|
|
83582
|
+
* @internal
|
|
83583
|
+
*/
|
|
83584
|
+
getDebugInfo() {
|
|
83585
|
+
this.ensureCache();
|
|
83586
|
+
return {
|
|
83587
|
+
isCached: this.cache !== null,
|
|
83588
|
+
pageCount: this.config.layout.pages.length,
|
|
83589
|
+
pageGap: this.cache.pageGap,
|
|
83590
|
+
totalHeight: this.cache.totalHeight,
|
|
83591
|
+
cumulativeY: [...this.cache.cumulativeY],
|
|
83592
|
+
pageHeights: [...this.cache.pageHeights]
|
|
83593
|
+
};
|
|
83594
|
+
}
|
|
83595
|
+
}
|
|
83311
83596
|
var Priority = /* @__PURE__ */ ((Priority2) => {
|
|
83312
83597
|
Priority2[Priority2["P0"] = 0] = "P0";
|
|
83313
83598
|
Priority2[Priority2["P1"] = 1] = "P1";
|
|
@@ -83601,18 +83886,41 @@ const rangesOverlap = (startA, endA, startB, endB) => {
|
|
|
83601
83886
|
const effectiveEndA = endA ?? startA + 1;
|
|
83602
83887
|
return effectiveEndA > startB && startA < endB;
|
|
83603
83888
|
};
|
|
83604
|
-
function hitTestPage(layout, point) {
|
|
83889
|
+
function hitTestPage(layout, point, geometryHelper) {
|
|
83890
|
+
if (geometryHelper) {
|
|
83891
|
+
const pageIndex = geometryHelper.getPageIndexAtY(point.y);
|
|
83892
|
+
if (pageIndex !== null) {
|
|
83893
|
+
return { pageIndex, page: layout.pages[pageIndex] };
|
|
83894
|
+
}
|
|
83895
|
+
const nearest = geometryHelper.getNearestPageIndex(point.y);
|
|
83896
|
+
if (nearest !== null) {
|
|
83897
|
+
return { pageIndex: nearest, page: layout.pages[nearest] };
|
|
83898
|
+
}
|
|
83899
|
+
return null;
|
|
83900
|
+
}
|
|
83605
83901
|
const pageGap = layout.pageGap ?? 0;
|
|
83606
83902
|
let cursorY = 0;
|
|
83903
|
+
let nearestIndex = null;
|
|
83904
|
+
let nearestDistance = Infinity;
|
|
83607
83905
|
for (let pageIndex = 0; pageIndex < layout.pages.length; pageIndex += 1) {
|
|
83608
83906
|
const page = layout.pages[pageIndex];
|
|
83907
|
+
const pageHeight = page.size?.h ?? layout.pageSize.h;
|
|
83609
83908
|
const top2 = cursorY;
|
|
83610
|
-
const bottom2 = top2 +
|
|
83909
|
+
const bottom2 = top2 + pageHeight;
|
|
83611
83910
|
if (point.y >= top2 && point.y < bottom2) {
|
|
83612
83911
|
return { pageIndex, page };
|
|
83613
83912
|
}
|
|
83913
|
+
const center = top2 + pageHeight / 2;
|
|
83914
|
+
const distance = Math.abs(point.y - center);
|
|
83915
|
+
if (distance < nearestDistance) {
|
|
83916
|
+
nearestDistance = distance;
|
|
83917
|
+
nearestIndex = pageIndex;
|
|
83918
|
+
}
|
|
83614
83919
|
cursorY = bottom2 + pageGap;
|
|
83615
83920
|
}
|
|
83921
|
+
if (nearestIndex !== null) {
|
|
83922
|
+
return { pageIndex: nearestIndex, page: layout.pages[nearestIndex] };
|
|
83923
|
+
}
|
|
83616
83924
|
return null;
|
|
83617
83925
|
}
|
|
83618
83926
|
function hitTestFragment(layout, pageHit, blocks, measures, point) {
|
|
@@ -83773,7 +84081,7 @@ const hitTestTableFragment = (pageHit, blocks, measures, point) => {
|
|
|
83773
84081
|
}
|
|
83774
84082
|
return null;
|
|
83775
84083
|
};
|
|
83776
|
-
function clickToPosition(layout, blocks, measures, containerPoint, domContainer, clientX, clientY) {
|
|
84084
|
+
function clickToPosition(layout, blocks, measures, containerPoint, domContainer, clientX, clientY, geometryHelper) {
|
|
83777
84085
|
logClickStage("log", "entry", {
|
|
83778
84086
|
pages: layout.pages.length
|
|
83779
84087
|
});
|
|
@@ -83816,75 +84124,132 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
|
|
|
83816
84124
|
return { pos: domPos, blockId: "", pageIndex: 0, column: 0, lineIndex: -1 };
|
|
83817
84125
|
}
|
|
83818
84126
|
}
|
|
83819
|
-
const pageHit = hitTestPage(layout, containerPoint);
|
|
84127
|
+
const pageHit = hitTestPage(layout, containerPoint, geometryHelper);
|
|
83820
84128
|
if (!pageHit) {
|
|
83821
84129
|
return null;
|
|
83822
84130
|
}
|
|
83823
|
-
const
|
|
84131
|
+
const pageTopY = geometryHelper ? geometryHelper.getPageTop(pageHit.pageIndex) : calculatePageTopFallback(layout, pageHit.pageIndex);
|
|
83824
84132
|
const pageRelativePoint = {
|
|
83825
84133
|
x: containerPoint.x,
|
|
83826
|
-
y: containerPoint.y -
|
|
84134
|
+
y: containerPoint.y - pageTopY
|
|
83827
84135
|
};
|
|
83828
84136
|
logClickStage("log", "page-hit", {
|
|
83829
84137
|
pageIndex: pageHit.pageIndex
|
|
83830
84138
|
});
|
|
83831
|
-
|
|
84139
|
+
let fragmentHit = hitTestFragment(layout, pageHit, blocks, measures, pageRelativePoint);
|
|
84140
|
+
if (!fragmentHit) {
|
|
84141
|
+
const page = pageHit.page;
|
|
84142
|
+
const fragments = page.fragments.filter(
|
|
84143
|
+
(f2) => f2 != null && typeof f2 === "object"
|
|
84144
|
+
);
|
|
84145
|
+
if (fragments.length > 0) {
|
|
84146
|
+
let nearest = null;
|
|
84147
|
+
let nearestDist = Infinity;
|
|
84148
|
+
for (const frag of fragments) {
|
|
84149
|
+
const top2 = frag.y;
|
|
84150
|
+
const bottom2 = frag.y + frag.height;
|
|
84151
|
+
let dist2;
|
|
84152
|
+
if (pageRelativePoint.y < top2) {
|
|
84153
|
+
dist2 = top2 - pageRelativePoint.y;
|
|
84154
|
+
} else if (pageRelativePoint.y > bottom2) {
|
|
84155
|
+
dist2 = pageRelativePoint.y - bottom2;
|
|
84156
|
+
} else {
|
|
84157
|
+
dist2 = 0;
|
|
84158
|
+
}
|
|
84159
|
+
if (dist2 < nearestDist) {
|
|
84160
|
+
nearestDist = dist2;
|
|
84161
|
+
nearest = frag;
|
|
84162
|
+
}
|
|
84163
|
+
}
|
|
84164
|
+
if (nearest) {
|
|
84165
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, nearest.blockId);
|
|
84166
|
+
if (blockIndex !== -1) {
|
|
84167
|
+
const block = blocks[blockIndex];
|
|
84168
|
+
const measure = measures[blockIndex];
|
|
84169
|
+
if (block && measure) {
|
|
84170
|
+
fragmentHit = {
|
|
84171
|
+
fragment: nearest,
|
|
84172
|
+
block,
|
|
84173
|
+
measure,
|
|
84174
|
+
pageIndex: pageHit.pageIndex,
|
|
84175
|
+
pageY: 0
|
|
84176
|
+
};
|
|
84177
|
+
}
|
|
84178
|
+
}
|
|
84179
|
+
}
|
|
84180
|
+
}
|
|
84181
|
+
}
|
|
83832
84182
|
if (fragmentHit) {
|
|
83833
84183
|
const { fragment, block, measure, pageIndex, pageY } = fragmentHit;
|
|
83834
|
-
if (fragment.kind
|
|
83835
|
-
|
|
83836
|
-
|
|
83837
|
-
|
|
83838
|
-
|
|
84184
|
+
if (fragment.kind === "para" && measure.kind === "paragraph" && block.kind === "paragraph") {
|
|
84185
|
+
const lineIndex = findLineIndexAtY(measure, pageY, fragment.fromLine, fragment.toLine);
|
|
84186
|
+
if (lineIndex == null) {
|
|
84187
|
+
logClickStage("warn", "no-line", {
|
|
84188
|
+
blockId: fragment.blockId
|
|
84189
|
+
});
|
|
84190
|
+
return null;
|
|
84191
|
+
}
|
|
84192
|
+
const line = measure.lines[lineIndex];
|
|
84193
|
+
const isRTL = isRtlBlock(block);
|
|
84194
|
+
const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
|
|
84195
|
+
const indentRight = typeof block.attrs?.indent?.right === "number" ? block.attrs.indent.right : 0;
|
|
84196
|
+
const paraIndentLeft = Number.isFinite(indentLeft) ? indentLeft : 0;
|
|
84197
|
+
const paraIndentRight = Number.isFinite(indentRight) ? indentRight : 0;
|
|
84198
|
+
const totalIndent = paraIndentLeft + paraIndentRight;
|
|
84199
|
+
const availableWidth = Math.max(0, fragment.width - totalIndent);
|
|
84200
|
+
if (totalIndent > fragment.width) {
|
|
84201
|
+
console.warn(
|
|
84202
|
+
`[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.`
|
|
84203
|
+
);
|
|
84204
|
+
}
|
|
84205
|
+
const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
84206
|
+
const isListItem3 = markerWidth > 0;
|
|
84207
|
+
const alignmentOverride = isListItem3 ? "left" : void 0;
|
|
84208
|
+
const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth, alignmentOverride);
|
|
84209
|
+
if (pos == null) {
|
|
84210
|
+
logClickStage("warn", "no-position", {
|
|
84211
|
+
blockId: fragment.blockId
|
|
84212
|
+
});
|
|
84213
|
+
return null;
|
|
84214
|
+
}
|
|
84215
|
+
const column = determineColumn(layout, fragment.x);
|
|
84216
|
+
logPositionDebug({
|
|
84217
|
+
blockId: fragment.blockId,
|
|
84218
|
+
x: pageRelativePoint.x - fragment.x
|
|
83839
84219
|
});
|
|
83840
|
-
|
|
83841
|
-
}
|
|
83842
|
-
const lineIndex = findLineIndexAtY(measure, pageY, fragment.fromLine, fragment.toLine);
|
|
83843
|
-
if (lineIndex == null) {
|
|
83844
|
-
logClickStage("warn", "no-line", {
|
|
84220
|
+
logClickStage("log", "success", {
|
|
83845
84221
|
blockId: fragment.blockId
|
|
83846
84222
|
});
|
|
83847
|
-
return
|
|
83848
|
-
|
|
83849
|
-
|
|
83850
|
-
|
|
83851
|
-
|
|
83852
|
-
|
|
83853
|
-
|
|
83854
|
-
|
|
83855
|
-
const totalIndent = paraIndentLeft + paraIndentRight;
|
|
83856
|
-
const availableWidth = Math.max(0, fragment.width - totalIndent);
|
|
83857
|
-
if (totalIndent > fragment.width) {
|
|
83858
|
-
console.warn(
|
|
83859
|
-
`[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.`
|
|
83860
|
-
);
|
|
84223
|
+
return {
|
|
84224
|
+
pos,
|
|
84225
|
+
blockId: fragment.blockId,
|
|
84226
|
+
pageIndex,
|
|
84227
|
+
column,
|
|
84228
|
+
lineIndex
|
|
84229
|
+
// lineIndex is now already absolute (within measure.lines), no need to add fragment.fromLine
|
|
84230
|
+
};
|
|
83861
84231
|
}
|
|
83862
|
-
|
|
83863
|
-
|
|
83864
|
-
|
|
83865
|
-
|
|
83866
|
-
|
|
83867
|
-
|
|
83868
|
-
|
|
84232
|
+
if (isAtomicFragment(fragment)) {
|
|
84233
|
+
const pmRange = getAtomicPmRange(fragment, block);
|
|
84234
|
+
const pos = pmRange.pmStart ?? pmRange.pmEnd ?? null;
|
|
84235
|
+
if (pos == null) {
|
|
84236
|
+
logClickStage("warn", "atomic-without-range", {
|
|
84237
|
+
fragmentId: fragment.blockId
|
|
84238
|
+
});
|
|
84239
|
+
return null;
|
|
84240
|
+
}
|
|
84241
|
+
logClickStage("log", "success", {
|
|
84242
|
+
blockId: fragment.blockId,
|
|
84243
|
+
column: determineColumn(layout, fragment.x)
|
|
83869
84244
|
});
|
|
83870
|
-
return
|
|
84245
|
+
return {
|
|
84246
|
+
pos,
|
|
84247
|
+
blockId: fragment.blockId,
|
|
84248
|
+
pageIndex,
|
|
84249
|
+
column: determineColumn(layout, fragment.x),
|
|
84250
|
+
lineIndex: -1
|
|
84251
|
+
};
|
|
83871
84252
|
}
|
|
83872
|
-
const column = determineColumn(layout, fragment.x);
|
|
83873
|
-
logPositionDebug({
|
|
83874
|
-
blockId: fragment.blockId,
|
|
83875
|
-
x: pageRelativePoint.x - fragment.x
|
|
83876
|
-
});
|
|
83877
|
-
logClickStage("log", "success", {
|
|
83878
|
-
blockId: fragment.blockId
|
|
83879
|
-
});
|
|
83880
|
-
return {
|
|
83881
|
-
pos,
|
|
83882
|
-
blockId: fragment.blockId,
|
|
83883
|
-
pageIndex,
|
|
83884
|
-
column,
|
|
83885
|
-
lineIndex
|
|
83886
|
-
// lineIndex is now already absolute (within measure.lines), no need to add fragment.fromLine
|
|
83887
|
-
};
|
|
83888
84253
|
}
|
|
83889
84254
|
const tableHit = hitTestTableFragment(pageHit, blocks, measures, pageRelativePoint);
|
|
83890
84255
|
if (tableHit) {
|
|
@@ -84034,12 +84399,22 @@ const sumLineHeights = (measure, fromLine, toLine) => {
|
|
|
84034
84399
|
}
|
|
84035
84400
|
return height;
|
|
84036
84401
|
};
|
|
84037
|
-
|
|
84402
|
+
const calculatePageTopFallback = (layout, pageIndex) => {
|
|
84403
|
+
const pageGap = layout.pageGap ?? 0;
|
|
84404
|
+
let y2 = 0;
|
|
84405
|
+
for (let i = 0; i < pageIndex; i++) {
|
|
84406
|
+
const pageHeight = layout.pages[i]?.size?.h ?? layout.pageSize.h;
|
|
84407
|
+
y2 += pageHeight + pageGap;
|
|
84408
|
+
}
|
|
84409
|
+
return y2;
|
|
84410
|
+
};
|
|
84411
|
+
function selectionToRects(layout, blocks, measures, from2, to, geometryHelper) {
|
|
84038
84412
|
if (from2 === to) {
|
|
84039
84413
|
return [];
|
|
84040
84414
|
}
|
|
84041
84415
|
const rects = [];
|
|
84042
84416
|
layout.pages.forEach((page, pageIndex) => {
|
|
84417
|
+
const pageTopY = geometryHelper ? geometryHelper.getPageTop(pageIndex) : calculatePageTopFallback(layout, pageIndex);
|
|
84043
84418
|
page.fragments.forEach((fragment) => {
|
|
84044
84419
|
if (fragment.kind === "para") {
|
|
84045
84420
|
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
@@ -84081,12 +84456,16 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
84081
84456
|
wordLayout
|
|
84082
84457
|
});
|
|
84083
84458
|
const rectX = fragment.x + indentAdjust + Math.min(startX, endX);
|
|
84084
|
-
const rectWidth = Math.max(
|
|
84459
|
+
const rectWidth = Math.max(
|
|
84460
|
+
1,
|
|
84461
|
+
Math.min(Math.abs(endX - startX), line.width)
|
|
84462
|
+
// clamp to line width to prevent runaway widths
|
|
84463
|
+
);
|
|
84085
84464
|
const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
|
|
84086
84465
|
const rectY = fragment.y + lineOffset;
|
|
84087
84466
|
rects.push({
|
|
84088
84467
|
x: rectX,
|
|
84089
|
-
y: rectY +
|
|
84468
|
+
y: rectY + pageTopY,
|
|
84090
84469
|
width: rectWidth,
|
|
84091
84470
|
height: line.lineHeight,
|
|
84092
84471
|
pageIndex
|
|
@@ -84214,12 +84593,16 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
84214
84593
|
wordLayout: cellWordLayout
|
|
84215
84594
|
});
|
|
84216
84595
|
const rectX = fragment.x + cellX + padding.left + textIndentAdjust + Math.min(startX, endX);
|
|
84217
|
-
const rectWidth = Math.max(
|
|
84596
|
+
const rectWidth = Math.max(
|
|
84597
|
+
1,
|
|
84598
|
+
Math.min(Math.abs(endX - startX), line.width)
|
|
84599
|
+
// clamp to line width to prevent runaway widths
|
|
84600
|
+
);
|
|
84218
84601
|
const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
|
|
84219
84602
|
const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
|
|
84220
84603
|
rects.push({
|
|
84221
84604
|
x: rectX,
|
|
84222
|
-
y: rectY +
|
|
84605
|
+
y: rectY + pageTopY,
|
|
84223
84606
|
width: rectWidth,
|
|
84224
84607
|
height: line.lineHeight,
|
|
84225
84608
|
pageIndex
|
|
@@ -84248,7 +84631,7 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
84248
84631
|
if (!rangesOverlap(pmRange.pmStart, pmRange.pmEnd, from2, to)) return;
|
|
84249
84632
|
rects.push({
|
|
84250
84633
|
x: fragment.x,
|
|
84251
|
-
y: fragment.y +
|
|
84634
|
+
y: fragment.y + pageTopY,
|
|
84252
84635
|
width: fragment.width,
|
|
84253
84636
|
height: fragment.height,
|
|
84254
84637
|
pageIndex
|
|
@@ -87489,6 +87872,7 @@ const DEFAULT_PAGE_SIZE = { w: 612, h: 792 };
|
|
|
87489
87872
|
const DEFAULT_MARGINS = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
87490
87873
|
const DEFAULT_VIRTUALIZED_PAGE_GAP = 72;
|
|
87491
87874
|
const DEFAULT_PAGE_GAP = 24;
|
|
87875
|
+
const DEFAULT_HORIZONTAL_PAGE_GAP = 20;
|
|
87492
87876
|
const WORD_CHARACTER_REGEX = /[\p{L}\p{N}''_~-]/u;
|
|
87493
87877
|
const MULTI_CLICK_TIME_THRESHOLD_MS = 400;
|
|
87494
87878
|
const MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5;
|
|
@@ -87512,6 +87896,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
87512
87896
|
__privateAdd$1(this, _layoutOptions);
|
|
87513
87897
|
__privateAdd$1(this, _layoutState, { blocks: [], measures: [], layout: null, bookmarks: /* @__PURE__ */ new Map() });
|
|
87514
87898
|
__privateAdd$1(this, _domPainter, null);
|
|
87899
|
+
__privateAdd$1(this, _pageGeometryHelper, null);
|
|
87515
87900
|
__privateAdd$1(this, _dragHandlerCleanup, null);
|
|
87516
87901
|
__privateAdd$1(this, _layoutError, null);
|
|
87517
87902
|
__privateAdd$1(this, _layoutErrorState, "healthy");
|
|
@@ -87664,7 +88049,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
87664
88049
|
{ x: x2, y: y2 },
|
|
87665
88050
|
__privateGet$1(this, _viewportHost),
|
|
87666
88051
|
event.clientX,
|
|
87667
|
-
event.clientY
|
|
88052
|
+
event.clientY,
|
|
88053
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
87668
88054
|
);
|
|
87669
88055
|
const doc22 = __privateGet$1(this, _editor3).state?.doc;
|
|
87670
88056
|
const hit = rawHit && doc22 ? { ...rawHit, pos: Math.max(0, Math.min(rawHit.pos, doc22.content.size)) } : rawHit;
|
|
@@ -87863,7 +88249,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
87863
88249
|
{ x: normalized.x, y: normalized.y },
|
|
87864
88250
|
__privateGet$1(this, _viewportHost),
|
|
87865
88251
|
event.clientX,
|
|
87866
|
-
event.clientY
|
|
88252
|
+
event.clientY,
|
|
88253
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
87867
88254
|
);
|
|
87868
88255
|
if (!hit) return;
|
|
87869
88256
|
const currentTableHit = __privateMethod$1(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
|
|
@@ -88710,7 +89097,14 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
88710
89097
|
return __privateMethod$1(this, _PresentationEditor_instances, computeHeaderFooterSelectionRects_fn).call(this, start2, end2);
|
|
88711
89098
|
}
|
|
88712
89099
|
if (!__privateGet$1(this, _layoutState).layout) return [];
|
|
88713
|
-
const rects = selectionToRects(
|
|
89100
|
+
const rects = selectionToRects(
|
|
89101
|
+
__privateGet$1(this, _layoutState).layout,
|
|
89102
|
+
__privateGet$1(this, _layoutState).blocks,
|
|
89103
|
+
__privateGet$1(this, _layoutState).measures,
|
|
89104
|
+
start2,
|
|
89105
|
+
end2,
|
|
89106
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
89107
|
+
) ?? [];
|
|
88714
89108
|
return rects;
|
|
88715
89109
|
};
|
|
88716
89110
|
const rawRects = layoutRectSource();
|
|
@@ -88975,6 +89369,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
88975
89369
|
};
|
|
88976
89370
|
}
|
|
88977
89371
|
__privateSet(this, _domPainter, null);
|
|
89372
|
+
__privateSet(this, _pageGeometryHelper, null);
|
|
88978
89373
|
__privateSet(this, _pendingDocChange, true);
|
|
88979
89374
|
__privateMethod$1(this, _PresentationEditor_instances, scheduleRerender_fn).call(this);
|
|
88980
89375
|
}
|
|
@@ -89007,7 +89402,16 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
89007
89402
|
x: localX,
|
|
89008
89403
|
y: headerPageIndex * headerPageHeight + (localY - headerPageIndex * headerPageHeight)
|
|
89009
89404
|
};
|
|
89010
|
-
const hit2 = clickToPosition(
|
|
89405
|
+
const hit2 = clickToPosition(
|
|
89406
|
+
context.layout,
|
|
89407
|
+
context.blocks,
|
|
89408
|
+
context.measures,
|
|
89409
|
+
headerPoint,
|
|
89410
|
+
void 0,
|
|
89411
|
+
void 0,
|
|
89412
|
+
void 0,
|
|
89413
|
+
void 0
|
|
89414
|
+
) ?? null;
|
|
89011
89415
|
return hit2;
|
|
89012
89416
|
}
|
|
89013
89417
|
if (!__privateGet$1(this, _layoutState).layout) {
|
|
@@ -89020,7 +89424,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
89020
89424
|
normalized,
|
|
89021
89425
|
__privateGet$1(this, _viewportHost),
|
|
89022
89426
|
clientX,
|
|
89023
|
-
clientY
|
|
89427
|
+
clientY,
|
|
89428
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
89024
89429
|
) ?? null;
|
|
89025
89430
|
return hit;
|
|
89026
89431
|
}
|
|
@@ -89243,6 +89648,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
89243
89648
|
__privateSet(this, _session, { mode: "body" });
|
|
89244
89649
|
__privateSet(this, _activeHeaderFooterEditor, null);
|
|
89245
89650
|
__privateSet(this, _domPainter, null);
|
|
89651
|
+
__privateSet(this, _pageGeometryHelper, null);
|
|
89246
89652
|
(_a2 = __privateGet$1(this, _dragHandlerCleanup)) == null ? void 0 : _a2.call(this);
|
|
89247
89653
|
__privateSet(this, _dragHandlerCleanup, null);
|
|
89248
89654
|
__privateGet$1(this, _selectionOverlay2)?.remove();
|
|
@@ -89296,7 +89702,14 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
89296
89702
|
if (!normalized) return false;
|
|
89297
89703
|
const pmPos = __privateGet$1(this, _layoutState).bookmarks.get(normalized);
|
|
89298
89704
|
if (pmPos == null) return false;
|
|
89299
|
-
const rects = selectionToRects(
|
|
89705
|
+
const rects = selectionToRects(
|
|
89706
|
+
layout,
|
|
89707
|
+
__privateGet$1(this, _layoutState).blocks,
|
|
89708
|
+
__privateGet$1(this, _layoutState).measures,
|
|
89709
|
+
pmPos,
|
|
89710
|
+
pmPos + 1,
|
|
89711
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
89712
|
+
) ?? [];
|
|
89300
89713
|
const rect = rects[0];
|
|
89301
89714
|
let pageIndex = rect?.pageIndex ?? null;
|
|
89302
89715
|
if (pageIndex == null) {
|
|
@@ -89360,6 +89773,7 @@ _hiddenHost = /* @__PURE__ */ new WeakMap();
|
|
|
89360
89773
|
_layoutOptions = /* @__PURE__ */ new WeakMap();
|
|
89361
89774
|
_layoutState = /* @__PURE__ */ new WeakMap();
|
|
89362
89775
|
_domPainter = /* @__PURE__ */ new WeakMap();
|
|
89776
|
+
_pageGeometryHelper = /* @__PURE__ */ new WeakMap();
|
|
89363
89777
|
_dragHandlerCleanup = /* @__PURE__ */ new WeakMap();
|
|
89364
89778
|
_layoutError = /* @__PURE__ */ new WeakMap();
|
|
89365
89779
|
_layoutErrorState = /* @__PURE__ */ new WeakMap();
|
|
@@ -89818,7 +90232,7 @@ renderRemoteSelection_fn = function(cursor) {
|
|
|
89818
90232
|
if (!layout || !blocks || !measures) return;
|
|
89819
90233
|
const start2 = Math.min(cursor.anchor, cursor.head);
|
|
89820
90234
|
const end2 = Math.max(cursor.anchor, cursor.head);
|
|
89821
|
-
const rects = selectionToRects(layout, blocks, measures, start2, end2) ?? [];
|
|
90235
|
+
const rects = selectionToRects(layout, blocks, measures, start2, end2, __privateGet$1(this, _pageGeometryHelper) ?? void 0) ?? [];
|
|
89822
90236
|
const color = __privateMethod$1(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
89823
90237
|
const opacity = __privateGet$1(this, _layoutOptions).presence?.highlightOpacity ?? 0.35;
|
|
89824
90238
|
const pageHeight = layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
@@ -90178,15 +90592,25 @@ hitTestTable_fn = function(normalizedX, normalizedY) {
|
|
|
90178
90592
|
const configuredPageSize = __privateGet$1(this, _layoutOptions).pageSize ?? DEFAULT_PAGE_SIZE;
|
|
90179
90593
|
let pageY = 0;
|
|
90180
90594
|
let pageHit = null;
|
|
90181
|
-
|
|
90182
|
-
|
|
90183
|
-
const
|
|
90184
|
-
|
|
90185
|
-
|
|
90186
|
-
|
|
90187
|
-
|
|
90595
|
+
const geometryHelper = __privateGet$1(this, _pageGeometryHelper);
|
|
90596
|
+
if (geometryHelper) {
|
|
90597
|
+
const idx = geometryHelper.getPageIndexAtY(normalizedY) ?? geometryHelper.getNearestPageIndex(normalizedY);
|
|
90598
|
+
if (idx != null && layout.pages[idx]) {
|
|
90599
|
+
pageHit = { pageIndex: idx, page: layout.pages[idx] };
|
|
90600
|
+
pageY = geometryHelper.getPageTop(idx);
|
|
90601
|
+
}
|
|
90602
|
+
}
|
|
90603
|
+
if (!pageHit) {
|
|
90604
|
+
const gap = layout.pageGap ?? __privateMethod$1(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this);
|
|
90605
|
+
for (let i = 0; i < layout.pages.length; i++) {
|
|
90606
|
+
const page = layout.pages[i];
|
|
90607
|
+
const pageHeight = page.size?.h ?? configuredPageSize.h;
|
|
90608
|
+
if (normalizedY >= pageY && normalizedY < pageY + pageHeight) {
|
|
90609
|
+
pageHit = { pageIndex: i, page };
|
|
90610
|
+
break;
|
|
90611
|
+
}
|
|
90612
|
+
pageY += pageHeight + gap;
|
|
90188
90613
|
}
|
|
90189
|
-
pageY += pageHeight + gap;
|
|
90190
90614
|
}
|
|
90191
90615
|
if (!pageHit) {
|
|
90192
90616
|
return null;
|
|
@@ -90438,12 +90862,7 @@ rerender_fn = async function() {
|
|
|
90438
90862
|
return;
|
|
90439
90863
|
}
|
|
90440
90864
|
({ layout, measures } = result);
|
|
90441
|
-
|
|
90442
|
-
const gap = __privateGet$1(this, _layoutOptions).virtualization.gap ?? DEFAULT_VIRTUALIZED_PAGE_GAP;
|
|
90443
|
-
layout.pageGap = Math.max(0, gap);
|
|
90444
|
-
} else {
|
|
90445
|
-
layout.pageGap = DEFAULT_PAGE_GAP;
|
|
90446
|
-
}
|
|
90865
|
+
layout.pageGap = __privateMethod$1(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this);
|
|
90447
90866
|
headerLayouts = result.headers;
|
|
90448
90867
|
footerLayouts = result.footers;
|
|
90449
90868
|
} catch (error) {
|
|
@@ -90460,6 +90879,17 @@ rerender_fn = async function() {
|
|
|
90460
90879
|
__privateSet(this, _layoutState, { blocks, measures, layout, bookmarks, anchorMap });
|
|
90461
90880
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
90462
90881
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
90882
|
+
if (__privateGet$1(this, _layoutState).layout) {
|
|
90883
|
+
const pageGap = __privateGet$1(this, _layoutState).layout.pageGap ?? __privateMethod$1(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this);
|
|
90884
|
+
if (!__privateGet$1(this, _pageGeometryHelper)) {
|
|
90885
|
+
__privateSet(this, _pageGeometryHelper, new PageGeometryHelper({
|
|
90886
|
+
layout: __privateGet$1(this, _layoutState).layout,
|
|
90887
|
+
pageGap
|
|
90888
|
+
}));
|
|
90889
|
+
} else {
|
|
90890
|
+
__privateGet$1(this, _pageGeometryHelper).updateLayout(__privateGet$1(this, _layoutState).layout, pageGap);
|
|
90891
|
+
}
|
|
90892
|
+
}
|
|
90463
90893
|
await __privateMethod$1(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
90464
90894
|
__privateMethod$1(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
|
|
90465
90895
|
const painter = __privateMethod$1(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks, measures);
|
|
@@ -90529,7 +90959,8 @@ ensurePainter_fn = function(blocks, measures) {
|
|
|
90529
90959
|
pageStyles: __privateGet$1(this, _layoutOptions).pageStyles,
|
|
90530
90960
|
headerProvider: __privateGet$1(this, _headerDecorationProvider),
|
|
90531
90961
|
footerProvider: __privateGet$1(this, _footerDecorationProvider),
|
|
90532
|
-
ruler: __privateGet$1(this, _layoutOptions).ruler
|
|
90962
|
+
ruler: __privateGet$1(this, _layoutOptions).ruler,
|
|
90963
|
+
pageGap: __privateGet$1(this, _layoutState).layout?.pageGap ?? __privateMethod$1(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this)
|
|
90533
90964
|
}));
|
|
90534
90965
|
}
|
|
90535
90966
|
return __privateGet$1(this, _domPainter);
|
|
@@ -90617,7 +91048,14 @@ updateSelection_fn = function() {
|
|
|
90617
91048
|
}
|
|
90618
91049
|
return;
|
|
90619
91050
|
}
|
|
90620
|
-
const rects = selectionToRects(
|
|
91051
|
+
const rects = selectionToRects(
|
|
91052
|
+
layout,
|
|
91053
|
+
__privateGet$1(this, _layoutState).blocks,
|
|
91054
|
+
__privateGet$1(this, _layoutState).measures,
|
|
91055
|
+
from2,
|
|
91056
|
+
to,
|
|
91057
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
91058
|
+
) ?? [];
|
|
90621
91059
|
let domStart = null;
|
|
90622
91060
|
let domEnd = null;
|
|
90623
91061
|
try {
|
|
@@ -90631,7 +91069,9 @@ updateSelection_fn = function() {
|
|
|
90631
91069
|
const correctedRects = __privateMethod$1(this, _PresentationEditor_instances, applyDomCorrectionToRects_fn).call(this, rects, domStart, domEnd);
|
|
90632
91070
|
try {
|
|
90633
91071
|
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
90634
|
-
|
|
91072
|
+
if (correctedRects.length > 0) {
|
|
91073
|
+
__privateMethod$1(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this, correctedRects);
|
|
91074
|
+
}
|
|
90635
91075
|
} catch (error) {
|
|
90636
91076
|
if (process$1$1.env.NODE_ENV === "development") {
|
|
90637
91077
|
console.warn("[PresentationEditor] Failed to render selection rects:", error);
|
|
@@ -91419,6 +91859,15 @@ waitForPageMount_fn = async function(pageIndex, options = {}) {
|
|
|
91419
91859
|
checkPage();
|
|
91420
91860
|
});
|
|
91421
91861
|
};
|
|
91862
|
+
getEffectivePageGap_fn = function() {
|
|
91863
|
+
if (__privateGet$1(this, _layoutOptions).virtualization?.enabled) {
|
|
91864
|
+
return Math.max(0, __privateGet$1(this, _layoutOptions).virtualization.gap ?? DEFAULT_VIRTUALIZED_PAGE_GAP);
|
|
91865
|
+
}
|
|
91866
|
+
if (__privateGet$1(this, _layoutOptions).layoutMode === "horizontal") {
|
|
91867
|
+
return DEFAULT_HORIZONTAL_PAGE_GAP;
|
|
91868
|
+
}
|
|
91869
|
+
return DEFAULT_PAGE_GAP;
|
|
91870
|
+
};
|
|
91422
91871
|
getBodyPageHeight_fn = function() {
|
|
91423
91872
|
return __privateGet$1(this, _layoutState).layout?.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
91424
91873
|
};
|
|
@@ -91442,7 +91891,7 @@ applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
|
|
|
91442
91891
|
dy: domStart.y - layoutY
|
|
91443
91892
|
};
|
|
91444
91893
|
}
|
|
91445
|
-
|
|
91894
|
+
const corrected = rects.map((rect, idx) => {
|
|
91446
91895
|
const delta = pageDelta[rect.pageIndex];
|
|
91447
91896
|
let adjustedX = delta ? rect.x + delta.dx : rect.x;
|
|
91448
91897
|
let adjustedY = delta ? rect.y + delta.dy : rect.y;
|
|
@@ -91457,6 +91906,7 @@ applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
|
|
|
91457
91906
|
}
|
|
91458
91907
|
if (isLastRect && domEnd && rect.pageIndex === domEnd.pageIndex) {
|
|
91459
91908
|
const endX = domEnd.x;
|
|
91909
|
+
adjustedX = Math.min(adjustedX, endX);
|
|
91460
91910
|
adjustedWidth = Math.max(1, endX - adjustedX);
|
|
91461
91911
|
}
|
|
91462
91912
|
return {
|
|
@@ -91466,6 +91916,29 @@ applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
|
|
|
91466
91916
|
width: adjustedWidth
|
|
91467
91917
|
};
|
|
91468
91918
|
});
|
|
91919
|
+
const MAX_DELTA_PX = 12;
|
|
91920
|
+
let invalid = false;
|
|
91921
|
+
if (domStart && corrected[0]) {
|
|
91922
|
+
const dx = Math.abs(corrected[0].x - domStart.x);
|
|
91923
|
+
const dy = Math.abs(corrected[0].y - domStart.y);
|
|
91924
|
+
if (dx > MAX_DELTA_PX || dy > MAX_DELTA_PX) invalid = true;
|
|
91925
|
+
}
|
|
91926
|
+
if (domEnd && corrected[corrected.length - 1]) {
|
|
91927
|
+
const last = corrected[corrected.length - 1];
|
|
91928
|
+
const dx = Math.abs(last.x + last.width - domEnd.x);
|
|
91929
|
+
const dy = Math.abs(last.y - domEnd.y);
|
|
91930
|
+
if (dx > MAX_DELTA_PX || dy > MAX_DELTA_PX) invalid = true;
|
|
91931
|
+
}
|
|
91932
|
+
if (invalid) {
|
|
91933
|
+
console.warn("[SelectionOverlay] Suppressing selection render due to large DOM/Layout mismatch", {
|
|
91934
|
+
domStart,
|
|
91935
|
+
domEnd,
|
|
91936
|
+
rectStart: corrected[0],
|
|
91937
|
+
rectEnd: corrected[corrected.length - 1]
|
|
91938
|
+
});
|
|
91939
|
+
return [];
|
|
91940
|
+
}
|
|
91941
|
+
return corrected;
|
|
91469
91942
|
};
|
|
91470
91943
|
renderCellSelectionOverlay_fn = function(selection, layout) {
|
|
91471
91944
|
const localSelectionLayer = __privateGet$1(this, _localSelectionLayer);
|
|
@@ -91749,7 +92222,7 @@ computeHeaderFooterSelectionRects_fn = function(from2, to) {
|
|
|
91749
92222
|
return [];
|
|
91750
92223
|
}
|
|
91751
92224
|
if (!bodyLayout) return [];
|
|
91752
|
-
const rects = selectionToRects(context.layout, context.blocks, context.measures, from2, to) ?? [];
|
|
92225
|
+
const rects = selectionToRects(context.layout, context.blocks, context.measures, from2, to, void 0) ?? [];
|
|
91753
92226
|
const headerPageHeight = context.layout.pageSize?.h ?? context.region.height ?? 1;
|
|
91754
92227
|
const bodyPageHeight = __privateMethod$1(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
91755
92228
|
return rects.map((rect) => {
|
|
@@ -92216,7 +92689,14 @@ getCurrentPageIndex_fn = function() {
|
|
|
92216
92689
|
if (!layout || !selection) {
|
|
92217
92690
|
return 0;
|
|
92218
92691
|
}
|
|
92219
|
-
const rects = selectionToRects(
|
|
92692
|
+
const rects = selectionToRects(
|
|
92693
|
+
layout,
|
|
92694
|
+
__privateGet$1(this, _layoutState).blocks,
|
|
92695
|
+
__privateGet$1(this, _layoutState).measures,
|
|
92696
|
+
selection.from,
|
|
92697
|
+
selection.to,
|
|
92698
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
92699
|
+
) ?? [];
|
|
92220
92700
|
if (rects.length > 0) {
|
|
92221
92701
|
return rects[0]?.pageIndex ?? 0;
|
|
92222
92702
|
}
|