@harbour-enterprises/superdoc 1.0.0-beta.100 → 1.0.0-beta.102
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-BFqkSyYx.es.js} +1 -1
- package/dist/chunks/{PdfViewer-Bl_KAt28.cjs → PdfViewer-X1sOA7hm.cjs} +1 -1
- package/dist/chunks/{index-BtLZer3S.es.js → index-BP1yyX4N.es.js} +3 -3
- package/dist/chunks/{index-UIImjS8C.cjs → index-f4ON3m7j.cjs} +3 -3
- package/dist/chunks/{index-Bd5TMBeR-D31VShf3.cjs → index-nVrA3URL-BssoM7VE.cjs} +1 -1
- package/dist/chunks/{index-Bd5TMBeR-DcY3xcTG.es.js → index-nVrA3URL-vs_NmI3L.es.js} +1 -1
- package/dist/chunks/{super-editor.es-BLGnf9gI.cjs → super-editor.es-B7Xuihea.cjs} +641 -128
- package/dist/chunks/{super-editor.es-oszwJ36j.es.js → super-editor.es-BM69n_BR.es.js} +641 -128
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-B6-fwuLp.js → converter-NrpPx2Xr.js} +12 -6
- package/dist/super-editor/chunks/{docx-zipper-DXUMayjk.js → docx-zipper-oyKPvmaC.js} +1 -1
- package/dist/super-editor/chunks/{editor-BAK8u8dm.js → editor-Dnw031hl.js} +631 -120
- package/dist/super-editor/chunks/{index-Bd5TMBeR.js → index-nVrA3URL.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DCCbbUQz.js → toolbar-OrlYExrD.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 +10 -10
- 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 +643 -130
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +10 -1
|
@@ -9,11 +9,11 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
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, hideDimmingOverlay_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, computeCaretLayoutRectFromDOM_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;
|
|
12
|
+
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, hideDimmingOverlay_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, computeCaretLayoutRectFromDOM_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;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-
|
|
16
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-NrpPx2Xr.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-oyKPvmaC.js";
|
|
17
17
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
@@ -9098,6 +9098,14 @@ const toggleNode = (typeOrName, toggleTypeOrName, attrs = {}) => ({ state, comma
|
|
|
9098
9098
|
const selectAll = () => ({ state, dispatch }) => selectAll$1(state, dispatch);
|
|
9099
9099
|
const deleteSelection = () => ({ state, tr, dispatch }) => {
|
|
9100
9100
|
const { from: from2, to, empty: empty2 } = state.selection;
|
|
9101
|
+
if (typeof document !== "undefined" && document.getSelection) {
|
|
9102
|
+
const currentDomSelection = document.getSelection();
|
|
9103
|
+
const selectedLength = currentDomSelection?.toString?.().length;
|
|
9104
|
+
const isCollapsed = currentDomSelection?.isCollapsed;
|
|
9105
|
+
if (!isCollapsed && selectedLength === 1) {
|
|
9106
|
+
return false;
|
|
9107
|
+
}
|
|
9108
|
+
}
|
|
9101
9109
|
if (empty2) {
|
|
9102
9110
|
return deleteSelection$1(state, dispatch);
|
|
9103
9111
|
}
|
|
@@ -11406,12 +11414,14 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
|
|
|
11406
11414
|
importedId: node.attrs["w:id"]
|
|
11407
11415
|
});
|
|
11408
11416
|
if (type.name === "commentRangeStart") {
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11417
|
+
if (!matchingImportedComment?.isDone) {
|
|
11418
|
+
toMark.push({
|
|
11419
|
+
commentId: resolvedCommentId,
|
|
11420
|
+
importedId,
|
|
11421
|
+
internal,
|
|
11422
|
+
start: pos
|
|
11423
|
+
});
|
|
11424
|
+
}
|
|
11415
11425
|
ensureFallbackComment({
|
|
11416
11426
|
converter,
|
|
11417
11427
|
matchingImportedComment,
|
|
@@ -13952,7 +13962,7 @@ const isHeadless = (editor) => {
|
|
|
13952
13962
|
const shouldSkipNodeView = (editor) => {
|
|
13953
13963
|
return isHeadless(editor);
|
|
13954
13964
|
};
|
|
13955
|
-
const summaryVersion = "1.0.0-beta.
|
|
13965
|
+
const summaryVersion = "1.0.0-beta.102";
|
|
13956
13966
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13957
13967
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13958
13968
|
function mapAttributes(attrs) {
|
|
@@ -14744,7 +14754,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14744
14754
|
{ default: remarkStringify },
|
|
14745
14755
|
{ default: remarkGfm }
|
|
14746
14756
|
] = await Promise.all([
|
|
14747
|
-
import("./index-
|
|
14757
|
+
import("./index-nVrA3URL.js"),
|
|
14748
14758
|
import("./index-DRCvimau.js"),
|
|
14749
14759
|
import("./index-C_x_N6Uh.js"),
|
|
14750
14760
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14949,7 +14959,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14949
14959
|
* Process collaboration migrations
|
|
14950
14960
|
*/
|
|
14951
14961
|
processCollaborationMigrations() {
|
|
14952
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
14962
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.102");
|
|
14953
14963
|
if (!this.options.ydoc) return;
|
|
14954
14964
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14955
14965
|
let docVersion = metaMap.get("version");
|
|
@@ -27120,7 +27130,7 @@ const containerStyles = {
|
|
|
27120
27130
|
alignItems: "center",
|
|
27121
27131
|
background: "transparent",
|
|
27122
27132
|
padding: "0",
|
|
27123
|
-
gap:
|
|
27133
|
+
// gap is set dynamically by renderer based on pageGap option (default: 24px)
|
|
27124
27134
|
overflowY: "auto"
|
|
27125
27135
|
};
|
|
27126
27136
|
const containerStylesHorizontal = {
|
|
@@ -27130,7 +27140,7 @@ const containerStylesHorizontal = {
|
|
|
27130
27140
|
justifyContent: "safe center",
|
|
27131
27141
|
background: "transparent",
|
|
27132
27142
|
padding: "0",
|
|
27133
|
-
gap:
|
|
27143
|
+
// gap is set dynamically by renderer based on pageGap option (default: 20px for horizontal)
|
|
27134
27144
|
overflowX: "auto",
|
|
27135
27145
|
minHeight: "100%"
|
|
27136
27146
|
};
|
|
@@ -28933,6 +28943,7 @@ function isMinimalWordLayout(value) {
|
|
|
28933
28943
|
const LIST_MARKER_GAP$1 = 8;
|
|
28934
28944
|
const DEFAULT_TAB_INTERVAL_PX$1 = 48;
|
|
28935
28945
|
const DEFAULT_PAGE_HEIGHT_PX = 1056;
|
|
28946
|
+
const DEFAULT_VIRTUALIZED_PAGE_GAP$1 = 72;
|
|
28936
28947
|
const COMMENT_EXTERNAL_COLOR = "#B1124B";
|
|
28937
28948
|
const COMMENT_INTERNAL_COLOR = "#078383";
|
|
28938
28949
|
const COMMENT_INACTIVE_ALPHA = "22";
|
|
@@ -29062,10 +29073,11 @@ const _DomPainter = class _DomPainter {
|
|
|
29062
29073
|
this.totalPages = 0;
|
|
29063
29074
|
this.linkIdCounter = 0;
|
|
29064
29075
|
this.pendingTooltips = /* @__PURE__ */ new WeakMap();
|
|
29076
|
+
this.pageGap = 24;
|
|
29065
29077
|
this.virtualEnabled = false;
|
|
29066
29078
|
this.virtualWindow = 5;
|
|
29067
29079
|
this.virtualOverscan = 0;
|
|
29068
|
-
this.virtualGap =
|
|
29080
|
+
this.virtualGap = DEFAULT_VIRTUALIZED_PAGE_GAP$1;
|
|
29069
29081
|
this.virtualPaddingTop = null;
|
|
29070
29082
|
this.topSpacerEl = null;
|
|
29071
29083
|
this.bottomSpacerEl = null;
|
|
@@ -29084,13 +29096,14 @@ const _DomPainter = class _DomPainter {
|
|
|
29084
29096
|
this.blockLookup = this.buildBlockLookup(blocks, measures);
|
|
29085
29097
|
this.headerProvider = options.headerProvider;
|
|
29086
29098
|
this.footerProvider = options.footerProvider;
|
|
29099
|
+
const defaultGap = this.layoutMode === "horizontal" ? 20 : 24;
|
|
29100
|
+
this.pageGap = typeof options.pageGap === "number" && Number.isFinite(options.pageGap) ? Math.max(0, options.pageGap) : defaultGap;
|
|
29087
29101
|
if (this.layoutMode === "vertical" && options.virtualization?.enabled) {
|
|
29088
29102
|
this.virtualEnabled = true;
|
|
29089
29103
|
this.virtualWindow = Math.max(1, options.virtualization.window ?? 5);
|
|
29090
29104
|
this.virtualOverscan = Math.max(0, options.virtualization.overscan ?? 0);
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
}
|
|
29105
|
+
const hasExplicitVirtualGap = typeof options.virtualization.gap === "number" && Number.isFinite(options.virtualization.gap);
|
|
29106
|
+
this.virtualGap = hasExplicitVirtualGap ? Math.max(0, options.virtualization.gap) : DEFAULT_VIRTUALIZED_PAGE_GAP$1;
|
|
29094
29107
|
if (typeof options.virtualization.paddingTop === "number" && Number.isFinite(options.virtualization.paddingTop)) {
|
|
29095
29108
|
this.virtualPaddingTop = Math.max(0, options.virtualization.paddingTop);
|
|
29096
29109
|
}
|
|
@@ -29191,6 +29204,7 @@ const _DomPainter = class _DomPainter {
|
|
|
29191
29204
|
const mode = this.layoutMode;
|
|
29192
29205
|
if (mode === "horizontal") {
|
|
29193
29206
|
applyStyles$2(mount, containerStylesHorizontal);
|
|
29207
|
+
mount.style.gap = `${this.pageGap}px`;
|
|
29194
29208
|
this.renderHorizontal(layout, mount);
|
|
29195
29209
|
this.currentLayout = layout;
|
|
29196
29210
|
this.pageStates = [];
|
|
@@ -29213,6 +29227,7 @@ const _DomPainter = class _DomPainter {
|
|
|
29213
29227
|
this.changedBlocks.clear();
|
|
29214
29228
|
return;
|
|
29215
29229
|
}
|
|
29230
|
+
mount.style.gap = `${this.pageGap}px`;
|
|
29216
29231
|
if (!this.currentLayout || this.pageStates.length === 0) {
|
|
29217
29232
|
this.fullRender(layout);
|
|
29218
29233
|
} else {
|
|
@@ -32432,6 +32447,7 @@ const createDomPainter = (options) => {
|
|
|
32432
32447
|
const painter = new DomPainter(options.blocks, options.measures, {
|
|
32433
32448
|
pageStyles: options.pageStyles,
|
|
32434
32449
|
layoutMode: options.layoutMode,
|
|
32450
|
+
pageGap: options.pageGap,
|
|
32435
32451
|
headerProvider: options.headerProvider,
|
|
32436
32452
|
footerProvider: options.footerProvider,
|
|
32437
32453
|
virtualization: options.virtualization,
|
|
@@ -37729,6 +37745,285 @@ async function remeasureAffectedBlocks(blocks, measures, affectedBlockIds, const
|
|
|
37729
37745
|
}
|
|
37730
37746
|
return updatedMeasures;
|
|
37731
37747
|
}
|
|
37748
|
+
class PageGeometryHelper {
|
|
37749
|
+
/**
|
|
37750
|
+
* Creates a new PageGeometryHelper instance.
|
|
37751
|
+
*
|
|
37752
|
+
* @param config - Page geometry configuration
|
|
37753
|
+
*/
|
|
37754
|
+
constructor(config) {
|
|
37755
|
+
this.cache = null;
|
|
37756
|
+
this.config = config;
|
|
37757
|
+
}
|
|
37758
|
+
/**
|
|
37759
|
+
* Updates the layout and invalidates the cache.
|
|
37760
|
+
*
|
|
37761
|
+
* Call this whenever the layout changes (new pages, different heights, etc.)
|
|
37762
|
+
*
|
|
37763
|
+
* @param layout - New layout data
|
|
37764
|
+
* @param pageGap - Optional new page gap (if not provided, uses current gap)
|
|
37765
|
+
*/
|
|
37766
|
+
updateLayout(layout, pageGap) {
|
|
37767
|
+
this.config.layout = layout;
|
|
37768
|
+
if (pageGap !== void 0) {
|
|
37769
|
+
this.config.pageGap = pageGap;
|
|
37770
|
+
}
|
|
37771
|
+
this.cache = null;
|
|
37772
|
+
}
|
|
37773
|
+
/**
|
|
37774
|
+
* Updates the page gap and invalidates the cache.
|
|
37775
|
+
*
|
|
37776
|
+
* @param pageGap - New gap between pages in pixels
|
|
37777
|
+
*/
|
|
37778
|
+
updatePageGap(pageGap) {
|
|
37779
|
+
if (this.config.pageGap !== pageGap) {
|
|
37780
|
+
this.config.pageGap = pageGap;
|
|
37781
|
+
this.cache = null;
|
|
37782
|
+
}
|
|
37783
|
+
}
|
|
37784
|
+
/**
|
|
37785
|
+
* Gets the cumulative Y position (top edge) of a page in container space.
|
|
37786
|
+
*
|
|
37787
|
+
* The returned value is the distance from the top of the container to the
|
|
37788
|
+
* top of the specified page, accounting for all previous pages and gaps.
|
|
37789
|
+
*
|
|
37790
|
+
* @param pageIndex - Zero-based page index
|
|
37791
|
+
* @returns Y position in pixels, or 0 if page index is invalid
|
|
37792
|
+
*
|
|
37793
|
+
* @example
|
|
37794
|
+
* ```typescript
|
|
37795
|
+
* // Get Y position of page 0 (first page)
|
|
37796
|
+
* const y0 = helper.getPageTop(0); // Returns 0
|
|
37797
|
+
*
|
|
37798
|
+
* // Get Y position of page 2 (third page)
|
|
37799
|
+
* // Assumes page 0 height = 1000, page 1 height = 1200, gap = 24
|
|
37800
|
+
* const y2 = helper.getPageTop(2); // Returns 1000 + 24 + 1200 + 24 = 2248
|
|
37801
|
+
* ```
|
|
37802
|
+
*/
|
|
37803
|
+
getPageTop(pageIndex) {
|
|
37804
|
+
this.ensureCache();
|
|
37805
|
+
if (pageIndex < 0 || pageIndex >= this.cache.cumulativeY.length) {
|
|
37806
|
+
return 0;
|
|
37807
|
+
}
|
|
37808
|
+
return this.cache.cumulativeY[pageIndex];
|
|
37809
|
+
}
|
|
37810
|
+
/**
|
|
37811
|
+
* Gets the height of a specific page.
|
|
37812
|
+
*
|
|
37813
|
+
* Uses per-page height if available (from layout.pages[i].size?.h),
|
|
37814
|
+
* otherwise falls back to layout.pageSize.h.
|
|
37815
|
+
*
|
|
37816
|
+
* @param pageIndex - Zero-based page index
|
|
37817
|
+
* @returns Page height in pixels, or 0 if page index is invalid
|
|
37818
|
+
*
|
|
37819
|
+
* @example
|
|
37820
|
+
* ```typescript
|
|
37821
|
+
* const height = helper.getPageHeight(0); // Returns page-specific height
|
|
37822
|
+
* ```
|
|
37823
|
+
*/
|
|
37824
|
+
getPageHeight(pageIndex) {
|
|
37825
|
+
this.ensureCache();
|
|
37826
|
+
if (pageIndex < 0 || pageIndex >= this.cache.pageHeights.length) {
|
|
37827
|
+
return 0;
|
|
37828
|
+
}
|
|
37829
|
+
return this.cache.pageHeights[pageIndex];
|
|
37830
|
+
}
|
|
37831
|
+
/**
|
|
37832
|
+
* Gets the gap between pages.
|
|
37833
|
+
*
|
|
37834
|
+
* @returns Gap in pixels
|
|
37835
|
+
*
|
|
37836
|
+
* @example
|
|
37837
|
+
* ```typescript
|
|
37838
|
+
* const gap = helper.getPageGap(); // Returns 24
|
|
37839
|
+
* ```
|
|
37840
|
+
*/
|
|
37841
|
+
getPageGap() {
|
|
37842
|
+
this.ensureCache();
|
|
37843
|
+
return this.cache.pageGap;
|
|
37844
|
+
}
|
|
37845
|
+
/**
|
|
37846
|
+
* Gets the total height of all pages including gaps.
|
|
37847
|
+
*
|
|
37848
|
+
* Total height = sum of all page heights + (pageCount - 1) * gap
|
|
37849
|
+
*
|
|
37850
|
+
* @returns Total height in pixels
|
|
37851
|
+
*
|
|
37852
|
+
* @example
|
|
37853
|
+
* ```typescript
|
|
37854
|
+
* // 3 pages: heights [1000, 1200, 1000], gap = 24
|
|
37855
|
+
* const total = helper.getTotalHeight();
|
|
37856
|
+
* // Returns 1000 + 24 + 1200 + 24 + 1000 = 3248
|
|
37857
|
+
* ```
|
|
37858
|
+
*/
|
|
37859
|
+
getTotalHeight() {
|
|
37860
|
+
this.ensureCache();
|
|
37861
|
+
return this.cache.totalHeight;
|
|
37862
|
+
}
|
|
37863
|
+
/**
|
|
37864
|
+
* Gets the number of pages in the layout.
|
|
37865
|
+
*
|
|
37866
|
+
* @returns Page count
|
|
37867
|
+
*/
|
|
37868
|
+
getPageCount() {
|
|
37869
|
+
return this.config.layout.pages.length;
|
|
37870
|
+
}
|
|
37871
|
+
/**
|
|
37872
|
+
* Finds the page index containing a given Y coordinate.
|
|
37873
|
+
*
|
|
37874
|
+
* This performs a linear search through cached cumulative positions.
|
|
37875
|
+
* For large documents, consider adding binary search optimization.
|
|
37876
|
+
*
|
|
37877
|
+
* @param containerY - Y coordinate in container space
|
|
37878
|
+
* @returns Page index, or null if Y is outside all pages
|
|
37879
|
+
*
|
|
37880
|
+
* @example
|
|
37881
|
+
* ```typescript
|
|
37882
|
+
* // Find which page contains Y = 1500
|
|
37883
|
+
* const pageIndex = helper.getPageIndexAtY(1500);
|
|
37884
|
+
* // Returns 1 (second page) if first page ends at Y=1024
|
|
37885
|
+
* ```
|
|
37886
|
+
*/
|
|
37887
|
+
getPageIndexAtY(containerY) {
|
|
37888
|
+
this.ensureCache();
|
|
37889
|
+
const cache2 = this.cache;
|
|
37890
|
+
for (let i = 0; i < cache2.cumulativeY.length; i++) {
|
|
37891
|
+
const pageTop = cache2.cumulativeY[i];
|
|
37892
|
+
const pageBottom = pageTop + cache2.pageHeights[i];
|
|
37893
|
+
if (containerY >= pageTop && containerY < pageBottom) {
|
|
37894
|
+
return i;
|
|
37895
|
+
}
|
|
37896
|
+
}
|
|
37897
|
+
return null;
|
|
37898
|
+
}
|
|
37899
|
+
/**
|
|
37900
|
+
* Finds the nearest page index to a given Y coordinate (snap-to-nearest).
|
|
37901
|
+
*
|
|
37902
|
+
* Returns the page containing Y when inside a page; otherwise returns the
|
|
37903
|
+
* closest page based on distance to page center. Useful for dragging through
|
|
37904
|
+
* page gaps where getPageIndexAtY would return null.
|
|
37905
|
+
*
|
|
37906
|
+
* @param containerY - Y coordinate in container space
|
|
37907
|
+
* @returns Nearest page index, or null if there are no pages
|
|
37908
|
+
*/
|
|
37909
|
+
getNearestPageIndex(containerY) {
|
|
37910
|
+
this.ensureCache();
|
|
37911
|
+
const cache2 = this.cache;
|
|
37912
|
+
const pageCount = cache2.pageHeights.length;
|
|
37913
|
+
if (pageCount === 0) return null;
|
|
37914
|
+
const direct = this.getPageIndexAtY(containerY);
|
|
37915
|
+
if (direct !== null) return direct;
|
|
37916
|
+
let nearestIndex = 0;
|
|
37917
|
+
let nearestDistance = Infinity;
|
|
37918
|
+
for (let i = 0; i < pageCount; i++) {
|
|
37919
|
+
const top2 = cache2.cumulativeY[i];
|
|
37920
|
+
const height = cache2.pageHeights[i];
|
|
37921
|
+
const center = top2 + height / 2;
|
|
37922
|
+
const distance = Math.abs(containerY - center);
|
|
37923
|
+
if (distance < nearestDistance) {
|
|
37924
|
+
nearestDistance = distance;
|
|
37925
|
+
nearestIndex = i;
|
|
37926
|
+
}
|
|
37927
|
+
}
|
|
37928
|
+
return nearestIndex;
|
|
37929
|
+
}
|
|
37930
|
+
/**
|
|
37931
|
+
* Ensures the cache is built and up-to-date.
|
|
37932
|
+
* Validates cache state and rebuilds if needed.
|
|
37933
|
+
* @private
|
|
37934
|
+
* @throws Never throws - handles errors gracefully with fallback values
|
|
37935
|
+
*/
|
|
37936
|
+
ensureCache() {
|
|
37937
|
+
if (this.cache !== null) {
|
|
37938
|
+
if (!Array.isArray(this.cache.cumulativeY) || !Array.isArray(this.cache.pageHeights)) {
|
|
37939
|
+
console.warn("[PageGeometryHelper] Cache corruption detected, rebuilding cache");
|
|
37940
|
+
this.cache = null;
|
|
37941
|
+
} else {
|
|
37942
|
+
return;
|
|
37943
|
+
}
|
|
37944
|
+
}
|
|
37945
|
+
this.buildCache();
|
|
37946
|
+
}
|
|
37947
|
+
/**
|
|
37948
|
+
* Builds the geometry cache from current layout data.
|
|
37949
|
+
* Handles errors gracefully by providing fallback values.
|
|
37950
|
+
* @private
|
|
37951
|
+
* @throws Never throws - catches all errors and provides safe defaults
|
|
37952
|
+
*/
|
|
37953
|
+
buildCache() {
|
|
37954
|
+
try {
|
|
37955
|
+
const layout = this.config.layout;
|
|
37956
|
+
if (!layout || !Array.isArray(layout.pages)) {
|
|
37957
|
+
throw new Error("Invalid layout: missing or invalid pages array");
|
|
37958
|
+
}
|
|
37959
|
+
const pageGap = this.config.pageGap ?? layout.pageGap ?? 0;
|
|
37960
|
+
const pageCount = layout.pages.length;
|
|
37961
|
+
if (!Number.isFinite(pageGap) || pageGap < 0) {
|
|
37962
|
+
throw new Error(`Invalid pageGap: ${pageGap} (must be non-negative finite number)`);
|
|
37963
|
+
}
|
|
37964
|
+
const cumulativeY = new Array(pageCount);
|
|
37965
|
+
const pageHeights = new Array(pageCount);
|
|
37966
|
+
let currentY = 0;
|
|
37967
|
+
for (let i = 0; i < pageCount; i++) {
|
|
37968
|
+
const page = layout.pages[i];
|
|
37969
|
+
if (!page) {
|
|
37970
|
+
throw new Error(`Invalid page at index ${i}: page is null or undefined`);
|
|
37971
|
+
}
|
|
37972
|
+
const pageHeight = page.size?.h ?? layout.pageSize.h;
|
|
37973
|
+
if (!Number.isFinite(pageHeight) || pageHeight < 0) {
|
|
37974
|
+
throw new Error(`Invalid page height at index ${i}: ${pageHeight} (must be non-negative finite number)`);
|
|
37975
|
+
}
|
|
37976
|
+
cumulativeY[i] = currentY;
|
|
37977
|
+
pageHeights[i] = pageHeight;
|
|
37978
|
+
currentY += pageHeight;
|
|
37979
|
+
if (i < pageCount - 1) {
|
|
37980
|
+
currentY += pageGap;
|
|
37981
|
+
}
|
|
37982
|
+
}
|
|
37983
|
+
const totalHeight = currentY;
|
|
37984
|
+
this.cache = {
|
|
37985
|
+
cumulativeY,
|
|
37986
|
+
pageHeights,
|
|
37987
|
+
pageGap,
|
|
37988
|
+
totalHeight,
|
|
37989
|
+
layoutVersion: 0
|
|
37990
|
+
// Placeholder for future version tracking
|
|
37991
|
+
};
|
|
37992
|
+
} catch (error) {
|
|
37993
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
37994
|
+
console.error(`[PageGeometryHelper] Cache build failed: ${errorMessage}. Using fallback empty cache.`);
|
|
37995
|
+
this.cache = {
|
|
37996
|
+
cumulativeY: [],
|
|
37997
|
+
pageHeights: [],
|
|
37998
|
+
pageGap: 0,
|
|
37999
|
+
totalHeight: 0,
|
|
38000
|
+
layoutVersion: 0
|
|
38001
|
+
};
|
|
38002
|
+
}
|
|
38003
|
+
}
|
|
38004
|
+
/**
|
|
38005
|
+
* Clears the cache, forcing recalculation on next access.
|
|
38006
|
+
* Useful for testing or manual cache invalidation.
|
|
38007
|
+
*/
|
|
38008
|
+
clearCache() {
|
|
38009
|
+
this.cache = null;
|
|
38010
|
+
}
|
|
38011
|
+
/**
|
|
38012
|
+
* Gets debug information about the current cache state.
|
|
38013
|
+
* @internal
|
|
38014
|
+
*/
|
|
38015
|
+
getDebugInfo() {
|
|
38016
|
+
this.ensureCache();
|
|
38017
|
+
return {
|
|
38018
|
+
isCached: this.cache !== null,
|
|
38019
|
+
pageCount: this.config.layout.pages.length,
|
|
38020
|
+
pageGap: this.cache.pageGap,
|
|
38021
|
+
totalHeight: this.cache.totalHeight,
|
|
38022
|
+
cumulativeY: [...this.cache.cumulativeY],
|
|
38023
|
+
pageHeights: [...this.cache.pageHeights]
|
|
38024
|
+
};
|
|
38025
|
+
}
|
|
38026
|
+
}
|
|
37732
38027
|
var Priority = /* @__PURE__ */ ((Priority2) => {
|
|
37733
38028
|
Priority2[Priority2["P0"] = 0] = "P0";
|
|
37734
38029
|
Priority2[Priority2["P1"] = 1] = "P1";
|
|
@@ -38022,18 +38317,41 @@ const rangesOverlap = (startA, endA, startB, endB) => {
|
|
|
38022
38317
|
const effectiveEndA = endA ?? startA + 1;
|
|
38023
38318
|
return effectiveEndA > startB && startA < endB;
|
|
38024
38319
|
};
|
|
38025
|
-
function hitTestPage(layout, point) {
|
|
38320
|
+
function hitTestPage(layout, point, geometryHelper) {
|
|
38321
|
+
if (geometryHelper) {
|
|
38322
|
+
const pageIndex = geometryHelper.getPageIndexAtY(point.y);
|
|
38323
|
+
if (pageIndex !== null) {
|
|
38324
|
+
return { pageIndex, page: layout.pages[pageIndex] };
|
|
38325
|
+
}
|
|
38326
|
+
const nearest = geometryHelper.getNearestPageIndex(point.y);
|
|
38327
|
+
if (nearest !== null) {
|
|
38328
|
+
return { pageIndex: nearest, page: layout.pages[nearest] };
|
|
38329
|
+
}
|
|
38330
|
+
return null;
|
|
38331
|
+
}
|
|
38026
38332
|
const pageGap = layout.pageGap ?? 0;
|
|
38027
38333
|
let cursorY = 0;
|
|
38334
|
+
let nearestIndex = null;
|
|
38335
|
+
let nearestDistance = Infinity;
|
|
38028
38336
|
for (let pageIndex = 0; pageIndex < layout.pages.length; pageIndex += 1) {
|
|
38029
38337
|
const page = layout.pages[pageIndex];
|
|
38338
|
+
const pageHeight = page.size?.h ?? layout.pageSize.h;
|
|
38030
38339
|
const top2 = cursorY;
|
|
38031
|
-
const bottom2 = top2 +
|
|
38340
|
+
const bottom2 = top2 + pageHeight;
|
|
38032
38341
|
if (point.y >= top2 && point.y < bottom2) {
|
|
38033
38342
|
return { pageIndex, page };
|
|
38034
38343
|
}
|
|
38344
|
+
const center = top2 + pageHeight / 2;
|
|
38345
|
+
const distance = Math.abs(point.y - center);
|
|
38346
|
+
if (distance < nearestDistance) {
|
|
38347
|
+
nearestDistance = distance;
|
|
38348
|
+
nearestIndex = pageIndex;
|
|
38349
|
+
}
|
|
38035
38350
|
cursorY = bottom2 + pageGap;
|
|
38036
38351
|
}
|
|
38352
|
+
if (nearestIndex !== null) {
|
|
38353
|
+
return { pageIndex: nearestIndex, page: layout.pages[nearestIndex] };
|
|
38354
|
+
}
|
|
38037
38355
|
return null;
|
|
38038
38356
|
}
|
|
38039
38357
|
function hitTestFragment(layout, pageHit, blocks, measures, point) {
|
|
@@ -38194,7 +38512,7 @@ const hitTestTableFragment = (pageHit, blocks, measures, point) => {
|
|
|
38194
38512
|
}
|
|
38195
38513
|
return null;
|
|
38196
38514
|
};
|
|
38197
|
-
function clickToPosition(layout, blocks, measures, containerPoint, domContainer, clientX, clientY) {
|
|
38515
|
+
function clickToPosition(layout, blocks, measures, containerPoint, domContainer, clientX, clientY, geometryHelper) {
|
|
38198
38516
|
logClickStage("log", "entry", {
|
|
38199
38517
|
pages: layout.pages.length
|
|
38200
38518
|
});
|
|
@@ -38237,75 +38555,132 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
|
|
|
38237
38555
|
return { pos: domPos, blockId: "", pageIndex: 0, column: 0, lineIndex: -1 };
|
|
38238
38556
|
}
|
|
38239
38557
|
}
|
|
38240
|
-
const pageHit = hitTestPage(layout, containerPoint);
|
|
38558
|
+
const pageHit = hitTestPage(layout, containerPoint, geometryHelper);
|
|
38241
38559
|
if (!pageHit) {
|
|
38242
38560
|
return null;
|
|
38243
38561
|
}
|
|
38244
|
-
const
|
|
38562
|
+
const pageTopY = geometryHelper ? geometryHelper.getPageTop(pageHit.pageIndex) : calculatePageTopFallback(layout, pageHit.pageIndex);
|
|
38245
38563
|
const pageRelativePoint = {
|
|
38246
38564
|
x: containerPoint.x,
|
|
38247
|
-
y: containerPoint.y -
|
|
38565
|
+
y: containerPoint.y - pageTopY
|
|
38248
38566
|
};
|
|
38249
38567
|
logClickStage("log", "page-hit", {
|
|
38250
38568
|
pageIndex: pageHit.pageIndex
|
|
38251
38569
|
});
|
|
38252
|
-
|
|
38570
|
+
let fragmentHit = hitTestFragment(layout, pageHit, blocks, measures, pageRelativePoint);
|
|
38571
|
+
if (!fragmentHit) {
|
|
38572
|
+
const page = pageHit.page;
|
|
38573
|
+
const fragments = page.fragments.filter(
|
|
38574
|
+
(f2) => f2 != null && typeof f2 === "object"
|
|
38575
|
+
);
|
|
38576
|
+
if (fragments.length > 0) {
|
|
38577
|
+
let nearest = null;
|
|
38578
|
+
let nearestDist = Infinity;
|
|
38579
|
+
for (const frag of fragments) {
|
|
38580
|
+
const top2 = frag.y;
|
|
38581
|
+
const bottom2 = frag.y + frag.height;
|
|
38582
|
+
let dist;
|
|
38583
|
+
if (pageRelativePoint.y < top2) {
|
|
38584
|
+
dist = top2 - pageRelativePoint.y;
|
|
38585
|
+
} else if (pageRelativePoint.y > bottom2) {
|
|
38586
|
+
dist = pageRelativePoint.y - bottom2;
|
|
38587
|
+
} else {
|
|
38588
|
+
dist = 0;
|
|
38589
|
+
}
|
|
38590
|
+
if (dist < nearestDist) {
|
|
38591
|
+
nearestDist = dist;
|
|
38592
|
+
nearest = frag;
|
|
38593
|
+
}
|
|
38594
|
+
}
|
|
38595
|
+
if (nearest) {
|
|
38596
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, nearest.blockId);
|
|
38597
|
+
if (blockIndex !== -1) {
|
|
38598
|
+
const block = blocks[blockIndex];
|
|
38599
|
+
const measure = measures[blockIndex];
|
|
38600
|
+
if (block && measure) {
|
|
38601
|
+
fragmentHit = {
|
|
38602
|
+
fragment: nearest,
|
|
38603
|
+
block,
|
|
38604
|
+
measure,
|
|
38605
|
+
pageIndex: pageHit.pageIndex,
|
|
38606
|
+
pageY: 0
|
|
38607
|
+
};
|
|
38608
|
+
}
|
|
38609
|
+
}
|
|
38610
|
+
}
|
|
38611
|
+
}
|
|
38612
|
+
}
|
|
38253
38613
|
if (fragmentHit) {
|
|
38254
38614
|
const { fragment, block, measure, pageIndex, pageY } = fragmentHit;
|
|
38255
|
-
if (fragment.kind
|
|
38256
|
-
|
|
38257
|
-
|
|
38258
|
-
|
|
38259
|
-
|
|
38615
|
+
if (fragment.kind === "para" && measure.kind === "paragraph" && block.kind === "paragraph") {
|
|
38616
|
+
const lineIndex = findLineIndexAtY(measure, pageY, fragment.fromLine, fragment.toLine);
|
|
38617
|
+
if (lineIndex == null) {
|
|
38618
|
+
logClickStage("warn", "no-line", {
|
|
38619
|
+
blockId: fragment.blockId
|
|
38620
|
+
});
|
|
38621
|
+
return null;
|
|
38622
|
+
}
|
|
38623
|
+
const line = measure.lines[lineIndex];
|
|
38624
|
+
const isRTL = isRtlBlock(block);
|
|
38625
|
+
const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
|
|
38626
|
+
const indentRight = typeof block.attrs?.indent?.right === "number" ? block.attrs.indent.right : 0;
|
|
38627
|
+
const paraIndentLeft = Number.isFinite(indentLeft) ? indentLeft : 0;
|
|
38628
|
+
const paraIndentRight = Number.isFinite(indentRight) ? indentRight : 0;
|
|
38629
|
+
const totalIndent = paraIndentLeft + paraIndentRight;
|
|
38630
|
+
const availableWidth = Math.max(0, fragment.width - totalIndent);
|
|
38631
|
+
if (totalIndent > fragment.width) {
|
|
38632
|
+
console.warn(
|
|
38633
|
+
`[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.`
|
|
38634
|
+
);
|
|
38635
|
+
}
|
|
38636
|
+
const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
38637
|
+
const isListItem3 = markerWidth > 0;
|
|
38638
|
+
const alignmentOverride = isListItem3 ? "left" : void 0;
|
|
38639
|
+
const pos = mapPointToPm(block, line, pageRelativePoint.x - fragment.x, isRTL, availableWidth, alignmentOverride);
|
|
38640
|
+
if (pos == null) {
|
|
38641
|
+
logClickStage("warn", "no-position", {
|
|
38642
|
+
blockId: fragment.blockId
|
|
38643
|
+
});
|
|
38644
|
+
return null;
|
|
38645
|
+
}
|
|
38646
|
+
const column = determineColumn(layout, fragment.x);
|
|
38647
|
+
logPositionDebug({
|
|
38648
|
+
blockId: fragment.blockId,
|
|
38649
|
+
x: pageRelativePoint.x - fragment.x
|
|
38260
38650
|
});
|
|
38261
|
-
|
|
38262
|
-
}
|
|
38263
|
-
const lineIndex = findLineIndexAtY(measure, pageY, fragment.fromLine, fragment.toLine);
|
|
38264
|
-
if (lineIndex == null) {
|
|
38265
|
-
logClickStage("warn", "no-line", {
|
|
38651
|
+
logClickStage("log", "success", {
|
|
38266
38652
|
blockId: fragment.blockId
|
|
38267
38653
|
});
|
|
38268
|
-
return
|
|
38269
|
-
|
|
38270
|
-
|
|
38271
|
-
|
|
38272
|
-
|
|
38273
|
-
|
|
38274
|
-
|
|
38275
|
-
|
|
38276
|
-
const totalIndent = paraIndentLeft + paraIndentRight;
|
|
38277
|
-
const availableWidth = Math.max(0, fragment.width - totalIndent);
|
|
38278
|
-
if (totalIndent > fragment.width) {
|
|
38279
|
-
console.warn(
|
|
38280
|
-
`[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.`
|
|
38281
|
-
);
|
|
38654
|
+
return {
|
|
38655
|
+
pos,
|
|
38656
|
+
blockId: fragment.blockId,
|
|
38657
|
+
pageIndex,
|
|
38658
|
+
column,
|
|
38659
|
+
lineIndex
|
|
38660
|
+
// lineIndex is now already absolute (within measure.lines), no need to add fragment.fromLine
|
|
38661
|
+
};
|
|
38282
38662
|
}
|
|
38283
|
-
|
|
38284
|
-
|
|
38285
|
-
|
|
38286
|
-
|
|
38287
|
-
|
|
38288
|
-
|
|
38289
|
-
|
|
38663
|
+
if (isAtomicFragment(fragment)) {
|
|
38664
|
+
const pmRange = getAtomicPmRange(fragment, block);
|
|
38665
|
+
const pos = pmRange.pmStart ?? pmRange.pmEnd ?? null;
|
|
38666
|
+
if (pos == null) {
|
|
38667
|
+
logClickStage("warn", "atomic-without-range", {
|
|
38668
|
+
fragmentId: fragment.blockId
|
|
38669
|
+
});
|
|
38670
|
+
return null;
|
|
38671
|
+
}
|
|
38672
|
+
logClickStage("log", "success", {
|
|
38673
|
+
blockId: fragment.blockId,
|
|
38674
|
+
column: determineColumn(layout, fragment.x)
|
|
38290
38675
|
});
|
|
38291
|
-
return
|
|
38676
|
+
return {
|
|
38677
|
+
pos,
|
|
38678
|
+
blockId: fragment.blockId,
|
|
38679
|
+
pageIndex,
|
|
38680
|
+
column: determineColumn(layout, fragment.x),
|
|
38681
|
+
lineIndex: -1
|
|
38682
|
+
};
|
|
38292
38683
|
}
|
|
38293
|
-
const column = determineColumn(layout, fragment.x);
|
|
38294
|
-
logPositionDebug({
|
|
38295
|
-
blockId: fragment.blockId,
|
|
38296
|
-
x: pageRelativePoint.x - fragment.x
|
|
38297
|
-
});
|
|
38298
|
-
logClickStage("log", "success", {
|
|
38299
|
-
blockId: fragment.blockId
|
|
38300
|
-
});
|
|
38301
|
-
return {
|
|
38302
|
-
pos,
|
|
38303
|
-
blockId: fragment.blockId,
|
|
38304
|
-
pageIndex,
|
|
38305
|
-
column,
|
|
38306
|
-
lineIndex
|
|
38307
|
-
// lineIndex is now already absolute (within measure.lines), no need to add fragment.fromLine
|
|
38308
|
-
};
|
|
38309
38684
|
}
|
|
38310
38685
|
const tableHit = hitTestTableFragment(pageHit, blocks, measures, pageRelativePoint);
|
|
38311
38686
|
if (tableHit) {
|
|
@@ -38455,12 +38830,22 @@ const sumLineHeights = (measure, fromLine, toLine) => {
|
|
|
38455
38830
|
}
|
|
38456
38831
|
return height;
|
|
38457
38832
|
};
|
|
38458
|
-
|
|
38833
|
+
const calculatePageTopFallback = (layout, pageIndex) => {
|
|
38834
|
+
const pageGap = layout.pageGap ?? 0;
|
|
38835
|
+
let y = 0;
|
|
38836
|
+
for (let i = 0; i < pageIndex; i++) {
|
|
38837
|
+
const pageHeight = layout.pages[i]?.size?.h ?? layout.pageSize.h;
|
|
38838
|
+
y += pageHeight + pageGap;
|
|
38839
|
+
}
|
|
38840
|
+
return y;
|
|
38841
|
+
};
|
|
38842
|
+
function selectionToRects(layout, blocks, measures, from2, to, geometryHelper) {
|
|
38459
38843
|
if (from2 === to) {
|
|
38460
38844
|
return [];
|
|
38461
38845
|
}
|
|
38462
38846
|
const rects = [];
|
|
38463
38847
|
layout.pages.forEach((page, pageIndex) => {
|
|
38848
|
+
const pageTopY = geometryHelper ? geometryHelper.getPageTop(pageIndex) : calculatePageTopFallback(layout, pageIndex);
|
|
38464
38849
|
page.fragments.forEach((fragment) => {
|
|
38465
38850
|
if (fragment.kind === "para") {
|
|
38466
38851
|
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
@@ -38502,12 +38887,16 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
38502
38887
|
wordLayout
|
|
38503
38888
|
});
|
|
38504
38889
|
const rectX = fragment.x + indentAdjust + Math.min(startX, endX);
|
|
38505
|
-
const rectWidth = Math.max(
|
|
38890
|
+
const rectWidth = Math.max(
|
|
38891
|
+
1,
|
|
38892
|
+
Math.min(Math.abs(endX - startX), line.width)
|
|
38893
|
+
// clamp to line width to prevent runaway widths
|
|
38894
|
+
);
|
|
38506
38895
|
const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
|
|
38507
38896
|
const rectY = fragment.y + lineOffset;
|
|
38508
38897
|
rects.push({
|
|
38509
38898
|
x: rectX,
|
|
38510
|
-
y: rectY +
|
|
38899
|
+
y: rectY + pageTopY,
|
|
38511
38900
|
width: rectWidth,
|
|
38512
38901
|
height: line.lineHeight,
|
|
38513
38902
|
pageIndex
|
|
@@ -38635,12 +39024,16 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
38635
39024
|
wordLayout: cellWordLayout
|
|
38636
39025
|
});
|
|
38637
39026
|
const rectX = fragment.x + cellX + padding.left + textIndentAdjust + Math.min(startX, endX);
|
|
38638
|
-
const rectWidth = Math.max(
|
|
39027
|
+
const rectWidth = Math.max(
|
|
39028
|
+
1,
|
|
39029
|
+
Math.min(Math.abs(endX - startX), line.width)
|
|
39030
|
+
// clamp to line width to prevent runaway widths
|
|
39031
|
+
);
|
|
38639
39032
|
const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
|
|
38640
39033
|
const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
|
|
38641
39034
|
rects.push({
|
|
38642
39035
|
x: rectX,
|
|
38643
|
-
y: rectY +
|
|
39036
|
+
y: rectY + pageTopY,
|
|
38644
39037
|
width: rectWidth,
|
|
38645
39038
|
height: line.lineHeight,
|
|
38646
39039
|
pageIndex
|
|
@@ -38669,7 +39062,7 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
38669
39062
|
if (!rangesOverlap(pmRange.pmStart, pmRange.pmEnd, from2, to)) return;
|
|
38670
39063
|
rects.push({
|
|
38671
39064
|
x: fragment.x,
|
|
38672
|
-
y: fragment.y +
|
|
39065
|
+
y: fragment.y + pageTopY,
|
|
38673
39066
|
width: fragment.width,
|
|
38674
39067
|
height: fragment.height,
|
|
38675
39068
|
pageIndex
|
|
@@ -42027,6 +42420,7 @@ const DEFAULT_PAGE_SIZE = { w: 612, h: 792 };
|
|
|
42027
42420
|
const DEFAULT_MARGINS = { top: 72, right: 72, bottom: 72, left: 72 };
|
|
42028
42421
|
const DEFAULT_VIRTUALIZED_PAGE_GAP = 72;
|
|
42029
42422
|
const DEFAULT_PAGE_GAP = 24;
|
|
42423
|
+
const DEFAULT_HORIZONTAL_PAGE_GAP = 20;
|
|
42030
42424
|
const WORD_CHARACTER_REGEX = /[\p{L}\p{N}''_~-]/u;
|
|
42031
42425
|
const MULTI_CLICK_TIME_THRESHOLD_MS = 400;
|
|
42032
42426
|
const MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5;
|
|
@@ -42050,6 +42444,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
42050
42444
|
__privateAdd(this, _layoutOptions);
|
|
42051
42445
|
__privateAdd(this, _layoutState, { blocks: [], measures: [], layout: null, bookmarks: /* @__PURE__ */ new Map() });
|
|
42052
42446
|
__privateAdd(this, _domPainter, null);
|
|
42447
|
+
__privateAdd(this, _pageGeometryHelper, null);
|
|
42053
42448
|
__privateAdd(this, _dragHandlerCleanup, null);
|
|
42054
42449
|
__privateAdd(this, _layoutError, null);
|
|
42055
42450
|
__privateAdd(this, _layoutErrorState, "healthy");
|
|
@@ -42218,7 +42613,8 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
42218
42613
|
{ x, y },
|
|
42219
42614
|
__privateGet(this, _viewportHost),
|
|
42220
42615
|
event.clientX,
|
|
42221
|
-
event.clientY
|
|
42616
|
+
event.clientY,
|
|
42617
|
+
__privateGet(this, _pageGeometryHelper) ?? void 0
|
|
42222
42618
|
);
|
|
42223
42619
|
const doc2 = __privateGet(this, _editor3).state?.doc;
|
|
42224
42620
|
const hit = rawHit && doc2 ? { ...rawHit, pos: Math.max(0, Math.min(rawHit.pos, doc2.content.size)) } : rawHit;
|
|
@@ -42417,7 +42813,8 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
42417
42813
|
{ x: normalized.x, y: normalized.y },
|
|
42418
42814
|
__privateGet(this, _viewportHost),
|
|
42419
42815
|
event.clientX,
|
|
42420
|
-
event.clientY
|
|
42816
|
+
event.clientY,
|
|
42817
|
+
__privateGet(this, _pageGeometryHelper) ?? void 0
|
|
42421
42818
|
);
|
|
42422
42819
|
if (!hit) return;
|
|
42423
42820
|
const currentTableHit = __privateMethod(this, _PresentationEditor_instances, hitTestTable_fn).call(this, normalized.x, normalized.y);
|
|
@@ -43307,7 +43704,14 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
43307
43704
|
return __privateMethod(this, _PresentationEditor_instances, computeHeaderFooterSelectionRects_fn).call(this, start2, end2);
|
|
43308
43705
|
}
|
|
43309
43706
|
if (!__privateGet(this, _layoutState).layout) return [];
|
|
43310
|
-
const rects = selectionToRects(
|
|
43707
|
+
const rects = selectionToRects(
|
|
43708
|
+
__privateGet(this, _layoutState).layout,
|
|
43709
|
+
__privateGet(this, _layoutState).blocks,
|
|
43710
|
+
__privateGet(this, _layoutState).measures,
|
|
43711
|
+
start2,
|
|
43712
|
+
end2,
|
|
43713
|
+
__privateGet(this, _pageGeometryHelper) ?? void 0
|
|
43714
|
+
) ?? [];
|
|
43311
43715
|
return rects;
|
|
43312
43716
|
};
|
|
43313
43717
|
const rawRects = layoutRectSource();
|
|
@@ -43572,6 +43976,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
43572
43976
|
};
|
|
43573
43977
|
}
|
|
43574
43978
|
__privateSet(this, _domPainter, null);
|
|
43979
|
+
__privateSet(this, _pageGeometryHelper, null);
|
|
43575
43980
|
__privateSet(this, _pendingDocChange, true);
|
|
43576
43981
|
__privateMethod(this, _PresentationEditor_instances, scheduleRerender_fn).call(this);
|
|
43577
43982
|
}
|
|
@@ -43604,7 +44009,16 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
43604
44009
|
x: localX,
|
|
43605
44010
|
y: headerPageIndex * headerPageHeight + (localY - headerPageIndex * headerPageHeight)
|
|
43606
44011
|
};
|
|
43607
|
-
const hit2 = clickToPosition(
|
|
44012
|
+
const hit2 = clickToPosition(
|
|
44013
|
+
context.layout,
|
|
44014
|
+
context.blocks,
|
|
44015
|
+
context.measures,
|
|
44016
|
+
headerPoint,
|
|
44017
|
+
void 0,
|
|
44018
|
+
void 0,
|
|
44019
|
+
void 0,
|
|
44020
|
+
void 0
|
|
44021
|
+
) ?? null;
|
|
43608
44022
|
return hit2;
|
|
43609
44023
|
}
|
|
43610
44024
|
if (!__privateGet(this, _layoutState).layout) {
|
|
@@ -43617,7 +44031,8 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
43617
44031
|
normalized,
|
|
43618
44032
|
__privateGet(this, _viewportHost),
|
|
43619
44033
|
clientX,
|
|
43620
|
-
clientY
|
|
44034
|
+
clientY,
|
|
44035
|
+
__privateGet(this, _pageGeometryHelper) ?? void 0
|
|
43621
44036
|
) ?? null;
|
|
43622
44037
|
return hit;
|
|
43623
44038
|
}
|
|
@@ -43840,6 +44255,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
43840
44255
|
__privateSet(this, _session, { mode: "body" });
|
|
43841
44256
|
__privateSet(this, _activeHeaderFooterEditor, null);
|
|
43842
44257
|
__privateSet(this, _domPainter, null);
|
|
44258
|
+
__privateSet(this, _pageGeometryHelper, null);
|
|
43843
44259
|
(_a = __privateGet(this, _dragHandlerCleanup)) == null ? void 0 : _a.call(this);
|
|
43844
44260
|
__privateSet(this, _dragHandlerCleanup, null);
|
|
43845
44261
|
__privateGet(this, _selectionOverlay2)?.remove();
|
|
@@ -43893,7 +44309,14 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
43893
44309
|
if (!normalized) return false;
|
|
43894
44310
|
const pmPos = __privateGet(this, _layoutState).bookmarks.get(normalized);
|
|
43895
44311
|
if (pmPos == null) return false;
|
|
43896
|
-
const rects = selectionToRects(
|
|
44312
|
+
const rects = selectionToRects(
|
|
44313
|
+
layout,
|
|
44314
|
+
__privateGet(this, _layoutState).blocks,
|
|
44315
|
+
__privateGet(this, _layoutState).measures,
|
|
44316
|
+
pmPos,
|
|
44317
|
+
pmPos + 1,
|
|
44318
|
+
__privateGet(this, _pageGeometryHelper) ?? void 0
|
|
44319
|
+
) ?? [];
|
|
43897
44320
|
const rect = rects[0];
|
|
43898
44321
|
let pageIndex = rect?.pageIndex ?? null;
|
|
43899
44322
|
if (pageIndex == null) {
|
|
@@ -43957,6 +44380,7 @@ _hiddenHost = new WeakMap();
|
|
|
43957
44380
|
_layoutOptions = new WeakMap();
|
|
43958
44381
|
_layoutState = new WeakMap();
|
|
43959
44382
|
_domPainter = new WeakMap();
|
|
44383
|
+
_pageGeometryHelper = new WeakMap();
|
|
43960
44384
|
_dragHandlerCleanup = new WeakMap();
|
|
43961
44385
|
_layoutError = new WeakMap();
|
|
43962
44386
|
_layoutErrorState = new WeakMap();
|
|
@@ -44588,7 +45012,7 @@ renderRemoteSelection_fn = function(cursor) {
|
|
|
44588
45012
|
if (!layout || !blocks || !measures) return;
|
|
44589
45013
|
const start2 = Math.min(cursor.anchor, cursor.head);
|
|
44590
45014
|
const end2 = Math.max(cursor.anchor, cursor.head);
|
|
44591
|
-
const rects = selectionToRects(layout, blocks, measures, start2, end2) ?? [];
|
|
45015
|
+
const rects = selectionToRects(layout, blocks, measures, start2, end2, __privateGet(this, _pageGeometryHelper) ?? void 0) ?? [];
|
|
44592
45016
|
const color = __privateMethod(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
44593
45017
|
const opacity = __privateGet(this, _layoutOptions).presence?.highlightOpacity ?? 0.35;
|
|
44594
45018
|
const pageHeight = layout.pageSize?.h ?? __privateGet(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
@@ -45081,15 +45505,25 @@ hitTestTable_fn = function(normalizedX, normalizedY) {
|
|
|
45081
45505
|
const configuredPageSize = __privateGet(this, _layoutOptions).pageSize ?? DEFAULT_PAGE_SIZE;
|
|
45082
45506
|
let pageY = 0;
|
|
45083
45507
|
let pageHit = null;
|
|
45084
|
-
|
|
45085
|
-
|
|
45086
|
-
const
|
|
45087
|
-
|
|
45088
|
-
|
|
45089
|
-
|
|
45090
|
-
|
|
45508
|
+
const geometryHelper = __privateGet(this, _pageGeometryHelper);
|
|
45509
|
+
if (geometryHelper) {
|
|
45510
|
+
const idx = geometryHelper.getPageIndexAtY(normalizedY) ?? geometryHelper.getNearestPageIndex(normalizedY);
|
|
45511
|
+
if (idx != null && layout.pages[idx]) {
|
|
45512
|
+
pageHit = { pageIndex: idx, page: layout.pages[idx] };
|
|
45513
|
+
pageY = geometryHelper.getPageTop(idx);
|
|
45514
|
+
}
|
|
45515
|
+
}
|
|
45516
|
+
if (!pageHit) {
|
|
45517
|
+
const gap = layout.pageGap ?? __privateMethod(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this);
|
|
45518
|
+
for (let i = 0; i < layout.pages.length; i++) {
|
|
45519
|
+
const page = layout.pages[i];
|
|
45520
|
+
const pageHeight = page.size?.h ?? configuredPageSize.h;
|
|
45521
|
+
if (normalizedY >= pageY && normalizedY < pageY + pageHeight) {
|
|
45522
|
+
pageHit = { pageIndex: i, page };
|
|
45523
|
+
break;
|
|
45524
|
+
}
|
|
45525
|
+
pageY += pageHeight + gap;
|
|
45091
45526
|
}
|
|
45092
|
-
pageY += pageHeight + gap;
|
|
45093
45527
|
}
|
|
45094
45528
|
if (!pageHit) {
|
|
45095
45529
|
return null;
|
|
@@ -45401,12 +45835,7 @@ rerender_fn = async function() {
|
|
|
45401
45835
|
return;
|
|
45402
45836
|
}
|
|
45403
45837
|
({ layout, measures } = result);
|
|
45404
|
-
|
|
45405
|
-
const gap = __privateGet(this, _layoutOptions).virtualization.gap ?? DEFAULT_VIRTUALIZED_PAGE_GAP;
|
|
45406
|
-
layout.pageGap = Math.max(0, gap);
|
|
45407
|
-
} else {
|
|
45408
|
-
layout.pageGap = DEFAULT_PAGE_GAP;
|
|
45409
|
-
}
|
|
45838
|
+
layout.pageGap = __privateMethod(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this);
|
|
45410
45839
|
headerLayouts = result.headers;
|
|
45411
45840
|
footerLayouts = result.footers;
|
|
45412
45841
|
} catch (error) {
|
|
@@ -45423,6 +45852,17 @@ rerender_fn = async function() {
|
|
|
45423
45852
|
__privateSet(this, _layoutState, { blocks, measures, layout, bookmarks, anchorMap });
|
|
45424
45853
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
45425
45854
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
45855
|
+
if (__privateGet(this, _layoutState).layout) {
|
|
45856
|
+
const pageGap = __privateGet(this, _layoutState).layout.pageGap ?? __privateMethod(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this);
|
|
45857
|
+
if (!__privateGet(this, _pageGeometryHelper)) {
|
|
45858
|
+
__privateSet(this, _pageGeometryHelper, new PageGeometryHelper({
|
|
45859
|
+
layout: __privateGet(this, _layoutState).layout,
|
|
45860
|
+
pageGap
|
|
45861
|
+
}));
|
|
45862
|
+
} else {
|
|
45863
|
+
__privateGet(this, _pageGeometryHelper).updateLayout(__privateGet(this, _layoutState).layout, pageGap);
|
|
45864
|
+
}
|
|
45865
|
+
}
|
|
45426
45866
|
await __privateMethod(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
45427
45867
|
__privateMethod(this, _PresentationEditor_instances, updateDecorationProviders_fn).call(this, layout);
|
|
45428
45868
|
const painter = __privateMethod(this, _PresentationEditor_instances, ensurePainter_fn).call(this, blocks, measures);
|
|
@@ -45492,7 +45932,8 @@ ensurePainter_fn = function(blocks, measures) {
|
|
|
45492
45932
|
pageStyles: __privateGet(this, _layoutOptions).pageStyles,
|
|
45493
45933
|
headerProvider: __privateGet(this, _headerDecorationProvider),
|
|
45494
45934
|
footerProvider: __privateGet(this, _footerDecorationProvider),
|
|
45495
|
-
ruler: __privateGet(this, _layoutOptions).ruler
|
|
45935
|
+
ruler: __privateGet(this, _layoutOptions).ruler,
|
|
45936
|
+
pageGap: __privateGet(this, _layoutState).layout?.pageGap ?? __privateMethod(this, _PresentationEditor_instances, getEffectivePageGap_fn).call(this)
|
|
45496
45937
|
}));
|
|
45497
45938
|
}
|
|
45498
45939
|
return __privateGet(this, _domPainter);
|
|
@@ -45647,7 +46088,14 @@ updateSelection_fn = function() {
|
|
|
45647
46088
|
}
|
|
45648
46089
|
return;
|
|
45649
46090
|
}
|
|
45650
|
-
const rects = selectionToRects(
|
|
46091
|
+
const rects = selectionToRects(
|
|
46092
|
+
layout,
|
|
46093
|
+
__privateGet(this, _layoutState).blocks,
|
|
46094
|
+
__privateGet(this, _layoutState).measures,
|
|
46095
|
+
from2,
|
|
46096
|
+
to,
|
|
46097
|
+
__privateGet(this, _pageGeometryHelper) ?? void 0
|
|
46098
|
+
) ?? [];
|
|
45651
46099
|
let domStart = null;
|
|
45652
46100
|
let domEnd = null;
|
|
45653
46101
|
try {
|
|
@@ -45661,7 +46109,9 @@ updateSelection_fn = function() {
|
|
|
45661
46109
|
const correctedRects = __privateMethod(this, _PresentationEditor_instances, applyDomCorrectionToRects_fn).call(this, rects, domStart, domEnd);
|
|
45662
46110
|
try {
|
|
45663
46111
|
__privateGet(this, _localSelectionLayer).innerHTML = "";
|
|
45664
|
-
|
|
46112
|
+
if (correctedRects.length > 0) {
|
|
46113
|
+
__privateMethod(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this, correctedRects);
|
|
46114
|
+
}
|
|
45665
46115
|
} catch (error) {
|
|
45666
46116
|
if (process$1.env.NODE_ENV === "development") {
|
|
45667
46117
|
console.warn("[PresentationEditor] Failed to render selection rects:", error);
|
|
@@ -46514,6 +46964,19 @@ waitForPageMount_fn = async function(pageIndex, options = {}) {
|
|
|
46514
46964
|
checkPage();
|
|
46515
46965
|
});
|
|
46516
46966
|
};
|
|
46967
|
+
/**
|
|
46968
|
+
* Get effective page gap based on layout mode and virtualization settings.
|
|
46969
|
+
* Keeps painter, layout, and geometry in sync.
|
|
46970
|
+
*/
|
|
46971
|
+
getEffectivePageGap_fn = function() {
|
|
46972
|
+
if (__privateGet(this, _layoutOptions).virtualization?.enabled) {
|
|
46973
|
+
return Math.max(0, __privateGet(this, _layoutOptions).virtualization.gap ?? DEFAULT_VIRTUALIZED_PAGE_GAP);
|
|
46974
|
+
}
|
|
46975
|
+
if (__privateGet(this, _layoutOptions).layoutMode === "horizontal") {
|
|
46976
|
+
return DEFAULT_HORIZONTAL_PAGE_GAP;
|
|
46977
|
+
}
|
|
46978
|
+
return DEFAULT_PAGE_GAP;
|
|
46979
|
+
};
|
|
46517
46980
|
getBodyPageHeight_fn = function() {
|
|
46518
46981
|
return __privateGet(this, _layoutState).layout?.pageSize?.h ?? __privateGet(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
46519
46982
|
};
|
|
@@ -46566,7 +47029,7 @@ applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
|
|
|
46566
47029
|
dy: domStart.y - layoutY
|
|
46567
47030
|
};
|
|
46568
47031
|
}
|
|
46569
|
-
|
|
47032
|
+
const corrected = rects.map((rect, idx) => {
|
|
46570
47033
|
const delta = pageDelta[rect.pageIndex];
|
|
46571
47034
|
let adjustedX = delta ? rect.x + delta.dx : rect.x;
|
|
46572
47035
|
let adjustedY = delta ? rect.y + delta.dy : rect.y;
|
|
@@ -46581,6 +47044,7 @@ applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
|
|
|
46581
47044
|
}
|
|
46582
47045
|
if (isLastRect && domEnd && rect.pageIndex === domEnd.pageIndex) {
|
|
46583
47046
|
const endX = domEnd.x;
|
|
47047
|
+
adjustedX = Math.min(adjustedX, endX);
|
|
46584
47048
|
adjustedWidth = Math.max(1, endX - adjustedX);
|
|
46585
47049
|
}
|
|
46586
47050
|
return {
|
|
@@ -46590,6 +47054,29 @@ applyDomCorrectionToRects_fn = function(rects, domStart, domEnd) {
|
|
|
46590
47054
|
width: adjustedWidth
|
|
46591
47055
|
};
|
|
46592
47056
|
});
|
|
47057
|
+
const MAX_DELTA_PX = 12;
|
|
47058
|
+
let invalid = false;
|
|
47059
|
+
if (domStart && corrected[0]) {
|
|
47060
|
+
const dx = Math.abs(corrected[0].x - domStart.x);
|
|
47061
|
+
const dy = Math.abs(corrected[0].y - domStart.y);
|
|
47062
|
+
if (dx > MAX_DELTA_PX || dy > MAX_DELTA_PX) invalid = true;
|
|
47063
|
+
}
|
|
47064
|
+
if (domEnd && corrected[corrected.length - 1]) {
|
|
47065
|
+
const last = corrected[corrected.length - 1];
|
|
47066
|
+
const dx = Math.abs(last.x + last.width - domEnd.x);
|
|
47067
|
+
const dy = Math.abs(last.y - domEnd.y);
|
|
47068
|
+
if (dx > MAX_DELTA_PX || dy > MAX_DELTA_PX) invalid = true;
|
|
47069
|
+
}
|
|
47070
|
+
if (invalid) {
|
|
47071
|
+
console.warn("[SelectionOverlay] Suppressing selection render due to large DOM/Layout mismatch", {
|
|
47072
|
+
domStart,
|
|
47073
|
+
domEnd,
|
|
47074
|
+
rectStart: corrected[0],
|
|
47075
|
+
rectEnd: corrected[corrected.length - 1]
|
|
47076
|
+
});
|
|
47077
|
+
return [];
|
|
47078
|
+
}
|
|
47079
|
+
return corrected;
|
|
46593
47080
|
};
|
|
46594
47081
|
/**
|
|
46595
47082
|
* Renders visual highlighting for CellSelection (multiple table cells selected).
|
|
@@ -46907,7 +47394,7 @@ computeHeaderFooterSelectionRects_fn = function(from2, to) {
|
|
|
46907
47394
|
return [];
|
|
46908
47395
|
}
|
|
46909
47396
|
if (!bodyLayout) return [];
|
|
46910
|
-
const rects = selectionToRects(context.layout, context.blocks, context.measures, from2, to) ?? [];
|
|
47397
|
+
const rects = selectionToRects(context.layout, context.blocks, context.measures, from2, to, void 0) ?? [];
|
|
46911
47398
|
const headerPageHeight = context.layout.pageSize?.h ?? context.region.height ?? 1;
|
|
46912
47399
|
const bodyPageHeight = __privateMethod(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
46913
47400
|
return rects.map((rect) => {
|
|
@@ -47594,7 +48081,14 @@ getCurrentPageIndex_fn = function() {
|
|
|
47594
48081
|
if (!layout || !selection) {
|
|
47595
48082
|
return 0;
|
|
47596
48083
|
}
|
|
47597
|
-
const rects = selectionToRects(
|
|
48084
|
+
const rects = selectionToRects(
|
|
48085
|
+
layout,
|
|
48086
|
+
__privateGet(this, _layoutState).blocks,
|
|
48087
|
+
__privateGet(this, _layoutState).measures,
|
|
48088
|
+
selection.from,
|
|
48089
|
+
selection.to,
|
|
48090
|
+
__privateGet(this, _pageGeometryHelper) ?? void 0
|
|
48091
|
+
) ?? [];
|
|
47598
48092
|
if (rects.length > 0) {
|
|
47599
48093
|
return rects[0]?.pageIndex ?? 0;
|
|
47600
48094
|
}
|
|
@@ -53159,14 +53653,19 @@ const createCell = (cellType, cellContent = null) => {
|
|
|
53159
53653
|
}
|
|
53160
53654
|
return cellType.createAndFill();
|
|
53161
53655
|
};
|
|
53162
|
-
const createTableBorders = (
|
|
53656
|
+
const createTableBorders = (borderSpec = {}) => {
|
|
53657
|
+
borderSpec = {
|
|
53658
|
+
size: 0.66665,
|
|
53659
|
+
color: "#000000",
|
|
53660
|
+
...borderSpec
|
|
53661
|
+
};
|
|
53163
53662
|
return {
|
|
53164
|
-
top:
|
|
53165
|
-
left:
|
|
53166
|
-
bottom:
|
|
53167
|
-
right:
|
|
53168
|
-
insideH:
|
|
53169
|
-
insideV:
|
|
53663
|
+
top: borderSpec,
|
|
53664
|
+
left: borderSpec,
|
|
53665
|
+
bottom: borderSpec,
|
|
53666
|
+
right: borderSpec,
|
|
53667
|
+
insideH: borderSpec,
|
|
53668
|
+
insideV: borderSpec
|
|
53170
53669
|
};
|
|
53171
53670
|
};
|
|
53172
53671
|
const createTable = (schema, rowsCount, colsCount, withHeaderRow, cellContent = null) => {
|
|
@@ -53294,12 +53793,17 @@ const deleteTableWhenSelected = ({ editor }) => {
|
|
|
53294
53793
|
editor.commands.deleteTable();
|
|
53295
53794
|
return true;
|
|
53296
53795
|
};
|
|
53297
|
-
const createCellBorders = (
|
|
53796
|
+
const createCellBorders = (borderSpec = {}) => {
|
|
53797
|
+
borderSpec = {
|
|
53798
|
+
size: 0.66665,
|
|
53799
|
+
color: "#000000",
|
|
53800
|
+
...borderSpec
|
|
53801
|
+
};
|
|
53298
53802
|
return {
|
|
53299
|
-
top:
|
|
53300
|
-
left:
|
|
53301
|
-
bottom:
|
|
53302
|
-
right:
|
|
53803
|
+
top: borderSpec,
|
|
53804
|
+
left: borderSpec,
|
|
53805
|
+
bottom: borderSpec,
|
|
53806
|
+
right: borderSpec
|
|
53303
53807
|
};
|
|
53304
53808
|
};
|
|
53305
53809
|
function cellAround($pos) {
|
|
@@ -54066,13 +54570,20 @@ const Table = Node$1.create({
|
|
|
54066
54570
|
if (["tableCell", "tableHeader"].includes(node.type.name)) {
|
|
54067
54571
|
tr.setNodeMarkup(pos, void 0, {
|
|
54068
54572
|
...node.attrs,
|
|
54069
|
-
borders: createCellBorders({ size: 0 })
|
|
54573
|
+
borders: createCellBorders({ size: 0, space: 0, val: "none", color: "auto" })
|
|
54070
54574
|
});
|
|
54071
54575
|
}
|
|
54072
54576
|
});
|
|
54073
54577
|
tr.setNodeMarkup(table.pos, void 0, {
|
|
54074
54578
|
...table.node.attrs,
|
|
54075
|
-
borders: createTableBorders({ size: 0 })
|
|
54579
|
+
borders: createTableBorders({ size: 0 }),
|
|
54580
|
+
// TODO: This works around the issue that table borders are duplicated between
|
|
54581
|
+
// the attributes of the table and the tableProperties attribute.
|
|
54582
|
+
// This can be removed when the redundancy is eliminated.
|
|
54583
|
+
tableProperties: {
|
|
54584
|
+
...table.node.attrs.tableProperties,
|
|
54585
|
+
borders: createTableBorders({ size: 0, space: 0, val: "none", color: "auto" })
|
|
54586
|
+
}
|
|
54076
54587
|
});
|
|
54077
54588
|
return true;
|
|
54078
54589
|
}
|