@harbour-enterprises/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
|
@@ -19192,6 +19192,7 @@ function getUnderlineCssString({ type: type2 = "single", color = null, thickness
|
|
|
19192
19192
|
return parts.join("; ");
|
|
19193
19193
|
}
|
|
19194
19194
|
const INLINE_OVERRIDE_PROPERTIES = ["fontSize", "bold", "italic", "strike", "underline", "letterSpacing"];
|
|
19195
|
+
const DEFAULT_FONT_SIZE_HALF_POINTS = 20;
|
|
19195
19196
|
const resolveRunProperties = (params2, inlineRpr, resolvedPpr, isListNumber = false, numberingDefinedInline = false) => {
|
|
19196
19197
|
const paragraphStyleId = resolvedPpr?.styleId;
|
|
19197
19198
|
const paragraphStyleProps = resolveStyleChain$1(params2, paragraphStyleId, translator$1N);
|
|
@@ -19233,6 +19234,15 @@ const resolveRunProperties = (params2, inlineRpr, resolvedPpr, isListNumber = fa
|
|
|
19233
19234
|
finalProps[prop] = inlineRpr[prop];
|
|
19234
19235
|
}
|
|
19235
19236
|
}
|
|
19237
|
+
if (finalProps.fontSize == null || typeof finalProps.fontSize !== "number" || !Number.isFinite(finalProps.fontSize) || finalProps.fontSize <= 0) {
|
|
19238
|
+
let defaultFontSize = DEFAULT_FONT_SIZE_HALF_POINTS;
|
|
19239
|
+
if (defaultProps2?.fontSize != null && typeof defaultProps2.fontSize === "number" && Number.isFinite(defaultProps2.fontSize) && defaultProps2.fontSize > 0) {
|
|
19240
|
+
defaultFontSize = defaultProps2.fontSize;
|
|
19241
|
+
} else if (normalProps?.fontSize != null && typeof normalProps.fontSize === "number" && Number.isFinite(normalProps.fontSize) && normalProps.fontSize > 0) {
|
|
19242
|
+
defaultFontSize = normalProps.fontSize;
|
|
19243
|
+
}
|
|
19244
|
+
finalProps.fontSize = defaultFontSize;
|
|
19245
|
+
}
|
|
19236
19246
|
return finalProps;
|
|
19237
19247
|
};
|
|
19238
19248
|
function resolveParagraphProperties(params2, inlineProps, insideTable = false, overrideInlineStyleId = false, tableStyleId = null) {
|
|
@@ -34756,7 +34766,8 @@ const inputRulesPlugin = ({ editor, rules }) => {
|
|
|
34756
34766
|
if (fieldAnnotationContent.length) {
|
|
34757
34767
|
return false;
|
|
34758
34768
|
}
|
|
34759
|
-
|
|
34769
|
+
const result = handleClipboardPaste({ editor, view }, html);
|
|
34770
|
+
return result;
|
|
34760
34771
|
}
|
|
34761
34772
|
},
|
|
34762
34773
|
isInputRules: true
|
|
@@ -34771,38 +34782,36 @@ function isWordHtml(html) {
|
|
|
34771
34782
|
function isGoogleDocsHtml(html) {
|
|
34772
34783
|
return /docs-internal-guid-/.test(html);
|
|
34773
34784
|
}
|
|
34785
|
+
function findParagraphAncestor($from) {
|
|
34786
|
+
for (let d2 = $from.depth; d2 >= 0; d2--) {
|
|
34787
|
+
const node = $from.node(d2);
|
|
34788
|
+
if (node.type.name === "paragraph") {
|
|
34789
|
+
return { node, depth: d2 };
|
|
34790
|
+
}
|
|
34791
|
+
}
|
|
34792
|
+
return { node: null, depth: -1 };
|
|
34793
|
+
}
|
|
34774
34794
|
function handleHtmlPaste(html, editor, source) {
|
|
34775
34795
|
let cleanedHtml;
|
|
34776
34796
|
cleanedHtml = htmlHandler(html, editor);
|
|
34777
34797
|
let doc2 = DOMParser$1.fromSchema(editor.schema).parse(cleanedHtml);
|
|
34778
34798
|
doc2 = wrapTextsInRuns(doc2);
|
|
34779
34799
|
const { dispatch, state: state2 } = editor.view;
|
|
34780
|
-
if (!dispatch)
|
|
34800
|
+
if (!dispatch) {
|
|
34801
|
+
return false;
|
|
34802
|
+
}
|
|
34781
34803
|
const { $from } = state2.selection;
|
|
34782
|
-
const
|
|
34783
|
-
const
|
|
34804
|
+
const { node: paragraphNode } = findParagraphAncestor($from);
|
|
34805
|
+
const isInParagraph = paragraphNode !== null;
|
|
34784
34806
|
const isSingleParagraph = doc2.childCount === 1 && doc2.firstChild.type.name === "paragraph";
|
|
34785
34807
|
if (isInParagraph && isSingleParagraph) {
|
|
34786
34808
|
const paragraphContent = doc2.firstChild.content;
|
|
34787
34809
|
const tr = state2.tr.replaceSelectionWith(paragraphContent, false);
|
|
34788
34810
|
dispatch(tr);
|
|
34789
|
-
} else if (isInParagraph
|
|
34790
|
-
const
|
|
34791
|
-
|
|
34792
|
-
|
|
34793
|
-
allContent.push(...node.content.content);
|
|
34794
|
-
if (index2 < doc2.content.childCount - 1) {
|
|
34795
|
-
allContent.push(editor.schema.text("\n"));
|
|
34796
|
-
}
|
|
34797
|
-
}
|
|
34798
|
-
});
|
|
34799
|
-
if (allContent.length > 0) {
|
|
34800
|
-
const fragment = Fragment.from(allContent);
|
|
34801
|
-
const tr = state2.tr.replaceSelectionWith(fragment, false);
|
|
34802
|
-
dispatch(tr);
|
|
34803
|
-
} else {
|
|
34804
|
-
dispatch(state2.tr.replaceSelectionWith(doc2, true));
|
|
34805
|
-
}
|
|
34811
|
+
} else if (isInParagraph) {
|
|
34812
|
+
const slice2 = new Slice(doc2.content, 0, 0);
|
|
34813
|
+
const tr = state2.tr.replaceSelection(slice2);
|
|
34814
|
+
dispatch(tr);
|
|
34806
34815
|
} else {
|
|
34807
34816
|
dispatch(state2.tr.replaceSelectionWith(doc2, true));
|
|
34808
34817
|
}
|
|
@@ -41858,7 +41867,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
41858
41867
|
static getStoredSuperdocVersion(docx) {
|
|
41859
41868
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
41860
41869
|
}
|
|
41861
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
41870
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.39") {
|
|
41862
41871
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
41863
41872
|
}
|
|
41864
41873
|
/**
|
|
@@ -45164,7 +45173,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
45164
45173
|
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);
|
|
45165
45174
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
45166
45175
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
45167
|
-
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;
|
|
45176
|
+
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;
|
|
45168
45177
|
var GOOD_LEAF_SIZE = 200;
|
|
45169
45178
|
var RopeSequence = function RopeSequence2() {
|
|
45170
45179
|
};
|
|
@@ -54096,11 +54105,13 @@ const unsetAllMarks = () => ({ tr, dispatch, editor }) => {
|
|
|
54096
54105
|
selection = editor.options.lastSelection;
|
|
54097
54106
|
}
|
|
54098
54107
|
const { empty: empty2, ranges } = selection;
|
|
54099
|
-
if (empty2) return true;
|
|
54100
54108
|
if (dispatch) {
|
|
54101
|
-
|
|
54102
|
-
|
|
54103
|
-
|
|
54109
|
+
if (!empty2) {
|
|
54110
|
+
ranges.forEach((range2) => {
|
|
54111
|
+
tr.removeMark(range2.$from.pos, range2.$to.pos);
|
|
54112
|
+
});
|
|
54113
|
+
}
|
|
54114
|
+
tr.setStoredMarks([]);
|
|
54104
54115
|
}
|
|
54105
54116
|
return true;
|
|
54106
54117
|
};
|
|
@@ -59031,7 +59042,7 @@ const isHeadless = (editor) => {
|
|
|
59031
59042
|
const shouldSkipNodeView = (editor) => {
|
|
59032
59043
|
return isHeadless(editor);
|
|
59033
59044
|
};
|
|
59034
|
-
const summaryVersion = "1.0.0-beta.
|
|
59045
|
+
const summaryVersion = "1.0.0-beta.39";
|
|
59035
59046
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59036
59047
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59037
59048
|
function mapAttributes(attrs) {
|
|
@@ -59820,7 +59831,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
59820
59831
|
{ default: remarkStringify },
|
|
59821
59832
|
{ default: remarkGfm }
|
|
59822
59833
|
] = await Promise.all([
|
|
59823
|
-
Promise.resolve().then(() => require("./index-
|
|
59834
|
+
Promise.resolve().then(() => require("./index-BqDEyWLQ-CCRXZcrp.cjs")),
|
|
59824
59835
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
59825
59836
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
59826
59837
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -60025,7 +60036,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60025
60036
|
* Process collaboration migrations
|
|
60026
60037
|
*/
|
|
60027
60038
|
processCollaborationMigrations() {
|
|
60028
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
60039
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.39");
|
|
60029
60040
|
if (!this.options.ydoc) return;
|
|
60030
60041
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60031
60042
|
let docVersion = metaMap.get("version");
|
|
@@ -62036,7 +62047,7 @@ const applyTextStyleMark = (run2, attrs, themeColors) => {
|
|
|
62036
62047
|
const fontSizePx = normalizeFontSizePx(attrs.fontSize);
|
|
62037
62048
|
if (fontSizePx !== void 0 && fontSizePx >= 1 && fontSizePx <= 1e3) {
|
|
62038
62049
|
run2.fontSize = fontSizePx;
|
|
62039
|
-
}
|
|
62050
|
+
} else if (attrs.fontSize !== void 0) ;
|
|
62040
62051
|
if (isFiniteNumber(attrs.letterSpacing)) {
|
|
62041
62052
|
const spacing = Number(attrs.letterSpacing);
|
|
62042
62053
|
if (spacing >= -100 && spacing <= 100) {
|
|
@@ -64715,18 +64726,18 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
64715
64726
|
paragraphAttrs.rtl = true;
|
|
64716
64727
|
}
|
|
64717
64728
|
const explicitAlignment = normalizeAlignment(attrs.alignment ?? attrs.textAlign);
|
|
64729
|
+
const paragraphAlignment = typeof paragraphProps.justification === "string" ? normalizeAlignment(paragraphProps.justification) : void 0;
|
|
64718
64730
|
const styleAlignment = hydrated?.alignment ? normalizeAlignment(hydrated.alignment) : void 0;
|
|
64719
|
-
const paragraphAlignment = paragraphProps.justification ? normalizeAlignment(paragraphProps.justification) : void 0;
|
|
64720
64731
|
if (bidi && adjustRightInd) {
|
|
64721
64732
|
paragraphAttrs.alignment = "right";
|
|
64722
64733
|
} else if (explicitAlignment) {
|
|
64723
64734
|
paragraphAttrs.alignment = explicitAlignment;
|
|
64735
|
+
} else if (paragraphAlignment) {
|
|
64736
|
+
paragraphAttrs.alignment = paragraphAlignment;
|
|
64724
64737
|
} else if (bidi) {
|
|
64725
64738
|
paragraphAttrs.alignment = "right";
|
|
64726
64739
|
} else if (styleAlignment) {
|
|
64727
64740
|
paragraphAttrs.alignment = styleAlignment;
|
|
64728
|
-
} else if (paragraphAlignment) {
|
|
64729
|
-
paragraphAttrs.alignment = paragraphAlignment;
|
|
64730
64741
|
} else if (computed2.paragraph.alignment) {
|
|
64731
64742
|
paragraphAttrs.alignment = computed2.paragraph.alignment;
|
|
64732
64743
|
}
|
|
@@ -70446,11 +70457,26 @@ const FIELD_ANNOTATION_STYLES = `
|
|
|
70446
70457
|
z-index: 1000;
|
|
70447
70458
|
}
|
|
70448
70459
|
`;
|
|
70460
|
+
const IMAGE_SELECTION_STYLES = `
|
|
70461
|
+
/* Highlight for selected images (block or inline) */
|
|
70462
|
+
.superdoc-image-selected {
|
|
70463
|
+
outline: 2px solid #4a90e2;
|
|
70464
|
+
outline-offset: 2px;
|
|
70465
|
+
border-radius: 2px;
|
|
70466
|
+
box-shadow: 0 0 0 1px rgba(74, 144, 226, 0.35);
|
|
70467
|
+
}
|
|
70468
|
+
|
|
70469
|
+
/* Ensure inline images can be targeted */
|
|
70470
|
+
.superdoc-inline-image.superdoc-image-selected {
|
|
70471
|
+
outline-offset: 2px;
|
|
70472
|
+
}
|
|
70473
|
+
`;
|
|
70449
70474
|
let printStylesInjected = false;
|
|
70450
70475
|
let linkStylesInjected = false;
|
|
70451
70476
|
let trackChangeStylesInjected = false;
|
|
70452
70477
|
let sdtContainerStylesInjected = false;
|
|
70453
70478
|
let fieldAnnotationStylesInjected = false;
|
|
70479
|
+
let imageSelectionStylesInjected = false;
|
|
70454
70480
|
const ensurePrintStyles = (doc2) => {
|
|
70455
70481
|
if (printStylesInjected || !doc2) return;
|
|
70456
70482
|
const styleEl = doc2.createElement("style");
|
|
@@ -70491,6 +70517,14 @@ const ensureFieldAnnotationStyles = (doc2) => {
|
|
|
70491
70517
|
doc2.head?.appendChild(styleEl);
|
|
70492
70518
|
fieldAnnotationStylesInjected = true;
|
|
70493
70519
|
};
|
|
70520
|
+
const ensureImageSelectionStyles = (doc2) => {
|
|
70521
|
+
if (imageSelectionStylesInjected || !doc2) return;
|
|
70522
|
+
const styleEl = doc2.createElement("style");
|
|
70523
|
+
styleEl.setAttribute("data-superdoc-image-selection-styles", "true");
|
|
70524
|
+
styleEl.textContent = IMAGE_SELECTION_STYLES;
|
|
70525
|
+
doc2.head?.appendChild(styleEl);
|
|
70526
|
+
imageSelectionStylesInjected = true;
|
|
70527
|
+
};
|
|
70494
70528
|
const DOM_CLASS_NAMES = {
|
|
70495
70529
|
/**
|
|
70496
70530
|
* Class name for page container elements.
|
|
@@ -71391,6 +71425,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
71391
71425
|
ensureTrackChangeStyles(doc2);
|
|
71392
71426
|
ensureFieldAnnotationStyles(doc2);
|
|
71393
71427
|
ensureSdtContainerStyles(doc2);
|
|
71428
|
+
ensureImageSelectionStyles(doc2);
|
|
71394
71429
|
mount2.classList.add(CLASS_NAMES$1.container);
|
|
71395
71430
|
if (this.mount && this.mount !== mount2) {
|
|
71396
71431
|
this.resetState();
|
|
@@ -71926,7 +71961,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
71926
71961
|
if (fragment.continuesOnNext) {
|
|
71927
71962
|
fragmentEl.dataset.continuesOnNext = "true";
|
|
71928
71963
|
}
|
|
71929
|
-
const lines = measure.lines.slice(fragment.fromLine, fragment.toLine);
|
|
71964
|
+
const lines = fragment.lines ?? measure.lines.slice(fragment.fromLine, fragment.toLine);
|
|
71930
71965
|
applyParagraphBlockStyles(fragmentEl, block.attrs);
|
|
71931
71966
|
if (block.attrs?.styleId) {
|
|
71932
71967
|
fragmentEl.dataset.styleId = block.attrs.styleId;
|
|
@@ -73023,6 +73058,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
73023
73058
|
return null;
|
|
73024
73059
|
}
|
|
73025
73060
|
const img = this.doc.createElement("img");
|
|
73061
|
+
img.classList.add("superdoc-inline-image");
|
|
73026
73062
|
const isDataUrl = typeof run2.src === "string" && run2.src.startsWith("data:");
|
|
73027
73063
|
if (isDataUrl) {
|
|
73028
73064
|
if (run2.src.length > MAX_DATA_URL_LENGTH) {
|
|
@@ -75560,6 +75596,23 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
75560
75596
|
}
|
|
75561
75597
|
}
|
|
75562
75598
|
let lines = normalizeLines(measure);
|
|
75599
|
+
const measurementWidth = lines[0]?.maxWidth;
|
|
75600
|
+
let didRemeasureForColumnWidth = false;
|
|
75601
|
+
if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > columnWidth) {
|
|
75602
|
+
let firstLineIndent = 0;
|
|
75603
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
75604
|
+
if (wordLayout?.marker && measure.marker) {
|
|
75605
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
75606
|
+
if (markerJustification === "left") {
|
|
75607
|
+
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
75608
|
+
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
75609
|
+
firstLineIndent = markerWidth + gutterWidth;
|
|
75610
|
+
}
|
|
75611
|
+
}
|
|
75612
|
+
const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
|
|
75613
|
+
lines = normalizeLines(newMeasure);
|
|
75614
|
+
didRemeasureForColumnWidth = true;
|
|
75615
|
+
}
|
|
75563
75616
|
let fromLine = 0;
|
|
75564
75617
|
const spacing = block.attrs?.spacing ?? {};
|
|
75565
75618
|
const styleId = block.attrs?.styleId;
|
|
@@ -75635,7 +75688,17 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
75635
75688
|
tempY += lineHeight2;
|
|
75636
75689
|
}
|
|
75637
75690
|
if (narrowestWidth < columnWidth) {
|
|
75638
|
-
|
|
75691
|
+
let firstLineIndent = 0;
|
|
75692
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
75693
|
+
if (wordLayout?.marker && measure.marker) {
|
|
75694
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
75695
|
+
if (markerJustification === "left") {
|
|
75696
|
+
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
75697
|
+
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
75698
|
+
firstLineIndent = markerWidth + gutterWidth;
|
|
75699
|
+
}
|
|
75700
|
+
}
|
|
75701
|
+
const newMeasure = remeasureParagraph2(block, narrowestWidth, firstLineIndent);
|
|
75639
75702
|
lines = normalizeLines(newMeasure);
|
|
75640
75703
|
didRemeasureForFloats = true;
|
|
75641
75704
|
}
|
|
@@ -75700,6 +75763,9 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
75700
75763
|
width: effectiveColumnWidth,
|
|
75701
75764
|
...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
|
|
75702
75765
|
};
|
|
75766
|
+
if (didRemeasureForColumnWidth) {
|
|
75767
|
+
fragment.lines = lines.slice(fromLine, slice2.toLine);
|
|
75768
|
+
}
|
|
75703
75769
|
if (measure.marker && fromLine === 0) {
|
|
75704
75770
|
fragment.markerWidth = measure.marker.markerWidth;
|
|
75705
75771
|
if (measure.marker.markerTextWidth != null) {
|
|
@@ -78428,12 +78494,14 @@ function lineHeightForRuns(runs, fromRun, toRun) {
|
|
|
78428
78494
|
}
|
|
78429
78495
|
return maxSize2 * 1.2;
|
|
78430
78496
|
}
|
|
78431
|
-
function remeasureParagraph(block, maxWidth) {
|
|
78497
|
+
function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
78432
78498
|
const runs = block.runs ?? [];
|
|
78433
78499
|
const lines = [];
|
|
78434
78500
|
let currentRun = 0;
|
|
78435
78501
|
let currentChar = 0;
|
|
78436
78502
|
while (currentRun < runs.length) {
|
|
78503
|
+
const isFirstLine = lines.length === 0;
|
|
78504
|
+
const effectiveMaxWidth = isFirstLine ? maxWidth - firstLineIndent : maxWidth;
|
|
78437
78505
|
const startRun = currentRun;
|
|
78438
78506
|
const startChar = currentChar;
|
|
78439
78507
|
let width = 0;
|
|
@@ -78447,7 +78515,7 @@ function remeasureParagraph(block, maxWidth) {
|
|
|
78447
78515
|
const start2 = r2 === currentRun ? currentChar : 0;
|
|
78448
78516
|
for (let c2 = start2; c2 < text.length; c2 += 1) {
|
|
78449
78517
|
const w2 = measureRunSliceWidth(run2, c2, c2 + 1);
|
|
78450
|
-
if (width + w2 >
|
|
78518
|
+
if (width + w2 > effectiveMaxWidth && width > 0) {
|
|
78451
78519
|
if (lastBreakRun >= 0) {
|
|
78452
78520
|
endRun = lastBreakRun;
|
|
78453
78521
|
endChar = lastBreakChar;
|
|
@@ -78946,7 +79014,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
78946
79014
|
...options,
|
|
78947
79015
|
headerContentHeights,
|
|
78948
79016
|
// Pass header heights to prevent overlap
|
|
78949
|
-
remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
|
|
79017
|
+
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
78950
79018
|
});
|
|
78951
79019
|
const layoutEnd = performance.now();
|
|
78952
79020
|
perfLog(`[Perf] 4.2 Layout document (pagination): ${(layoutEnd - layoutStart).toFixed(2)}ms`);
|
|
@@ -78994,7 +79062,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
78994
79062
|
...options,
|
|
78995
79063
|
headerContentHeights,
|
|
78996
79064
|
// Pass header heights to prevent overlap
|
|
78997
|
-
remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
|
|
79065
|
+
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
78998
79066
|
});
|
|
78999
79067
|
const relayoutEnd = performance.now();
|
|
79000
79068
|
const relayoutTime = relayoutEnd - relayoutStart;
|
|
@@ -79825,6 +79893,31 @@ function findBlockIndexByFragmentId(blocks, fragmentBlockId, targetPmRange) {
|
|
|
79825
79893
|
}
|
|
79826
79894
|
return matchingIndices[0];
|
|
79827
79895
|
}
|
|
79896
|
+
const DEFAULT_CELL_PADDING = { top: 2, bottom: 2, left: 4, right: 4 };
|
|
79897
|
+
const getCellPaddingFromRow = (cellIdx, row) => {
|
|
79898
|
+
const padding = row?.cells?.[cellIdx]?.attrs?.padding ?? {};
|
|
79899
|
+
return {
|
|
79900
|
+
top: padding.top ?? DEFAULT_CELL_PADDING.top,
|
|
79901
|
+
bottom: padding.bottom ?? DEFAULT_CELL_PADDING.bottom,
|
|
79902
|
+
left: padding.left ?? DEFAULT_CELL_PADDING.left,
|
|
79903
|
+
right: padding.right ?? DEFAULT_CELL_PADDING.right
|
|
79904
|
+
};
|
|
79905
|
+
};
|
|
79906
|
+
const getCellBlocks = (cell) => {
|
|
79907
|
+
if (!cell) return [];
|
|
79908
|
+
return cell.blocks ?? (cell.paragraph ? [cell.paragraph] : []);
|
|
79909
|
+
};
|
|
79910
|
+
const getCellMeasures = (cell) => {
|
|
79911
|
+
if (!cell) return [];
|
|
79912
|
+
return cell.blocks ?? (cell.paragraph ? [cell.paragraph] : []);
|
|
79913
|
+
};
|
|
79914
|
+
const sumLineHeights = (measure, fromLine, toLine) => {
|
|
79915
|
+
let height = 0;
|
|
79916
|
+
for (let i = fromLine; i < toLine && i < measure.lines.length; i += 1) {
|
|
79917
|
+
height += measure.lines[i]?.lineHeight ?? 0;
|
|
79918
|
+
}
|
|
79919
|
+
return height;
|
|
79920
|
+
};
|
|
79828
79921
|
function selectionToRects(layout, blocks, measures, from2, to) {
|
|
79829
79922
|
if (from2 === to) {
|
|
79830
79923
|
return [];
|
|
@@ -79871,6 +79964,136 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
79871
79964
|
});
|
|
79872
79965
|
return;
|
|
79873
79966
|
}
|
|
79967
|
+
if (fragment.kind === "table") {
|
|
79968
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
79969
|
+
if (blockIndex === -1) return;
|
|
79970
|
+
const block = blocks[blockIndex];
|
|
79971
|
+
const measure = measures[blockIndex];
|
|
79972
|
+
if (!block || block.kind !== "table" || measure?.kind !== "table") {
|
|
79973
|
+
return;
|
|
79974
|
+
}
|
|
79975
|
+
const tableBlock = block;
|
|
79976
|
+
const tableMeasure = measure;
|
|
79977
|
+
const tableFragment = fragment;
|
|
79978
|
+
const rowHeights = tableMeasure.rows.map((rowMeasure, idx) => {
|
|
79979
|
+
if (tableFragment.partialRow && tableFragment.partialRow.rowIndex === idx) {
|
|
79980
|
+
return tableFragment.partialRow.partialHeight;
|
|
79981
|
+
}
|
|
79982
|
+
return rowMeasure?.height ?? 0;
|
|
79983
|
+
});
|
|
79984
|
+
const calculateCellX = (cellIdx, cellMeasure) => {
|
|
79985
|
+
const gridStart = cellMeasure.gridColumnStart ?? cellIdx;
|
|
79986
|
+
let x2 = 0;
|
|
79987
|
+
for (let i = 0; i < gridStart && i < tableMeasure.columnWidths.length; i += 1) {
|
|
79988
|
+
x2 += tableMeasure.columnWidths[i];
|
|
79989
|
+
}
|
|
79990
|
+
return x2;
|
|
79991
|
+
};
|
|
79992
|
+
const processRow = (rowIndex, rowOffset) => {
|
|
79993
|
+
const rowMeasure = tableMeasure.rows[rowIndex];
|
|
79994
|
+
const row = tableBlock.rows[rowIndex];
|
|
79995
|
+
if (!rowMeasure || !row) return rowOffset;
|
|
79996
|
+
const rowHeight = rowHeights[rowIndex] ?? rowMeasure.height;
|
|
79997
|
+
const isPartialRow = tableFragment.partialRow?.rowIndex === rowIndex;
|
|
79998
|
+
const partialRowData = isPartialRow ? tableFragment.partialRow : null;
|
|
79999
|
+
const totalColumns = Math.min(rowMeasure.cells.length, row.cells.length);
|
|
80000
|
+
for (let cellIdx = 0; cellIdx < totalColumns; cellIdx += 1) {
|
|
80001
|
+
const cellMeasure = rowMeasure.cells[cellIdx];
|
|
80002
|
+
const cell = row.cells[cellIdx];
|
|
80003
|
+
if (!cellMeasure || !cell) continue;
|
|
80004
|
+
const padding = getCellPaddingFromRow(cellIdx, row);
|
|
80005
|
+
const cellX = calculateCellX(cellIdx, cellMeasure);
|
|
80006
|
+
const cellBlocks = getCellBlocks(cell);
|
|
80007
|
+
const cellBlockMeasures = getCellMeasures(cellMeasure);
|
|
80008
|
+
const renderedBlocks = [];
|
|
80009
|
+
let cumulativeLine = 0;
|
|
80010
|
+
for (let i = 0; i < Math.min(cellBlocks.length, cellBlockMeasures.length); i += 1) {
|
|
80011
|
+
const paraBlock = cellBlocks[i];
|
|
80012
|
+
const paraMeasure = cellBlockMeasures[i];
|
|
80013
|
+
if (!paraBlock || !paraMeasure || paraBlock.kind !== "paragraph" || paraMeasure.kind !== "paragraph") {
|
|
80014
|
+
continue;
|
|
80015
|
+
}
|
|
80016
|
+
const lineCount = paraMeasure.lines.length;
|
|
80017
|
+
const blockStart = cumulativeLine;
|
|
80018
|
+
const blockEnd = cumulativeLine + lineCount;
|
|
80019
|
+
cumulativeLine = blockEnd;
|
|
80020
|
+
const allowedStart = partialRowData?.fromLineByCell?.[cellIdx] ?? 0;
|
|
80021
|
+
const rawAllowedEnd = partialRowData?.toLineByCell?.[cellIdx];
|
|
80022
|
+
const allowedEnd = rawAllowedEnd == null || rawAllowedEnd === -1 ? cumulativeLine : rawAllowedEnd;
|
|
80023
|
+
const renderStartGlobal = Math.max(blockStart, allowedStart);
|
|
80024
|
+
const renderEndGlobal = Math.min(blockEnd, allowedEnd);
|
|
80025
|
+
if (renderStartGlobal >= renderEndGlobal) continue;
|
|
80026
|
+
const startLine = renderStartGlobal - blockStart;
|
|
80027
|
+
const endLine = renderEndGlobal - blockStart;
|
|
80028
|
+
let height = sumLineHeights(paraMeasure, startLine, endLine);
|
|
80029
|
+
const rendersWholeBlock = startLine === 0 && endLine >= lineCount;
|
|
80030
|
+
if (rendersWholeBlock) {
|
|
80031
|
+
const totalHeight = paraMeasure.totalHeight;
|
|
80032
|
+
if (typeof totalHeight === "number" && totalHeight > height) {
|
|
80033
|
+
height = totalHeight;
|
|
80034
|
+
}
|
|
80035
|
+
const spacingAfter = paraBlock.attrs?.spacing?.after;
|
|
80036
|
+
if (typeof spacingAfter === "number" && spacingAfter > 0) {
|
|
80037
|
+
height += spacingAfter;
|
|
80038
|
+
}
|
|
80039
|
+
}
|
|
80040
|
+
renderedBlocks.push({ block: paraBlock, measure: paraMeasure, startLine, endLine, height });
|
|
80041
|
+
}
|
|
80042
|
+
const contentHeight = renderedBlocks.reduce((acc, info) => acc + info.height, 0);
|
|
80043
|
+
const contentAreaHeight = Math.max(0, rowHeight - (padding.top + padding.bottom));
|
|
80044
|
+
const freeSpace = Math.max(0, contentAreaHeight - contentHeight);
|
|
80045
|
+
let verticalOffset = 0;
|
|
80046
|
+
const vAlign = cell.attrs?.verticalAlign;
|
|
80047
|
+
if (vAlign === "center" || vAlign === "middle") {
|
|
80048
|
+
verticalOffset = freeSpace / 2;
|
|
80049
|
+
} else if (vAlign === "bottom") {
|
|
80050
|
+
verticalOffset = freeSpace;
|
|
80051
|
+
}
|
|
80052
|
+
let blockTopCursor = padding.top + verticalOffset;
|
|
80053
|
+
renderedBlocks.forEach((info) => {
|
|
80054
|
+
const paragraphMarkerWidth = info.measure.marker?.markerWidth ?? 0;
|
|
80055
|
+
const intersectingLines = findLinesIntersectingRange(info.block, info.measure, from2, to);
|
|
80056
|
+
intersectingLines.forEach(({ line, index: index2 }) => {
|
|
80057
|
+
if (index2 < info.startLine || index2 >= info.endLine) {
|
|
80058
|
+
return;
|
|
80059
|
+
}
|
|
80060
|
+
const range2 = computeLinePmRange(info.block, line);
|
|
80061
|
+
if (range2.pmStart == null || range2.pmEnd == null) return;
|
|
80062
|
+
const sliceFrom = Math.max(range2.pmStart, from2);
|
|
80063
|
+
const sliceTo = Math.min(range2.pmEnd, to);
|
|
80064
|
+
if (sliceFrom >= sliceTo) return;
|
|
80065
|
+
const charOffsetFrom = pmPosToCharOffset(info.block, line, sliceFrom);
|
|
80066
|
+
const charOffsetTo = pmPosToCharOffset(info.block, line, sliceTo);
|
|
80067
|
+
const availableWidth = Math.max(1, cellMeasure.width - padding.left - padding.right);
|
|
80068
|
+
const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth);
|
|
80069
|
+
const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth);
|
|
80070
|
+
const rectX = fragment.x + cellX + padding.left + paragraphMarkerWidth + Math.min(startX, endX);
|
|
80071
|
+
const rectWidth = Math.max(1, Math.abs(endX - startX));
|
|
80072
|
+
const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
|
|
80073
|
+
const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
|
|
80074
|
+
rects.push({
|
|
80075
|
+
x: rectX,
|
|
80076
|
+
y: rectY + pageIndex * layout.pageSize.h,
|
|
80077
|
+
width: rectWidth,
|
|
80078
|
+
height: line.lineHeight,
|
|
80079
|
+
pageIndex
|
|
80080
|
+
});
|
|
80081
|
+
});
|
|
80082
|
+
blockTopCursor += info.height;
|
|
80083
|
+
});
|
|
80084
|
+
}
|
|
80085
|
+
return rowOffset + rowHeight;
|
|
80086
|
+
};
|
|
80087
|
+
let rowCursor = 0;
|
|
80088
|
+
const repeatHeaderCount = tableFragment.repeatHeaderCount ?? 0;
|
|
80089
|
+
for (let r2 = 0; r2 < repeatHeaderCount && r2 < tableMeasure.rows.length; r2 += 1) {
|
|
80090
|
+
rowCursor = processRow(r2, rowCursor);
|
|
80091
|
+
}
|
|
80092
|
+
for (let r2 = tableFragment.fromRow; r2 < tableFragment.toRow && r2 < tableMeasure.rows.length; r2 += 1) {
|
|
80093
|
+
rowCursor = processRow(r2, rowCursor);
|
|
80094
|
+
}
|
|
80095
|
+
return;
|
|
80096
|
+
}
|
|
79874
80097
|
if (isAtomicFragment(fragment)) {
|
|
79875
80098
|
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
79876
80099
|
if (blockIndex === -1) return;
|
|
@@ -80397,7 +80620,16 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
80397
80620
|
const rawFirstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
|
|
80398
80621
|
const firstLineOffset = isWordLayoutList ? 0 : rawFirstLineOffset;
|
|
80399
80622
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
80400
|
-
|
|
80623
|
+
let leftJustifiedMarkerSpace = 0;
|
|
80624
|
+
if (wordLayout?.marker) {
|
|
80625
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
80626
|
+
if (markerJustification === "left") {
|
|
80627
|
+
const markerBoxWidth = wordLayout.marker.markerBoxWidthPx ?? 0;
|
|
80628
|
+
const gutterWidth = wordLayout.marker.gutterWidthPx ?? LIST_MARKER_GAP;
|
|
80629
|
+
leftJustifiedMarkerSpace = markerBoxWidth + gutterWidth;
|
|
80630
|
+
}
|
|
80631
|
+
}
|
|
80632
|
+
const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
|
|
80401
80633
|
const tabStops = buildTabStopsPx(
|
|
80402
80634
|
indent,
|
|
80403
80635
|
block.attrs?.tabs,
|
|
@@ -82873,12 +83105,30 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
82873
83105
|
if (linkEl) {
|
|
82874
83106
|
const href = linkEl.getAttribute("href") ?? "";
|
|
82875
83107
|
const isAnchorLink = href.startsWith("#") && href.length > 1;
|
|
82876
|
-
|
|
83108
|
+
const isTocLink = linkEl.closest(".superdoc-toc-entry") !== null;
|
|
83109
|
+
if (isAnchorLink && isTocLink) {
|
|
82877
83110
|
event.preventDefault();
|
|
82878
83111
|
event.stopPropagation();
|
|
82879
83112
|
this.goToAnchor(href);
|
|
82880
83113
|
return;
|
|
82881
83114
|
}
|
|
83115
|
+
event.preventDefault();
|
|
83116
|
+
event.stopPropagation();
|
|
83117
|
+
const linkClickEvent = new CustomEvent("superdoc-link-click", {
|
|
83118
|
+
bubbles: true,
|
|
83119
|
+
composed: true,
|
|
83120
|
+
detail: {
|
|
83121
|
+
href,
|
|
83122
|
+
target: linkEl.getAttribute("target"),
|
|
83123
|
+
rel: linkEl.getAttribute("rel"),
|
|
83124
|
+
tooltip: linkEl.getAttribute("title"),
|
|
83125
|
+
element: linkEl,
|
|
83126
|
+
clientX: event.clientX,
|
|
83127
|
+
clientY: event.clientY
|
|
83128
|
+
}
|
|
83129
|
+
});
|
|
83130
|
+
linkEl.dispatchEvent(linkClickEvent);
|
|
83131
|
+
return;
|
|
82882
83132
|
}
|
|
82883
83133
|
const isDraggableAnnotation = target?.closest?.('[data-draggable="true"]') != null;
|
|
82884
83134
|
if (!__privateGet$1(this, _layoutState).layout) {
|
|
@@ -82976,6 +83226,44 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
82976
83226
|
__privateGet$1(this, _layoutState).measures,
|
|
82977
83227
|
hit.pos
|
|
82978
83228
|
);
|
|
83229
|
+
const targetImg = event.target?.closest?.("img");
|
|
83230
|
+
const imgPmStart = targetImg?.dataset?.pmStart ? Number(targetImg.dataset.pmStart) : null;
|
|
83231
|
+
if (!Number.isNaN(imgPmStart) && imgPmStart != null) {
|
|
83232
|
+
const doc222 = __privateGet$1(this, _editor3).state.doc;
|
|
83233
|
+
if (imgPmStart < 0 || imgPmStart >= doc222.content.size) {
|
|
83234
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
83235
|
+
console.warn(
|
|
83236
|
+
`[PresentationEditor] Invalid position ${imgPmStart} for inline image (document size: ${doc222.content.size})`
|
|
83237
|
+
);
|
|
83238
|
+
}
|
|
83239
|
+
return;
|
|
83240
|
+
}
|
|
83241
|
+
const newSelectionId = `inline-${imgPmStart}`;
|
|
83242
|
+
if (__privateGet$1(this, _lastSelectedImageBlockId) && __privateGet$1(this, _lastSelectedImageBlockId) !== newSelectionId) {
|
|
83243
|
+
this.emit("imageDeselected", { blockId: __privateGet$1(this, _lastSelectedImageBlockId) });
|
|
83244
|
+
}
|
|
83245
|
+
try {
|
|
83246
|
+
const tr = __privateGet$1(this, _editor3).state.tr.setSelection(NodeSelection.create(doc222, imgPmStart));
|
|
83247
|
+
__privateGet$1(this, _editor3).view?.dispatch(tr);
|
|
83248
|
+
const selector = `.superdoc-inline-image[data-pm-start="${imgPmStart}"]`;
|
|
83249
|
+
const targetElement = __privateGet$1(this, _viewportHost).querySelector(selector);
|
|
83250
|
+
this.emit("imageSelected", {
|
|
83251
|
+
element: targetElement ?? targetImg,
|
|
83252
|
+
blockId: null,
|
|
83253
|
+
pmStart: imgPmStart
|
|
83254
|
+
});
|
|
83255
|
+
__privateSet(this, _lastSelectedImageBlockId, newSelectionId);
|
|
83256
|
+
} catch (error) {
|
|
83257
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
83258
|
+
console.warn(
|
|
83259
|
+
`[PresentationEditor] Failed to create NodeSelection for inline image at position ${imgPmStart}:`,
|
|
83260
|
+
error
|
|
83261
|
+
);
|
|
83262
|
+
}
|
|
83263
|
+
}
|
|
83264
|
+
__privateMethod$1(this, _PresentationEditor_instances, focusEditorAfterImageSelection_fn).call(this);
|
|
83265
|
+
return;
|
|
83266
|
+
}
|
|
82979
83267
|
if (fragmentHit && (fragmentHit.fragment.kind === "image" || fragmentHit.fragment.kind === "drawing")) {
|
|
82980
83268
|
const doc222 = __privateGet$1(this, _editor3).state.doc;
|
|
82981
83269
|
try {
|
|
@@ -83002,15 +83290,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
83002
83290
|
console.warn("[PresentationEditor] Failed to create NodeSelection for atomic fragment:", error);
|
|
83003
83291
|
}
|
|
83004
83292
|
}
|
|
83005
|
-
__privateMethod$1(this, _PresentationEditor_instances,
|
|
83006
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
83007
|
-
document.activeElement.blur();
|
|
83008
|
-
}
|
|
83009
|
-
const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
|
|
83010
|
-
if (editorDom2) {
|
|
83011
|
-
editorDom2.focus();
|
|
83012
|
-
__privateGet$1(this, _editor3).view?.focus();
|
|
83013
|
-
}
|
|
83293
|
+
__privateMethod$1(this, _PresentationEditor_instances, focusEditorAfterImageSelection_fn).call(this);
|
|
83014
83294
|
return;
|
|
83015
83295
|
}
|
|
83016
83296
|
if (__privateGet$1(this, _lastSelectedImageBlockId)) {
|
|
@@ -83583,6 +83863,47 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
83583
83863
|
get overlayElement() {
|
|
83584
83864
|
return __privateGet$1(this, _selectionOverlay2) ?? null;
|
|
83585
83865
|
}
|
|
83866
|
+
/**
|
|
83867
|
+
* Get the current zoom level.
|
|
83868
|
+
*
|
|
83869
|
+
* The zoom level is a multiplier that controls the visual scale of the document.
|
|
83870
|
+
* This value is applied via CSS transform: scale() on the #viewportHost element,
|
|
83871
|
+
* which ensures consistent scaling between rendered content and overlay elements
|
|
83872
|
+
* (selections, cursors, interactive handles).
|
|
83873
|
+
*
|
|
83874
|
+
* Relationship to Centralized Zoom Architecture:
|
|
83875
|
+
* - PresentationEditor is the SINGLE SOURCE OF TRUTH for zoom state
|
|
83876
|
+
* - Zoom is applied internally via transform: scale() on #viewportHost
|
|
83877
|
+
* - External components (toolbar, UI controls) should use setZoom() to modify zoom
|
|
83878
|
+
* - The zoom value is used throughout the system for coordinate transformations
|
|
83879
|
+
*
|
|
83880
|
+
* Coordinate Space Implications:
|
|
83881
|
+
* - Layout coordinates: Unscaled logical pixels used by the layout engine
|
|
83882
|
+
* - Screen coordinates: Physical pixels affected by CSS transform: scale()
|
|
83883
|
+
* - Conversion: screenCoord = layoutCoord * zoom
|
|
83884
|
+
*
|
|
83885
|
+
* Zoom Scale:
|
|
83886
|
+
* - 1 = 100% (default, no scaling)
|
|
83887
|
+
* - 0.5 = 50% (zoomed out, content appears smaller)
|
|
83888
|
+
* - 2 = 200% (zoomed in, content appears larger)
|
|
83889
|
+
*
|
|
83890
|
+
* @returns The current zoom level multiplier (default: 1 if not configured)
|
|
83891
|
+
*
|
|
83892
|
+
* @example
|
|
83893
|
+
* ```typescript
|
|
83894
|
+
* const zoom = presentation.zoom;
|
|
83895
|
+
* // Convert layout coordinates to screen coordinates
|
|
83896
|
+
* const screenX = layoutX * zoom;
|
|
83897
|
+
* const screenY = layoutY * zoom;
|
|
83898
|
+
*
|
|
83899
|
+
* // Convert screen coordinates back to layout coordinates
|
|
83900
|
+
* const layoutX = screenX / zoom;
|
|
83901
|
+
* const layoutY = screenY / zoom;
|
|
83902
|
+
* ```
|
|
83903
|
+
*/
|
|
83904
|
+
get zoom() {
|
|
83905
|
+
return __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
83906
|
+
}
|
|
83586
83907
|
/**
|
|
83587
83908
|
* Set the document mode and update editor editability.
|
|
83588
83909
|
*
|
|
@@ -83773,8 +84094,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
83773
84094
|
const pageLocalY = rect.y - rect.pageIndex * pageHeight;
|
|
83774
84095
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
|
|
83775
84096
|
if (!coords) return null;
|
|
83776
|
-
const absLeft = coords.x + overlayRect.left;
|
|
83777
|
-
const absTop = coords.y + overlayRect.top;
|
|
84097
|
+
const absLeft = coords.x * zoom + overlayRect.left;
|
|
84098
|
+
const absTop = coords.y * zoom + overlayRect.top;
|
|
83778
84099
|
const left2 = relativeRect ? absLeft - relativeRect.left : absLeft;
|
|
83779
84100
|
const top2 = relativeRect ? absTop - relativeRect.top : absTop;
|
|
83780
84101
|
const width = Math.max(1, rect.width * zoom);
|
|
@@ -84691,7 +85012,7 @@ renderRemoteCursors_fn = function() {
|
|
|
84691
85012
|
};
|
|
84692
85013
|
renderRemoteCaret_fn = function(cursor) {
|
|
84693
85014
|
const caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, cursor.head);
|
|
84694
|
-
|
|
85015
|
+
__privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
84695
85016
|
const doc2 = __privateGet$1(this, _visibleHost).ownerDocument ?? document;
|
|
84696
85017
|
const color = __privateMethod$1(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
84697
85018
|
let caretEl = __privateGet$1(this, _remoteCursorElements).get(cursor.clientId);
|
|
@@ -84724,7 +85045,7 @@ renderRemoteCaret_fn = function(cursor) {
|
|
|
84724
85045
|
}
|
|
84725
85046
|
caretEl.style.opacity = "1";
|
|
84726
85047
|
caretEl.style.transform = `translate(${coords.x}px, ${coords.y}px)`;
|
|
84727
|
-
caretEl.style.height = `${Math.max(1, caretLayout.height
|
|
85048
|
+
caretEl.style.height = `${Math.max(1, caretLayout.height)}px`;
|
|
84728
85049
|
caretEl.style.borderLeftColor = color;
|
|
84729
85050
|
const labelEl = caretEl.querySelector(".presentation-editor__remote-label");
|
|
84730
85051
|
if (labelEl) {
|
|
@@ -84764,7 +85085,6 @@ renderRemoteSelection_fn = function(cursor) {
|
|
|
84764
85085
|
const end2 = Math.max(cursor.anchor, cursor.head);
|
|
84765
85086
|
const rects = selectionToRects(layout, blocks, measures, start2, end2) ?? [];
|
|
84766
85087
|
const color = __privateMethod$1(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
84767
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
84768
85088
|
const opacity = __privateGet$1(this, _layoutOptions).presence?.highlightOpacity ?? 0.35;
|
|
84769
85089
|
const pageHeight = layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
84770
85090
|
const doc2 = __privateGet$1(this, _visibleHost).ownerDocument ?? document;
|
|
@@ -84778,8 +85098,8 @@ renderRemoteSelection_fn = function(cursor) {
|
|
|
84778
85098
|
selectionEl.style.position = "absolute";
|
|
84779
85099
|
selectionEl.style.left = `${coords.x}px`;
|
|
84780
85100
|
selectionEl.style.top = `${coords.y}px`;
|
|
84781
|
-
selectionEl.style.width = `${Math.max(1, rect.width
|
|
84782
|
-
selectionEl.style.height = `${Math.max(1, rect.height
|
|
85101
|
+
selectionEl.style.width = `${Math.max(1, rect.width)}px`;
|
|
85102
|
+
selectionEl.style.height = `${Math.max(1, rect.height)}px`;
|
|
84783
85103
|
selectionEl.style.backgroundColor = color;
|
|
84784
85104
|
selectionEl.style.opacity = opacity.toString();
|
|
84785
85105
|
selectionEl.style.borderRadius = _PresentationEditor.CURSOR_STYLES.SELECTION_BORDER_RADIUS;
|
|
@@ -84889,6 +85209,17 @@ setupDragHandlers_fn = function() {
|
|
|
84889
85209
|
}
|
|
84890
85210
|
}));
|
|
84891
85211
|
};
|
|
85212
|
+
focusEditorAfterImageSelection_fn = function() {
|
|
85213
|
+
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
85214
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
85215
|
+
document.activeElement.blur();
|
|
85216
|
+
}
|
|
85217
|
+
const editorDom = __privateGet$1(this, _editor3).view?.dom;
|
|
85218
|
+
if (editorDom) {
|
|
85219
|
+
editorDom.focus();
|
|
85220
|
+
__privateGet$1(this, _editor3).view?.focus();
|
|
85221
|
+
}
|
|
85222
|
+
};
|
|
84892
85223
|
setupInputBridge_fn = function() {
|
|
84893
85224
|
__privateGet$1(this, _inputBridge)?.destroy();
|
|
84894
85225
|
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
@@ -85312,6 +85643,9 @@ scheduleSelectionUpdate_fn = function() {
|
|
|
85312
85643
|
if (__privateGet$1(this, _selectionUpdateScheduled)) {
|
|
85313
85644
|
return;
|
|
85314
85645
|
}
|
|
85646
|
+
if (__privateGet$1(this, _isRerendering) || __privateGet$1(this, _pendingDocChange)) {
|
|
85647
|
+
return;
|
|
85648
|
+
}
|
|
85315
85649
|
__privateSet(this, _selectionUpdateScheduled, true);
|
|
85316
85650
|
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
85317
85651
|
win.requestAnimationFrame(() => {
|
|
@@ -85327,13 +85661,26 @@ updateSelection_fn = function() {
|
|
|
85327
85661
|
return;
|
|
85328
85662
|
}
|
|
85329
85663
|
if (__privateGet$1(this, _documentMode) === "viewing") {
|
|
85330
|
-
|
|
85664
|
+
try {
|
|
85665
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
85666
|
+
} catch (error) {
|
|
85667
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
85668
|
+
console.warn("[PresentationEditor] Failed to clear selection layer in viewing mode:", error);
|
|
85669
|
+
}
|
|
85670
|
+
}
|
|
85331
85671
|
return;
|
|
85332
85672
|
}
|
|
85333
85673
|
const layout = __privateGet$1(this, _layoutState).layout;
|
|
85334
|
-
const
|
|
85335
|
-
|
|
85674
|
+
const editorState = this.getActiveEditor().state;
|
|
85675
|
+
const selection = editorState?.selection;
|
|
85336
85676
|
if (!selection) {
|
|
85677
|
+
try {
|
|
85678
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
85679
|
+
} catch (error) {
|
|
85680
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
85681
|
+
console.warn("[PresentationEditor] Failed to clear selection layer (no selection):", error);
|
|
85682
|
+
}
|
|
85683
|
+
}
|
|
85337
85684
|
return;
|
|
85338
85685
|
}
|
|
85339
85686
|
if (!layout) {
|
|
@@ -85341,15 +85688,40 @@ updateSelection_fn = function() {
|
|
|
85341
85688
|
}
|
|
85342
85689
|
const { from: from2, to } = selection;
|
|
85343
85690
|
if (from2 === to) {
|
|
85344
|
-
|
|
85691
|
+
let caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2);
|
|
85692
|
+
const doc2 = editorState?.doc;
|
|
85693
|
+
if (!doc2) {
|
|
85694
|
+
return;
|
|
85695
|
+
}
|
|
85696
|
+
const docSize = doc2.content?.size ?? 0;
|
|
85697
|
+
if (!caretLayout && from2 > 0) {
|
|
85698
|
+
caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2 - 1);
|
|
85699
|
+
}
|
|
85700
|
+
if (!caretLayout && from2 + 1 <= docSize) {
|
|
85701
|
+
caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2 + 1);
|
|
85702
|
+
}
|
|
85345
85703
|
if (!caretLayout) {
|
|
85346
85704
|
return;
|
|
85347
85705
|
}
|
|
85348
|
-
|
|
85706
|
+
try {
|
|
85707
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
85708
|
+
__privateMethod$1(this, _PresentationEditor_instances, renderCaretOverlay_fn).call(this, caretLayout);
|
|
85709
|
+
} catch (error) {
|
|
85710
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
85711
|
+
console.warn("[PresentationEditor] Failed to render caret overlay:", error);
|
|
85712
|
+
}
|
|
85713
|
+
}
|
|
85349
85714
|
return;
|
|
85350
85715
|
}
|
|
85351
85716
|
const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, from2, to) ?? [];
|
|
85352
|
-
|
|
85717
|
+
try {
|
|
85718
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
85719
|
+
__privateMethod$1(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this, rects);
|
|
85720
|
+
} catch (error) {
|
|
85721
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
85722
|
+
console.warn("[PresentationEditor] Failed to render selection rects:", error);
|
|
85723
|
+
}
|
|
85724
|
+
}
|
|
85353
85725
|
};
|
|
85354
85726
|
resolveLayoutOptions_fn = function(blocks, sectionMetadata) {
|
|
85355
85727
|
const defaults = __privateMethod$1(this, _PresentationEditor_instances, computeDefaultLayoutDefaults_fn).call(this);
|
|
@@ -86095,7 +86467,6 @@ renderSelectionRects_fn = function(rects) {
|
|
|
86095
86467
|
return;
|
|
86096
86468
|
}
|
|
86097
86469
|
const pageHeight = __privateMethod$1(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
86098
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
86099
86470
|
rects.forEach((rect, _index) => {
|
|
86100
86471
|
const pageLocalY = rect.y - rect.pageIndex * pageHeight;
|
|
86101
86472
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
|
|
@@ -86110,8 +86481,8 @@ renderSelectionRects_fn = function(rects) {
|
|
|
86110
86481
|
highlight.style.position = "absolute";
|
|
86111
86482
|
highlight.style.left = `${coords.x}px`;
|
|
86112
86483
|
highlight.style.top = `${coords.y}px`;
|
|
86113
|
-
highlight.style.width = `${Math.max(1, rect.width
|
|
86114
|
-
highlight.style.height = `${Math.max(1, rect.height
|
|
86484
|
+
highlight.style.width = `${Math.max(1, rect.width)}px`;
|
|
86485
|
+
highlight.style.height = `${Math.max(1, rect.height)}px`;
|
|
86115
86486
|
highlight.style.backgroundColor = "rgba(51, 132, 255, 0.35)";
|
|
86116
86487
|
highlight.style.borderRadius = "2px";
|
|
86117
86488
|
highlight.style.pointerEvents = "none";
|
|
@@ -86120,7 +86491,6 @@ renderSelectionRects_fn = function(rects) {
|
|
|
86120
86491
|
};
|
|
86121
86492
|
renderHoverRegion_fn = function(region) {
|
|
86122
86493
|
if (!__privateGet$1(this, _hoverOverlay) || !__privateGet$1(this, _hoverTooltip)) return;
|
|
86123
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
86124
86494
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, region.pageIndex, region.localX, region.localY);
|
|
86125
86495
|
if (!coords) {
|
|
86126
86496
|
__privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
|
|
@@ -86129,15 +86499,15 @@ renderHoverRegion_fn = function(region) {
|
|
|
86129
86499
|
__privateGet$1(this, _hoverOverlay).style.display = "block";
|
|
86130
86500
|
__privateGet$1(this, _hoverOverlay).style.left = `${coords.x}px`;
|
|
86131
86501
|
__privateGet$1(this, _hoverOverlay).style.top = `${coords.y}px`;
|
|
86132
|
-
__privateGet$1(this, _hoverOverlay).style.width = `${region.width
|
|
86133
|
-
__privateGet$1(this, _hoverOverlay).style.height = `${region.height
|
|
86502
|
+
__privateGet$1(this, _hoverOverlay).style.width = `${region.width}px`;
|
|
86503
|
+
__privateGet$1(this, _hoverOverlay).style.height = `${region.height}px`;
|
|
86134
86504
|
const tooltipText = `Double-click to edit ${region.kind === "header" ? "header" : "footer"}`;
|
|
86135
86505
|
__privateGet$1(this, _hoverTooltip).textContent = tooltipText;
|
|
86136
86506
|
__privateGet$1(this, _hoverTooltip).style.display = "block";
|
|
86137
86507
|
__privateGet$1(this, _hoverTooltip).style.left = `${coords.x}px`;
|
|
86138
86508
|
const tooltipHeight = 24;
|
|
86139
86509
|
const spaceAbove = coords.y;
|
|
86140
|
-
const regionHeight = region.height
|
|
86510
|
+
const regionHeight = region.height;
|
|
86141
86511
|
const tooltipY = spaceAbove < tooltipHeight + 4 ? coords.y + regionHeight + 4 : coords.y - tooltipHeight;
|
|
86142
86512
|
__privateGet$1(this, _hoverTooltip).style.top = `${Math.max(0, tooltipY)}px`;
|
|
86143
86513
|
};
|
|
@@ -86154,11 +86524,11 @@ renderCaretOverlay_fn = function(caretLayout) {
|
|
|
86154
86524
|
if (!__privateGet$1(this, _localSelectionLayer)) {
|
|
86155
86525
|
return;
|
|
86156
86526
|
}
|
|
86157
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
86158
86527
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, caretLayout.pageIndex, caretLayout.x, caretLayout.y);
|
|
86159
86528
|
if (!coords) {
|
|
86160
86529
|
return;
|
|
86161
86530
|
}
|
|
86531
|
+
const finalHeight = Math.max(1, caretLayout.height);
|
|
86162
86532
|
const caretEl = __privateGet$1(this, _localSelectionLayer).ownerDocument?.createElement("div");
|
|
86163
86533
|
if (!caretEl) {
|
|
86164
86534
|
return;
|
|
@@ -86168,7 +86538,7 @@ renderCaretOverlay_fn = function(caretLayout) {
|
|
|
86168
86538
|
caretEl.style.left = `${coords.x}px`;
|
|
86169
86539
|
caretEl.style.top = `${coords.y}px`;
|
|
86170
86540
|
caretEl.style.width = "2px";
|
|
86171
|
-
caretEl.style.height = `${
|
|
86541
|
+
caretEl.style.height = `${finalHeight}px`;
|
|
86172
86542
|
caretEl.style.backgroundColor = "#3366FF";
|
|
86173
86543
|
caretEl.style.borderRadius = "1px";
|
|
86174
86544
|
caretEl.style.pointerEvents = "none";
|
|
@@ -86322,7 +86692,8 @@ inchesToPx_fn = function(value) {
|
|
|
86322
86692
|
};
|
|
86323
86693
|
applyZoom_fn = function() {
|
|
86324
86694
|
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
86325
|
-
__privateGet$1(this,
|
|
86695
|
+
__privateGet$1(this, _viewportHost).style.transformOrigin = "top left";
|
|
86696
|
+
__privateGet$1(this, _viewportHost).style.transform = zoom === 1 ? "" : `scale(${zoom})`;
|
|
86326
86697
|
};
|
|
86327
86698
|
createLayoutMetrics_fn = function(perf, startMark, layout, blocks) {
|
|
86328
86699
|
if (!perf || startMark == null || typeof perf.now !== "function") {
|
|
@@ -86336,20 +86707,28 @@ createLayoutMetrics_fn = function(perf, startMark, layout, blocks) {
|
|
|
86336
86707
|
};
|
|
86337
86708
|
};
|
|
86338
86709
|
convertPageLocalToOverlayCoords_fn = function(pageIndex, pageLocalX, pageLocalY) {
|
|
86339
|
-
|
|
86340
|
-
|
|
86341
|
-
|
|
86342
|
-
|
|
86710
|
+
if (!Number.isFinite(pageIndex) || pageIndex < 0) {
|
|
86711
|
+
console.warn(
|
|
86712
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageIndex ${pageIndex}. Expected a finite non-negative number.`
|
|
86713
|
+
);
|
|
86343
86714
|
return null;
|
|
86344
86715
|
}
|
|
86345
|
-
|
|
86346
|
-
|
|
86347
|
-
|
|
86348
|
-
|
|
86349
|
-
|
|
86716
|
+
if (!Number.isFinite(pageLocalX)) {
|
|
86717
|
+
console.warn(
|
|
86718
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageLocalX ${pageLocalX}. Expected a finite number.`
|
|
86719
|
+
);
|
|
86720
|
+
return null;
|
|
86721
|
+
}
|
|
86722
|
+
if (!Number.isFinite(pageLocalY)) {
|
|
86723
|
+
console.warn(
|
|
86724
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageLocalY ${pageLocalY}. Expected a finite number.`
|
|
86725
|
+
);
|
|
86726
|
+
return null;
|
|
86727
|
+
}
|
|
86728
|
+
const pageHeight = __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
86350
86729
|
return {
|
|
86351
|
-
x:
|
|
86352
|
-
y:
|
|
86730
|
+
x: pageLocalX,
|
|
86731
|
+
y: pageIndex * pageHeight + pageLocalY
|
|
86353
86732
|
};
|
|
86354
86733
|
};
|
|
86355
86734
|
normalizeClientPoint_fn = function(clientX, clientY) {
|
|
@@ -101014,7 +101393,8 @@ const Strike = Mark2.create({
|
|
|
101014
101393
|
},
|
|
101015
101394
|
addShortcuts() {
|
|
101016
101395
|
return {
|
|
101017
|
-
"Mod-Shift-
|
|
101396
|
+
"Mod-Shift-x": () => this.editor.commands.toggleStrike(),
|
|
101397
|
+
"Mod-Shift-X": () => this.editor.commands.toggleStrike()
|
|
101018
101398
|
};
|
|
101019
101399
|
}
|
|
101020
101400
|
});
|
|
@@ -119012,16 +119392,6 @@ const _SuperToolbar = class _SuperToolbar2 extends EventEmitter2 {
|
|
|
119012
119392
|
if (!argument) return;
|
|
119013
119393
|
item.onActivate({ zoom: argument });
|
|
119014
119394
|
this.emit("superdoc-command", { item, argument });
|
|
119015
|
-
const layers = this.superdoc.element?.querySelector(".layers");
|
|
119016
|
-
if (!layers) return;
|
|
119017
|
-
const isMobileDevice = typeof screen.orientation !== "undefined";
|
|
119018
|
-
const isSmallScreen = window.matchMedia("(max-width: 834px)").matches;
|
|
119019
|
-
if (isMobileDevice && isSmallScreen) {
|
|
119020
|
-
layers.style.transformOrigin = "0 0";
|
|
119021
|
-
layers.style.transform = `scale(${parseInt(argument, 10) / 100})`;
|
|
119022
|
-
} else {
|
|
119023
|
-
layers.style.zoom = parseInt(argument, 10) / 100;
|
|
119024
|
-
}
|
|
119025
119395
|
this.superdoc.superdocStore.activeZoom = parseInt(argument, 10);
|
|
119026
119396
|
},
|
|
119027
119397
|
/**
|
|
@@ -121292,6 +121662,19 @@ const _sfc_main$4 = {
|
|
|
121292
121662
|
const emit = __emit;
|
|
121293
121663
|
const overlayRect = vue.ref(null);
|
|
121294
121664
|
const tableMetadata = vue.ref(null);
|
|
121665
|
+
const getZoom = () => {
|
|
121666
|
+
const editor = props.editor;
|
|
121667
|
+
if (editor && typeof editor.zoom === "number") {
|
|
121668
|
+
return editor.zoom;
|
|
121669
|
+
}
|
|
121670
|
+
if (editor?.presentationEditor && typeof editor.presentationEditor.zoom === "number") {
|
|
121671
|
+
return editor.presentationEditor.zoom;
|
|
121672
|
+
}
|
|
121673
|
+
console.warn(
|
|
121674
|
+
"[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."
|
|
121675
|
+
);
|
|
121676
|
+
return 1;
|
|
121677
|
+
};
|
|
121295
121678
|
const dragState = vue.ref(null);
|
|
121296
121679
|
const forcedCleanup = vue.ref(false);
|
|
121297
121680
|
let rafId = null;
|
|
@@ -121401,12 +121784,16 @@ const _sfc_main$4 = {
|
|
|
121401
121784
|
}));
|
|
121402
121785
|
}
|
|
121403
121786
|
function getSegmentHandleStyle(boundary, segment) {
|
|
121787
|
+
const zoom = getZoom();
|
|
121788
|
+
const scaledX = boundary.x * zoom;
|
|
121789
|
+
const scaledY = segment.y != null ? segment.y * zoom : null;
|
|
121790
|
+
const scaledH = segment.h != null ? segment.h * zoom : null;
|
|
121404
121791
|
return {
|
|
121405
121792
|
position: "absolute",
|
|
121406
|
-
left: `${
|
|
121407
|
-
top:
|
|
121793
|
+
left: `${scaledX}px`,
|
|
121794
|
+
top: scaledY != null ? `${scaledY}px` : "0",
|
|
121408
121795
|
width: `${RESIZE_HANDLE_WIDTH_PX}px`,
|
|
121409
|
-
height:
|
|
121796
|
+
height: scaledH != null ? `${scaledH}px` : "100%",
|
|
121410
121797
|
transform: `translateX(-${RESIZE_HANDLE_OFFSET_PX}px)`,
|
|
121411
121798
|
cursor: "col-resize",
|
|
121412
121799
|
pointerEvents: "auto"
|
|
@@ -121416,7 +121803,8 @@ const _sfc_main$4 = {
|
|
|
121416
121803
|
if (!dragState.value || !tableMetadata.value) return { display: "none" };
|
|
121417
121804
|
const initialBoundary = resizableBoundaries.value[dragState.value.resizableBoundaryIndex];
|
|
121418
121805
|
if (!initialBoundary) return { display: "none" };
|
|
121419
|
-
const
|
|
121806
|
+
const zoom = getZoom();
|
|
121807
|
+
const newX = (initialBoundary.x + dragState.value.constrainedDelta) * zoom;
|
|
121420
121808
|
return {
|
|
121421
121809
|
position: "absolute",
|
|
121422
121810
|
left: `${newX}px`,
|
|
@@ -121544,7 +121932,9 @@ const _sfc_main$4 = {
|
|
|
121544
121932
|
}
|
|
121545
121933
|
const mouseMoveThrottle = throttle2((event) => {
|
|
121546
121934
|
if (isUnmounted || !dragState.value) return;
|
|
121547
|
-
const
|
|
121935
|
+
const zoom = getZoom();
|
|
121936
|
+
const screenDelta = event.clientX - dragState.value.initialX;
|
|
121937
|
+
const delta = screenDelta / zoom;
|
|
121548
121938
|
const minDelta = -(dragState.value.leftColumn.width - dragState.value.leftColumn.minWidth);
|
|
121549
121939
|
let maxDelta;
|
|
121550
121940
|
if (dragState.value.isRightEdge) {
|
|
@@ -121555,7 +121945,7 @@ const _sfc_main$4 = {
|
|
|
121555
121945
|
const tableLeftInPage = tableRect.left - pageRect.left;
|
|
121556
121946
|
const rightMargin = tableLeftInPage;
|
|
121557
121947
|
const maxRightPosition = pageRect.right - rightMargin;
|
|
121558
|
-
const availableSpace = maxRightPosition - tableRect.right;
|
|
121948
|
+
const availableSpace = (maxRightPosition - tableRect.right) / zoom;
|
|
121559
121949
|
maxDelta = Math.max(0, availableSpace);
|
|
121560
121950
|
} else {
|
|
121561
121951
|
maxDelta = Infinity;
|
|
@@ -121791,7 +122181,7 @@ const _sfc_main$4 = {
|
|
|
121791
122181
|
};
|
|
121792
122182
|
}
|
|
121793
122183
|
};
|
|
121794
|
-
const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
122184
|
+
const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-814384b6"]]);
|
|
121795
122185
|
const _hoisted_1$2 = ["data-handle-position", "onMousedown"];
|
|
121796
122186
|
const OVERLAY_EXPANSION_PX = 2e3;
|
|
121797
122187
|
const RESIZE_HANDLE_SIZE_PX = 12;
|
|
@@ -122225,6 +122615,8 @@ const _sfc_main$3 = {
|
|
|
122225
122615
|
}
|
|
122226
122616
|
};
|
|
122227
122617
|
const ImageResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-e66ec7bb"]]);
|
|
122618
|
+
const LINK_CLICK_DEBOUNCE_MS = 300;
|
|
122619
|
+
const CURSOR_UPDATE_TIMEOUT_MS = 10;
|
|
122228
122620
|
const _sfc_main$2 = {
|
|
122229
122621
|
__name: "LinkClickHandler",
|
|
122230
122622
|
props: {
|
|
@@ -122247,7 +122639,15 @@ const _sfc_main$2 = {
|
|
|
122247
122639
|
},
|
|
122248
122640
|
setup(__props) {
|
|
122249
122641
|
const props = __props;
|
|
122642
|
+
let lastLinkClickTime = 0;
|
|
122250
122643
|
const handleLinkClick = (event) => {
|
|
122644
|
+
const detail = event?.detail ?? {};
|
|
122645
|
+
const linkElement = detail.element;
|
|
122646
|
+
const now = Date.now();
|
|
122647
|
+
if (now - lastLinkClickTime < LINK_CLICK_DEBOUNCE_MS) {
|
|
122648
|
+
return;
|
|
122649
|
+
}
|
|
122650
|
+
lastLinkClickTime = now;
|
|
122251
122651
|
if (props.popoverVisible) {
|
|
122252
122652
|
props.closePopover();
|
|
122253
122653
|
return;
|
|
@@ -122259,12 +122659,34 @@ const _sfc_main$2 = {
|
|
|
122259
122659
|
if (!surface) {
|
|
122260
122660
|
return;
|
|
122261
122661
|
}
|
|
122262
|
-
const
|
|
122263
|
-
|
|
122662
|
+
const pmStart = linkElement?.dataset?.pmStart;
|
|
122663
|
+
if (pmStart != null) {
|
|
122664
|
+
const pos = parseInt(pmStart, 10);
|
|
122665
|
+
const state2 = props.editor.state;
|
|
122666
|
+
const doc2 = state2.doc;
|
|
122667
|
+
if (!isNaN(pos) && pos >= 0 && pos <= doc2.content.size) {
|
|
122668
|
+
const tr = state2.tr.setSelection(TextSelection$1.create(doc2, pos));
|
|
122669
|
+
props.editor.dispatch(tr);
|
|
122670
|
+
} else {
|
|
122671
|
+
console.warn(`Invalid PM position from data-pm-start: ${pmStart}, falling back to coordinate-based positioning`);
|
|
122672
|
+
moveCursorToMouseEvent(detail, props.editor);
|
|
122673
|
+
}
|
|
122674
|
+
} else {
|
|
122675
|
+
moveCursorToMouseEvent(detail, props.editor);
|
|
122676
|
+
}
|
|
122264
122677
|
setTimeout(() => {
|
|
122265
122678
|
const currentState = props.editor.state;
|
|
122679
|
+
const $from = currentState.selection.$from;
|
|
122680
|
+
const linkMarkType = currentState.schema.marks.link;
|
|
122681
|
+
const nodeAfter = $from.nodeAfter;
|
|
122682
|
+
const nodeBefore = $from.nodeBefore;
|
|
122683
|
+
const marksOnNodeAfter = nodeAfter?.marks || [];
|
|
122684
|
+
const marksOnNodeBefore = nodeBefore?.marks || [];
|
|
122685
|
+
const linkOnNodeAfter = linkMarkType && marksOnNodeAfter.some((m2) => m2.type === linkMarkType);
|
|
122686
|
+
const linkOnNodeBefore = linkMarkType && marksOnNodeBefore.some((m2) => m2.type === linkMarkType);
|
|
122687
|
+
const hasLinkAdjacent = linkOnNodeAfter || linkOnNodeBefore;
|
|
122266
122688
|
const hasLink = selectionHasNodeOrMark(currentState, "link", { requireEnds: true });
|
|
122267
|
-
if (hasLink) {
|
|
122689
|
+
if (hasLink || hasLinkAdjacent) {
|
|
122268
122690
|
const surfaceRect = surface.getBoundingClientRect();
|
|
122269
122691
|
if (!surfaceRect) return;
|
|
122270
122692
|
props.openPopover(
|
|
@@ -122280,7 +122702,7 @@ const _sfc_main$2 = {
|
|
|
122280
122702
|
}
|
|
122281
122703
|
);
|
|
122282
122704
|
}
|
|
122283
|
-
},
|
|
122705
|
+
}, CURSOR_UPDATE_TIMEOUT_MS);
|
|
122284
122706
|
};
|
|
122285
122707
|
let surfaceElement = null;
|
|
122286
122708
|
vue.onMounted(() => {
|
|
@@ -122326,7 +122748,7 @@ const _hoisted_3 = { class: "placeholder-title" };
|
|
|
122326
122748
|
const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
122327
122749
|
const TABLE_RESIZE_HOVER_THRESHOLD = 8;
|
|
122328
122750
|
const TABLE_RESIZE_THROTTLE_MS = 16;
|
|
122329
|
-
const _sfc_main$1 = {
|
|
122751
|
+
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
122330
122752
|
__name: "SuperEditor",
|
|
122331
122753
|
props: {
|
|
122332
122754
|
documentId: {
|
|
@@ -122395,6 +122817,24 @@ const _sfc_main$1 = {
|
|
|
122395
122817
|
imageElement: null,
|
|
122396
122818
|
blockId: null
|
|
122397
122819
|
});
|
|
122820
|
+
const selectedImageState = vue.reactive({
|
|
122821
|
+
element: null,
|
|
122822
|
+
blockId: null,
|
|
122823
|
+
pmStart: null
|
|
122824
|
+
});
|
|
122825
|
+
const getEditorZoom = () => {
|
|
122826
|
+
const active = activeEditor.value;
|
|
122827
|
+
if (active && typeof active.zoom === "number") {
|
|
122828
|
+
return active.zoom;
|
|
122829
|
+
}
|
|
122830
|
+
if (active?.presentationEditor && typeof active.presentationEditor.zoom === "number") {
|
|
122831
|
+
return active.presentationEditor.zoom;
|
|
122832
|
+
}
|
|
122833
|
+
console.warn(
|
|
122834
|
+
"[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."
|
|
122835
|
+
);
|
|
122836
|
+
return 1;
|
|
122837
|
+
};
|
|
122398
122838
|
let lastUpdateTableResizeTimestamp = 0;
|
|
122399
122839
|
const isNearColumnBoundary = (event, tableElement) => {
|
|
122400
122840
|
if (!event || typeof event.clientX !== "number" || typeof event.clientY !== "number") {
|
|
@@ -122410,13 +122850,26 @@ const _sfc_main$1 = {
|
|
|
122410
122850
|
try {
|
|
122411
122851
|
const metadata = JSON.parse(boundariesAttr);
|
|
122412
122852
|
if (!metadata.columns || !Array.isArray(metadata.columns)) return false;
|
|
122853
|
+
const zoom = getEditorZoom();
|
|
122413
122854
|
const tableRect = tableElement.getBoundingClientRect();
|
|
122414
|
-
const
|
|
122415
|
-
const
|
|
122855
|
+
const mouseXScreen = event.clientX - tableRect.left;
|
|
122856
|
+
const mouseYScreen = event.clientY - tableRect.top;
|
|
122416
122857
|
for (let i2 = 0; i2 < metadata.columns.length; i2++) {
|
|
122417
122858
|
const col = metadata.columns[i2];
|
|
122418
|
-
|
|
122419
|
-
|
|
122859
|
+
if (!col || typeof col !== "object") {
|
|
122860
|
+
console.warn(`[isNearColumnBoundary] Invalid column at index ${i2}: not an object`, col);
|
|
122861
|
+
continue;
|
|
122862
|
+
}
|
|
122863
|
+
if (typeof col.x !== "number" || !Number.isFinite(col.x)) {
|
|
122864
|
+
console.warn(`[isNearColumnBoundary] Invalid column.x at index ${i2}:`, col.x);
|
|
122865
|
+
continue;
|
|
122866
|
+
}
|
|
122867
|
+
if (typeof col.w !== "number" || !Number.isFinite(col.w) || col.w <= 0) {
|
|
122868
|
+
console.warn(`[isNearColumnBoundary] Invalid column.w at index ${i2}:`, col.w);
|
|
122869
|
+
continue;
|
|
122870
|
+
}
|
|
122871
|
+
const boundaryXScreen = (col.x + col.w) * zoom;
|
|
122872
|
+
if (Math.abs(mouseXScreen - boundaryXScreen) <= TABLE_RESIZE_HOVER_THRESHOLD) {
|
|
122420
122873
|
const segmentColIndex = i2 + 1;
|
|
122421
122874
|
const segments = metadata.segments?.[segmentColIndex];
|
|
122422
122875
|
if (!segments || segments.length === 0) {
|
|
@@ -122424,15 +122877,15 @@ const _sfc_main$1 = {
|
|
|
122424
122877
|
continue;
|
|
122425
122878
|
}
|
|
122426
122879
|
for (const seg of segments) {
|
|
122427
|
-
const
|
|
122428
|
-
const
|
|
122429
|
-
if (
|
|
122880
|
+
const segTopScreen = (seg.y || 0) * zoom;
|
|
122881
|
+
const segBottomScreen = seg.h != null ? segTopScreen + seg.h * zoom : tableRect.height;
|
|
122882
|
+
if (mouseYScreen >= segTopScreen && mouseYScreen <= segBottomScreen) {
|
|
122430
122883
|
return true;
|
|
122431
122884
|
}
|
|
122432
122885
|
}
|
|
122433
122886
|
}
|
|
122434
122887
|
}
|
|
122435
|
-
if (Math.abs(
|
|
122888
|
+
if (Math.abs(mouseXScreen) <= TABLE_RESIZE_HOVER_THRESHOLD) {
|
|
122436
122889
|
return true;
|
|
122437
122890
|
}
|
|
122438
122891
|
return false;
|
|
@@ -122496,6 +122949,27 @@ const _sfc_main$1 = {
|
|
|
122496
122949
|
imageResizeState.imageElement = null;
|
|
122497
122950
|
imageResizeState.blockId = null;
|
|
122498
122951
|
};
|
|
122952
|
+
const clearSelectedImage = () => {
|
|
122953
|
+
if (selectedImageState.element?.classList?.contains("superdoc-image-selected")) {
|
|
122954
|
+
selectedImageState.element.classList.remove("superdoc-image-selected");
|
|
122955
|
+
}
|
|
122956
|
+
selectedImageState.element = null;
|
|
122957
|
+
selectedImageState.blockId = null;
|
|
122958
|
+
selectedImageState.pmStart = null;
|
|
122959
|
+
};
|
|
122960
|
+
const setSelectedImage = (element, blockId, pmStart) => {
|
|
122961
|
+
if (selectedImageState.element && selectedImageState.element !== element) {
|
|
122962
|
+
selectedImageState.element.classList.remove("superdoc-image-selected");
|
|
122963
|
+
}
|
|
122964
|
+
if (element && element.classList) {
|
|
122965
|
+
element.classList.add("superdoc-image-selected");
|
|
122966
|
+
selectedImageState.element = element;
|
|
122967
|
+
selectedImageState.blockId = blockId ?? null;
|
|
122968
|
+
selectedImageState.pmStart = typeof pmStart === "number" ? pmStart : null;
|
|
122969
|
+
} else {
|
|
122970
|
+
clearSelectedImage();
|
|
122971
|
+
}
|
|
122972
|
+
};
|
|
122499
122973
|
const handleOverlayUpdates = (event) => {
|
|
122500
122974
|
updateTableResizeOverlay(event);
|
|
122501
122975
|
updateImageResizeOverlay(event);
|
|
@@ -122586,6 +123060,7 @@ const _sfc_main$1 = {
|
|
|
122586
123060
|
const initEditor = async ({ content, media = {}, mediaFiles = {}, fonts = {} } = {}) => {
|
|
122587
123061
|
const { editorCtor, ...editorOptions } = props.options || {};
|
|
122588
123062
|
const EditorCtor = editorCtor ?? Editor;
|
|
123063
|
+
clearSelectedImage();
|
|
122589
123064
|
editor.value = new EditorCtor({
|
|
122590
123065
|
mode: "docx",
|
|
122591
123066
|
element: editorElem.value,
|
|
@@ -122602,17 +123077,19 @@ const _sfc_main$1 = {
|
|
|
122602
123077
|
editor: activeEditor.value,
|
|
122603
123078
|
presentationEditor: editor.value instanceof PresentationEditor ? editor.value : null
|
|
122604
123079
|
});
|
|
122605
|
-
editor.value.on("paginationUpdate", () => {
|
|
122606
|
-
const base2 = activeEditor.value;
|
|
122607
|
-
if (isHeadless(base2)) return;
|
|
122608
|
-
const paginationTarget = editor.value?.editor ? { value: base2 } : editor;
|
|
122609
|
-
adjustPaginationBreaks(editorElem, paginationTarget);
|
|
122610
|
-
});
|
|
122611
123080
|
if (editor.value instanceof PresentationEditor) {
|
|
122612
|
-
editor.value
|
|
123081
|
+
const presentationEditor = editor.value;
|
|
123082
|
+
presentationEditor.on("imageSelected", ({ element, blockId, pmStart }) => {
|
|
123083
|
+
setSelectedImage(element, blockId ?? null, pmStart);
|
|
123084
|
+
});
|
|
123085
|
+
presentationEditor.on("imageDeselected", () => {
|
|
123086
|
+
clearSelectedImage();
|
|
123087
|
+
});
|
|
123088
|
+
presentationEditor.on("layoutUpdated", () => {
|
|
122613
123089
|
if (imageResizeState.visible && imageResizeState.blockId) {
|
|
123090
|
+
const escapedBlockId = CSS.escape(imageResizeState.blockId);
|
|
122614
123091
|
const newElement = editorElem.value?.querySelector(
|
|
122615
|
-
`.superdoc-image-fragment[data-sd-block-id="${
|
|
123092
|
+
`.superdoc-image-fragment[data-sd-block-id="${escapedBlockId}"]`
|
|
122616
123093
|
);
|
|
122617
123094
|
if (newElement) {
|
|
122618
123095
|
imageResizeState.imageElement = newElement;
|
|
@@ -122622,8 +123099,33 @@ const _sfc_main$1 = {
|
|
|
122622
123099
|
imageResizeState.blockId = null;
|
|
122623
123100
|
}
|
|
122624
123101
|
}
|
|
123102
|
+
if (selectedImageState.blockId) {
|
|
123103
|
+
const escapedBlockId = CSS.escape(selectedImageState.blockId);
|
|
123104
|
+
const refreshed = editorElem.value?.querySelector(
|
|
123105
|
+
`.superdoc-image-fragment[data-sd-block-id="${escapedBlockId}"]`
|
|
123106
|
+
);
|
|
123107
|
+
if (refreshed) {
|
|
123108
|
+
setSelectedImage(refreshed, selectedImageState.blockId, selectedImageState.pmStart);
|
|
123109
|
+
} else {
|
|
123110
|
+
if (selectedImageState.pmStart != null) {
|
|
123111
|
+
const pmSelector = `.superdoc-image-fragment[data-pm-start="${selectedImageState.pmStart}"], .superdoc-inline-image[data-pm-start="${selectedImageState.pmStart}"]`;
|
|
123112
|
+
const pmElement = editorElem.value?.querySelector(pmSelector);
|
|
123113
|
+
if (pmElement) {
|
|
123114
|
+
setSelectedImage(pmElement, selectedImageState.blockId, selectedImageState.pmStart);
|
|
123115
|
+
return;
|
|
123116
|
+
}
|
|
123117
|
+
}
|
|
123118
|
+
clearSelectedImage();
|
|
123119
|
+
}
|
|
123120
|
+
}
|
|
122625
123121
|
});
|
|
122626
123122
|
}
|
|
123123
|
+
editor.value.on("paginationUpdate", () => {
|
|
123124
|
+
const base2 = activeEditor.value;
|
|
123125
|
+
if (isHeadless(base2)) return;
|
|
123126
|
+
const paginationTarget = editor.value?.editor ? { value: base2 } : editor;
|
|
123127
|
+
adjustPaginationBreaks(editorElem, paginationTarget);
|
|
123128
|
+
});
|
|
122627
123129
|
editor.value.on("collaborationReady", () => {
|
|
122628
123130
|
setTimeout(() => {
|
|
122629
123131
|
editorReady.value = true;
|
|
@@ -122690,6 +123192,7 @@ const _sfc_main$1 = {
|
|
|
122690
123192
|
};
|
|
122691
123193
|
vue.onBeforeUnmount(() => {
|
|
122692
123194
|
stopPolling();
|
|
123195
|
+
clearSelectedImage();
|
|
122693
123196
|
editor.value?.destroy();
|
|
122694
123197
|
editor.value = null;
|
|
122695
123198
|
});
|
|
@@ -122804,8 +123307,8 @@ const _sfc_main$1 = {
|
|
|
122804
123307
|
]);
|
|
122805
123308
|
};
|
|
122806
123309
|
}
|
|
122807
|
-
};
|
|
122808
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
123310
|
+
});
|
|
123311
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-a935d3e2"]]);
|
|
122809
123312
|
const _hoisted_1 = ["innerHTML"];
|
|
122810
123313
|
const _sfc_main = {
|
|
122811
123314
|
__name: "SuperInput",
|