@harbour-enterprises/superdoc 1.8.0-next.1 → 1.8.0-next.2

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.
@@ -1,10 +1,10 @@
1
- import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-BUj9aTuQ.es.js";
2
- import "./SuperConverter-Cv5FYCpa.es.js";
1
+ import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-Ck-OA2Y9.es.js";
3
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
3
  import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
5
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
6
5
  import "./jszip-B1fkPkPJ.es.js";
7
6
  import "./helpers-C8e9wR5l.es.js";
7
+ import "./SuperConverter-Br0Eq-TV.es.js";
8
8
  import { i as inject, a as provide, c as computed, o as onBeforeUnmount, p as process$1, b as onBeforeMount, d as defineComponent, h, t as toRef, T as Transition, e as TransitionGroup, w as watchEffect, r as ref, f as onMounted, g as Teleport, F as Fragment, j as reactive, k as effectScope, m as markRaw, l as toRaw, n as isRef, q as isReactive, s as getCurrentInstance, u as watch, v as unref, x as hasInjectionContext, y as nextTick, z as getCurrentScope, A as onScopeDispose, B as toRefs, C as global, D as shallowRef, E as createElementBlock, G as openBlock, H as toDisplayString, I as createVNode, J as withCtx, K as createBaseVNode, L as normalizeStyle, M as createCommentVNode, N as createBlock, O as withModifiers, P as normalizeClass, Q as resolveDirective, R as withDirectives, S as renderList, U as createApp, V as resolveDynamicComponent, W as defineAsyncComponent } from "./vue-BnBKJwCW.es.js";
9
9
  import "./jszip.min-DCl8qkFO.es.js";
10
10
  import { createZip } from "../super-editor/file-zipper.es.js";
@@ -7535,7 +7535,7 @@ const _sfc_main = {
7535
7535
  __name: "SuperDoc",
7536
7536
  emits: ["selection-update"],
7537
7537
  setup(__props, { emit: __emit }) {
7538
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DCILVrwF.es.js"));
7538
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DQeTXTnR.es.js"));
7539
7539
  const superdocStore = useSuperdocStore();
7540
7540
  const commentsStore = useCommentsStore();
7541
7541
  const {
@@ -7674,9 +7674,6 @@ const _sfc_main = {
7674
7674
  doc.setPresentationEditor(presentationEditor);
7675
7675
  }
7676
7676
  presentationEditor.setContextMenuDisabled?.(proxy.$superdoc.config.disableContextMenu);
7677
- presentationEditor.onTelemetry((telemetryPayload) => {
7678
- proxy.$superdoc.captureLayoutPipelineEvent(telemetryPayload);
7679
- });
7680
7677
  presentationEditor.on("commentPositions", ({ positions }) => {
7681
7678
  const commentsConfig = proxy.$superdoc.config.modules?.comments;
7682
7679
  if (!commentsConfig || commentsConfig === false) return;
@@ -7868,7 +7865,6 @@ const _sfc_main = {
7868
7865
  collaborationProvider: doc.provider || null,
7869
7866
  isNewFile: doc.isNewFile || false,
7870
7867
  handleImageUpload: proxy.$superdoc.config.handleImageUpload,
7871
- telemetry: proxy.$superdoc.telemetry,
7872
7868
  externalExtensions: proxy.$superdoc.config.editorExtensions || [],
7873
7869
  suppressDefaultDocxStyles: proxy.$superdoc.config.suppressDefaultDocxStyles,
7874
7870
  disableContextMenu: proxy.$superdoc.config.disableContextMenu,
@@ -8292,7 +8288,7 @@ const _sfc_main = {
8292
8288
  };
8293
8289
  }
8294
8290
  };
8295
- const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-78737564"]]);
8291
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b35b3325"]]);
8296
8292
  const createSuperdocVueApp = () => {
8297
8293
  const app = createApp(App);
8298
8294
  const pinia = createPinia();
@@ -8409,8 +8405,6 @@ class SuperDoc extends EventEmitter {
8409
8405
  // UI font for SuperDoc surfaces (toolbar, comments UI, etc.)
8410
8406
  uiDisplayFallbackFont: "Arial, Helvetica, sans-serif",
8411
8407
  isDev: false,
8412
- // telemetry config
8413
- telemetry: null,
8414
8408
  // Events
8415
8409
  onEditorBeforeCreate: () => null,
8416
8410
  onEditorCreate: () => null,
@@ -8489,7 +8483,7 @@ class SuperDoc extends EventEmitter {
8489
8483
  this.config.colors = shuffleArray(this.config.colors);
8490
8484
  this.userColorMap = /* @__PURE__ */ new Map();
8491
8485
  this.colorIndex = 0;
8492
- this.version = "1.8.0-next.1";
8486
+ this.version = "1.8.0-next.2";
8493
8487
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8494
8488
  this.superdocId = config.superdocId || v4();
8495
8489
  this.colors = this.config.colors;
@@ -9281,20 +9275,6 @@ class SuperDoc extends EventEmitter {
9281
9275
  this.activeEditor.setHighContrastMode(isHighContrast);
9282
9276
  this.highContrastModeStore.setHighContrastMode(isHighContrast);
9283
9277
  }
9284
- /**
9285
- * Capture layout pipeline events from PresentationEditor
9286
- * Forwards metrics and errors to host callbacks
9287
- * @param {Object} payload - Event payload from PresentationEditor.onTelemetry
9288
- * @param {string} payload.type - Event type: 'layout' or 'error'
9289
- * @param {Object} payload.data - Event data (metrics for layout, error details for error)
9290
- * @returns {void}
9291
- */
9292
- captureLayoutPipelineEvent(payload) {
9293
- this.emit("layout-pipeline", payload);
9294
- if (typeof this.config.onLayoutPipelineEvent === "function") {
9295
- this.config.onLayoutPipelineEvent(payload);
9296
- }
9297
- }
9298
9278
  }
9299
9279
  export {
9300
9280
  DOCX as D,
@@ -1,6 +1,6 @@
1
1
  import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
2
2
  import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
3
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-Cv5FYCpa.es.js";
3
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-Br0Eq-TV.es.js";
4
4
  import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h as h$1, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
5
5
  import "./jszip.min-DCl8qkFO.es.js";
6
6
  import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
@@ -13105,69 +13105,92 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
13105
13105
  }
13106
13106
  return comment.parentCommentId;
13107
13107
  };
13108
- const startNodes = [];
13109
- const endNodes = [];
13110
- const seen = /* @__PURE__ */ new Set();
13111
- const trackedChangeCommentMeta = /* @__PURE__ */ new Map();
13108
+ const commentRanges = /* @__PURE__ */ new Map();
13109
+ const commentTrackedChangeId = /* @__PURE__ */ new Map();
13112
13110
  doc2.descendants((node, pos) => {
13113
13111
  const commentMarks = node.marks?.filter((mark) => mark.type.name === CommentMarkName) || [];
13112
+ if (!commentMarks.length) return;
13113
+ const nodeEnd = pos + node.nodeSize;
13114
+ const trackedChangeMark = node.marks?.find((mark) => TRACK_CHANGE_MARKS$1.includes(mark.type.name));
13115
+ const trackedChangeId = trackedChangeMark?.attrs?.id;
13114
13116
  commentMarks.forEach((commentMark) => {
13115
13117
  const { attrs = {} } = commentMark;
13116
13118
  const { commentId } = attrs;
13117
13119
  if (commentId === "pending") return;
13118
- if (seen.has(commentId)) return;
13119
- const comment = commentMap.get(commentId);
13120
- const parentCommentId = getThreadingParentId(comment);
13121
- const trackedChangeMark = node.marks?.find((mark) => TRACK_CHANGE_MARKS$1.includes(mark.type.name));
13122
- const trackedChangeId = trackedChangeMark?.attrs?.id;
13123
- const trackedSpan = trackedChangeId ? trackedChangeSpanById.get(trackedChangeId) : null;
13124
- if (trackedSpan) {
13125
- trackedChangeCommentMeta.set(commentId, {
13126
- comment,
13127
- parentCommentId,
13128
- trackedChangeId
13120
+ if (!commentRanges.has(commentId)) {
13121
+ commentRanges.set(commentId, {
13122
+ start: pos,
13123
+ end: nodeEnd,
13124
+ attrs
13129
13125
  });
13130
- seen.add(commentId);
13131
- return;
13126
+ } else {
13127
+ const existing = commentRanges.get(commentId);
13128
+ existing.start = Math.min(existing.start, pos);
13129
+ existing.end = Math.max(existing.end, nodeEnd);
13130
+ }
13131
+ if (trackedChangeId && !commentTrackedChangeId.has(commentId)) {
13132
+ commentTrackedChangeId.set(commentId, trackedChangeId);
13132
13133
  }
13133
- seen.add(commentId);
13134
- const commentStartNodeAttrs = getPreparedComment(commentMark.attrs);
13135
- const startNode = schema.nodes.commentRangeStart.create(commentStartNodeAttrs);
13134
+ });
13135
+ });
13136
+ const startNodes = [];
13137
+ const endNodes = [];
13138
+ const seen = /* @__PURE__ */ new Set();
13139
+ const trackedChangeCommentMeta = /* @__PURE__ */ new Map();
13140
+ commentRanges.forEach(({ start: start2, end: end2, attrs }, commentId) => {
13141
+ if (seen.has(commentId)) return;
13142
+ seen.add(commentId);
13143
+ const comment = commentMap.get(commentId);
13144
+ const parentCommentId = getThreadingParentId(comment);
13145
+ const trackedChangeId = commentTrackedChangeId.get(commentId);
13146
+ const trackedSpan = trackedChangeId ? trackedChangeSpanById.get(trackedChangeId) : null;
13147
+ if (trackedSpan) {
13148
+ trackedChangeCommentMeta.set(commentId, {
13149
+ comment,
13150
+ parentCommentId,
13151
+ trackedChangeId
13152
+ });
13153
+ return;
13154
+ }
13155
+ const commentStartNodeAttrs = getPreparedComment(attrs);
13156
+ const startNode = schema.nodes.commentRangeStart.create(commentStartNodeAttrs);
13157
+ startNodes.push({
13158
+ pos: start2,
13159
+ node: startNode,
13160
+ commentId,
13161
+ parentCommentId
13162
+ });
13163
+ const endNode = schema.nodes.commentRangeEnd.create(commentStartNodeAttrs);
13164
+ endNodes.push({
13165
+ pos: end2,
13166
+ node: endNode,
13167
+ commentId,
13168
+ parentCommentId
13169
+ });
13170
+ const childComments = comments.filter((c2) => getThreadingParentId(c2) === commentId).sort((a, b2) => a.createdTime - b2.createdTime);
13171
+ childComments.forEach((c2) => {
13172
+ if (seen.has(c2.commentId)) return;
13173
+ seen.add(c2.commentId);
13174
+ const childRange = commentRanges.get(c2.commentId);
13175
+ const childStart = childRange?.start ?? start2;
13176
+ const childEnd = childRange?.end ?? end2;
13177
+ const childMark = getPreparedComment({
13178
+ commentId: c2.commentId,
13179
+ internal: c2.isInternal
13180
+ });
13181
+ const childStartNode = schema.nodes.commentRangeStart.create(childMark);
13136
13182
  startNodes.push({
13137
- pos,
13138
- node: startNode,
13139
- commentId,
13140
- parentCommentId
13183
+ pos: childStart,
13184
+ node: childStartNode,
13185
+ commentId: c2.commentId,
13186
+ parentCommentId: getThreadingParentId(c2)
13141
13187
  });
13142
- const endNode = schema.nodes.commentRangeEnd.create(commentStartNodeAttrs);
13188
+ const childEndNode = schema.nodes.commentRangeEnd.create(childMark);
13143
13189
  endNodes.push({
13144
- pos: pos + node.nodeSize,
13145
- node: endNode,
13146
- commentId,
13147
- parentCommentId
13148
- });
13149
- const childComments = comments.filter((c2) => getThreadingParentId(c2) === commentId).sort((a, b2) => a.createdTime - b2.createdTime);
13150
- childComments.forEach((c2) => {
13151
- if (seen.has(c2.commentId)) return;
13152
- seen.add(c2.commentId);
13153
- const childMark = getPreparedComment({
13154
- commentId: c2.commentId,
13155
- internal: c2.isInternal
13156
- });
13157
- const childStartNode = schema.nodes.commentRangeStart.create(childMark);
13158
- startNodes.push({
13159
- pos,
13160
- node: childStartNode,
13161
- commentId: c2.commentId,
13162
- parentCommentId: getThreadingParentId(c2)
13163
- });
13164
- const childEndNode = schema.nodes.commentRangeEnd.create(childMark);
13165
- endNodes.push({
13166
- pos: pos + node.nodeSize,
13167
- node: childEndNode,
13168
- commentId: c2.commentId,
13169
- parentCommentId: getThreadingParentId(c2)
13170
- });
13190
+ pos: childEnd,
13191
+ node: childEndNode,
13192
+ commentId: c2.commentId,
13193
+ parentCommentId: getThreadingParentId(c2)
13171
13194
  });
13172
13195
  });
13173
13196
  });
@@ -13197,6 +13220,34 @@ const prepareCommentsForExport = (doc2, tr, schema, comments = []) => {
13197
13220
  commentId: comment.commentId,
13198
13221
  parentCommentId
13199
13222
  });
13223
+ const childComments = comments.filter((c2) => getThreadingParentId(c2) === comment.commentId).sort((a, b2) => a.createdTime - b2.createdTime);
13224
+ childComments.forEach((c2) => {
13225
+ if (seen.has(c2.commentId)) return;
13226
+ seen.add(c2.commentId);
13227
+ const childRange = commentRanges.get(c2.commentId);
13228
+ const childStart = childRange?.start ?? span.startPos;
13229
+ const childEnd = childRange?.end ?? span.endPos;
13230
+ const childStartMarks = childRange ? void 0 : startMarks;
13231
+ const childEndMarks = childRange ? void 0 : endMarks;
13232
+ const childMarkAttrs = getPreparedComment({
13233
+ commentId: c2.commentId,
13234
+ internal: c2.isInternal
13235
+ });
13236
+ const childStartNode2 = schema.nodes.commentRangeStart.create(childMarkAttrs, null, childStartMarks);
13237
+ startNodes.push({
13238
+ pos: childStart,
13239
+ node: childStartNode2,
13240
+ commentId: c2.commentId,
13241
+ parentCommentId: getThreadingParentId(c2)
13242
+ });
13243
+ const childEndNode2 = schema.nodes.commentRangeEnd.create(childMarkAttrs, null, childEndMarks);
13244
+ endNodes.push({
13245
+ pos: childEnd,
13246
+ node: childEndNode2,
13247
+ commentId: c2.commentId,
13248
+ parentCommentId: getThreadingParentId(c2)
13249
+ });
13250
+ });
13200
13251
  });
13201
13252
  comments.filter((comment) => trackedChangeSpanById.has(comment.parentCommentId) && !comment.trackedChange).sort((a, b2) => a.createdTime - b2.createdTime).forEach((comment) => {
13202
13253
  if (seen.has(comment.commentId)) return;
@@ -16034,7 +16085,7 @@ const canUseDOM = () => {
16034
16085
  return false;
16035
16086
  }
16036
16087
  };
16037
- const summaryVersion = "1.8.0-next.1";
16088
+ const summaryVersion = "1.8.0-next.2";
16038
16089
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
16039
16090
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
16040
16091
  function mapAttributes(attrs) {
@@ -16619,8 +16670,6 @@ class Editor extends EventEmitter {
16619
16670
  onFontsResolved: null,
16620
16671
  // async (file) => url;
16621
16672
  handleImageUpload: null,
16622
- // telemetry
16623
- telemetry: null,
16624
16673
  // Docx xml updated by User
16625
16674
  customUpdatedFiles: {},
16626
16675
  isHeaderFooterChanged: false,
@@ -17555,7 +17604,6 @@ class Editor extends EventEmitter {
17555
17604
  media: this.options.mediaFiles,
17556
17605
  fonts: this.options.fonts,
17557
17606
  debug: true,
17558
- telemetry: this.options.telemetry,
17559
17607
  fileSource: this.options.fileSource,
17560
17608
  documentId: this.options.documentId,
17561
17609
  mockWindow: this.options.mockWindow ?? null,
@@ -17804,7 +17852,6 @@ class Editor extends EventEmitter {
17804
17852
  handleClick: this.#handleNodeSelection.bind(this)
17805
17853
  });
17806
17854
  this.createNodeViews();
17807
- this.options.telemetry?.trackUsage?.("editor_initialized", {});
17808
17855
  }
17809
17856
  /**
17810
17857
  * Creates all node views.
@@ -17997,7 +18044,7 @@ class Editor extends EventEmitter {
17997
18044
  this.#dispatchTransaction(tr);
17998
18045
  }
17999
18046
  /**
18000
- * Get document identifier for telemetry (async - may generate hash)
18047
+ * Get document identifier (async - may generate hash)
18001
18048
  */
18002
18049
  async getDocumentIdentifier() {
18003
18050
  return await this.converter?.getDocumentIdentifier() || null;
@@ -18014,17 +18061,6 @@ class Editor extends EventEmitter {
18014
18061
  isDocumentModified() {
18015
18062
  return this.converter?.documentModified || false;
18016
18063
  }
18017
- /**
18018
- * Get telemetry data (async because of lazy hash generation)
18019
- */
18020
- async getTelemetryData() {
18021
- return {
18022
- documentId: await this.getDocumentIdentifier(),
18023
- isModified: this.isDocumentModified(),
18024
- isPermanentId: !!this.converter?.documentGuid,
18025
- version: this.converter?.getSuperdocVersion()
18026
- };
18027
- }
18028
18064
  /**
18029
18065
  * @deprecated use getDocumentGuid instead
18030
18066
  */
@@ -18268,19 +18304,24 @@ class Editor extends EventEmitter {
18268
18304
  commentsType = "external",
18269
18305
  exportJsonOnly = false,
18270
18306
  exportXmlOnly = false,
18271
- comments = [],
18307
+ comments,
18272
18308
  getUpdatedDocs = false,
18273
18309
  fieldsHighlightColor = null
18274
18310
  } = {}) {
18275
18311
  try {
18276
- const json = this.#prepareDocumentForExport(comments);
18312
+ const effectiveComments = comments ?? this.converter.comments ?? [];
18313
+ const preparedComments = effectiveComments.map((comment) => ({
18314
+ ...comment,
18315
+ commentJSON: comment.commentJSON ?? comment.textJson
18316
+ }));
18317
+ const json = this.#prepareDocumentForExport(preparedComments);
18277
18318
  const documentXml = await this.converter.exportToDocx(
18278
18319
  json,
18279
18320
  this.schema,
18280
18321
  this.storage.image.media,
18281
18322
  isFinalDoc,
18282
18323
  commentsType,
18283
- comments,
18324
+ preparedComments,
18284
18325
  this,
18285
18326
  exportJsonOnly,
18286
18327
  fieldsHighlightColor
@@ -18326,7 +18367,7 @@ class Editor extends EventEmitter {
18326
18367
  if (footnotesRelsXml) {
18327
18368
  updatedDocs["word/_rels/footnotes.xml.rels"] = String(footnotesRelsXml);
18328
18369
  }
18329
- if (comments.length) {
18370
+ if (preparedComments.length) {
18330
18371
  const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
18331
18372
  updatedDocs["word/comments.xml"] = String(commentsXml);
18332
18373
  const commentsExtended = this.converter.convertedXml["word/commentsExtended.xml"];
@@ -18365,10 +18406,6 @@ class Editor extends EventEmitter {
18365
18406
  fonts: this.options.fonts,
18366
18407
  isHeadless: this.options.isHeadless
18367
18408
  });
18368
- this.options.telemetry?.trackUsage?.("document_export", {
18369
- documentType: "docx",
18370
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
18371
- });
18372
18409
  return result;
18373
18410
  } catch (error) {
18374
18411
  const err = error instanceof Error ? error : new Error(String(error));
@@ -18705,7 +18742,7 @@ class Editor extends EventEmitter {
18705
18742
  * Process collaboration migrations
18706
18743
  */
18707
18744
  processCollaborationMigrations() {
18708
- console.debug("[checkVersionMigrations] Current editor version", "1.8.0-next.1");
18745
+ console.debug("[checkVersionMigrations] Current editor version", "1.8.0-next.2");
18709
18746
  if (!this.options.ydoc) return;
18710
18747
  const metaMap = this.options.ydoc.getMap("meta");
18711
18748
  let docVersion = metaMap.get("version");
@@ -24372,8 +24409,22 @@ const SDT_CONTAINER_STYLES = `
24372
24409
  const FIELD_ANNOTATION_STYLES = `
24373
24410
  /* Field annotation draggable styles */
24374
24411
  .superdoc-layout .annotation[data-draggable="true"] {
24375
- user-select: none;
24376
- -webkit-user-select: none;
24412
+ user-select: text;
24413
+ }
24414
+
24415
+ .superdoc-layout .annotation::selection,
24416
+ .superdoc-layout .annotation *::selection {
24417
+ background: transparent;
24418
+ }
24419
+
24420
+ .superdoc-layout .annotation::-moz-selection,
24421
+ .superdoc-layout .annotation *::-moz-selection {
24422
+ background: transparent;
24423
+ }
24424
+
24425
+ .superdoc-layout .annotation,
24426
+ .superdoc-layout .annotation * {
24427
+ caret-color: transparent;
24377
24428
  }
24378
24429
 
24379
24430
  .superdoc-layout .annotation[data-draggable="true"]:hover {
@@ -55616,7 +55667,6 @@ class PresentationEditor extends EventEmitter {
55616
55667
  #layoutErrorState = "healthy";
55617
55668
  #errorBanner = null;
55618
55669
  #errorBannerMessage = null;
55619
- #telemetryEmitter = null;
55620
55670
  #renderScheduled = false;
55621
55671
  #pendingDocChange = false;
55622
55672
  #pendingMapping = null;
@@ -55652,6 +55702,7 @@ class PresentationEditor extends EventEmitter {
55652
55702
  #lastClickTime = 0;
55653
55703
  #lastClickPosition = { x: 0, y: 0 };
55654
55704
  #lastSelectedImageBlockId = null;
55705
+ #lastSelectedFieldAnnotation = null;
55655
55706
  // Drag selection state
55656
55707
  #dragAnchor = null;
55657
55708
  #dragAnchorPageIndex = null;
@@ -56389,30 +56440,6 @@ class PresentationEditor extends EventEmitter {
56389
56440
  this.on("layoutError", handler);
56390
56441
  return () => this.off("layoutError", handler);
56391
56442
  }
56392
- /**
56393
- * Attach a telemetry listener to capture layout events/errors.
56394
- * Uses type-safe discriminated union for event handling.
56395
- *
56396
- * @param handler - Callback function receiving telemetry events
56397
- * @returns Unsubscribe function to remove the handler
56398
- *
56399
- * @example
56400
- * ```typescript
56401
- * const unsubscribe = editor.onTelemetry((event) => {
56402
- * if (event.type === 'remoteCursorsRender') {
56403
- * console.log(`Rendered ${event.data.visibleCount} cursors in ${event.data.renderTimeMs}ms`);
56404
- * }
56405
- * });
56406
- * ```
56407
- */
56408
- onTelemetry(handler) {
56409
- this.#telemetryEmitter = handler;
56410
- return () => {
56411
- if (this.#telemetryEmitter === handler) {
56412
- this.#telemetryEmitter = null;
56413
- }
56414
- };
56415
- }
56416
56443
  /**
56417
56444
  * Surface pages for pagination UI consumers.
56418
56445
  */
@@ -58856,9 +58883,6 @@ class PresentationEditor extends EventEmitter {
58856
58883
  this.emit("commentPositions", { positions: commentPositions });
58857
58884
  }
58858
58885
  }
58859
- if (this.#telemetryEmitter && metrics) {
58860
- this.#telemetryEmitter({ type: "layout", data: { layout, blocks, measures, metrics } });
58861
- }
58862
58886
  this.#selectionSync.requestRender({ immediate: true });
58863
58887
  if (this.#remoteCursorManager?.hasRemoteCursors()) {
58864
58888
  this.#scheduleRemoteCursorReRender();
@@ -58957,6 +58981,45 @@ class PresentationEditor extends EventEmitter {
58957
58981
  #scheduleSelectionUpdate(options) {
58958
58982
  this.#selectionSync.requestRender(options);
58959
58983
  }
58984
+ #clearSelectedFieldAnnotationClass() {
58985
+ if (this.#lastSelectedFieldAnnotation?.element?.classList?.contains("ProseMirror-selectednode")) {
58986
+ this.#lastSelectedFieldAnnotation.element.classList.remove("ProseMirror-selectednode");
58987
+ }
58988
+ this.#lastSelectedFieldAnnotation = null;
58989
+ }
58990
+ #setSelectedFieldAnnotationClass(element, pmStart) {
58991
+ if (this.#lastSelectedFieldAnnotation?.element && this.#lastSelectedFieldAnnotation.element !== element) {
58992
+ this.#lastSelectedFieldAnnotation.element.classList.remove("ProseMirror-selectednode");
58993
+ }
58994
+ element.classList.add("ProseMirror-selectednode");
58995
+ this.#lastSelectedFieldAnnotation = { element, pmStart };
58996
+ }
58997
+ #syncSelectedFieldAnnotationClass(selection) {
58998
+ if (!selection || !(selection instanceof NodeSelection)) {
58999
+ this.#clearSelectedFieldAnnotationClass();
59000
+ return;
59001
+ }
59002
+ const node = selection.node;
59003
+ if (!node || node.type?.name !== "fieldAnnotation") {
59004
+ this.#clearSelectedFieldAnnotationClass();
59005
+ return;
59006
+ }
59007
+ if (!this.#painterHost) {
59008
+ this.#clearSelectedFieldAnnotationClass();
59009
+ return;
59010
+ }
59011
+ const pmStart = selection.from;
59012
+ if (this.#lastSelectedFieldAnnotation?.pmStart === pmStart && this.#lastSelectedFieldAnnotation.element) {
59013
+ return;
59014
+ }
59015
+ const selector = `.annotation[data-pm-start="${pmStart}"]`;
59016
+ const element = this.#painterHost.querySelector(selector);
59017
+ if (!element) {
59018
+ this.#clearSelectedFieldAnnotationClass();
59019
+ return;
59020
+ }
59021
+ this.#setSelectedFieldAnnotationClass(element, pmStart);
59022
+ }
58960
59023
  /**
58961
59024
  * Updates the visual cursor/selection overlay to match the current editor selection.
58962
59025
  *
@@ -58986,6 +59049,7 @@ class PresentationEditor extends EventEmitter {
58986
59049
  #updateSelection() {
58987
59050
  const sessionMode = this.#headerFooterSession?.session?.mode ?? "body";
58988
59051
  if (sessionMode !== "body") {
59052
+ this.#clearSelectedFieldAnnotationClass();
58989
59053
  return;
58990
59054
  }
58991
59055
  if (!this.#localSelectionLayer) {
@@ -58993,6 +59057,7 @@ class PresentationEditor extends EventEmitter {
58993
59057
  }
58994
59058
  if (this.#isViewLocked()) {
58995
59059
  try {
59060
+ this.#clearSelectedFieldAnnotationClass();
58996
59061
  this.#localSelectionLayer.innerHTML = "";
58997
59062
  } catch (error) {
58998
59063
  if (process$1.env.NODE_ENV === "development") {
@@ -59006,6 +59071,7 @@ class PresentationEditor extends EventEmitter {
59006
59071
  const selection = editorState?.selection;
59007
59072
  if (!selection) {
59008
59073
  try {
59074
+ this.#clearSelectedFieldAnnotationClass();
59009
59075
  this.#localSelectionLayer.innerHTML = "";
59010
59076
  } catch (error) {
59011
59077
  if (process$1.env.NODE_ENV === "development") {
@@ -59022,6 +59088,7 @@ class PresentationEditor extends EventEmitter {
59022
59088
  if (this.#layoutEpoch < docEpoch) {
59023
59089
  return;
59024
59090
  }
59091
+ this.#syncSelectedFieldAnnotationClass(selection);
59025
59092
  this.#updateSelectionVirtualizationPins({ includeDragBuffer: this.#isDragging });
59026
59093
  if (selection instanceof CellSelection) {
59027
59094
  try {
@@ -59058,7 +59125,8 @@ class PresentationEditor extends EventEmitter {
59058
59125
  }
59059
59126
  try {
59060
59127
  this.#localSelectionLayer.innerHTML = "";
59061
- if (domRects.length > 0) {
59128
+ const isFieldAnnotationSelection = selection instanceof NodeSelection && selection.node?.type?.name === "fieldAnnotation";
59129
+ if (domRects.length > 0 && !isFieldAnnotationSelection) {
59062
59130
  renderSelectionRects({
59063
59131
  localSelectionLayer: this.#localSelectionLayer,
59064
59132
  rects: domRects,
@@ -60573,9 +60641,6 @@ class PresentationEditor extends EventEmitter {
60573
60641
  this.#layoutErrorState = this.#layoutState.layout ? "degraded" : "failed";
60574
60642
  }
60575
60643
  this.emit("layoutError", this.#layoutError);
60576
- if (this.#telemetryEmitter) {
60577
- this.#telemetryEmitter({ type: "error", data: this.#layoutError });
60578
- }
60579
60644
  this.#showLayoutErrorBanner(error);
60580
60645
  }
60581
60646
  #decorateError(error, stage) {
@@ -74948,7 +75013,14 @@ const TrackChanges = Extension.create({
74948
75013
  return commands2.rejectTrackedChangesBetween(from3, to);
74949
75014
  },
74950
75015
  insertTrackedChange: (options = {}) => ({ state, dispatch, editor }) => {
74951
- const { from: from3 = state.selection.from, to = state.selection.to, text = "", user, comment } = options;
75016
+ const {
75017
+ from: from3 = state.selection.from,
75018
+ to = state.selection.to,
75019
+ text = "",
75020
+ user,
75021
+ comment,
75022
+ addToHistory = true
75023
+ } = options;
74952
75024
  const docSize = state.doc.content.size;
74953
75025
  if (from3 < 0 || to > docSize || from3 > to) {
74954
75026
  console.warn("insertTrackedChange: invalid range", { from: from3, to, docSize });
@@ -75020,6 +75092,9 @@ const TrackChanges = Extension.create({
75020
75092
  });
75021
75093
  tr.setMeta(CommentsPluginKey, { type: "force" });
75022
75094
  tr.setMeta("skipTrackChanges", true);
75095
+ if (!addToHistory) {
75096
+ tr.setMeta("addToHistory", false);
75097
+ }
75023
75098
  dispatch(tr);
75024
75099
  if (comment?.trim() && changeId && editor.commands.addCommentReply) {
75025
75100
  editor.commands.addCommentReply({
@@ -93766,6 +93841,12 @@ class SuperToolbar extends EventEmitter$1 {
93766
93841
  const { command: command2 } = item;
93767
93842
  const isMarkToggle = this.isMarkToggle(item);
93768
93843
  const shouldRestoreFocus = Boolean(item?.restoreEditorFocus);
93844
+ const hasArgument = argument !== null && argument !== void 0;
93845
+ const isDropdownOpen = item?.type === "dropdown" && !hasArgument;
93846
+ const isFontCommand = item?.command === "setFontFamily" || item?.command === "setFontSize";
93847
+ if (isDropdownOpen && isFontCommand) {
93848
+ return;
93849
+ }
93769
93850
  if (!wasFocused && isMarkToggle) {
93770
93851
  this.pendingMarkCommands.push({ command: command2, argument, item });
93771
93852
  item?.activate?.();
@@ -97250,7 +97331,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
97250
97331
  if (event.ctrlKey && isMacOS()) {
97251
97332
  return;
97252
97333
  }
97253
- if (event.target.classList.contains("ProseMirror")) return;
97334
+ const target = event.target;
97335
+ if (target?.classList?.contains("ProseMirror")) return;
97336
+ if (target?.closest?.(".presentation-editor, .superdoc-layout")) {
97337
+ return;
97338
+ }
97254
97339
  onMarginClickCursorChange(event, activeEditor.value);
97255
97340
  };
97256
97341
  const handleMarginChange = ({ side, value }) => {
@@ -97415,7 +97500,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
97415
97500
  };
97416
97501
  }
97417
97502
  });
97418
- const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4160d1eb"]]);
97503
+ const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-da20b5ef"]]);
97419
97504
  const _hoisted_1 = ["innerHTML"];
97420
97505
  const _sfc_main = {
97421
97506
  __name: "SuperInput",