superdoc 1.0.0-beta.32 → 1.0.0-beta.34
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-CTKbqDWv.cjs → PdfViewer-CMVOK_jD.cjs} +1 -1
- package/dist/chunks/{PdfViewer-edjIRb_p.es.js → PdfViewer-DSx1zQC5.es.js} +1 -1
- package/dist/chunks/{index-Pwv0a9G5.es.js → index-8_ijaxSz.es.js} +57 -32
- package/dist/chunks/{index-Cajp7-Xa.cjs → index-BqXrnRP8.cjs} +57 -32
- package/dist/chunks/{index-SGV4U12y-Dh5jaROA.cjs → index-CQeXM6oB-BAx-uLYb.cjs} +1 -1
- package/dist/chunks/{index-SGV4U12y-BPGxOtvI.es.js → index-CQeXM6oB-DjCz53Th.es.js} +1 -1
- package/dist/chunks/{super-editor.es-BbbbKgEs.cjs → super-editor.es-CgTVSX1p.cjs} +433 -124
- package/dist/chunks/{super-editor.es-CdGsYGU1.es.js → super-editor.es-TkKngzld.es.js} +433 -124
- package/dist/style.css +33 -33
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CpuOoAUa.js → converter-Hv-kNdxI.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-Dk99r397.js → docx-zipper-C6nUdlsw.js} +1 -1
- package/dist/super-editor/chunks/{editor-CFv-RJI-.js → editor-uvvccWc5.js} +487 -117
- package/dist/super-editor/chunks/{index-SGV4U12y.js → index-CQeXM6oB.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CQr3Xnx9.js → toolbar-BCWRHtW5.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 +10 -9
- 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 +489 -155
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,11 +9,11 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, hideDimmingOverlay_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup,
|
|
12
|
+
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, hideDimmingOverlay_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, convertPageLocalToOverlayCoords_fn, normalizeClientPoint_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName, $ as TrackInsertMarkName, a0 as v4, a1 as TrackFormatMarkName, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as encodeCSSFromPPr, at as twipsToPixels$2, au as resolveRunProperties, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-
|
|
16
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as resolveParagraphProperties, ak as _getReferencedTableStyles, al as parseSizeUnit, am as minMax, an as updateDOMAttributes, ao as findChildren$5, ap as generateRandomSigned32BitIntStrId, aq as decodeRPrFromMarks, ar as calculateResolvedParagraphProperties, as as encodeCSSFromPPr, at as twipsToPixels$2, au as resolveRunProperties, av as encodeCSSFromRPr, aw as generateOrderedListIndex, ax as docxNumberingHelpers, ay as InputRule, az as convertSizeToCSS, aA as SelectionRange, aB as Transform, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-Hv-kNdxI.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-C6nUdlsw.js";
|
|
17
17
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
@@ -10875,13 +10875,13 @@ const findTrackedMarkBetween = ({
|
|
|
10875
10875
|
return markFound;
|
|
10876
10876
|
};
|
|
10877
10877
|
const markInsertion = ({ tr, from: from2, to, user, date }) => {
|
|
10878
|
-
tr.removeMark(from2, to, tr.doc.type.schema.marks[TrackDeleteMarkName]);
|
|
10879
|
-
tr.removeMark(from2, to, tr.doc.type.schema.marks[TrackInsertMarkName]);
|
|
10878
|
+
tr.removeMark(from2, to, tr.doc.type.schema.marks[TrackDeleteMarkName$1]);
|
|
10879
|
+
tr.removeMark(from2, to, tr.doc.type.schema.marks[TrackInsertMarkName$1]);
|
|
10880
10880
|
let trackedMark = findTrackedMarkBetween({
|
|
10881
10881
|
tr,
|
|
10882
10882
|
from: from2,
|
|
10883
10883
|
to,
|
|
10884
|
-
markName: TrackInsertMarkName,
|
|
10884
|
+
markName: TrackInsertMarkName$1,
|
|
10885
10885
|
attrs: { authorEmail: user.email }
|
|
10886
10886
|
});
|
|
10887
10887
|
let id;
|
|
@@ -10890,7 +10890,7 @@ const markInsertion = ({ tr, from: from2, to, user, date }) => {
|
|
|
10890
10890
|
} else {
|
|
10891
10891
|
id = v4();
|
|
10892
10892
|
}
|
|
10893
|
-
const insertionMark = tr.doc.type.schema.marks[TrackInsertMarkName].create({
|
|
10893
|
+
const insertionMark = tr.doc.type.schema.marks[TrackInsertMarkName$1].create({
|
|
10894
10894
|
id,
|
|
10895
10895
|
author: user.name,
|
|
10896
10896
|
authorEmail: user.email,
|
|
@@ -10916,7 +10916,7 @@ const markDeletion = ({ tr, from: from2, to, user, date, id: providedId }) => {
|
|
|
10916
10916
|
tr,
|
|
10917
10917
|
from: from2,
|
|
10918
10918
|
to,
|
|
10919
|
-
markName: TrackDeleteMarkName,
|
|
10919
|
+
markName: TrackDeleteMarkName$1,
|
|
10920
10920
|
attrs: { authorEmail: user.email }
|
|
10921
10921
|
});
|
|
10922
10922
|
let id;
|
|
@@ -10927,7 +10927,7 @@ const markDeletion = ({ tr, from: from2, to, user, date, id: providedId }) => {
|
|
|
10927
10927
|
} else {
|
|
10928
10928
|
id = v4();
|
|
10929
10929
|
}
|
|
10930
|
-
const deletionMark = tr.doc.type.schema.marks[TrackDeleteMarkName].create({
|
|
10930
|
+
const deletionMark = tr.doc.type.schema.marks[TrackDeleteMarkName$1].create({
|
|
10931
10931
|
id,
|
|
10932
10932
|
author: user.name,
|
|
10933
10933
|
authorEmail: user.email,
|
|
@@ -10940,7 +10940,7 @@ const markDeletion = ({ tr, from: from2, to, user, date, id: providedId }) => {
|
|
|
10940
10940
|
if (node.type.name.includes("table")) {
|
|
10941
10941
|
return;
|
|
10942
10942
|
}
|
|
10943
|
-
if (node.isInline && node.marks.find((mark) => mark.type.name === TrackInsertMarkName && mark.attrs.authorEmail === user.email)) {
|
|
10943
|
+
if (node.isInline && node.marks.find((mark) => mark.type.name === TrackInsertMarkName$1 && mark.attrs.authorEmail === user.email)) {
|
|
10944
10944
|
const removeStep = new ReplaceStep(
|
|
10945
10945
|
deletionMap.map(Math.max(from2, pos)),
|
|
10946
10946
|
deletionMap.map(Math.min(to, pos + node.nodeSize)),
|
|
@@ -10949,14 +10949,14 @@ const markDeletion = ({ tr, from: from2, to, user, date, id: providedId }) => {
|
|
|
10949
10949
|
if (!tr.maybeStep(removeStep).failed) {
|
|
10950
10950
|
deletionMap.appendMap(removeStep.getMap());
|
|
10951
10951
|
}
|
|
10952
|
-
} else if (node.isInline && !node.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
|
|
10952
|
+
} else if (node.isInline && !node.marks.find((mark) => mark.type.name === TrackDeleteMarkName$1)) {
|
|
10953
10953
|
nodes.push(node);
|
|
10954
10954
|
tr.addMark(
|
|
10955
10955
|
deletionMap.map(Math.max(from2, pos)),
|
|
10956
10956
|
deletionMap.map(Math.min(to, pos + node.nodeSize)),
|
|
10957
10957
|
deletionMark
|
|
10958
10958
|
);
|
|
10959
|
-
} else if (node.attrs.track && !node.attrs.track.find((trackAttr) => trackAttr.type === TrackDeleteMarkName) && !["bulletList", "orderedList"].includes(node.type.name)) ;
|
|
10959
|
+
} else if (node.attrs.track && !node.attrs.track.find((trackAttr) => trackAttr.type === TrackDeleteMarkName$1) && !["bulletList", "orderedList"].includes(node.type.name)) ;
|
|
10960
10960
|
});
|
|
10961
10961
|
return { deletionMark, deletionMap, nodes };
|
|
10962
10962
|
};
|
|
@@ -11023,7 +11023,7 @@ const getTrackChanges = (state, id = null) => {
|
|
|
11023
11023
|
}
|
|
11024
11024
|
allInlineNodes.forEach(({ node, pos }) => {
|
|
11025
11025
|
const { marks } = node;
|
|
11026
|
-
const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName];
|
|
11026
|
+
const trackedMarks = [TrackInsertMarkName$1, TrackDeleteMarkName$1, TrackFormatMarkName$1];
|
|
11027
11027
|
if (marks.length > 0) {
|
|
11028
11028
|
marks.forEach((mark) => {
|
|
11029
11029
|
if (trackedMarks.includes(mark.type.name)) {
|
|
@@ -11136,7 +11136,7 @@ const getTrackChangesDecorations = (state, onlyOriginalShown, onlyModifiedShown)
|
|
|
11136
11136
|
return DecorationSet.empty;
|
|
11137
11137
|
}
|
|
11138
11138
|
trackedChanges.forEach(({ mark, from: from2, to }) => {
|
|
11139
|
-
if (mark.type.name === TrackInsertMarkName) {
|
|
11139
|
+
if (mark.type.name === TrackInsertMarkName$1) {
|
|
11140
11140
|
if (onlyOriginalShown) {
|
|
11141
11141
|
const decoration = Decoration.inline(from2, to, {
|
|
11142
11142
|
class: "track-insert-dec hidden"
|
|
@@ -11154,7 +11154,7 @@ const getTrackChangesDecorations = (state, onlyOriginalShown, onlyModifiedShown)
|
|
|
11154
11154
|
decorations.push(decoration);
|
|
11155
11155
|
}
|
|
11156
11156
|
}
|
|
11157
|
-
if (mark.type.name === TrackDeleteMarkName) {
|
|
11157
|
+
if (mark.type.name === TrackDeleteMarkName$1) {
|
|
11158
11158
|
if (onlyOriginalShown) {
|
|
11159
11159
|
const decoration = Decoration.inline(from2, to, {
|
|
11160
11160
|
class: "track-delete-dec normal"
|
|
@@ -11186,7 +11186,7 @@ const getTrackChangesDecorations = (state, onlyOriginalShown, onlyModifiedShown)
|
|
|
11186
11186
|
decorations.push(decorationWidget);
|
|
11187
11187
|
}
|
|
11188
11188
|
}
|
|
11189
|
-
if (mark.type.name === TrackFormatMarkName) {
|
|
11189
|
+
if (mark.type.name === TrackFormatMarkName$1) {
|
|
11190
11190
|
if (onlyOriginalShown) {
|
|
11191
11191
|
const decoration = Decoration.inline(from2, to, {
|
|
11192
11192
|
class: "track-format-dec before"
|
|
@@ -11207,7 +11207,7 @@ const getTrackChangesDecorations = (state, onlyOriginalShown, onlyModifiedShown)
|
|
|
11207
11207
|
});
|
|
11208
11208
|
return DecorationSet.create(state.doc, decorations);
|
|
11209
11209
|
};
|
|
11210
|
-
const CommentMarkName = "commentMark";
|
|
11210
|
+
const CommentMarkName$1 = "commentMark";
|
|
11211
11211
|
const resolveCommentMeta = ({ converter, importedId }) => {
|
|
11212
11212
|
const comments = converter?.comments || [];
|
|
11213
11213
|
const matchingImportedComment = comments.find((c) => c.importedId == importedId);
|
|
@@ -11238,7 +11238,7 @@ const ensureFallbackComment = ({ converter, matchingImportedComment, commentId,
|
|
|
11238
11238
|
const removeCommentsById = ({ commentId, state, tr, dispatch }) => {
|
|
11239
11239
|
const positions = getCommentPositionsById(commentId, state.doc);
|
|
11240
11240
|
positions.forEach(({ from: from2, to }) => {
|
|
11241
|
-
tr.removeMark(from2, to, state.schema.marks[CommentMarkName]);
|
|
11241
|
+
tr.removeMark(from2, to, state.schema.marks[CommentMarkName$1]);
|
|
11242
11242
|
});
|
|
11243
11243
|
dispatch(tr);
|
|
11244
11244
|
};
|
|
@@ -11246,7 +11246,7 @@ const getCommentPositionsById = (commentId, doc2) => {
|
|
|
11246
11246
|
const positions = [];
|
|
11247
11247
|
doc2.descendants((node, pos) => {
|
|
11248
11248
|
const { marks } = node;
|
|
11249
|
-
const commentMark = marks.find((mark) => mark.type.name === CommentMarkName);
|
|
11249
|
+
const commentMark = marks.find((mark) => mark.type.name === CommentMarkName$1);
|
|
11250
11250
|
if (commentMark) {
|
|
11251
11251
|
const { attrs } = commentMark;
|
|
11252
11252
|
const { commentId: currentCommentId } = attrs;
|
|
@@ -11266,7 +11266,7 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
|
|
|
11266
11266
|
const endNodes = [];
|
|
11267
11267
|
const seen = /* @__PURE__ */ new Set();
|
|
11268
11268
|
doc2.descendants((node, pos) => {
|
|
11269
|
-
const commentMarks = node.marks?.filter((mark) => mark.type.name === CommentMarkName) || [];
|
|
11269
|
+
const commentMarks = node.marks?.filter((mark) => mark.type.name === CommentMarkName$1) || [];
|
|
11270
11270
|
commentMarks.forEach((commentMark) => {
|
|
11271
11271
|
const { attrs = {} } = commentMark;
|
|
11272
11272
|
const { commentId } = attrs;
|
|
@@ -11394,7 +11394,7 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
|
|
|
11394
11394
|
importedId,
|
|
11395
11395
|
internal: itemToMark.internal
|
|
11396
11396
|
};
|
|
11397
|
-
tr.addMark(start2, pos + 1, schema.marks[CommentMarkName].create(markAttrs));
|
|
11397
|
+
tr.addMark(start2, pos + 1, schema.marks[CommentMarkName$1].create(markAttrs));
|
|
11398
11398
|
toDelete.push({ start: pos, end: pos + 1 });
|
|
11399
11399
|
} else if (type.name === "commentReference") {
|
|
11400
11400
|
toDelete.push({ start: pos, end: pos + 1 });
|
|
@@ -11512,7 +11512,7 @@ const updatePosition = ({ allCommentPositions, threadId, pos, currentBounds, nod
|
|
|
11512
11512
|
existing.bounds.bottom = Math.max(existing.bounds.bottom, currentBounds.bottom);
|
|
11513
11513
|
}
|
|
11514
11514
|
};
|
|
11515
|
-
const TRACK_CHANGE_MARKS = [TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName];
|
|
11515
|
+
const TRACK_CHANGE_MARKS = [TrackInsertMarkName$1, TrackDeleteMarkName$1, TrackFormatMarkName$1];
|
|
11516
11516
|
const CommentsPluginKey = new PluginKey("comments");
|
|
11517
11517
|
const CommentsPlugin = Extension.create({
|
|
11518
11518
|
name: "comments",
|
|
@@ -11528,7 +11528,7 @@ const CommentsPlugin = Extension.create({
|
|
|
11528
11528
|
tr.addMark(
|
|
11529
11529
|
$from.pos,
|
|
11530
11530
|
$to.pos,
|
|
11531
|
-
this.editor.schema.marks[CommentMarkName].create({
|
|
11531
|
+
this.editor.schema.marks[CommentMarkName$1].create({
|
|
11532
11532
|
commentId: resolvedCommentId,
|
|
11533
11533
|
internal: resolvedInternal
|
|
11534
11534
|
})
|
|
@@ -11568,7 +11568,7 @@ const CommentsPlugin = Extension.create({
|
|
|
11568
11568
|
doc2.descendants((node, pos) => {
|
|
11569
11569
|
if (foundStartNode) return;
|
|
11570
11570
|
const { marks = [] } = node;
|
|
11571
|
-
const commentMark = marks.find((mark) => mark.type.name === CommentMarkName);
|
|
11571
|
+
const commentMark = marks.find((mark) => mark.type.name === CommentMarkName$1);
|
|
11572
11572
|
if (commentMark) {
|
|
11573
11573
|
const { attrs } = commentMark;
|
|
11574
11574
|
const wid = attrs.commentId;
|
|
@@ -11582,7 +11582,7 @@ const CommentsPlugin = Extension.create({
|
|
|
11582
11582
|
tr.addMark(
|
|
11583
11583
|
foundPos,
|
|
11584
11584
|
foundPos + foundStartNode.nodeSize,
|
|
11585
|
-
this.editor.schema.marks[CommentMarkName].create({
|
|
11585
|
+
this.editor.schema.marks[CommentMarkName$1].create({
|
|
11586
11586
|
commentId,
|
|
11587
11587
|
internal: isInternal
|
|
11588
11588
|
})
|
|
@@ -11711,10 +11711,10 @@ const CommentsPlugin = Extension.create({
|
|
|
11711
11711
|
prevDoc = doc2;
|
|
11712
11712
|
shouldUpdate = false;
|
|
11713
11713
|
const decorations = [];
|
|
11714
|
-
const allCommentPositions =
|
|
11714
|
+
const allCommentPositions = {};
|
|
11715
11715
|
doc2.descendants((node, pos) => {
|
|
11716
11716
|
const { marks = [] } = node;
|
|
11717
|
-
const commentMarks = marks.filter((mark) => mark.type.name === CommentMarkName);
|
|
11717
|
+
const commentMarks = marks.filter((mark) => mark.type.name === CommentMarkName$1);
|
|
11718
11718
|
let hasActive = false;
|
|
11719
11719
|
commentMarks.forEach((commentMark) => {
|
|
11720
11720
|
const { attrs } = commentMark;
|
|
@@ -11840,7 +11840,7 @@ const getActiveCommentId = (doc2, selection) => {
|
|
|
11840
11840
|
return;
|
|
11841
11841
|
}
|
|
11842
11842
|
const { marks = [] } = node;
|
|
11843
|
-
const commentMark = marks.find((mark) => mark.type.name === CommentMarkName);
|
|
11843
|
+
const commentMark = marks.find((mark) => mark.type.name === CommentMarkName$1);
|
|
11844
11844
|
if (commentMark) {
|
|
11845
11845
|
overlaps.push({
|
|
11846
11846
|
node,
|
|
@@ -11863,7 +11863,7 @@ const getActiveCommentId = (doc2, selection) => {
|
|
|
11863
11863
|
}
|
|
11864
11864
|
});
|
|
11865
11865
|
const { marks: closestMarks = [] } = closestCommentRangeStart || {};
|
|
11866
|
-
const closestCommentMark = closestMarks.find((mark) => mark.type.name === CommentMarkName);
|
|
11866
|
+
const closestCommentMark = closestMarks.find((mark) => mark.type.name === CommentMarkName$1);
|
|
11867
11867
|
return closestCommentMark?.attrs?.commentId || closestCommentMark?.attrs?.importedId;
|
|
11868
11868
|
};
|
|
11869
11869
|
const findTrackedMark = ({
|
|
@@ -11913,7 +11913,7 @@ const handleTrackedChangeTransaction = (trackedChangeMeta, trackedChanges, newEd
|
|
|
11913
11913
|
let nodes = step?.slice?.content?.content || [];
|
|
11914
11914
|
if (!nodes.length) {
|
|
11915
11915
|
newEditorState.doc.descendants((node) => {
|
|
11916
|
-
const hasFormatMark = node.marks.find((mark) => mark.type.name === TrackFormatMarkName);
|
|
11916
|
+
const hasFormatMark = node.marks.find((mark) => mark.type.name === TrackFormatMarkName$1);
|
|
11917
11917
|
if (hasFormatMark) {
|
|
11918
11918
|
nodes = [node];
|
|
11919
11919
|
return false;
|
|
@@ -11938,19 +11938,19 @@ const handleTrackedChangeTransaction = (trackedChangeMeta, trackedChanges, newEd
|
|
|
11938
11938
|
const getTrackedChangeText = ({ nodes, mark, trackedChangeType, isDeletionInsertion }) => {
|
|
11939
11939
|
let trackedChangeText = "";
|
|
11940
11940
|
let deletionText = "";
|
|
11941
|
-
if (trackedChangeType === TrackInsertMarkName) {
|
|
11941
|
+
if (trackedChangeType === TrackInsertMarkName$1) {
|
|
11942
11942
|
trackedChangeText = nodes.reduce((acc, node) => {
|
|
11943
11943
|
if (!node.marks.find((nodeMark) => nodeMark.type.name === mark.type.name)) return acc;
|
|
11944
11944
|
acc += node?.text || node?.textContent || "";
|
|
11945
11945
|
return acc;
|
|
11946
11946
|
}, "");
|
|
11947
11947
|
}
|
|
11948
|
-
if (trackedChangeType === TrackFormatMarkName) {
|
|
11948
|
+
if (trackedChangeType === TrackFormatMarkName$1) {
|
|
11949
11949
|
trackedChangeText = translateFormatChangesToEnglish(mark.attrs);
|
|
11950
11950
|
}
|
|
11951
|
-
if (trackedChangeType === TrackDeleteMarkName || isDeletionInsertion) {
|
|
11951
|
+
if (trackedChangeType === TrackDeleteMarkName$1 || isDeletionInsertion) {
|
|
11952
11952
|
deletionText = nodes.reduce((acc, node) => {
|
|
11953
|
-
if (!node.marks.find((nodeMark) => nodeMark.type.name === TrackDeleteMarkName)) return acc;
|
|
11953
|
+
if (!node.marks.find((nodeMark) => nodeMark.type.name === TrackDeleteMarkName$1)) return acc;
|
|
11954
11954
|
acc += node?.text || node?.textContent || "";
|
|
11955
11955
|
return acc;
|
|
11956
11956
|
}, "");
|
|
@@ -12016,7 +12016,7 @@ function findRangeById(doc2, id) {
|
|
|
12016
12016
|
if (to === null || pos + node.nodeSize > to) to = pos + node.nodeSize;
|
|
12017
12017
|
}
|
|
12018
12018
|
const commentMark = node.marks.find(
|
|
12019
|
-
(m) => m.type.name === CommentMarkName && (m.attrs.commentId === id || m.attrs.importedId === id)
|
|
12019
|
+
(m) => m.type.name === CommentMarkName$1 && (m.attrs.commentId === id || m.attrs.importedId === id)
|
|
12020
12020
|
);
|
|
12021
12021
|
if (commentMark) {
|
|
12022
12022
|
if (from2 === null || pos < from2) from2 = pos;
|
|
@@ -12026,7 +12026,7 @@ function findRangeById(doc2, id) {
|
|
|
12026
12026
|
return from2 !== null && to !== null ? { from: from2, to } : null;
|
|
12027
12027
|
}
|
|
12028
12028
|
const replaceStep = ({ state, tr, step, newTr, map: map2, user, date, originalStep, originalStepIndex }) => {
|
|
12029
|
-
const deletionMarkSchema = state.schema.marks[TrackDeleteMarkName];
|
|
12029
|
+
const deletionMarkSchema = state.schema.marks[TrackDeleteMarkName$1];
|
|
12030
12030
|
const deletionMark = findMark(state, deletionMarkSchema, false);
|
|
12031
12031
|
const positionTo = deletionMark ? deletionMark.to : step.to;
|
|
12032
12032
|
const newStep = new ReplaceStep(
|
|
@@ -12090,17 +12090,17 @@ const addMarkStep = ({ state, step, newTr, doc: doc2, user, date }) => {
|
|
|
12090
12090
|
if (!node.isInline) {
|
|
12091
12091
|
return;
|
|
12092
12092
|
}
|
|
12093
|
-
if (node.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
|
|
12093
|
+
if (node.marks.find((mark) => mark.type.name === TrackDeleteMarkName$1)) {
|
|
12094
12094
|
return false;
|
|
12095
12095
|
}
|
|
12096
12096
|
const existingChangeMark = node.marks.find(
|
|
12097
|
-
(mark) => [TrackDeleteMarkName, TrackFormatMarkName].includes(mark.type.name)
|
|
12097
|
+
(mark) => [TrackDeleteMarkName$1, TrackFormatMarkName$1].includes(mark.type.name)
|
|
12098
12098
|
);
|
|
12099
12099
|
const wid = existingChangeMark ? existingChangeMark.attrs.id : v4();
|
|
12100
12100
|
newTr.addMark(Math.max(step.from, pos), Math.min(step.to, pos + node.nodeSize), step.mark);
|
|
12101
12101
|
const allowedMarks = ["bold", "italic", "strike", "underline", "textStyle"];
|
|
12102
12102
|
if (allowedMarks.includes(step.mark.type.name) && !node.marks.find((mark) => mark.type === step.mark.type)) {
|
|
12103
|
-
const formatChangeMark = node.marks.find((mark) => mark.type.name === TrackFormatMarkName);
|
|
12103
|
+
const formatChangeMark = node.marks.find((mark) => mark.type.name === TrackFormatMarkName$1);
|
|
12104
12104
|
let after = [];
|
|
12105
12105
|
let before = [];
|
|
12106
12106
|
if (formatChangeMark) {
|
|
@@ -12136,7 +12136,7 @@ const addMarkStep = ({ state, step, newTr, doc: doc2, user, date }) => {
|
|
|
12136
12136
|
];
|
|
12137
12137
|
}
|
|
12138
12138
|
if (after.length || before.length) {
|
|
12139
|
-
const newFormatMark = state.schema.marks[TrackFormatMarkName].create({
|
|
12139
|
+
const newFormatMark = state.schema.marks[TrackFormatMarkName$1].create({
|
|
12140
12140
|
id: wid,
|
|
12141
12141
|
author: user.name,
|
|
12142
12142
|
authorEmail: user.email,
|
|
@@ -12168,13 +12168,13 @@ const removeMarkStep = ({ state, step, newTr, doc: doc2, user, date }) => {
|
|
|
12168
12168
|
if (!node.isInline) {
|
|
12169
12169
|
return true;
|
|
12170
12170
|
}
|
|
12171
|
-
if (node.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
|
|
12171
|
+
if (node.marks.find((mark) => mark.type.name === TrackDeleteMarkName$1)) {
|
|
12172
12172
|
return false;
|
|
12173
12173
|
}
|
|
12174
12174
|
newTr.removeMark(Math.max(step.from, pos), Math.min(step.to, pos + node.nodeSize), step.mark);
|
|
12175
12175
|
const allowedMarks = ["bold", "italic", "strike", "underline", "textStyle"];
|
|
12176
12176
|
if (allowedMarks.includes(step.mark.type.name) && node.marks.find((mark) => mark.type === step.mark.type)) {
|
|
12177
|
-
const formatChangeMark = node.marks.find((mark) => mark.type.name === TrackFormatMarkName);
|
|
12177
|
+
const formatChangeMark = node.marks.find((mark) => mark.type.name === TrackFormatMarkName$1);
|
|
12178
12178
|
let after = [];
|
|
12179
12179
|
let before = [];
|
|
12180
12180
|
if (formatChangeMark) {
|
|
@@ -12202,7 +12202,7 @@ const removeMarkStep = ({ state, step, newTr, doc: doc2, user, date }) => {
|
|
|
12202
12202
|
];
|
|
12203
12203
|
}
|
|
12204
12204
|
if (after.length || before.length) {
|
|
12205
|
-
const newFormatMark = state.schema.marks[TrackFormatMarkName].create({
|
|
12205
|
+
const newFormatMark = state.schema.marks[TrackFormatMarkName$1].create({
|
|
12206
12206
|
id: v4(),
|
|
12207
12207
|
author: user.name,
|
|
12208
12208
|
authorEmail: user.email,
|
|
@@ -12283,7 +12283,7 @@ const trackedTransaction = ({ tr, state, user }) => {
|
|
|
12283
12283
|
newTr.setMeta("addToHistory", tr.getMeta("addToHistory"));
|
|
12284
12284
|
}
|
|
12285
12285
|
if (tr.selectionSet) {
|
|
12286
|
-
const deletionMarkSchema = state.schema.marks[TrackDeleteMarkName];
|
|
12286
|
+
const deletionMarkSchema = state.schema.marks[TrackDeleteMarkName$1];
|
|
12287
12287
|
const deletionMark = findMark(state, deletionMarkSchema, false);
|
|
12288
12288
|
if (tr.selection instanceof TextSelection && (tr.selection.from < state.selection.from || tr.getMeta("inputType") === "deleteContentBackward")) {
|
|
12289
12289
|
const caretPos = map2.map(tr.selection.from, -1);
|
|
@@ -13913,7 +13913,7 @@ const isHeadless = (editor) => {
|
|
|
13913
13913
|
const shouldSkipNodeView = (editor) => {
|
|
13914
13914
|
return isHeadless(editor);
|
|
13915
13915
|
};
|
|
13916
|
-
const summaryVersion = "1.0.0-beta.
|
|
13916
|
+
const summaryVersion = "1.0.0-beta.34";
|
|
13917
13917
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13918
13918
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13919
13919
|
function mapAttributes(attrs) {
|
|
@@ -14705,7 +14705,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14705
14705
|
{ default: remarkStringify },
|
|
14706
14706
|
{ default: remarkGfm }
|
|
14707
14707
|
] = await Promise.all([
|
|
14708
|
-
import("./index-
|
|
14708
|
+
import("./index-CQeXM6oB.js"),
|
|
14709
14709
|
import("./index-DRCvimau.js"),
|
|
14710
14710
|
import("./index-C_x_N6Uh.js"),
|
|
14711
14711
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14910,7 +14910,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14910
14910
|
* Process collaboration migrations
|
|
14911
14911
|
*/
|
|
14912
14912
|
processCollaborationMigrations() {
|
|
14913
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
14913
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.34");
|
|
14914
14914
|
if (!this.options.ydoc) return;
|
|
14915
14915
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14916
14916
|
let docVersion = metaMap.get("version");
|
|
@@ -27795,7 +27795,7 @@ function hitTestFragment(layout, pageHit, blocks, measures, point) {
|
|
|
27795
27795
|
});
|
|
27796
27796
|
for (const fragment of fragments) {
|
|
27797
27797
|
if (fragment.kind !== "para") continue;
|
|
27798
|
-
const blockIndex = blocks
|
|
27798
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId);
|
|
27799
27799
|
if (blockIndex === -1) continue;
|
|
27800
27800
|
const block = blocks[blockIndex];
|
|
27801
27801
|
const measure = measures[blockIndex];
|
|
@@ -27822,7 +27822,7 @@ const hitTestAtomicFragment = (pageHit, blocks, measures, point) => {
|
|
|
27822
27822
|
const withinX = point.x >= fragment.x && point.x <= fragment.x + fragment.width;
|
|
27823
27823
|
const withinY = point.y >= fragment.y && point.y <= fragment.y + fragment.height;
|
|
27824
27824
|
if (!withinX || !withinY) continue;
|
|
27825
|
-
const blockIndex = blocks
|
|
27825
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId);
|
|
27826
27826
|
if (blockIndex === -1) continue;
|
|
27827
27827
|
const block = blocks[blockIndex];
|
|
27828
27828
|
const measure = measures[blockIndex];
|
|
@@ -27961,7 +27961,7 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
|
|
|
27961
27961
|
blockId = fragment.blockId;
|
|
27962
27962
|
pageIndex = pi;
|
|
27963
27963
|
column = determineColumn(layout, fragment.x);
|
|
27964
|
-
const blockIndex = blocks
|
|
27964
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId);
|
|
27965
27965
|
if (blockIndex !== -1) {
|
|
27966
27966
|
const measure = measures[blockIndex];
|
|
27967
27967
|
if (measure && measure.kind === "paragraph") {
|
|
@@ -28111,6 +28111,44 @@ function clickToPosition(layout, blocks, measures, containerPoint, domContainer,
|
|
|
28111
28111
|
});
|
|
28112
28112
|
return null;
|
|
28113
28113
|
}
|
|
28114
|
+
function findBlockIndexByFragmentId(blocks, fragmentBlockId, targetPmRange) {
|
|
28115
|
+
const index2 = blocks.findIndex(
|
|
28116
|
+
(block) => block.id === fragmentBlockId && block.kind !== "pageBreak" && block.kind !== "sectionBreak"
|
|
28117
|
+
);
|
|
28118
|
+
if (index2 !== -1) {
|
|
28119
|
+
return index2;
|
|
28120
|
+
}
|
|
28121
|
+
const baseBlockId = fragmentBlockId.replace(/-\d+$/, "");
|
|
28122
|
+
if (baseBlockId === fragmentBlockId) {
|
|
28123
|
+
return -1;
|
|
28124
|
+
}
|
|
28125
|
+
const matchingIndices = [];
|
|
28126
|
+
blocks.forEach((block, idx) => {
|
|
28127
|
+
if (block.id === baseBlockId && block.kind === "paragraph") {
|
|
28128
|
+
matchingIndices.push(idx);
|
|
28129
|
+
}
|
|
28130
|
+
});
|
|
28131
|
+
if (matchingIndices.length === 0) {
|
|
28132
|
+
return -1;
|
|
28133
|
+
}
|
|
28134
|
+
if (matchingIndices.length === 1) {
|
|
28135
|
+
return matchingIndices[0];
|
|
28136
|
+
}
|
|
28137
|
+
if (targetPmRange) {
|
|
28138
|
+
for (const idx of matchingIndices) {
|
|
28139
|
+
const block = blocks[idx];
|
|
28140
|
+
if (block.kind !== "paragraph") continue;
|
|
28141
|
+
const hasOverlap = block.runs.some((run) => {
|
|
28142
|
+
if (run.pmStart == null || run.pmEnd == null) return false;
|
|
28143
|
+
return run.pmEnd > targetPmRange.from && run.pmStart < targetPmRange.to;
|
|
28144
|
+
});
|
|
28145
|
+
if (hasOverlap) {
|
|
28146
|
+
return idx;
|
|
28147
|
+
}
|
|
28148
|
+
}
|
|
28149
|
+
}
|
|
28150
|
+
return matchingIndices[0];
|
|
28151
|
+
}
|
|
28114
28152
|
function selectionToRects(layout, blocks, measures, from2, to) {
|
|
28115
28153
|
if (from2 === to) {
|
|
28116
28154
|
return [];
|
|
@@ -28119,8 +28157,10 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
28119
28157
|
layout.pages.forEach((page, pageIndex) => {
|
|
28120
28158
|
page.fragments.forEach((fragment) => {
|
|
28121
28159
|
if (fragment.kind === "para") {
|
|
28122
|
-
const blockIndex = blocks.
|
|
28123
|
-
if (blockIndex === -1)
|
|
28160
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
28161
|
+
if (blockIndex === -1) {
|
|
28162
|
+
return;
|
|
28163
|
+
}
|
|
28124
28164
|
const block = blocks[blockIndex];
|
|
28125
28165
|
const measure = measures[blockIndex];
|
|
28126
28166
|
if (!block || block.kind !== "paragraph" || measure?.kind !== "paragraph") {
|
|
@@ -28156,7 +28196,7 @@ function selectionToRects(layout, blocks, measures, from2, to) {
|
|
|
28156
28196
|
return;
|
|
28157
28197
|
}
|
|
28158
28198
|
if (isAtomicFragment(fragment)) {
|
|
28159
|
-
const blockIndex = blocks.
|
|
28199
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId, { from: from2, to });
|
|
28160
28200
|
if (blockIndex === -1) return;
|
|
28161
28201
|
const block = blocks[blockIndex];
|
|
28162
28202
|
const pmRange = getAtomicPmRange(fragment, block);
|
|
@@ -28177,7 +28217,7 @@ function getFragmentAtPosition(layout, blocks, measures, pos) {
|
|
|
28177
28217
|
for (let pageIndex = 0; pageIndex < layout.pages.length; pageIndex += 1) {
|
|
28178
28218
|
const page = layout.pages[pageIndex];
|
|
28179
28219
|
for (const fragment of page.fragments) {
|
|
28180
|
-
const blockIndex = blocks
|
|
28220
|
+
const blockIndex = findBlockIndexByFragmentId(blocks, fragment.blockId);
|
|
28181
28221
|
if (blockIndex === -1) {
|
|
28182
28222
|
continue;
|
|
28183
28223
|
}
|
|
@@ -37764,6 +37804,10 @@ function isInRegisteredSurface(event) {
|
|
|
37764
37804
|
}
|
|
37765
37805
|
return false;
|
|
37766
37806
|
}
|
|
37807
|
+
const CommentMarkName = "commentMark";
|
|
37808
|
+
const TrackInsertMarkName = "trackInsert";
|
|
37809
|
+
const TrackDeleteMarkName = "trackDelete";
|
|
37810
|
+
const TrackFormatMarkName = "trackFormat";
|
|
37767
37811
|
function isValidFieldAnnotationAttributes(attrs) {
|
|
37768
37812
|
if (!attrs || typeof attrs !== "object") return false;
|
|
37769
37813
|
const a = attrs;
|
|
@@ -37776,7 +37820,7 @@ const WORD_CHARACTER_REGEX = /[\p{L}\p{N}''_~-]/u;
|
|
|
37776
37820
|
const MULTI_CLICK_TIME_THRESHOLD_MS = 400;
|
|
37777
37821
|
const MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5;
|
|
37778
37822
|
const HEADER_FOOTER_INIT_BUDGET_MS = 200;
|
|
37779
|
-
const SCROLL_DEBOUNCE_MS =
|
|
37823
|
+
const SCROLL_DEBOUNCE_MS = 32;
|
|
37780
37824
|
const MAX_ZOOM_WARNING_THRESHOLD = 10;
|
|
37781
37825
|
const MAX_SELECTION_RECTS_PER_USER = 100;
|
|
37782
37826
|
const DEFAULT_STALE_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
@@ -37793,7 +37837,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
37793
37837
|
__privateAdd(this, _selectionOverlay2);
|
|
37794
37838
|
__privateAdd(this, _hiddenHost);
|
|
37795
37839
|
__privateAdd(this, _layoutOptions);
|
|
37796
|
-
__privateAdd(this, _layoutState, { blocks: [], measures: [], layout: null });
|
|
37840
|
+
__privateAdd(this, _layoutState, { blocks: [], measures: [], layout: null, bookmarks: /* @__PURE__ */ new Map() });
|
|
37797
37841
|
__privateAdd(this, _domPainter, null);
|
|
37798
37842
|
__privateAdd(this, _dragHandlerCleanup, null);
|
|
37799
37843
|
__privateAdd(this, _layoutError, null);
|
|
@@ -37847,6 +37891,8 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
37847
37891
|
// Remote cursor/presence state management
|
|
37848
37892
|
/** Map of clientId -> normalized remote cursor state */
|
|
37849
37893
|
__privateAdd(this, _remoteCursorState, /* @__PURE__ */ new Map());
|
|
37894
|
+
/** Map of clientId -> DOM element for cursor (enables DOM reuse to prevent flicker) */
|
|
37895
|
+
__privateAdd(this, _remoteCursorElements, /* @__PURE__ */ new Map());
|
|
37850
37896
|
/** Flag indicating remote cursor state needs re-rendering (RAF batching) */
|
|
37851
37897
|
__privateAdd(this, _remoteCursorDirty, false);
|
|
37852
37898
|
/** DOM element for rendering remote cursor overlays */
|
|
@@ -37857,15 +37903,28 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
37857
37903
|
__privateAdd(this, _awarenessCleanup, null);
|
|
37858
37904
|
/** Cleanup function for scroll listener (virtualization updates) */
|
|
37859
37905
|
__privateAdd(this, _scrollCleanup, null);
|
|
37860
|
-
/** RAF handle for remote cursor updates, cleared on destroy to prevent post-destruction callbacks */
|
|
37861
|
-
__privateAdd(this, _remoteCursorRafHandle, null);
|
|
37862
37906
|
/** Timeout handle for scroll debounce (instance-level tracking for proper cleanup) */
|
|
37863
37907
|
__privateAdd(this, _scrollTimeout);
|
|
37908
|
+
/** Timestamp of last remote cursor render for throttle-based immediate rendering */
|
|
37909
|
+
__privateAdd(this, _lastRemoteCursorRenderTime, 0);
|
|
37910
|
+
/** Timeout handle for trailing edge of cursor throttle */
|
|
37911
|
+
__privateAdd(this, _remoteCursorThrottleTimeout, null);
|
|
37864
37912
|
__privateAdd(this, _handlePointerDown, (event) => {
|
|
37865
37913
|
if (event.button !== 0) {
|
|
37866
37914
|
return;
|
|
37867
37915
|
}
|
|
37868
37916
|
const target = event.target;
|
|
37917
|
+
const linkEl = target?.closest?.("a.superdoc-link");
|
|
37918
|
+
if (linkEl) {
|
|
37919
|
+
const href = linkEl.getAttribute("href") ?? "";
|
|
37920
|
+
const isAnchorLink = href.startsWith("#") && href.length > 1;
|
|
37921
|
+
if (isAnchorLink) {
|
|
37922
|
+
event.preventDefault();
|
|
37923
|
+
event.stopPropagation();
|
|
37924
|
+
this.goToAnchor(href);
|
|
37925
|
+
return;
|
|
37926
|
+
}
|
|
37927
|
+
}
|
|
37869
37928
|
const isDraggableAnnotation = target?.closest?.('[data-draggable="true"]') != null;
|
|
37870
37929
|
if (!__privateGet(this, _layoutState).layout) {
|
|
37871
37930
|
if (!isDraggableAnnotation) {
|
|
@@ -39168,12 +39227,11 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
39168
39227
|
__privateSet(this, _rafHandle, null);
|
|
39169
39228
|
}, "Layout RAF");
|
|
39170
39229
|
}
|
|
39171
|
-
if (__privateGet(this,
|
|
39230
|
+
if (__privateGet(this, _remoteCursorThrottleTimeout) !== null) {
|
|
39172
39231
|
__privateMethod(this, _PresentationEditor_instances, safeCleanup_fn).call(this, () => {
|
|
39173
|
-
|
|
39174
|
-
|
|
39175
|
-
|
|
39176
|
-
}, "Remote cursor RAF");
|
|
39232
|
+
clearTimeout(__privateGet(this, _remoteCursorThrottleTimeout));
|
|
39233
|
+
__privateSet(this, _remoteCursorThrottleTimeout, null);
|
|
39234
|
+
}, "Remote cursor throttle");
|
|
39177
39235
|
}
|
|
39178
39236
|
__privateGet(this, _editorListeners).forEach(({ event, handler }) => __privateGet(this, _editor3)?.off(event, handler));
|
|
39179
39237
|
__privateSet(this, _editorListeners, []);
|
|
@@ -39197,6 +39255,7 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
39197
39255
|
__privateSet(this, _scrollCleanup, null);
|
|
39198
39256
|
}
|
|
39199
39257
|
__privateGet(this, _remoteCursorState).clear();
|
|
39258
|
+
__privateGet(this, _remoteCursorElements).clear();
|
|
39200
39259
|
__privateSet(this, _remoteCursorOverlay, null);
|
|
39201
39260
|
if (__privateGet(this, _options)?.documentId) {
|
|
39202
39261
|
__privateGet(_PresentationEditor, _instances).delete(__privateGet(this, _options).documentId);
|
|
@@ -39239,6 +39298,94 @@ const _PresentationEditor = class _PresentationEditor extends EventEmitter {
|
|
|
39239
39298
|
__privateGet(this, _editor3).destroy();
|
|
39240
39299
|
}
|
|
39241
39300
|
}
|
|
39301
|
+
/**
|
|
39302
|
+
* Navigate to a bookmark/anchor in the current document (e.g., TOC links).
|
|
39303
|
+
*
|
|
39304
|
+
* This method performs asynchronous navigation to support virtualized page rendering:
|
|
39305
|
+
* 1. Normalizes the anchor by removing leading '#' if present
|
|
39306
|
+
* 2. Looks up the bookmark in the document's bookmark registry
|
|
39307
|
+
* 3. Determines which page contains the target position
|
|
39308
|
+
* 4. Scrolls the page into view (may be virtualized)
|
|
39309
|
+
* 5. Waits up to 2000ms for the page to mount in the DOM
|
|
39310
|
+
* 6. Moves the editor caret to the bookmark position
|
|
39311
|
+
*
|
|
39312
|
+
* @param anchor - Bookmark name or fragment identifier (with or without leading '#')
|
|
39313
|
+
* @returns Promise resolving to true if navigation succeeded, false otherwise
|
|
39314
|
+
*
|
|
39315
|
+
* @remarks
|
|
39316
|
+
* Navigation fails and returns false if:
|
|
39317
|
+
* - The anchor parameter is empty or becomes empty after normalization
|
|
39318
|
+
* - No layout has been computed yet
|
|
39319
|
+
* - The bookmark does not exist in the document
|
|
39320
|
+
* - The bookmark's page cannot be determined
|
|
39321
|
+
* - The page fails to mount within the timeout period (2000ms)
|
|
39322
|
+
*
|
|
39323
|
+
* Note: This method does not throw errors. All failures are logged and result in
|
|
39324
|
+
* a false return value. An 'error' event is emitted for unhandled exceptions.
|
|
39325
|
+
*
|
|
39326
|
+
* @throws Never throws directly - errors are caught, logged, and emitted as events
|
|
39327
|
+
*/
|
|
39328
|
+
async goToAnchor(anchor) {
|
|
39329
|
+
try {
|
|
39330
|
+
if (!anchor) return false;
|
|
39331
|
+
const layout = __privateGet(this, _layoutState).layout;
|
|
39332
|
+
if (!layout) return false;
|
|
39333
|
+
const normalized = anchor.startsWith("#") ? anchor.slice(1) : anchor;
|
|
39334
|
+
if (!normalized) return false;
|
|
39335
|
+
const pmPos = __privateGet(this, _layoutState).bookmarks.get(normalized);
|
|
39336
|
+
if (pmPos == null) return false;
|
|
39337
|
+
const rects = selectionToRects(layout, __privateGet(this, _layoutState).blocks, __privateGet(this, _layoutState).measures, pmPos, pmPos + 1) ?? [];
|
|
39338
|
+
const rect = rects[0];
|
|
39339
|
+
let pageIndex = rect?.pageIndex ?? null;
|
|
39340
|
+
if (pageIndex == null) {
|
|
39341
|
+
let nextFragmentPage = null;
|
|
39342
|
+
let nextFragmentStart = null;
|
|
39343
|
+
for (const page of layout.pages) {
|
|
39344
|
+
for (const fragment of page.fragments) {
|
|
39345
|
+
if (fragment.kind !== "para") continue;
|
|
39346
|
+
const fragStart = fragment.pmStart;
|
|
39347
|
+
const fragEnd = fragment.pmEnd;
|
|
39348
|
+
if (fragStart == null || fragEnd == null) continue;
|
|
39349
|
+
if (pmPos >= fragStart && pmPos < fragEnd) {
|
|
39350
|
+
pageIndex = page.number - 1;
|
|
39351
|
+
break;
|
|
39352
|
+
}
|
|
39353
|
+
if (fragStart > pmPos && (nextFragmentStart === null || fragStart < nextFragmentStart)) {
|
|
39354
|
+
nextFragmentPage = page.number - 1;
|
|
39355
|
+
nextFragmentStart = fragStart;
|
|
39356
|
+
}
|
|
39357
|
+
}
|
|
39358
|
+
if (pageIndex != null) break;
|
|
39359
|
+
}
|
|
39360
|
+
if (pageIndex == null && nextFragmentPage != null) {
|
|
39361
|
+
pageIndex = nextFragmentPage;
|
|
39362
|
+
}
|
|
39363
|
+
}
|
|
39364
|
+
if (pageIndex == null) return false;
|
|
39365
|
+
__privateMethod(this, _PresentationEditor_instances, scrollPageIntoView_fn).call(this, pageIndex);
|
|
39366
|
+
await __privateMethod(this, _PresentationEditor_instances, waitForPageMount_fn).call(this, pageIndex, { timeout: _PresentationEditor.ANCHOR_NAV_TIMEOUT_MS });
|
|
39367
|
+
const pageEl = __privateGet(this, _painterHost)?.querySelector(`[data-page-index="${pageIndex}"]`);
|
|
39368
|
+
if (pageEl) {
|
|
39369
|
+
pageEl.scrollIntoView({ behavior: "instant", block: "start" });
|
|
39370
|
+
}
|
|
39371
|
+
const activeEditor = this.getActiveEditor();
|
|
39372
|
+
if (activeEditor?.commands?.setTextSelection) {
|
|
39373
|
+
activeEditor.commands.setTextSelection({ from: pmPos, to: pmPos });
|
|
39374
|
+
} else {
|
|
39375
|
+
console.warn(
|
|
39376
|
+
"[PresentationEditor] goToAnchor: Navigation succeeded but could not move caret (editor commands unavailable)"
|
|
39377
|
+
);
|
|
39378
|
+
}
|
|
39379
|
+
return true;
|
|
39380
|
+
} catch (error) {
|
|
39381
|
+
console.error("[PresentationEditor] goToAnchor failed:", error);
|
|
39382
|
+
this.emit("error", {
|
|
39383
|
+
error,
|
|
39384
|
+
context: "goToAnchor"
|
|
39385
|
+
});
|
|
39386
|
+
return false;
|
|
39387
|
+
}
|
|
39388
|
+
}
|
|
39242
39389
|
};
|
|
39243
39390
|
_instances = new WeakMap();
|
|
39244
39391
|
_options = new WeakMap();
|
|
@@ -39299,14 +39446,54 @@ _dragAnchor = new WeakMap();
|
|
|
39299
39446
|
_isDragging = new WeakMap();
|
|
39300
39447
|
_dragExtensionMode = new WeakMap();
|
|
39301
39448
|
_remoteCursorState = new WeakMap();
|
|
39449
|
+
_remoteCursorElements = new WeakMap();
|
|
39302
39450
|
_remoteCursorDirty = new WeakMap();
|
|
39303
39451
|
_remoteCursorOverlay = new WeakMap();
|
|
39304
39452
|
_localSelectionLayer = new WeakMap();
|
|
39305
39453
|
_awarenessCleanup = new WeakMap();
|
|
39306
39454
|
_scrollCleanup = new WeakMap();
|
|
39307
|
-
_remoteCursorRafHandle = new WeakMap();
|
|
39308
39455
|
_scrollTimeout = new WeakMap();
|
|
39456
|
+
_lastRemoteCursorRenderTime = new WeakMap();
|
|
39457
|
+
_remoteCursorThrottleTimeout = new WeakMap();
|
|
39309
39458
|
_PresentationEditor_instances = new WeakSet();
|
|
39459
|
+
/**
|
|
39460
|
+
* Collect all comment and tracked change positions from the PM document.
|
|
39461
|
+
*
|
|
39462
|
+
* This is the authoritative source for PM positions - called after every
|
|
39463
|
+
* layout update to ensure positions are always fresh from the current document.
|
|
39464
|
+
*
|
|
39465
|
+
* The returned positions contain PM offsets (start, end) which can be passed
|
|
39466
|
+
* to getCommentBounds() to compute visual layout coordinates.
|
|
39467
|
+
*
|
|
39468
|
+
* @returns Map of threadId -> { threadId, start, end }
|
|
39469
|
+
*/
|
|
39470
|
+
collectCommentPositions_fn = function() {
|
|
39471
|
+
const editorState = __privateGet(this, _editor3)?.state;
|
|
39472
|
+
if (!editorState) return {};
|
|
39473
|
+
const doc2 = editorState.doc;
|
|
39474
|
+
const trackChangeMarks = [TrackInsertMarkName, TrackDeleteMarkName, TrackFormatMarkName];
|
|
39475
|
+
const pmPositions = {};
|
|
39476
|
+
doc2.descendants((node, pos) => {
|
|
39477
|
+
const marks = node.marks || [];
|
|
39478
|
+
for (const mark of marks) {
|
|
39479
|
+
let threadId;
|
|
39480
|
+
if (mark.type.name === CommentMarkName) {
|
|
39481
|
+
threadId = mark.attrs.commentId || mark.attrs.importedId;
|
|
39482
|
+
} else if (trackChangeMarks.includes(mark.type.name)) {
|
|
39483
|
+
threadId = mark.attrs.id;
|
|
39484
|
+
}
|
|
39485
|
+
if (!threadId) continue;
|
|
39486
|
+
const nodeEnd = pos + node.nodeSize;
|
|
39487
|
+
if (!pmPositions[threadId]) {
|
|
39488
|
+
pmPositions[threadId] = { threadId, start: pos, end: nodeEnd };
|
|
39489
|
+
} else {
|
|
39490
|
+
pmPositions[threadId].start = Math.min(pmPositions[threadId].start, pos);
|
|
39491
|
+
pmPositions[threadId].end = Math.max(pmPositions[threadId].end, nodeEnd);
|
|
39492
|
+
}
|
|
39493
|
+
}
|
|
39494
|
+
});
|
|
39495
|
+
return pmPositions;
|
|
39496
|
+
};
|
|
39310
39497
|
/**
|
|
39311
39498
|
* Aggregate an array of rects into a single bounding box.
|
|
39312
39499
|
*/
|
|
@@ -39350,9 +39537,13 @@ setupEditorListeners_fn = function() {
|
|
|
39350
39537
|
__privateSet(this, _pendingDocChange, true);
|
|
39351
39538
|
__privateMethod(this, _PresentationEditor_instances, scheduleRerender_fn).call(this);
|
|
39352
39539
|
}
|
|
39540
|
+
if (transaction?.docChanged) {
|
|
39541
|
+
__privateMethod(this, _PresentationEditor_instances, updateLocalAwarenessCursor_fn).call(this);
|
|
39542
|
+
}
|
|
39353
39543
|
};
|
|
39354
39544
|
const handleSelection = () => {
|
|
39355
39545
|
__privateMethod(this, _PresentationEditor_instances, scheduleSelectionUpdate_fn).call(this);
|
|
39546
|
+
__privateMethod(this, _PresentationEditor_instances, updateLocalAwarenessCursor_fn).call(this);
|
|
39356
39547
|
};
|
|
39357
39548
|
__privateGet(this, _editor3).on("update", handleUpdate);
|
|
39358
39549
|
__privateGet(this, _editor3).on("selectionUpdate", handleSelection);
|
|
@@ -39429,6 +39620,47 @@ setupCollaborationCursors_fn = function() {
|
|
|
39429
39620
|
});
|
|
39430
39621
|
handleAwarenessChange();
|
|
39431
39622
|
};
|
|
39623
|
+
/**
|
|
39624
|
+
* Update local cursor position in awareness.
|
|
39625
|
+
*
|
|
39626
|
+
* CRITICAL FIX: The y-prosemirror cursor plugin only updates awareness when
|
|
39627
|
+
* view.hasFocus() returns true. In PresentationEditor, the hidden PM EditorView
|
|
39628
|
+
* may not have DOM focus (focus is on the visual representation / input bridge).
|
|
39629
|
+
* This causes the cursor plugin to not send cursor updates, making remote users
|
|
39630
|
+
* see a stale cursor position.
|
|
39631
|
+
*
|
|
39632
|
+
* This method bypasses the focus check and manually updates awareness with the
|
|
39633
|
+
* current selection position whenever the PM selection changes.
|
|
39634
|
+
*
|
|
39635
|
+
* @private
|
|
39636
|
+
* @returns {void}
|
|
39637
|
+
* @throws {Error} Position conversion errors are silently caught and ignored.
|
|
39638
|
+
* These can occur during document restructuring when the PM document structure
|
|
39639
|
+
* doesn't match the Yjs structure, or when positions are temporarily invalid.
|
|
39640
|
+
*/
|
|
39641
|
+
updateLocalAwarenessCursor_fn = function() {
|
|
39642
|
+
const provider = __privateGet(this, _options).collaborationProvider;
|
|
39643
|
+
if (!provider?.awareness) return;
|
|
39644
|
+
if (typeof provider.awareness.setLocalStateField !== "function") {
|
|
39645
|
+
return;
|
|
39646
|
+
}
|
|
39647
|
+
const ystate = ySyncPluginKey.getState(__privateGet(this, _editor3).state);
|
|
39648
|
+
if (!ystate?.binding?.mapping) return;
|
|
39649
|
+
const { selection } = __privateGet(this, _editor3).state;
|
|
39650
|
+
const { anchor, head } = selection;
|
|
39651
|
+
try {
|
|
39652
|
+
const relAnchor = absolutePositionToRelativePosition(anchor, ystate.type, ystate.binding.mapping);
|
|
39653
|
+
const relHead = absolutePositionToRelativePosition(head, ystate.type, ystate.binding.mapping);
|
|
39654
|
+
if (relAnchor && relHead) {
|
|
39655
|
+
const cursorData = {
|
|
39656
|
+
anchor: relAnchor,
|
|
39657
|
+
head: relHead
|
|
39658
|
+
};
|
|
39659
|
+
provider.awareness.setLocalStateField("cursor", cursorData);
|
|
39660
|
+
}
|
|
39661
|
+
} catch {
|
|
39662
|
+
}
|
|
39663
|
+
};
|
|
39432
39664
|
/**
|
|
39433
39665
|
* Normalize awareness states from Yjs relative positions to absolute PM positions.
|
|
39434
39666
|
* Converts remote cursor data into PresentationEditor-friendly coordinate space.
|
|
@@ -39509,26 +39741,62 @@ getValidatedColor_fn = function(cursor) {
|
|
|
39509
39741
|
return cursor.user.color.match(/^#[0-9A-Fa-f]{6}$/) ? cursor.user.color : __privateMethod(this, _PresentationEditor_instances, getFallbackColor_fn).call(this, cursor.clientId);
|
|
39510
39742
|
};
|
|
39511
39743
|
/**
|
|
39512
|
-
* Schedule a remote cursor update using
|
|
39513
|
-
*
|
|
39514
|
-
*
|
|
39744
|
+
* Schedule a remote cursor update using microtask + throttle-based rendering.
|
|
39745
|
+
*
|
|
39746
|
+
* CRITICAL: Uses queueMicrotask to defer cursor normalization until after all
|
|
39747
|
+
* synchronous code completes. This fixes a race condition where awareness events
|
|
39748
|
+
* fire before the ProseMirror state is updated with Yjs document changes:
|
|
39749
|
+
*
|
|
39750
|
+
* 1. WebSocket message arrives with doc update + awareness update
|
|
39751
|
+
* 2. Yjs doc is updated, sync plugin starts creating PM transaction
|
|
39752
|
+
* 3. Awareness update fires events (PresentationEditor handler called)
|
|
39753
|
+
* 4. If we read PM state NOW, it may not have the new text yet
|
|
39754
|
+
* 5. Cursor position conversion uses stale mapping → wrong position
|
|
39755
|
+
*
|
|
39756
|
+
* By deferring to a microtask, we ensure:
|
|
39757
|
+
* - All synchronous code completes (including PM transaction dispatch)
|
|
39758
|
+
* - PM state reflects the latest Yjs document state
|
|
39759
|
+
* - Cursor positions are calculated correctly
|
|
39760
|
+
*
|
|
39761
|
+
* Throttling is still applied (60fps max) to prevent excessive re-renders.
|
|
39762
|
+
*
|
|
39515
39763
|
* @private
|
|
39516
39764
|
*/
|
|
39517
39765
|
scheduleRemoteCursorUpdate_fn = function() {
|
|
39518
39766
|
if (__privateGet(this, _layoutOptions).presence?.enabled === false) return;
|
|
39519
39767
|
if (__privateGet(this, _remoteCursorUpdateScheduled)) return;
|
|
39520
39768
|
__privateSet(this, _remoteCursorUpdateScheduled, true);
|
|
39521
|
-
|
|
39522
|
-
|
|
39523
|
-
|
|
39524
|
-
|
|
39525
|
-
|
|
39526
|
-
|
|
39769
|
+
queueMicrotask(() => {
|
|
39770
|
+
if (!__privateGet(this, _remoteCursorUpdateScheduled)) return;
|
|
39771
|
+
const now = performance.now();
|
|
39772
|
+
const elapsed = now - __privateGet(this, _lastRemoteCursorRenderTime);
|
|
39773
|
+
const THROTTLE_MS = 16;
|
|
39774
|
+
if (elapsed >= THROTTLE_MS) {
|
|
39775
|
+
if (__privateGet(this, _remoteCursorThrottleTimeout) !== null) {
|
|
39776
|
+
clearTimeout(__privateGet(this, _remoteCursorThrottleTimeout));
|
|
39777
|
+
__privateSet(this, _remoteCursorThrottleTimeout, null);
|
|
39778
|
+
}
|
|
39779
|
+
__privateSet(this, _remoteCursorUpdateScheduled, false);
|
|
39780
|
+
__privateSet(this, _lastRemoteCursorRenderTime, now);
|
|
39781
|
+
__privateMethod(this, _PresentationEditor_instances, updateRemoteCursors_fn).call(this);
|
|
39782
|
+
return;
|
|
39783
|
+
}
|
|
39784
|
+
const remaining = THROTTLE_MS - elapsed;
|
|
39785
|
+
__privateSet(this, _remoteCursorThrottleTimeout, window.setTimeout(() => {
|
|
39786
|
+
__privateSet(this, _remoteCursorUpdateScheduled, false);
|
|
39787
|
+
__privateSet(this, _remoteCursorThrottleTimeout, null);
|
|
39788
|
+
__privateSet(this, _lastRemoteCursorRenderTime, performance.now());
|
|
39789
|
+
__privateMethod(this, _PresentationEditor_instances, updateRemoteCursors_fn).call(this);
|
|
39790
|
+
}, remaining));
|
|
39791
|
+
});
|
|
39527
39792
|
};
|
|
39528
39793
|
/**
|
|
39529
39794
|
* Schedule a remote cursor re-render without re-normalizing awareness states.
|
|
39530
39795
|
* Performance optimization: avoids expensive Yjs position conversions on layout changes.
|
|
39531
39796
|
* Used when layout geometry changes but cursor positions haven't (e.g., zoom, scroll, reflow).
|
|
39797
|
+
*
|
|
39798
|
+
* Note: This method doesn't need microtask deferral because it uses already-computed
|
|
39799
|
+
* PM positions from #remoteCursorState, not awareness relative positions.
|
|
39532
39800
|
* @private
|
|
39533
39801
|
*/
|
|
39534
39802
|
scheduleRemoteCursorReRender_fn = function() {
|
|
@@ -39536,11 +39804,11 @@ scheduleRemoteCursorReRender_fn = function() {
|
|
|
39536
39804
|
if (__privateGet(this, _remoteCursorUpdateScheduled)) return;
|
|
39537
39805
|
__privateSet(this, _remoteCursorUpdateScheduled, true);
|
|
39538
39806
|
const win = __privateGet(this, _visibleHost).ownerDocument?.defaultView ?? window;
|
|
39539
|
-
|
|
39807
|
+
win.requestAnimationFrame(() => {
|
|
39540
39808
|
__privateSet(this, _remoteCursorUpdateScheduled, false);
|
|
39541
|
-
__privateSet(this,
|
|
39809
|
+
__privateSet(this, _lastRemoteCursorRenderTime, performance.now());
|
|
39542
39810
|
__privateMethod(this, _PresentationEditor_instances, renderRemoteCursors_fn).call(this);
|
|
39543
|
-
})
|
|
39811
|
+
});
|
|
39544
39812
|
};
|
|
39545
39813
|
/**
|
|
39546
39814
|
* Update remote cursor state, render overlays, and emit event for host consumption.
|
|
@@ -39550,6 +39818,7 @@ scheduleRemoteCursorReRender_fn = function() {
|
|
|
39550
39818
|
updateRemoteCursors_fn = function() {
|
|
39551
39819
|
if (__privateGet(this, _layoutOptions).presence?.enabled === false) {
|
|
39552
39820
|
__privateGet(this, _remoteCursorState).clear();
|
|
39821
|
+
__privateGet(this, _remoteCursorElements).clear();
|
|
39553
39822
|
if (__privateGet(this, _remoteCursorOverlay)) {
|
|
39554
39823
|
__privateGet(this, _remoteCursorOverlay).innerHTML = "";
|
|
39555
39824
|
}
|
|
@@ -39582,12 +39851,14 @@ updateRemoteCursors_fn = function() {
|
|
|
39582
39851
|
* Extracted rendering logic to support both full updates and geometry-only re-renders.
|
|
39583
39852
|
* Used by #updateRemoteCursors (after awareness normalization) and #scheduleRemoteCursorReRender
|
|
39584
39853
|
* (when only layout geometry changes, not cursor positions).
|
|
39854
|
+
*
|
|
39855
|
+
* FLICKER PREVENTION: This method reuses existing DOM elements instead of clearing
|
|
39856
|
+
* and recreating them. Elements are keyed by clientId and only created/removed when
|
|
39857
|
+
* clients join/leave. Position updates use CSS transitions for smooth movement.
|
|
39858
|
+
*
|
|
39585
39859
|
* @private
|
|
39586
39860
|
*/
|
|
39587
39861
|
renderRemoteCursors_fn = function() {
|
|
39588
|
-
if (__privateGet(this, _remoteCursorOverlay)) {
|
|
39589
|
-
__privateGet(this, _remoteCursorOverlay).innerHTML = "";
|
|
39590
|
-
}
|
|
39591
39862
|
const layout = __privateGet(this, _layoutState)?.layout;
|
|
39592
39863
|
const blocks = __privateGet(this, _layoutState)?.blocks;
|
|
39593
39864
|
const measures = __privateGet(this, _layoutState)?.measures;
|
|
@@ -39596,13 +39867,21 @@ renderRemoteCursors_fn = function() {
|
|
|
39596
39867
|
}
|
|
39597
39868
|
const maxVisible = __privateGet(this, _layoutOptions).presence?.maxVisible ?? 20;
|
|
39598
39869
|
const sortedCursors = Array.from(__privateGet(this, _remoteCursorState).values()).sort((a, b) => b.updatedAt - a.updatedAt).slice(0, maxVisible);
|
|
39870
|
+
const visibleClientIds = /* @__PURE__ */ new Set();
|
|
39599
39871
|
sortedCursors.forEach((cursor) => {
|
|
39872
|
+
visibleClientIds.add(cursor.clientId);
|
|
39600
39873
|
if (cursor.anchor === cursor.head) {
|
|
39601
39874
|
__privateMethod(this, _PresentationEditor_instances, renderRemoteCaret_fn).call(this, cursor);
|
|
39602
39875
|
} else {
|
|
39603
39876
|
__privateMethod(this, _PresentationEditor_instances, renderRemoteSelection_fn).call(this, cursor);
|
|
39604
39877
|
}
|
|
39605
39878
|
});
|
|
39879
|
+
__privateGet(this, _remoteCursorElements).forEach((element, clientId) => {
|
|
39880
|
+
if (!visibleClientIds.has(clientId)) {
|
|
39881
|
+
element.remove();
|
|
39882
|
+
__privateGet(this, _remoteCursorElements).delete(clientId);
|
|
39883
|
+
}
|
|
39884
|
+
});
|
|
39606
39885
|
};
|
|
39607
39886
|
/**
|
|
39608
39887
|
* Render a remote collaborator's caret at their current cursor position.
|
|
@@ -39612,8 +39891,11 @@ renderRemoteCursors_fn = function() {
|
|
|
39612
39891
|
* and virtualization), and renders a colored vertical bar with an optional name label.
|
|
39613
39892
|
*
|
|
39614
39893
|
* **Virtualization handling:** If the cursor's position falls on a page that is not currently
|
|
39615
|
-
* mounted in the DOM (due to virtualization), the
|
|
39616
|
-
*
|
|
39894
|
+
* mounted in the DOM (due to virtualization), the element is hidden but retained in memory.
|
|
39895
|
+
* It will be shown again when the page becomes visible.
|
|
39896
|
+
*
|
|
39897
|
+
* **Flicker prevention:** Reuses existing DOM elements when possible, updating positions via
|
|
39898
|
+
* CSS transforms with smooth transitions. Elements are only created for new clients.
|
|
39617
39899
|
*
|
|
39618
39900
|
* **Performance:** Uses GPU-accelerated CSS transforms and respects the maxVisible limit
|
|
39619
39901
|
* enforced by the parent #updateRemoteCursors method.
|
|
@@ -39623,27 +39905,45 @@ renderRemoteCursors_fn = function() {
|
|
|
39623
39905
|
*/
|
|
39624
39906
|
renderRemoteCaret_fn = function(cursor) {
|
|
39625
39907
|
const caretLayout = __privateMethod(this, _PresentationEditor_instances, computeCaretLayoutRect_fn).call(this, cursor.head);
|
|
39626
|
-
if (!caretLayout) return;
|
|
39627
|
-
const coords = __privateMethod(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, caretLayout.pageIndex, caretLayout.x, caretLayout.y);
|
|
39628
|
-
if (!coords) return;
|
|
39629
39908
|
const zoom = __privateGet(this, _layoutOptions).zoom ?? 1;
|
|
39630
39909
|
const doc2 = __privateGet(this, _visibleHost).ownerDocument ?? document;
|
|
39631
39910
|
const color = __privateMethod(this, _PresentationEditor_instances, getValidatedColor_fn).call(this, cursor);
|
|
39632
|
-
|
|
39633
|
-
|
|
39634
|
-
|
|
39635
|
-
|
|
39636
|
-
|
|
39637
|
-
|
|
39911
|
+
let caretEl = __privateGet(this, _remoteCursorElements).get(cursor.clientId);
|
|
39912
|
+
const isNewElement = !caretEl;
|
|
39913
|
+
if (isNewElement) {
|
|
39914
|
+
caretEl = doc2.createElement("div");
|
|
39915
|
+
caretEl.className = "presentation-editor__remote-caret";
|
|
39916
|
+
caretEl.style.position = "absolute";
|
|
39917
|
+
caretEl.style.width = `${_PresentationEditor.CURSOR_STYLES.CARET_WIDTH}px`;
|
|
39918
|
+
caretEl.style.borderLeft = `${_PresentationEditor.CURSOR_STYLES.CARET_WIDTH}px solid ${color}`;
|
|
39919
|
+
caretEl.style.pointerEvents = "none";
|
|
39920
|
+
caretEl.style.transition = "transform 50ms ease-out, height 50ms ease-out, opacity 100ms ease-out";
|
|
39921
|
+
caretEl.style.willChange = "transform";
|
|
39922
|
+
caretEl.setAttribute("data-client-id", cursor.clientId.toString());
|
|
39923
|
+
caretEl.setAttribute("aria-hidden", "true");
|
|
39924
|
+
if (__privateGet(this, _layoutOptions).presence?.showLabels !== false) {
|
|
39925
|
+
__privateMethod(this, _PresentationEditor_instances, renderRemoteCursorLabel_fn).call(this, caretEl, cursor);
|
|
39926
|
+
}
|
|
39927
|
+
__privateGet(this, _remoteCursorElements).set(cursor.clientId, caretEl);
|
|
39928
|
+
__privateGet(this, _remoteCursorOverlay)?.appendChild(caretEl);
|
|
39929
|
+
}
|
|
39930
|
+
if (!caretLayout) {
|
|
39931
|
+
caretEl.style.opacity = "0";
|
|
39932
|
+
return;
|
|
39933
|
+
}
|
|
39934
|
+
const coords = __privateMethod(this, _PresentationEditor_instances, convertPageLocalToOverlayCoords_fn).call(this, caretLayout.pageIndex, caretLayout.x, caretLayout.y);
|
|
39935
|
+
if (!coords) {
|
|
39936
|
+
caretEl.style.opacity = "0";
|
|
39937
|
+
return;
|
|
39938
|
+
}
|
|
39939
|
+
caretEl.style.opacity = "1";
|
|
39940
|
+
caretEl.style.transform = `translate(${coords.x}px, ${coords.y}px)`;
|
|
39638
39941
|
caretEl.style.height = `${Math.max(1, caretLayout.height * zoom)}px`;
|
|
39639
|
-
caretEl.style.
|
|
39640
|
-
|
|
39641
|
-
|
|
39642
|
-
|
|
39643
|
-
if (__privateGet(this, _layoutOptions).presence?.showLabels !== false) {
|
|
39644
|
-
__privateMethod(this, _PresentationEditor_instances, renderRemoteCursorLabel_fn).call(this, caretEl, cursor);
|
|
39942
|
+
caretEl.style.borderLeftColor = color;
|
|
39943
|
+
const labelEl = caretEl.querySelector(".presentation-editor__remote-label");
|
|
39944
|
+
if (labelEl) {
|
|
39945
|
+
labelEl.style.backgroundColor = color;
|
|
39645
39946
|
}
|
|
39646
|
-
__privateGet(this, _remoteCursorOverlay)?.appendChild(caretEl);
|
|
39647
39947
|
};
|
|
39648
39948
|
/**
|
|
39649
39949
|
* Render a label above a remote cursor showing the collaborator's name/email.
|
|
@@ -40206,6 +40506,7 @@ rerender_fn = async function() {
|
|
|
40206
40506
|
}
|
|
40207
40507
|
const sectionMetadata = [];
|
|
40208
40508
|
let blocks;
|
|
40509
|
+
let bookmarks = /* @__PURE__ */ new Map();
|
|
40209
40510
|
try {
|
|
40210
40511
|
const converter2 = __privateGet(this, _editor3).converter;
|
|
40211
40512
|
const converterContext = converter2 ? {
|
|
@@ -40224,6 +40525,7 @@ rerender_fn = async function() {
|
|
|
40224
40525
|
converterContext
|
|
40225
40526
|
});
|
|
40226
40527
|
blocks = result.blocks;
|
|
40528
|
+
bookmarks = result.bookmarks ?? /* @__PURE__ */ new Map();
|
|
40227
40529
|
} catch (error) {
|
|
40228
40530
|
__privateMethod(this, _PresentationEditor_instances, handleLayoutError_fn).call(this, "render", __privateMethod(this, _PresentationEditor_instances, decorateError_fn).call(this, error, "toFlowBlocks"));
|
|
40229
40531
|
return;
|
|
@@ -40271,7 +40573,8 @@ rerender_fn = async function() {
|
|
|
40271
40573
|
__privateSet(this, _sectionMetadata, sectionMetadata);
|
|
40272
40574
|
const converter = __privateGet(this, _editor3).converter;
|
|
40273
40575
|
__privateSet(this, _multiSectionIdentifier, buildMultiSectionIdentifier(sectionMetadata, converter?.pageStyles));
|
|
40274
|
-
|
|
40576
|
+
const anchorMap = __privateMethod(this, _PresentationEditor_instances, computeAnchorMap_fn).call(this, bookmarks, layout);
|
|
40577
|
+
__privateSet(this, _layoutState, { blocks, measures, layout, bookmarks, anchorMap });
|
|
40275
40578
|
__privateSet(this, _headerLayoutResults, headerLayouts ?? null);
|
|
40276
40579
|
__privateSet(this, _footerLayoutResults, footerLayouts ?? null);
|
|
40277
40580
|
await __privateMethod(this, _PresentationEditor_instances, layoutPerRIdHeaderFooters_fn).call(this, headerFooterInput, layout, sectionMetadata);
|
|
@@ -40320,6 +40623,11 @@ rerender_fn = async function() {
|
|
|
40320
40623
|
const payload = { layout, blocks, measures, metrics };
|
|
40321
40624
|
this.emit("layoutUpdated", payload);
|
|
40322
40625
|
this.emit("paginationUpdate", payload);
|
|
40626
|
+
const commentPositions = __privateMethod(this, _PresentationEditor_instances, collectCommentPositions_fn).call(this);
|
|
40627
|
+
const positionKeys = Object.keys(commentPositions);
|
|
40628
|
+
if (positionKeys.length > 0) {
|
|
40629
|
+
this.emit("commentPositions", { positions: commentPositions });
|
|
40630
|
+
}
|
|
40323
40631
|
if (__privateGet(this, _telemetryEmitter) && metrics) {
|
|
40324
40632
|
__privateGet(this, _telemetryEmitter).call(this, { type: "layout", data: { layout, blocks, measures, metrics } });
|
|
40325
40633
|
}
|
|
@@ -40943,9 +41251,9 @@ emitHeaderFooterEditingContext_fn = function(editor) {
|
|
|
40943
41251
|
__privateMethod(this, _PresentationEditor_instances, announce_fn).call(this, __privateGet(this, _session).mode === "body" ? "Exited header/footer edit mode." : `Editing ${__privateGet(this, _session).kind === "header" ? "Header" : "Footer"} (${__privateGet(this, _session).sectionType ?? "default"})`);
|
|
40944
41252
|
};
|
|
40945
41253
|
updateAwarenessSession_fn = function() {
|
|
40946
|
-
const provider = __privateGet(this,
|
|
41254
|
+
const provider = __privateGet(this, _options).collaborationProvider;
|
|
40947
41255
|
const awareness = provider?.awareness;
|
|
40948
|
-
if (!awareness
|
|
41256
|
+
if (!awareness || typeof awareness.setLocalStateField !== "function") {
|
|
40949
41257
|
return;
|
|
40950
41258
|
}
|
|
40951
41259
|
if (__privateGet(this, _session).mode === "body") {
|
|
@@ -41074,6 +41382,66 @@ scrollPageIntoView_fn = function(pageIndex) {
|
|
|
41074
41382
|
__privateGet(this, _visibleHost).scrollTop = yPosition;
|
|
41075
41383
|
}
|
|
41076
41384
|
};
|
|
41385
|
+
/**
|
|
41386
|
+
* Build an anchor map (bookmark name -> page index) using fragment PM ranges.
|
|
41387
|
+
* Mirrors layout-engine's buildAnchorMap to avoid an extra dependency here.
|
|
41388
|
+
*/
|
|
41389
|
+
computeAnchorMap_fn = function(bookmarks, layout) {
|
|
41390
|
+
const anchorMap = /* @__PURE__ */ new Map();
|
|
41391
|
+
const blockPmRanges = /* @__PURE__ */ new Map();
|
|
41392
|
+
const computeBlockRange = (blockId) => {
|
|
41393
|
+
if (blockPmRanges.has(blockId)) {
|
|
41394
|
+
const cached = blockPmRanges.get(blockId);
|
|
41395
|
+
return { pmStart: cached.pmStart, pmEnd: cached.pmEnd };
|
|
41396
|
+
}
|
|
41397
|
+
const block = __privateGet(this, _layoutState).blocks.find((b) => b.id === blockId);
|
|
41398
|
+
if (!block || block.kind !== "paragraph") {
|
|
41399
|
+
blockPmRanges.set(blockId, { pmStart: null, pmEnd: null, hasFragmentPositions: false });
|
|
41400
|
+
return { pmStart: null, pmEnd: null };
|
|
41401
|
+
}
|
|
41402
|
+
let pmStart = null;
|
|
41403
|
+
let pmEnd = null;
|
|
41404
|
+
for (const run of block.runs) {
|
|
41405
|
+
if (run.pmStart != null) {
|
|
41406
|
+
pmStart = pmStart == null ? run.pmStart : Math.min(pmStart, run.pmStart);
|
|
41407
|
+
}
|
|
41408
|
+
if (run.pmEnd != null) {
|
|
41409
|
+
pmEnd = pmEnd == null ? run.pmEnd : Math.max(pmEnd, run.pmEnd);
|
|
41410
|
+
}
|
|
41411
|
+
}
|
|
41412
|
+
blockPmRanges.set(blockId, { pmStart, pmEnd, hasFragmentPositions: false });
|
|
41413
|
+
return { pmStart, pmEnd };
|
|
41414
|
+
};
|
|
41415
|
+
bookmarks.forEach((pmPosition, bookmarkName) => {
|
|
41416
|
+
for (const page of layout.pages) {
|
|
41417
|
+
for (const fragment of page.fragments) {
|
|
41418
|
+
if (fragment.kind !== "para") continue;
|
|
41419
|
+
let fragStart = fragment.pmStart;
|
|
41420
|
+
let fragEnd = fragment.pmEnd;
|
|
41421
|
+
if (fragStart == null || fragEnd == null) {
|
|
41422
|
+
const range = computeBlockRange(fragment.blockId);
|
|
41423
|
+
if (range.pmStart != null && range.pmEnd != null) {
|
|
41424
|
+
fragStart = range.pmStart;
|
|
41425
|
+
fragEnd = range.pmEnd;
|
|
41426
|
+
}
|
|
41427
|
+
} else {
|
|
41428
|
+
const cached = blockPmRanges.get(fragment.blockId);
|
|
41429
|
+
blockPmRanges.set(fragment.blockId, {
|
|
41430
|
+
pmStart: cached?.pmStart ?? fragStart,
|
|
41431
|
+
pmEnd: cached?.pmEnd ?? fragEnd,
|
|
41432
|
+
hasFragmentPositions: true
|
|
41433
|
+
});
|
|
41434
|
+
}
|
|
41435
|
+
if (fragStart == null || fragEnd == null) continue;
|
|
41436
|
+
if (pmPosition >= fragStart && pmPosition < fragEnd) {
|
|
41437
|
+
anchorMap.set(bookmarkName, page.number);
|
|
41438
|
+
return;
|
|
41439
|
+
}
|
|
41440
|
+
}
|
|
41441
|
+
}
|
|
41442
|
+
});
|
|
41443
|
+
return anchorMap;
|
|
41444
|
+
};
|
|
41077
41445
|
waitForPageMount_fn = async function(pageIndex, options = {}) {
|
|
41078
41446
|
const timeout2 = options.timeout ?? 2e3;
|
|
41079
41447
|
const startTime = performance.now();
|
|
@@ -41711,6 +42079,7 @@ _PresentationEditor.CURSOR_STYLES = {
|
|
|
41711
42079
|
SELECTION_BORDER_RADIUS: "2px",
|
|
41712
42080
|
MAX_LABEL_LENGTH: 30
|
|
41713
42081
|
};
|
|
42082
|
+
_PresentationEditor.ANCHOR_NAV_TIMEOUT_MS = 2e3;
|
|
41714
42083
|
let PresentationEditor = _PresentationEditor;
|
|
41715
42084
|
class PresentationInputBridge {
|
|
41716
42085
|
/**
|
|
@@ -45974,6 +46343,7 @@ const Paragraph = OxmlNode.create({
|
|
|
45974
46343
|
return ["p", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
45975
46344
|
},
|
|
45976
46345
|
addNodeView() {
|
|
46346
|
+
if (this.editor.options?.mode !== "docx" || !this.editor.converter) return null;
|
|
45977
46347
|
if (shouldSkipNodeView(this.editor)) return null;
|
|
45978
46348
|
return ({ node, editor, getPos, decorations, extensionAttrs }) => {
|
|
45979
46349
|
return new ParagraphNodeView(node, editor, getPos, decorations, extensionAttrs);
|
|
@@ -46216,7 +46586,7 @@ const CommentReference = Node$1.create({
|
|
|
46216
46586
|
}
|
|
46217
46587
|
});
|
|
46218
46588
|
const CommentsMark = Mark.create({
|
|
46219
|
-
name: CommentMarkName,
|
|
46589
|
+
name: CommentMarkName$1,
|
|
46220
46590
|
group: "comments",
|
|
46221
46591
|
excludes: "",
|
|
46222
46592
|
addOptions() {
|
|
@@ -46235,10 +46605,10 @@ const CommentsMark = Mark.create({
|
|
|
46235
46605
|
};
|
|
46236
46606
|
},
|
|
46237
46607
|
parseDOM() {
|
|
46238
|
-
return [{ tag: CommentMarkName }];
|
|
46608
|
+
return [{ tag: CommentMarkName$1 }];
|
|
46239
46609
|
},
|
|
46240
46610
|
renderDOM({ htmlAttributes }) {
|
|
46241
|
-
return [CommentMarkName, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
46611
|
+
return [CommentMarkName$1, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
46242
46612
|
}
|
|
46243
46613
|
});
|
|
46244
46614
|
let cache = /* @__PURE__ */ new WeakMap();
|
|
@@ -56450,7 +56820,7 @@ function addLinkRelationship({ editor, href }) {
|
|
|
56450
56820
|
}
|
|
56451
56821
|
const trackInsertClass = "track-insert";
|
|
56452
56822
|
const TrackInsert = Mark.create({
|
|
56453
|
-
name: TrackInsertMarkName,
|
|
56823
|
+
name: TrackInsertMarkName$1,
|
|
56454
56824
|
group: "track",
|
|
56455
56825
|
inclusive: false,
|
|
56456
56826
|
addOptions() {
|
|
@@ -56527,7 +56897,7 @@ const TrackInsert = Mark.create({
|
|
|
56527
56897
|
});
|
|
56528
56898
|
const trackDeleteClass = "track-delete";
|
|
56529
56899
|
const TrackDelete = Mark.create({
|
|
56530
|
-
name: TrackDeleteMarkName,
|
|
56900
|
+
name: TrackDeleteMarkName$1,
|
|
56531
56901
|
group: "track",
|
|
56532
56902
|
inclusive: false,
|
|
56533
56903
|
addOptions() {
|
|
@@ -56636,7 +57006,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
56636
57006
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
56637
57007
|
const trackFormatClass = "track-format";
|
|
56638
57008
|
const TrackFormat = Mark.create({
|
|
56639
|
-
name: TrackFormatMarkName,
|
|
57009
|
+
name: TrackFormatMarkName$1,
|
|
56640
57010
|
group: "track",
|
|
56641
57011
|
inclusive: false,
|
|
56642
57012
|
addOptions() {
|
|
@@ -56850,7 +57220,7 @@ const TrackChanges = Extension.create({
|
|
|
56850
57220
|
tr.setMeta("inputType", "acceptReject");
|
|
56851
57221
|
const map2 = new Mapping();
|
|
56852
57222
|
doc2.nodesBetween(from2, to, (node, pos) => {
|
|
56853
|
-
if (node.marks && node.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
|
|
57223
|
+
if (node.marks && node.marks.find((mark) => mark.type.name === TrackDeleteMarkName$1)) {
|
|
56854
57224
|
const deletionStep = new ReplaceStep(
|
|
56855
57225
|
map2.map(Math.max(pos, from2)),
|
|
56856
57226
|
map2.map(Math.min(pos + node.nodeSize, to)),
|
|
@@ -56858,8 +57228,8 @@ const TrackChanges = Extension.create({
|
|
|
56858
57228
|
);
|
|
56859
57229
|
tr.step(deletionStep);
|
|
56860
57230
|
map2.appendMap(deletionStep.getMap());
|
|
56861
|
-
} else if (node.marks && node.marks.find((mark) => mark.type.name === TrackInsertMarkName)) {
|
|
56862
|
-
const insertionMark = node.marks.find((mark) => mark.type.name === TrackInsertMarkName);
|
|
57231
|
+
} else if (node.marks && node.marks.find((mark) => mark.type.name === TrackInsertMarkName$1)) {
|
|
57232
|
+
const insertionMark = node.marks.find((mark) => mark.type.name === TrackInsertMarkName$1);
|
|
56863
57233
|
tr.step(
|
|
56864
57234
|
new RemoveMarkStep(
|
|
56865
57235
|
map2.map(Math.max(pos, from2)),
|
|
@@ -56867,8 +57237,8 @@ const TrackChanges = Extension.create({
|
|
|
56867
57237
|
insertionMark
|
|
56868
57238
|
)
|
|
56869
57239
|
);
|
|
56870
|
-
} else if (node.marks && node.marks.find((mark) => mark.type.name === TrackFormatMarkName)) {
|
|
56871
|
-
const formatChangeMark = node.marks.find((mark) => mark.type.name === TrackFormatMarkName);
|
|
57240
|
+
} else if (node.marks && node.marks.find((mark) => mark.type.name === TrackFormatMarkName$1)) {
|
|
57241
|
+
const formatChangeMark = node.marks.find((mark) => mark.type.name === TrackFormatMarkName$1);
|
|
56872
57242
|
tr.step(
|
|
56873
57243
|
new RemoveMarkStep(
|
|
56874
57244
|
map2.map(Math.max(pos, from2)),
|
|
@@ -56890,8 +57260,8 @@ const TrackChanges = Extension.create({
|
|
|
56890
57260
|
tr.setMeta("inputType", "acceptReject");
|
|
56891
57261
|
const map2 = new Mapping();
|
|
56892
57262
|
doc2.nodesBetween(from2, to, (node, pos) => {
|
|
56893
|
-
if (node.marks && node.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
|
|
56894
|
-
const deletionMark = node.marks.find((mark) => mark.type.name === TrackDeleteMarkName);
|
|
57263
|
+
if (node.marks && node.marks.find((mark) => mark.type.name === TrackDeleteMarkName$1)) {
|
|
57264
|
+
const deletionMark = node.marks.find((mark) => mark.type.name === TrackDeleteMarkName$1);
|
|
56895
57265
|
tr.step(
|
|
56896
57266
|
new RemoveMarkStep(
|
|
56897
57267
|
map2.map(Math.max(pos, from2)),
|
|
@@ -56899,7 +57269,7 @@ const TrackChanges = Extension.create({
|
|
|
56899
57269
|
deletionMark
|
|
56900
57270
|
)
|
|
56901
57271
|
);
|
|
56902
|
-
} else if (node.marks && node.marks.find((mark) => mark.type.name === TrackInsertMarkName)) {
|
|
57272
|
+
} else if (node.marks && node.marks.find((mark) => mark.type.name === TrackInsertMarkName$1)) {
|
|
56903
57273
|
const deletionStep = new ReplaceStep(
|
|
56904
57274
|
map2.map(Math.max(pos, from2)),
|
|
56905
57275
|
map2.map(Math.min(pos + node.nodeSize, to)),
|
|
@@ -56907,8 +57277,8 @@ const TrackChanges = Extension.create({
|
|
|
56907
57277
|
);
|
|
56908
57278
|
tr.step(deletionStep);
|
|
56909
57279
|
map2.appendMap(deletionStep.getMap());
|
|
56910
|
-
} else if (node.marks && node.marks.find((mark) => mark.type.name === TrackFormatMarkName)) {
|
|
56911
|
-
const formatChangeMark = node.marks.find((mark) => mark.type.name === TrackFormatMarkName);
|
|
57280
|
+
} else if (node.marks && node.marks.find((mark) => mark.type.name === TrackFormatMarkName$1)) {
|
|
57281
|
+
const formatChangeMark = node.marks.find((mark) => mark.type.name === TrackFormatMarkName$1);
|
|
56912
57282
|
formatChangeMark.attrs.before.forEach((oldMark) => {
|
|
56913
57283
|
tr.step(
|
|
56914
57284
|
new AddMarkStep(
|
|
@@ -57084,7 +57454,7 @@ const getChangesByIdToResolve = (state, id) => {
|
|
|
57084
57454
|
const hasContentBetween = state.doc.textBetween(left2.from, right2.to, "\n").length > getSegmentSize(left2) + getSegmentSize(right2);
|
|
57085
57455
|
return !hasContentBetween;
|
|
57086
57456
|
};
|
|
57087
|
-
const isComplementaryPair = (firstType, secondType) => firstType === TrackDeleteMarkName && secondType === TrackInsertMarkName || firstType === TrackInsertMarkName && secondType === TrackDeleteMarkName;
|
|
57457
|
+
const isComplementaryPair = (firstType, secondType) => firstType === TrackDeleteMarkName$1 && secondType === TrackInsertMarkName$1 || firstType === TrackInsertMarkName$1 && secondType === TrackDeleteMarkName$1;
|
|
57088
57458
|
const linkedBefore = [];
|
|
57089
57459
|
const linkedAfter = [];
|
|
57090
57460
|
const collectDirection = (direction, collection) => {
|