@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
|
@@ -19175,6 +19175,7 @@ function getUnderlineCssString({ type: type2 = "single", color = null, thickness
|
|
|
19175
19175
|
return parts.join("; ");
|
|
19176
19176
|
}
|
|
19177
19177
|
const INLINE_OVERRIDE_PROPERTIES = ["fontSize", "bold", "italic", "strike", "underline", "letterSpacing"];
|
|
19178
|
+
const DEFAULT_FONT_SIZE_HALF_POINTS = 20;
|
|
19178
19179
|
const resolveRunProperties = (params2, inlineRpr, resolvedPpr, isListNumber = false, numberingDefinedInline = false) => {
|
|
19179
19180
|
const paragraphStyleId = resolvedPpr?.styleId;
|
|
19180
19181
|
const paragraphStyleProps = resolveStyleChain$1(params2, paragraphStyleId, translator$1N);
|
|
@@ -19216,6 +19217,15 @@ const resolveRunProperties = (params2, inlineRpr, resolvedPpr, isListNumber = fa
|
|
|
19216
19217
|
finalProps[prop] = inlineRpr[prop];
|
|
19217
19218
|
}
|
|
19218
19219
|
}
|
|
19220
|
+
if (finalProps.fontSize == null || typeof finalProps.fontSize !== "number" || !Number.isFinite(finalProps.fontSize) || finalProps.fontSize <= 0) {
|
|
19221
|
+
let defaultFontSize = DEFAULT_FONT_SIZE_HALF_POINTS;
|
|
19222
|
+
if (defaultProps2?.fontSize != null && typeof defaultProps2.fontSize === "number" && Number.isFinite(defaultProps2.fontSize) && defaultProps2.fontSize > 0) {
|
|
19223
|
+
defaultFontSize = defaultProps2.fontSize;
|
|
19224
|
+
} else if (normalProps?.fontSize != null && typeof normalProps.fontSize === "number" && Number.isFinite(normalProps.fontSize) && normalProps.fontSize > 0) {
|
|
19225
|
+
defaultFontSize = normalProps.fontSize;
|
|
19226
|
+
}
|
|
19227
|
+
finalProps.fontSize = defaultFontSize;
|
|
19228
|
+
}
|
|
19219
19229
|
return finalProps;
|
|
19220
19230
|
};
|
|
19221
19231
|
function resolveParagraphProperties(params2, inlineProps, insideTable = false, overrideInlineStyleId = false, tableStyleId = null) {
|
|
@@ -34739,7 +34749,8 @@ const inputRulesPlugin = ({ editor, rules }) => {
|
|
|
34739
34749
|
if (fieldAnnotationContent.length) {
|
|
34740
34750
|
return false;
|
|
34741
34751
|
}
|
|
34742
|
-
|
|
34752
|
+
const result = handleClipboardPaste({ editor, view }, html);
|
|
34753
|
+
return result;
|
|
34743
34754
|
}
|
|
34744
34755
|
},
|
|
34745
34756
|
isInputRules: true
|
|
@@ -34754,38 +34765,36 @@ function isWordHtml(html) {
|
|
|
34754
34765
|
function isGoogleDocsHtml(html) {
|
|
34755
34766
|
return /docs-internal-guid-/.test(html);
|
|
34756
34767
|
}
|
|
34768
|
+
function findParagraphAncestor($from) {
|
|
34769
|
+
for (let d2 = $from.depth; d2 >= 0; d2--) {
|
|
34770
|
+
const node = $from.node(d2);
|
|
34771
|
+
if (node.type.name === "paragraph") {
|
|
34772
|
+
return { node, depth: d2 };
|
|
34773
|
+
}
|
|
34774
|
+
}
|
|
34775
|
+
return { node: null, depth: -1 };
|
|
34776
|
+
}
|
|
34757
34777
|
function handleHtmlPaste(html, editor, source) {
|
|
34758
34778
|
let cleanedHtml;
|
|
34759
34779
|
cleanedHtml = htmlHandler(html, editor);
|
|
34760
34780
|
let doc2 = DOMParser$1.fromSchema(editor.schema).parse(cleanedHtml);
|
|
34761
34781
|
doc2 = wrapTextsInRuns(doc2);
|
|
34762
34782
|
const { dispatch, state: state2 } = editor.view;
|
|
34763
|
-
if (!dispatch)
|
|
34783
|
+
if (!dispatch) {
|
|
34784
|
+
return false;
|
|
34785
|
+
}
|
|
34764
34786
|
const { $from } = state2.selection;
|
|
34765
|
-
const
|
|
34766
|
-
const
|
|
34787
|
+
const { node: paragraphNode } = findParagraphAncestor($from);
|
|
34788
|
+
const isInParagraph = paragraphNode !== null;
|
|
34767
34789
|
const isSingleParagraph = doc2.childCount === 1 && doc2.firstChild.type.name === "paragraph";
|
|
34768
34790
|
if (isInParagraph && isSingleParagraph) {
|
|
34769
34791
|
const paragraphContent = doc2.firstChild.content;
|
|
34770
34792
|
const tr = state2.tr.replaceSelectionWith(paragraphContent, false);
|
|
34771
34793
|
dispatch(tr);
|
|
34772
|
-
} else if (isInParagraph
|
|
34773
|
-
const
|
|
34774
|
-
|
|
34775
|
-
|
|
34776
|
-
allContent.push(...node.content.content);
|
|
34777
|
-
if (index2 < doc2.content.childCount - 1) {
|
|
34778
|
-
allContent.push(editor.schema.text("\n"));
|
|
34779
|
-
}
|
|
34780
|
-
}
|
|
34781
|
-
});
|
|
34782
|
-
if (allContent.length > 0) {
|
|
34783
|
-
const fragment = Fragment.from(allContent);
|
|
34784
|
-
const tr = state2.tr.replaceSelectionWith(fragment, false);
|
|
34785
|
-
dispatch(tr);
|
|
34786
|
-
} else {
|
|
34787
|
-
dispatch(state2.tr.replaceSelectionWith(doc2, true));
|
|
34788
|
-
}
|
|
34794
|
+
} else if (isInParagraph) {
|
|
34795
|
+
const slice2 = new Slice(doc2.content, 0, 0);
|
|
34796
|
+
const tr = state2.tr.replaceSelection(slice2);
|
|
34797
|
+
dispatch(tr);
|
|
34789
34798
|
} else {
|
|
34790
34799
|
dispatch(state2.tr.replaceSelectionWith(doc2, true));
|
|
34791
34800
|
}
|
|
@@ -41841,7 +41850,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
41841
41850
|
static getStoredSuperdocVersion(docx) {
|
|
41842
41851
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
41843
41852
|
}
|
|
41844
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
41853
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.39") {
|
|
41845
41854
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
41846
41855
|
}
|
|
41847
41856
|
/**
|
|
@@ -45147,7 +45156,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
45147
45156
|
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);
|
|
45148
45157
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
45149
45158
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
45150
|
-
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;
|
|
45159
|
+
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;
|
|
45151
45160
|
var GOOD_LEAF_SIZE = 200;
|
|
45152
45161
|
var RopeSequence = function RopeSequence2() {
|
|
45153
45162
|
};
|
|
@@ -54079,11 +54088,13 @@ const unsetAllMarks = () => ({ tr, dispatch, editor }) => {
|
|
|
54079
54088
|
selection = editor.options.lastSelection;
|
|
54080
54089
|
}
|
|
54081
54090
|
const { empty: empty2, ranges } = selection;
|
|
54082
|
-
if (empty2) return true;
|
|
54083
54091
|
if (dispatch) {
|
|
54084
|
-
|
|
54085
|
-
|
|
54086
|
-
|
|
54092
|
+
if (!empty2) {
|
|
54093
|
+
ranges.forEach((range2) => {
|
|
54094
|
+
tr.removeMark(range2.$from.pos, range2.$to.pos);
|
|
54095
|
+
});
|
|
54096
|
+
}
|
|
54097
|
+
tr.setStoredMarks([]);
|
|
54087
54098
|
}
|
|
54088
54099
|
return true;
|
|
54089
54100
|
};
|
|
@@ -59014,7 +59025,7 @@ const isHeadless = (editor) => {
|
|
|
59014
59025
|
const shouldSkipNodeView = (editor) => {
|
|
59015
59026
|
return isHeadless(editor);
|
|
59016
59027
|
};
|
|
59017
|
-
const summaryVersion = "1.0.0-beta.
|
|
59028
|
+
const summaryVersion = "1.0.0-beta.39";
|
|
59018
59029
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59019
59030
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59020
59031
|
function mapAttributes(attrs) {
|
|
@@ -59803,7 +59814,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
59803
59814
|
{ default: remarkStringify },
|
|
59804
59815
|
{ default: remarkGfm }
|
|
59805
59816
|
] = await Promise.all([
|
|
59806
|
-
import("./index-
|
|
59817
|
+
import("./index-BqDEyWLQ-B3TrQVjX.es.js"),
|
|
59807
59818
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
59808
59819
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
59809
59820
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -60008,7 +60019,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60008
60019
|
* Process collaboration migrations
|
|
60009
60020
|
*/
|
|
60010
60021
|
processCollaborationMigrations() {
|
|
60011
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
60022
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.39");
|
|
60012
60023
|
if (!this.options.ydoc) return;
|
|
60013
60024
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60014
60025
|
let docVersion = metaMap.get("version");
|
|
@@ -62019,7 +62030,7 @@ const applyTextStyleMark = (run2, attrs, themeColors) => {
|
|
|
62019
62030
|
const fontSizePx = normalizeFontSizePx(attrs.fontSize);
|
|
62020
62031
|
if (fontSizePx !== void 0 && fontSizePx >= 1 && fontSizePx <= 1e3) {
|
|
62021
62032
|
run2.fontSize = fontSizePx;
|
|
62022
|
-
}
|
|
62033
|
+
} else if (attrs.fontSize !== void 0) ;
|
|
62023
62034
|
if (isFiniteNumber(attrs.letterSpacing)) {
|
|
62024
62035
|
const spacing = Number(attrs.letterSpacing);
|
|
62025
62036
|
if (spacing >= -100 && spacing <= 100) {
|
|
@@ -64698,18 +64709,18 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
64698
64709
|
paragraphAttrs.rtl = true;
|
|
64699
64710
|
}
|
|
64700
64711
|
const explicitAlignment = normalizeAlignment(attrs.alignment ?? attrs.textAlign);
|
|
64712
|
+
const paragraphAlignment = typeof paragraphProps.justification === "string" ? normalizeAlignment(paragraphProps.justification) : void 0;
|
|
64701
64713
|
const styleAlignment = hydrated?.alignment ? normalizeAlignment(hydrated.alignment) : void 0;
|
|
64702
|
-
const paragraphAlignment = paragraphProps.justification ? normalizeAlignment(paragraphProps.justification) : void 0;
|
|
64703
64714
|
if (bidi && adjustRightInd) {
|
|
64704
64715
|
paragraphAttrs.alignment = "right";
|
|
64705
64716
|
} else if (explicitAlignment) {
|
|
64706
64717
|
paragraphAttrs.alignment = explicitAlignment;
|
|
64718
|
+
} else if (paragraphAlignment) {
|
|
64719
|
+
paragraphAttrs.alignment = paragraphAlignment;
|
|
64707
64720
|
} else if (bidi) {
|
|
64708
64721
|
paragraphAttrs.alignment = "right";
|
|
64709
64722
|
} else if (styleAlignment) {
|
|
64710
64723
|
paragraphAttrs.alignment = styleAlignment;
|
|
64711
|
-
} else if (paragraphAlignment) {
|
|
64712
|
-
paragraphAttrs.alignment = paragraphAlignment;
|
|
64713
64724
|
} else if (computed2.paragraph.alignment) {
|
|
64714
64725
|
paragraphAttrs.alignment = computed2.paragraph.alignment;
|
|
64715
64726
|
}
|
|
@@ -70429,11 +70440,26 @@ const FIELD_ANNOTATION_STYLES = `
|
|
|
70429
70440
|
z-index: 1000;
|
|
70430
70441
|
}
|
|
70431
70442
|
`;
|
|
70443
|
+
const IMAGE_SELECTION_STYLES = `
|
|
70444
|
+
/* Highlight for selected images (block or inline) */
|
|
70445
|
+
.superdoc-image-selected {
|
|
70446
|
+
outline: 2px solid #4a90e2;
|
|
70447
|
+
outline-offset: 2px;
|
|
70448
|
+
border-radius: 2px;
|
|
70449
|
+
box-shadow: 0 0 0 1px rgba(74, 144, 226, 0.35);
|
|
70450
|
+
}
|
|
70451
|
+
|
|
70452
|
+
/* Ensure inline images can be targeted */
|
|
70453
|
+
.superdoc-inline-image.superdoc-image-selected {
|
|
70454
|
+
outline-offset: 2px;
|
|
70455
|
+
}
|
|
70456
|
+
`;
|
|
70432
70457
|
let printStylesInjected = false;
|
|
70433
70458
|
let linkStylesInjected = false;
|
|
70434
70459
|
let trackChangeStylesInjected = false;
|
|
70435
70460
|
let sdtContainerStylesInjected = false;
|
|
70436
70461
|
let fieldAnnotationStylesInjected = false;
|
|
70462
|
+
let imageSelectionStylesInjected = false;
|
|
70437
70463
|
const ensurePrintStyles = (doc2) => {
|
|
70438
70464
|
if (printStylesInjected || !doc2) return;
|
|
70439
70465
|
const styleEl = doc2.createElement("style");
|
|
@@ -70474,6 +70500,14 @@ const ensureFieldAnnotationStyles = (doc2) => {
|
|
|
70474
70500
|
doc2.head?.appendChild(styleEl);
|
|
70475
70501
|
fieldAnnotationStylesInjected = true;
|
|
70476
70502
|
};
|
|
70503
|
+
const ensureImageSelectionStyles = (doc2) => {
|
|
70504
|
+
if (imageSelectionStylesInjected || !doc2) return;
|
|
70505
|
+
const styleEl = doc2.createElement("style");
|
|
70506
|
+
styleEl.setAttribute("data-superdoc-image-selection-styles", "true");
|
|
70507
|
+
styleEl.textContent = IMAGE_SELECTION_STYLES;
|
|
70508
|
+
doc2.head?.appendChild(styleEl);
|
|
70509
|
+
imageSelectionStylesInjected = true;
|
|
70510
|
+
};
|
|
70477
70511
|
const DOM_CLASS_NAMES = {
|
|
70478
70512
|
/**
|
|
70479
70513
|
* Class name for page container elements.
|
|
@@ -71374,6 +71408,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
71374
71408
|
ensureTrackChangeStyles(doc2);
|
|
71375
71409
|
ensureFieldAnnotationStyles(doc2);
|
|
71376
71410
|
ensureSdtContainerStyles(doc2);
|
|
71411
|
+
ensureImageSelectionStyles(doc2);
|
|
71377
71412
|
mount2.classList.add(CLASS_NAMES$1.container);
|
|
71378
71413
|
if (this.mount && this.mount !== mount2) {
|
|
71379
71414
|
this.resetState();
|
|
@@ -71909,7 +71944,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
71909
71944
|
if (fragment.continuesOnNext) {
|
|
71910
71945
|
fragmentEl.dataset.continuesOnNext = "true";
|
|
71911
71946
|
}
|
|
71912
|
-
const lines = measure.lines.slice(fragment.fromLine, fragment.toLine);
|
|
71947
|
+
const lines = fragment.lines ?? measure.lines.slice(fragment.fromLine, fragment.toLine);
|
|
71913
71948
|
applyParagraphBlockStyles(fragmentEl, block.attrs);
|
|
71914
71949
|
if (block.attrs?.styleId) {
|
|
71915
71950
|
fragmentEl.dataset.styleId = block.attrs.styleId;
|
|
@@ -73006,6 +73041,7 @@ const _DomPainter = class _DomPainter2 {
|
|
|
73006
73041
|
return null;
|
|
73007
73042
|
}
|
|
73008
73043
|
const img = this.doc.createElement("img");
|
|
73044
|
+
img.classList.add("superdoc-inline-image");
|
|
73009
73045
|
const isDataUrl = typeof run2.src === "string" && run2.src.startsWith("data:");
|
|
73010
73046
|
if (isDataUrl) {
|
|
73011
73047
|
if (run2.src.length > MAX_DATA_URL_LENGTH) {
|
|
@@ -75543,6 +75579,23 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
75543
75579
|
}
|
|
75544
75580
|
}
|
|
75545
75581
|
let lines = normalizeLines(measure);
|
|
75582
|
+
const measurementWidth = lines[0]?.maxWidth;
|
|
75583
|
+
let didRemeasureForColumnWidth = false;
|
|
75584
|
+
if (typeof remeasureParagraph2 === "function" && typeof measurementWidth === "number" && measurementWidth > columnWidth) {
|
|
75585
|
+
let firstLineIndent = 0;
|
|
75586
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
75587
|
+
if (wordLayout?.marker && measure.marker) {
|
|
75588
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
75589
|
+
if (markerJustification === "left") {
|
|
75590
|
+
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
75591
|
+
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
75592
|
+
firstLineIndent = markerWidth + gutterWidth;
|
|
75593
|
+
}
|
|
75594
|
+
}
|
|
75595
|
+
const newMeasure = remeasureParagraph2(block, columnWidth, firstLineIndent);
|
|
75596
|
+
lines = normalizeLines(newMeasure);
|
|
75597
|
+
didRemeasureForColumnWidth = true;
|
|
75598
|
+
}
|
|
75546
75599
|
let fromLine = 0;
|
|
75547
75600
|
const spacing = block.attrs?.spacing ?? {};
|
|
75548
75601
|
const styleId = block.attrs?.styleId;
|
|
@@ -75618,7 +75671,17 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
75618
75671
|
tempY += lineHeight2;
|
|
75619
75672
|
}
|
|
75620
75673
|
if (narrowestWidth < columnWidth) {
|
|
75621
|
-
|
|
75674
|
+
let firstLineIndent = 0;
|
|
75675
|
+
const wordLayout = block.attrs?.wordLayout;
|
|
75676
|
+
if (wordLayout?.marker && measure.marker) {
|
|
75677
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
75678
|
+
if (markerJustification === "left") {
|
|
75679
|
+
const markerWidth = measure.marker.markerWidth ?? 0;
|
|
75680
|
+
const gutterWidth = measure.marker.gutterWidth ?? wordLayout.marker.gutterWidthPx ?? 0;
|
|
75681
|
+
firstLineIndent = markerWidth + gutterWidth;
|
|
75682
|
+
}
|
|
75683
|
+
}
|
|
75684
|
+
const newMeasure = remeasureParagraph2(block, narrowestWidth, firstLineIndent);
|
|
75622
75685
|
lines = normalizeLines(newMeasure);
|
|
75623
75686
|
didRemeasureForFloats = true;
|
|
75624
75687
|
}
|
|
@@ -75683,6 +75746,9 @@ function layoutParagraphBlock(ctx2, anchors) {
|
|
|
75683
75746
|
width: effectiveColumnWidth,
|
|
75684
75747
|
...computeFragmentPmRange(block, lines, fromLine, slice2.toLine)
|
|
75685
75748
|
};
|
|
75749
|
+
if (didRemeasureForColumnWidth) {
|
|
75750
|
+
fragment.lines = lines.slice(fromLine, slice2.toLine);
|
|
75751
|
+
}
|
|
75686
75752
|
if (measure.marker && fromLine === 0) {
|
|
75687
75753
|
fragment.markerWidth = measure.marker.markerWidth;
|
|
75688
75754
|
if (measure.marker.markerTextWidth != null) {
|
|
@@ -78411,12 +78477,14 @@ function lineHeightForRuns(runs, fromRun, toRun) {
|
|
|
78411
78477
|
}
|
|
78412
78478
|
return maxSize2 * 1.2;
|
|
78413
78479
|
}
|
|
78414
|
-
function remeasureParagraph(block, maxWidth) {
|
|
78480
|
+
function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
|
|
78415
78481
|
const runs = block.runs ?? [];
|
|
78416
78482
|
const lines = [];
|
|
78417
78483
|
let currentRun = 0;
|
|
78418
78484
|
let currentChar = 0;
|
|
78419
78485
|
while (currentRun < runs.length) {
|
|
78486
|
+
const isFirstLine = lines.length === 0;
|
|
78487
|
+
const effectiveMaxWidth = isFirstLine ? maxWidth - firstLineIndent : maxWidth;
|
|
78420
78488
|
const startRun = currentRun;
|
|
78421
78489
|
const startChar = currentChar;
|
|
78422
78490
|
let width = 0;
|
|
@@ -78430,7 +78498,7 @@ function remeasureParagraph(block, maxWidth) {
|
|
|
78430
78498
|
const start2 = r2 === currentRun ? currentChar : 0;
|
|
78431
78499
|
for (let c2 = start2; c2 < text.length; c2 += 1) {
|
|
78432
78500
|
const w2 = measureRunSliceWidth(run2, c2, c2 + 1);
|
|
78433
|
-
if (width + w2 >
|
|
78501
|
+
if (width + w2 > effectiveMaxWidth && width > 0) {
|
|
78434
78502
|
if (lastBreakRun >= 0) {
|
|
78435
78503
|
endRun = lastBreakRun;
|
|
78436
78504
|
endChar = lastBreakChar;
|
|
@@ -78929,7 +78997,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
78929
78997
|
...options,
|
|
78930
78998
|
headerContentHeights,
|
|
78931
78999
|
// Pass header heights to prevent overlap
|
|
78932
|
-
remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
|
|
79000
|
+
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
78933
79001
|
});
|
|
78934
79002
|
const layoutEnd = performance.now();
|
|
78935
79003
|
perfLog(`[Perf] 4.2 Layout document (pagination): ${(layoutEnd - layoutStart).toFixed(2)}ms`);
|
|
@@ -78977,7 +79045,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
78977
79045
|
...options,
|
|
78978
79046
|
headerContentHeights,
|
|
78979
79047
|
// Pass header heights to prevent overlap
|
|
78980
|
-
remeasureParagraph: (block, maxWidth) => remeasureParagraph(block, maxWidth)
|
|
79048
|
+
remeasureParagraph: (block, maxWidth, firstLineIndent) => remeasureParagraph(block, maxWidth, firstLineIndent)
|
|
78981
79049
|
});
|
|
78982
79050
|
const relayoutEnd = performance.now();
|
|
78983
79051
|
const relayoutTime = relayoutEnd - relayoutStart;
|
|
@@ -79808,6 +79876,31 @@ function findBlockIndexByFragmentId(blocks, fragmentBlockId, targetPmRange) {
|
|
|
79808
79876
|
}
|
|
79809
79877
|
return matchingIndices[0];
|
|
79810
79878
|
}
|
|
79879
|
+
const DEFAULT_CELL_PADDING = { top: 2, bottom: 2, left: 4, right: 4 };
|
|
79880
|
+
const getCellPaddingFromRow = (cellIdx, row) => {
|
|
79881
|
+
const padding = row?.cells?.[cellIdx]?.attrs?.padding ?? {};
|
|
79882
|
+
return {
|
|
79883
|
+
top: padding.top ?? DEFAULT_CELL_PADDING.top,
|
|
79884
|
+
bottom: padding.bottom ?? DEFAULT_CELL_PADDING.bottom,
|
|
79885
|
+
left: padding.left ?? DEFAULT_CELL_PADDING.left,
|
|
79886
|
+
right: padding.right ?? DEFAULT_CELL_PADDING.right
|
|
79887
|
+
};
|
|
79888
|
+
};
|
|
79889
|
+
const getCellBlocks = (cell) => {
|
|
79890
|
+
if (!cell) return [];
|
|
79891
|
+
return cell.blocks ?? (cell.paragraph ? [cell.paragraph] : []);
|
|
79892
|
+
};
|
|
79893
|
+
const getCellMeasures = (cell) => {
|
|
79894
|
+
if (!cell) return [];
|
|
79895
|
+
return cell.blocks ?? (cell.paragraph ? [cell.paragraph] : []);
|
|
79896
|
+
};
|
|
79897
|
+
const sumLineHeights = (measure, fromLine, toLine) => {
|
|
79898
|
+
let height = 0;
|
|
79899
|
+
for (let i = fromLine; i < toLine && i < measure.lines.length; i += 1) {
|
|
79900
|
+
height += measure.lines[i]?.lineHeight ?? 0;
|
|
79901
|
+
}
|
|
79902
|
+
return height;
|
|
79903
|
+
};
|
|
79811
79904
|
function selectionToRects(layout, blocks, measures, from2, to) {
|
|
79812
79905
|
if (from2 === to) {
|
|
79813
79906
|
return [];
|
|
@@ -79854,6 +79947,136 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
79854
79947
|
});
|
|
79855
79948
|
return;
|
|
79856
79949
|
}
|
|
79950
|
+
if (fragment.kind === "table") {
|
|
79951
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
79952
|
+
if (blockIndex === -1) return;
|
|
79953
|
+
const block = blocks[blockIndex];
|
|
79954
|
+
const measure = measures[blockIndex];
|
|
79955
|
+
if (!block || block.kind !== "table" || measure?.kind !== "table") {
|
|
79956
|
+
return;
|
|
79957
|
+
}
|
|
79958
|
+
const tableBlock = block;
|
|
79959
|
+
const tableMeasure = measure;
|
|
79960
|
+
const tableFragment = fragment;
|
|
79961
|
+
const rowHeights = tableMeasure.rows.map((rowMeasure, idx) => {
|
|
79962
|
+
if (tableFragment.partialRow && tableFragment.partialRow.rowIndex === idx) {
|
|
79963
|
+
return tableFragment.partialRow.partialHeight;
|
|
79964
|
+
}
|
|
79965
|
+
return rowMeasure?.height ?? 0;
|
|
79966
|
+
});
|
|
79967
|
+
const calculateCellX = (cellIdx, cellMeasure) => {
|
|
79968
|
+
const gridStart = cellMeasure.gridColumnStart ?? cellIdx;
|
|
79969
|
+
let x2 = 0;
|
|
79970
|
+
for (let i = 0; i < gridStart && i < tableMeasure.columnWidths.length; i += 1) {
|
|
79971
|
+
x2 += tableMeasure.columnWidths[i];
|
|
79972
|
+
}
|
|
79973
|
+
return x2;
|
|
79974
|
+
};
|
|
79975
|
+
const processRow = (rowIndex, rowOffset) => {
|
|
79976
|
+
const rowMeasure = tableMeasure.rows[rowIndex];
|
|
79977
|
+
const row = tableBlock.rows[rowIndex];
|
|
79978
|
+
if (!rowMeasure || !row) return rowOffset;
|
|
79979
|
+
const rowHeight = rowHeights[rowIndex] ?? rowMeasure.height;
|
|
79980
|
+
const isPartialRow = tableFragment.partialRow?.rowIndex === rowIndex;
|
|
79981
|
+
const partialRowData = isPartialRow ? tableFragment.partialRow : null;
|
|
79982
|
+
const totalColumns = Math.min(rowMeasure.cells.length, row.cells.length);
|
|
79983
|
+
for (let cellIdx = 0; cellIdx < totalColumns; cellIdx += 1) {
|
|
79984
|
+
const cellMeasure = rowMeasure.cells[cellIdx];
|
|
79985
|
+
const cell = row.cells[cellIdx];
|
|
79986
|
+
if (!cellMeasure || !cell) continue;
|
|
79987
|
+
const padding = getCellPaddingFromRow(cellIdx, row);
|
|
79988
|
+
const cellX = calculateCellX(cellIdx, cellMeasure);
|
|
79989
|
+
const cellBlocks = getCellBlocks(cell);
|
|
79990
|
+
const cellBlockMeasures = getCellMeasures(cellMeasure);
|
|
79991
|
+
const renderedBlocks = [];
|
|
79992
|
+
let cumulativeLine = 0;
|
|
79993
|
+
for (let i = 0; i < Math.min(cellBlocks.length, cellBlockMeasures.length); i += 1) {
|
|
79994
|
+
const paraBlock = cellBlocks[i];
|
|
79995
|
+
const paraMeasure = cellBlockMeasures[i];
|
|
79996
|
+
if (!paraBlock || !paraMeasure || paraBlock.kind !== "paragraph" || paraMeasure.kind !== "paragraph") {
|
|
79997
|
+
continue;
|
|
79998
|
+
}
|
|
79999
|
+
const lineCount = paraMeasure.lines.length;
|
|
80000
|
+
const blockStart = cumulativeLine;
|
|
80001
|
+
const blockEnd = cumulativeLine + lineCount;
|
|
80002
|
+
cumulativeLine = blockEnd;
|
|
80003
|
+
const allowedStart = partialRowData?.fromLineByCell?.[cellIdx] ?? 0;
|
|
80004
|
+
const rawAllowedEnd = partialRowData?.toLineByCell?.[cellIdx];
|
|
80005
|
+
const allowedEnd = rawAllowedEnd == null || rawAllowedEnd === -1 ? cumulativeLine : rawAllowedEnd;
|
|
80006
|
+
const renderStartGlobal = Math.max(blockStart, allowedStart);
|
|
80007
|
+
const renderEndGlobal = Math.min(blockEnd, allowedEnd);
|
|
80008
|
+
if (renderStartGlobal >= renderEndGlobal) continue;
|
|
80009
|
+
const startLine = renderStartGlobal - blockStart;
|
|
80010
|
+
const endLine = renderEndGlobal - blockStart;
|
|
80011
|
+
let height = sumLineHeights(paraMeasure, startLine, endLine);
|
|
80012
|
+
const rendersWholeBlock = startLine === 0 && endLine >= lineCount;
|
|
80013
|
+
if (rendersWholeBlock) {
|
|
80014
|
+
const totalHeight = paraMeasure.totalHeight;
|
|
80015
|
+
if (typeof totalHeight === "number" && totalHeight > height) {
|
|
80016
|
+
height = totalHeight;
|
|
80017
|
+
}
|
|
80018
|
+
const spacingAfter = paraBlock.attrs?.spacing?.after;
|
|
80019
|
+
if (typeof spacingAfter === "number" && spacingAfter > 0) {
|
|
80020
|
+
height += spacingAfter;
|
|
80021
|
+
}
|
|
80022
|
+
}
|
|
80023
|
+
renderedBlocks.push({ block: paraBlock, measure: paraMeasure, startLine, endLine, height });
|
|
80024
|
+
}
|
|
80025
|
+
const contentHeight = renderedBlocks.reduce((acc, info) => acc + info.height, 0);
|
|
80026
|
+
const contentAreaHeight = Math.max(0, rowHeight - (padding.top + padding.bottom));
|
|
80027
|
+
const freeSpace = Math.max(0, contentAreaHeight - contentHeight);
|
|
80028
|
+
let verticalOffset = 0;
|
|
80029
|
+
const vAlign = cell.attrs?.verticalAlign;
|
|
80030
|
+
if (vAlign === "center" || vAlign === "middle") {
|
|
80031
|
+
verticalOffset = freeSpace / 2;
|
|
80032
|
+
} else if (vAlign === "bottom") {
|
|
80033
|
+
verticalOffset = freeSpace;
|
|
80034
|
+
}
|
|
80035
|
+
let blockTopCursor = padding.top + verticalOffset;
|
|
80036
|
+
renderedBlocks.forEach((info) => {
|
|
80037
|
+
const paragraphMarkerWidth = info.measure.marker?.markerWidth ?? 0;
|
|
80038
|
+
const intersectingLines = findLinesIntersectingRange(info.block, info.measure, from2, to);
|
|
80039
|
+
intersectingLines.forEach(({ line, index: index2 }) => {
|
|
80040
|
+
if (index2 < info.startLine || index2 >= info.endLine) {
|
|
80041
|
+
return;
|
|
80042
|
+
}
|
|
80043
|
+
const range2 = computeLinePmRange(info.block, line);
|
|
80044
|
+
if (range2.pmStart == null || range2.pmEnd == null) return;
|
|
80045
|
+
const sliceFrom = Math.max(range2.pmStart, from2);
|
|
80046
|
+
const sliceTo = Math.min(range2.pmEnd, to);
|
|
80047
|
+
if (sliceFrom >= sliceTo) return;
|
|
80048
|
+
const charOffsetFrom = pmPosToCharOffset(info.block, line, sliceFrom);
|
|
80049
|
+
const charOffsetTo = pmPosToCharOffset(info.block, line, sliceTo);
|
|
80050
|
+
const availableWidth = Math.max(1, cellMeasure.width - padding.left - padding.right);
|
|
80051
|
+
const startX = mapPmToX(info.block, line, charOffsetFrom, availableWidth);
|
|
80052
|
+
const endX = mapPmToX(info.block, line, charOffsetTo, availableWidth);
|
|
80053
|
+
const rectX = fragment.x + cellX + padding.left + paragraphMarkerWidth + Math.min(startX, endX);
|
|
80054
|
+
const rectWidth = Math.max(1, Math.abs(endX - startX));
|
|
80055
|
+
const lineOffset = lineHeightBeforeIndex(info.measure, index2) - lineHeightBeforeIndex(info.measure, info.startLine);
|
|
80056
|
+
const rectY = fragment.y + rowOffset + blockTopCursor + lineOffset;
|
|
80057
|
+
rects.push({
|
|
80058
|
+
x: rectX,
|
|
80059
|
+
y: rectY + pageIndex * layout.pageSize.h,
|
|
80060
|
+
width: rectWidth,
|
|
80061
|
+
height: line.lineHeight,
|
|
80062
|
+
pageIndex
|
|
80063
|
+
});
|
|
80064
|
+
});
|
|
80065
|
+
blockTopCursor += info.height;
|
|
80066
|
+
});
|
|
80067
|
+
}
|
|
80068
|
+
return rowOffset + rowHeight;
|
|
80069
|
+
};
|
|
80070
|
+
let rowCursor = 0;
|
|
80071
|
+
const repeatHeaderCount = tableFragment.repeatHeaderCount ?? 0;
|
|
80072
|
+
for (let r2 = 0; r2 < repeatHeaderCount && r2 < tableMeasure.rows.length; r2 += 1) {
|
|
80073
|
+
rowCursor = processRow(r2, rowCursor);
|
|
80074
|
+
}
|
|
80075
|
+
for (let r2 = tableFragment.fromRow; r2 < tableFragment.toRow && r2 < tableMeasure.rows.length; r2 += 1) {
|
|
80076
|
+
rowCursor = processRow(r2, rowCursor);
|
|
80077
|
+
}
|
|
80078
|
+
return;
|
|
80079
|
+
}
|
|
79857
80080
|
if (isAtomicFragment(fragment)) {
|
|
79858
80081
|
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
79859
80082
|
if (blockIndex === -1) return;
|
|
@@ -80380,7 +80603,16 @@ async function measureParagraphBlock(block, maxWidth) {
|
|
|
80380
80603
|
const rawFirstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
|
|
80381
80604
|
const firstLineOffset = isWordLayoutList ? 0 : rawFirstLineOffset;
|
|
80382
80605
|
const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
|
|
80383
|
-
|
|
80606
|
+
let leftJustifiedMarkerSpace = 0;
|
|
80607
|
+
if (wordLayout?.marker) {
|
|
80608
|
+
const markerJustification = wordLayout.marker.justification ?? "left";
|
|
80609
|
+
if (markerJustification === "left") {
|
|
80610
|
+
const markerBoxWidth = wordLayout.marker.markerBoxWidthPx ?? 0;
|
|
80611
|
+
const gutterWidth = wordLayout.marker.gutterWidthPx ?? LIST_MARKER_GAP;
|
|
80612
|
+
leftJustifiedMarkerSpace = markerBoxWidth + gutterWidth;
|
|
80613
|
+
}
|
|
80614
|
+
}
|
|
80615
|
+
const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset - leftJustifiedMarkerSpace);
|
|
80384
80616
|
const tabStops = buildTabStopsPx(
|
|
80385
80617
|
indent,
|
|
80386
80618
|
block.attrs?.tabs,
|
|
@@ -82856,12 +83088,30 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
82856
83088
|
if (linkEl) {
|
|
82857
83089
|
const href = linkEl.getAttribute("href") ?? "";
|
|
82858
83090
|
const isAnchorLink = href.startsWith("#") && href.length > 1;
|
|
82859
|
-
|
|
83091
|
+
const isTocLink = linkEl.closest(".superdoc-toc-entry") !== null;
|
|
83092
|
+
if (isAnchorLink && isTocLink) {
|
|
82860
83093
|
event.preventDefault();
|
|
82861
83094
|
event.stopPropagation();
|
|
82862
83095
|
this.goToAnchor(href);
|
|
82863
83096
|
return;
|
|
82864
83097
|
}
|
|
83098
|
+
event.preventDefault();
|
|
83099
|
+
event.stopPropagation();
|
|
83100
|
+
const linkClickEvent = new CustomEvent("superdoc-link-click", {
|
|
83101
|
+
bubbles: true,
|
|
83102
|
+
composed: true,
|
|
83103
|
+
detail: {
|
|
83104
|
+
href,
|
|
83105
|
+
target: linkEl.getAttribute("target"),
|
|
83106
|
+
rel: linkEl.getAttribute("rel"),
|
|
83107
|
+
tooltip: linkEl.getAttribute("title"),
|
|
83108
|
+
element: linkEl,
|
|
83109
|
+
clientX: event.clientX,
|
|
83110
|
+
clientY: event.clientY
|
|
83111
|
+
}
|
|
83112
|
+
});
|
|
83113
|
+
linkEl.dispatchEvent(linkClickEvent);
|
|
83114
|
+
return;
|
|
82865
83115
|
}
|
|
82866
83116
|
const isDraggableAnnotation = target?.closest?.('[data-draggable="true"]') != null;
|
|
82867
83117
|
if (!__privateGet$1(this, _layoutState).layout) {
|
|
@@ -82959,6 +83209,44 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
82959
83209
|
__privateGet$1(this, _layoutState).measures,
|
|
82960
83210
|
hit.pos
|
|
82961
83211
|
);
|
|
83212
|
+
const targetImg = event.target?.closest?.("img");
|
|
83213
|
+
const imgPmStart = targetImg?.dataset?.pmStart ? Number(targetImg.dataset.pmStart) : null;
|
|
83214
|
+
if (!Number.isNaN(imgPmStart) && imgPmStart != null) {
|
|
83215
|
+
const doc222 = __privateGet$1(this, _editor3).state.doc;
|
|
83216
|
+
if (imgPmStart < 0 || imgPmStart >= doc222.content.size) {
|
|
83217
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
83218
|
+
console.warn(
|
|
83219
|
+
`[PresentationEditor] Invalid position ${imgPmStart} for inline image (document size: ${doc222.content.size})`
|
|
83220
|
+
);
|
|
83221
|
+
}
|
|
83222
|
+
return;
|
|
83223
|
+
}
|
|
83224
|
+
const newSelectionId = `inline-${imgPmStart}`;
|
|
83225
|
+
if (__privateGet$1(this, _lastSelectedImageBlockId) && __privateGet$1(this, _lastSelectedImageBlockId) !== newSelectionId) {
|
|
83226
|
+
this.emit("imageDeselected", { blockId: __privateGet$1(this, _lastSelectedImageBlockId) });
|
|
83227
|
+
}
|
|
83228
|
+
try {
|
|
83229
|
+
const tr = __privateGet$1(this, _editor3).state.tr.setSelection(NodeSelection.create(doc222, imgPmStart));
|
|
83230
|
+
__privateGet$1(this, _editor3).view?.dispatch(tr);
|
|
83231
|
+
const selector = `.superdoc-inline-image[data-pm-start="${imgPmStart}"]`;
|
|
83232
|
+
const targetElement = __privateGet$1(this, _viewportHost).querySelector(selector);
|
|
83233
|
+
this.emit("imageSelected", {
|
|
83234
|
+
element: targetElement ?? targetImg,
|
|
83235
|
+
blockId: null,
|
|
83236
|
+
pmStart: imgPmStart
|
|
83237
|
+
});
|
|
83238
|
+
__privateSet(this, _lastSelectedImageBlockId, newSelectionId);
|
|
83239
|
+
} catch (error) {
|
|
83240
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
83241
|
+
console.warn(
|
|
83242
|
+
`[PresentationEditor] Failed to create NodeSelection for inline image at position ${imgPmStart}:`,
|
|
83243
|
+
error
|
|
83244
|
+
);
|
|
83245
|
+
}
|
|
83246
|
+
}
|
|
83247
|
+
__privateMethod$1(this, _PresentationEditor_instances, focusEditorAfterImageSelection_fn).call(this);
|
|
83248
|
+
return;
|
|
83249
|
+
}
|
|
82962
83250
|
if (fragmentHit && (fragmentHit.fragment.kind === "image" || fragmentHit.fragment.kind === "drawing")) {
|
|
82963
83251
|
const doc222 = __privateGet$1(this, _editor3).state.doc;
|
|
82964
83252
|
try {
|
|
@@ -82985,15 +83273,7 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
82985
83273
|
console.warn("[PresentationEditor] Failed to create NodeSelection for atomic fragment:", error);
|
|
82986
83274
|
}
|
|
82987
83275
|
}
|
|
82988
|
-
__privateMethod$1(this, _PresentationEditor_instances,
|
|
82989
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
82990
|
-
document.activeElement.blur();
|
|
82991
|
-
}
|
|
82992
|
-
const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
|
|
82993
|
-
if (editorDom2) {
|
|
82994
|
-
editorDom2.focus();
|
|
82995
|
-
__privateGet$1(this, _editor3).view?.focus();
|
|
82996
|
-
}
|
|
83276
|
+
__privateMethod$1(this, _PresentationEditor_instances, focusEditorAfterImageSelection_fn).call(this);
|
|
82997
83277
|
return;
|
|
82998
83278
|
}
|
|
82999
83279
|
if (__privateGet$1(this, _lastSelectedImageBlockId)) {
|
|
@@ -83566,6 +83846,47 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
83566
83846
|
get overlayElement() {
|
|
83567
83847
|
return __privateGet$1(this, _selectionOverlay2) ?? null;
|
|
83568
83848
|
}
|
|
83849
|
+
/**
|
|
83850
|
+
* Get the current zoom level.
|
|
83851
|
+
*
|
|
83852
|
+
* The zoom level is a multiplier that controls the visual scale of the document.
|
|
83853
|
+
* This value is applied via CSS transform: scale() on the #viewportHost element,
|
|
83854
|
+
* which ensures consistent scaling between rendered content and overlay elements
|
|
83855
|
+
* (selections, cursors, interactive handles).
|
|
83856
|
+
*
|
|
83857
|
+
* Relationship to Centralized Zoom Architecture:
|
|
83858
|
+
* - PresentationEditor is the SINGLE SOURCE OF TRUTH for zoom state
|
|
83859
|
+
* - Zoom is applied internally via transform: scale() on #viewportHost
|
|
83860
|
+
* - External components (toolbar, UI controls) should use setZoom() to modify zoom
|
|
83861
|
+
* - The zoom value is used throughout the system for coordinate transformations
|
|
83862
|
+
*
|
|
83863
|
+
* Coordinate Space Implications:
|
|
83864
|
+
* - Layout coordinates: Unscaled logical pixels used by the layout engine
|
|
83865
|
+
* - Screen coordinates: Physical pixels affected by CSS transform: scale()
|
|
83866
|
+
* - Conversion: screenCoord = layoutCoord * zoom
|
|
83867
|
+
*
|
|
83868
|
+
* Zoom Scale:
|
|
83869
|
+
* - 1 = 100% (default, no scaling)
|
|
83870
|
+
* - 0.5 = 50% (zoomed out, content appears smaller)
|
|
83871
|
+
* - 2 = 200% (zoomed in, content appears larger)
|
|
83872
|
+
*
|
|
83873
|
+
* @returns The current zoom level multiplier (default: 1 if not configured)
|
|
83874
|
+
*
|
|
83875
|
+
* @example
|
|
83876
|
+
* ```typescript
|
|
83877
|
+
* const zoom = presentation.zoom;
|
|
83878
|
+
* // Convert layout coordinates to screen coordinates
|
|
83879
|
+
* const screenX = layoutX * zoom;
|
|
83880
|
+
* const screenY = layoutY * zoom;
|
|
83881
|
+
*
|
|
83882
|
+
* // Convert screen coordinates back to layout coordinates
|
|
83883
|
+
* const layoutX = screenX / zoom;
|
|
83884
|
+
* const layoutY = screenY / zoom;
|
|
83885
|
+
* ```
|
|
83886
|
+
*/
|
|
83887
|
+
get zoom() {
|
|
83888
|
+
return __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
83889
|
+
}
|
|
83569
83890
|
/**
|
|
83570
83891
|
* Set the document mode and update editor editability.
|
|
83571
83892
|
*
|
|
@@ -83756,8 +84077,8 @@ const _PresentationEditor = class _PresentationEditor2 extends EventEmitter$1 {
|
|
|
83756
84077
|
const pageLocalY = rect.y - rect.pageIndex * pageHeight;
|
|
83757
84078
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
|
|
83758
84079
|
if (!coords) return null;
|
|
83759
|
-
const absLeft = coords.x + overlayRect.left;
|
|
83760
|
-
const absTop = coords.y + overlayRect.top;
|
|
84080
|
+
const absLeft = coords.x * zoom + overlayRect.left;
|
|
84081
|
+
const absTop = coords.y * zoom + overlayRect.top;
|
|
83761
84082
|
const left2 = relativeRect ? absLeft - relativeRect.left : absLeft;
|
|
83762
84083
|
const top2 = relativeRect ? absTop - relativeRect.top : absTop;
|
|
83763
84084
|
const width = Math.max(1, rect.width * zoom);
|
|
@@ -84674,7 +84995,7 @@ renderRemoteCursors_fn = function() {
|
|
|
84674
84995
|
};
|
|
84675
84996
|
renderRemoteCaret_fn = function(cursor) {
|
|
84676
84997
|
const caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, cursor.head);
|
|
84677
|
-
|
|
84998
|
+
__privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
84678
84999
|
const doc2 = __privateGet$1(this, _visibleHost).ownerDocument ?? document;
|
|
84679
85000
|
const color = __privateMethod$1(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
84680
85001
|
let caretEl = __privateGet$1(this, _remoteCursorElements).get(cursor.clientId);
|
|
@@ -84707,7 +85028,7 @@ renderRemoteCaret_fn = function(cursor) {
|
|
|
84707
85028
|
}
|
|
84708
85029
|
caretEl.style.opacity = "1";
|
|
84709
85030
|
caretEl.style.transform = `translate(${coords.x}px, ${coords.y}px)`;
|
|
84710
|
-
caretEl.style.height = `${Math.max(1, caretLayout.height
|
|
85031
|
+
caretEl.style.height = `${Math.max(1, caretLayout.height)}px`;
|
|
84711
85032
|
caretEl.style.borderLeftColor = color;
|
|
84712
85033
|
const labelEl = caretEl.querySelector(".presentation-editor__remote-label");
|
|
84713
85034
|
if (labelEl) {
|
|
@@ -84747,7 +85068,6 @@ renderRemoteSelection_fn = function(cursor) {
|
|
|
84747
85068
|
const end2 = Math.max(cursor.anchor, cursor.head);
|
|
84748
85069
|
const rects = selectionToRects(layout, blocks, measures, start2, end2) ?? [];
|
|
84749
85070
|
const color = __privateMethod$1(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
84750
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
84751
85071
|
const opacity = __privateGet$1(this, _layoutOptions).presence?.highlightOpacity ?? 0.35;
|
|
84752
85072
|
const pageHeight = layout.pageSize?.h ?? __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
84753
85073
|
const doc2 = __privateGet$1(this, _visibleHost).ownerDocument ?? document;
|
|
@@ -84761,8 +85081,8 @@ renderRemoteSelection_fn = function(cursor) {
|
|
|
84761
85081
|
selectionEl.style.position = "absolute";
|
|
84762
85082
|
selectionEl.style.left = `${coords.x}px`;
|
|
84763
85083
|
selectionEl.style.top = `${coords.y}px`;
|
|
84764
|
-
selectionEl.style.width = `${Math.max(1, rect.width
|
|
84765
|
-
selectionEl.style.height = `${Math.max(1, rect.height
|
|
85084
|
+
selectionEl.style.width = `${Math.max(1, rect.width)}px`;
|
|
85085
|
+
selectionEl.style.height = `${Math.max(1, rect.height)}px`;
|
|
84766
85086
|
selectionEl.style.backgroundColor = color;
|
|
84767
85087
|
selectionEl.style.opacity = opacity.toString();
|
|
84768
85088
|
selectionEl.style.borderRadius = _PresentationEditor.CURSOR_STYLES.SELECTION_BORDER_RADIUS;
|
|
@@ -84872,6 +85192,17 @@ setupDragHandlers_fn = function() {
|
|
|
84872
85192
|
}
|
|
84873
85193
|
}));
|
|
84874
85194
|
};
|
|
85195
|
+
focusEditorAfterImageSelection_fn = function() {
|
|
85196
|
+
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
85197
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
85198
|
+
document.activeElement.blur();
|
|
85199
|
+
}
|
|
85200
|
+
const editorDom = __privateGet$1(this, _editor3).view?.dom;
|
|
85201
|
+
if (editorDom) {
|
|
85202
|
+
editorDom.focus();
|
|
85203
|
+
__privateGet$1(this, _editor3).view?.focus();
|
|
85204
|
+
}
|
|
85205
|
+
};
|
|
84875
85206
|
setupInputBridge_fn = function() {
|
|
84876
85207
|
__privateGet$1(this, _inputBridge)?.destroy();
|
|
84877
85208
|
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
@@ -85295,6 +85626,9 @@ scheduleSelectionUpdate_fn = function() {
|
|
|
85295
85626
|
if (__privateGet$1(this, _selectionUpdateScheduled)) {
|
|
85296
85627
|
return;
|
|
85297
85628
|
}
|
|
85629
|
+
if (__privateGet$1(this, _isRerendering) || __privateGet$1(this, _pendingDocChange)) {
|
|
85630
|
+
return;
|
|
85631
|
+
}
|
|
85298
85632
|
__privateSet(this, _selectionUpdateScheduled, true);
|
|
85299
85633
|
const win = __privateGet$1(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
85300
85634
|
win.requestAnimationFrame(() => {
|
|
@@ -85310,13 +85644,26 @@ updateSelection_fn = function() {
|
|
|
85310
85644
|
return;
|
|
85311
85645
|
}
|
|
85312
85646
|
if (__privateGet$1(this, _documentMode) === "viewing") {
|
|
85313
|
-
|
|
85647
|
+
try {
|
|
85648
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
85649
|
+
} catch (error) {
|
|
85650
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
85651
|
+
console.warn("[PresentationEditor] Failed to clear selection layer in viewing mode:", error);
|
|
85652
|
+
}
|
|
85653
|
+
}
|
|
85314
85654
|
return;
|
|
85315
85655
|
}
|
|
85316
85656
|
const layout = __privateGet$1(this, _layoutState).layout;
|
|
85317
|
-
const
|
|
85318
|
-
|
|
85657
|
+
const editorState = this.getActiveEditor().state;
|
|
85658
|
+
const selection = editorState?.selection;
|
|
85319
85659
|
if (!selection) {
|
|
85660
|
+
try {
|
|
85661
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
85662
|
+
} catch (error) {
|
|
85663
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
85664
|
+
console.warn("[PresentationEditor] Failed to clear selection layer (no selection):", error);
|
|
85665
|
+
}
|
|
85666
|
+
}
|
|
85320
85667
|
return;
|
|
85321
85668
|
}
|
|
85322
85669
|
if (!layout) {
|
|
@@ -85324,15 +85671,40 @@ updateSelection_fn = function() {
|
|
|
85324
85671
|
}
|
|
85325
85672
|
const { from: from2, to } = selection;
|
|
85326
85673
|
if (from2 === to) {
|
|
85327
|
-
|
|
85674
|
+
let caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2);
|
|
85675
|
+
const doc2 = editorState?.doc;
|
|
85676
|
+
if (!doc2) {
|
|
85677
|
+
return;
|
|
85678
|
+
}
|
|
85679
|
+
const docSize = doc2.content?.size ?? 0;
|
|
85680
|
+
if (!caretLayout && from2 > 0) {
|
|
85681
|
+
caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2 - 1);
|
|
85682
|
+
}
|
|
85683
|
+
if (!caretLayout && from2 + 1 <= docSize) {
|
|
85684
|
+
caretLayout = __privateMethod$1(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, from2 + 1);
|
|
85685
|
+
}
|
|
85328
85686
|
if (!caretLayout) {
|
|
85329
85687
|
return;
|
|
85330
85688
|
}
|
|
85331
|
-
|
|
85689
|
+
try {
|
|
85690
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
85691
|
+
__privateMethod$1(this, _PresentationEditor_instances, renderCaretOverlay_fn).call(this, caretLayout);
|
|
85692
|
+
} catch (error) {
|
|
85693
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
85694
|
+
console.warn("[PresentationEditor] Failed to render caret overlay:", error);
|
|
85695
|
+
}
|
|
85696
|
+
}
|
|
85332
85697
|
return;
|
|
85333
85698
|
}
|
|
85334
85699
|
const rects = selectionToRects(layout, __privateGet$1(this, _layoutState).blocks, __privateGet$1(this, _layoutState).measures, from2, to) ?? [];
|
|
85335
|
-
|
|
85700
|
+
try {
|
|
85701
|
+
__privateGet$1(this, _localSelectionLayer).innerHTML = "";
|
|
85702
|
+
__privateMethod$1(this, _PresentationEditor_instances, renderSelectionRects_fn).call(this, rects);
|
|
85703
|
+
} catch (error) {
|
|
85704
|
+
if (process$1$1.env.NODE_ENV === "development") {
|
|
85705
|
+
console.warn("[PresentationEditor] Failed to render selection rects:", error);
|
|
85706
|
+
}
|
|
85707
|
+
}
|
|
85336
85708
|
};
|
|
85337
85709
|
resolveLayoutOptions_fn = function(blocks, sectionMetadata) {
|
|
85338
85710
|
const defaults = __privateMethod$1(this, _PresentationEditor_instances, computeDefaultLayoutDefaults_fn).call(this);
|
|
@@ -86078,7 +86450,6 @@ renderSelectionRects_fn = function(rects) {
|
|
|
86078
86450
|
return;
|
|
86079
86451
|
}
|
|
86080
86452
|
const pageHeight = __privateMethod$1(this, _PresentationEditor_instances, getBodyPageHeight_fn).call(this);
|
|
86081
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
86082
86453
|
rects.forEach((rect, _index) => {
|
|
86083
86454
|
const pageLocalY = rect.y - rect.pageIndex * pageHeight;
|
|
86084
86455
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, rect.pageIndex, rect.x, pageLocalY);
|
|
@@ -86093,8 +86464,8 @@ renderSelectionRects_fn = function(rects) {
|
|
|
86093
86464
|
highlight.style.position = "absolute";
|
|
86094
86465
|
highlight.style.left = `${coords.x}px`;
|
|
86095
86466
|
highlight.style.top = `${coords.y}px`;
|
|
86096
|
-
highlight.style.width = `${Math.max(1, rect.width
|
|
86097
|
-
highlight.style.height = `${Math.max(1, rect.height
|
|
86467
|
+
highlight.style.width = `${Math.max(1, rect.width)}px`;
|
|
86468
|
+
highlight.style.height = `${Math.max(1, rect.height)}px`;
|
|
86098
86469
|
highlight.style.backgroundColor = "rgba(51, 132, 255, 0.35)";
|
|
86099
86470
|
highlight.style.borderRadius = "2px";
|
|
86100
86471
|
highlight.style.pointerEvents = "none";
|
|
@@ -86103,7 +86474,6 @@ renderSelectionRects_fn = function(rects) {
|
|
|
86103
86474
|
};
|
|
86104
86475
|
renderHoverRegion_fn = function(region) {
|
|
86105
86476
|
if (!__privateGet$1(this, _hoverOverlay) || !__privateGet$1(this, _hoverTooltip)) return;
|
|
86106
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
86107
86477
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, region.pageIndex, region.localX, region.localY);
|
|
86108
86478
|
if (!coords) {
|
|
86109
86479
|
__privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
|
|
@@ -86112,15 +86482,15 @@ renderHoverRegion_fn = function(region) {
|
|
|
86112
86482
|
__privateGet$1(this, _hoverOverlay).style.display = "block";
|
|
86113
86483
|
__privateGet$1(this, _hoverOverlay).style.left = `${coords.x}px`;
|
|
86114
86484
|
__privateGet$1(this, _hoverOverlay).style.top = `${coords.y}px`;
|
|
86115
|
-
__privateGet$1(this, _hoverOverlay).style.width = `${region.width
|
|
86116
|
-
__privateGet$1(this, _hoverOverlay).style.height = `${region.height
|
|
86485
|
+
__privateGet$1(this, _hoverOverlay).style.width = `${region.width}px`;
|
|
86486
|
+
__privateGet$1(this, _hoverOverlay).style.height = `${region.height}px`;
|
|
86117
86487
|
const tooltipText = `Double-click to edit ${region.kind === "header" ? "header" : "footer"}`;
|
|
86118
86488
|
__privateGet$1(this, _hoverTooltip).textContent = tooltipText;
|
|
86119
86489
|
__privateGet$1(this, _hoverTooltip).style.display = "block";
|
|
86120
86490
|
__privateGet$1(this, _hoverTooltip).style.left = `${coords.x}px`;
|
|
86121
86491
|
const tooltipHeight = 24;
|
|
86122
86492
|
const spaceAbove = coords.y;
|
|
86123
|
-
const regionHeight = region.height
|
|
86493
|
+
const regionHeight = region.height;
|
|
86124
86494
|
const tooltipY = spaceAbove < tooltipHeight + 4 ? coords.y + regionHeight + 4 : coords.y - tooltipHeight;
|
|
86125
86495
|
__privateGet$1(this, _hoverTooltip).style.top = `${Math.max(0, tooltipY)}px`;
|
|
86126
86496
|
};
|
|
@@ -86137,11 +86507,11 @@ renderCaretOverlay_fn = function(caretLayout) {
|
|
|
86137
86507
|
if (!__privateGet$1(this, _localSelectionLayer)) {
|
|
86138
86508
|
return;
|
|
86139
86509
|
}
|
|
86140
|
-
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
86141
86510
|
const coords = __privateMethod$1(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, caretLayout.pageIndex, caretLayout.x, caretLayout.y);
|
|
86142
86511
|
if (!coords) {
|
|
86143
86512
|
return;
|
|
86144
86513
|
}
|
|
86514
|
+
const finalHeight = Math.max(1, caretLayout.height);
|
|
86145
86515
|
const caretEl = __privateGet$1(this, _localSelectionLayer).ownerDocument?.createElement("div");
|
|
86146
86516
|
if (!caretEl) {
|
|
86147
86517
|
return;
|
|
@@ -86151,7 +86521,7 @@ renderCaretOverlay_fn = function(caretLayout) {
|
|
|
86151
86521
|
caretEl.style.left = `${coords.x}px`;
|
|
86152
86522
|
caretEl.style.top = `${coords.y}px`;
|
|
86153
86523
|
caretEl.style.width = "2px";
|
|
86154
|
-
caretEl.style.height = `${
|
|
86524
|
+
caretEl.style.height = `${finalHeight}px`;
|
|
86155
86525
|
caretEl.style.backgroundColor = "#3366FF";
|
|
86156
86526
|
caretEl.style.borderRadius = "1px";
|
|
86157
86527
|
caretEl.style.pointerEvents = "none";
|
|
@@ -86305,7 +86675,8 @@ inchesToPx_fn = function(value) {
|
|
|
86305
86675
|
};
|
|
86306
86676
|
applyZoom_fn = function() {
|
|
86307
86677
|
const zoom = __privateGet$1(this, _layoutOptions).zoom ?? 1;
|
|
86308
|
-
__privateGet$1(this,
|
|
86678
|
+
__privateGet$1(this, _viewportHost).style.transformOrigin = "top left";
|
|
86679
|
+
__privateGet$1(this, _viewportHost).style.transform = zoom === 1 ? "" : `scale(${zoom})`;
|
|
86309
86680
|
};
|
|
86310
86681
|
createLayoutMetrics_fn = function(perf, startMark, layout, blocks) {
|
|
86311
86682
|
if (!perf || startMark == null || typeof perf.now !== "function") {
|
|
@@ -86319,20 +86690,28 @@ createLayoutMetrics_fn = function(perf, startMark, layout, blocks) {
|
|
|
86319
86690
|
};
|
|
86320
86691
|
};
|
|
86321
86692
|
convertPageLocalToOverlayCoords_fn = function(pageIndex, pageLocalX, pageLocalY) {
|
|
86322
|
-
|
|
86323
|
-
|
|
86324
|
-
|
|
86325
|
-
|
|
86693
|
+
if (!Number.isFinite(pageIndex) || pageIndex < 0) {
|
|
86694
|
+
console.warn(
|
|
86695
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageIndex ${pageIndex}. Expected a finite non-negative number.`
|
|
86696
|
+
);
|
|
86326
86697
|
return null;
|
|
86327
86698
|
}
|
|
86328
|
-
|
|
86329
|
-
|
|
86330
|
-
|
|
86331
|
-
|
|
86332
|
-
|
|
86699
|
+
if (!Number.isFinite(pageLocalX)) {
|
|
86700
|
+
console.warn(
|
|
86701
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageLocalX ${pageLocalX}. Expected a finite number.`
|
|
86702
|
+
);
|
|
86703
|
+
return null;
|
|
86704
|
+
}
|
|
86705
|
+
if (!Number.isFinite(pageLocalY)) {
|
|
86706
|
+
console.warn(
|
|
86707
|
+
`[PresentationEditor] #convertPageLocalToOverlayCoords: Invalid pageLocalY ${pageLocalY}. Expected a finite number.`
|
|
86708
|
+
);
|
|
86709
|
+
return null;
|
|
86710
|
+
}
|
|
86711
|
+
const pageHeight = __privateGet$1(this, _layoutOptions).pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
|
|
86333
86712
|
return {
|
|
86334
|
-
x:
|
|
86335
|
-
y:
|
|
86713
|
+
x: pageLocalX,
|
|
86714
|
+
y: pageIndex * pageHeight + pageLocalY
|
|
86336
86715
|
};
|
|
86337
86716
|
};
|
|
86338
86717
|
normalizeClientPoint_fn = function(clientX, clientY) {
|
|
@@ -100997,7 +101376,8 @@ const Strike = Mark2.create({
|
|
|
100997
101376
|
},
|
|
100998
101377
|
addShortcuts() {
|
|
100999
101378
|
return {
|
|
101000
|
-
"Mod-Shift-
|
|
101379
|
+
"Mod-Shift-x": () => this.editor.commands.toggleStrike(),
|
|
101380
|
+
"Mod-Shift-X": () => this.editor.commands.toggleStrike()
|
|
101001
101381
|
};
|
|
101002
101382
|
}
|
|
101003
101383
|
});
|
|
@@ -118995,16 +119375,6 @@ const _SuperToolbar = class _SuperToolbar2 extends EventEmitter2 {
|
|
|
118995
119375
|
if (!argument) return;
|
|
118996
119376
|
item.onActivate({ zoom: argument });
|
|
118997
119377
|
this.emit("superdoc-command", { item, argument });
|
|
118998
|
-
const layers = this.superdoc.element?.querySelector(".layers");
|
|
118999
|
-
if (!layers) return;
|
|
119000
|
-
const isMobileDevice = typeof screen.orientation !== "undefined";
|
|
119001
|
-
const isSmallScreen = window.matchMedia("(max-width: 834px)").matches;
|
|
119002
|
-
if (isMobileDevice && isSmallScreen) {
|
|
119003
|
-
layers.style.transformOrigin = "0 0";
|
|
119004
|
-
layers.style.transform = `scale(${parseInt(argument, 10) / 100})`;
|
|
119005
|
-
} else {
|
|
119006
|
-
layers.style.zoom = parseInt(argument, 10) / 100;
|
|
119007
|
-
}
|
|
119008
119378
|
this.superdoc.superdocStore.activeZoom = parseInt(argument, 10);
|
|
119009
119379
|
},
|
|
119010
119380
|
/**
|
|
@@ -121275,6 +121645,19 @@ const _sfc_main$4 = {
|
|
|
121275
121645
|
const emit = __emit;
|
|
121276
121646
|
const overlayRect = ref$1(null);
|
|
121277
121647
|
const tableMetadata = ref$1(null);
|
|
121648
|
+
const getZoom = () => {
|
|
121649
|
+
const editor = props.editor;
|
|
121650
|
+
if (editor && typeof editor.zoom === "number") {
|
|
121651
|
+
return editor.zoom;
|
|
121652
|
+
}
|
|
121653
|
+
if (editor?.presentationEditor && typeof editor.presentationEditor.zoom === "number") {
|
|
121654
|
+
return editor.presentationEditor.zoom;
|
|
121655
|
+
}
|
|
121656
|
+
console.warn(
|
|
121657
|
+
"[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."
|
|
121658
|
+
);
|
|
121659
|
+
return 1;
|
|
121660
|
+
};
|
|
121278
121661
|
const dragState = ref$1(null);
|
|
121279
121662
|
const forcedCleanup = ref$1(false);
|
|
121280
121663
|
let rafId = null;
|
|
@@ -121384,12 +121767,16 @@ const _sfc_main$4 = {
|
|
|
121384
121767
|
}));
|
|
121385
121768
|
}
|
|
121386
121769
|
function getSegmentHandleStyle(boundary, segment) {
|
|
121770
|
+
const zoom = getZoom();
|
|
121771
|
+
const scaledX = boundary.x * zoom;
|
|
121772
|
+
const scaledY = segment.y != null ? segment.y * zoom : null;
|
|
121773
|
+
const scaledH = segment.h != null ? segment.h * zoom : null;
|
|
121387
121774
|
return {
|
|
121388
121775
|
position: "absolute",
|
|
121389
|
-
left: `${
|
|
121390
|
-
top:
|
|
121776
|
+
left: `${scaledX}px`,
|
|
121777
|
+
top: scaledY != null ? `${scaledY}px` : "0",
|
|
121391
121778
|
width: `${RESIZE_HANDLE_WIDTH_PX}px`,
|
|
121392
|
-
height:
|
|
121779
|
+
height: scaledH != null ? `${scaledH}px` : "100%",
|
|
121393
121780
|
transform: `translateX(-${RESIZE_HANDLE_OFFSET_PX}px)`,
|
|
121394
121781
|
cursor: "col-resize",
|
|
121395
121782
|
pointerEvents: "auto"
|
|
@@ -121399,7 +121786,8 @@ const _sfc_main$4 = {
|
|
|
121399
121786
|
if (!dragState.value || !tableMetadata.value) return { display: "none" };
|
|
121400
121787
|
const initialBoundary = resizableBoundaries.value[dragState.value.resizableBoundaryIndex];
|
|
121401
121788
|
if (!initialBoundary) return { display: "none" };
|
|
121402
|
-
const
|
|
121789
|
+
const zoom = getZoom();
|
|
121790
|
+
const newX = (initialBoundary.x + dragState.value.constrainedDelta) * zoom;
|
|
121403
121791
|
return {
|
|
121404
121792
|
position: "absolute",
|
|
121405
121793
|
left: `${newX}px`,
|
|
@@ -121527,7 +121915,9 @@ const _sfc_main$4 = {
|
|
|
121527
121915
|
}
|
|
121528
121916
|
const mouseMoveThrottle = throttle2((event) => {
|
|
121529
121917
|
if (isUnmounted || !dragState.value) return;
|
|
121530
|
-
const
|
|
121918
|
+
const zoom = getZoom();
|
|
121919
|
+
const screenDelta = event.clientX - dragState.value.initialX;
|
|
121920
|
+
const delta = screenDelta / zoom;
|
|
121531
121921
|
const minDelta = -(dragState.value.leftColumn.width - dragState.value.leftColumn.minWidth);
|
|
121532
121922
|
let maxDelta;
|
|
121533
121923
|
if (dragState.value.isRightEdge) {
|
|
@@ -121538,7 +121928,7 @@ const _sfc_main$4 = {
|
|
|
121538
121928
|
const tableLeftInPage = tableRect.left - pageRect.left;
|
|
121539
121929
|
const rightMargin = tableLeftInPage;
|
|
121540
121930
|
const maxRightPosition = pageRect.right - rightMargin;
|
|
121541
|
-
const availableSpace = maxRightPosition - tableRect.right;
|
|
121931
|
+
const availableSpace = (maxRightPosition - tableRect.right) / zoom;
|
|
121542
121932
|
maxDelta = Math.max(0, availableSpace);
|
|
121543
121933
|
} else {
|
|
121544
121934
|
maxDelta = Infinity;
|
|
@@ -121774,7 +122164,7 @@ const _sfc_main$4 = {
|
|
|
121774
122164
|
};
|
|
121775
122165
|
}
|
|
121776
122166
|
};
|
|
121777
|
-
const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
122167
|
+
const TableResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-814384b6"]]);
|
|
121778
122168
|
const _hoisted_1$2 = ["data-handle-position", "onMousedown"];
|
|
121779
122169
|
const OVERLAY_EXPANSION_PX = 2e3;
|
|
121780
122170
|
const RESIZE_HANDLE_SIZE_PX = 12;
|
|
@@ -122208,6 +122598,8 @@ const _sfc_main$3 = {
|
|
|
122208
122598
|
}
|
|
122209
122599
|
};
|
|
122210
122600
|
const ImageResizeOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-e66ec7bb"]]);
|
|
122601
|
+
const LINK_CLICK_DEBOUNCE_MS = 300;
|
|
122602
|
+
const CURSOR_UPDATE_TIMEOUT_MS = 10;
|
|
122211
122603
|
const _sfc_main$2 = {
|
|
122212
122604
|
__name: "LinkClickHandler",
|
|
122213
122605
|
props: {
|
|
@@ -122230,7 +122622,15 @@ const _sfc_main$2 = {
|
|
|
122230
122622
|
},
|
|
122231
122623
|
setup(__props) {
|
|
122232
122624
|
const props = __props;
|
|
122625
|
+
let lastLinkClickTime = 0;
|
|
122233
122626
|
const handleLinkClick = (event) => {
|
|
122627
|
+
const detail = event?.detail ?? {};
|
|
122628
|
+
const linkElement = detail.element;
|
|
122629
|
+
const now = Date.now();
|
|
122630
|
+
if (now - lastLinkClickTime < LINK_CLICK_DEBOUNCE_MS) {
|
|
122631
|
+
return;
|
|
122632
|
+
}
|
|
122633
|
+
lastLinkClickTime = now;
|
|
122234
122634
|
if (props.popoverVisible) {
|
|
122235
122635
|
props.closePopover();
|
|
122236
122636
|
return;
|
|
@@ -122242,12 +122642,34 @@ const _sfc_main$2 = {
|
|
|
122242
122642
|
if (!surface) {
|
|
122243
122643
|
return;
|
|
122244
122644
|
}
|
|
122245
|
-
const
|
|
122246
|
-
|
|
122645
|
+
const pmStart = linkElement?.dataset?.pmStart;
|
|
122646
|
+
if (pmStart != null) {
|
|
122647
|
+
const pos = parseInt(pmStart, 10);
|
|
122648
|
+
const state2 = props.editor.state;
|
|
122649
|
+
const doc2 = state2.doc;
|
|
122650
|
+
if (!isNaN(pos) && pos >= 0 && pos <= doc2.content.size) {
|
|
122651
|
+
const tr = state2.tr.setSelection(TextSelection$1.create(doc2, pos));
|
|
122652
|
+
props.editor.dispatch(tr);
|
|
122653
|
+
} else {
|
|
122654
|
+
console.warn(`Invalid PM position from data-pm-start: ${pmStart}, falling back to coordinate-based positioning`);
|
|
122655
|
+
moveCursorToMouseEvent(detail, props.editor);
|
|
122656
|
+
}
|
|
122657
|
+
} else {
|
|
122658
|
+
moveCursorToMouseEvent(detail, props.editor);
|
|
122659
|
+
}
|
|
122247
122660
|
setTimeout(() => {
|
|
122248
122661
|
const currentState = props.editor.state;
|
|
122662
|
+
const $from = currentState.selection.$from;
|
|
122663
|
+
const linkMarkType = currentState.schema.marks.link;
|
|
122664
|
+
const nodeAfter = $from.nodeAfter;
|
|
122665
|
+
const nodeBefore = $from.nodeBefore;
|
|
122666
|
+
const marksOnNodeAfter = nodeAfter?.marks || [];
|
|
122667
|
+
const marksOnNodeBefore = nodeBefore?.marks || [];
|
|
122668
|
+
const linkOnNodeAfter = linkMarkType && marksOnNodeAfter.some((m2) => m2.type === linkMarkType);
|
|
122669
|
+
const linkOnNodeBefore = linkMarkType && marksOnNodeBefore.some((m2) => m2.type === linkMarkType);
|
|
122670
|
+
const hasLinkAdjacent = linkOnNodeAfter || linkOnNodeBefore;
|
|
122249
122671
|
const hasLink = selectionHasNodeOrMark(currentState, "link", { requireEnds: true });
|
|
122250
|
-
if (hasLink) {
|
|
122672
|
+
if (hasLink || hasLinkAdjacent) {
|
|
122251
122673
|
const surfaceRect = surface.getBoundingClientRect();
|
|
122252
122674
|
if (!surfaceRect) return;
|
|
122253
122675
|
props.openPopover(
|
|
@@ -122263,7 +122685,7 @@ const _sfc_main$2 = {
|
|
|
122263
122685
|
}
|
|
122264
122686
|
);
|
|
122265
122687
|
}
|
|
122266
|
-
},
|
|
122688
|
+
}, CURSOR_UPDATE_TIMEOUT_MS);
|
|
122267
122689
|
};
|
|
122268
122690
|
let surfaceElement = null;
|
|
122269
122691
|
onMounted(() => {
|
|
@@ -122309,7 +122731,7 @@ const _hoisted_3 = { class: "placeholder-title" };
|
|
|
122309
122731
|
const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
122310
122732
|
const TABLE_RESIZE_HOVER_THRESHOLD = 8;
|
|
122311
122733
|
const TABLE_RESIZE_THROTTLE_MS = 16;
|
|
122312
|
-
const _sfc_main$1 = {
|
|
122734
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
122313
122735
|
__name: "SuperEditor",
|
|
122314
122736
|
props: {
|
|
122315
122737
|
documentId: {
|
|
@@ -122378,6 +122800,24 @@ const _sfc_main$1 = {
|
|
|
122378
122800
|
imageElement: null,
|
|
122379
122801
|
blockId: null
|
|
122380
122802
|
});
|
|
122803
|
+
const selectedImageState = reactive({
|
|
122804
|
+
element: null,
|
|
122805
|
+
blockId: null,
|
|
122806
|
+
pmStart: null
|
|
122807
|
+
});
|
|
122808
|
+
const getEditorZoom = () => {
|
|
122809
|
+
const active = activeEditor.value;
|
|
122810
|
+
if (active && typeof active.zoom === "number") {
|
|
122811
|
+
return active.zoom;
|
|
122812
|
+
}
|
|
122813
|
+
if (active?.presentationEditor && typeof active.presentationEditor.zoom === "number") {
|
|
122814
|
+
return active.presentationEditor.zoom;
|
|
122815
|
+
}
|
|
122816
|
+
console.warn(
|
|
122817
|
+
"[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."
|
|
122818
|
+
);
|
|
122819
|
+
return 1;
|
|
122820
|
+
};
|
|
122381
122821
|
let lastUpdateTableResizeTimestamp = 0;
|
|
122382
122822
|
const isNearColumnBoundary = (event, tableElement) => {
|
|
122383
122823
|
if (!event || typeof event.clientX !== "number" || typeof event.clientY !== "number") {
|
|
@@ -122393,13 +122833,26 @@ const _sfc_main$1 = {
|
|
|
122393
122833
|
try {
|
|
122394
122834
|
const metadata = JSON.parse(boundariesAttr);
|
|
122395
122835
|
if (!metadata.columns || !Array.isArray(metadata.columns)) return false;
|
|
122836
|
+
const zoom = getEditorZoom();
|
|
122396
122837
|
const tableRect = tableElement.getBoundingClientRect();
|
|
122397
|
-
const
|
|
122398
|
-
const
|
|
122838
|
+
const mouseXScreen = event.clientX - tableRect.left;
|
|
122839
|
+
const mouseYScreen = event.clientY - tableRect.top;
|
|
122399
122840
|
for (let i2 = 0; i2 < metadata.columns.length; i2++) {
|
|
122400
122841
|
const col = metadata.columns[i2];
|
|
122401
|
-
|
|
122402
|
-
|
|
122842
|
+
if (!col || typeof col !== "object") {
|
|
122843
|
+
console.warn(`[isNearColumnBoundary] Invalid column at index ${i2}: not an object`, col);
|
|
122844
|
+
continue;
|
|
122845
|
+
}
|
|
122846
|
+
if (typeof col.x !== "number" || !Number.isFinite(col.x)) {
|
|
122847
|
+
console.warn(`[isNearColumnBoundary] Invalid column.x at index ${i2}:`, col.x);
|
|
122848
|
+
continue;
|
|
122849
|
+
}
|
|
122850
|
+
if (typeof col.w !== "number" || !Number.isFinite(col.w) || col.w <= 0) {
|
|
122851
|
+
console.warn(`[isNearColumnBoundary] Invalid column.w at index ${i2}:`, col.w);
|
|
122852
|
+
continue;
|
|
122853
|
+
}
|
|
122854
|
+
const boundaryXScreen = (col.x + col.w) * zoom;
|
|
122855
|
+
if (Math.abs(mouseXScreen - boundaryXScreen) <= TABLE_RESIZE_HOVER_THRESHOLD) {
|
|
122403
122856
|
const segmentColIndex = i2 + 1;
|
|
122404
122857
|
const segments = metadata.segments?.[segmentColIndex];
|
|
122405
122858
|
if (!segments || segments.length === 0) {
|
|
@@ -122407,15 +122860,15 @@ const _sfc_main$1 = {
|
|
|
122407
122860
|
continue;
|
|
122408
122861
|
}
|
|
122409
122862
|
for (const seg of segments) {
|
|
122410
|
-
const
|
|
122411
|
-
const
|
|
122412
|
-
if (
|
|
122863
|
+
const segTopScreen = (seg.y || 0) * zoom;
|
|
122864
|
+
const segBottomScreen = seg.h != null ? segTopScreen + seg.h * zoom : tableRect.height;
|
|
122865
|
+
if (mouseYScreen >= segTopScreen && mouseYScreen <= segBottomScreen) {
|
|
122413
122866
|
return true;
|
|
122414
122867
|
}
|
|
122415
122868
|
}
|
|
122416
122869
|
}
|
|
122417
122870
|
}
|
|
122418
|
-
if (Math.abs(
|
|
122871
|
+
if (Math.abs(mouseXScreen) <= TABLE_RESIZE_HOVER_THRESHOLD) {
|
|
122419
122872
|
return true;
|
|
122420
122873
|
}
|
|
122421
122874
|
return false;
|
|
@@ -122479,6 +122932,27 @@ const _sfc_main$1 = {
|
|
|
122479
122932
|
imageResizeState.imageElement = null;
|
|
122480
122933
|
imageResizeState.blockId = null;
|
|
122481
122934
|
};
|
|
122935
|
+
const clearSelectedImage = () => {
|
|
122936
|
+
if (selectedImageState.element?.classList?.contains("superdoc-image-selected")) {
|
|
122937
|
+
selectedImageState.element.classList.remove("superdoc-image-selected");
|
|
122938
|
+
}
|
|
122939
|
+
selectedImageState.element = null;
|
|
122940
|
+
selectedImageState.blockId = null;
|
|
122941
|
+
selectedImageState.pmStart = null;
|
|
122942
|
+
};
|
|
122943
|
+
const setSelectedImage = (element, blockId, pmStart) => {
|
|
122944
|
+
if (selectedImageState.element && selectedImageState.element !== element) {
|
|
122945
|
+
selectedImageState.element.classList.remove("superdoc-image-selected");
|
|
122946
|
+
}
|
|
122947
|
+
if (element && element.classList) {
|
|
122948
|
+
element.classList.add("superdoc-image-selected");
|
|
122949
|
+
selectedImageState.element = element;
|
|
122950
|
+
selectedImageState.blockId = blockId ?? null;
|
|
122951
|
+
selectedImageState.pmStart = typeof pmStart === "number" ? pmStart : null;
|
|
122952
|
+
} else {
|
|
122953
|
+
clearSelectedImage();
|
|
122954
|
+
}
|
|
122955
|
+
};
|
|
122482
122956
|
const handleOverlayUpdates = (event) => {
|
|
122483
122957
|
updateTableResizeOverlay(event);
|
|
122484
122958
|
updateImageResizeOverlay(event);
|
|
@@ -122569,6 +123043,7 @@ const _sfc_main$1 = {
|
|
|
122569
123043
|
const initEditor = async ({ content, media = {}, mediaFiles = {}, fonts = {} } = {}) => {
|
|
122570
123044
|
const { editorCtor, ...editorOptions } = props.options || {};
|
|
122571
123045
|
const EditorCtor = editorCtor ?? Editor;
|
|
123046
|
+
clearSelectedImage();
|
|
122572
123047
|
editor.value = new EditorCtor({
|
|
122573
123048
|
mode: "docx",
|
|
122574
123049
|
element: editorElem.value,
|
|
@@ -122585,17 +123060,19 @@ const _sfc_main$1 = {
|
|
|
122585
123060
|
editor: activeEditor.value,
|
|
122586
123061
|
presentationEditor: editor.value instanceof PresentationEditor ? editor.value : null
|
|
122587
123062
|
});
|
|
122588
|
-
editor.value.on("paginationUpdate", () => {
|
|
122589
|
-
const base2 = activeEditor.value;
|
|
122590
|
-
if (isHeadless(base2)) return;
|
|
122591
|
-
const paginationTarget = editor.value?.editor ? { value: base2 } : editor;
|
|
122592
|
-
adjustPaginationBreaks(editorElem, paginationTarget);
|
|
122593
|
-
});
|
|
122594
123063
|
if (editor.value instanceof PresentationEditor) {
|
|
122595
|
-
editor.value
|
|
123064
|
+
const presentationEditor = editor.value;
|
|
123065
|
+
presentationEditor.on("imageSelected", ({ element, blockId, pmStart }) => {
|
|
123066
|
+
setSelectedImage(element, blockId ?? null, pmStart);
|
|
123067
|
+
});
|
|
123068
|
+
presentationEditor.on("imageDeselected", () => {
|
|
123069
|
+
clearSelectedImage();
|
|
123070
|
+
});
|
|
123071
|
+
presentationEditor.on("layoutUpdated", () => {
|
|
122596
123072
|
if (imageResizeState.visible && imageResizeState.blockId) {
|
|
123073
|
+
const escapedBlockId = CSS.escape(imageResizeState.blockId);
|
|
122597
123074
|
const newElement = editorElem.value?.querySelector(
|
|
122598
|
-
`.superdoc-image-fragment[data-sd-block-id="${
|
|
123075
|
+
`.superdoc-image-fragment[data-sd-block-id="${escapedBlockId}"]`
|
|
122599
123076
|
);
|
|
122600
123077
|
if (newElement) {
|
|
122601
123078
|
imageResizeState.imageElement = newElement;
|
|
@@ -122605,8 +123082,33 @@ const _sfc_main$1 = {
|
|
|
122605
123082
|
imageResizeState.blockId = null;
|
|
122606
123083
|
}
|
|
122607
123084
|
}
|
|
123085
|
+
if (selectedImageState.blockId) {
|
|
123086
|
+
const escapedBlockId = CSS.escape(selectedImageState.blockId);
|
|
123087
|
+
const refreshed = editorElem.value?.querySelector(
|
|
123088
|
+
`.superdoc-image-fragment[data-sd-block-id="${escapedBlockId}"]`
|
|
123089
|
+
);
|
|
123090
|
+
if (refreshed) {
|
|
123091
|
+
setSelectedImage(refreshed, selectedImageState.blockId, selectedImageState.pmStart);
|
|
123092
|
+
} else {
|
|
123093
|
+
if (selectedImageState.pmStart != null) {
|
|
123094
|
+
const pmSelector = `.superdoc-image-fragment[data-pm-start="${selectedImageState.pmStart}"], .superdoc-inline-image[data-pm-start="${selectedImageState.pmStart}"]`;
|
|
123095
|
+
const pmElement = editorElem.value?.querySelector(pmSelector);
|
|
123096
|
+
if (pmElement) {
|
|
123097
|
+
setSelectedImage(pmElement, selectedImageState.blockId, selectedImageState.pmStart);
|
|
123098
|
+
return;
|
|
123099
|
+
}
|
|
123100
|
+
}
|
|
123101
|
+
clearSelectedImage();
|
|
123102
|
+
}
|
|
123103
|
+
}
|
|
122608
123104
|
});
|
|
122609
123105
|
}
|
|
123106
|
+
editor.value.on("paginationUpdate", () => {
|
|
123107
|
+
const base2 = activeEditor.value;
|
|
123108
|
+
if (isHeadless(base2)) return;
|
|
123109
|
+
const paginationTarget = editor.value?.editor ? { value: base2 } : editor;
|
|
123110
|
+
adjustPaginationBreaks(editorElem, paginationTarget);
|
|
123111
|
+
});
|
|
122610
123112
|
editor.value.on("collaborationReady", () => {
|
|
122611
123113
|
setTimeout(() => {
|
|
122612
123114
|
editorReady.value = true;
|
|
@@ -122673,6 +123175,7 @@ const _sfc_main$1 = {
|
|
|
122673
123175
|
};
|
|
122674
123176
|
onBeforeUnmount(() => {
|
|
122675
123177
|
stopPolling();
|
|
123178
|
+
clearSelectedImage();
|
|
122676
123179
|
editor.value?.destroy();
|
|
122677
123180
|
editor.value = null;
|
|
122678
123181
|
});
|
|
@@ -122787,8 +123290,8 @@ const _sfc_main$1 = {
|
|
|
122787
123290
|
]);
|
|
122788
123291
|
};
|
|
122789
123292
|
}
|
|
122790
|
-
};
|
|
122791
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
123293
|
+
});
|
|
123294
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-a935d3e2"]]);
|
|
122792
123295
|
const _hoisted_1 = ["innerHTML"];
|
|
122793
123296
|
const _sfc_main = {
|
|
122794
123297
|
__name: "SuperInput",
|