superdoc 1.0.0-beta.37 → 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-ioYMTqps.cjs → PdfViewer-Beeg4BCm.cjs} +1 -1
- package/dist/chunks/{PdfViewer-C7M9_O_G.es.js → PdfViewer-eV3LwCxv.es.js} +1 -1
- package/dist/chunks/{index-CVmL6SHD-DZlLqgFx.es.js → index-BqDEyWLQ-B3TrQVjX.es.js} +1 -1
- package/dist/chunks/{index-CVmL6SHD-LYqtvXZO.cjs → index-BqDEyWLQ-CCRXZcrp.cjs} +1 -1
- package/dist/chunks/{index-CEh5e5Sy.cjs → index-DdrGP1Py.cjs} +3 -3
- package/dist/chunks/{index-tgFI32Kk.es.js → index-DvGFHOzb.es.js} +3 -3
- package/dist/chunks/{super-editor.es-Bk7tbTHB.es.js → super-editor.es-CQM3jM5n.es.js} +633 -126
- package/dist/chunks/{super-editor.es-CqPIzvls.cjs → super-editor.es-Uiy2hAKb.cjs} +633 -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-ubqPT9rF.js → converter-nztpWkGr.js} +31 -22
- package/dist/super-editor/chunks/{docx-zipper-w_7HFRZI.js → docx-zipper-DaYim92a.js} +1 -1
- package/dist/super-editor/chunks/{editor-Udi34-u-.js → editor-H7c-XUpw.js} +542 -66
- package/dist/super-editor/chunks/{index-CVmL6SHD.js → index-BqDEyWLQ.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CKT2hVa-.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 +635 -128
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -19193,6 +19193,7 @@
|
|
|
19193
19193
|
return parts.join("; ");
|
|
19194
19194
|
}
|
|
19195
19195
|
const INLINE_OVERRIDE_PROPERTIES = ["fontSize", "bold", "italic", "strike", "underline", "letterSpacing"];
|
|
19196
|
+
const DEFAULT_FONT_SIZE_HALF_POINTS = 20;
|
|
19196
19197
|
const resolveRunProperties = (params2, inlineRpr, resolvedPpr, isListNumber = false, numberingDefinedInline = false) => {
|
|
19197
19198
|
const paragraphStyleId = resolvedPpr?.styleId;
|
|
19198
19199
|
const paragraphStyleProps = resolveStyleChain$1(params2, paragraphStyleId, translator$1N);
|
|
@@ -19234,6 +19235,15 @@
|
|
|
19234
19235
|
finalProps[prop] = inlineRpr[prop];
|
|
19235
19236
|
}
|
|
19236
19237
|
}
|
|
19238
|
+
if (finalProps.fontSize == null || typeof finalProps.fontSize !== "number" || !Number.isFinite(finalProps.fontSize) || finalProps.fontSize <= 0) {
|
|
19239
|
+
let defaultFontSize = DEFAULT_FONT_SIZE_HALF_POINTS;
|
|
19240
|
+
if (defaultProps2?.fontSize != null && typeof defaultProps2.fontSize === "number" && Number.isFinite(defaultProps2.fontSize) && defaultProps2.fontSize > 0) {
|
|
19241
|
+
defaultFontSize = defaultProps2.fontSize;
|
|
19242
|
+
} else if (normalProps?.fontSize != null && typeof normalProps.fontSize === "number" && Number.isFinite(normalProps.fontSize) && normalProps.fontSize > 0) {
|
|
19243
|
+
defaultFontSize = normalProps.fontSize;
|
|
19244
|
+
}
|
|
19245
|
+
finalProps.fontSize = defaultFontSize;
|
|
19246
|
+
}
|
|
19237
19247
|
return finalProps;
|
|
19238
19248
|
};
|
|
19239
19249
|
function resolveParagraphProperties(params2, inlineProps, insideTable = false, overrideInlineStyleId = false, tableStyleId = null) {
|
|
@@ -34757,7 +34767,8 @@
|
|
|
34757
34767
|
if (fieldAnnotationContent.length) {
|
|
34758
34768
|
return false;
|
|
34759
34769
|
}
|
|
34760
|
-
|
|
34770
|
+
const result = handleClipboardPaste({ editor, view }, html2);
|
|
34771
|
+
return result;
|
|
34761
34772
|
}
|
|
34762
34773
|
},
|
|
34763
34774
|
isInputRules: true
|
|
@@ -34772,38 +34783,36 @@
|
|
|
34772
34783
|
function isGoogleDocsHtml(html2) {
|
|
34773
34784
|
return /docs-internal-guid-/.test(html2);
|
|
34774
34785
|
}
|
|
34786
|
+
function findParagraphAncestor($from) {
|
|
34787
|
+
for (let d2 = $from.depth; d2 >= 0; d2--) {
|
|
34788
|
+
const node2 = $from.node(d2);
|
|
34789
|
+
if (node2.type.name === "paragraph") {
|
|
34790
|
+
return { node: node2, depth: d2 };
|
|
34791
|
+
}
|
|
34792
|
+
}
|
|
34793
|
+
return { node: null, depth: -1 };
|
|
34794
|
+
}
|
|
34775
34795
|
function handleHtmlPaste(html2, editor, source) {
|
|
34776
34796
|
let cleanedHtml;
|
|
34777
34797
|
cleanedHtml = htmlHandler(html2, editor);
|
|
34778
34798
|
let doc2 = DOMParser$1.fromSchema(editor.schema).parse(cleanedHtml);
|
|
34779
34799
|
doc2 = wrapTextsInRuns(doc2);
|
|
34780
34800
|
const { dispatch, state: state2 } = editor.view;
|
|
34781
|
-
if (!dispatch)
|
|
34801
|
+
if (!dispatch) {
|
|
34802
|
+
return false;
|
|
34803
|
+
}
|
|
34782
34804
|
const { $from } = state2.selection;
|
|
34783
|
-
const
|
|
34784
|
-
const
|
|
34805
|
+
const { node: paragraphNode } = findParagraphAncestor($from);
|
|
34806
|
+
const isInParagraph = paragraphNode !== null;
|
|
34785
34807
|
const isSingleParagraph = doc2.childCount === 1 && doc2.firstChild.type.name === "paragraph";
|
|
34786
34808
|
if (isInParagraph && isSingleParagraph) {
|
|
34787
34809
|
const paragraphContent = doc2.firstChild.content;
|
|
34788
34810
|
const tr = state2.tr.replaceSelectionWith(paragraphContent, false);
|
|
34789
34811
|
dispatch(tr);
|
|
34790
|
-
} else if (isInParagraph
|
|
34791
|
-
const
|
|
34792
|
-
|
|
34793
|
-
|
|
34794
|
-
allContent.push(...node2.content.content);
|
|
34795
|
-
if (index2 < doc2.content.childCount - 1) {
|
|
34796
|
-
allContent.push(editor.schema.text("\n"));
|
|
34797
|
-
}
|
|
34798
|
-
}
|
|
34799
|
-
});
|
|
34800
|
-
if (allContent.length > 0) {
|
|
34801
|
-
const fragment = Fragment$1.from(allContent);
|
|
34802
|
-
const tr = state2.tr.replaceSelectionWith(fragment, false);
|
|
34803
|
-
dispatch(tr);
|
|
34804
|
-
} else {
|
|
34805
|
-
dispatch(state2.tr.replaceSelectionWith(doc2, true));
|
|
34806
|
-
}
|
|
34812
|
+
} else if (isInParagraph) {
|
|
34813
|
+
const slice = new Slice(doc2.content, 0, 0);
|
|
34814
|
+
const tr = state2.tr.replaceSelection(slice);
|
|
34815
|
+
dispatch(tr);
|
|
34807
34816
|
} else {
|
|
34808
34817
|
dispatch(state2.tr.replaceSelectionWith(doc2, true));
|
|
34809
34818
|
}
|
|
@@ -41859,7 +41868,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
41859
41868
|
static getStoredSuperdocVersion(docx) {
|
|
41860
41869
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
41861
41870
|
}
|
|
41862
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
41871
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.39") {
|
|
41863
41872
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
41864
41873
|
}
|
|
41865
41874
|
/**
|
|
@@ -53022,7 +53031,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
53022
53031
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
53023
53032
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
53024
53033
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
53025
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, 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;
|
|
53034
|
+
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, 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;
|
|
53026
53035
|
var GOOD_LEAF_SIZE = 200;
|
|
53027
53036
|
var RopeSequence = function RopeSequence2() {
|
|
53028
53037
|
};
|
|
@@ -61954,11 +61963,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
61954
61963
|
selection = editor.options.lastSelection;
|
|
61955
61964
|
}
|
|
61956
61965
|
const { empty: empty2, ranges } = selection;
|
|
61957
|
-
if (empty2) return true;
|
|
61958
61966
|
if (dispatch) {
|
|
61959
|
-
|
|
61960
|
-
|
|
61961
|
-
|
|
61967
|
+
if (!empty2) {
|
|
61968
|
+
ranges.forEach((range2) => {
|
|
61969
|
+
tr.removeMark(range2.$from.pos, range2.$to.pos);
|
|
61970
|
+
});
|
|
61971
|
+
}
|
|
61972
|
+
tr.setStoredMarks([]);
|
|
61962
61973
|
}
|
|
61963
61974
|
return true;
|
|
61964
61975
|
};
|
|
@@ -66889,7 +66900,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
66889
66900
|
const shouldSkipNodeView = (editor) => {
|
|
66890
66901
|
return isHeadless(editor);
|
|
66891
66902
|
};
|
|
66892
|
-
const summaryVersion = "1.0.0-beta.
|
|
66903
|
+
const summaryVersion = "1.0.0-beta.39";
|
|
66893
66904
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
66894
66905
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
66895
66906
|
function mapAttributes(attrs) {
|
|
@@ -67678,7 +67689,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67678
67689
|
{ default: remarkStringify2 },
|
|
67679
67690
|
{ default: remarkGfm2 }
|
|
67680
67691
|
] = await Promise.all([
|
|
67681
|
-
Promise.resolve().then(() =>
|
|
67692
|
+
Promise.resolve().then(() => indexBqDEyWLQ),
|
|
67682
67693
|
Promise.resolve().then(() => indexDRCvimau),
|
|
67683
67694
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
67684
67695
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -67883,7 +67894,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67883
67894
|
* Process collaboration migrations
|
|
67884
67895
|
*/
|
|
67885
67896
|
processCollaborationMigrations() {
|
|
67886
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
67897
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.39");
|
|
67887
67898
|
if (!this.options.ydoc) return;
|
|
67888
67899
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
67889
67900
|
let docVersion = metaMap.get("version");
|
|
@@ -69894,7 +69905,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69894
69905
|
const fontSizePx = normalizeFontSizePx(attrs.fontSize);
|
|
69895
69906
|
if (fontSizePx !== void 0 && fontSizePx >= 1 && fontSizePx <= 1e3) {
|
|
69896
69907
|
run2.fontSize = fontSizePx;
|
|
69897
|
-
}
|
|
69908
|
+
} else if (attrs.fontSize !== void 0) ;
|
|
69898
69909
|
if (isFiniteNumber(attrs.letterSpacing)) {
|
|
69899
69910
|
const spacing = Number(attrs.letterSpacing);
|
|
69900
69911
|
if (spacing >= -100 && spacing <= 100) {
|
|
@@ -72573,18 +72584,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
72573
72584
|
paragraphAttrs.rtl = true;
|
|
72574
72585
|
}
|
|
72575
72586
|
const explicitAlignment = normalizeAlignment(attrs.alignment ?? attrs.textAlign);
|
|
72587
|
+
const paragraphAlignment = typeof paragraphProps.justification === "string" ? normalizeAlignment(paragraphProps.justification) : void 0;
|
|
72576
72588
|
const styleAlignment = hydrated?.alignment ? normalizeAlignment(hydrated.alignment) : void 0;
|
|
72577
|
-
const paragraphAlignment = paragraphProps.justification ? normalizeAlignment(paragraphProps.justification) : void 0;
|
|
72578
72589
|
if (bidi && adjustRightInd) {
|
|
72579
72590
|
paragraphAttrs.alignment = "right";
|
|
72580
72591
|
} else if (explicitAlignment) {
|
|
72581
72592
|
paragraphAttrs.alignment = explicitAlignment;
|
|
72593
|
+
} else if (paragraphAlignment) {
|
|
72594
|
+
paragraphAttrs.alignment = paragraphAlignment;
|
|
72582
72595
|
} else if (bidi) {
|
|
72583
72596
|
paragraphAttrs.alignment = "right";
|
|
72584
72597
|
} else if (styleAlignment) {
|
|
72585
72598
|
paragraphAttrs.alignment = styleAlignment;
|
|
72586
|
-
} else if (paragraphAlignment) {
|
|
72587
|
-
paragraphAttrs.alignment = paragraphAlignment;
|
|
72588
72599
|
} else if (computed2.paragraph.alignment) {
|
|
72589
72600
|
paragraphAttrs.alignment = computed2.paragraph.alignment;
|
|
72590
72601
|
}
|
|
@@ -78303,12 +78314,27 @@ ${l}
|
|
|
78303
78314
|
pointer-events: none;
|
|
78304
78315
|
z-index: 1000;
|
|
78305
78316
|
}
|
|
78317
|
+
`;
|
|
78318
|
+
const IMAGE_SELECTION_STYLES = `
|
|
78319
|
+
/* Highlight for selected images (block or inline) */
|
|
78320
|
+
.superdoc-image-selected {
|
|
78321
|
+
outline: 2px solid #4a90e2;
|
|
78322
|
+
outline-offset: 2px;
|
|
78323
|
+
border-radius: 2px;
|
|
78324
|
+
box-shadow: 0 0 0 1px rgba(74, 144, 226, 0.35);
|
|
78325
|
+
}
|
|
78326
|
+
|
|
78327
|
+
/* Ensure inline images can be targeted */
|
|
78328
|
+
.superdoc-inline-image.superdoc-image-selected {
|
|
78329
|
+
outline-offset: 2px;
|
|
78330
|
+
}
|
|
78306
78331
|
`;
|
|
78307
78332
|
let printStylesInjected = false;
|
|
78308
78333
|
let linkStylesInjected = false;
|
|
78309
78334
|
let trackChangeStylesInjected = false;
|
|
78310
78335
|
let sdtContainerStylesInjected = false;
|
|
78311
78336
|
let fieldAnnotationStylesInjected = false;
|
|
78337
|
+
let imageSelectionStylesInjected = false;
|
|
78312
78338
|
const ensurePrintStyles = (doc2) => {
|
|
78313
78339
|
if (printStylesInjected || !doc2) return;
|
|
78314
78340
|
const styleEl = doc2.createElement("style");
|
|
@@ -78349,6 +78375,14 @@ ${l}
|
|
|
78349
78375
|
doc2.head?.appendChild(styleEl);
|
|
78350
78376
|
fieldAnnotationStylesInjected = true;
|
|
78351
78377
|
};
|
|
78378
|
+
const ensureImageSelectionStyles = (doc2) => {
|
|
78379
|
+
if (imageSelectionStylesInjected || !doc2) return;
|
|
78380
|
+
const styleEl = doc2.createElement("style");
|
|
78381
|
+
styleEl.setAttribute("data-superdoc-image-selection-styles", "true");
|
|
78382
|
+
styleEl.textContent = IMAGE_SELECTION_STYLES;
|
|
78383
|
+
doc2.head?.appendChild(styleEl);
|
|
78384
|
+
imageSelectionStylesInjected = true;
|
|
78385
|
+
};
|
|
78352
78386
|
const DOM_CLASS_NAMES = {
|
|
78353
78387
|
/**
|
|
78354
78388
|
* Class name for page container elements.
|
|
@@ -79249,6 +79283,7 @@ ${l}
|
|
|
79249
79283
|
ensureTrackChangeStyles(doc2);
|
|
79250
79284
|
ensureFieldAnnotationStyles(doc2);
|
|
79251
79285
|
ensureSdtContainerStyles(doc2);
|
|
79286
|
+
ensureImageSelectionStyles(doc2);
|
|
79252
79287
|
mount2.classList.add(CLASS_NAMES$1.container);
|
|
79253
79288
|
if (this.mount && this.mount !== mount2) {
|
|
79254
79289
|
this.resetState();
|
|
@@ -79784,7 +79819,7 @@ ${l}
|
|
|
79784
79819
|
if (fragment.continuesOnNext) {
|
|
79785
79820
|
fragmentEl.dataset.continuesOnNext = "true";
|
|
79786
79821
|
}
|
|
79787
|
-
const lines = measure.lines.slice(fragment.fromLine, fragment.toLine);
|
|
79822
|
+
const lines = fragment.lines ?? measure.lines.slice(fragment.fromLine, fragment.toLine);
|
|
79788
79823
|
applyParagraphBlockStyles(fragmentEl, block.attrs);
|
|
79789
79824
|
if (block.attrs?.styleId) {
|
|
79790
79825
|
fragmentEl.dataset.styleId = block.attrs.styleId;
|
|
@@ -80881,6 +80916,7 @@ ${l}
|
|
|
80881
80916
|
return null;
|
|
80882
80917
|
}
|
|
80883
80918
|
const img2 = this.doc.createElement("img");
|
|
80919
|
+
img2.classList.add("superdoc-inline-image");
|
|
80884
80920
|
const isDataUrl = typeof run2.src === "string" && run2.src.startsWith("data:");
|
|
80885
80921
|
if (isDataUrl) {
|
|
80886
80922
|
if (run2.src.length > MAX_DATA_URL_LENGTH) {
|
|
@@ -83418,6 +83454,23 @@ ${l}
|
|
|
83418
83454
|
}
|
|
83419
83455
|
}
|
|
83420
83456
|
let lines = normalizeLines(measure);
|
|
83457
|
+
const measurementWidth = lines[0]?.maxWidth;
|
|
83458
|
+
let didRemeasureForColumnWidth = false;
|
|
83459
|
+
if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > columnWidth) {
|
|
83460
|
+
let firstLineIndent = 0;
|
|
83461
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
83462
|
+
if (wordLayout?.marker && measure.marker) {
|
|
83463
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
83464
|
+
if (markerJustification === "left") {
|
|
83465
|
+
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
83466
|
+
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
83467
|
+
firstLineIndent = markerWidth + gutterWidth;
|
|
83468
|
+
}
|
|
83469
|
+
}
|
|
83470
|
+
const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
|
|
83471
|
+
lines = normalizeLines(newMeasure);
|
|
83472
|
+
didRemeasureForColumnWidth = true;
|
|
83473
|
+
}
|
|
83421
83474
|
let fromLine = 0;
|
|
83422
83475
|
const spacing = block.attrs?.spacing ?? {};
|
|
83423
83476
|
const styleId = block.attrs?.styleId;
|
|
@@ -83493,7 +83546,17 @@ ${l}
|
|
|
83493
83546
|
tempY += lineHeight2;
|
|
83494
83547
|
}
|
|
83495
83548
|
if (narrowestWidth < columnWidth) {
|
|
83496
|
-
|
|
83549
|
+
let firstLineIndent = 0;
|
|
83550
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
83551
|
+
if (wordLayout?.marker && measure.marker) {
|
|
83552
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
83553
|
+
if (markerJustification === "left") {
|
|
83554
|
+
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
83555
|
+
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
83556
|
+
firstLineIndent = markerWidth + gutterWidth;
|
|
83557
|
+
}
|
|
83558
|
+
}
|
|
83559
|
+
const newMeasure = remeasureParagraph2(block, narrowestWidth, firstLineIndent);
|
|
83497
83560
|
lines = normalizeLines(newMeasure);
|
|
83498
83561
|
didRemeasureForFloats = true;
|
|
83499
83562
|
}
|
|
@@ -83558,6 +83621,9 @@ ${l}
|
|
|
83558
83621
|
width: effectiveColumnWidth,
|
|
83559
83622
|
...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
|
|
83560
83623
|
};
|
|
83624
|
+
if (didRemeasureForColumnWidth) {
|
|
83625
|
+
fragment.lines = lines.slice(fromLine, slice2.toLine);
|
|
83626
|
+
}
|
|
83561
83627
|
if (measure.marker && fromLine === 0) {
|
|
83562
83628
|
fragment.markerWidth = measure.marker.markerWidth;
|
|
83563
83629
|
if (measure.marker.markerTextWidth != null) {
|
|
@@ -86286,12 +86352,14 @@ ${l}
|
|
|
86286
86352
|
}
|
|
86287
86353
|
return maxSize2 * 1.2;
|
|
86288
86354
|
}
|
|
86289
|
-
function remeasureParagraph(block, maxWidth) {
|
|
86355
|
+
function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
86290
86356
|
const runs2 = block.runs ?? [];
|
|
86291
86357
|
const lines = [];
|
|
86292
86358
|
let currentRun = 0;
|
|
86293
86359
|
let currentChar = 0;
|
|
86294
86360
|
while (currentRun < runs2.length) {
|
|
86361
|
+
const isFirstLine = lines.length === 0;
|
|
86362
|
+
const effectiveMaxWidth = isFirstLine ? maxWidth - firstLineIndent : maxWidth;
|
|
86295
86363
|
const startRun = currentRun;
|
|
86296
86364
|
const startChar = currentChar;
|
|
86297
86365
|
let width = 0;
|
|
@@ -86305,7 +86373,7 @@ ${l}
|
|
|
86305
86373
|
const start2 = r2 === currentRun ? currentChar : 0;
|
|
86306
86374
|
for (let c2 = start2; c2 < text2.length; c2 += 1) {
|
|
86307
86375
|
const w2 = measureRunSliceWidth(run2, c2, c2 + 1);
|
|
86308
|
-
if (width + w2 >
|
|
86376
|
+
if (width + w2 > effectiveMaxWidth && width > 0) {
|
|
86309
86377
|
if (lastBreakRun >= 0) {
|
|
86310
86378
|
endRun = lastBreakRun;
|
|
86311
86379
|
endChar = lastBreakChar;
|
|
@@ -86804,7 +86872,7 @@ ${l}
|
|
|
86804
86872
|
...options,
|
|
86805
86873
|
headerContentHeights,
|
|
86806
86874
|
// Pass header heights to prevent overlap
|
|
86807
|
-
remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
|
|
86875
|
+
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
86808
86876
|
});
|
|
86809
86877
|
const layoutEnd = performance.now();
|
|
86810
86878
|
perfLog(`[Perf] 4.2 Layout document (pagination): ${(layoutEnd - layoutStart).toFixed(2)}ms`);
|
|
@@ -86852,7 +86920,7 @@ ${l}
|
|
|
86852
86920
|
...options,
|
|
86853
86921
|
headerContentHeights,
|
|
86854
86922
|
// Pass header heights to prevent overlap
|
|
86855
|
-
remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
|
|
86923
|
+
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
86856
86924
|
});
|
|
86857
86925
|
const relayoutEnd = performance.now();
|
|
86858
86926
|
const relayoutTime = relayoutEnd - relayoutStart;
|
|
@@ -87683,6 +87751,31 @@ ${l}
|
|
|
87683
87751
|
}
|
|
87684
87752
|
return matchingIndices[0];
|
|
87685
87753
|
}
|
|
87754
|
+
const DEFAULT_CELL_PADDING = { top: 2, bottom: 2, left: 4, right: 4 };
|
|
87755
|
+
const getCellPaddingFromRow = (cellIdx, row2) => {
|
|
87756
|
+
const padding = row2?.cells?.[cellIdx]?.attrs?.padding ?? {};
|
|
87757
|
+
return {
|
|
87758
|
+
top: padding.top ?? DEFAULT_CELL_PADDING.top,
|
|
87759
|
+
bottom: padding.bottom ?? DEFAULT_CELL_PADDING.bottom,
|
|
87760
|
+
left: padding.left ?? DEFAULT_CELL_PADDING.left,
|
|
87761
|
+
right: padding.right ?? DEFAULT_CELL_PADDING.right
|
|
87762
|
+
};
|
|
87763
|
+
};
|
|
87764
|
+
const getCellBlocks = (cell2) => {
|
|
87765
|
+
if (!cell2) return [];
|
|
87766
|
+
return cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
|
|
87767
|
+
};
|
|
87768
|
+
const getCellMeasures = (cell2) => {
|
|
87769
|
+
if (!cell2) return [];
|
|
87770
|
+
return cell2.blocks ?? (cell2.paragraph ? [cell2.paragraph] : []);
|
|
87771
|
+
};
|
|
87772
|
+
const sumLineHeights = (measure, fromLine, toLine) => {
|
|
87773
|
+
let height = 0;
|
|
87774
|
+
for (let i2 = fromLine; i2 < toLine && i2 < measure.lines.length; i2 += 1) {
|
|
87775
|
+
height += measure.lines[i2]?.lineHeight ?? 0;
|
|
87776
|
+
}
|
|
87777
|
+
return height;
|
|
87778
|
+
};
|
|
87686
87779
|
function selectionToRects(layout, blocks2, measures, from2, to) {
|
|
87687
87780
|
if (from2 === to) {
|
|
87688
87781
|
return [];
|
|
@@ -87729,6 +87822,136 @@ ${l}
|
|
|
87729
87822
|
});
|
|
87730
87823
|
return;
|
|
87731
87824
|
}
|
|
87825
|
+
if (fragment.kind === "table") {
|
|
87826
|
+
const blockIndex = findBlockIndexByFragmentId(blocks2, fragment.blockId, { from: from2, to });
|
|
87827
|
+
if (blockIndex === -1) return;
|
|
87828
|
+
const block = blocks2[blockIndex];
|
|
87829
|
+
const measure = measures[blockIndex];
|
|
87830
|
+
if (!block || block.kind !== "table" || measure?.kind !== "table") {
|
|
87831
|
+
return;
|
|
87832
|
+
}
|
|
87833
|
+
const tableBlock = block;
|
|
87834
|
+
const tableMeasure = measure;
|
|
87835
|
+
const tableFragment = fragment;
|
|
87836
|
+
const rowHeights = tableMeasure.rows.map((rowMeasure, idx) => {
|
|
87837
|
+
if (tableFragment.partialRow && tableFragment.partialRow.rowIndex === idx) {
|
|
87838
|
+
return tableFragment.partialRow.partialHeight;
|
|
87839
|
+
}
|
|
87840
|
+
return rowMeasure?.height ?? 0;
|
|
87841
|
+
});
|
|
87842
|
+
const calculateCellX = (cellIdx, cellMeasure) => {
|
|
87843
|
+
const gridStart = cellMeasure.gridColumnStart ?? cellIdx;
|
|
87844
|
+
let x2 = 0;
|
|
87845
|
+
for (let i2 = 0; i2 < gridStart && i2 < tableMeasure.columnWidths.length; i2 += 1) {
|
|
87846
|
+
x2 += tableMeasure.columnWidths[i2];
|
|
87847
|
+
}
|
|
87848
|
+
return x2;
|
|
87849
|
+
};
|
|
87850
|
+
const processRow = (rowIndex, rowOffset) => {
|
|
87851
|
+
const rowMeasure = tableMeasure.rows[rowIndex];
|
|
87852
|
+
const row2 = tableBlock.rows[rowIndex];
|
|
87853
|
+
if (!rowMeasure || !row2) return rowOffset;
|
|
87854
|
+
const rowHeight = rowHeights[rowIndex] ?? rowMeasure.height;
|
|
87855
|
+
const isPartialRow = tableFragment.partialRow?.rowIndex === rowIndex;
|
|
87856
|
+
const partialRowData = isPartialRow ? tableFragment.partialRow : null;
|
|
87857
|
+
const totalColumns = Math.min(rowMeasure.cells.length, row2.cells.length);
|
|
87858
|
+
for (let cellIdx = 0; cellIdx < totalColumns; cellIdx += 1) {
|
|
87859
|
+
const cellMeasure = rowMeasure.cells[cellIdx];
|
|
87860
|
+
const cell2 = row2.cells[cellIdx];
|
|
87861
|
+
if (!cellMeasure || !cell2) continue;
|
|
87862
|
+
const padding = getCellPaddingFromRow(cellIdx, row2);
|
|
87863
|
+
const cellX = calculateCellX(cellIdx, cellMeasure);
|
|
87864
|
+
const cellBlocks = getCellBlocks(cell2);
|
|
87865
|
+
const cellBlockMeasures = getCellMeasures(cellMeasure);
|
|
87866
|
+
const renderedBlocks = [];
|
|
87867
|
+
let cumulativeLine = 0;
|
|
87868
|
+
for (let i2 = 0; i2 < Math.min(cellBlocks.length, cellBlockMeasures.length); i2 += 1) {
|
|
87869
|
+
const paraBlock = cellBlocks[i2];
|
|
87870
|
+
const paraMeasure = cellBlockMeasures[i2];
|
|
87871
|
+
if (!paraBlock || !paraMeasure || paraBlock.kind !== "paragraph" || paraMeasure.kind !== "paragraph") {
|
|
87872
|
+
continue;
|
|
87873
|
+
}
|
|
87874
|
+
const lineCount = paraMeasure.lines.length;
|
|
87875
|
+
const blockStart = cumulativeLine;
|
|
87876
|
+
const blockEnd = cumulativeLine + lineCount;
|
|
87877
|
+
cumulativeLine = blockEnd;
|
|
87878
|
+
const allowedStart = partialRowData?.fromLineByCell?.[cellIdx] ?? 0;
|
|
87879
|
+
const rawAllowedEnd = partialRowData?.toLineByCell?.[cellIdx];
|
|
87880
|
+
const allowedEnd = rawAllowedEnd == null || rawAllowedEnd === -1 ? cumulativeLine : rawAllowedEnd;
|
|
87881
|
+
const renderStartGlobal = Math.max(blockStart, allowedStart);
|
|
87882
|
+
const renderEndGlobal = Math.min(blockEnd, allowedEnd);
|
|
87883
|
+
if (renderStartGlobal >= renderEndGlobal) continue;
|
|
87884
|
+
const startLine = renderStartGlobal - blockStart;
|
|
87885
|
+
const endLine = renderEndGlobal - blockStart;
|
|
87886
|
+
let height = sumLineHeights(paraMeasure, startLine, endLine);
|
|
87887
|
+
const rendersWholeBlock = startLine === 0 && endLine >= lineCount;
|
|
87888
|
+
if (rendersWholeBlock) {
|
|
87889
|
+
const totalHeight = paraMeasure.totalHeight;
|
|
87890
|
+
if (typeof totalHeight === "number" && totalHeight > height) {
|
|
87891
|
+
height = totalHeight;
|
|
87892
|
+
}
|
|
87893
|
+
const spacingAfter = paraBlock.attrs?.spacing?.after;
|
|
87894
|
+
if (typeof spacingAfter === "number" && spacingAfter > 0) {
|
|
87895
|
+
height += spacingAfter;
|
|
87896
|
+
}
|
|
87897
|
+
}
|
|
87898
|
+
renderedBlocks.push({ block: paraBlock, measure: paraMeasure, startLine, endLine, height });
|
|
87899
|
+
}
|
|
87900
|
+
const contentHeight = renderedBlocks.reduce((acc, info) => acc + info.height, 0);
|
|
87901
|
+
const contentAreaHeight = Math.max(0, rowHeight - (padding.top + padding.bottom));
|
|
87902
|
+
const freeSpace = Math.max(0, contentAreaHeight - contentHeight);
|
|
87903
|
+
let verticalOffset = 0;
|
|
87904
|
+
const vAlign = cell2.attrs?.verticalAlign;
|
|
87905
|
+
if (vAlign === "center" || vAlign === "middle") {
|
|
87906
|
+
verticalOffset = freeSpace / 2;
|
|
87907
|
+
} else if (vAlign === "bottom") {
|
|
87908
|
+
verticalOffset = freeSpace;
|
|
87909
|
+
}
|
|
87910
|
+
let blockTopCursor = padding.top + verticalOffset;
|
|
87911
|
+
renderedBlocks.forEach((info) => {
|
|
87912
|
+
const paragraphMarkerWidth = info.measure.marker?.markerWidth ?? 0;
|
|
87913
|
+
const intersectingLines = findLinesIntersectingRange(info.block, info.measure, from2, to);
|
|
87914
|
+
intersectingLines.forEach(({ line, index: index2 }) => {
|
|
87915
|
+
if (index2 < info.startLine || index2 >= info.endLine) {
|
|
87916
|
+
return;
|
|
87917
|
+
}
|
|
87918
|
+
const range2 = computeLinePmRange(info.block, line);
|
|
87919
|
+
if (range2.pmStart == null || range2.pmEnd == null) return;
|
|
87920
|
+
const sliceFrom = Math.max(range2.pmStart, from2);
|
|
87921
|
+
const sliceTo = Math.min(range2.pmEnd, to);
|
|
87922
|
+
if (sliceFrom >= sliceTo) return;
|
|
87923
|
+
const charOffsetFrom = pmPosToCharOffset(info.block, line, sliceFrom);
|
|
87924
|
+
const charOffsetTo = pmPosToCharOffset(info.block, line, sliceTo);
|
|
87925
|
+
const availableWidth = Math.max(1, cellMeasure.width - padding.left - padding.right);
|
|
87926
|
+
const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth);
|
|
87927
|
+
const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth);
|
|
87928
|
+
const rectX = fragment.x + cellX + padding.left + paragraphMarkerWidth + Math.min(startX, endX);
|
|
87929
|
+
const rectWidth = Math.max(1, Math.abs(endX - startX));
|
|
87930
|
+
const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
|
|
87931
|
+
const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
|
|
87932
|
+
rects.push({
|
|
87933
|
+
x: rectX,
|
|
87934
|
+
y: rectY + pageIndex * layout.pageSize.h,
|
|
87935
|
+
width: rectWidth,
|
|
87936
|
+
height: line.lineHeight,
|
|
87937
|
+
pageIndex
|
|
87938
|
+
});
|
|
87939
|
+
});
|
|
87940
|
+
blockTopCursor += info.height;
|
|
87941
|
+
});
|
|
87942
|
+
}
|
|
87943
|
+
return rowOffset + rowHeight;
|
|
87944
|
+
};
|
|
87945
|
+
let rowCursor = 0;
|
|
87946
|
+
const repeatHeaderCount = tableFragment.repeatHeaderCount ?? 0;
|
|
87947
|
+
for (let r2 = 0; r2 < repeatHeaderCount && r2 < tableMeasure.rows.length; r2 += 1) {
|
|
87948
|
+
rowCursor = processRow(r2, rowCursor);
|
|
87949
|
+
}
|
|
87950
|
+
for (let r2 = tableFragment.fromRow; r2 < tableFragment.toRow && r2 < tableMeasure.rows.length; r2 += 1) {
|
|
87951
|
+
rowCursor = processRow(r2, rowCursor);
|
|
87952
|
+
}
|
|
87953
|
+
return;
|
|
87954
|
+
}
|
|
87732
87955
|
if (isAtomicFragment(fragment)) {
|
|
87733
87956
|
const blockIndex = findBlockIndexByFragmentId(blocks2, fragment.blockId, { from: from2, to });
|
|
87734
87957
|
if (blockIndex === -1) return;
|
|
@@ -88255,7 +88478,16 @@ ${l}
|
|
|
88255
88478
|
const rawFirstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
|
|
88256
88479
|
const firstLineOffset = isWordLayoutList ? 0 : rawFirstLineOffset;
|
|
88257
88480
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
88258
|
-
|
|
88481
|
+
let leftJustifiedMarkerSpace = 0;
|
|
88482
|
+
if (wordLayout?.marker) {
|
|
88483
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
88484
|
+
if (markerJustification === "left") {
|
|
88485
|
+
const markerBoxWidth = wordLayout.marker.markerBoxWidthPx ?? 0;
|
|
88486
|
+
const gutterWidth = wordLayout.marker.gutterWidthPx ?? LIST_MARKER_GAP;
|
|
88487
|
+
leftJustifiedMarkerSpace = markerBoxWidth + gutterWidth;
|
|
88488
|
+
}
|
|
88489
|
+
}
|
|
88490
|
+
const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
|
|
88259
88491
|
const tabStops = buildTabStopsPx(
|
|
88260
88492
|
indent2,
|
|
88261
88493
|
block.attrs?.tabs,
|
|
@@ -90731,12 +90963,30 @@ ${l}
|
|
|
90731
90963
|
if (linkEl) {
|
|
90732
90964
|
const href = linkEl.getAttribute("href") ?? "";
|
|
90733
90965
|
const isAnchorLink = href.startsWith("#") && href.length > 1;
|
|
90734
|
-
|
|
90966
|
+
const isTocLink = linkEl.closest(".superdoc-toc-entry") !== null;
|
|
90967
|
+
if (isAnchorLink && isTocLink) {
|
|
90735
90968
|
event.preventDefault();
|
|
90736
90969
|
event.stopPropagation();
|
|
90737
90970
|
this.goToAnchor(href);
|
|
90738
90971
|
return;
|
|
90739
90972
|
}
|
|
90973
|
+
event.preventDefault();
|
|
90974
|
+
event.stopPropagation();
|
|
90975
|
+
const linkClickEvent = new CustomEvent("superdoc-link-click", {
|
|
90976
|
+
bubbles: true,
|
|
90977
|
+
composed: true,
|
|
90978
|
+
detail: {
|
|
90979
|
+
href,
|
|
90980
|
+
target: linkEl.getAttribute("target"),
|
|
90981
|
+
rel: linkEl.getAttribute("rel"),
|
|
90982
|
+
tooltip: linkEl.getAttribute("title"),
|
|
90983
|
+
element: linkEl,
|
|
90984
|
+
clientX: event.clientX,
|
|
90985
|
+
clientY: event.clientY
|
|
90986
|
+
}
|
|
90987
|
+
});
|
|
90988
|
+
linkEl.dispatchEvent(linkClickEvent);
|
|
90989
|
+
return;
|
|
90740
90990
|
}
|
|
90741
90991
|
const isDraggableAnnotation = target?.closest?.('[data-draggable="true"]') != null;
|
|
90742
90992
|
if (!__privateGet$1(this, _layoutState).layout) {
|
|
@@ -90834,6 +91084,44 @@ ${l}
|
|
|
90834
91084
|
__privateGet$1(this, _layoutState).measures,
|
|
90835
91085
|
hit.pos
|
|
90836
91086
|
);
|
|
91087
|
+
const targetImg = event.target?.closest?.("img");
|
|
91088
|
+
const imgPmStart = targetImg?.dataset?.pmStart ? Number(targetImg.dataset.pmStart) : null;
|
|
91089
|
+
if (!Number.isNaN(imgPmStart) && imgPmStart != null) {
|
|
91090
|
+
const doc222 = __privateGet$1(this, _editor3).state.doc;
|
|
91091
|
+
if (imgPmStart < 0 || imgPmStart >= doc222.content.size) {
|
|
91092
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
91093
|
+
console.warn(
|
|
91094
|
+
`[PresentationEditor] Invalid position ${imgPmStart} for inline image (document size: ${doc222.content.size})`
|
|
91095
|
+
);
|
|
91096
|
+
}
|
|
91097
|
+
return;
|
|
91098
|
+
}
|
|
91099
|
+
const newSelectionId = `inline-${imgPmStart}`;
|
|
91100
|
+
if (__privateGet$1(this, _lastSelectedImageBlockId) && __privateGet$1(this, _lastSelectedImageBlockId) !== newSelectionId) {
|
|
91101
|
+
this.emit("imageDeselected", { blockId: __privateGet$1(this, _lastSelectedImageBlockId) });
|
|
91102
|
+
}
|
|
91103
|
+
try {
|
|
91104
|
+
const tr = __privateGet$1(this, _editor3).state.tr.setSelection(NodeSelection.create(doc222, imgPmStart));
|
|
91105
|
+
__privateGet$1(this, _editor3).view?.dispatch(tr);
|
|
91106
|
+
const selector = `.superdoc-inline-image[data-pm-start="${imgPmStart}"]`;
|
|
91107
|
+
const targetElement = __privateGet$1(this, _viewportHost).querySelector(selector);
|
|
91108
|
+
this.emit("imageSelected", {
|
|
91109
|
+
element: targetElement ?? targetImg,
|
|
91110
|
+
blockId: null,
|
|
91111
|
+
pmStart: imgPmStart
|
|
91112
|
+
});
|
|
91113
|
+
__privateSet(this, _lastSelectedImageBlockId, newSelectionId);
|
|
91114
|
+
} catch (error) {
|
|
91115
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
91116
|
+
console.warn(
|
|
91117
|
+
`[PresentationEditor] Failed to create NodeSelection for inline image at position ${imgPmStart}:`,
|
|
91118
|
+
error
|
|
91119
|
+
);
|
|
91120
|
+
}
|
|
91121
|
+
}
|
|
91122
|
+
__privateMethod$1(this, _PresentationEditor_instances, focusEditorAfterImageSelection_fn).call(this);
|
|
91123
|
+
return;
|
|
91124
|
+
}
|
|
90837
91125
|
if (fragmentHit && (fragmentHit.fragment.kind === "image" || fragmentHit.fragment.kind === "drawing")) {
|
|
90838
91126
|
const doc222 = __privateGet$1(this, _editor3).state.doc;
|
|
90839
91127
|
try {
|
|
@@ -90860,15 +91148,7 @@ ${l}
|
|
|
90860
91148
|
console.warn("[PresentationEditor] Failed to create NodeSelection for atomic fragment:", error);
|
|
90861
91149
|
}
|
|
90862
91150
|
}
|
|
90863
|
-
__privateMethod$1(this, _PresentationEditor_instances,
|
|
90864
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
90865
|
-
document.activeElement.blur();
|
|
90866
|
-
}
|
|
90867
|
-
const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
|
|
90868
|
-
if (editorDom2) {
|
|
90869
|
-
editorDom2.focus();
|
|
90870
|
-
__privateGet$1(this, _editor3).view?.focus();
|
|
90871
|
-
}
|
|
91151
|
+
__privateMethod$1(this, _PresentationEditor_instances, focusEditorAfterImageSelection_fn).call(this);
|
|
90872
91152
|
return;
|
|
90873
91153
|
}
|
|
90874
91154
|
if (__privateGet$1(this, _lastSelectedImageBlockId)) {
|
|
@@ -91441,6 +91721,47 @@ ${l}
|
|
|
91441
91721
|
get overlayElement() {
|
|
91442
91722
|
return __privateGet$1(this, _selectionOverlay2) ?? null;
|
|
91443
91723
|
}
|
|
91724
|
+
/**
|
|
91725
|
+
* Get the current zoom level.
|
|
91726
|
+
*
|
|
91727
|
+
* The zoom level is a multiplier that controls the visual scale of the document.
|
|
91728
|
+
* This value is applied via CSS transform: scale() on the #viewportHost element,
|
|
91729
|
+
* which ensures consistent scaling between rendered content and overlay elements
|
|
91730
|
+
* (selections, cursors, interactive handles).
|
|
91731
|
+
*
|
|
91732
|
+
* Relationship to Centralized Zoom Architecture:
|
|
91733
|
+
* - PresentationEditor is the SINGLE SOURCE OF TRUTH for zoom state
|
|
91734
|
+
* - Zoom is applied internally via transform: scale() on #viewportHost
|
|
91735
|
+
* - External components (toolbar, UI controls) should use setZoom() to modify zoom
|
|
91736
|
+
* - The zoom value is used throughout the system for coordinate transformations
|
|
91737
|
+
*
|
|
91738
|
+
* Coordinate Space Implications:
|
|
91739
|
+
* - Layout coordinates: Unscaled logical pixels used by the layout engine
|
|
91740
|
+
* - Screen coordinates: Physical pixels affected by CSS transform: scale()
|
|
91741
|
+
* - Conversion: screenCoord = layoutCoord * zoom
|
|
91742
|
+
*
|
|
91743
|
+
* Zoom Scale:
|
|
91744
|
+
* - 1 = 100% (default, no scaling)
|
|
91745
|
+
* - 0.5 = 50% (zoomed out, content appears smaller)
|
|
91746
|
+
* - 2 = 200% (zoomed in, content appears larger)
|
|
91747
|
+
*
|
|
91748
|
+
* @returns The current zoom level multiplier (default: 1 if not configured)
|
|
91749
|
+
*
|
|
91750
|
+
* @example
|
|
91751
|
+
* ```typescript
|
|
91752
|
+
* const zoom = presentation.zoom;
|
|
91753
|
+
* // Convert layout coordinates to screen coordinates
|
|
91754
|
+
* const screenX = layoutX * zoom;
|
|
91755
|
+
* const screenY = layoutY * zoom;
|
|
91756
|
+
*
|
|
91757
|
+
* // Convert screen coordinates back to layout coordinates
|
|
91758
|
+
* const layoutX = screenX / zoom;
|
|
91759
|
+
* const layoutY = screenY / zoom;
|
|
91760
|
+
* ```
|
|
91761
|
+
*/
|
|
91762
|
+
get zoom() {
|
|
91763
|
+
return __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
91764
|
+
}
|
|
91444
91765
|
/**
|
|
91445
91766
|
* Set the document mode and update editor editability.
|
|
91446
91767
|
*
|
|
@@ -91631,8 +91952,8 @@ ${l}
|
|
|
91631
91952
|
const pageLocalY = rect.y - rect.pageIndex * pageHeight;
|
|
91632
91953
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
|
|
91633
91954
|
if (!coords) return null;
|
|
91634
|
-
const absLeft = coords.x + overlayRect.left;
|
|
91635
|
-
const absTop = coords.y + overlayRect.top;
|
|
91955
|
+
const absLeft = coords.x * zoom + overlayRect.left;
|
|
91956
|
+
const absTop = coords.y * zoom + overlayRect.top;
|
|
91636
91957
|
const left2 = relativeRect ? absLeft - relativeRect.left : absLeft;
|
|
91637
91958
|
const top2 = relativeRect ? absTop - relativeRect.top : absTop;
|
|
91638
91959
|
const width = Math.max(1, rect.width * zoom);
|
|
@@ -92530,6 +92851,10 @@ ${l}
|
|
|
92530
92851
|
const visibleClientIds = /* @__PURE__ */ new Set();
|
|
92531
92852
|
sortedCursors.forEach((cursor) => {
|
|
92532
92853
|
visibleClientIds.add(cursor.clientId);
|
|
92854
|
+
const oldSelections = __privateGet$1(this, _remoteCursorOverlay)?.querySelectorAll(
|
|
92855
|
+
`.presentation-editor__remote-selection[data-client-id="${cursor.clientId}"]`
|
|
92856
|
+
);
|
|
92857
|
+
oldSelections?.forEach((el) => el.remove());
|
|
92533
92858
|
if (cursor.anchor === cursor.head) {
|
|
92534
92859
|
__privateMethod$1(this, _PresentationEditor_instances, renderRemoteCaret_fn).call(this, cursor);
|
|
92535
92860
|
} else {
|
|
@@ -92545,7 +92870,7 @@ ${l}
|
|
|
92545
92870
|
};
|
|
92546
92871
|
renderRemoteCaret_fn = function(cursor) {
|
|
92547
92872
|
const caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, cursor.head);
|
|
92548
|
-
|
|
92873
|
+
__privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
92549
92874
|
const doc2 = __privateGet$1(this, _visibleHost).ownerDocument ?? document;
|
|
92550
92875
|
const color2 = __privateMethod$1(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
92551
92876
|
let caretEl = __privateGet$1(this, _remoteCursorElements).get(cursor.clientId);
|
|
@@ -92578,7 +92903,7 @@ ${l}
|
|
|
92578
92903
|
}
|
|
92579
92904
|
caretEl.style.opacity = "1";
|
|
92580
92905
|
caretEl.style.transform = `translate(${coords.x}px, ${coords.y}px)`;
|
|
92581
|
-
caretEl.style.height = `${Math.max(1, caretLayout.height
|
|
92906
|
+
caretEl.style.height = `${Math.max(1, caretLayout.height)}px`;
|
|
92582
92907
|
caretEl.style.borderLeftColor = color2;
|
|
92583
92908
|
const labelEl = caretEl.querySelector(".presentation-editor__remote-label");
|
|
92584
92909
|
if (labelEl) {
|
|
@@ -92618,7 +92943,6 @@ ${l}
|
|
|
92618
92943
|
const end2 = Math.max(cursor.anchor, cursor.head);
|
|
92619
92944
|
const rects = selectionToRects(layout, blocks2, measures, start2, end2) ?? [];
|
|
92620
92945
|
const color2 = __privateMethod$1(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
92621
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
92622
92946
|
const opacity = __privateGet$1(this, _layoutOptions).presence?.highlightOpacity ?? 0.35;
|
|
92623
92947
|
const pageHeight = layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
92624
92948
|
const doc2 = __privateGet$1(this, _visibleHost).ownerDocument ?? document;
|
|
@@ -92632,8 +92956,8 @@ ${l}
|
|
|
92632
92956
|
selectionEl.style.position = "absolute";
|
|
92633
92957
|
selectionEl.style.left = `${coords.x}px`;
|
|
92634
92958
|
selectionEl.style.top = `${coords.y}px`;
|
|
92635
|
-
selectionEl.style.width = `${Math.max(1, rect.width
|
|
92636
|
-
selectionEl.style.height = `${Math.max(1, rect.height
|
|
92959
|
+
selectionEl.style.width = `${Math.max(1, rect.width)}px`;
|
|
92960
|
+
selectionEl.style.height = `${Math.max(1, rect.height)}px`;
|
|
92637
92961
|
selectionEl.style.backgroundColor = color2;
|
|
92638
92962
|
selectionEl.style.opacity = opacity.toString();
|
|
92639
92963
|
selectionEl.style.borderRadius = _PresentationEditor.CURSOR_STYLES.SELECTION_BORDER_RADIUS;
|
|
@@ -92743,6 +93067,17 @@ ${l}
|
|
|
92743
93067
|
}
|
|
92744
93068
|
}));
|
|
92745
93069
|
};
|
|
93070
|
+
focusEditorAfterImageSelection_fn = function() {
|
|
93071
|
+
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
93072
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
93073
|
+
document.activeElement.blur();
|
|
93074
|
+
}
|
|
93075
|
+
const editorDom = __privateGet$1(this, _editor3).view?.dom;
|
|
93076
|
+
if (editorDom) {
|
|
93077
|
+
editorDom.focus();
|
|
93078
|
+
__privateGet$1(this, _editor3).view?.focus();
|
|
93079
|
+
}
|
|
93080
|
+
};
|
|
92746
93081
|
setupInputBridge_fn = function() {
|
|
92747
93082
|
__privateGet$1(this, _inputBridge)?.destroy();
|
|
92748
93083
|
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
@@ -93166,6 +93501,9 @@ ${l}
|
|
|
93166
93501
|
if (__privateGet$1(this, _selectionUpdateScheduled)) {
|
|
93167
93502
|
return;
|
|
93168
93503
|
}
|
|
93504
|
+
if (__privateGet$1(this, _isRerendering) || __privateGet$1(this, _pendingDocChange)) {
|
|
93505
|
+
return;
|
|
93506
|
+
}
|
|
93169
93507
|
__privateSet(this, _selectionUpdateScheduled, true);
|
|
93170
93508
|
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
93171
93509
|
win.requestAnimationFrame(() => {
|
|
@@ -93181,13 +93519,26 @@ ${l}
|
|
|
93181
93519
|
return;
|
|
93182
93520
|
}
|
|
93183
93521
|
if (__privateGet$1(this, _documentMode) === "viewing") {
|
|
93184
|
-
|
|
93522
|
+
try {
|
|
93523
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
93524
|
+
} catch (error) {
|
|
93525
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
93526
|
+
console.warn("[PresentationEditor] Failed to clear selection layer in viewing mode:", error);
|
|
93527
|
+
}
|
|
93528
|
+
}
|
|
93185
93529
|
return;
|
|
93186
93530
|
}
|
|
93187
93531
|
const layout = __privateGet$1(this, _layoutState).layout;
|
|
93188
|
-
const
|
|
93189
|
-
|
|
93532
|
+
const editorState = this.getActiveEditor().state;
|
|
93533
|
+
const selection = editorState?.selection;
|
|
93190
93534
|
if (!selection) {
|
|
93535
|
+
try {
|
|
93536
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
93537
|
+
} catch (error) {
|
|
93538
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
93539
|
+
console.warn("[PresentationEditor] Failed to clear selection layer (no selection):", error);
|
|
93540
|
+
}
|
|
93541
|
+
}
|
|
93191
93542
|
return;
|
|
93192
93543
|
}
|
|
93193
93544
|
if (!layout) {
|
|
@@ -93195,15 +93546,40 @@ ${l}
|
|
|
93195
93546
|
}
|
|
93196
93547
|
const { from: from2, to } = selection;
|
|
93197
93548
|
if (from2 === to) {
|
|
93198
|
-
|
|
93549
|
+
let caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2);
|
|
93550
|
+
const doc2 = editorState?.doc;
|
|
93551
|
+
if (!doc2) {
|
|
93552
|
+
return;
|
|
93553
|
+
}
|
|
93554
|
+
const docSize = doc2.content?.size ?? 0;
|
|
93555
|
+
if (!caretLayout && from2 > 0) {
|
|
93556
|
+
caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2 - 1);
|
|
93557
|
+
}
|
|
93558
|
+
if (!caretLayout && from2 + 1 <= docSize) {
|
|
93559
|
+
caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2 + 1);
|
|
93560
|
+
}
|
|
93199
93561
|
if (!caretLayout) {
|
|
93200
93562
|
return;
|
|
93201
93563
|
}
|
|
93202
|
-
|
|
93564
|
+
try {
|
|
93565
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
93566
|
+
__privateMethod$1(this, _PresentationEditor_instances, renderCaretOverlay_fn).call(this, caretLayout);
|
|
93567
|
+
} catch (error) {
|
|
93568
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
93569
|
+
console.warn("[PresentationEditor] Failed to render caret overlay:", error);
|
|
93570
|
+
}
|
|
93571
|
+
}
|
|
93203
93572
|
return;
|
|
93204
93573
|
}
|
|
93205
93574
|
const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, from2, to) ?? [];
|
|
93206
|
-
|
|
93575
|
+
try {
|
|
93576
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
93577
|
+
__privateMethod$1(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this, rects);
|
|
93578
|
+
} catch (error) {
|
|
93579
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
93580
|
+
console.warn("[PresentationEditor] Failed to render selection rects:", error);
|
|
93581
|
+
}
|
|
93582
|
+
}
|
|
93207
93583
|
};
|
|
93208
93584
|
resolveLayoutOptions_fn = function(blocks2, sectionMetadata) {
|
|
93209
93585
|
const defaults2 = __privateMethod$1(this, _PresentationEditor_instances, computeDefaultLayoutDefaults_fn).call(this);
|
|
@@ -93949,7 +94325,6 @@ ${l}
|
|
|
93949
94325
|
return;
|
|
93950
94326
|
}
|
|
93951
94327
|
const pageHeight = __privateMethod$1(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
93952
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
93953
94328
|
rects.forEach((rect, _index) => {
|
|
93954
94329
|
const pageLocalY = rect.y - rect.pageIndex * pageHeight;
|
|
93955
94330
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
|
|
@@ -93964,8 +94339,8 @@ ${l}
|
|
|
93964
94339
|
highlight.style.position = "absolute";
|
|
93965
94340
|
highlight.style.left = `${coords.x}px`;
|
|
93966
94341
|
highlight.style.top = `${coords.y}px`;
|
|
93967
|
-
highlight.style.width = `${Math.max(1, rect.width
|
|
93968
|
-
highlight.style.height = `${Math.max(1, rect.height
|
|
94342
|
+
highlight.style.width = `${Math.max(1, rect.width)}px`;
|
|
94343
|
+
highlight.style.height = `${Math.max(1, rect.height)}px`;
|
|
93969
94344
|
highlight.style.backgroundColor = "rgba(51, 132, 255, 0.35)";
|
|
93970
94345
|
highlight.style.borderRadius = "2px";
|
|
93971
94346
|
highlight.style.pointerEvents = "none";
|
|
@@ -93974,7 +94349,6 @@ ${l}
|
|
|
93974
94349
|
};
|
|
93975
94350
|
renderHoverRegion_fn = function(region) {
|
|
93976
94351
|
if (!__privateGet$1(this, _hoverOverlay) || !__privateGet$1(this, _hoverTooltip)) return;
|
|
93977
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
93978
94352
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, region.pageIndex, region.localX, region.localY);
|
|
93979
94353
|
if (!coords) {
|
|
93980
94354
|
__privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
|
|
@@ -93983,15 +94357,15 @@ ${l}
|
|
|
93983
94357
|
__privateGet$1(this, _hoverOverlay).style.display = "block";
|
|
93984
94358
|
__privateGet$1(this, _hoverOverlay).style.left = `${coords.x}px`;
|
|
93985
94359
|
__privateGet$1(this, _hoverOverlay).style.top = `${coords.y}px`;
|
|
93986
|
-
__privateGet$1(this, _hoverOverlay).style.width = `${region.width
|
|
93987
|
-
__privateGet$1(this, _hoverOverlay).style.height = `${region.height
|
|
94360
|
+
__privateGet$1(this, _hoverOverlay).style.width = `${region.width}px`;
|
|
94361
|
+
__privateGet$1(this, _hoverOverlay).style.height = `${region.height}px`;
|
|
93988
94362
|
const tooltipText = `Double-click to edit ${region.kind === "header" ? "header" : "footer"}`;
|
|
93989
94363
|
__privateGet$1(this, _hoverTooltip).textContent = tooltipText;
|
|
93990
94364
|
__privateGet$1(this, _hoverTooltip).style.display = "block";
|
|
93991
94365
|
__privateGet$1(this, _hoverTooltip).style.left = `${coords.x}px`;
|
|
93992
94366
|
const tooltipHeight = 24;
|
|
93993
94367
|
const spaceAbove = coords.y;
|
|
93994
|
-
const regionHeight = region.height
|
|
94368
|
+
const regionHeight = region.height;
|
|
93995
94369
|
const tooltipY = spaceAbove < tooltipHeight + 4 ? coords.y + regionHeight + 4 : coords.y - tooltipHeight;
|
|
93996
94370
|
__privateGet$1(this, _hoverTooltip).style.top = `${Math.max(0, tooltipY)}px`;
|
|
93997
94371
|
};
|
|
@@ -94008,11 +94382,11 @@ ${l}
|
|
|
94008
94382
|
if (!__privateGet$1(this, _localSelectionLayer)) {
|
|
94009
94383
|
return;
|
|
94010
94384
|
}
|
|
94011
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
94012
94385
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, caretLayout.pageIndex, caretLayout.x, caretLayout.y);
|
|
94013
94386
|
if (!coords) {
|
|
94014
94387
|
return;
|
|
94015
94388
|
}
|
|
94389
|
+
const finalHeight = Math.max(1, caretLayout.height);
|
|
94016
94390
|
const caretEl = __privateGet$1(this, _localSelectionLayer).ownerDocument?.createElement("div");
|
|
94017
94391
|
if (!caretEl) {
|
|
94018
94392
|
return;
|
|
@@ -94022,7 +94396,7 @@ ${l}
|
|
|
94022
94396
|
caretEl.style.left = `${coords.x}px`;
|
|
94023
94397
|
caretEl.style.top = `${coords.y}px`;
|
|
94024
94398
|
caretEl.style.width = "2px";
|
|
94025
|
-
caretEl.style.height = `${
|
|
94399
|
+
caretEl.style.height = `${finalHeight}px`;
|
|
94026
94400
|
caretEl.style.backgroundColor = "#3366FF";
|
|
94027
94401
|
caretEl.style.borderRadius = "1px";
|
|
94028
94402
|
caretEl.style.pointerEvents = "none";
|
|
@@ -94176,7 +94550,8 @@ ${l}
|
|
|
94176
94550
|
};
|
|
94177
94551
|
applyZoom_fn = function() {
|
|
94178
94552
|
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
94179
|
-
__privateGet$1(this,
|
|
94553
|
+
__privateGet$1(this, _viewportHost).style.transformOrigin = "top left";
|
|
94554
|
+
__privateGet$1(this, _viewportHost).style.transform = zoom === 1 ? "" : `scale(${zoom})`;
|
|
94180
94555
|
};
|
|
94181
94556
|
createLayoutMetrics_fn = function(perf, startMark, layout, blocks2) {
|
|
94182
94557
|
if (!perf || startMark == null || typeof perf.now !== "function") {
|
|
@@ -94190,20 +94565,28 @@ ${l}
|
|
|
94190
94565
|
};
|
|
94191
94566
|
};
|
|
94192
94567
|
convertPageLocalToOverlayCoords_fn = function(pageIndex, pageLocalX, pageLocalY) {
|
|
94193
|
-
|
|
94194
|
-
|
|
94195
|
-
|
|
94196
|
-
|
|
94568
|
+
if (!Number.isFinite(pageIndex) || pageIndex < 0) {
|
|
94569
|
+
console.warn(
|
|
94570
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageIndex ${pageIndex}. Expected a finite non-negative number.`
|
|
94571
|
+
);
|
|
94197
94572
|
return null;
|
|
94198
94573
|
}
|
|
94199
|
-
|
|
94200
|
-
|
|
94201
|
-
|
|
94202
|
-
|
|
94203
|
-
|
|
94574
|
+
if (!Number.isFinite(pageLocalX)) {
|
|
94575
|
+
console.warn(
|
|
94576
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageLocalX ${pageLocalX}. Expected a finite number.`
|
|
94577
|
+
);
|
|
94578
|
+
return null;
|
|
94579
|
+
}
|
|
94580
|
+
if (!Number.isFinite(pageLocalY)) {
|
|
94581
|
+
console.warn(
|
|
94582
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageLocalY ${pageLocalY}. Expected a finite number.`
|
|
94583
|
+
);
|
|
94584
|
+
return null;
|
|
94585
|
+
}
|
|
94586
|
+
const pageHeight = __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
94204
94587
|
return {
|
|
94205
|
-
x:
|
|
94206
|
-
y:
|
|
94588
|
+
x: pageLocalX,
|
|
94589
|
+
y: pageIndex * pageHeight + pageLocalY
|
|
94207
94590
|
};
|
|
94208
94591
|
};
|
|
94209
94592
|
normalizeClientPoint_fn = function(clientX, clientY) {
|
|
@@ -108868,7 +109251,8 @@ ${l}
|
|
|
108868
109251
|
},
|
|
108869
109252
|
addShortcuts() {
|
|
108870
109253
|
return {
|
|
108871
|
-
"Mod-Shift-
|
|
109254
|
+
"Mod-Shift-x": () => this.editor.commands.toggleStrike(),
|
|
109255
|
+
"Mod-Shift-X": () => this.editor.commands.toggleStrike()
|
|
108872
109256
|
};
|
|
108873
109257
|
}
|
|
108874
109258
|
});
|
|
@@ -126866,16 +127250,6 @@ ${style2}
|
|
|
126866
127250
|
if (!argument) return;
|
|
126867
127251
|
item.onActivate({ zoom: argument });
|
|
126868
127252
|
this.emit("superdoc-command", { item, argument });
|
|
126869
|
-
const layers = this.superdoc.element?.querySelector(".layers");
|
|
126870
|
-
if (!layers) return;
|
|
126871
|
-
const isMobileDevice = typeof screen.orientation !== "undefined";
|
|
126872
|
-
const isSmallScreen = window.matchMedia("(max-width: 834px)").matches;
|
|
126873
|
-
if (isMobileDevice && isSmallScreen) {
|
|
126874
|
-
layers.style.transformOrigin = "0 0";
|
|
126875
|
-
layers.style.transform = `scale(${parseInt(argument, 10) / 100})`;
|
|
126876
|
-
} else {
|
|
126877
|
-
layers.style.zoom = parseInt(argument, 10) / 100;
|
|
126878
|
-
}
|
|
126879
127253
|
this.superdoc.superdocStore.activeZoom = parseInt(argument, 10);
|
|
126880
127254
|
},
|
|
126881
127255
|
/**
|
|
@@ -129119,6 +129493,19 @@ ${style2}
|
|
|
129119
129493
|
const emit2 = __emit;
|
|
129120
129494
|
const overlayRect = ref(null);
|
|
129121
129495
|
const tableMetadata = ref(null);
|
|
129496
|
+
const getZoom = () => {
|
|
129497
|
+
const editor = props.editor;
|
|
129498
|
+
if (editor && typeof editor.zoom === "number") {
|
|
129499
|
+
return editor.zoom;
|
|
129500
|
+
}
|
|
129501
|
+
if (editor?.presentationEditor && typeof editor.presentationEditor.zoom === "number") {
|
|
129502
|
+
return editor.presentationEditor.zoom;
|
|
129503
|
+
}
|
|
129504
|
+
console.warn(
|
|
129505
|
+
"[TableResizeOverlay] getZoom: Unable to retrieve zoom from editor instance, using fallback value of 1. This may indicate the editor is not fully initialized or is not a PresentationEditor instance. Table resize handles may be misaligned."
|
|
129506
|
+
);
|
|
129507
|
+
return 1;
|
|
129508
|
+
};
|
|
129122
129509
|
const dragState = ref(null);
|
|
129123
129510
|
const forcedCleanup = ref(false);
|
|
129124
129511
|
let rafId = null;
|
|
@@ -129228,12 +129615,16 @@ ${style2}
|
|
|
129228
129615
|
}));
|
|
129229
129616
|
}
|
|
129230
129617
|
function getSegmentHandleStyle(boundary, segment) {
|
|
129618
|
+
const zoom = getZoom();
|
|
129619
|
+
const scaledX = boundary.x * zoom;
|
|
129620
|
+
const scaledY = segment.y != null ? segment.y * zoom : null;
|
|
129621
|
+
const scaledH = segment.h != null ? segment.h * zoom : null;
|
|
129231
129622
|
return {
|
|
129232
129623
|
position: "absolute",
|
|
129233
|
-
left: `${
|
|
129234
|
-
top:
|
|
129624
|
+
left: `${scaledX}px`,
|
|
129625
|
+
top: scaledY != null ? `${scaledY}px` : "0",
|
|
129235
129626
|
width: `${RESIZE_HANDLE_WIDTH_PX}px`,
|
|
129236
|
-
height:
|
|
129627
|
+
height: scaledH != null ? `${scaledH}px` : "100%",
|
|
129237
129628
|
transform: `translateX(-${RESIZE_HANDLE_OFFSET_PX}px)`,
|
|
129238
129629
|
cursor: "col-resize",
|
|
129239
129630
|
pointerEvents: "auto"
|
|
@@ -129243,7 +129634,8 @@ ${style2}
|
|
|
129243
129634
|
if (!dragState.value || !tableMetadata.value) return { display: "none" };
|
|
129244
129635
|
const initialBoundary = resizableBoundaries.value[dragState.value.resizableBoundaryIndex];
|
|
129245
129636
|
if (!initialBoundary) return { display: "none" };
|
|
129246
|
-
const
|
|
129637
|
+
const zoom = getZoom();
|
|
129638
|
+
const newX = (initialBoundary.x + dragState.value.constrainedDelta) * zoom;
|
|
129247
129639
|
return {
|
|
129248
129640
|
position: "absolute",
|
|
129249
129641
|
left: `${newX}px`,
|
|
@@ -129371,7 +129763,9 @@ ${style2}
|
|
|
129371
129763
|
}
|
|
129372
129764
|
const mouseMoveThrottle = throttle2((event) => {
|
|
129373
129765
|
if (isUnmounted || !dragState.value) return;
|
|
129374
|
-
const
|
|
129766
|
+
const zoom = getZoom();
|
|
129767
|
+
const screenDelta = event.clientX - dragState.value.initialX;
|
|
129768
|
+
const delta = screenDelta / zoom;
|
|
129375
129769
|
const minDelta = -(dragState.value.leftColumn.width - dragState.value.leftColumn.minWidth);
|
|
129376
129770
|
let maxDelta;
|
|
129377
129771
|
if (dragState.value.isRightEdge) {
|
|
@@ -129382,7 +129776,7 @@ ${style2}
|
|
|
129382
129776
|
const tableLeftInPage = tableRect.left - pageRect.left;
|
|
129383
129777
|
const rightMargin = tableLeftInPage;
|
|
129384
129778
|
const maxRightPosition = pageRect.right - rightMargin;
|
|
129385
|
-
const availableSpace = maxRightPosition - tableRect.right;
|
|
129779
|
+
const availableSpace = (maxRightPosition - tableRect.right) / zoom;
|
|
129386
129780
|
maxDelta = Math.max(0, availableSpace);
|
|
129387
129781
|
} else {
|
|
129388
129782
|
maxDelta = Infinity;
|
|
@@ -129618,7 +130012,7 @@ ${style2}
|
|
|
129618
130012
|
};
|
|
129619
130013
|
}
|
|
129620
130014
|
};
|
|
129621
|
-
const TableResizeOverlay = /* @__PURE__ */ _export_sfc$1(_sfc_main$4$1, [["__scopeId", "data-v-
|
|
130015
|
+
const TableResizeOverlay = /* @__PURE__ */ _export_sfc$1(_sfc_main$4$1, [["__scopeId", "data-v-814384b6"]]);
|
|
129622
130016
|
const _hoisted_1$2$1 = ["data-handle-position", "onMousedown"];
|
|
129623
130017
|
const OVERLAY_EXPANSION_PX = 2e3;
|
|
129624
130018
|
const RESIZE_HANDLE_SIZE_PX = 12;
|
|
@@ -130052,6 +130446,8 @@ ${style2}
|
|
|
130052
130446
|
}
|
|
130053
130447
|
};
|
|
130054
130448
|
const ImageResizeOverlay = /* @__PURE__ */ _export_sfc$1(_sfc_main$3$1, [["__scopeId", "data-v-e66ec7bb"]]);
|
|
130449
|
+
const LINK_CLICK_DEBOUNCE_MS = 300;
|
|
130450
|
+
const CURSOR_UPDATE_TIMEOUT_MS = 10;
|
|
130055
130451
|
const _sfc_main$2$1 = {
|
|
130056
130452
|
__name: "LinkClickHandler",
|
|
130057
130453
|
props: {
|
|
@@ -130074,7 +130470,15 @@ ${style2}
|
|
|
130074
130470
|
},
|
|
130075
130471
|
setup(__props) {
|
|
130076
130472
|
const props = __props;
|
|
130473
|
+
let lastLinkClickTime = 0;
|
|
130077
130474
|
const handleLinkClick = (event) => {
|
|
130475
|
+
const detail = event?.detail ?? {};
|
|
130476
|
+
const linkElement = detail.element;
|
|
130477
|
+
const now = Date.now();
|
|
130478
|
+
if (now - lastLinkClickTime < LINK_CLICK_DEBOUNCE_MS) {
|
|
130479
|
+
return;
|
|
130480
|
+
}
|
|
130481
|
+
lastLinkClickTime = now;
|
|
130078
130482
|
if (props.popoverVisible) {
|
|
130079
130483
|
props.closePopover();
|
|
130080
130484
|
return;
|
|
@@ -130086,12 +130490,34 @@ ${style2}
|
|
|
130086
130490
|
if (!surface) {
|
|
130087
130491
|
return;
|
|
130088
130492
|
}
|
|
130089
|
-
const
|
|
130090
|
-
|
|
130493
|
+
const pmStart = linkElement?.dataset?.pmStart;
|
|
130494
|
+
if (pmStart != null) {
|
|
130495
|
+
const pos = parseInt(pmStart, 10);
|
|
130496
|
+
const state2 = props.editor.state;
|
|
130497
|
+
const doc2 = state2.doc;
|
|
130498
|
+
if (!isNaN(pos) && pos >= 0 && pos <= doc2.content.size) {
|
|
130499
|
+
const tr = state2.tr.setSelection(TextSelection$1.create(doc2, pos));
|
|
130500
|
+
props.editor.dispatch(tr);
|
|
130501
|
+
} else {
|
|
130502
|
+
console.warn(`Invalid PM position from data-pm-start: ${pmStart}, falling back to coordinate-based positioning`);
|
|
130503
|
+
moveCursorToMouseEvent(detail, props.editor);
|
|
130504
|
+
}
|
|
130505
|
+
} else {
|
|
130506
|
+
moveCursorToMouseEvent(detail, props.editor);
|
|
130507
|
+
}
|
|
130091
130508
|
setTimeout(() => {
|
|
130092
130509
|
const currentState = props.editor.state;
|
|
130510
|
+
const $from = currentState.selection.$from;
|
|
130511
|
+
const linkMarkType = currentState.schema.marks.link;
|
|
130512
|
+
const nodeAfter = $from.nodeAfter;
|
|
130513
|
+
const nodeBefore = $from.nodeBefore;
|
|
130514
|
+
const marksOnNodeAfter = nodeAfter?.marks || [];
|
|
130515
|
+
const marksOnNodeBefore = nodeBefore?.marks || [];
|
|
130516
|
+
const linkOnNodeAfter = linkMarkType && marksOnNodeAfter.some((m2) => m2.type === linkMarkType);
|
|
130517
|
+
const linkOnNodeBefore = linkMarkType && marksOnNodeBefore.some((m2) => m2.type === linkMarkType);
|
|
130518
|
+
const hasLinkAdjacent = linkOnNodeAfter || linkOnNodeBefore;
|
|
130093
130519
|
const hasLink = selectionHasNodeOrMark(currentState, "link", { requireEnds: true });
|
|
130094
|
-
if (hasLink) {
|
|
130520
|
+
if (hasLink || hasLinkAdjacent) {
|
|
130095
130521
|
const surfaceRect = surface.getBoundingClientRect();
|
|
130096
130522
|
if (!surfaceRect) return;
|
|
130097
130523
|
props.openPopover(
|
|
@@ -130107,7 +130533,7 @@ ${style2}
|
|
|
130107
130533
|
}
|
|
130108
130534
|
);
|
|
130109
130535
|
}
|
|
130110
|
-
},
|
|
130536
|
+
}, CURSOR_UPDATE_TIMEOUT_MS);
|
|
130111
130537
|
};
|
|
130112
130538
|
let surfaceElement = null;
|
|
130113
130539
|
onMounted(() => {
|
|
@@ -130153,7 +130579,7 @@ ${style2}
|
|
|
130153
130579
|
const DOCX$1 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
130154
130580
|
const TABLE_RESIZE_HOVER_THRESHOLD = 8;
|
|
130155
130581
|
const TABLE_RESIZE_THROTTLE_MS = 16;
|
|
130156
|
-
const _sfc_main$1$1 = {
|
|
130582
|
+
const _sfc_main$1$1 = /* @__PURE__ */ defineComponent({
|
|
130157
130583
|
__name: "SuperEditor",
|
|
130158
130584
|
props: {
|
|
130159
130585
|
documentId: {
|
|
@@ -130222,6 +130648,24 @@ ${style2}
|
|
|
130222
130648
|
imageElement: null,
|
|
130223
130649
|
blockId: null
|
|
130224
130650
|
});
|
|
130651
|
+
const selectedImageState = reactive({
|
|
130652
|
+
element: null,
|
|
130653
|
+
blockId: null,
|
|
130654
|
+
pmStart: null
|
|
130655
|
+
});
|
|
130656
|
+
const getEditorZoom = () => {
|
|
130657
|
+
const active = activeEditor.value;
|
|
130658
|
+
if (active && typeof active.zoom === "number") {
|
|
130659
|
+
return active.zoom;
|
|
130660
|
+
}
|
|
130661
|
+
if (active?.presentationEditor && typeof active.presentationEditor.zoom === "number") {
|
|
130662
|
+
return active.presentationEditor.zoom;
|
|
130663
|
+
}
|
|
130664
|
+
console.warn(
|
|
130665
|
+
"[SuperEditor] getEditorZoom: Unable to retrieve zoom from editor instance, using fallback value of 1. This may indicate the editor is not fully initialized or is not a PresentationEditor instance."
|
|
130666
|
+
);
|
|
130667
|
+
return 1;
|
|
130668
|
+
};
|
|
130225
130669
|
let lastUpdateTableResizeTimestamp = 0;
|
|
130226
130670
|
const isNearColumnBoundary = (event, tableElement) => {
|
|
130227
130671
|
if (!event || typeof event.clientX !== "number" || typeof event.clientY !== "number") {
|
|
@@ -130237,13 +130681,26 @@ ${style2}
|
|
|
130237
130681
|
try {
|
|
130238
130682
|
const metadata = JSON.parse(boundariesAttr);
|
|
130239
130683
|
if (!metadata.columns || !Array.isArray(metadata.columns)) return false;
|
|
130684
|
+
const zoom = getEditorZoom();
|
|
130240
130685
|
const tableRect = tableElement.getBoundingClientRect();
|
|
130241
|
-
const
|
|
130242
|
-
const
|
|
130686
|
+
const mouseXScreen = event.clientX - tableRect.left;
|
|
130687
|
+
const mouseYScreen = event.clientY - tableRect.top;
|
|
130243
130688
|
for (let i2 = 0; i2 < metadata.columns.length; i2++) {
|
|
130244
130689
|
const col = metadata.columns[i2];
|
|
130245
|
-
|
|
130246
|
-
|
|
130690
|
+
if (!col || typeof col !== "object") {
|
|
130691
|
+
console.warn(`[isNearColumnBoundary] Invalid column at index ${i2}: not an object`, col);
|
|
130692
|
+
continue;
|
|
130693
|
+
}
|
|
130694
|
+
if (typeof col.x !== "number" || !Number.isFinite(col.x)) {
|
|
130695
|
+
console.warn(`[isNearColumnBoundary] Invalid column.x at index ${i2}:`, col.x);
|
|
130696
|
+
continue;
|
|
130697
|
+
}
|
|
130698
|
+
if (typeof col.w !== "number" || !Number.isFinite(col.w) || col.w <= 0) {
|
|
130699
|
+
console.warn(`[isNearColumnBoundary] Invalid column.w at index ${i2}:`, col.w);
|
|
130700
|
+
continue;
|
|
130701
|
+
}
|
|
130702
|
+
const boundaryXScreen = (col.x + col.w) * zoom;
|
|
130703
|
+
if (Math.abs(mouseXScreen - boundaryXScreen) <= TABLE_RESIZE_HOVER_THRESHOLD) {
|
|
130247
130704
|
const segmentColIndex = i2 + 1;
|
|
130248
130705
|
const segments = metadata.segments?.[segmentColIndex];
|
|
130249
130706
|
if (!segments || segments.length === 0) {
|
|
@@ -130251,15 +130708,15 @@ ${style2}
|
|
|
130251
130708
|
continue;
|
|
130252
130709
|
}
|
|
130253
130710
|
for (const seg of segments) {
|
|
130254
|
-
const
|
|
130255
|
-
const
|
|
130256
|
-
if (
|
|
130711
|
+
const segTopScreen = (seg.y || 0) * zoom;
|
|
130712
|
+
const segBottomScreen = seg.h != null ? segTopScreen + seg.h * zoom : tableRect.height;
|
|
130713
|
+
if (mouseYScreen >= segTopScreen && mouseYScreen <= segBottomScreen) {
|
|
130257
130714
|
return true;
|
|
130258
130715
|
}
|
|
130259
130716
|
}
|
|
130260
130717
|
}
|
|
130261
130718
|
}
|
|
130262
|
-
if (Math.abs(
|
|
130719
|
+
if (Math.abs(mouseXScreen) <= TABLE_RESIZE_HOVER_THRESHOLD) {
|
|
130263
130720
|
return true;
|
|
130264
130721
|
}
|
|
130265
130722
|
return false;
|
|
@@ -130323,6 +130780,27 @@ ${style2}
|
|
|
130323
130780
|
imageResizeState.imageElement = null;
|
|
130324
130781
|
imageResizeState.blockId = null;
|
|
130325
130782
|
};
|
|
130783
|
+
const clearSelectedImage = () => {
|
|
130784
|
+
if (selectedImageState.element?.classList?.contains("superdoc-image-selected")) {
|
|
130785
|
+
selectedImageState.element.classList.remove("superdoc-image-selected");
|
|
130786
|
+
}
|
|
130787
|
+
selectedImageState.element = null;
|
|
130788
|
+
selectedImageState.blockId = null;
|
|
130789
|
+
selectedImageState.pmStart = null;
|
|
130790
|
+
};
|
|
130791
|
+
const setSelectedImage = (element2, blockId, pmStart) => {
|
|
130792
|
+
if (selectedImageState.element && selectedImageState.element !== element2) {
|
|
130793
|
+
selectedImageState.element.classList.remove("superdoc-image-selected");
|
|
130794
|
+
}
|
|
130795
|
+
if (element2 && element2.classList) {
|
|
130796
|
+
element2.classList.add("superdoc-image-selected");
|
|
130797
|
+
selectedImageState.element = element2;
|
|
130798
|
+
selectedImageState.blockId = blockId ?? null;
|
|
130799
|
+
selectedImageState.pmStart = typeof pmStart === "number" ? pmStart : null;
|
|
130800
|
+
} else {
|
|
130801
|
+
clearSelectedImage();
|
|
130802
|
+
}
|
|
130803
|
+
};
|
|
130326
130804
|
const handleOverlayUpdates = (event) => {
|
|
130327
130805
|
updateTableResizeOverlay(event);
|
|
130328
130806
|
updateImageResizeOverlay(event);
|
|
@@ -130413,6 +130891,7 @@ ${style2}
|
|
|
130413
130891
|
const initEditor = async ({ content: content2, media: media2 = {}, mediaFiles = {}, fonts = {} } = {}) => {
|
|
130414
130892
|
const { editorCtor, ...editorOptions } = props.options || {};
|
|
130415
130893
|
const EditorCtor = editorCtor ?? Editor;
|
|
130894
|
+
clearSelectedImage();
|
|
130416
130895
|
editor.value = new EditorCtor({
|
|
130417
130896
|
mode: "docx",
|
|
130418
130897
|
element: editorElem.value,
|
|
@@ -130429,17 +130908,19 @@ ${style2}
|
|
|
130429
130908
|
editor: activeEditor.value,
|
|
130430
130909
|
presentationEditor: editor.value instanceof PresentationEditor ? editor.value : null
|
|
130431
130910
|
});
|
|
130432
|
-
editor.value.on("paginationUpdate", () => {
|
|
130433
|
-
const base2 = activeEditor.value;
|
|
130434
|
-
if (isHeadless(base2)) return;
|
|
130435
|
-
const paginationTarget = editor.value?.editor ? { value: base2 } : editor;
|
|
130436
|
-
adjustPaginationBreaks(editorElem, paginationTarget);
|
|
130437
|
-
});
|
|
130438
130911
|
if (editor.value instanceof PresentationEditor) {
|
|
130439
|
-
editor.value
|
|
130912
|
+
const presentationEditor = editor.value;
|
|
130913
|
+
presentationEditor.on("imageSelected", ({ element: element2, blockId, pmStart }) => {
|
|
130914
|
+
setSelectedImage(element2, blockId ?? null, pmStart);
|
|
130915
|
+
});
|
|
130916
|
+
presentationEditor.on("imageDeselected", () => {
|
|
130917
|
+
clearSelectedImage();
|
|
130918
|
+
});
|
|
130919
|
+
presentationEditor.on("layoutUpdated", () => {
|
|
130440
130920
|
if (imageResizeState.visible && imageResizeState.blockId) {
|
|
130921
|
+
const escapedBlockId = CSS.escape(imageResizeState.blockId);
|
|
130441
130922
|
const newElement = editorElem.value?.querySelector(
|
|
130442
|
-
`.superdoc-image-fragment[data-sd-block-id="${
|
|
130923
|
+
`.superdoc-image-fragment[data-sd-block-id="${escapedBlockId}"]`
|
|
130443
130924
|
);
|
|
130444
130925
|
if (newElement) {
|
|
130445
130926
|
imageResizeState.imageElement = newElement;
|
|
@@ -130449,8 +130930,33 @@ ${style2}
|
|
|
130449
130930
|
imageResizeState.blockId = null;
|
|
130450
130931
|
}
|
|
130451
130932
|
}
|
|
130933
|
+
if (selectedImageState.blockId) {
|
|
130934
|
+
const escapedBlockId = CSS.escape(selectedImageState.blockId);
|
|
130935
|
+
const refreshed = editorElem.value?.querySelector(
|
|
130936
|
+
`.superdoc-image-fragment[data-sd-block-id="${escapedBlockId}"]`
|
|
130937
|
+
);
|
|
130938
|
+
if (refreshed) {
|
|
130939
|
+
setSelectedImage(refreshed, selectedImageState.blockId, selectedImageState.pmStart);
|
|
130940
|
+
} else {
|
|
130941
|
+
if (selectedImageState.pmStart != null) {
|
|
130942
|
+
const pmSelector = `.superdoc-image-fragment[data-pm-start="${selectedImageState.pmStart}"], .superdoc-inline-image[data-pm-start="${selectedImageState.pmStart}"]`;
|
|
130943
|
+
const pmElement = editorElem.value?.querySelector(pmSelector);
|
|
130944
|
+
if (pmElement) {
|
|
130945
|
+
setSelectedImage(pmElement, selectedImageState.blockId, selectedImageState.pmStart);
|
|
130946
|
+
return;
|
|
130947
|
+
}
|
|
130948
|
+
}
|
|
130949
|
+
clearSelectedImage();
|
|
130950
|
+
}
|
|
130951
|
+
}
|
|
130452
130952
|
});
|
|
130453
130953
|
}
|
|
130954
|
+
editor.value.on("paginationUpdate", () => {
|
|
130955
|
+
const base2 = activeEditor.value;
|
|
130956
|
+
if (isHeadless(base2)) return;
|
|
130957
|
+
const paginationTarget = editor.value?.editor ? { value: base2 } : editor;
|
|
130958
|
+
adjustPaginationBreaks(editorElem, paginationTarget);
|
|
130959
|
+
});
|
|
130454
130960
|
editor.value.on("collaborationReady", () => {
|
|
130455
130961
|
setTimeout(() => {
|
|
130456
130962
|
editorReady.value = true;
|
|
@@ -130517,6 +131023,7 @@ ${style2}
|
|
|
130517
131023
|
};
|
|
130518
131024
|
onBeforeUnmount(() => {
|
|
130519
131025
|
stopPolling();
|
|
131026
|
+
clearSelectedImage();
|
|
130520
131027
|
editor.value?.destroy();
|
|
130521
131028
|
editor.value = null;
|
|
130522
131029
|
});
|
|
@@ -130631,8 +131138,8 @@ ${style2}
|
|
|
130631
131138
|
]);
|
|
130632
131139
|
};
|
|
130633
131140
|
}
|
|
130634
|
-
};
|
|
130635
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-
|
|
131141
|
+
});
|
|
131142
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-a935d3e2"]]);
|
|
130636
131143
|
const _hoisted_1$h = ["innerHTML"];
|
|
130637
131144
|
const _sfc_main$i = {
|
|
130638
131145
|
__name: "SuperInput",
|
|
@@ -147823,7 +148330,7 @@ ${style2}
|
|
|
147823
148330
|
this.config.colors = shuffleArray(this.config.colors);
|
|
147824
148331
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
147825
148332
|
this.colorIndex = 0;
|
|
147826
|
-
this.version = "1.0.0-beta.
|
|
148333
|
+
this.version = "1.0.0-beta.39";
|
|
147827
148334
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
147828
148335
|
this.superdocId = config2.superdocId || v4();
|
|
147829
148336
|
this.colors = this.config.colors;
|
|
@@ -150289,7 +150796,7 @@ ${style2}
|
|
|
150289
150796
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
150290
150797
|
);
|
|
150291
150798
|
}
|
|
150292
|
-
const
|
|
150799
|
+
const indexBqDEyWLQ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
150293
150800
|
__proto__: null,
|
|
150294
150801
|
unified
|
|
150295
150802
|
}, Symbol.toStringTag, { value: "Module" }));
|