@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
|
@@ -42421,7 +42421,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42421
42421
|
static getStoredSuperdocVersion(docx) {
|
|
42422
42422
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42423
42423
|
}
|
|
42424
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
42424
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.101") {
|
|
42425
42425
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42426
42426
|
}
|
|
42427
42427
|
/**
|
|
@@ -45733,7 +45733,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
45733
45733
|
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);
|
|
45734
45734
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
45735
45735
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
45736
|
-
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;
|
|
45736
|
+
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;
|
|
45737
45737
|
var GOOD_LEAF_SIZE = 200;
|
|
45738
45738
|
var RopeSequence = function RopeSequence2() {
|
|
45739
45739
|
};
|
|
@@ -59639,7 +59639,7 @@ const isHeadless = (editor) => {
|
|
|
59639
59639
|
const shouldSkipNodeView = (editor) => {
|
|
59640
59640
|
return isHeadless(editor);
|
|
59641
59641
|
};
|
|
59642
|
-
const summaryVersion = "1.0.0-beta.
|
|
59642
|
+
const summaryVersion = "1.0.0-beta.101";
|
|
59643
59643
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59644
59644
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59645
59645
|
function mapAttributes(attrs) {
|
|
@@ -60428,7 +60428,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60428
60428
|
{ default: remarkStringify },
|
|
60429
60429
|
{ default: remarkGfm }
|
|
60430
60430
|
] = await Promise.all([
|
|
60431
|
-
Promise.resolve().then(() => require("./index-
|
|
60431
|
+
Promise.resolve().then(() => require("./index-N8gZUeSO-BneVBXkH.cjs")),
|
|
60432
60432
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
60433
60433
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
60434
60434
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -60633,7 +60633,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60633
60633
|
* Process collaboration migrations
|
|
60634
60634
|
*/
|
|
60635
60635
|
processCollaborationMigrations() {
|
|
60636
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
60636
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.101");
|
|
60637
60637
|
if (!this.options.ydoc) return;
|
|
60638
60638
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60639
60639
|
let docVersion = metaMap.get("version");
|
|
@@ -72716,7 +72716,7 @@ const containerStyles = {
|
|
|
72716
72716
|
alignItems: "center",
|
|
72717
72717
|
background: "transparent",
|
|
72718
72718
|
padding: "0",
|
|
72719
|
-
gap:
|
|
72719
|
+
// gap is set dynamically by renderer based on pageGap option (default: 24px)
|
|
72720
72720
|
overflowY: "auto"
|
|
72721
72721
|
};
|
|
72722
72722
|
const containerStylesHorizontal = {
|
|
@@ -72726,7 +72726,7 @@ const containerStylesHorizontal = {
|
|
|
72726
72726
|
justifyContent: "safe center",
|
|
72727
72727
|
background: "transparent",
|
|
72728
72728
|
padding: "0",
|
|
72729
|
-
gap:
|
|
72729
|
+
// gap is set dynamically by renderer based on pageGap option (default: 20px for horizontal)
|
|
72730
72730
|
overflowX: "auto",
|
|
72731
72731
|
minHeight: "100%"
|
|
72732
72732
|
};
|
|
@@ -74529,6 +74529,7 @@ function isMinimalWordLayout(value) {
|
|
|
74529
74529
|
const LIST_MARKER_GAP$1 = 8;
|
|
74530
74530
|
const DEFAULT_TAB_INTERVAL_PX$1 = 48;
|
|
74531
74531
|
const DEFAULT_PAGE_HEIGHT_PX = 1056;
|
|
74532
|
+
const DEFAULT_VIRTUALIZED_PAGE_GAP$1 = 72;
|
|
74532
74533
|
const COMMENT_EXTERNAL_COLOR = "#B1124B";
|
|
74533
74534
|
const COMMENT_INTERNAL_COLOR = "#078383";
|
|
74534
74535
|
const COMMENT_INACTIVE_ALPHA = "22";
|
|
@@ -74658,10 +74659,11 @@ const _DomPainter = class _DomPainter2 {
|
|
|
74658
74659
|
this.totalPages = 0;
|
|
74659
74660
|
this.linkIdCounter = 0;
|
|
74660
74661
|
this.pendingTooltips = /* @__PURE__ */ new WeakMap();
|
|
74662
|
+
this.pageGap = 24;
|
|
74661
74663
|
this.virtualEnabled = false;
|
|
74662
74664
|
this.virtualWindow = 5;
|
|
74663
74665
|
this.virtualOverscan = 0;
|
|
74664
|
-
this.virtualGap =
|
|
74666
|
+
this.virtualGap = DEFAULT_VIRTUALIZED_PAGE_GAP$1;
|
|
74665
74667
|
this.virtualPaddingTop = null;
|
|
74666
74668
|
this.topSpacerEl = null;
|
|
74667
74669
|
this.bottomSpacerEl = null;
|
|
@@ -74680,13 +74682,14 @@ const _DomPainter = class _DomPainter2 {
|
|
|
74680
74682
|
this.blockLookup = this.buildBlockLookup(blocks, measures);
|
|
74681
74683
|
this.headerProvider = options.headerProvider;
|
|
74682
74684
|
this.footerProvider = options.footerProvider;
|
|
74685
|
+
const defaultGap = this.layoutMode === "horizontal" ? 20 : 24;
|
|
74686
|
+
this.pageGap = typeof options.pageGap === "number" && Number.isFinite(options.pageGap) ? Math.max(0, options.pageGap) : defaultGap;
|
|
74683
74687
|
if (this.layoutMode === "vertical" && options.virtualization?.enabled) {
|
|
74684
74688
|
this.virtualEnabled = true;
|
|
74685
74689
|
this.virtualWindow = Math.max(1, options.virtualization.window ?? 5);
|
|
74686
74690
|
this.virtualOverscan = Math.max(0, options.virtualization.overscan ?? 0);
|
|
74687
|
-
|
|
74688
|
-
|
|
74689
|
-
}
|
|
74691
|
+
const hasExplicitVirtualGap = typeof options.virtualization.gap === "number" && Number.isFinite(options.virtualization.gap);
|
|
74692
|
+
this.virtualGap = hasExplicitVirtualGap ? Math.max(0, options.virtualization.gap) : DEFAULT_VIRTUALIZED_PAGE_GAP$1;
|
|
74690
74693
|
if (typeof options.virtualization.paddingTop === "number" && Number.isFinite(options.virtualization.paddingTop)) {
|
|
74691
74694
|
this.virtualPaddingTop = Math.max(0, options.virtualization.paddingTop);
|
|
74692
74695
|
}
|
|
@@ -74787,6 +74790,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
74787
74790
|
const mode = this.layoutMode;
|
|
74788
74791
|
if (mode === "horizontal") {
|
|
74789
74792
|
applyStyles$2(mount2, containerStylesHorizontal);
|
|
74793
|
+
mount2.style.gap = `${this.pageGap}px`;
|
|
74790
74794
|
this.renderHorizontal(layout, mount2);
|
|
74791
74795
|
this.currentLayout = layout;
|
|
74792
74796
|
this.pageStates = [];
|
|
@@ -74809,6 +74813,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
74809
74813
|
this.changedBlocks.clear();
|
|
74810
74814
|
return;
|
|
74811
74815
|
}
|
|
74816
|
+
mount2.style.gap = `${this.pageGap}px`;
|
|
74812
74817
|
if (!this.currentLayout || this.pageStates.length === 0) {
|
|
74813
74818
|
this.fullRender(layout);
|
|
74814
74819
|
} else {
|
|
@@ -78028,6 +78033,7 @@ const createDomPainter = (options) => {
|
|
|
78028
78033
|
const painter = new DomPainter(options.blocks, options.measures, {
|
|
78029
78034
|
pageStyles: options.pageStyles,
|
|
78030
78035
|
layoutMode: options.layoutMode,
|
|
78036
|
+
pageGap: options.pageGap,
|
|
78031
78037
|
headerProvider: options.headerProvider,
|
|
78032
78038
|
footerProvider: options.footerProvider,
|
|
78033
78039
|
virtualization: options.virtualization,
|
|
@@ -83325,6 +83331,285 @@ async function remeasureAffectedBlocks(blocks, measures, affectedBlockIds, const
|
|
|
83325
83331
|
}
|
|
83326
83332
|
return updatedMeasures;
|
|
83327
83333
|
}
|
|
83334
|
+
class PageGeometryHelper {
|
|
83335
|
+
/**
|
|
83336
|
+
* Creates a new PageGeometryHelper instance.
|
|
83337
|
+
*
|
|
83338
|
+
* @param config - Page geometry configuration
|
|
83339
|
+
*/
|
|
83340
|
+
constructor(config2) {
|
|
83341
|
+
this.cache = null;
|
|
83342
|
+
this.config = config2;
|
|
83343
|
+
}
|
|
83344
|
+
/**
|
|
83345
|
+
* Updates the layout and invalidates the cache.
|
|
83346
|
+
*
|
|
83347
|
+
* Call this whenever the layout changes (new pages, different heights, etc.)
|
|
83348
|
+
*
|
|
83349
|
+
* @param layout - New layout data
|
|
83350
|
+
* @param pageGap - Optional new page gap (if not provided, uses current gap)
|
|
83351
|
+
*/
|
|
83352
|
+
updateLayout(layout, pageGap) {
|
|
83353
|
+
this.config.layout = layout;
|
|
83354
|
+
if (pageGap !== void 0) {
|
|
83355
|
+
this.config.pageGap = pageGap;
|
|
83356
|
+
}
|
|
83357
|
+
this.cache = null;
|
|
83358
|
+
}
|
|
83359
|
+
/**
|
|
83360
|
+
* Updates the page gap and invalidates the cache.
|
|
83361
|
+
*
|
|
83362
|
+
* @param pageGap - New gap between pages in pixels
|
|
83363
|
+
*/
|
|
83364
|
+
updatePageGap(pageGap) {
|
|
83365
|
+
if (this.config.pageGap !== pageGap) {
|
|
83366
|
+
this.config.pageGap = pageGap;
|
|
83367
|
+
this.cache = null;
|
|
83368
|
+
}
|
|
83369
|
+
}
|
|
83370
|
+
/**
|
|
83371
|
+
* Gets the cumulative Y position (top edge) of a page in container space.
|
|
83372
|
+
*
|
|
83373
|
+
* The returned value is the distance from the top of the container to the
|
|
83374
|
+
* top of the specified page, accounting for all previous pages and gaps.
|
|
83375
|
+
*
|
|
83376
|
+
* @param pageIndex - Zero-based page index
|
|
83377
|
+
* @returns Y position in pixels, or 0 if page index is invalid
|
|
83378
|
+
*
|
|
83379
|
+
* @example
|
|
83380
|
+
* ```typescript
|
|
83381
|
+
* // Get Y position of page 0 (first page)
|
|
83382
|
+
* const y0 = helper.getPageTop(0); // Returns 0
|
|
83383
|
+
*
|
|
83384
|
+
* // Get Y position of page 2 (third page)
|
|
83385
|
+
* // Assumes page 0 height = 1000, page 1 height = 1200, gap = 24
|
|
83386
|
+
* const y2 = helper.getPageTop(2); // Returns 1000 + 24 + 1200 + 24 = 2248
|
|
83387
|
+
* ```
|
|
83388
|
+
*/
|
|
83389
|
+
getPageTop(pageIndex) {
|
|
83390
|
+
this.ensureCache();
|
|
83391
|
+
if (pageIndex < 0 || pageIndex >= this.cache.cumulativeY.length) {
|
|
83392
|
+
return 0;
|
|
83393
|
+
}
|
|
83394
|
+
return this.cache.cumulativeY[pageIndex];
|
|
83395
|
+
}
|
|
83396
|
+
/**
|
|
83397
|
+
* Gets the height of a specific page.
|
|
83398
|
+
*
|
|
83399
|
+
* Uses per-page height if available (from layout.pages[i].size?.h),
|
|
83400
|
+
* otherwise falls back to layout.pageSize.h.
|
|
83401
|
+
*
|
|
83402
|
+
* @param pageIndex - Zero-based page index
|
|
83403
|
+
* @returns Page height in pixels, or 0 if page index is invalid
|
|
83404
|
+
*
|
|
83405
|
+
* @example
|
|
83406
|
+
* ```typescript
|
|
83407
|
+
* const height = helper.getPageHeight(0); // Returns page-specific height
|
|
83408
|
+
* ```
|
|
83409
|
+
*/
|
|
83410
|
+
getPageHeight(pageIndex) {
|
|
83411
|
+
this.ensureCache();
|
|
83412
|
+
if (pageIndex < 0 || pageIndex >= this.cache.pageHeights.length) {
|
|
83413
|
+
return 0;
|
|
83414
|
+
}
|
|
83415
|
+
return this.cache.pageHeights[pageIndex];
|
|
83416
|
+
}
|
|
83417
|
+
/**
|
|
83418
|
+
* Gets the gap between pages.
|
|
83419
|
+
*
|
|
83420
|
+
* @returns Gap in pixels
|
|
83421
|
+
*
|
|
83422
|
+
* @example
|
|
83423
|
+
* ```typescript
|
|
83424
|
+
* const gap = helper.getPageGap(); // Returns 24
|
|
83425
|
+
* ```
|
|
83426
|
+
*/
|
|
83427
|
+
getPageGap() {
|
|
83428
|
+
this.ensureCache();
|
|
83429
|
+
return this.cache.pageGap;
|
|
83430
|
+
}
|
|
83431
|
+
/**
|
|
83432
|
+
* Gets the total height of all pages including gaps.
|
|
83433
|
+
*
|
|
83434
|
+
* Total height = sum of all page heights + (pageCount - 1) * gap
|
|
83435
|
+
*
|
|
83436
|
+
* @returns Total height in pixels
|
|
83437
|
+
*
|
|
83438
|
+
* @example
|
|
83439
|
+
* ```typescript
|
|
83440
|
+
* // 3 pages: heights [1000, 1200, 1000], gap = 24
|
|
83441
|
+
* const total = helper.getTotalHeight();
|
|
83442
|
+
* // Returns 1000 + 24 + 1200 + 24 + 1000 = 3248
|
|
83443
|
+
* ```
|
|
83444
|
+
*/
|
|
83445
|
+
getTotalHeight() {
|
|
83446
|
+
this.ensureCache();
|
|
83447
|
+
return this.cache.totalHeight;
|
|
83448
|
+
}
|
|
83449
|
+
/**
|
|
83450
|
+
* Gets the number of pages in the layout.
|
|
83451
|
+
*
|
|
83452
|
+
* @returns Page count
|
|
83453
|
+
*/
|
|
83454
|
+
getPageCount() {
|
|
83455
|
+
return this.config.layout.pages.length;
|
|
83456
|
+
}
|
|
83457
|
+
/**
|
|
83458
|
+
* Finds the page index containing a given Y coordinate.
|
|
83459
|
+
*
|
|
83460
|
+
* This performs a linear search through cached cumulative positions.
|
|
83461
|
+
* For large documents, consider adding binary search optimization.
|
|
83462
|
+
*
|
|
83463
|
+
* @param containerY - Y coordinate in container space
|
|
83464
|
+
* @returns Page index, or null if Y is outside all pages
|
|
83465
|
+
*
|
|
83466
|
+
* @example
|
|
83467
|
+
* ```typescript
|
|
83468
|
+
* // Find which page contains Y = 1500
|
|
83469
|
+
* const pageIndex = helper.getPageIndexAtY(1500);
|
|
83470
|
+
* // Returns 1 (second page) if first page ends at Y=1024
|
|
83471
|
+
* ```
|
|
83472
|
+
*/
|
|
83473
|
+
getPageIndexAtY(containerY) {
|
|
83474
|
+
this.ensureCache();
|
|
83475
|
+
const cache2 = this.cache;
|
|
83476
|
+
for (let i = 0; i < cache2.cumulativeY.length; i++) {
|
|
83477
|
+
const pageTop = cache2.cumulativeY[i];
|
|
83478
|
+
const pageBottom = pageTop + cache2.pageHeights[i];
|
|
83479
|
+
if (containerY >= pageTop && containerY < pageBottom) {
|
|
83480
|
+
return i;
|
|
83481
|
+
}
|
|
83482
|
+
}
|
|
83483
|
+
return null;
|
|
83484
|
+
}
|
|
83485
|
+
/**
|
|
83486
|
+
* Finds the nearest page index to a given Y coordinate (snap-to-nearest).
|
|
83487
|
+
*
|
|
83488
|
+
* Returns the page containing Y when inside a page; otherwise returns the
|
|
83489
|
+
* closest page based on distance to page center. Useful for dragging through
|
|
83490
|
+
* page gaps where getPageIndexAtY would return null.
|
|
83491
|
+
*
|
|
83492
|
+
* @param containerY - Y coordinate in container space
|
|
83493
|
+
* @returns Nearest page index, or null if there are no pages
|
|
83494
|
+
*/
|
|
83495
|
+
getNearestPageIndex(containerY) {
|
|
83496
|
+
this.ensureCache();
|
|
83497
|
+
const cache2 = this.cache;
|
|
83498
|
+
const pageCount = cache2.pageHeights.length;
|
|
83499
|
+
if (pageCount === 0) return null;
|
|
83500
|
+
const direct = this.getPageIndexAtY(containerY);
|
|
83501
|
+
if (direct !== null) return direct;
|
|
83502
|
+
let nearestIndex = 0;
|
|
83503
|
+
let nearestDistance = Infinity;
|
|
83504
|
+
for (let i = 0; i < pageCount; i++) {
|
|
83505
|
+
const top2 = cache2.cumulativeY[i];
|
|
83506
|
+
const height = cache2.pageHeights[i];
|
|
83507
|
+
const center = top2 + height / 2;
|
|
83508
|
+
const distance = Math.abs(containerY - center);
|
|
83509
|
+
if (distance < nearestDistance) {
|
|
83510
|
+
nearestDistance = distance;
|
|
83511
|
+
nearestIndex = i;
|
|
83512
|
+
}
|
|
83513
|
+
}
|
|
83514
|
+
return nearestIndex;
|
|
83515
|
+
}
|
|
83516
|
+
/**
|
|
83517
|
+
* Ensures the cache is built and up-to-date.
|
|
83518
|
+
* Validates cache state and rebuilds if needed.
|
|
83519
|
+
* @private
|
|
83520
|
+
* @throws Never throws - handles errors gracefully with fallback values
|
|
83521
|
+
*/
|
|
83522
|
+
ensureCache() {
|
|
83523
|
+
if (this.cache !== null) {
|
|
83524
|
+
if (!Array.isArray(this.cache.cumulativeY) || !Array.isArray(this.cache.pageHeights)) {
|
|
83525
|
+
console.warn("[PageGeometryHelper] Cache corruption detected, rebuilding cache");
|
|
83526
|
+
this.cache = null;
|
|
83527
|
+
} else {
|
|
83528
|
+
return;
|
|
83529
|
+
}
|
|
83530
|
+
}
|
|
83531
|
+
this.buildCache();
|
|
83532
|
+
}
|
|
83533
|
+
/**
|
|
83534
|
+
* Builds the geometry cache from current layout data.
|
|
83535
|
+
* Handles errors gracefully by providing fallback values.
|
|
83536
|
+
* @private
|
|
83537
|
+
* @throws Never throws - catches all errors and provides safe defaults
|
|
83538
|
+
*/
|
|
83539
|
+
buildCache() {
|
|
83540
|
+
try {
|
|
83541
|
+
const layout = this.config.layout;
|
|
83542
|
+
if (!layout || !Array.isArray(layout.pages)) {
|
|
83543
|
+
throw new Error("Invalid layout: missing or invalid pages array");
|
|
83544
|
+
}
|
|
83545
|
+
const pageGap = this.config.pageGap ?? layout.pageGap ?? 0;
|
|
83546
|
+
const pageCount = layout.pages.length;
|
|
83547
|
+
if (!Number.isFinite(pageGap) || pageGap < 0) {
|
|
83548
|
+
throw new Error(`Invalid pageGap: ${pageGap} (must be non-negative finite number)`);
|
|
83549
|
+
}
|
|
83550
|
+
const cumulativeY = new Array(pageCount);
|
|
83551
|
+
const pageHeights = new Array(pageCount);
|
|
83552
|
+
let currentY = 0;
|
|
83553
|
+
for (let i = 0; i < pageCount; i++) {
|
|
83554
|
+
const page = layout.pages[i];
|
|
83555
|
+
if (!page) {
|
|
83556
|
+
throw new Error(`Invalid page at index ${i}: page is null or undefined`);
|
|
83557
|
+
}
|
|
83558
|
+
const pageHeight = page.size?.h ?? layout.pageSize.h;
|
|
83559
|
+
if (!Number.isFinite(pageHeight) || pageHeight < 0) {
|
|
83560
|
+
throw new Error(`Invalid page height at index ${i}: ${pageHeight} (must be non-negative finite number)`);
|
|
83561
|
+
}
|
|
83562
|
+
cumulativeY[i] = currentY;
|
|
83563
|
+
pageHeights[i] = pageHeight;
|
|
83564
|
+
currentY += pageHeight;
|
|
83565
|
+
if (i < pageCount - 1) {
|
|
83566
|
+
currentY += pageGap;
|
|
83567
|
+
}
|
|
83568
|
+
}
|
|
83569
|
+
const totalHeight = currentY;
|
|
83570
|
+
this.cache = {
|
|
83571
|
+
cumulativeY,
|
|
83572
|
+
pageHeights,
|
|
83573
|
+
pageGap,
|
|
83574
|
+
totalHeight,
|
|
83575
|
+
layoutVersion: 0
|
|
83576
|
+
// Placeholder for future version tracking
|
|
83577
|
+
};
|
|
83578
|
+
} catch (error) {
|
|
83579
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
83580
|
+
console.error(`[PageGeometryHelper] Cache build failed: ${errorMessage}. Using fallback empty cache.`);
|
|
83581
|
+
this.cache = {
|
|
83582
|
+
cumulativeY: [],
|
|
83583
|
+
pageHeights: [],
|
|
83584
|
+
pageGap: 0,
|
|
83585
|
+
totalHeight: 0,
|
|
83586
|
+
layoutVersion: 0
|
|
83587
|
+
};
|
|
83588
|
+
}
|
|
83589
|
+
}
|
|
83590
|
+
/**
|
|
83591
|
+
* Clears the cache, forcing recalculation on next access.
|
|
83592
|
+
* Useful for testing or manual cache invalidation.
|
|
83593
|
+
*/
|
|
83594
|
+
clearCache() {
|
|
83595
|
+
this.cache = null;
|
|
83596
|
+
}
|
|
83597
|
+
/**
|
|
83598
|
+
* Gets debug information about the current cache state.
|
|
83599
|
+
* @internal
|
|
83600
|
+
*/
|
|
83601
|
+
getDebugInfo() {
|
|
83602
|
+
this.ensureCache();
|
|
83603
|
+
return {
|
|
83604
|
+
isCached: this.cache !== null,
|
|
83605
|
+
pageCount: this.config.layout.pages.length,
|
|
83606
|
+
pageGap: this.cache.pageGap,
|
|
83607
|
+
totalHeight: this.cache.totalHeight,
|
|
83608
|
+
cumulativeY: [...this.cache.cumulativeY],
|
|
83609
|
+
pageHeights: [...this.cache.pageHeights]
|
|
83610
|
+
};
|
|
83611
|
+
}
|
|
83612
|
+
}
|
|
83328
83613
|
var Priority = /* @__PURE__ */ ((Priority2) => {
|
|
83329
83614
|
Priority2[Priority2["P0"] = 0] = "P0";
|
|
83330
83615
|
Priority2[Priority2["P1"] = 1] = "P1";
|
|
@@ -83618,18 +83903,41 @@ const rangesOverlap = (startA, endA, startB, endB) => {
|
|
|
83618
83903
|
const effectiveEndA = endA ?? startA + 1;
|
|
83619
83904
|
return effectiveEndA > startB && startA < endB;
|
|
83620
83905
|
};
|
|
83621
|
-
function hitTestPage(layout, point) {
|
|
83906
|
+
function hitTestPage(layout, point, geometryHelper) {
|
|
83907
|
+
if (geometryHelper) {
|
|
83908
|
+
const pageIndex = geometryHelper.getPageIndexAtY(point.y);
|
|
83909
|
+
if (pageIndex !== null) {
|
|
83910
|
+
return { pageIndex, page: layout.pages[pageIndex] };
|
|
83911
|
+
}
|
|
83912
|
+
const nearest = geometryHelper.getNearestPageIndex(point.y);
|
|
83913
|
+
if (nearest !== null) {
|
|
83914
|
+
return { pageIndex: nearest, page: layout.pages[nearest] };
|
|
83915
|
+
}
|
|
83916
|
+
return null;
|
|
83917
|
+
}
|
|
83622
83918
|
const pageGap = layout.pageGap ?? 0;
|
|
83623
83919
|
let cursorY = 0;
|
|
83920
|
+
let nearestIndex = null;
|
|
83921
|
+
let nearestDistance = Infinity;
|
|
83624
83922
|
for (let pageIndex = 0; pageIndex < layout.pages.length; pageIndex += 1) {
|
|
83625
83923
|
const page = layout.pages[pageIndex];
|
|
83924
|
+
const pageHeight = page.size?.h ?? layout.pageSize.h;
|
|
83626
83925
|
const top2 = cursorY;
|
|
83627
|
-
const bottom2 = top2 +
|
|
83926
|
+
const bottom2 = top2 + pageHeight;
|
|
83628
83927
|
if (point.y >= top2 && point.y < bottom2) {
|
|
83629
83928
|
return { pageIndex, page };
|
|
83630
83929
|
}
|
|
83930
|
+
const center = top2 + pageHeight / 2;
|
|
83931
|
+
const distance = Math.abs(point.y - center);
|
|
83932
|
+
if (distance < nearestDistance) {
|
|
83933
|
+
nearestDistance = distance;
|
|
83934
|
+
nearestIndex = pageIndex;
|
|
83935
|
+
}
|
|
83631
83936
|
cursorY = bottom2 + pageGap;
|
|
83632
83937
|
}
|
|
83938
|
+
if (nearestIndex !== null) {
|
|
83939
|
+
return { pageIndex: nearestIndex, page: layout.pages[nearestIndex] };
|
|
83940
|
+
}
|
|
83633
83941
|
return null;
|
|
83634
83942
|
}
|
|
83635
83943
|
function hitTestFragment(layout, pageHit, blocks, measures, point) {
|
|
@@ -83790,7 +84098,7 @@ const hitTestTableFragment = (pageHit, blocks, measures, point) => {
|
|
|
83790
84098
|
}
|
|
83791
84099
|
return null;
|
|
83792
84100
|
};
|
|
83793
|
-
function clickToPosition(layout, blocks, measures, containerPoint, domContainer, clientX, clientY) {
|
|
84101
|
+
function clickToPosition(layout, blocks, measures, containerPoint, domContainer, clientX, clientY, geometryHelper) {
|
|
83794
84102
|
logClickStage("log", "entry", {
|
|
83795
84103
|
pages: layout.pages.length
|
|
83796
84104
|
});
|
|
@@ -83833,75 +84141,132 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
|
|
|
83833
84141
|
return { pos: domPos, blockId: "", pageIndex: 0, column: 0, lineIndex: -1 };
|
|
83834
84142
|
}
|
|
83835
84143
|
}
|
|
83836
|
-
const pageHit = hitTestPage(layout, containerPoint);
|
|
84144
|
+
const pageHit = hitTestPage(layout, containerPoint, geometryHelper);
|
|
83837
84145
|
if (!pageHit) {
|
|
83838
84146
|
return null;
|
|
83839
84147
|
}
|
|
83840
|
-
const
|
|
84148
|
+
const pageTopY = geometryHelper ? geometryHelper.getPageTop(pageHit.pageIndex) : calculatePageTopFallback(layout, pageHit.pageIndex);
|
|
83841
84149
|
const pageRelativePoint = {
|
|
83842
84150
|
x: containerPoint.x,
|
|
83843
|
-
y: containerPoint.y -
|
|
84151
|
+
y: containerPoint.y - pageTopY
|
|
83844
84152
|
};
|
|
83845
84153
|
logClickStage("log", "page-hit", {
|
|
83846
84154
|
pageIndex: pageHit.pageIndex
|
|
83847
84155
|
});
|
|
83848
|
-
|
|
84156
|
+
let fragmentHit = hitTestFragment(layout, pageHit, blocks, measures, pageRelativePoint);
|
|
84157
|
+
if (!fragmentHit) {
|
|
84158
|
+
const page = pageHit.page;
|
|
84159
|
+
const fragments = page.fragments.filter(
|
|
84160
|
+
(f2) => f2 != null && typeof f2 === "object"
|
|
84161
|
+
);
|
|
84162
|
+
if (fragments.length > 0) {
|
|
84163
|
+
let nearest = null;
|
|
84164
|
+
let nearestDist = Infinity;
|
|
84165
|
+
for (const frag of fragments) {
|
|
84166
|
+
const top2 = frag.y;
|
|
84167
|
+
const bottom2 = frag.y + frag.height;
|
|
84168
|
+
let dist2;
|
|
84169
|
+
if (pageRelativePoint.y < top2) {
|
|
84170
|
+
dist2 = top2 - pageRelativePoint.y;
|
|
84171
|
+
} else if (pageRelativePoint.y > bottom2) {
|
|
84172
|
+
dist2 = pageRelativePoint.y - bottom2;
|
|
84173
|
+
} else {
|
|
84174
|
+
dist2 = 0;
|
|
84175
|
+
}
|
|
84176
|
+
if (dist2 < nearestDist) {
|
|
84177
|
+
nearestDist = dist2;
|
|
84178
|
+
nearest = frag;
|
|
84179
|
+
}
|
|
84180
|
+
}
|
|
84181
|
+
if (nearest) {
|
|
84182
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, nearest.blockId);
|
|
84183
|
+
if (blockIndex !== -1) {
|
|
84184
|
+
const block = blocks[blockIndex];
|
|
84185
|
+
const measure = measures[blockIndex];
|
|
84186
|
+
if (block && measure) {
|
|
84187
|
+
fragmentHit = {
|
|
84188
|
+
fragment: nearest,
|
|
84189
|
+
block,
|
|
84190
|
+
measure,
|
|
84191
|
+
pageIndex: pageHit.pageIndex,
|
|
84192
|
+
pageY: 0
|
|
84193
|
+
};
|
|
84194
|
+
}
|
|
84195
|
+
}
|
|
84196
|
+
}
|
|
84197
|
+
}
|
|
84198
|
+
}
|
|
83849
84199
|
if (fragmentHit) {
|
|
83850
84200
|
const { fragment, block, measure, pageIndex, pageY } = fragmentHit;
|
|
83851
|
-
if (fragment.kind
|
|
83852
|
-
|
|
83853
|
-
|
|
83854
|
-
|
|
83855
|
-
|
|
84201
|
+
if (fragment.kind === "para" && measure.kind === "paragraph" && block.kind === "paragraph") {
|
|
84202
|
+
const lineIndex = findLineIndexAtY(measure, pageY, fragment.fromLine, fragment.toLine);
|
|
84203
|
+
if (lineIndex == null) {
|
|
84204
|
+
logClickStage("warn", "no-line", {
|
|
84205
|
+
blockId: fragment.blockId
|
|
84206
|
+
});
|
|
84207
|
+
return null;
|
|
84208
|
+
}
|
|
84209
|
+
const line = measure.lines[lineIndex];
|
|
84210
|
+
const isRTL = isRtlBlock(block);
|
|
84211
|
+
const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
|
|
84212
|
+
const indentRight = typeof block.attrs?.indent?.right === "number" ? block.attrs.indent.right : 0;
|
|
84213
|
+
const paraIndentLeft = Number.isFinite(indentLeft) ? indentLeft : 0;
|
|
84214
|
+
const paraIndentRight = Number.isFinite(indentRight) ? indentRight : 0;
|
|
84215
|
+
const totalIndent = paraIndentLeft + paraIndentRight;
|
|
84216
|
+
const availableWidth = Math.max(0, fragment.width - totalIndent);
|
|
84217
|
+
if (totalIndent > fragment.width) {
|
|
84218
|
+
console.warn(
|
|
84219
|
+
`[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.`
|
|
84220
|
+
);
|
|
84221
|
+
}
|
|
84222
|
+
const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
84223
|
+
const isListItem3 = markerWidth > 0;
|
|
84224
|
+
const alignmentOverride = isListItem3 ? "left" : void 0;
|
|
84225
|
+
const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth, alignmentOverride);
|
|
84226
|
+
if (pos == null) {
|
|
84227
|
+
logClickStage("warn", "no-position", {
|
|
84228
|
+
blockId: fragment.blockId
|
|
84229
|
+
});
|
|
84230
|
+
return null;
|
|
84231
|
+
}
|
|
84232
|
+
const column = determineColumn(layout, fragment.x);
|
|
84233
|
+
logPositionDebug({
|
|
84234
|
+
blockId: fragment.blockId,
|
|
84235
|
+
x: pageRelativePoint.x - fragment.x
|
|
83856
84236
|
});
|
|
83857
|
-
|
|
83858
|
-
}
|
|
83859
|
-
const lineIndex = findLineIndexAtY(measure, pageY, fragment.fromLine, fragment.toLine);
|
|
83860
|
-
if (lineIndex == null) {
|
|
83861
|
-
logClickStage("warn", "no-line", {
|
|
84237
|
+
logClickStage("log", "success", {
|
|
83862
84238
|
blockId: fragment.blockId
|
|
83863
84239
|
});
|
|
83864
|
-
return
|
|
83865
|
-
|
|
83866
|
-
|
|
83867
|
-
|
|
83868
|
-
|
|
83869
|
-
|
|
83870
|
-
|
|
83871
|
-
|
|
83872
|
-
const totalIndent = paraIndentLeft + paraIndentRight;
|
|
83873
|
-
const availableWidth = Math.max(0, fragment.width - totalIndent);
|
|
83874
|
-
if (totalIndent > fragment.width) {
|
|
83875
|
-
console.warn(
|
|
83876
|
-
`[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.`
|
|
83877
|
-
);
|
|
84240
|
+
return {
|
|
84241
|
+
pos,
|
|
84242
|
+
blockId: fragment.blockId,
|
|
84243
|
+
pageIndex,
|
|
84244
|
+
column,
|
|
84245
|
+
lineIndex
|
|
84246
|
+
// lineIndex is now already absolute (within measure.lines), no need to add fragment.fromLine
|
|
84247
|
+
};
|
|
83878
84248
|
}
|
|
83879
|
-
|
|
83880
|
-
|
|
83881
|
-
|
|
83882
|
-
|
|
83883
|
-
|
|
83884
|
-
|
|
83885
|
-
|
|
84249
|
+
if (isAtomicFragment(fragment)) {
|
|
84250
|
+
const pmRange = getAtomicPmRange(fragment, block);
|
|
84251
|
+
const pos = pmRange.pmStart ?? pmRange.pmEnd ?? null;
|
|
84252
|
+
if (pos == null) {
|
|
84253
|
+
logClickStage("warn", "atomic-without-range", {
|
|
84254
|
+
fragmentId: fragment.blockId
|
|
84255
|
+
});
|
|
84256
|
+
return null;
|
|
84257
|
+
}
|
|
84258
|
+
logClickStage("log", "success", {
|
|
84259
|
+
blockId: fragment.blockId,
|
|
84260
|
+
column: determineColumn(layout, fragment.x)
|
|
83886
84261
|
});
|
|
83887
|
-
return
|
|
84262
|
+
return {
|
|
84263
|
+
pos,
|
|
84264
|
+
blockId: fragment.blockId,
|
|
84265
|
+
pageIndex,
|
|
84266
|
+
column: determineColumn(layout, fragment.x),
|
|
84267
|
+
lineIndex: -1
|
|
84268
|
+
};
|
|
83888
84269
|
}
|
|
83889
|
-
const column = determineColumn(layout, fragment.x);
|
|
83890
|
-
logPositionDebug({
|
|
83891
|
-
blockId: fragment.blockId,
|
|
83892
|
-
x: pageRelativePoint.x - fragment.x
|
|
83893
|
-
});
|
|
83894
|
-
logClickStage("log", "success", {
|
|
83895
|
-
blockId: fragment.blockId
|
|
83896
|
-
});
|
|
83897
|
-
return {
|
|
83898
|
-
pos,
|
|
83899
|
-
blockId: fragment.blockId,
|
|
83900
|
-
pageIndex,
|
|
83901
|
-
column,
|
|
83902
|
-
lineIndex
|
|
83903
|
-
// lineIndex is now already absolute (within measure.lines), no need to add fragment.fromLine
|
|
83904
|
-
};
|
|
83905
84270
|
}
|
|
83906
84271
|
const tableHit = hitTestTableFragment(pageHit, blocks, measures, pageRelativePoint);
|
|
83907
84272
|
if (tableHit) {
|
|
@@ -84051,12 +84416,22 @@ const sumLineHeights = (measure, fromLine, toLine) => {
|
|
|
84051
84416
|
}
|
|
84052
84417
|
return height;
|
|
84053
84418
|
};
|
|
84054
|
-
|
|
84419
|
+
const calculatePageTopFallback = (layout, pageIndex) => {
|
|
84420
|
+
const pageGap = layout.pageGap ?? 0;
|
|
84421
|
+
let y2 = 0;
|
|
84422
|
+
for (let i = 0; i < pageIndex; i++) {
|
|
84423
|
+
const pageHeight = layout.pages[i]?.size?.h ?? layout.pageSize.h;
|
|
84424
|
+
y2 += pageHeight + pageGap;
|
|
84425
|
+
}
|
|
84426
|
+
return y2;
|
|
84427
|
+
};
|
|
84428
|
+
function selectionToRects(layout, blocks, measures, from2, to, geometryHelper) {
|
|
84055
84429
|
if (from2 === to) {
|
|
84056
84430
|
return [];
|
|
84057
84431
|
}
|
|
84058
84432
|
const rects = [];
|
|
84059
84433
|
layout.pages.forEach((page, pageIndex) => {
|
|
84434
|
+
const pageTopY = geometryHelper ? geometryHelper.getPageTop(pageIndex) : calculatePageTopFallback(layout, pageIndex);
|
|
84060
84435
|
page.fragments.forEach((fragment) => {
|
|
84061
84436
|
if (fragment.kind === "para") {
|
|
84062
84437
|
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
@@ -84098,12 +84473,16 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
84098
84473
|
wordLayout
|
|
84099
84474
|
});
|
|
84100
84475
|
const rectX = fragment.x + indentAdjust + Math.min(startX, endX);
|
|
84101
|
-
const rectWidth = Math.max(
|
|
84476
|
+
const rectWidth = Math.max(
|
|
84477
|
+
1,
|
|
84478
|
+
Math.min(Math.abs(endX - startX), line.width)
|
|
84479
|
+
// clamp to line width to prevent runaway widths
|
|
84480
|
+
);
|
|
84102
84481
|
const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
|
|
84103
84482
|
const rectY = fragment.y + lineOffset;
|
|
84104
84483
|
rects.push({
|
|
84105
84484
|
x: rectX,
|
|
84106
|
-
y: rectY +
|
|
84485
|
+
y: rectY + pageTopY,
|
|
84107
84486
|
width: rectWidth,
|
|
84108
84487
|
height: line.lineHeight,
|
|
84109
84488
|
pageIndex
|
|
@@ -84231,12 +84610,16 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
84231
84610
|
wordLayout: cellWordLayout
|
|
84232
84611
|
});
|
|
84233
84612
|
const rectX = fragment.x + cellX + padding.left + textIndentAdjust + Math.min(startX, endX);
|
|
84234
|
-
const rectWidth = Math.max(
|
|
84613
|
+
const rectWidth = Math.max(
|
|
84614
|
+
1,
|
|
84615
|
+
Math.min(Math.abs(endX - startX), line.width)
|
|
84616
|
+
// clamp to line width to prevent runaway widths
|
|
84617
|
+
);
|
|
84235
84618
|
const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
|
|
84236
84619
|
const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
|
|
84237
84620
|
rects.push({
|
|
84238
84621
|
x: rectX,
|
|
84239
|
-
y: rectY +
|
|
84622
|
+
y: rectY + pageTopY,
|
|
84240
84623
|
width: rectWidth,
|
|
84241
84624
|
height: line.lineHeight,
|
|
84242
84625
|
pageIndex
|
|
@@ -84265,7 +84648,7 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
84265
84648
|
if (!rangesOverlap(pmRange.pmStart, pmRange.pmEnd, from2, to)) return;
|
|
84266
84649
|
rects.push({
|
|
84267
84650
|
x: fragment.x,
|
|
84268
|
-
y: fragment.y +
|
|
84651
|
+
y: fragment.y + pageTopY,
|
|
84269
84652
|
width: fragment.width,
|
|
84270
84653
|
height: fragment.height,
|
|
84271
84654
|
pageIndex
|
|
@@ -87506,6 +87889,7 @@ const DEFAULT_PAGE_SIZE = { w: 612, h: 792 };
|
|
|
87506
87889
|
const DEFAULT_MARGINS = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
87507
87890
|
const DEFAULT_VIRTUALIZED_PAGE_GAP = 72;
|
|
87508
87891
|
const DEFAULT_PAGE_GAP = 24;
|
|
87892
|
+
const DEFAULT_HORIZONTAL_PAGE_GAP = 20;
|
|
87509
87893
|
const WORD_CHARACTER_REGEX = /[\p{L}\p{N}''_~-]/u;
|
|
87510
87894
|
const MULTI_CLICK_TIME_THRESHOLD_MS = 400;
|
|
87511
87895
|
const MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5;
|
|
@@ -87529,6 +87913,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
87529
87913
|
__privateAdd$1(this, _layoutOptions);
|
|
87530
87914
|
__privateAdd$1(this, _layoutState, { blocks: [], measures: [], layout: null, bookmarks: /* @__PURE__ */ new Map() });
|
|
87531
87915
|
__privateAdd$1(this, _domPainter, null);
|
|
87916
|
+
__privateAdd$1(this, _pageGeometryHelper, null);
|
|
87532
87917
|
__privateAdd$1(this, _dragHandlerCleanup, null);
|
|
87533
87918
|
__privateAdd$1(this, _layoutError, null);
|
|
87534
87919
|
__privateAdd$1(this, _layoutErrorState, "healthy");
|
|
@@ -87681,7 +88066,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
87681
88066
|
{ x: x2, y: y2 },
|
|
87682
88067
|
__privateGet$1(this, _viewportHost),
|
|
87683
88068
|
event.clientX,
|
|
87684
|
-
event.clientY
|
|
88069
|
+
event.clientY,
|
|
88070
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
87685
88071
|
);
|
|
87686
88072
|
const doc22 = __privateGet$1(this, _editor3).state?.doc;
|
|
87687
88073
|
const hit = rawHit && doc22 ? { ...rawHit, pos: Math.max(0, Math.min(rawHit.pos, doc22.content.size)) } : rawHit;
|
|
@@ -87880,7 +88266,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
87880
88266
|
{ x: normalized.x, y: normalized.y },
|
|
87881
88267
|
__privateGet$1(this, _viewportHost),
|
|
87882
88268
|
event.clientX,
|
|
87883
|
-
event.clientY
|
|
88269
|
+
event.clientY,
|
|
88270
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
87884
88271
|
);
|
|
87885
88272
|
if (!hit) return;
|
|
87886
88273
|
const currentTableHit = __privateMethod$1(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
|
|
@@ -88727,7 +89114,14 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
88727
89114
|
return __privateMethod$1(this, _PresentationEditor_instances, computeHeaderFooterSelectionRects_fn).call(this, start2, end2);
|
|
88728
89115
|
}
|
|
88729
89116
|
if (!__privateGet$1(this, _layoutState).layout) return [];
|
|
88730
|
-
const rects = selectionToRects(
|
|
89117
|
+
const rects = selectionToRects(
|
|
89118
|
+
__privateGet$1(this, _layoutState).layout,
|
|
89119
|
+
__privateGet$1(this, _layoutState).blocks,
|
|
89120
|
+
__privateGet$1(this, _layoutState).measures,
|
|
89121
|
+
start2,
|
|
89122
|
+
end2,
|
|
89123
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
89124
|
+
) ?? [];
|
|
88731
89125
|
return rects;
|
|
88732
89126
|
};
|
|
88733
89127
|
const rawRects = layoutRectSource();
|
|
@@ -88992,6 +89386,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
88992
89386
|
};
|
|
88993
89387
|
}
|
|
88994
89388
|
__privateSet(this, _domPainter, null);
|
|
89389
|
+
__privateSet(this, _pageGeometryHelper, null);
|
|
88995
89390
|
__privateSet(this, _pendingDocChange, true);
|
|
88996
89391
|
__privateMethod$1(this, _PresentationEditor_instances, scheduleRerender_fn).call(this);
|
|
88997
89392
|
}
|
|
@@ -89024,7 +89419,16 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
89024
89419
|
x: localX,
|
|
89025
89420
|
y: headerPageIndex * headerPageHeight + (localY - headerPageIndex * headerPageHeight)
|
|
89026
89421
|
};
|
|
89027
|
-
const hit2 = clickToPosition(
|
|
89422
|
+
const hit2 = clickToPosition(
|
|
89423
|
+
context.layout,
|
|
89424
|
+
context.blocks,
|
|
89425
|
+
context.measures,
|
|
89426
|
+
headerPoint,
|
|
89427
|
+
void 0,
|
|
89428
|
+
void 0,
|
|
89429
|
+
void 0,
|
|
89430
|
+
void 0
|
|
89431
|
+
) ?? null;
|
|
89028
89432
|
return hit2;
|
|
89029
89433
|
}
|
|
89030
89434
|
if (!__privateGet$1(this, _layoutState).layout) {
|
|
@@ -89037,7 +89441,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
89037
89441
|
normalized,
|
|
89038
89442
|
__privateGet$1(this, _viewportHost),
|
|
89039
89443
|
clientX,
|
|
89040
|
-
clientY
|
|
89444
|
+
clientY,
|
|
89445
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
89041
89446
|
) ?? null;
|
|
89042
89447
|
return hit;
|
|
89043
89448
|
}
|
|
@@ -89260,6 +89665,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
89260
89665
|
__privateSet(this, _session, { mode: "body" });
|
|
89261
89666
|
__privateSet(this, _activeHeaderFooterEditor, null);
|
|
89262
89667
|
__privateSet(this, _domPainter, null);
|
|
89668
|
+
__privateSet(this, _pageGeometryHelper, null);
|
|
89263
89669
|
(_a2 = __privateGet$1(this, _dragHandlerCleanup)) == null ? void 0 : _a2.call(this);
|
|
89264
89670
|
__privateSet(this, _dragHandlerCleanup, null);
|
|
89265
89671
|
__privateGet$1(this, _selectionOverlay2)?.remove();
|
|
@@ -89313,7 +89719,14 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
89313
89719
|
if (!normalized) return false;
|
|
89314
89720
|
const pmPos = __privateGet$1(this, _layoutState).bookmarks.get(normalized);
|
|
89315
89721
|
if (pmPos == null) return false;
|
|
89316
|
-
const rects = selectionToRects(
|
|
89722
|
+
const rects = selectionToRects(
|
|
89723
|
+
layout,
|
|
89724
|
+
__privateGet$1(this, _layoutState).blocks,
|
|
89725
|
+
__privateGet$1(this, _layoutState).measures,
|
|
89726
|
+
pmPos,
|
|
89727
|
+
pmPos + 1,
|
|
89728
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
89729
|
+
) ?? [];
|
|
89317
89730
|
const rect = rects[0];
|
|
89318
89731
|
let pageIndex = rect?.pageIndex ?? null;
|
|
89319
89732
|
if (pageIndex == null) {
|
|
@@ -89377,6 +89790,7 @@ _hiddenHost = /* @__PURE__ */ new WeakMap();
|
|
|
89377
89790
|
_layoutOptions = /* @__PURE__ */ new WeakMap();
|
|
89378
89791
|
_layoutState = /* @__PURE__ */ new WeakMap();
|
|
89379
89792
|
_domPainter = /* @__PURE__ */ new WeakMap();
|
|
89793
|
+
_pageGeometryHelper = /* @__PURE__ */ new WeakMap();
|
|
89380
89794
|
_dragHandlerCleanup = /* @__PURE__ */ new WeakMap();
|
|
89381
89795
|
_layoutError = /* @__PURE__ */ new WeakMap();
|
|
89382
89796
|
_layoutErrorState = /* @__PURE__ */ new WeakMap();
|
|
@@ -89835,7 +90249,7 @@ renderRemoteSelection_fn = function(cursor) {
|
|
|
89835
90249
|
if (!layout || !blocks || !measures) return;
|
|
89836
90250
|
const start2 = Math.min(cursor.anchor, cursor.head);
|
|
89837
90251
|
const end2 = Math.max(cursor.anchor, cursor.head);
|
|
89838
|
-
const rects = selectionToRects(layout, blocks, measures, start2, end2) ?? [];
|
|
90252
|
+
const rects = selectionToRects(layout, blocks, measures, start2, end2, __privateGet$1(this, _pageGeometryHelper) ?? void 0) ?? [];
|
|
89839
90253
|
const color = __privateMethod$1(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
89840
90254
|
const opacity = __privateGet$1(this, _layoutOptions).presence?.highlightOpacity ?? 0.35;
|
|
89841
90255
|
const pageHeight = layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
@@ -90195,15 +90609,25 @@ hitTestTable_fn = function(normalizedX, normalizedY) {
|
|
|
90195
90609
|
const configuredPageSize = __privateGet$1(this, _layoutOptions).pageSize ?? DEFAULT_PAGE_SIZE;
|
|
90196
90610
|
let pageY = 0;
|
|
90197
90611
|
let pageHit = null;
|
|
90198
|
-
|
|
90199
|
-
|
|
90200
|
-
const
|
|
90201
|
-
|
|
90202
|
-
|
|
90203
|
-
|
|
90204
|
-
|
|
90612
|
+
const geometryHelper = __privateGet$1(this, _pageGeometryHelper);
|
|
90613
|
+
if (geometryHelper) {
|
|
90614
|
+
const idx = geometryHelper.getPageIndexAtY(normalizedY) ?? geometryHelper.getNearestPageIndex(normalizedY);
|
|
90615
|
+
if (idx != null && layout.pages[idx]) {
|
|
90616
|
+
pageHit = { pageIndex: idx, page: layout.pages[idx] };
|
|
90617
|
+
pageY = geometryHelper.getPageTop(idx);
|
|
90618
|
+
}
|
|
90619
|
+
}
|
|
90620
|
+
if (!pageHit) {
|
|
90621
|
+
const gap = layout.pageGap ?? __privateMethod$1(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this);
|
|
90622
|
+
for (let i = 0; i < layout.pages.length; i++) {
|
|
90623
|
+
const page = layout.pages[i];
|
|
90624
|
+
const pageHeight = page.size?.h ?? configuredPageSize.h;
|
|
90625
|
+
if (normalizedY >= pageY && normalizedY < pageY + pageHeight) {
|
|
90626
|
+
pageHit = { pageIndex: i, page };
|
|
90627
|
+
break;
|
|
90628
|
+
}
|
|
90629
|
+
pageY += pageHeight + gap;
|
|
90205
90630
|
}
|
|
90206
|
-
pageY += pageHeight + gap;
|
|
90207
90631
|
}
|
|
90208
90632
|
if (!pageHit) {
|
|
90209
90633
|
return null;
|
|
@@ -90455,12 +90879,7 @@ rerender_fn = async function() {
|
|
|
90455
90879
|
return;
|
|
90456
90880
|
}
|
|
90457
90881
|
({ layout, measures } = result);
|
|
90458
|
-
|
|
90459
|
-
const gap = __privateGet$1(this, _layoutOptions).virtualization.gap ?? DEFAULT_VIRTUALIZED_PAGE_GAP;
|
|
90460
|
-
layout.pageGap = Math.max(0, gap);
|
|
90461
|
-
} else {
|
|
90462
|
-
layout.pageGap = DEFAULT_PAGE_GAP;
|
|
90463
|
-
}
|
|
90882
|
+
layout.pageGap = __privateMethod$1(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this);
|
|
90464
90883
|
headerLayouts = result.headers;
|
|
90465
90884
|
footerLayouts = result.footers;
|
|
90466
90885
|
} catch (error) {
|
|
@@ -90477,6 +90896,17 @@ rerender_fn = async function() {
|
|
|
90477
90896
|
__privateSet(this, _layoutState, { blocks, measures, layout, bookmarks, anchorMap });
|
|
90478
90897
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
90479
90898
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
90899
|
+
if (__privateGet$1(this, _layoutState).layout) {
|
|
90900
|
+
const pageGap = __privateGet$1(this, _layoutState).layout.pageGap ?? __privateMethod$1(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this);
|
|
90901
|
+
if (!__privateGet$1(this, _pageGeometryHelper)) {
|
|
90902
|
+
__privateSet(this, _pageGeometryHelper, new PageGeometryHelper({
|
|
90903
|
+
layout: __privateGet$1(this, _layoutState).layout,
|
|
90904
|
+
pageGap
|
|
90905
|
+
}));
|
|
90906
|
+
} else {
|
|
90907
|
+
__privateGet$1(this, _pageGeometryHelper).updateLayout(__privateGet$1(this, _layoutState).layout, pageGap);
|
|
90908
|
+
}
|
|
90909
|
+
}
|
|
90480
90910
|
await __privateMethod$1(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
90481
90911
|
__privateMethod$1(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
|
|
90482
90912
|
const painter = __privateMethod$1(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks, measures);
|
|
@@ -90546,7 +90976,8 @@ ensurePainter_fn = function(blocks, measures) {
|
|
|
90546
90976
|
pageStyles: __privateGet$1(this, _layoutOptions).pageStyles,
|
|
90547
90977
|
headerProvider: __privateGet$1(this, _headerDecorationProvider),
|
|
90548
90978
|
footerProvider: __privateGet$1(this, _footerDecorationProvider),
|
|
90549
|
-
ruler: __privateGet$1(this, _layoutOptions).ruler
|
|
90979
|
+
ruler: __privateGet$1(this, _layoutOptions).ruler,
|
|
90980
|
+
pageGap: __privateGet$1(this, _layoutState).layout?.pageGap ?? __privateMethod$1(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this)
|
|
90550
90981
|
}));
|
|
90551
90982
|
}
|
|
90552
90983
|
return __privateGet$1(this, _domPainter);
|
|
@@ -90634,7 +91065,14 @@ updateSelection_fn = function() {
|
|
|
90634
91065
|
}
|
|
90635
91066
|
return;
|
|
90636
91067
|
}
|
|
90637
|
-
const rects = selectionToRects(
|
|
91068
|
+
const rects = selectionToRects(
|
|
91069
|
+
layout,
|
|
91070
|
+
__privateGet$1(this, _layoutState).blocks,
|
|
91071
|
+
__privateGet$1(this, _layoutState).measures,
|
|
91072
|
+
from2,
|
|
91073
|
+
to,
|
|
91074
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
91075
|
+
) ?? [];
|
|
90638
91076
|
let domStart = null;
|
|
90639
91077
|
let domEnd = null;
|
|
90640
91078
|
try {
|
|
@@ -90648,7 +91086,9 @@ updateSelection_fn = function() {
|
|
|
90648
91086
|
const correctedRects = __privateMethod$1(this, _PresentationEditor_instances, applyDomCorrectionToRects_fn).call(this, rects, domStart, domEnd);
|
|
90649
91087
|
try {
|
|
90650
91088
|
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
90651
|
-
|
|
91089
|
+
if (correctedRects.length > 0) {
|
|
91090
|
+
__privateMethod$1(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this, correctedRects);
|
|
91091
|
+
}
|
|
90652
91092
|
} catch (error) {
|
|
90653
91093
|
if (process$1$1.env.NODE_ENV === "development") {
|
|
90654
91094
|
console.warn("[PresentationEditor] Failed to render selection rects:", error);
|
|
@@ -91436,6 +91876,15 @@ waitForPageMount_fn = async function(pageIndex, options = {}) {
|
|
|
91436
91876
|
checkPage();
|
|
91437
91877
|
});
|
|
91438
91878
|
};
|
|
91879
|
+
getEffectivePageGap_fn = function() {
|
|
91880
|
+
if (__privateGet$1(this, _layoutOptions).virtualization?.enabled) {
|
|
91881
|
+
return Math.max(0, __privateGet$1(this, _layoutOptions).virtualization.gap ?? DEFAULT_VIRTUALIZED_PAGE_GAP);
|
|
91882
|
+
}
|
|
91883
|
+
if (__privateGet$1(this, _layoutOptions).layoutMode === "horizontal") {
|
|
91884
|
+
return DEFAULT_HORIZONTAL_PAGE_GAP;
|
|
91885
|
+
}
|
|
91886
|
+
return DEFAULT_PAGE_GAP;
|
|
91887
|
+
};
|
|
91439
91888
|
getBodyPageHeight_fn = function() {
|
|
91440
91889
|
return __privateGet$1(this, _layoutState).layout?.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
91441
91890
|
};
|
|
@@ -91459,7 +91908,7 @@ applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
|
|
|
91459
91908
|
dy: domStart.y - layoutY
|
|
91460
91909
|
};
|
|
91461
91910
|
}
|
|
91462
|
-
|
|
91911
|
+
const corrected = rects.map((rect, idx) => {
|
|
91463
91912
|
const delta = pageDelta[rect.pageIndex];
|
|
91464
91913
|
let adjustedX = delta ? rect.x + delta.dx : rect.x;
|
|
91465
91914
|
let adjustedY = delta ? rect.y + delta.dy : rect.y;
|
|
@@ -91474,6 +91923,7 @@ applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
|
|
|
91474
91923
|
}
|
|
91475
91924
|
if (isLastRect && domEnd && rect.pageIndex === domEnd.pageIndex) {
|
|
91476
91925
|
const endX = domEnd.x;
|
|
91926
|
+
adjustedX = Math.min(adjustedX, endX);
|
|
91477
91927
|
adjustedWidth = Math.max(1, endX - adjustedX);
|
|
91478
91928
|
}
|
|
91479
91929
|
return {
|
|
@@ -91483,6 +91933,29 @@ applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
|
|
|
91483
91933
|
width: adjustedWidth
|
|
91484
91934
|
};
|
|
91485
91935
|
});
|
|
91936
|
+
const MAX_DELTA_PX = 12;
|
|
91937
|
+
let invalid = false;
|
|
91938
|
+
if (domStart && corrected[0]) {
|
|
91939
|
+
const dx = Math.abs(corrected[0].x - domStart.x);
|
|
91940
|
+
const dy = Math.abs(corrected[0].y - domStart.y);
|
|
91941
|
+
if (dx > MAX_DELTA_PX || dy > MAX_DELTA_PX) invalid = true;
|
|
91942
|
+
}
|
|
91943
|
+
if (domEnd && corrected[corrected.length - 1]) {
|
|
91944
|
+
const last = corrected[corrected.length - 1];
|
|
91945
|
+
const dx = Math.abs(last.x + last.width - domEnd.x);
|
|
91946
|
+
const dy = Math.abs(last.y - domEnd.y);
|
|
91947
|
+
if (dx > MAX_DELTA_PX || dy > MAX_DELTA_PX) invalid = true;
|
|
91948
|
+
}
|
|
91949
|
+
if (invalid) {
|
|
91950
|
+
console.warn("[SelectionOverlay] Suppressing selection render due to large DOM/Layout mismatch", {
|
|
91951
|
+
domStart,
|
|
91952
|
+
domEnd,
|
|
91953
|
+
rectStart: corrected[0],
|
|
91954
|
+
rectEnd: corrected[corrected.length - 1]
|
|
91955
|
+
});
|
|
91956
|
+
return [];
|
|
91957
|
+
}
|
|
91958
|
+
return corrected;
|
|
91486
91959
|
};
|
|
91487
91960
|
renderCellSelectionOverlay_fn = function(selection, layout) {
|
|
91488
91961
|
const localSelectionLayer = __privateGet$1(this, _localSelectionLayer);
|
|
@@ -91766,7 +92239,7 @@ computeHeaderFooterSelectionRects_fn = function(from2, to) {
|
|
|
91766
92239
|
return [];
|
|
91767
92240
|
}
|
|
91768
92241
|
if (!bodyLayout) return [];
|
|
91769
|
-
const rects = selectionToRects(context.layout, context.blocks, context.measures, from2, to) ?? [];
|
|
92242
|
+
const rects = selectionToRects(context.layout, context.blocks, context.measures, from2, to, void 0) ?? [];
|
|
91770
92243
|
const headerPageHeight = context.layout.pageSize?.h ?? context.region.height ?? 1;
|
|
91771
92244
|
const bodyPageHeight = __privateMethod$1(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
91772
92245
|
return rects.map((rect) => {
|
|
@@ -92233,7 +92706,14 @@ getCurrentPageIndex_fn = function() {
|
|
|
92233
92706
|
if (!layout || !selection) {
|
|
92234
92707
|
return 0;
|
|
92235
92708
|
}
|
|
92236
|
-
const rects = selectionToRects(
|
|
92709
|
+
const rects = selectionToRects(
|
|
92710
|
+
layout,
|
|
92711
|
+
__privateGet$1(this, _layoutState).blocks,
|
|
92712
|
+
__privateGet$1(this, _layoutState).measures,
|
|
92713
|
+
selection.from,
|
|
92714
|
+
selection.to,
|
|
92715
|
+
__privateGet$1(this, _pageGeometryHelper) ?? void 0
|
|
92716
|
+
) ?? [];
|
|
92237
92717
|
if (rects.length > 0) {
|
|
92238
92718
|
return rects[0]?.pageIndex ?? 0;
|
|
92239
92719
|
}
|