@harbour-enterprises/superdoc 2.0.0-next.13 → 2.0.0-next.14

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.
Files changed (27) hide show
  1. package/dist/chunks/{PdfViewer-CHWTTxtm.cjs → PdfViewer-B2KasYH0.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DGJe0yHt.es.js → PdfViewer-DHGCKcbn.es.js} +1 -1
  3. package/dist/chunks/{index-BbC6VsXh.es.js → index-BFL0Wf8L.es.js} +3 -3
  4. package/dist/chunks/{index-DwECJSoY.cjs → index-C5g9qqV4.cjs} +3 -3
  5. package/dist/chunks/{index-Bh0gd0Pm-DMBx9Ybz.es.js → index-CIGMPabO-0NmziL3U.es.js} +1 -1
  6. package/dist/chunks/{index-Bh0gd0Pm-BGAaVc0H.cjs → index-CIGMPabO-CaiVnKiQ.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-BJ1ZZaEo.es.js → super-editor.es-Cnykvny5.es.js} +99 -9
  8. package/dist/chunks/{super-editor.es-CZoFXUj4.cjs → super-editor.es-VSoDsxCy.cjs} +99 -9
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-Dx9n2qwO.js → converter-CHaTddld.js} +1 -3
  11. package/dist/super-editor/chunks/{docx-zipper-Ds8FGkok.js → docx-zipper-DukEuVKp.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-C8TLVw8v.js → editor-Ca-y1mB-.js} +100 -8
  13. package/dist/super-editor/chunks/{index-Bh0gd0Pm.js → index-CIGMPabO.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-DpUoIWke.js → toolbar-C5IzePMi.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +101 -11
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -12,8 +12,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _a, _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, _currentEpoch, _mapsByFromEpoch, _maxEpochsToKeep, _EpochPositionMapper_instances, pruneByCurrentEpoch_fn, _entries, _windowRoot, _getPainterHost, _onRebuild, _observer, _rebuildScheduled, _rebuildRafId, _docEpoch, _layoutEpoch, _layoutUpdating, _pending, _scheduled, _rafHandle, _scheduler, _SelectionSyncCoordinator_instances, isSafeToRender_fn, maybeSchedule_fn, cancelScheduledRender_fn, _windowRoot2, _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, _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, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionSync, _remoteCursorUpdateScheduled, _epochMapper, _layoutEpoch2, _domPositionIndex, _domIndexObserverManager, _debugLastPointer, _debugLastHit, _pendingMarginClick, _rafHandle2, _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, _a11ySelectionAnnounceTimeout, _a11yLastAnnouncedSelectionKey, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _dragAnchorPageIndex, _isDragging, _dragExtensionMode, _dragLastPointer, _dragLastRawHit, _dragUsedPageNotMountedFallback, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, wrapHiddenEditorFocus_fn, collectCommentPositions_fn, updateSelectionDebugHud_fn, computePendingMarginClick_fn, aggregateLayoutBounds_fn, rebuildDomPositionIndex_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, _handlePointerMove, _handlePointerLeave, _handleVisibleHostFocusIn, _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, computeExpectedSectionType_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, syncHiddenEditorA11yAttributes_fn, scheduleA11ySelectionAnnouncement_fn, announceSelectionNow_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, isSelectionAwareVirtualizationEnabled_fn, updateSelectionVirtualizationPins_fn, finalizeDragSelectionWithDom_fn, scrollPageIntoView_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, renderCellSelectionOverlay_fn, renderHoverRegion_fn, clearHoverRegion_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, applyZoom_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeSelectionRectsFromDom_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_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$2, 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 SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-Dx9n2qwO.js";
16
- import { D as DocxZipper } from "./docx-zipper-Ds8FGkok.js";
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$2, 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 SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-CHaTddld.js";
16
+ import { D as DocxZipper } from "./docx-zipper-DukEuVKp.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() {
@@ -12148,6 +12148,70 @@ const getCommentPositionsById = (commentId, doc2) => {
12148
12148
  });
12149
12149
  return positions;
12150
12150
  };
12151
+ const getCommentMarkSegmentsById = (commentId, doc2) => {
12152
+ const segments = [];
12153
+ doc2.descendants((node, pos) => {
12154
+ if (!node.isInline) return;
12155
+ const commentMark = node.marks?.find(
12156
+ (mark) => mark.type.name === CommentMarkName$1 && mark.attrs?.commentId === commentId
12157
+ );
12158
+ if (!commentMark) return;
12159
+ segments.push({
12160
+ from: pos,
12161
+ to: pos + node.nodeSize,
12162
+ attrs: commentMark.attrs || {}
12163
+ });
12164
+ });
12165
+ return segments;
12166
+ };
12167
+ const getCommentMarkRangesById = (commentId, doc2) => {
12168
+ const segments = getCommentMarkSegmentsById(commentId, doc2);
12169
+ if (!segments.length) return { segments, ranges: [] };
12170
+ const ranges = [];
12171
+ let active = null;
12172
+ segments.forEach((seg) => {
12173
+ if (!active) {
12174
+ active = {
12175
+ from: seg.from,
12176
+ to: seg.to,
12177
+ internal: !!seg.attrs?.internal
12178
+ };
12179
+ return;
12180
+ }
12181
+ if (seg.from <= active.to) {
12182
+ active.to = Math.max(active.to, seg.to);
12183
+ return;
12184
+ }
12185
+ ranges.push(active);
12186
+ active = {
12187
+ from: seg.from,
12188
+ to: seg.to,
12189
+ internal: !!seg.attrs?.internal
12190
+ };
12191
+ });
12192
+ if (active) ranges.push(active);
12193
+ return { segments, ranges };
12194
+ };
12195
+ const resolveCommentById = ({ commentId, state, tr, dispatch }) => {
12196
+ const { schema } = state;
12197
+ const markType = schema.marks?.[CommentMarkName$1];
12198
+ if (!markType) return false;
12199
+ const { segments, ranges } = getCommentMarkRangesById(commentId, state.doc);
12200
+ if (!segments.length) return false;
12201
+ segments.forEach(({ from: from2, to, attrs }) => {
12202
+ tr.removeMark(from2, to, markType.create(attrs));
12203
+ });
12204
+ const startType = schema.nodes?.commentRangeStart;
12205
+ const endType = schema.nodes?.commentRangeEnd;
12206
+ if (startType && endType) {
12207
+ ranges.slice().sort((a, b) => b.from - a.from).forEach(({ from: from2, to, internal }) => {
12208
+ tr.insert(to, endType.create({ "w:id": commentId }));
12209
+ tr.insert(from2, startType.create({ "w:id": commentId, internal }));
12210
+ });
12211
+ }
12212
+ dispatch(tr);
12213
+ return true;
12214
+ };
12151
12215
  const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
12152
12216
  const commentMap = /* @__PURE__ */ new Map();
12153
12217
  comments.forEach((c) => {
@@ -12254,6 +12318,7 @@ const getPreparedComment = (attrs) => {
12254
12318
  const prepareCommentsForImport = (doc2, tr, schema, converter) => {
12255
12319
  const toMark = [];
12256
12320
  const toDelete = [];
12321
+ const toUpdate = [];
12257
12322
  doc2.descendants((node, pos) => {
12258
12323
  const { type } = node;
12259
12324
  const commentNodes = ["commentRangeStart", "commentRangeEnd", "commentReference"];
@@ -12262,8 +12327,9 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
12262
12327
  converter,
12263
12328
  importedId: node.attrs["w:id"]
12264
12329
  });
12330
+ const isDone = !!matchingImportedComment?.isDone;
12265
12331
  if (type.name === "commentRangeStart") {
12266
- if (!matchingImportedComment?.isDone) {
12332
+ if (!isDone) {
12267
12333
  toMark.push({
12268
12334
  commentId: resolvedCommentId,
12269
12335
  importedId,
@@ -12277,8 +12343,29 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
12277
12343
  commentId: resolvedCommentId,
12278
12344
  importedId
12279
12345
  });
12280
- toDelete.push({ start: pos, end: pos + 1 });
12346
+ if (isDone) {
12347
+ toUpdate.push({
12348
+ pos,
12349
+ attrs: {
12350
+ ...node.attrs,
12351
+ "w:id": resolvedCommentId,
12352
+ internal
12353
+ }
12354
+ });
12355
+ } else {
12356
+ toDelete.push({ start: pos, end: pos + 1 });
12357
+ }
12281
12358
  } else if (type.name === "commentRangeEnd") {
12359
+ if (isDone) {
12360
+ toUpdate.push({
12361
+ pos,
12362
+ attrs: {
12363
+ ...node.attrs,
12364
+ "w:id": resolvedCommentId
12365
+ }
12366
+ });
12367
+ return;
12368
+ }
12282
12369
  const itemToMark = toMark.find((p) => p.importedId === importedId);
12283
12370
  if (!itemToMark) return;
12284
12371
  const { start: start2 } = itemToMark;
@@ -12293,6 +12380,11 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
12293
12380
  toDelete.push({ start: pos, end: pos + 1 });
12294
12381
  }
12295
12382
  });
12383
+ if (typeof tr.setNodeMarkup === "function") {
12384
+ toUpdate.sort((a, b) => b.pos - a.pos).forEach(({ pos, attrs }) => {
12385
+ tr.setNodeMarkup(pos, void 0, attrs);
12386
+ });
12387
+ }
12296
12388
  toDelete.sort((a, b) => b.start - a.start).forEach(({ start: start2, end: end2 }) => {
12297
12389
  tr.delete(start2, end2);
12298
12390
  });
@@ -12486,7 +12578,7 @@ const CommentsPlugin = Extension.create({
12486
12578
  },
12487
12579
  resolveComment: ({ commentId }) => ({ tr, dispatch, state }) => {
12488
12580
  tr.setMeta(CommentsPluginKey, { event: "update" });
12489
- removeCommentsById({ commentId, state, tr, dispatch });
12581
+ return resolveCommentById({ commentId, state, tr, dispatch });
12490
12582
  },
12491
12583
  setCursorById: (id) => ({ state, editor }) => {
12492
12584
  const { from: from2 } = findRangeById(state.doc, id) || {};
@@ -14815,7 +14907,7 @@ const isHeadless = (editor) => {
14815
14907
  const shouldSkipNodeView = (editor) => {
14816
14908
  return isHeadless(editor);
14817
14909
  };
14818
- const summaryVersion = "2.0.0-next.13";
14910
+ const summaryVersion = "2.0.0-next.14";
14819
14911
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
14820
14912
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
14821
14913
  function mapAttributes(attrs) {
@@ -15607,7 +15699,7 @@ const _Editor = class _Editor extends EventEmitter {
15607
15699
  { default: remarkStringify },
15608
15700
  { default: remarkGfm }
15609
15701
  ] = await Promise.all([
15610
- import("./index-Bh0gd0Pm.js"),
15702
+ import("./index-CIGMPabO.js"),
15611
15703
  import("./index-DRCvimau.js"),
15612
15704
  import("./index-C_x_N6Uh.js"),
15613
15705
  import("./index-D_sWOSiG.js"),
@@ -15812,7 +15904,7 @@ const _Editor = class _Editor extends EventEmitter {
15812
15904
  * Process collaboration migrations
15813
15905
  */
15814
15906
  processCollaborationMigrations() {
15815
- console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.13");
15907
+ console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.14");
15816
15908
  if (!this.options.ydoc) return;
15817
15909
  const metaMap = this.options.ydoc.getMap("meta");
15818
15910
  let docVersion = metaMap.get("version");
@@ -1,4 +1,4 @@
1
- import { aK as getDefaultExportFromCjs } from "./converter-Dx9n2qwO.js";
1
+ import { aK as getDefaultExportFromCjs } from "./converter-CHaTddld.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,6 +1,6 @@
1
1
  import { ref, readonly, watch, computed, getCurrentInstance, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, withDirectives, h, Teleport, toRef, nextTick, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, markRaw, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, withKeys, unref, withModifiers, createBlock, toDisplayString, vModelText, createVNode, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-Dx9n2qwO.js";
3
- import { g as global$1, _ as _export_sfc, u as useHighContrastMode } from "./editor-C8TLVw8v.js";
2
+ import { p as process$1 } from "./converter-CHaTddld.js";
3
+ import { g as global$1, _ as _export_sfc, u as useHighContrastMode } from "./editor-Ca-y1mB-.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { ac } from "./chunks/converter-Dx9n2qwO.js";
1
+ import { ac } from "./chunks/converter-CHaTddld.js";
2
2
  export {
3
3
  ac as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-Dx9n2qwO.js";
2
- import { D } from "./chunks/docx-zipper-Ds8FGkok.js";
1
+ import "./chunks/converter-CHaTddld.js";
2
+ import { D } from "./chunks/docx-zipper-DukEuVKp.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-C8TLVw8v.js";
2
- import "./chunks/converter-Dx9n2qwO.js";
3
- import "./chunks/docx-zipper-Ds8FGkok.js";
1
+ import { E } from "./chunks/editor-Ca-y1mB-.js";
2
+ import "./chunks/converter-CHaTddld.js";
3
+ import "./chunks/docx-zipper-DukEuVKp.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-Ds8FGkok.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-DukEuVKp.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -9,14 +9,14 @@ 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 __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _MARK_TOGGLE_NAMES, _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn, syncStickyMarksFromState_fn, restoreStickyMarksIfNeeded_fn, ensureStoredMarksForMarkToggle_fn;
12
- import { aK as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aN as vClickOutside, aO as getActiveFormatting, aD as isInTable, O as findParentNode, at as calculateResolvedParagraphProperties, a7 as twipsToLines, Q as isList, an as parseSizeUnit, W as isMacOS, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-Dx9n2qwO.js";
13
- import { ac, i, a9, aQ } from "./chunks/converter-Dx9n2qwO.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as getEditorSurfaceElement, l as collectTrackedChangesForContext, S as SLASH_MENU_HANDLED_FLAG, m as SlashMenuPluginKey, s as shouldBypassContextMenu, n as generateRulerDefinition, o as clampHandlePosition, p as calculateMarginFromHandle, q as measureCache, t as isHeadless, E as Editor, v as getStarterExtensions, P as PresentationEditor, w as Placeholder, x as getRichTextExtensions, D as DecorationSet, z as Decoration, M as Mark, A as Extension, B as Attribute, N as Node } from "./chunks/editor-C8TLVw8v.js";
15
- import { G, J, H, T, C, I, F } from "./chunks/editor-C8TLVw8v.js";
12
+ import { aK as getDefaultExportFromCjs, a0 as v4, T as TextSelection$1, v as getMarkRange, aN as vClickOutside, aO as getActiveFormatting, aD as isInTable, O as findParentNode, at as calculateResolvedParagraphProperties, a7 as twipsToLines, Q as isList, an as parseSizeUnit, W as isMacOS, a8 as pixelsToTwips, aP as getFileObject, P as PluginKey, a as Plugin } from "./chunks/converter-CHaTddld.js";
13
+ import { ac, i, a9, aQ } from "./chunks/converter-CHaTddld.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as getEditorSurfaceElement, l as collectTrackedChangesForContext, S as SLASH_MENU_HANDLED_FLAG, m as SlashMenuPluginKey, s as shouldBypassContextMenu, n as generateRulerDefinition, o as clampHandlePosition, p as calculateMarginFromHandle, q as measureCache, t as isHeadless, E as Editor, v as getStarterExtensions, P as PresentationEditor, w as Placeholder, x as getRichTextExtensions, D as DecorationSet, z as Decoration, M as Mark, A as Extension, B as Attribute, N as Node } from "./chunks/editor-Ca-y1mB-.js";
15
+ import { G, J, H, T, C, I, F } from "./chunks/editor-Ca-y1mB-.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, defineComponent, reactive, onUnmounted, renderSlot, useCssVars, shallowRef, createBlock, Teleport, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-DpUoIWke.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-C5IzePMi.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-Ds8FGkok.js";
19
+ import { D } from "./chunks/docx-zipper-DukEuVKp.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-DpUoIWke.js";
3
- import "./chunks/editor-C8TLVw8v.js";
2
+ import { T } from "./chunks/toolbar-C5IzePMi.js";
3
+ import "./chunks/editor-Ca-y1mB-.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-CZoFXUj4.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-VSoDsxCy.cjs");
4
4
  require("./chunks/vue-gvuFr0vx.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, P, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-BJ1ZZaEo.es.js";
1
+ import { A, a, _, C, D, E, b, P, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-Cnykvny5.es.js";
2
2
  import "./chunks/vue-CLFbn_1r.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-CZoFXUj4.cjs");
4
- const superdoc = require("./chunks/index-DwECJSoY.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-VSoDsxCy.cjs");
4
+ const superdoc = require("./chunks/index-C5g9qqV4.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
7
7
  exports.Editor = superEditor_es.Editor;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-BJ1ZZaEo.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-BbC6VsXh.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-Cnykvny5.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-BFL0Wf8L.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -38547,8 +38547,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38547
38547
  );
38548
38548
  const isInternal = parentComment?.isInternal || originalComment.isInternal;
38549
38549
  if (commentsExportType === "external" && isInternal) return;
38550
- const isResolved = !!originalComment.resolvedTime;
38551
- if (isResolved) return;
38552
38550
  if (node2.type !== "commentRangeStart" && node2.type !== "commentRangeEnd") {
38553
38551
  return;
38554
38552
  }
@@ -42470,7 +42468,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
42470
42468
  static getStoredSuperdocVersion(docx) {
42471
42469
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42472
42470
  }
42473
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.13") {
42471
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "2.0.0-next.14") {
42474
42472
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42475
42473
  }
42476
42474
  /**
@@ -65782,6 +65780,70 @@ ${err.toString()}`);
65782
65780
  });
65783
65781
  return positions;
65784
65782
  };
65783
+ const getCommentMarkSegmentsById = (commentId, doc2) => {
65784
+ const segments = [];
65785
+ doc2.descendants((node2, pos) => {
65786
+ if (!node2.isInline) return;
65787
+ const commentMark = node2.marks?.find(
65788
+ (mark2) => mark2.type.name === CommentMarkName$1 && mark2.attrs?.commentId === commentId
65789
+ );
65790
+ if (!commentMark) return;
65791
+ segments.push({
65792
+ from: pos,
65793
+ to: pos + node2.nodeSize,
65794
+ attrs: commentMark.attrs || {}
65795
+ });
65796
+ });
65797
+ return segments;
65798
+ };
65799
+ const getCommentMarkRangesById = (commentId, doc2) => {
65800
+ const segments = getCommentMarkSegmentsById(commentId, doc2);
65801
+ if (!segments.length) return { segments, ranges: [] };
65802
+ const ranges = [];
65803
+ let active = null;
65804
+ segments.forEach((seg) => {
65805
+ if (!active) {
65806
+ active = {
65807
+ from: seg.from,
65808
+ to: seg.to,
65809
+ internal: !!seg.attrs?.internal
65810
+ };
65811
+ return;
65812
+ }
65813
+ if (seg.from <= active.to) {
65814
+ active.to = Math.max(active.to, seg.to);
65815
+ return;
65816
+ }
65817
+ ranges.push(active);
65818
+ active = {
65819
+ from: seg.from,
65820
+ to: seg.to,
65821
+ internal: !!seg.attrs?.internal
65822
+ };
65823
+ });
65824
+ if (active) ranges.push(active);
65825
+ return { segments, ranges };
65826
+ };
65827
+ const resolveCommentById = ({ commentId, state: state2, tr, dispatch }) => {
65828
+ const { schema } = state2;
65829
+ const markType = schema.marks?.[CommentMarkName$1];
65830
+ if (!markType) return false;
65831
+ const { segments, ranges } = getCommentMarkRangesById(commentId, state2.doc);
65832
+ if (!segments.length) return false;
65833
+ segments.forEach(({ from: from2, to, attrs }) => {
65834
+ tr.removeMark(from2, to, markType.create(attrs));
65835
+ });
65836
+ const startType = schema.nodes?.commentRangeStart;
65837
+ const endType = schema.nodes?.commentRangeEnd;
65838
+ if (startType && endType) {
65839
+ ranges.slice().sort((a2, b2) => b2.from - a2.from).forEach(({ from: from2, to, internal }) => {
65840
+ tr.insert(to, endType.create({ "w:id": commentId }));
65841
+ tr.insert(from2, startType.create({ "w:id": commentId, internal }));
65842
+ });
65843
+ }
65844
+ dispatch(tr);
65845
+ return true;
65846
+ };
65785
65847
  const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
65786
65848
  const commentMap = /* @__PURE__ */ new Map();
65787
65849
  comments.forEach((c2) => {
@@ -65888,6 +65950,7 @@ ${err.toString()}`);
65888
65950
  const prepareCommentsForImport = (doc2, tr, schema, converter) => {
65889
65951
  const toMark = [];
65890
65952
  const toDelete = [];
65953
+ const toUpdate = [];
65891
65954
  doc2.descendants((node2, pos) => {
65892
65955
  const { type: type2 } = node2;
65893
65956
  const commentNodes = ["commentRangeStart", "commentRangeEnd", "commentReference"];
@@ -65896,8 +65959,9 @@ ${err.toString()}`);
65896
65959
  converter,
65897
65960
  importedId: node2.attrs["w:id"]
65898
65961
  });
65962
+ const isDone = !!matchingImportedComment?.isDone;
65899
65963
  if (type2.name === "commentRangeStart") {
65900
- if (!matchingImportedComment?.isDone) {
65964
+ if (!isDone) {
65901
65965
  toMark.push({
65902
65966
  commentId: resolvedCommentId,
65903
65967
  importedId,
@@ -65911,8 +65975,29 @@ ${err.toString()}`);
65911
65975
  commentId: resolvedCommentId,
65912
65976
  importedId
65913
65977
  });
65914
- toDelete.push({ start: pos, end: pos + 1 });
65978
+ if (isDone) {
65979
+ toUpdate.push({
65980
+ pos,
65981
+ attrs: {
65982
+ ...node2.attrs,
65983
+ "w:id": resolvedCommentId,
65984
+ internal
65985
+ }
65986
+ });
65987
+ } else {
65988
+ toDelete.push({ start: pos, end: pos + 1 });
65989
+ }
65915
65990
  } else if (type2.name === "commentRangeEnd") {
65991
+ if (isDone) {
65992
+ toUpdate.push({
65993
+ pos,
65994
+ attrs: {
65995
+ ...node2.attrs,
65996
+ "w:id": resolvedCommentId
65997
+ }
65998
+ });
65999
+ return;
66000
+ }
65916
66001
  const itemToMark = toMark.find((p2) => p2.importedId === importedId);
65917
66002
  if (!itemToMark) return;
65918
66003
  const { start: start2 } = itemToMark;
@@ -65927,6 +66012,11 @@ ${err.toString()}`);
65927
66012
  toDelete.push({ start: pos, end: pos + 1 });
65928
66013
  }
65929
66014
  });
66015
+ if (typeof tr.setNodeMarkup === "function") {
66016
+ toUpdate.sort((a2, b2) => b2.pos - a2.pos).forEach(({ pos, attrs }) => {
66017
+ tr.setNodeMarkup(pos, void 0, attrs);
66018
+ });
66019
+ }
65930
66020
  toDelete.sort((a2, b2) => b2.start - a2.start).forEach(({ start: start2, end: end2 }) => {
65931
66021
  tr.delete(start2, end2);
65932
66022
  });
@@ -66120,7 +66210,7 @@ ${err.toString()}`);
66120
66210
  },
66121
66211
  resolveComment: ({ commentId }) => ({ tr, dispatch, state: state2 }) => {
66122
66212
  tr.setMeta(CommentsPluginKey, { event: "update" });
66123
- removeCommentsById({ commentId, state: state2, tr, dispatch });
66213
+ return resolveCommentById({ commentId, state: state2, tr, dispatch });
66124
66214
  },
66125
66215
  setCursorById: (id) => ({ state: state2, editor }) => {
66126
66216
  const { from: from2 } = findRangeById(state2.doc, id) || {};
@@ -68426,7 +68516,7 @@ ${err.toString()}`);
68426
68516
  const shouldSkipNodeView = (editor) => {
68427
68517
  return isHeadless(editor);
68428
68518
  };
68429
- const summaryVersion = "2.0.0-next.13";
68519
+ const summaryVersion = "2.0.0-next.14";
68430
68520
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
68431
68521
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
68432
68522
  function mapAttributes(attrs) {
@@ -69215,7 +69305,7 @@ ${err.toString()}`);
69215
69305
  { default: remarkStringify2 },
69216
69306
  { default: remarkGfm2 }
69217
69307
  ] = await Promise.all([
69218
- Promise.resolve().then(() => indexBh0gd0Pm),
69308
+ Promise.resolve().then(() => indexCIGMPabO),
69219
69309
  Promise.resolve().then(() => indexDRCvimau),
69220
69310
  Promise.resolve().then(() => indexC_x_N6Uh),
69221
69311
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -69420,7 +69510,7 @@ ${err.toString()}`);
69420
69510
  * Process collaboration migrations
69421
69511
  */
69422
69512
  processCollaborationMigrations() {
69423
- console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.13");
69513
+ console.debug("[checkVersionMigrations] Current editor version", "2.0.0-next.14");
69424
69514
  if (!this.options.ydoc) return;
69425
69515
  const metaMap = this.options.ydoc.getMap("meta");
69426
69516
  let docVersion = metaMap.get("version");
@@ -157870,7 +157960,7 @@ ${style2}
157870
157960
  this.config.colors = shuffleArray(this.config.colors);
157871
157961
  this.userColorMap = /* @__PURE__ */ new Map();
157872
157962
  this.colorIndex = 0;
157873
- this.version = "2.0.0-next.13";
157963
+ this.version = "2.0.0-next.14";
157874
157964
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
157875
157965
  this.superdocId = config2.superdocId || v4();
157876
157966
  this.colors = this.config.colors;
@@ -160343,7 +160433,7 @@ ${style2}
160343
160433
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
160344
160434
  );
160345
160435
  }
160346
- const indexBh0gd0Pm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
160436
+ const indexCIGMPabO = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
160347
160437
  __proto__: null,
160348
160438
  unified
160349
160439
  }, Symbol.toStringTag, { value: "Module" }));