superdoc 1.0.0-beta.38 → 1.0.0-beta.39
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-eK2uz3KN.cjs → PdfViewer-Beeg4BCm.cjs} +1 -1
- package/dist/chunks/{PdfViewer-C3wtcxtt.es.js → PdfViewer-eV3LwCxv.es.js} +1 -1
- package/dist/chunks/{index-HJCFGaOf-Da1SmPju.es.js → index-BqDEyWLQ-B3TrQVjX.es.js} +1 -1
- package/dist/chunks/{index-HJCFGaOf-wo6W4NlF.cjs → index-BqDEyWLQ-CCRXZcrp.cjs} +1 -1
- package/dist/chunks/{index-B6ZAbj8K.cjs → index-DdrGP1Py.cjs} +3 -3
- package/dist/chunks/{index-P989Rtaa.es.js → index-DvGFHOzb.es.js} +3 -3
- package/dist/chunks/{super-editor.es-Dy6E5wRe.es.js → super-editor.es-CQM3jM5n.es.js} +629 -126
- package/dist/chunks/{super-editor.es-BDOdam8J.cjs → super-editor.es-Uiy2hAKb.cjs} +629 -126
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/style.css +12 -12
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-8s6gUqqx.js → converter-nztpWkGr.js} +31 -22
- package/dist/super-editor/chunks/{docx-zipper-B_qYbV4L.js → docx-zipper-DaYim92a.js} +1 -1
- package/dist/super-editor/chunks/{editor-B1ULvXs3.js → editor-H7c-XUpw.js} +538 -66
- package/dist/super-editor/chunks/{index-HJCFGaOf.js → index-BqDEyWLQ.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-h10peB-S.js → toolbar-MtmAPa0Z.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/style.css +12 -12
- package/dist/super-editor/super-editor.es.js +169 -46
- 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 +631 -128
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -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, _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, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, 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, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, 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 resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as encodeCSSFromPPr, at as twipsToPixels$2, au as resolveRunProperties, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, 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 resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as encodeCSSFromPPr, at as twipsToPixels$2, au as resolveRunProperties, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-nztpWkGr.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-DaYim92a.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() {
|
|
@@ -8946,11 +8946,13 @@ const unsetAllMarks = () => ({ tr, dispatch, editor }) => {
|
|
|
8946
8946
|
selection = editor.options.lastSelection;
|
|
8947
8947
|
}
|
|
8948
8948
|
const { empty: empty2, ranges } = selection;
|
|
8949
|
-
if (empty2) return true;
|
|
8950
8949
|
if (dispatch) {
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8950
|
+
if (!empty2) {
|
|
8951
|
+
ranges.forEach((range) => {
|
|
8952
|
+
tr.removeMark(range.$from.pos, range.$to.pos);
|
|
8953
|
+
});
|
|
8954
|
+
}
|
|
8955
|
+
tr.setStoredMarks([]);
|
|
8954
8956
|
}
|
|
8955
8957
|
return true;
|
|
8956
8958
|
};
|
|
@@ -13913,7 +13915,7 @@ const isHeadless = (editor) => {
|
|
|
13913
13915
|
const shouldSkipNodeView = (editor) => {
|
|
13914
13916
|
return isHeadless(editor);
|
|
13915
13917
|
};
|
|
13916
|
-
const summaryVersion = "1.0.0-beta.
|
|
13918
|
+
const summaryVersion = "1.0.0-beta.39";
|
|
13917
13919
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13918
13920
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13919
13921
|
function mapAttributes(attrs) {
|
|
@@ -14705,7 +14707,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14705
14707
|
{ default: remarkStringify },
|
|
14706
14708
|
{ default: remarkGfm }
|
|
14707
14709
|
] = await Promise.all([
|
|
14708
|
-
import("./index-
|
|
14710
|
+
import("./index-BqDEyWLQ.js"),
|
|
14709
14711
|
import("./index-DRCvimau.js"),
|
|
14710
14712
|
import("./index-C_x_N6Uh.js"),
|
|
14711
14713
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14910,7 +14912,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14910
14912
|
* Process collaboration migrations
|
|
14911
14913
|
*/
|
|
14912
14914
|
processCollaborationMigrations() {
|
|
14913
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
14915
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.39");
|
|
14914
14916
|
if (!this.options.ydoc) return;
|
|
14915
14917
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14916
14918
|
let docVersion = metaMap.get("version");
|
|
@@ -17009,7 +17011,7 @@ const applyTextStyleMark = (run, attrs, themeColors) => {
|
|
|
17009
17011
|
const fontSizePx = normalizeFontSizePx(attrs.fontSize);
|
|
17010
17012
|
if (fontSizePx !== void 0 && fontSizePx >= 1 && fontSizePx <= 1e3) {
|
|
17011
17013
|
run.fontSize = fontSizePx;
|
|
17012
|
-
}
|
|
17014
|
+
} else if (attrs.fontSize !== void 0) ;
|
|
17013
17015
|
if (isFiniteNumber(attrs.letterSpacing)) {
|
|
17014
17016
|
const spacing = Number(attrs.letterSpacing);
|
|
17015
17017
|
if (spacing >= -100 && spacing <= 100) {
|
|
@@ -19688,18 +19690,18 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
19688
19690
|
paragraphAttrs.rtl = true;
|
|
19689
19691
|
}
|
|
19690
19692
|
const explicitAlignment = normalizeAlignment(attrs.alignment ?? attrs.textAlign);
|
|
19693
|
+
const paragraphAlignment = typeof paragraphProps.justification === "string" ? normalizeAlignment(paragraphProps.justification) : void 0;
|
|
19691
19694
|
const styleAlignment = hydrated?.alignment ? normalizeAlignment(hydrated.alignment) : void 0;
|
|
19692
|
-
const paragraphAlignment = paragraphProps.justification ? normalizeAlignment(paragraphProps.justification) : void 0;
|
|
19693
19695
|
if (bidi && adjustRightInd) {
|
|
19694
19696
|
paragraphAttrs.alignment = "right";
|
|
19695
19697
|
} else if (explicitAlignment) {
|
|
19696
19698
|
paragraphAttrs.alignment = explicitAlignment;
|
|
19699
|
+
} else if (paragraphAlignment) {
|
|
19700
|
+
paragraphAttrs.alignment = paragraphAlignment;
|
|
19697
19701
|
} else if (bidi) {
|
|
19698
19702
|
paragraphAttrs.alignment = "right";
|
|
19699
19703
|
} else if (styleAlignment) {
|
|
19700
19704
|
paragraphAttrs.alignment = styleAlignment;
|
|
19701
|
-
} else if (paragraphAlignment) {
|
|
19702
|
-
paragraphAttrs.alignment = paragraphAlignment;
|
|
19703
19705
|
} else if (computed2.paragraph.alignment) {
|
|
19704
19706
|
paragraphAttrs.alignment = computed2.paragraph.alignment;
|
|
19705
19707
|
}
|
|
@@ -25419,11 +25421,26 @@ const FIELD_ANNOTATION_STYLES = `
|
|
|
25419
25421
|
z-index: 1000;
|
|
25420
25422
|
}
|
|
25421
25423
|
`;
|
|
25424
|
+
const IMAGE_SELECTION_STYLES = `
|
|
25425
|
+
/* Highlight for selected images (block or inline) */
|
|
25426
|
+
.superdoc-image-selected {
|
|
25427
|
+
outline: 2px solid #4a90e2;
|
|
25428
|
+
outline-offset: 2px;
|
|
25429
|
+
border-radius: 2px;
|
|
25430
|
+
box-shadow: 0 0 0 1px rgba(74, 144, 226, 0.35);
|
|
25431
|
+
}
|
|
25432
|
+
|
|
25433
|
+
/* Ensure inline images can be targeted */
|
|
25434
|
+
.superdoc-inline-image.superdoc-image-selected {
|
|
25435
|
+
outline-offset: 2px;
|
|
25436
|
+
}
|
|
25437
|
+
`;
|
|
25422
25438
|
let printStylesInjected = false;
|
|
25423
25439
|
let linkStylesInjected = false;
|
|
25424
25440
|
let trackChangeStylesInjected = false;
|
|
25425
25441
|
let sdtContainerStylesInjected = false;
|
|
25426
25442
|
let fieldAnnotationStylesInjected = false;
|
|
25443
|
+
let imageSelectionStylesInjected = false;
|
|
25427
25444
|
const ensurePrintStyles = (doc2) => {
|
|
25428
25445
|
if (printStylesInjected || !doc2) return;
|
|
25429
25446
|
const styleEl = doc2.createElement("style");
|
|
@@ -25464,6 +25481,14 @@ const ensureFieldAnnotationStyles = (doc2) => {
|
|
|
25464
25481
|
doc2.head?.appendChild(styleEl);
|
|
25465
25482
|
fieldAnnotationStylesInjected = true;
|
|
25466
25483
|
};
|
|
25484
|
+
const ensureImageSelectionStyles = (doc2) => {
|
|
25485
|
+
if (imageSelectionStylesInjected || !doc2) return;
|
|
25486
|
+
const styleEl = doc2.createElement("style");
|
|
25487
|
+
styleEl.setAttribute("data-superdoc-image-selection-styles", "true");
|
|
25488
|
+
styleEl.textContent = IMAGE_SELECTION_STYLES;
|
|
25489
|
+
doc2.head?.appendChild(styleEl);
|
|
25490
|
+
imageSelectionStylesInjected = true;
|
|
25491
|
+
};
|
|
25467
25492
|
const DOM_CLASS_NAMES = {
|
|
25468
25493
|
/**
|
|
25469
25494
|
* Class name for page container elements.
|
|
@@ -26364,6 +26389,7 @@ const _DomPainter = class _DomPainter {
|
|
|
26364
26389
|
ensureTrackChangeStyles(doc2);
|
|
26365
26390
|
ensureFieldAnnotationStyles(doc2);
|
|
26366
26391
|
ensureSdtContainerStyles(doc2);
|
|
26392
|
+
ensureImageSelectionStyles(doc2);
|
|
26367
26393
|
mount.classList.add(CLASS_NAMES$1.container);
|
|
26368
26394
|
if (this.mount && this.mount !== mount) {
|
|
26369
26395
|
this.resetState();
|
|
@@ -26899,7 +26925,7 @@ const _DomPainter = class _DomPainter {
|
|
|
26899
26925
|
if (fragment.continuesOnNext) {
|
|
26900
26926
|
fragmentEl.dataset.continuesOnNext = "true";
|
|
26901
26927
|
}
|
|
26902
|
-
const lines = measure.lines.slice(fragment.fromLine, fragment.toLine);
|
|
26928
|
+
const lines = fragment.lines ?? measure.lines.slice(fragment.fromLine, fragment.toLine);
|
|
26903
26929
|
applyParagraphBlockStyles(fragmentEl, block.attrs);
|
|
26904
26930
|
if (block.attrs?.styleId) {
|
|
26905
26931
|
fragmentEl.dataset.styleId = block.attrs.styleId;
|
|
@@ -27996,6 +28022,7 @@ const _DomPainter = class _DomPainter {
|
|
|
27996
28022
|
return null;
|
|
27997
28023
|
}
|
|
27998
28024
|
const img = this.doc.createElement("img");
|
|
28025
|
+
img.classList.add("superdoc-inline-image");
|
|
27999
28026
|
const isDataUrl = typeof run.src === "string" && run.src.startsWith("data:");
|
|
28000
28027
|
if (isDataUrl) {
|
|
28001
28028
|
if (run.src.length > MAX_DATA_URL_LENGTH) {
|
|
@@ -30533,6 +30560,23 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
30533
30560
|
}
|
|
30534
30561
|
}
|
|
30535
30562
|
let lines = normalizeLines(measure);
|
|
30563
|
+
const measurementWidth = lines[0]?.maxWidth;
|
|
30564
|
+
let didRemeasureForColumnWidth = false;
|
|
30565
|
+
if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > columnWidth) {
|
|
30566
|
+
let firstLineIndent = 0;
|
|
30567
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
30568
|
+
if (wordLayout?.marker && measure.marker) {
|
|
30569
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
30570
|
+
if (markerJustification === "left") {
|
|
30571
|
+
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
30572
|
+
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
30573
|
+
firstLineIndent = markerWidth + gutterWidth;
|
|
30574
|
+
}
|
|
30575
|
+
}
|
|
30576
|
+
const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
|
|
30577
|
+
lines = normalizeLines(newMeasure);
|
|
30578
|
+
didRemeasureForColumnWidth = true;
|
|
30579
|
+
}
|
|
30536
30580
|
let fromLine = 0;
|
|
30537
30581
|
const spacing = block.attrs?.spacing ?? {};
|
|
30538
30582
|
const styleId = block.attrs?.styleId;
|
|
@@ -30608,7 +30652,17 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
30608
30652
|
tempY += lineHeight;
|
|
30609
30653
|
}
|
|
30610
30654
|
if (narrowestWidth < columnWidth) {
|
|
30611
|
-
|
|
30655
|
+
let firstLineIndent = 0;
|
|
30656
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
30657
|
+
if (wordLayout?.marker && measure.marker) {
|
|
30658
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
30659
|
+
if (markerJustification === "left") {
|
|
30660
|
+
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
30661
|
+
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
30662
|
+
firstLineIndent = markerWidth + gutterWidth;
|
|
30663
|
+
}
|
|
30664
|
+
}
|
|
30665
|
+
const newMeasure = remeasureParagraph2(block, narrowestWidth, firstLineIndent);
|
|
30612
30666
|
lines = normalizeLines(newMeasure);
|
|
30613
30667
|
didRemeasureForFloats = true;
|
|
30614
30668
|
}
|
|
@@ -30673,6 +30727,9 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
30673
30727
|
width: effectiveColumnWidth,
|
|
30674
30728
|
...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
|
|
30675
30729
|
};
|
|
30730
|
+
if (didRemeasureForColumnWidth) {
|
|
30731
|
+
fragment.lines = lines.slice(fromLine, slice2.toLine);
|
|
30732
|
+
}
|
|
30676
30733
|
if (measure.marker && fromLine === 0) {
|
|
30677
30734
|
fragment.markerWidth = measure.marker.markerWidth;
|
|
30678
30735
|
if (measure.marker.markerTextWidth != null) {
|
|
@@ -33401,12 +33458,14 @@ function lineHeightForRuns(runs, fromRun, toRun) {
|
|
|
33401
33458
|
}
|
|
33402
33459
|
return maxSize2 * 1.2;
|
|
33403
33460
|
}
|
|
33404
|
-
function remeasureParagraph(block, maxWidth) {
|
|
33461
|
+
function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
33405
33462
|
const runs = block.runs ?? [];
|
|
33406
33463
|
const lines = [];
|
|
33407
33464
|
let currentRun = 0;
|
|
33408
33465
|
let currentChar = 0;
|
|
33409
33466
|
while (currentRun < runs.length) {
|
|
33467
|
+
const isFirstLine = lines.length === 0;
|
|
33468
|
+
const effectiveMaxWidth = isFirstLine ? maxWidth - firstLineIndent : maxWidth;
|
|
33410
33469
|
const startRun = currentRun;
|
|
33411
33470
|
const startChar = currentChar;
|
|
33412
33471
|
let width = 0;
|
|
@@ -33420,7 +33479,7 @@ function remeasureParagraph(block, maxWidth) {
|
|
|
33420
33479
|
const start2 = r2 === currentRun ? currentChar : 0;
|
|
33421
33480
|
for (let c = start2; c < text.length; c += 1) {
|
|
33422
33481
|
const w = measureRunSliceWidth(run, c, c + 1);
|
|
33423
|
-
if (width + w >
|
|
33482
|
+
if (width + w > effectiveMaxWidth && width > 0) {
|
|
33424
33483
|
if (lastBreakRun >= 0) {
|
|
33425
33484
|
endRun = lastBreakRun;
|
|
33426
33485
|
endChar = lastBreakChar;
|
|
@@ -33919,7 +33978,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
33919
33978
|
...options,
|
|
33920
33979
|
headerContentHeights,
|
|
33921
33980
|
// Pass header heights to prevent overlap
|
|
33922
|
-
remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
|
|
33981
|
+
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
33923
33982
|
});
|
|
33924
33983
|
const layoutEnd = performance.now();
|
|
33925
33984
|
perfLog(`[Perf] 4.2 Layout document (pagination): ${(layoutEnd - layoutStart).toFixed(2)}ms`);
|
|
@@ -33967,7 +34026,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
33967
34026
|
...options,
|
|
33968
34027
|
headerContentHeights,
|
|
33969
34028
|
// Pass header heights to prevent overlap
|
|
33970
|
-
remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
|
|
34029
|
+
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
33971
34030
|
});
|
|
33972
34031
|
const relayoutEnd = performance.now();
|
|
33973
34032
|
const relayoutTime = relayoutEnd - relayoutStart;
|
|
@@ -34798,6 +34857,31 @@ function findBlockIndexByFragmentId(blocks, fragmentBlockId, targetPmRange) {
|
|
|
34798
34857
|
}
|
|
34799
34858
|
return matchingIndices[0];
|
|
34800
34859
|
}
|
|
34860
|
+
const DEFAULT_CELL_PADDING = { top: 2, bottom: 2, left: 4, right: 4 };
|
|
34861
|
+
const getCellPaddingFromRow = (cellIdx, row) => {
|
|
34862
|
+
const padding = row?.cells?.[cellIdx]?.attrs?.padding ?? {};
|
|
34863
|
+
return {
|
|
34864
|
+
top: padding.top ?? DEFAULT_CELL_PADDING.top,
|
|
34865
|
+
bottom: padding.bottom ?? DEFAULT_CELL_PADDING.bottom,
|
|
34866
|
+
left: padding.left ?? DEFAULT_CELL_PADDING.left,
|
|
34867
|
+
right: padding.right ?? DEFAULT_CELL_PADDING.right
|
|
34868
|
+
};
|
|
34869
|
+
};
|
|
34870
|
+
const getCellBlocks = (cell) => {
|
|
34871
|
+
if (!cell) return [];
|
|
34872
|
+
return cell.blocks ?? (cell.paragraph ? [cell.paragraph] : []);
|
|
34873
|
+
};
|
|
34874
|
+
const getCellMeasures = (cell) => {
|
|
34875
|
+
if (!cell) return [];
|
|
34876
|
+
return cell.blocks ?? (cell.paragraph ? [cell.paragraph] : []);
|
|
34877
|
+
};
|
|
34878
|
+
const sumLineHeights = (measure, fromLine, toLine) => {
|
|
34879
|
+
let height = 0;
|
|
34880
|
+
for (let i = fromLine; i < toLine && i < measure.lines.length; i += 1) {
|
|
34881
|
+
height += measure.lines[i]?.lineHeight ?? 0;
|
|
34882
|
+
}
|
|
34883
|
+
return height;
|
|
34884
|
+
};
|
|
34801
34885
|
function selectionToRects(layout, blocks, measures, from2, to) {
|
|
34802
34886
|
if (from2 === to) {
|
|
34803
34887
|
return [];
|
|
@@ -34844,6 +34928,136 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
34844
34928
|
});
|
|
34845
34929
|
return;
|
|
34846
34930
|
}
|
|
34931
|
+
if (fragment.kind === "table") {
|
|
34932
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
34933
|
+
if (blockIndex === -1) return;
|
|
34934
|
+
const block = blocks[blockIndex];
|
|
34935
|
+
const measure = measures[blockIndex];
|
|
34936
|
+
if (!block || block.kind !== "table" || measure?.kind !== "table") {
|
|
34937
|
+
return;
|
|
34938
|
+
}
|
|
34939
|
+
const tableBlock = block;
|
|
34940
|
+
const tableMeasure = measure;
|
|
34941
|
+
const tableFragment = fragment;
|
|
34942
|
+
const rowHeights = tableMeasure.rows.map((rowMeasure, idx) => {
|
|
34943
|
+
if (tableFragment.partialRow && tableFragment.partialRow.rowIndex === idx) {
|
|
34944
|
+
return tableFragment.partialRow.partialHeight;
|
|
34945
|
+
}
|
|
34946
|
+
return rowMeasure?.height ?? 0;
|
|
34947
|
+
});
|
|
34948
|
+
const calculateCellX = (cellIdx, cellMeasure) => {
|
|
34949
|
+
const gridStart = cellMeasure.gridColumnStart ?? cellIdx;
|
|
34950
|
+
let x = 0;
|
|
34951
|
+
for (let i = 0; i < gridStart && i < tableMeasure.columnWidths.length; i += 1) {
|
|
34952
|
+
x += tableMeasure.columnWidths[i];
|
|
34953
|
+
}
|
|
34954
|
+
return x;
|
|
34955
|
+
};
|
|
34956
|
+
const processRow = (rowIndex, rowOffset) => {
|
|
34957
|
+
const rowMeasure = tableMeasure.rows[rowIndex];
|
|
34958
|
+
const row = tableBlock.rows[rowIndex];
|
|
34959
|
+
if (!rowMeasure || !row) return rowOffset;
|
|
34960
|
+
const rowHeight = rowHeights[rowIndex] ?? rowMeasure.height;
|
|
34961
|
+
const isPartialRow = tableFragment.partialRow?.rowIndex === rowIndex;
|
|
34962
|
+
const partialRowData = isPartialRow ? tableFragment.partialRow : null;
|
|
34963
|
+
const totalColumns = Math.min(rowMeasure.cells.length, row.cells.length);
|
|
34964
|
+
for (let cellIdx = 0; cellIdx < totalColumns; cellIdx += 1) {
|
|
34965
|
+
const cellMeasure = rowMeasure.cells[cellIdx];
|
|
34966
|
+
const cell = row.cells[cellIdx];
|
|
34967
|
+
if (!cellMeasure || !cell) continue;
|
|
34968
|
+
const padding = getCellPaddingFromRow(cellIdx, row);
|
|
34969
|
+
const cellX = calculateCellX(cellIdx, cellMeasure);
|
|
34970
|
+
const cellBlocks = getCellBlocks(cell);
|
|
34971
|
+
const cellBlockMeasures = getCellMeasures(cellMeasure);
|
|
34972
|
+
const renderedBlocks = [];
|
|
34973
|
+
let cumulativeLine = 0;
|
|
34974
|
+
for (let i = 0; i < Math.min(cellBlocks.length, cellBlockMeasures.length); i += 1) {
|
|
34975
|
+
const paraBlock = cellBlocks[i];
|
|
34976
|
+
const paraMeasure = cellBlockMeasures[i];
|
|
34977
|
+
if (!paraBlock || !paraMeasure || paraBlock.kind !== "paragraph" || paraMeasure.kind !== "paragraph") {
|
|
34978
|
+
continue;
|
|
34979
|
+
}
|
|
34980
|
+
const lineCount = paraMeasure.lines.length;
|
|
34981
|
+
const blockStart = cumulativeLine;
|
|
34982
|
+
const blockEnd = cumulativeLine + lineCount;
|
|
34983
|
+
cumulativeLine = blockEnd;
|
|
34984
|
+
const allowedStart = partialRowData?.fromLineByCell?.[cellIdx] ?? 0;
|
|
34985
|
+
const rawAllowedEnd = partialRowData?.toLineByCell?.[cellIdx];
|
|
34986
|
+
const allowedEnd = rawAllowedEnd == null || rawAllowedEnd === -1 ? cumulativeLine : rawAllowedEnd;
|
|
34987
|
+
const renderStartGlobal = Math.max(blockStart, allowedStart);
|
|
34988
|
+
const renderEndGlobal = Math.min(blockEnd, allowedEnd);
|
|
34989
|
+
if (renderStartGlobal >= renderEndGlobal) continue;
|
|
34990
|
+
const startLine = renderStartGlobal - blockStart;
|
|
34991
|
+
const endLine = renderEndGlobal - blockStart;
|
|
34992
|
+
let height = sumLineHeights(paraMeasure, startLine, endLine);
|
|
34993
|
+
const rendersWholeBlock = startLine === 0 && endLine >= lineCount;
|
|
34994
|
+
if (rendersWholeBlock) {
|
|
34995
|
+
const totalHeight = paraMeasure.totalHeight;
|
|
34996
|
+
if (typeof totalHeight === "number" && totalHeight > height) {
|
|
34997
|
+
height = totalHeight;
|
|
34998
|
+
}
|
|
34999
|
+
const spacingAfter = paraBlock.attrs?.spacing?.after;
|
|
35000
|
+
if (typeof spacingAfter === "number" && spacingAfter > 0) {
|
|
35001
|
+
height += spacingAfter;
|
|
35002
|
+
}
|
|
35003
|
+
}
|
|
35004
|
+
renderedBlocks.push({ block: paraBlock, measure: paraMeasure, startLine, endLine, height });
|
|
35005
|
+
}
|
|
35006
|
+
const contentHeight = renderedBlocks.reduce((acc, info) => acc + info.height, 0);
|
|
35007
|
+
const contentAreaHeight = Math.max(0, rowHeight - (padding.top + padding.bottom));
|
|
35008
|
+
const freeSpace = Math.max(0, contentAreaHeight - contentHeight);
|
|
35009
|
+
let verticalOffset = 0;
|
|
35010
|
+
const vAlign = cell.attrs?.verticalAlign;
|
|
35011
|
+
if (vAlign === "center" || vAlign === "middle") {
|
|
35012
|
+
verticalOffset = freeSpace / 2;
|
|
35013
|
+
} else if (vAlign === "bottom") {
|
|
35014
|
+
verticalOffset = freeSpace;
|
|
35015
|
+
}
|
|
35016
|
+
let blockTopCursor = padding.top + verticalOffset;
|
|
35017
|
+
renderedBlocks.forEach((info) => {
|
|
35018
|
+
const paragraphMarkerWidth = info.measure.marker?.markerWidth ?? 0;
|
|
35019
|
+
const intersectingLines = findLinesIntersectingRange(info.block, info.measure, from2, to);
|
|
35020
|
+
intersectingLines.forEach(({ line, index: index2 }) => {
|
|
35021
|
+
if (index2 < info.startLine || index2 >= info.endLine) {
|
|
35022
|
+
return;
|
|
35023
|
+
}
|
|
35024
|
+
const range = computeLinePmRange(info.block, line);
|
|
35025
|
+
if (range.pmStart == null || range.pmEnd == null) return;
|
|
35026
|
+
const sliceFrom = Math.max(range.pmStart, from2);
|
|
35027
|
+
const sliceTo = Math.min(range.pmEnd, to);
|
|
35028
|
+
if (sliceFrom >= sliceTo) return;
|
|
35029
|
+
const charOffsetFrom = pmPosToCharOffset(info.block, line, sliceFrom);
|
|
35030
|
+
const charOffsetTo = pmPosToCharOffset(info.block, line, sliceTo);
|
|
35031
|
+
const availableWidth = Math.max(1, cellMeasure.width - padding.left - padding.right);
|
|
35032
|
+
const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth);
|
|
35033
|
+
const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth);
|
|
35034
|
+
const rectX = fragment.x + cellX + padding.left + paragraphMarkerWidth + Math.min(startX, endX);
|
|
35035
|
+
const rectWidth = Math.max(1, Math.abs(endX - startX));
|
|
35036
|
+
const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
|
|
35037
|
+
const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
|
|
35038
|
+
rects.push({
|
|
35039
|
+
x: rectX,
|
|
35040
|
+
y: rectY + pageIndex * layout.pageSize.h,
|
|
35041
|
+
width: rectWidth,
|
|
35042
|
+
height: line.lineHeight,
|
|
35043
|
+
pageIndex
|
|
35044
|
+
});
|
|
35045
|
+
});
|
|
35046
|
+
blockTopCursor += info.height;
|
|
35047
|
+
});
|
|
35048
|
+
}
|
|
35049
|
+
return rowOffset + rowHeight;
|
|
35050
|
+
};
|
|
35051
|
+
let rowCursor = 0;
|
|
35052
|
+
const repeatHeaderCount = tableFragment.repeatHeaderCount ?? 0;
|
|
35053
|
+
for (let r2 = 0; r2 < repeatHeaderCount && r2 < tableMeasure.rows.length; r2 += 1) {
|
|
35054
|
+
rowCursor = processRow(r2, rowCursor);
|
|
35055
|
+
}
|
|
35056
|
+
for (let r2 = tableFragment.fromRow; r2 < tableFragment.toRow && r2 < tableMeasure.rows.length; r2 += 1) {
|
|
35057
|
+
rowCursor = processRow(r2, rowCursor);
|
|
35058
|
+
}
|
|
35059
|
+
return;
|
|
35060
|
+
}
|
|
34847
35061
|
if (isAtomicFragment(fragment)) {
|
|
34848
35062
|
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
34849
35063
|
if (blockIndex === -1) return;
|
|
@@ -35370,7 +35584,16 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
35370
35584
|
const rawFirstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
|
|
35371
35585
|
const firstLineOffset = isWordLayoutList ? 0 : rawFirstLineOffset;
|
|
35372
35586
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
35373
|
-
|
|
35587
|
+
let leftJustifiedMarkerSpace = 0;
|
|
35588
|
+
if (wordLayout?.marker) {
|
|
35589
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
35590
|
+
if (markerJustification === "left") {
|
|
35591
|
+
const markerBoxWidth = wordLayout.marker.markerBoxWidthPx ?? 0;
|
|
35592
|
+
const gutterWidth = wordLayout.marker.gutterWidthPx ?? LIST_MARKER_GAP;
|
|
35593
|
+
leftJustifiedMarkerSpace = markerBoxWidth + gutterWidth;
|
|
35594
|
+
}
|
|
35595
|
+
}
|
|
35596
|
+
const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
|
|
35374
35597
|
const tabStops = buildTabStopsPx(
|
|
35375
35598
|
indent,
|
|
35376
35599
|
block.attrs?.tabs,
|
|
@@ -37968,12 +38191,30 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
37968
38191
|
if (linkEl) {
|
|
37969
38192
|
const href = linkEl.getAttribute("href") ?? "";
|
|
37970
38193
|
const isAnchorLink = href.startsWith("#") && href.length > 1;
|
|
37971
|
-
|
|
38194
|
+
const isTocLink = linkEl.closest(".superdoc-toc-entry") !== null;
|
|
38195
|
+
if (isAnchorLink && isTocLink) {
|
|
37972
38196
|
event.preventDefault();
|
|
37973
38197
|
event.stopPropagation();
|
|
37974
38198
|
this.goToAnchor(href);
|
|
37975
38199
|
return;
|
|
37976
38200
|
}
|
|
38201
|
+
event.preventDefault();
|
|
38202
|
+
event.stopPropagation();
|
|
38203
|
+
const linkClickEvent = new CustomEvent("superdoc-link-click", {
|
|
38204
|
+
bubbles: true,
|
|
38205
|
+
composed: true,
|
|
38206
|
+
detail: {
|
|
38207
|
+
href,
|
|
38208
|
+
target: linkEl.getAttribute("target"),
|
|
38209
|
+
rel: linkEl.getAttribute("rel"),
|
|
38210
|
+
tooltip: linkEl.getAttribute("title"),
|
|
38211
|
+
element: linkEl,
|
|
38212
|
+
clientX: event.clientX,
|
|
38213
|
+
clientY: event.clientY
|
|
38214
|
+
}
|
|
38215
|
+
});
|
|
38216
|
+
linkEl.dispatchEvent(linkClickEvent);
|
|
38217
|
+
return;
|
|
37977
38218
|
}
|
|
37978
38219
|
const isDraggableAnnotation = target?.closest?.('[data-draggable="true"]') != null;
|
|
37979
38220
|
if (!__privateGet(this, _layoutState).layout) {
|
|
@@ -38071,6 +38312,44 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
38071
38312
|
__privateGet(this, _layoutState).measures,
|
|
38072
38313
|
hit.pos
|
|
38073
38314
|
);
|
|
38315
|
+
const targetImg = event.target?.closest?.("img");
|
|
38316
|
+
const imgPmStart = targetImg?.dataset?.pmStart ? Number(targetImg.dataset.pmStart) : null;
|
|
38317
|
+
if (!Number.isNaN(imgPmStart) && imgPmStart != null) {
|
|
38318
|
+
const doc22 = __privateGet(this, _editor3).state.doc;
|
|
38319
|
+
if (imgPmStart < 0 || imgPmStart >= doc22.content.size) {
|
|
38320
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
38321
|
+
console.warn(
|
|
38322
|
+
`[PresentationEditor] Invalid position ${imgPmStart} for inline image (document size: ${doc22.content.size})`
|
|
38323
|
+
);
|
|
38324
|
+
}
|
|
38325
|
+
return;
|
|
38326
|
+
}
|
|
38327
|
+
const newSelectionId = `inline-${imgPmStart}`;
|
|
38328
|
+
if (__privateGet(this, _lastSelectedImageBlockId) && __privateGet(this, _lastSelectedImageBlockId) !== newSelectionId) {
|
|
38329
|
+
this.emit("imageDeselected", { blockId: __privateGet(this, _lastSelectedImageBlockId) });
|
|
38330
|
+
}
|
|
38331
|
+
try {
|
|
38332
|
+
const tr = __privateGet(this, _editor3).state.tr.setSelection(NodeSelection.create(doc22, imgPmStart));
|
|
38333
|
+
__privateGet(this, _editor3).view?.dispatch(tr);
|
|
38334
|
+
const selector = `.superdoc-inline-image[data-pm-start="${imgPmStart}"]`;
|
|
38335
|
+
const targetElement = __privateGet(this, _viewportHost).querySelector(selector);
|
|
38336
|
+
this.emit("imageSelected", {
|
|
38337
|
+
element: targetElement ?? targetImg,
|
|
38338
|
+
blockId: null,
|
|
38339
|
+
pmStart: imgPmStart
|
|
38340
|
+
});
|
|
38341
|
+
__privateSet(this, _lastSelectedImageBlockId, newSelectionId);
|
|
38342
|
+
} catch (error) {
|
|
38343
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
38344
|
+
console.warn(
|
|
38345
|
+
`[PresentationEditor] Failed to create NodeSelection for inline image at position ${imgPmStart}:`,
|
|
38346
|
+
error
|
|
38347
|
+
);
|
|
38348
|
+
}
|
|
38349
|
+
}
|
|
38350
|
+
__privateMethod(this, _PresentationEditor_instances, focusEditorAfterImageSelection_fn).call(this);
|
|
38351
|
+
return;
|
|
38352
|
+
}
|
|
38074
38353
|
if (fragmentHit && (fragmentHit.fragment.kind === "image" || fragmentHit.fragment.kind === "drawing")) {
|
|
38075
38354
|
const doc22 = __privateGet(this, _editor3).state.doc;
|
|
38076
38355
|
try {
|
|
@@ -38097,15 +38376,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
38097
38376
|
console.warn("[PresentationEditor] Failed to create NodeSelection for atomic fragment:", error);
|
|
38098
38377
|
}
|
|
38099
38378
|
}
|
|
38100
|
-
__privateMethod(this, _PresentationEditor_instances,
|
|
38101
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
38102
|
-
document.activeElement.blur();
|
|
38103
|
-
}
|
|
38104
|
-
const editorDom2 = __privateGet(this, _editor3).view?.dom;
|
|
38105
|
-
if (editorDom2) {
|
|
38106
|
-
editorDom2.focus();
|
|
38107
|
-
__privateGet(this, _editor3).view?.focus();
|
|
38108
|
-
}
|
|
38379
|
+
__privateMethod(this, _PresentationEditor_instances, focusEditorAfterImageSelection_fn).call(this);
|
|
38109
38380
|
return;
|
|
38110
38381
|
}
|
|
38111
38382
|
if (__privateGet(this, _lastSelectedImageBlockId)) {
|
|
@@ -38721,6 +38992,47 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
38721
38992
|
get overlayElement() {
|
|
38722
38993
|
return __privateGet(this, _selectionOverlay2) ?? null;
|
|
38723
38994
|
}
|
|
38995
|
+
/**
|
|
38996
|
+
* Get the current zoom level.
|
|
38997
|
+
*
|
|
38998
|
+
* The zoom level is a multiplier that controls the visual scale of the document.
|
|
38999
|
+
* This value is applied via CSS transform: scale() on the #viewportHost element,
|
|
39000
|
+
* which ensures consistent scaling between rendered content and overlay elements
|
|
39001
|
+
* (selections, cursors, interactive handles).
|
|
39002
|
+
*
|
|
39003
|
+
* Relationship to Centralized Zoom Architecture:
|
|
39004
|
+
* - PresentationEditor is the SINGLE SOURCE OF TRUTH for zoom state
|
|
39005
|
+
* - Zoom is applied internally via transform: scale() on #viewportHost
|
|
39006
|
+
* - External components (toolbar, UI controls) should use setZoom() to modify zoom
|
|
39007
|
+
* - The zoom value is used throughout the system for coordinate transformations
|
|
39008
|
+
*
|
|
39009
|
+
* Coordinate Space Implications:
|
|
39010
|
+
* - Layout coordinates: Unscaled logical pixels used by the layout engine
|
|
39011
|
+
* - Screen coordinates: Physical pixels affected by CSS transform: scale()
|
|
39012
|
+
* - Conversion: screenCoord = layoutCoord * zoom
|
|
39013
|
+
*
|
|
39014
|
+
* Zoom Scale:
|
|
39015
|
+
* - 1 = 100% (default, no scaling)
|
|
39016
|
+
* - 0.5 = 50% (zoomed out, content appears smaller)
|
|
39017
|
+
* - 2 = 200% (zoomed in, content appears larger)
|
|
39018
|
+
*
|
|
39019
|
+
* @returns The current zoom level multiplier (default: 1 if not configured)
|
|
39020
|
+
*
|
|
39021
|
+
* @example
|
|
39022
|
+
* ```typescript
|
|
39023
|
+
* const zoom = presentation.zoom;
|
|
39024
|
+
* // Convert layout coordinates to screen coordinates
|
|
39025
|
+
* const screenX = layoutX * zoom;
|
|
39026
|
+
* const screenY = layoutY * zoom;
|
|
39027
|
+
*
|
|
39028
|
+
* // Convert screen coordinates back to layout coordinates
|
|
39029
|
+
* const layoutX = screenX / zoom;
|
|
39030
|
+
* const layoutY = screenY / zoom;
|
|
39031
|
+
* ```
|
|
39032
|
+
*/
|
|
39033
|
+
get zoom() {
|
|
39034
|
+
return __privateGet(this, _layoutOptions).zoom ?? 1;
|
|
39035
|
+
}
|
|
38724
39036
|
/**
|
|
38725
39037
|
* Set the document mode and update editor editability.
|
|
38726
39038
|
*
|
|
@@ -38911,8 +39223,8 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
38911
39223
|
const pageLocalY = rect.y - rect.pageIndex * pageHeight;
|
|
38912
39224
|
const coords = __privateMethod(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
|
|
38913
39225
|
if (!coords) return null;
|
|
38914
|
-
const absLeft = coords.x + overlayRect.left;
|
|
38915
|
-
const absTop = coords.y + overlayRect.top;
|
|
39226
|
+
const absLeft = coords.x * zoom + overlayRect.left;
|
|
39227
|
+
const absTop = coords.y * zoom + overlayRect.top;
|
|
38916
39228
|
const left2 = relativeRect ? absLeft - relativeRect.left : absLeft;
|
|
38917
39229
|
const top2 = relativeRect ? absTop - relativeRect.top : absTop;
|
|
38918
39230
|
const width = Math.max(1, rect.width * zoom);
|
|
@@ -39960,7 +40272,7 @@ renderRemoteCursors_fn = function() {
|
|
|
39960
40272
|
*/
|
|
39961
40273
|
renderRemoteCaret_fn = function(cursor) {
|
|
39962
40274
|
const caretLayout = __privateMethod(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, cursor.head);
|
|
39963
|
-
|
|
40275
|
+
__privateGet(this, _layoutOptions).zoom ?? 1;
|
|
39964
40276
|
const doc2 = __privateGet(this, _visibleHost).ownerDocument ?? document;
|
|
39965
40277
|
const color = __privateMethod(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
39966
40278
|
let caretEl = __privateGet(this, _remoteCursorElements).get(cursor.clientId);
|
|
@@ -39993,7 +40305,7 @@ renderRemoteCaret_fn = function(cursor) {
|
|
|
39993
40305
|
}
|
|
39994
40306
|
caretEl.style.opacity = "1";
|
|
39995
40307
|
caretEl.style.transform = `translate(${coords.x}px, ${coords.y}px)`;
|
|
39996
|
-
caretEl.style.height = `${Math.max(1, caretLayout.height
|
|
40308
|
+
caretEl.style.height = `${Math.max(1, caretLayout.height)}px`;
|
|
39997
40309
|
caretEl.style.borderLeftColor = color;
|
|
39998
40310
|
const labelEl = caretEl.querySelector(".presentation-editor__remote-label");
|
|
39999
40311
|
if (labelEl) {
|
|
@@ -40075,7 +40387,6 @@ renderRemoteSelection_fn = function(cursor) {
|
|
|
40075
40387
|
const end2 = Math.max(cursor.anchor, cursor.head);
|
|
40076
40388
|
const rects = selectionToRects(layout, blocks, measures, start2, end2) ?? [];
|
|
40077
40389
|
const color = __privateMethod(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
40078
|
-
const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
|
|
40079
40390
|
const opacity = __privateGet(this, _layoutOptions).presence?.highlightOpacity ?? 0.35;
|
|
40080
40391
|
const pageHeight = layout.pageSize?.h ?? __privateGet(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
40081
40392
|
const doc2 = __privateGet(this, _visibleHost).ownerDocument ?? document;
|
|
@@ -40089,8 +40400,8 @@ renderRemoteSelection_fn = function(cursor) {
|
|
|
40089
40400
|
selectionEl.style.position = "absolute";
|
|
40090
40401
|
selectionEl.style.left = `${coords.x}px`;
|
|
40091
40402
|
selectionEl.style.top = `${coords.y}px`;
|
|
40092
|
-
selectionEl.style.width = `${Math.max(1, rect.width
|
|
40093
|
-
selectionEl.style.height = `${Math.max(1, rect.height
|
|
40403
|
+
selectionEl.style.width = `${Math.max(1, rect.width)}px`;
|
|
40404
|
+
selectionEl.style.height = `${Math.max(1, rect.height)}px`;
|
|
40094
40405
|
selectionEl.style.backgroundColor = color;
|
|
40095
40406
|
selectionEl.style.opacity = opacity.toString();
|
|
40096
40407
|
selectionEl.style.borderRadius = _PresentationEditor.CURSOR_STYLES.SELECTION_BORDER_RADIUS;
|
|
@@ -40205,6 +40516,24 @@ setupDragHandlers_fn = function() {
|
|
|
40205
40516
|
}
|
|
40206
40517
|
}));
|
|
40207
40518
|
};
|
|
40519
|
+
/**
|
|
40520
|
+
* Focus the editor after image selection and schedule selection update.
|
|
40521
|
+
* This method encapsulates the common focus and blur logic used when
|
|
40522
|
+
* selecting both inline and block images.
|
|
40523
|
+
* @private
|
|
40524
|
+
* @returns {void}
|
|
40525
|
+
*/
|
|
40526
|
+
focusEditorAfterImageSelection_fn = function() {
|
|
40527
|
+
__privateMethod(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
40528
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
40529
|
+
document.activeElement.blur();
|
|
40530
|
+
}
|
|
40531
|
+
const editorDom = __privateGet(this, _editor3).view?.dom;
|
|
40532
|
+
if (editorDom) {
|
|
40533
|
+
editorDom.focus();
|
|
40534
|
+
__privateGet(this, _editor3).view?.focus();
|
|
40535
|
+
}
|
|
40536
|
+
};
|
|
40208
40537
|
setupInputBridge_fn = function() {
|
|
40209
40538
|
__privateGet(this, _inputBridge)?.destroy();
|
|
40210
40539
|
const win = __privateGet(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
@@ -40705,10 +41034,39 @@ ensurePainter_fn = function(blocks, measures) {
|
|
|
40705
41034
|
}
|
|
40706
41035
|
return __privateGet(this, _domPainter);
|
|
40707
41036
|
};
|
|
41037
|
+
/**
|
|
41038
|
+
* Schedules a cursor/selection update in the next animation frame.
|
|
41039
|
+
*
|
|
41040
|
+
* Implements guards to prevent race conditions during layout recalculation:
|
|
41041
|
+
* - Skips scheduling if already scheduled (prevents duplicate updates)
|
|
41042
|
+
* - Skips if layout is being recalculated (#isRerendering || #pendingDocChange)
|
|
41043
|
+
* to avoid rendering cursor before layout is ready
|
|
41044
|
+
*
|
|
41045
|
+
* The cursor will be updated at the end of #rerender() after layout completes.
|
|
41046
|
+
*
|
|
41047
|
+
* @returns {void}
|
|
41048
|
+
*
|
|
41049
|
+
* @remarks
|
|
41050
|
+
* Edge cases handled:
|
|
41051
|
+
* - Race condition guard: #isRerendering and #pendingDocChange flags prevent
|
|
41052
|
+
* scheduling cursor updates while layout is recalculating, avoiding stale position data.
|
|
41053
|
+
* - Deduplication: #selectionUpdateScheduled flag prevents multiple redundant RAF callbacks
|
|
41054
|
+
* from being queued when selection changes rapidly.
|
|
41055
|
+
*
|
|
41056
|
+
* Side effects:
|
|
41057
|
+
* - Sets #selectionUpdateScheduled flag to true
|
|
41058
|
+
* - Schedules a requestAnimationFrame callback that calls #updateSelection()
|
|
41059
|
+
* - The RAF callback automatically resets #selectionUpdateScheduled to false
|
|
41060
|
+
*
|
|
41061
|
+
* @private
|
|
41062
|
+
*/
|
|
40708
41063
|
scheduleSelectionUpdate_fn = function() {
|
|
40709
41064
|
if (__privateGet(this, _selectionUpdateScheduled)) {
|
|
40710
41065
|
return;
|
|
40711
41066
|
}
|
|
41067
|
+
if (__privateGet(this, _isRerendering) || __privateGet(this, _pendingDocChange)) {
|
|
41068
|
+
return;
|
|
41069
|
+
}
|
|
40712
41070
|
__privateSet(this, _selectionUpdateScheduled, true);
|
|
40713
41071
|
const win = __privateGet(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
40714
41072
|
win.requestAnimationFrame(() => {
|
|
@@ -40716,6 +41074,47 @@ scheduleSelectionUpdate_fn = function() {
|
|
|
40716
41074
|
__privateMethod(this, _PresentationEditor_instances, updateSelection_fn).call(this);
|
|
40717
41075
|
});
|
|
40718
41076
|
};
|
|
41077
|
+
/**
|
|
41078
|
+
* Updates the visual cursor/selection overlay to match the current editor selection.
|
|
41079
|
+
*
|
|
41080
|
+
* Handles several edge cases:
|
|
41081
|
+
* - Defers cursor clearing until new position is successfully computed
|
|
41082
|
+
* - Falls back to adjacent positions (from-1, from+1) when exact position lookup fails
|
|
41083
|
+
* - Preserves existing cursor visibility when position cannot be computed
|
|
41084
|
+
* - Skips rendering in header/footer mode and viewing mode
|
|
41085
|
+
*
|
|
41086
|
+
* This method is called after layout completes to ensure cursor positioning
|
|
41087
|
+
* is based on stable layout data.
|
|
41088
|
+
*
|
|
41089
|
+
* @returns {void}
|
|
41090
|
+
*
|
|
41091
|
+
* @remarks
|
|
41092
|
+
* Edge cases handled:
|
|
41093
|
+
* - Position lookup failure: When #computeCaretLayoutRect(from) returns null (e.g., cursor
|
|
41094
|
+
* on node boundary between paragraph and run), falls back to adjacent positions.
|
|
41095
|
+
* - Fallback positions (from-1, from+1): Adjacent positions typically resolve to nearest
|
|
41096
|
+
* text content with valid layout fragments. The fallback logic tries from-1 first
|
|
41097
|
+
* (safer for most text editing), then from+1 if within document bounds.
|
|
41098
|
+
* - Bounds validation: Explicitly checks from > 0 before trying from-1, and validates
|
|
41099
|
+
* from+1 <= docSize before trying from+1, preventing invalid position access.
|
|
41100
|
+
* - Cursor preservation: If all position lookups fail, keeps existing cursor visible
|
|
41101
|
+
* rather than clearing it, preventing jarring visual disappearance during edge cases.
|
|
41102
|
+
* - Invalid document state: If editor state or doc is missing, safely returns early
|
|
41103
|
+
* after clearing cursor (defensive programming for race conditions during init/destroy).
|
|
41104
|
+
*
|
|
41105
|
+
* Side effects:
|
|
41106
|
+
* - Mutates #localSelectionLayer.innerHTML (clears or sets cursor/selection HTML)
|
|
41107
|
+
* - Calls #renderCaretOverlay() or #renderSelectionRects() which mutate DOM
|
|
41108
|
+
* - DOM manipulation is wrapped in try/catch to prevent errors from breaking editor state
|
|
41109
|
+
*
|
|
41110
|
+
* Why fallback positions work:
|
|
41111
|
+
* ProseMirror positions can land on structural node boundaries (e.g., between <p> and <run>)
|
|
41112
|
+
* that don't correspond to renderable layout fragments. Adjacent positions ±1 typically
|
|
41113
|
+
* land inside text content with valid layout data. The from-1 fallback is tried first
|
|
41114
|
+
* because it's safer for most text editing scenarios (e.g., after backspace at start of line).
|
|
41115
|
+
*
|
|
41116
|
+
* @private
|
|
41117
|
+
*/
|
|
40719
41118
|
updateSelection_fn = function() {
|
|
40720
41119
|
if (__privateGet(this, _session).mode !== "body") {
|
|
40721
41120
|
return;
|
|
@@ -40724,13 +41123,26 @@ updateSelection_fn = function() {
|
|
|
40724
41123
|
return;
|
|
40725
41124
|
}
|
|
40726
41125
|
if (__privateGet(this, _documentMode) === "viewing") {
|
|
40727
|
-
|
|
41126
|
+
try {
|
|
41127
|
+
__privateGet(this, _localSelectionLayer).innerHTML = "";
|
|
41128
|
+
} catch (error) {
|
|
41129
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
41130
|
+
console.warn("[PresentationEditor] Failed to clear selection layer in viewing mode:", error);
|
|
41131
|
+
}
|
|
41132
|
+
}
|
|
40728
41133
|
return;
|
|
40729
41134
|
}
|
|
40730
41135
|
const layout = __privateGet(this, _layoutState).layout;
|
|
40731
|
-
const
|
|
40732
|
-
|
|
41136
|
+
const editorState = this.getActiveEditor().state;
|
|
41137
|
+
const selection = editorState?.selection;
|
|
40733
41138
|
if (!selection) {
|
|
41139
|
+
try {
|
|
41140
|
+
__privateGet(this, _localSelectionLayer).innerHTML = "";
|
|
41141
|
+
} catch (error) {
|
|
41142
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
41143
|
+
console.warn("[PresentationEditor] Failed to clear selection layer (no selection):", error);
|
|
41144
|
+
}
|
|
41145
|
+
}
|
|
40734
41146
|
return;
|
|
40735
41147
|
}
|
|
40736
41148
|
if (!layout) {
|
|
@@ -40738,15 +41150,40 @@ updateSelection_fn = function() {
|
|
|
40738
41150
|
}
|
|
40739
41151
|
const { from: from2, to } = selection;
|
|
40740
41152
|
if (from2 === to) {
|
|
40741
|
-
|
|
41153
|
+
let caretLayout = __privateMethod(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2);
|
|
41154
|
+
const doc2 = editorState?.doc;
|
|
41155
|
+
if (!doc2) {
|
|
41156
|
+
return;
|
|
41157
|
+
}
|
|
41158
|
+
const docSize = doc2.content?.size ?? 0;
|
|
41159
|
+
if (!caretLayout && from2 > 0) {
|
|
41160
|
+
caretLayout = __privateMethod(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2 - 1);
|
|
41161
|
+
}
|
|
41162
|
+
if (!caretLayout && from2 + 1 <= docSize) {
|
|
41163
|
+
caretLayout = __privateMethod(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2 + 1);
|
|
41164
|
+
}
|
|
40742
41165
|
if (!caretLayout) {
|
|
40743
41166
|
return;
|
|
40744
41167
|
}
|
|
40745
|
-
|
|
41168
|
+
try {
|
|
41169
|
+
__privateGet(this, _localSelectionLayer).innerHTML = "";
|
|
41170
|
+
__privateMethod(this, _PresentationEditor_instances, renderCaretOverlay_fn).call(this, caretLayout);
|
|
41171
|
+
} catch (error) {
|
|
41172
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
41173
|
+
console.warn("[PresentationEditor] Failed to render caret overlay:", error);
|
|
41174
|
+
}
|
|
41175
|
+
}
|
|
40746
41176
|
return;
|
|
40747
41177
|
}
|
|
40748
41178
|
const rects = selectionToRects(layout, __privateGet(this, _layoutState).blocks, __privateGet(this, _layoutState).measures, from2, to) ?? [];
|
|
40749
|
-
|
|
41179
|
+
try {
|
|
41180
|
+
__privateGet(this, _localSelectionLayer).innerHTML = "";
|
|
41181
|
+
__privateMethod(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this, rects);
|
|
41182
|
+
} catch (error) {
|
|
41183
|
+
if (process$1.env.NODE_ENV === "development") {
|
|
41184
|
+
console.warn("[PresentationEditor] Failed to render selection rects:", error);
|
|
41185
|
+
}
|
|
41186
|
+
}
|
|
40750
41187
|
};
|
|
40751
41188
|
resolveLayoutOptions_fn = function(blocks, sectionMetadata) {
|
|
40752
41189
|
const defaults = __privateMethod(this, _PresentationEditor_instances, computeDefaultLayoutDefaults_fn).call(this);
|
|
@@ -41539,7 +41976,6 @@ renderSelectionRects_fn = function(rects) {
|
|
|
41539
41976
|
return;
|
|
41540
41977
|
}
|
|
41541
41978
|
const pageHeight = __privateMethod(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
41542
|
-
const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
|
|
41543
41979
|
rects.forEach((rect, _index) => {
|
|
41544
41980
|
const pageLocalY = rect.y - rect.pageIndex * pageHeight;
|
|
41545
41981
|
const coords = __privateMethod(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
|
|
@@ -41554,8 +41990,8 @@ renderSelectionRects_fn = function(rects) {
|
|
|
41554
41990
|
highlight.style.position = "absolute";
|
|
41555
41991
|
highlight.style.left = `${coords.x}px`;
|
|
41556
41992
|
highlight.style.top = `${coords.y}px`;
|
|
41557
|
-
highlight.style.width = `${Math.max(1, rect.width
|
|
41558
|
-
highlight.style.height = `${Math.max(1, rect.height
|
|
41993
|
+
highlight.style.width = `${Math.max(1, rect.width)}px`;
|
|
41994
|
+
highlight.style.height = `${Math.max(1, rect.height)}px`;
|
|
41559
41995
|
highlight.style.backgroundColor = "rgba(51, 132, 255, 0.35)";
|
|
41560
41996
|
highlight.style.borderRadius = "2px";
|
|
41561
41997
|
highlight.style.pointerEvents = "none";
|
|
@@ -41564,7 +42000,6 @@ renderSelectionRects_fn = function(rects) {
|
|
|
41564
42000
|
};
|
|
41565
42001
|
renderHoverRegion_fn = function(region) {
|
|
41566
42002
|
if (!__privateGet(this, _hoverOverlay) || !__privateGet(this, _hoverTooltip)) return;
|
|
41567
|
-
const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
|
|
41568
42003
|
const coords = __privateMethod(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, region.pageIndex, region.localX, region.localY);
|
|
41569
42004
|
if (!coords) {
|
|
41570
42005
|
__privateMethod(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
|
|
@@ -41573,15 +42008,15 @@ renderHoverRegion_fn = function(region) {
|
|
|
41573
42008
|
__privateGet(this, _hoverOverlay).style.display = "block";
|
|
41574
42009
|
__privateGet(this, _hoverOverlay).style.left = `${coords.x}px`;
|
|
41575
42010
|
__privateGet(this, _hoverOverlay).style.top = `${coords.y}px`;
|
|
41576
|
-
__privateGet(this, _hoverOverlay).style.width = `${region.width
|
|
41577
|
-
__privateGet(this, _hoverOverlay).style.height = `${region.height
|
|
42011
|
+
__privateGet(this, _hoverOverlay).style.width = `${region.width}px`;
|
|
42012
|
+
__privateGet(this, _hoverOverlay).style.height = `${region.height}px`;
|
|
41578
42013
|
const tooltipText = `Double-click to edit ${region.kind === "header" ? "header" : "footer"}`;
|
|
41579
42014
|
__privateGet(this, _hoverTooltip).textContent = tooltipText;
|
|
41580
42015
|
__privateGet(this, _hoverTooltip).style.display = "block";
|
|
41581
42016
|
__privateGet(this, _hoverTooltip).style.left = `${coords.x}px`;
|
|
41582
42017
|
const tooltipHeight = 24;
|
|
41583
42018
|
const spaceAbove = coords.y;
|
|
41584
|
-
const regionHeight = region.height
|
|
42019
|
+
const regionHeight = region.height;
|
|
41585
42020
|
const tooltipY = spaceAbove < tooltipHeight + 4 ? coords.y + regionHeight + 4 : coords.y - tooltipHeight;
|
|
41586
42021
|
__privateGet(this, _hoverTooltip).style.top = `${Math.max(0, tooltipY)}px`;
|
|
41587
42022
|
};
|
|
@@ -41598,11 +42033,11 @@ renderCaretOverlay_fn = function(caretLayout) {
|
|
|
41598
42033
|
if (!__privateGet(this, _localSelectionLayer)) {
|
|
41599
42034
|
return;
|
|
41600
42035
|
}
|
|
41601
|
-
const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
|
|
41602
42036
|
const coords = __privateMethod(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, caretLayout.pageIndex, caretLayout.x, caretLayout.y);
|
|
41603
42037
|
if (!coords) {
|
|
41604
42038
|
return;
|
|
41605
42039
|
}
|
|
42040
|
+
const finalHeight = Math.max(1, caretLayout.height);
|
|
41606
42041
|
const caretEl = __privateGet(this, _localSelectionLayer).ownerDocument?.createElement("div");
|
|
41607
42042
|
if (!caretEl) {
|
|
41608
42043
|
return;
|
|
@@ -41612,7 +42047,7 @@ renderCaretOverlay_fn = function(caretLayout) {
|
|
|
41612
42047
|
caretEl.style.left = `${coords.x}px`;
|
|
41613
42048
|
caretEl.style.top = `${coords.y}px`;
|
|
41614
42049
|
caretEl.style.width = "2px";
|
|
41615
|
-
caretEl.style.height = `${
|
|
42050
|
+
caretEl.style.height = `${finalHeight}px`;
|
|
41616
42051
|
caretEl.style.backgroundColor = "#3366FF";
|
|
41617
42052
|
caretEl.style.borderRadius = "1px";
|
|
41618
42053
|
caretEl.style.pointerEvents = "none";
|
|
@@ -41766,7 +42201,8 @@ inchesToPx_fn = function(value) {
|
|
|
41766
42201
|
};
|
|
41767
42202
|
applyZoom_fn = function() {
|
|
41768
42203
|
const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
|
|
41769
|
-
__privateGet(this,
|
|
42204
|
+
__privateGet(this, _viewportHost).style.transformOrigin = "top left";
|
|
42205
|
+
__privateGet(this, _viewportHost).style.transform = zoom === 1 ? "" : `scale(${zoom})`;
|
|
41770
42206
|
};
|
|
41771
42207
|
createLayoutMetrics_fn = function(perf, startMark, layout, blocks) {
|
|
41772
42208
|
if (!perf || startMark == null || typeof perf.now !== "function") {
|
|
@@ -41779,21 +42215,56 @@ createLayoutMetrics_fn = function(perf, startMark, layout, blocks) {
|
|
|
41779
42215
|
pageCount: layout.pages?.length ?? 0
|
|
41780
42216
|
};
|
|
41781
42217
|
};
|
|
42218
|
+
/**
|
|
42219
|
+
* Convert page-local coordinates to overlay-space coordinates.
|
|
42220
|
+
*
|
|
42221
|
+
* Transforms coordinates from page-local space (x, y relative to a specific page)
|
|
42222
|
+
* to overlay-space coordinates (absolute position within the stacked page layout).
|
|
42223
|
+
* The returned coordinates are in layout space (unscaled logical pixels), not screen
|
|
42224
|
+
* space - the CSS transform: scale() on #viewportHost handles zoom scaling.
|
|
42225
|
+
*
|
|
42226
|
+
* Pages are rendered vertically stacked at y = pageIndex * pageHeight, so the
|
|
42227
|
+
* conversion involves:
|
|
42228
|
+
* 1. X coordinate passes through unchanged (pages are horizontally aligned)
|
|
42229
|
+
* 2. Y coordinate is offset by (pageIndex * pageHeight) to account for stacking
|
|
42230
|
+
*
|
|
42231
|
+
* @param pageIndex - Zero-based page index (must be finite and non-negative)
|
|
42232
|
+
* @param pageLocalX - X coordinate relative to page origin (must be finite)
|
|
42233
|
+
* @param pageLocalY - Y coordinate relative to page origin (must be finite)
|
|
42234
|
+
* @returns Overlay coordinates {x, y} in layout space, or null if inputs are invalid
|
|
42235
|
+
*
|
|
42236
|
+
* @example
|
|
42237
|
+
* ```typescript
|
|
42238
|
+
* // Position at (50, 100) on page 2
|
|
42239
|
+
* const coords = this.#convertPageLocalToOverlayCoords(2, 50, 100);
|
|
42240
|
+
* // Returns: { x: 50, y: 2 * 792 + 100 } = { x: 50, y: 1684 }
|
|
42241
|
+
* ```
|
|
42242
|
+
*
|
|
42243
|
+
* @private
|
|
42244
|
+
*/
|
|
41782
42245
|
convertPageLocalToOverlayCoords_fn = function(pageIndex, pageLocalX, pageLocalY) {
|
|
41783
|
-
|
|
41784
|
-
|
|
41785
|
-
|
|
41786
|
-
|
|
42246
|
+
if (!Number.isFinite(pageIndex) || pageIndex < 0) {
|
|
42247
|
+
console.warn(
|
|
42248
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageIndex ${pageIndex}. Expected a finite non-negative number.`
|
|
42249
|
+
);
|
|
41787
42250
|
return null;
|
|
41788
42251
|
}
|
|
41789
|
-
|
|
41790
|
-
|
|
41791
|
-
|
|
41792
|
-
|
|
41793
|
-
|
|
42252
|
+
if (!Number.isFinite(pageLocalX)) {
|
|
42253
|
+
console.warn(
|
|
42254
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageLocalX ${pageLocalX}. Expected a finite number.`
|
|
42255
|
+
);
|
|
42256
|
+
return null;
|
|
42257
|
+
}
|
|
42258
|
+
if (!Number.isFinite(pageLocalY)) {
|
|
42259
|
+
console.warn(
|
|
42260
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageLocalY ${pageLocalY}. Expected a finite number.`
|
|
42261
|
+
);
|
|
42262
|
+
return null;
|
|
42263
|
+
}
|
|
42264
|
+
const pageHeight = __privateGet(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
41794
42265
|
return {
|
|
41795
|
-
x:
|
|
41796
|
-
y:
|
|
42266
|
+
x: pageLocalX,
|
|
42267
|
+
y: pageIndex * pageHeight + pageLocalY
|
|
41797
42268
|
};
|
|
41798
42269
|
};
|
|
41799
42270
|
normalizeClientPoint_fn = function(clientX, clientY) {
|
|
@@ -56631,7 +57102,8 @@ const Strike = Mark.create({
|
|
|
56631
57102
|
},
|
|
56632
57103
|
addShortcuts() {
|
|
56633
57104
|
return {
|
|
56634
|
-
"Mod-Shift-
|
|
57105
|
+
"Mod-Shift-x": () => this.editor.commands.toggleStrike(),
|
|
57106
|
+
"Mod-Shift-X": () => this.editor.commands.toggleStrike()
|
|
56635
57107
|
};
|
|
56636
57108
|
}
|
|
56637
57109
|
});
|