@harbour-enterprises/superdoc 1.0.0-beta.30 → 1.0.0-beta.31
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-BADCvUNL.cjs → PdfViewer-C8iiBtQt.cjs} +1 -1
- package/dist/chunks/{PdfViewer-C2nY5qD8.es.js → PdfViewer-jGctuklH.es.js} +1 -1
- package/dist/chunks/{index-DmelLGEj.es.js → index-Bu5UUj9S.es.js} +3 -3
- package/dist/chunks/{index-DTgPk1zO.cjs → index-ELjoBC86.cjs} +3 -3
- package/dist/chunks/{index-DUzV7kkk-CM3uwGCb.cjs → index-eG-VYUeN-CG3M1n5T.cjs} +1 -1
- package/dist/chunks/{index-DUzV7kkk-BvBMF_lo.es.js → index-eG-VYUeN-CIuOnW8W.es.js} +1 -1
- package/dist/chunks/{super-editor.es-Be9785LD.es.js → super-editor.es-BAKZgAuj.es.js} +424 -52
- package/dist/chunks/{super-editor.es-463G9jKM.cjs → super-editor.es-DatOA_vA.cjs} +424 -52
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-U59bT3FO.js → converter-CRKt1TG_.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-DSnoGkju.js → docx-zipper-CgVw58T-.js} +1 -1
- package/dist/super-editor/chunks/{editor-DRHVtMIR.js → editor-COQCS1pn.js} +423 -37
- package/dist/super-editor/chunks/{index-DUzV7kkk.js → index-eG-VYUeN.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DbBLxo6N.js → toolbar-B3CSV2yT.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- 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 +410 -38
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -41859,7 +41859,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
41859
41859
|
static getStoredSuperdocVersion(docx) {
|
|
41860
41860
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
41861
41861
|
}
|
|
41862
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.
|
|
41862
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.31") {
|
|
41863
41863
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
41864
41864
|
}
|
|
41865
41865
|
/**
|
|
@@ -53022,7 +53022,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
53022
53022
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
53023
53023
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
53024
53024
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
53025
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _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, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _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, 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;
|
|
53025
|
+
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _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, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _remoteCursorRafHandle, _scrollTimeout, _PresentationEditor_instances, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _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, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
53026
53026
|
var GOOD_LEAF_SIZE = 200;
|
|
53027
53027
|
var RopeSequence = function RopeSequence2() {
|
|
53028
53028
|
};
|
|
@@ -66889,7 +66889,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
66889
66889
|
const shouldSkipNodeView = (editor) => {
|
|
66890
66890
|
return isHeadless(editor);
|
|
66891
66891
|
};
|
|
66892
|
-
const summaryVersion = "1.0.0-beta.
|
|
66892
|
+
const summaryVersion = "1.0.0-beta.31";
|
|
66893
66893
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
66894
66894
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
66895
66895
|
function mapAttributes(attrs) {
|
|
@@ -67678,7 +67678,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67678
67678
|
{ default: remarkStringify2 },
|
|
67679
67679
|
{ default: remarkGfm2 }
|
|
67680
67680
|
] = await Promise.all([
|
|
67681
|
-
Promise.resolve().then(() =>
|
|
67681
|
+
Promise.resolve().then(() => indexEGVYUeN),
|
|
67682
67682
|
Promise.resolve().then(() => indexDRCvimau),
|
|
67683
67683
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
67684
67684
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -67883,7 +67883,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67883
67883
|
* Process collaboration migrations
|
|
67884
67884
|
*/
|
|
67885
67885
|
processCollaborationMigrations() {
|
|
67886
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
67886
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.31");
|
|
67887
67887
|
if (!this.options.ydoc) return;
|
|
67888
67888
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
67889
67889
|
let docVersion = metaMap.get("version");
|
|
@@ -69920,9 +69920,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
69920
69920
|
case TRACK_INSERT_MARK:
|
|
69921
69921
|
case TRACK_DELETE_MARK:
|
|
69922
69922
|
case TRACK_FORMAT_MARK: {
|
|
69923
|
-
|
|
69924
|
-
|
|
69925
|
-
|
|
69923
|
+
if (!isTabRun2) {
|
|
69924
|
+
const tracked = buildTrackedChangeMetaFromMark(mark2);
|
|
69925
|
+
if (tracked) {
|
|
69926
|
+
run2.trackedChange = selectTrackedChangeMeta(run2.trackedChange, tracked);
|
|
69927
|
+
}
|
|
69926
69928
|
}
|
|
69927
69929
|
break;
|
|
69928
69930
|
}
|
|
@@ -75462,6 +75464,38 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75462
75464
|
}
|
|
75463
75465
|
return line.width;
|
|
75464
75466
|
}
|
|
75467
|
+
function charOffsetToPm(block, line, charOffset, fallbackPmStart) {
|
|
75468
|
+
if (!Number.isFinite(charOffset) || !Number.isFinite(fallbackPmStart)) {
|
|
75469
|
+
console.warn("[charOffsetToPm] Invalid input:", { charOffset, fallbackPmStart });
|
|
75470
|
+
return fallbackPmStart;
|
|
75471
|
+
}
|
|
75472
|
+
const safeCharOffset = Math.max(0, charOffset);
|
|
75473
|
+
if (block.kind !== "paragraph") {
|
|
75474
|
+
return fallbackPmStart + safeCharOffset;
|
|
75475
|
+
}
|
|
75476
|
+
const runs2 = sliceRunsForLine$1(block, line);
|
|
75477
|
+
let cursor = 0;
|
|
75478
|
+
let lastPm = fallbackPmStart;
|
|
75479
|
+
for (const run2 of runs2) {
|
|
75480
|
+
const isTab = isTabRun$1(run2);
|
|
75481
|
+
const text2 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text ?? "";
|
|
75482
|
+
const runLength = isTab ? TAB_CHAR_LENGTH : text2.length;
|
|
75483
|
+
const runPmStart = typeof run2.pmStart === "number" ? run2.pmStart : null;
|
|
75484
|
+
const runPmEnd = typeof run2.pmEnd === "number" ? run2.pmEnd : runPmStart != null ? runPmStart + runLength : null;
|
|
75485
|
+
if (runPmStart != null) {
|
|
75486
|
+
lastPm = runPmStart;
|
|
75487
|
+
}
|
|
75488
|
+
if (safeCharOffset <= cursor + runLength) {
|
|
75489
|
+
const offsetInRun = Math.max(0, safeCharOffset - cursor);
|
|
75490
|
+
return runPmStart != null ? runPmStart + Math.min(offsetInRun, runLength) : fallbackPmStart + safeCharOffset;
|
|
75491
|
+
}
|
|
75492
|
+
if (runPmEnd != null) {
|
|
75493
|
+
lastPm = runPmEnd;
|
|
75494
|
+
}
|
|
75495
|
+
cursor += runLength;
|
|
75496
|
+
}
|
|
75497
|
+
return lastPm;
|
|
75498
|
+
}
|
|
75465
75499
|
function findCharacterAtX(block, line, x2, pmStart) {
|
|
75466
75500
|
const ctx2 = getMeasurementContext();
|
|
75467
75501
|
if (!ctx2) {
|
|
@@ -75476,9 +75510,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75476
75510
|
);
|
|
75477
75511
|
const ratio = Math.max(0, Math.min(1, x2 / line.width));
|
|
75478
75512
|
const charOffset = Math.round(ratio * charsInLine);
|
|
75513
|
+
const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
|
|
75479
75514
|
return {
|
|
75480
75515
|
charOffset,
|
|
75481
|
-
pmPosition:
|
|
75516
|
+
pmPosition: pmPosition2
|
|
75482
75517
|
};
|
|
75483
75518
|
}
|
|
75484
75519
|
const runs2 = sliceRunsForLine$1(block, line);
|
|
@@ -75494,11 +75529,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75494
75529
|
const midpoint = startX + tabWidth / 2;
|
|
75495
75530
|
const offsetInRun = safeX < midpoint ? 0 : TAB_CHAR_LENGTH;
|
|
75496
75531
|
const charOffset = currentCharOffset + offsetInRun;
|
|
75497
|
-
const
|
|
75498
|
-
const pmPosition = pmBase + offsetInRun;
|
|
75532
|
+
const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
|
|
75499
75533
|
return {
|
|
75500
75534
|
charOffset,
|
|
75501
|
-
pmPosition
|
|
75535
|
+
pmPosition: pmPosition2
|
|
75502
75536
|
};
|
|
75503
75537
|
}
|
|
75504
75538
|
currentX = endX;
|
|
@@ -75515,9 +75549,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75515
75549
|
const charX = currentX + measured2.width + computeLetterSpacingWidth(run2, i2, runLength);
|
|
75516
75550
|
if (charX >= safeX) {
|
|
75517
75551
|
if (i2 === 0) {
|
|
75552
|
+
const pmPosition3 = charOffsetToPm(block, line, currentCharOffset, pmStart);
|
|
75518
75553
|
return {
|
|
75519
75554
|
charOffset: currentCharOffset,
|
|
75520
|
-
pmPosition:
|
|
75555
|
+
pmPosition: pmPosition3
|
|
75521
75556
|
};
|
|
75522
75557
|
}
|
|
75523
75558
|
const prevText = text2.slice(0, i2 - 1);
|
|
@@ -75526,9 +75561,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75526
75561
|
const distToPrev = Math.abs(safeX - prevX);
|
|
75527
75562
|
const distToCurrent = Math.abs(safeX - charX);
|
|
75528
75563
|
const charOffset = distToPrev < distToCurrent ? currentCharOffset + i2 - 1 : currentCharOffset + i2;
|
|
75564
|
+
const pmPosition2 = charOffsetToPm(block, line, charOffset, pmStart);
|
|
75529
75565
|
return {
|
|
75530
75566
|
charOffset,
|
|
75531
|
-
pmPosition:
|
|
75567
|
+
pmPosition: pmPosition2
|
|
75532
75568
|
};
|
|
75533
75569
|
}
|
|
75534
75570
|
}
|
|
@@ -75536,9 +75572,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75536
75572
|
currentX += measured.width + computeLetterSpacingWidth(run2, runLength, runLength);
|
|
75537
75573
|
currentCharOffset += runLength;
|
|
75538
75574
|
}
|
|
75575
|
+
const pmPosition = charOffsetToPm(block, line, currentCharOffset, pmStart);
|
|
75539
75576
|
return {
|
|
75540
75577
|
charOffset: currentCharOffset,
|
|
75541
|
-
pmPosition
|
|
75578
|
+
pmPosition
|
|
75542
75579
|
};
|
|
75543
75580
|
}
|
|
75544
75581
|
const computeLetterSpacingWidth = (run2, precedingChars, runLength) => {
|
|
@@ -75744,7 +75781,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75744
75781
|
pmEnd: spanEnd,
|
|
75745
75782
|
text: targetEl.textContent?.substring(0, 30),
|
|
75746
75783
|
visibility: targetEl.style.visibility,
|
|
75747
|
-
rect: { left: targetRect.left, right: targetRect.right, width: targetRect.width }
|
|
75784
|
+
rect: { left: targetRect.left, right: targetRect.right, width: targetRect.width },
|
|
75785
|
+
pageX: viewX,
|
|
75786
|
+
pageY: viewY
|
|
75748
75787
|
});
|
|
75749
75788
|
if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd)) {
|
|
75750
75789
|
return null;
|
|
@@ -79310,6 +79349,88 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
79310
79349
|
}
|
|
79311
79350
|
return result;
|
|
79312
79351
|
}
|
|
79352
|
+
function findWordBoundaries(blocks2, pos) {
|
|
79353
|
+
const blockInfo = findBlockAtPosition(blocks2, pos);
|
|
79354
|
+
if (!blockInfo) return null;
|
|
79355
|
+
const { block, localPos } = blockInfo;
|
|
79356
|
+
if (block.kind !== "paragraph") return null;
|
|
79357
|
+
const { text: text2, pmStart } = extractBlockText(block);
|
|
79358
|
+
if (text2.length === 0) return null;
|
|
79359
|
+
const clampedPos = Math.max(0, Math.min(localPos, text2.length));
|
|
79360
|
+
let wordStart = clampedPos;
|
|
79361
|
+
while (wordStart > 0 && isWordChar(text2[wordStart - 1])) {
|
|
79362
|
+
wordStart--;
|
|
79363
|
+
}
|
|
79364
|
+
let wordEnd = clampedPos;
|
|
79365
|
+
while (wordEnd < text2.length && isWordChar(text2[wordEnd])) {
|
|
79366
|
+
wordEnd++;
|
|
79367
|
+
}
|
|
79368
|
+
if (wordStart === wordEnd) {
|
|
79369
|
+
while (wordStart > 0 && isWhitespace$1(text2[wordStart - 1])) {
|
|
79370
|
+
wordStart--;
|
|
79371
|
+
}
|
|
79372
|
+
while (wordEnd < text2.length && isWhitespace$1(text2[wordEnd])) {
|
|
79373
|
+
wordEnd++;
|
|
79374
|
+
}
|
|
79375
|
+
if (wordStart === wordEnd) {
|
|
79376
|
+
return null;
|
|
79377
|
+
}
|
|
79378
|
+
}
|
|
79379
|
+
return {
|
|
79380
|
+
from: pmStart + wordStart,
|
|
79381
|
+
to: pmStart + wordEnd
|
|
79382
|
+
};
|
|
79383
|
+
}
|
|
79384
|
+
function findParagraphBoundaries(blocks2, pos) {
|
|
79385
|
+
const blockInfo = findBlockAtPosition(blocks2, pos);
|
|
79386
|
+
if (!blockInfo) return null;
|
|
79387
|
+
const { block } = blockInfo;
|
|
79388
|
+
if (block.kind === "paragraph") {
|
|
79389
|
+
const { pmStart, pmEnd } = extractBlockText(block);
|
|
79390
|
+
return { from: pmStart, to: pmEnd };
|
|
79391
|
+
}
|
|
79392
|
+
if (block.kind === "image") {
|
|
79393
|
+
return { from: pos, to: pos + 1 };
|
|
79394
|
+
}
|
|
79395
|
+
return null;
|
|
79396
|
+
}
|
|
79397
|
+
function extractBlockText(block) {
|
|
79398
|
+
if (block.kind !== "paragraph") {
|
|
79399
|
+
return { text: "", pmStart: 0, pmEnd: 0 };
|
|
79400
|
+
}
|
|
79401
|
+
let text2 = "";
|
|
79402
|
+
let pmStart = Infinity;
|
|
79403
|
+
let pmEnd = 0;
|
|
79404
|
+
for (const run2 of block.runs) {
|
|
79405
|
+
text2 += "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text;
|
|
79406
|
+
if (run2.pmStart !== void 0) {
|
|
79407
|
+
pmStart = Math.min(pmStart, run2.pmStart);
|
|
79408
|
+
}
|
|
79409
|
+
if (run2.pmEnd !== void 0) {
|
|
79410
|
+
pmEnd = Math.max(pmEnd, run2.pmEnd);
|
|
79411
|
+
}
|
|
79412
|
+
}
|
|
79413
|
+
if (pmStart === Infinity) pmStart = 0;
|
|
79414
|
+
if (pmEnd === 0 && text2.length > 0) pmEnd = pmStart + text2.length;
|
|
79415
|
+
return { text: text2, pmStart, pmEnd };
|
|
79416
|
+
}
|
|
79417
|
+
function findBlockAtPosition(blocks2, pos) {
|
|
79418
|
+
for (const block of blocks2) {
|
|
79419
|
+
if (block.kind === "paragraph") {
|
|
79420
|
+
const { pmStart, pmEnd } = extractBlockText(block);
|
|
79421
|
+
if (pos >= pmStart && pos <= pmEnd) {
|
|
79422
|
+
return { block, localPos: pos - pmStart };
|
|
79423
|
+
}
|
|
79424
|
+
}
|
|
79425
|
+
}
|
|
79426
|
+
return null;
|
|
79427
|
+
}
|
|
79428
|
+
function isWordChar(char) {
|
|
79429
|
+
return /[\p{L}\p{N}_]/u.test(char);
|
|
79430
|
+
}
|
|
79431
|
+
function isWhitespace$1(char) {
|
|
79432
|
+
return /\s/.test(char);
|
|
79433
|
+
}
|
|
79313
79434
|
let canvas = null;
|
|
79314
79435
|
let ctx$2 = null;
|
|
79315
79436
|
function getCtx() {
|
|
@@ -80103,6 +80224,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
80103
80224
|
};
|
|
80104
80225
|
const logClickStage = (_level, _stage, _payload) => {
|
|
80105
80226
|
};
|
|
80227
|
+
const logPositionDebug = (payload) => {
|
|
80228
|
+
return;
|
|
80229
|
+
};
|
|
80230
|
+
const logSelectionMapDebug = (payload) => {
|
|
80231
|
+
return;
|
|
80232
|
+
};
|
|
80106
80233
|
const blockPmRangeFromAttrs = (block) => {
|
|
80107
80234
|
const attrs = block?.attrs;
|
|
80108
80235
|
const pmStart = typeof attrs?.pmStart === "number" ? attrs.pmStart : void 0;
|
|
@@ -80372,6 +80499,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
80372
80499
|
return null;
|
|
80373
80500
|
}
|
|
80374
80501
|
const column = determineColumn(layout, fragment.x);
|
|
80502
|
+
logPositionDebug({
|
|
80503
|
+
blockId: fragment.blockId,
|
|
80504
|
+
x: pageRelativePoint.x - fragment.x
|
|
80505
|
+
});
|
|
80375
80506
|
logClickStage("log", "success", {
|
|
80376
80507
|
blockId: fragment.blockId
|
|
80377
80508
|
});
|
|
@@ -80480,10 +80611,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
80480
80611
|
const sliceFrom = Math.max(range2.pmStart, from2);
|
|
80481
80612
|
const sliceTo = Math.min(range2.pmEnd, to);
|
|
80482
80613
|
if (sliceFrom >= sliceTo) return;
|
|
80483
|
-
const
|
|
80484
|
-
const
|
|
80485
|
-
const
|
|
80486
|
-
const
|
|
80614
|
+
const charOffsetFrom = pmPosToCharOffset(block, line, sliceFrom);
|
|
80615
|
+
const charOffsetTo = pmPosToCharOffset(block, line, sliceTo);
|
|
80616
|
+
const startX = mapPmToX(block, line, charOffsetFrom, fragment.width);
|
|
80617
|
+
const endX = mapPmToX(block, line, charOffsetTo, fragment.width);
|
|
80618
|
+
const markerWidth = fragment.markerWidth ?? measure.marker?.markerWidth ?? 0;
|
|
80619
|
+
const rectX = fragment.x + markerWidth + Math.min(startX, endX);
|
|
80620
|
+
const rectWidth = Math.max(1, Math.abs(endX - startX));
|
|
80487
80621
|
const lineOffset = lineHeightBeforeIndex(measure, index2) - lineHeightBeforeIndex(measure, fragment.fromLine);
|
|
80488
80622
|
const rectY = fragment.y + lineOffset;
|
|
80489
80623
|
rects.push({
|
|
@@ -80641,6 +80775,57 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
80641
80775
|
}
|
|
80642
80776
|
return { pmStart, pmEnd };
|
|
80643
80777
|
}
|
|
80778
|
+
function pmPosToCharOffset(block, line, pmPos) {
|
|
80779
|
+
if (block.kind !== "paragraph") return 0;
|
|
80780
|
+
let charOffset = 0;
|
|
80781
|
+
for (let runIndex = line.fromRun; runIndex <= line.toRun; runIndex += 1) {
|
|
80782
|
+
const run2 = block.runs[runIndex];
|
|
80783
|
+
if (!run2) continue;
|
|
80784
|
+
const text2 = "src" in run2 || run2.kind === "lineBreak" || run2.kind === "break" ? "" : run2.text ?? "";
|
|
80785
|
+
const runTextLength = text2.length;
|
|
80786
|
+
const runPmStart = run2.pmStart ?? null;
|
|
80787
|
+
const runPmEnd = run2.pmEnd ?? (runPmStart != null ? runPmStart + runTextLength : null);
|
|
80788
|
+
if (runPmStart == null || runPmEnd == null || runTextLength === 0) continue;
|
|
80789
|
+
const isFirstRun = runIndex === line.fromRun;
|
|
80790
|
+
const isLastRun = runIndex === line.toRun;
|
|
80791
|
+
const lineStartChar = isFirstRun ? line.fromChar : 0;
|
|
80792
|
+
const lineEndChar = isLastRun ? line.toChar : runTextLength;
|
|
80793
|
+
const runSliceCharCount = lineEndChar - lineStartChar;
|
|
80794
|
+
const runPmRange = runPmEnd - runPmStart;
|
|
80795
|
+
const runSlicePmStart = runPmStart + lineStartChar / runTextLength * runPmRange;
|
|
80796
|
+
const runSlicePmEnd = runPmStart + lineEndChar / runTextLength * runPmRange;
|
|
80797
|
+
if (pmPos >= runSlicePmStart && pmPos <= runSlicePmEnd) {
|
|
80798
|
+
const runSlicePmRange = runSlicePmEnd - runSlicePmStart;
|
|
80799
|
+
if (runSlicePmRange > 0) {
|
|
80800
|
+
const pmOffsetInSlice = pmPos - runSlicePmStart;
|
|
80801
|
+
const charOffsetInSlice = Math.round(pmOffsetInSlice / runSlicePmRange * runSliceCharCount);
|
|
80802
|
+
const result = charOffset + Math.min(charOffsetInSlice, runSliceCharCount);
|
|
80803
|
+
const runText2 = text2;
|
|
80804
|
+
const offsetInRun = result - charOffset - (isFirstRun ? 0 : 0);
|
|
80805
|
+
logSelectionMapDebug({
|
|
80806
|
+
blockId: block.id,
|
|
80807
|
+
lineFromRun: line.fromRun,
|
|
80808
|
+
lineToRun: line.toRun,
|
|
80809
|
+
runTextPreview: runText2.slice(Math.max(0, offsetInRun - 10), Math.min(runText2.length, offsetInRun + 10))
|
|
80810
|
+
});
|
|
80811
|
+
return result;
|
|
80812
|
+
}
|
|
80813
|
+
logSelectionMapDebug({
|
|
80814
|
+
blockId: block.id
|
|
80815
|
+
});
|
|
80816
|
+
return charOffset;
|
|
80817
|
+
}
|
|
80818
|
+
if (pmPos > runSlicePmEnd) {
|
|
80819
|
+
charOffset += runSliceCharCount;
|
|
80820
|
+
}
|
|
80821
|
+
}
|
|
80822
|
+
logSelectionMapDebug({
|
|
80823
|
+
blockId: block.id,
|
|
80824
|
+
lineFromRun: line.fromRun,
|
|
80825
|
+
lineToRun: line.toRun
|
|
80826
|
+
});
|
|
80827
|
+
return charOffset;
|
|
80828
|
+
}
|
|
80644
80829
|
const determineColumn = (layout, fragmentX) => {
|
|
80645
80830
|
const columns = layout.columns;
|
|
80646
80831
|
if (!columns || columns.count <= 1) return 0;
|
|
@@ -80685,8 +80870,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
80685
80870
|
if (isRTL) {
|
|
80686
80871
|
const charOffset = result.charOffset;
|
|
80687
80872
|
const charsInLine = Math.max(1, line.toChar - line.fromChar);
|
|
80688
|
-
const reversedOffset = charsInLine - charOffset;
|
|
80689
|
-
return range2.pmStart
|
|
80873
|
+
const reversedOffset = Math.max(0, Math.min(charsInLine, charsInLine - charOffset));
|
|
80874
|
+
return charOffsetToPm(block, line, reversedOffset, range2.pmStart);
|
|
80690
80875
|
}
|
|
80691
80876
|
return result.pmPosition;
|
|
80692
80877
|
};
|
|
@@ -84543,8 +84728,22 @@ ${l}
|
|
|
84543
84728
|
const paraIndentRight = paraIndent?.right ?? 0;
|
|
84544
84729
|
const suppressFirstLineIndent = block.attrs?.suppressFirstLineIndent === true;
|
|
84545
84730
|
const firstLineOffset = suppressFirstLineIndent ? 0 : (paraIndent?.firstLine ?? 0) - (paraIndent?.hanging ?? 0);
|
|
84731
|
+
const isListParagraph = !!(fragment.markerWidth && wordLayout?.marker);
|
|
84732
|
+
const lastRun = block.runs.length > 0 ? block.runs[block.runs.length - 1] : null;
|
|
84733
|
+
const paragraphEndsWithLineBreak = lastRun?.kind === "lineBreak";
|
|
84546
84734
|
lines.forEach((line, index2) => {
|
|
84547
|
-
const
|
|
84735
|
+
const availableWidthOverride = Math.max(0, fragment.width - (paraIndentLeft + paraIndentRight));
|
|
84736
|
+
const isLastLineOfFragment = index2 === lines.length - 1;
|
|
84737
|
+
const isLastLineOfParagraph = isLastLineOfFragment && !fragment.continuesOnNext;
|
|
84738
|
+
const shouldSkipJustifyForLastLine = isLastLineOfParagraph && !paragraphEndsWithLineBreak;
|
|
84739
|
+
const lineEl = this.renderLine(
|
|
84740
|
+
block,
|
|
84741
|
+
line,
|
|
84742
|
+
context,
|
|
84743
|
+
availableWidthOverride,
|
|
84744
|
+
fragment.fromLine + index2,
|
|
84745
|
+
isListParagraph || shouldSkipJustifyForLastLine
|
|
84746
|
+
);
|
|
84548
84747
|
const isListFirstLine = index2 === 0 && !fragment.continuesFromPrev && fragment.markerWidth && wordLayout?.marker;
|
|
84549
84748
|
const hasExplicitSegmentPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
84550
84749
|
const isFirstLine = index2 === 0 && !fragment.continuesFromPrev;
|
|
@@ -84773,8 +84972,13 @@ ${l}
|
|
|
84773
84972
|
const lines = itemMeasure.paragraph.lines.slice(fragment.fromLine, fragment.toLine);
|
|
84774
84973
|
const contentAttrs = wordLayout ? item.paragraph.attrs : stripListIndent(item.paragraph.attrs);
|
|
84775
84974
|
applyParagraphBlockStyles(contentEl, contentAttrs);
|
|
84776
|
-
|
|
84777
|
-
|
|
84975
|
+
contentEl.style.textAlign = "left";
|
|
84976
|
+
const paraForList = {
|
|
84977
|
+
...item.paragraph,
|
|
84978
|
+
attrs: { ...item.paragraph.attrs || {}, alignment: "left" }
|
|
84979
|
+
};
|
|
84980
|
+
lines.forEach((line, idx) => {
|
|
84981
|
+
const lineEl = this.renderLine(paraForList, line, context, fragment.width, fragment.fromLine + idx, true);
|
|
84778
84982
|
contentEl.appendChild(lineEl);
|
|
84779
84983
|
});
|
|
84780
84984
|
fragmentEl.appendChild(contentEl);
|
|
@@ -85296,12 +85500,15 @@ ${l}
|
|
|
85296
85500
|
const applyFragmentFrameWithSection = (el, frag) => {
|
|
85297
85501
|
this.applyFragmentFrame(el, frag, context.section);
|
|
85298
85502
|
};
|
|
85503
|
+
const renderLineForTableCell = (block, line, ctx2) => {
|
|
85504
|
+
return this.renderLine(block, line, ctx2, void 0, void 0, true);
|
|
85505
|
+
};
|
|
85299
85506
|
return renderTableFragment({
|
|
85300
85507
|
doc: this.doc,
|
|
85301
85508
|
fragment,
|
|
85302
85509
|
context,
|
|
85303
85510
|
blockLookup: this.blockLookup,
|
|
85304
|
-
renderLine:
|
|
85511
|
+
renderLine: renderLineForTableCell,
|
|
85305
85512
|
applyFragmentFrame: applyFragmentFrameWithSection,
|
|
85306
85513
|
applySdtDataset: this.applySdtDataset.bind(this),
|
|
85307
85514
|
applyStyles: applyStyles$2
|
|
@@ -85636,7 +85843,18 @@ ${l}
|
|
|
85636
85843
|
}
|
|
85637
85844
|
return img2;
|
|
85638
85845
|
}
|
|
85639
|
-
|
|
85846
|
+
/**
|
|
85847
|
+
* Renders a single line of a paragraph block.
|
|
85848
|
+
*
|
|
85849
|
+
* @param block - The paragraph block containing the line
|
|
85850
|
+
* @param line - The line measurement data
|
|
85851
|
+
* @param context - Rendering context with fragment information
|
|
85852
|
+
* @param availableWidthOverride - Optional override for available width used in justification calculations
|
|
85853
|
+
* @param lineIndex - Optional zero-based index of the line within the fragment
|
|
85854
|
+
* @param skipJustify - When true, prevents justification even if alignment is 'justify'
|
|
85855
|
+
* @returns The rendered line element
|
|
85856
|
+
*/
|
|
85857
|
+
renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify) {
|
|
85640
85858
|
if (!this.doc) {
|
|
85641
85859
|
throw new Error("DomPainter: document is not available");
|
|
85642
85860
|
}
|
|
@@ -85648,8 +85866,10 @@ ${l}
|
|
|
85648
85866
|
el.setAttribute("styleid", styleId);
|
|
85649
85867
|
}
|
|
85650
85868
|
const alignment2 = block.attrs?.alignment;
|
|
85651
|
-
if (alignment2 === "center" || alignment2 === "right"
|
|
85652
|
-
el.style.textAlign = alignment2
|
|
85869
|
+
if (alignment2 === "center" || alignment2 === "right") {
|
|
85870
|
+
el.style.textAlign = alignment2;
|
|
85871
|
+
} else if (alignment2 === "justify") {
|
|
85872
|
+
el.style.textAlign = "left";
|
|
85653
85873
|
} else {
|
|
85654
85874
|
el.style.textAlign = "left";
|
|
85655
85875
|
}
|
|
@@ -85662,6 +85882,7 @@ ${l}
|
|
|
85662
85882
|
}
|
|
85663
85883
|
const runsForLine = sliceRunsForLine(block, line);
|
|
85664
85884
|
const trackedConfig = this.resolveTrackedChangesConfig(block);
|
|
85885
|
+
const textSlices = runsForLine.length > 0 ? runsForLine.filter((r2) => (r2.kind === "text" || r2.kind === void 0) && "text" in r2 && r2.text != null).map((r2) => r2.text) : gatherTextSlicesForLine(block, line);
|
|
85665
85886
|
if (runsForLine.length === 0) {
|
|
85666
85887
|
const span = this.doc.createElement("span");
|
|
85667
85888
|
span.innerHTML = " ";
|
|
@@ -85708,6 +85929,19 @@ ${l}
|
|
|
85708
85929
|
});
|
|
85709
85930
|
}
|
|
85710
85931
|
const hasExplicitPositioning = line.segments?.some((seg) => seg.x !== void 0);
|
|
85932
|
+
const availableWidth = availableWidthOverride ?? line.maxWidth ?? line.width;
|
|
85933
|
+
const shouldJustify = !skipJustify && alignment2 === "justify" && !hasExplicitPositioning;
|
|
85934
|
+
if (shouldJustify) {
|
|
85935
|
+
const spaceCount = textSlices.reduce(
|
|
85936
|
+
(sum, s2) => sum + Array.from(s2).filter((ch) => ch === " " || ch === " ").length,
|
|
85937
|
+
0
|
|
85938
|
+
);
|
|
85939
|
+
const slack = Math.max(0, availableWidth - line.width);
|
|
85940
|
+
if (spaceCount > 0 && slack > 0) {
|
|
85941
|
+
const extraPerSpace = slack / spaceCount;
|
|
85942
|
+
el.style.wordSpacing = `${extraPerSpace}px`;
|
|
85943
|
+
}
|
|
85944
|
+
}
|
|
85711
85945
|
if (hasExplicitPositioning && line.segments) {
|
|
85712
85946
|
let cumulativeX = 0;
|
|
85713
85947
|
const segmentsByRun = /* @__PURE__ */ new Map();
|
|
@@ -86491,6 +86725,23 @@ ${l}
|
|
|
86491
86725
|
if (!shading?.fill) return;
|
|
86492
86726
|
element2.style.backgroundColor = shading.fill;
|
|
86493
86727
|
};
|
|
86728
|
+
const gatherTextSlicesForLine = (block, line) => {
|
|
86729
|
+
const slices = [];
|
|
86730
|
+
const startRun = line.fromRun ?? 0;
|
|
86731
|
+
const endRun = line.toRun ?? startRun;
|
|
86732
|
+
for (let runIndex = startRun; runIndex <= endRun; runIndex += 1) {
|
|
86733
|
+
const run2 = block.runs[runIndex];
|
|
86734
|
+
if (!run2 || run2.kind !== "text" && run2.kind !== void 0 || !("text" in run2) || !run2.text) continue;
|
|
86735
|
+
const isFirst = runIndex === startRun;
|
|
86736
|
+
const isLast = runIndex === endRun;
|
|
86737
|
+
const start2 = isFirst ? line.fromChar ?? 0 : 0;
|
|
86738
|
+
const end2 = isLast ? line.toChar ?? run2.text.length : run2.text.length;
|
|
86739
|
+
if (start2 >= end2) continue;
|
|
86740
|
+
const slice2 = run2.text.slice(start2, end2);
|
|
86741
|
+
if (slice2) slices.push(slice2);
|
|
86742
|
+
}
|
|
86743
|
+
return slices;
|
|
86744
|
+
};
|
|
86494
86745
|
const sliceRunsForLine = (block, line) => {
|
|
86495
86746
|
const result = [];
|
|
86496
86747
|
for (let runIndex = line.fromRun; runIndex <= line.toRun; runIndex += 1) {
|
|
@@ -89304,6 +89555,9 @@ ${l}
|
|
|
89304
89555
|
__privateAdd$1(this, _lastClickTime, 0);
|
|
89305
89556
|
__privateAdd$1(this, _lastClickPosition, { x: 0, y: 0 });
|
|
89306
89557
|
__privateAdd$1(this, _lastSelectedImageBlockId, null);
|
|
89558
|
+
__privateAdd$1(this, _dragAnchor, null);
|
|
89559
|
+
__privateAdd$1(this, _isDragging, false);
|
|
89560
|
+
__privateAdd$1(this, _dragExtensionMode, "char");
|
|
89307
89561
|
__privateAdd$1(this, _remoteCursorState, /* @__PURE__ */ new Map());
|
|
89308
89562
|
__privateAdd$1(this, _remoteCursorDirty, false);
|
|
89309
89563
|
__privateAdd$1(this, _remoteCursorOverlay, null);
|
|
@@ -89446,13 +89700,56 @@ ${l}
|
|
|
89446
89700
|
this.emit("imageDeselected", { blockId: __privateGet$1(this, _lastSelectedImageBlockId) });
|
|
89447
89701
|
__privateSet(this, _lastSelectedImageBlockId, null);
|
|
89448
89702
|
}
|
|
89703
|
+
if (event.shiftKey && __privateGet$1(this, _editor3).state.selection.$anchor) {
|
|
89704
|
+
const anchor = __privateGet$1(this, _editor3).state.selection.anchor;
|
|
89705
|
+
const head = hit.pos;
|
|
89706
|
+
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
89707
|
+
try {
|
|
89708
|
+
const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
|
|
89709
|
+
__privateGet$1(this, _editor3).view?.dispatch(tr);
|
|
89710
|
+
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
89711
|
+
} catch (error) {
|
|
89712
|
+
console.warn("[SELECTION] Failed to extend selection on shift+click:", {
|
|
89713
|
+
error,
|
|
89714
|
+
anchor,
|
|
89715
|
+
head,
|
|
89716
|
+
selAnchor,
|
|
89717
|
+
selHead,
|
|
89718
|
+
mode: __privateGet$1(this, _dragExtensionMode)
|
|
89719
|
+
});
|
|
89720
|
+
}
|
|
89721
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
89722
|
+
document.activeElement.blur();
|
|
89723
|
+
}
|
|
89724
|
+
const editorDom2 = __privateGet$1(this, _editor3).view?.dom;
|
|
89725
|
+
if (editorDom2) {
|
|
89726
|
+
editorDom2.focus();
|
|
89727
|
+
__privateGet$1(this, _editor3).view?.focus();
|
|
89728
|
+
}
|
|
89729
|
+
return;
|
|
89730
|
+
}
|
|
89449
89731
|
const clickDepth = __privateMethod$1(this, _PresentationEditor_instances, registerPointerClick_fn).call(this, event);
|
|
89732
|
+
if (clickDepth === 1) {
|
|
89733
|
+
__privateSet(this, _dragAnchor, hit.pos);
|
|
89734
|
+
}
|
|
89735
|
+
__privateSet(this, _isDragging, true);
|
|
89736
|
+
if (clickDepth >= 3) {
|
|
89737
|
+
__privateSet(this, _dragExtensionMode, "para");
|
|
89738
|
+
} else if (clickDepth === 2) {
|
|
89739
|
+
__privateSet(this, _dragExtensionMode, "word");
|
|
89740
|
+
} else {
|
|
89741
|
+
__privateSet(this, _dragExtensionMode, "char");
|
|
89742
|
+
}
|
|
89743
|
+
if (typeof __privateGet$1(this, _viewportHost).setPointerCapture === "function") {
|
|
89744
|
+
__privateGet$1(this, _viewportHost).setPointerCapture(event.pointerId);
|
|
89745
|
+
}
|
|
89450
89746
|
let handledByDepth = false;
|
|
89451
89747
|
if (__privateGet$1(this, _session).mode === "body") {
|
|
89748
|
+
const selectionPos = clickDepth >= 2 && __privateGet$1(this, _dragAnchor) !== null ? __privateGet$1(this, _dragAnchor) : hit.pos;
|
|
89452
89749
|
if (clickDepth >= 3) {
|
|
89453
|
-
handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectParagraphAt_fn).call(this,
|
|
89750
|
+
handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectParagraphAt_fn).call(this, selectionPos);
|
|
89454
89751
|
} else if (clickDepth === 2) {
|
|
89455
|
-
handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectWordAt_fn).call(this,
|
|
89752
|
+
handledByDepth = __privateMethod$1(this, _PresentationEditor_instances, selectWordAt_fn).call(this, selectionPos);
|
|
89456
89753
|
}
|
|
89457
89754
|
}
|
|
89458
89755
|
if (!handledByDepth) {
|
|
@@ -89477,6 +89774,36 @@ ${l}
|
|
|
89477
89774
|
if (!__privateGet$1(this, _layoutState).layout) return;
|
|
89478
89775
|
const normalized = __privateMethod$1(this, _PresentationEditor_instances, normalizeClientPoint_fn).call(this, event.clientX, event.clientY);
|
|
89479
89776
|
if (!normalized) return;
|
|
89777
|
+
if (__privateGet$1(this, _isDragging) && __privateGet$1(this, _dragAnchor) !== null && event.buttons & 1) {
|
|
89778
|
+
const hit = clickToPosition(
|
|
89779
|
+
__privateGet$1(this, _layoutState).layout,
|
|
89780
|
+
__privateGet$1(this, _layoutState).blocks,
|
|
89781
|
+
__privateGet$1(this, _layoutState).measures,
|
|
89782
|
+
{ x: normalized.x, y: normalized.y },
|
|
89783
|
+
__privateGet$1(this, _viewportHost),
|
|
89784
|
+
event.clientX,
|
|
89785
|
+
event.clientY
|
|
89786
|
+
);
|
|
89787
|
+
if (!hit) return;
|
|
89788
|
+
const anchor = __privateGet$1(this, _dragAnchor);
|
|
89789
|
+
const head = hit.pos;
|
|
89790
|
+
const { selAnchor, selHead } = __privateMethod$1(this, _PresentationEditor_instances, calculateExtendedSelection_fn).call(this, anchor, head, __privateGet$1(this, _dragExtensionMode));
|
|
89791
|
+
try {
|
|
89792
|
+
const tr = __privateGet$1(this, _editor3).state.tr.setSelection(TextSelection$1.create(__privateGet$1(this, _editor3).state.doc, selAnchor, selHead));
|
|
89793
|
+
__privateGet$1(this, _editor3).view?.dispatch(tr);
|
|
89794
|
+
__privateMethod$1(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
89795
|
+
} catch (error) {
|
|
89796
|
+
console.warn("[SELECTION] Failed to extend selection during drag:", {
|
|
89797
|
+
error,
|
|
89798
|
+
anchor,
|
|
89799
|
+
head,
|
|
89800
|
+
selAnchor,
|
|
89801
|
+
selHead,
|
|
89802
|
+
mode: __privateGet$1(this, _dragExtensionMode)
|
|
89803
|
+
});
|
|
89804
|
+
}
|
|
89805
|
+
return;
|
|
89806
|
+
}
|
|
89480
89807
|
if (__privateGet$1(this, _session).mode !== "body") {
|
|
89481
89808
|
__privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
|
|
89482
89809
|
return;
|
|
@@ -89495,6 +89822,13 @@ ${l}
|
|
|
89495
89822
|
__privateAdd$1(this, _handlePointerLeave, () => {
|
|
89496
89823
|
__privateMethod$1(this, _PresentationEditor_instances, clearHoverRegion_fn).call(this);
|
|
89497
89824
|
});
|
|
89825
|
+
__privateAdd$1(this, _handlePointerUp, (event) => {
|
|
89826
|
+
if (!__privateGet$1(this, _isDragging)) return;
|
|
89827
|
+
if (typeof __privateGet$1(this, _viewportHost).hasPointerCapture === "function" && typeof __privateGet$1(this, _viewportHost).releasePointerCapture === "function" && __privateGet$1(this, _viewportHost).hasPointerCapture(event.pointerId)) {
|
|
89828
|
+
__privateGet$1(this, _viewportHost).releasePointerCapture(event.pointerId);
|
|
89829
|
+
}
|
|
89830
|
+
__privateSet(this, _isDragging, false);
|
|
89831
|
+
});
|
|
89498
89832
|
__privateAdd$1(this, _handleDoubleClick, (event) => {
|
|
89499
89833
|
if (event.button !== 0) return;
|
|
89500
89834
|
if (!__privateGet$1(this, _layoutState).layout) return;
|
|
@@ -90414,6 +90748,7 @@ ${l}
|
|
|
90414
90748
|
__privateGet$1(this, _viewportHost)?.removeEventListener("pointerdown", __privateGet$1(this, _handlePointerDown));
|
|
90415
90749
|
__privateGet$1(this, _viewportHost)?.removeEventListener("dblclick", __privateGet$1(this, _handleDoubleClick));
|
|
90416
90750
|
__privateGet$1(this, _viewportHost)?.removeEventListener("pointermove", __privateGet$1(this, _handlePointerMove));
|
|
90751
|
+
__privateGet$1(this, _viewportHost)?.removeEventListener("pointerup", __privateGet$1(this, _handlePointerUp));
|
|
90417
90752
|
__privateGet$1(this, _viewportHost)?.removeEventListener("pointerleave", __privateGet$1(this, _handlePointerLeave));
|
|
90418
90753
|
__privateGet$1(this, _visibleHost)?.removeEventListener("keydown", __privateGet$1(this, _handleKeyDown));
|
|
90419
90754
|
__privateGet$1(this, _inputBridge)?.notifyTargetChanged();
|
|
@@ -90523,6 +90858,9 @@ ${l}
|
|
|
90523
90858
|
_lastClickTime = /* @__PURE__ */ new WeakMap();
|
|
90524
90859
|
_lastClickPosition = /* @__PURE__ */ new WeakMap();
|
|
90525
90860
|
_lastSelectedImageBlockId = /* @__PURE__ */ new WeakMap();
|
|
90861
|
+
_dragAnchor = /* @__PURE__ */ new WeakMap();
|
|
90862
|
+
_isDragging = /* @__PURE__ */ new WeakMap();
|
|
90863
|
+
_dragExtensionMode = /* @__PURE__ */ new WeakMap();
|
|
90526
90864
|
_remoteCursorState = /* @__PURE__ */ new WeakMap();
|
|
90527
90865
|
_remoteCursorDirty = /* @__PURE__ */ new WeakMap();
|
|
90528
90866
|
_remoteCursorOverlay = /* @__PURE__ */ new WeakMap();
|
|
@@ -90858,6 +91196,7 @@ ${l}
|
|
|
90858
91196
|
__privateGet$1(this, _viewportHost).addEventListener("pointerdown", __privateGet$1(this, _handlePointerDown));
|
|
90859
91197
|
__privateGet$1(this, _viewportHost).addEventListener("dblclick", __privateGet$1(this, _handleDoubleClick));
|
|
90860
91198
|
__privateGet$1(this, _viewportHost).addEventListener("pointermove", __privateGet$1(this, _handlePointerMove));
|
|
91199
|
+
__privateGet$1(this, _viewportHost).addEventListener("pointerup", __privateGet$1(this, _handlePointerUp));
|
|
90861
91200
|
__privateGet$1(this, _viewportHost).addEventListener("pointerleave", __privateGet$1(this, _handlePointerLeave));
|
|
90862
91201
|
__privateGet$1(this, _visibleHost).addEventListener("keydown", __privateGet$1(this, _handleKeyDown));
|
|
90863
91202
|
};
|
|
@@ -90937,8 +91276,11 @@ ${l}
|
|
|
90937
91276
|
registerPointerClick_fn = function(event) {
|
|
90938
91277
|
const MAX_CLICK_COUNT = 3;
|
|
90939
91278
|
const time2 = event.timeStamp ?? performance.now();
|
|
90940
|
-
const
|
|
90941
|
-
const
|
|
91279
|
+
const timeDelta = time2 - __privateGet$1(this, _lastClickTime);
|
|
91280
|
+
const withinTime = timeDelta <= MULTI_CLICK_TIME_THRESHOLD_MS;
|
|
91281
|
+
const distanceX = Math.abs(event.clientX - __privateGet$1(this, _lastClickPosition).x);
|
|
91282
|
+
const distanceY = Math.abs(event.clientY - __privateGet$1(this, _lastClickPosition).y);
|
|
91283
|
+
const withinDistance = distanceX <= MULTI_CLICK_DISTANCE_THRESHOLD_PX && distanceY <= MULTI_CLICK_DISTANCE_THRESHOLD_PX;
|
|
90942
91284
|
if (withinTime && withinDistance) {
|
|
90943
91285
|
__privateSet(this, _clickCount, Math.min(__privateGet$1(this, _clickCount) + 1, MAX_CLICK_COUNT));
|
|
90944
91286
|
} else {
|
|
@@ -90953,6 +91295,9 @@ ${l}
|
|
|
90953
91295
|
if (!state2?.doc) {
|
|
90954
91296
|
return false;
|
|
90955
91297
|
}
|
|
91298
|
+
if (pos < 0 || pos > state2.doc.content.size) {
|
|
91299
|
+
return false;
|
|
91300
|
+
}
|
|
90956
91301
|
const $pos = state2.doc.resolve(pos);
|
|
90957
91302
|
let textblockPos = $pos;
|
|
90958
91303
|
while (textblockPos.depth > 0) {
|
|
@@ -91039,6 +91384,30 @@ ${l}
|
|
|
91039
91384
|
return false;
|
|
91040
91385
|
}
|
|
91041
91386
|
};
|
|
91387
|
+
calculateExtendedSelection_fn = function(anchor, head, mode) {
|
|
91388
|
+
if (mode === "word") {
|
|
91389
|
+
const anchorBounds = findWordBoundaries(__privateGet$1(this, _layoutState).blocks, anchor);
|
|
91390
|
+
const headBounds = findWordBoundaries(__privateGet$1(this, _layoutState).blocks, head);
|
|
91391
|
+
if (anchorBounds && headBounds) {
|
|
91392
|
+
if (head >= anchor) {
|
|
91393
|
+
return { selAnchor: anchorBounds.from, selHead: headBounds.to };
|
|
91394
|
+
} else {
|
|
91395
|
+
return { selAnchor: anchorBounds.to, selHead: headBounds.from };
|
|
91396
|
+
}
|
|
91397
|
+
}
|
|
91398
|
+
} else if (mode === "para") {
|
|
91399
|
+
const anchorBounds = findParagraphBoundaries(__privateGet$1(this, _layoutState).blocks, anchor);
|
|
91400
|
+
const headBounds = findParagraphBoundaries(__privateGet$1(this, _layoutState).blocks, head);
|
|
91401
|
+
if (anchorBounds && headBounds) {
|
|
91402
|
+
if (head >= anchor) {
|
|
91403
|
+
return { selAnchor: anchorBounds.from, selHead: headBounds.to };
|
|
91404
|
+
} else {
|
|
91405
|
+
return { selAnchor: anchorBounds.to, selHead: headBounds.from };
|
|
91406
|
+
}
|
|
91407
|
+
}
|
|
91408
|
+
}
|
|
91409
|
+
return { selAnchor: anchor, selHead: head };
|
|
91410
|
+
};
|
|
91042
91411
|
isWordCharacter_fn = function(char) {
|
|
91043
91412
|
if (!char) {
|
|
91044
91413
|
return false;
|
|
@@ -91047,6 +91416,7 @@ ${l}
|
|
|
91047
91416
|
};
|
|
91048
91417
|
_handlePointerMove = /* @__PURE__ */ new WeakMap();
|
|
91049
91418
|
_handlePointerLeave = /* @__PURE__ */ new WeakMap();
|
|
91419
|
+
_handlePointerUp = /* @__PURE__ */ new WeakMap();
|
|
91050
91420
|
_handleDoubleClick = /* @__PURE__ */ new WeakMap();
|
|
91051
91421
|
_handleKeyDown = /* @__PURE__ */ new WeakMap();
|
|
91052
91422
|
focusHeaderFooterShortcut_fn = function(kind) {
|
|
@@ -92219,10 +92589,12 @@ ${l}
|
|
|
92219
92589
|
}
|
|
92220
92590
|
const pageRect = pageEl.getBoundingClientRect();
|
|
92221
92591
|
const overlayRect = __privateGet$1(this, _selectionOverlay2).getBoundingClientRect();
|
|
92222
|
-
const
|
|
92592
|
+
const layoutPageSize = __privateGet$1(this, _layoutState).layout?.pageSize;
|
|
92593
|
+
const scaleX = layoutPageSize && typeof layoutPageSize.w === "number" && layoutPageSize.w > 0 ? pageRect.width / layoutPageSize.w : 1;
|
|
92594
|
+
const scaleY = layoutPageSize && typeof layoutPageSize.h === "number" && layoutPageSize.h > 0 ? pageRect.height / layoutPageSize.h : 1;
|
|
92223
92595
|
return {
|
|
92224
|
-
x: pageRect.left - overlayRect.left + pageLocalX *
|
|
92225
|
-
y: pageRect.top - overlayRect.top + pageLocalY *
|
|
92596
|
+
x: pageRect.left - overlayRect.left + pageLocalX * scaleX,
|
|
92597
|
+
y: pageRect.top - overlayRect.top + pageLocalY * scaleY
|
|
92226
92598
|
};
|
|
92227
92599
|
};
|
|
92228
92600
|
normalizeClientPoint_fn = function(clientX, clientY) {
|
|
@@ -145776,7 +146148,7 @@ ${style2}
|
|
|
145776
146148
|
this.config.colors = shuffleArray(this.config.colors);
|
|
145777
146149
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
145778
146150
|
this.colorIndex = 0;
|
|
145779
|
-
this.version = "1.0.0-beta.
|
|
146151
|
+
this.version = "1.0.0-beta.31";
|
|
145780
146152
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
145781
146153
|
this.superdocId = config2.superdocId || v4();
|
|
145782
146154
|
this.colors = this.config.colors;
|
|
@@ -148220,7 +148592,7 @@ ${style2}
|
|
|
148220
148592
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
148221
148593
|
);
|
|
148222
148594
|
}
|
|
148223
|
-
const
|
|
148595
|
+
const indexEGVYUeN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
148224
148596
|
__proto__: null,
|
|
148225
148597
|
unified
|
|
148226
148598
|
}, Symbol.toStringTag, { value: "Module" }));
|