@harbour-enterprises/superdoc 1.3.0-next.8 → 1.3.0-next.9

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,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-De9wkgLl.cjs");
4
- const superdoc = require("./index-B2Aynj2f.cjs");
5
- const index = require("./index-DzCJy9Bf.cjs");
4
+ const superdoc = require("./index-Dgo4AYNb.cjs");
5
+ const index = require("./index-CqzJ4gdV.cjs");
6
6
  function self(vars) {
7
7
  const {
8
8
  opacityDisabled,
@@ -1,6 +1,6 @@
1
1
  import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, c as computed, r as ref, f as onMounted, X as onUnmounted, E as createElementBlock, G as openBlock, K as createBaseVNode, M as createCommentVNode, I as createVNode, v as unref } from "./vue-BnBKJwCW.es.js";
2
- import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-U7zpbaq1.es.js";
3
- import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-DoZiv8EQ.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-C0aR6iQ3.es.js";
3
+ import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-s5ZqooQe.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -31008,7 +31008,7 @@ class SuperConverter {
31008
31008
  static getStoredSuperdocVersion(docx) {
31009
31009
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
31010
31010
  }
31011
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.0-next.8") {
31011
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.0-next.9") {
31012
31012
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
31013
31013
  }
31014
31014
  /**
@@ -31007,7 +31007,7 @@ class SuperConverter {
31007
31007
  static getStoredSuperdocVersion(docx) {
31008
31008
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
31009
31009
  }
31010
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.0-next.8") {
31010
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.3.0-next.9") {
31011
31011
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
31012
31012
  }
31013
31013
  /**
@@ -1,5 +1,5 @@
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-DoZiv8EQ.es.js";
2
- import "./SuperConverter-DwLhA2mM.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-s5ZqooQe.es.js";
2
+ import "./SuperConverter-lLx4GqcF.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
5
5
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -5478,6 +5478,9 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
5478
5478
  const handleEditorLocationsUpdate = (allCommentPositions) => {
5479
5479
  editorCommentPositions.value = allCommentPositions || {};
5480
5480
  };
5481
+ const clearEditorCommentPositions = () => {
5482
+ editorCommentPositions.value = {};
5483
+ };
5481
5484
  const getFloatingComments = computed(() => {
5482
5485
  const comments = getGroupedComments.value?.parentComments.filter((c2) => !c2.resolvedTime).filter((c2) => {
5483
5486
  const keys = Object.keys(editorCommentPositions.value);
@@ -5580,6 +5583,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
5580
5583
  processLoadedDocxComments,
5581
5584
  translateCommentsForExport,
5582
5585
  handleEditorLocationsUpdate,
5586
+ clearEditorCommentPositions,
5583
5587
  handleTrackedChangeUpdate
5584
5588
  };
5585
5589
  });
@@ -7444,7 +7448,7 @@ const _sfc_main = {
7444
7448
  __name: "SuperDoc",
7445
7449
  emits: ["selection-update"],
7446
7450
  setup(__props, { emit: __emit }) {
7447
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CjwO2nPe.es.js"));
7451
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-GBLnj5Yg.es.js"));
7448
7452
  const superdocStore = useSuperdocStore();
7449
7453
  const commentsStore = useCommentsStore();
7450
7454
  const {
@@ -8350,7 +8354,7 @@ class SuperDoc extends EventEmitter {
8350
8354
  this.config.colors = shuffleArray(this.config.colors);
8351
8355
  this.userColorMap = /* @__PURE__ */ new Map();
8352
8356
  this.colorIndex = 0;
8353
- this.version = "1.3.0-next.8";
8357
+ this.version = "1.3.0-next.9";
8354
8358
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8355
8359
  this.superdocId = config.superdocId || v4();
8356
8360
  this.colors = this.config.colors;
@@ -8867,7 +8871,8 @@ class SuperDoc extends EventEmitter {
8867
8871
  }
8868
8872
  #setModeViewing() {
8869
8873
  this.toolbar.activeEditor = null;
8870
- this.setTrackedChangesPreferences({ mode: "original", enabled: false });
8874
+ this.setTrackedChangesPreferences({ mode: "original", enabled: true });
8875
+ this.commentsStore?.clearEditorCommentPositions?.();
8871
8876
  this.superdocStore.documents.forEach((doc) => {
8872
8877
  doc.removeComments();
8873
8878
  this.#applyDocumentMode(doc, "viewing");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-C8_CqJxM.cjs");
3
3
  const helpers$1 = require("./helpers-nOdwpmwb.cjs");
4
- const superEditor_converter = require("./SuperConverter-d7nvQrVD.cjs");
4
+ const superEditor_converter = require("./SuperConverter-BuhT_Z5G.cjs");
5
5
  const vue = require("./vue-De9wkgLl.cjs");
6
6
  require("./jszip.min-BPh2MMAa.cjs");
7
7
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
@@ -13219,8 +13219,8 @@ const CommentsPlugin = Extension.create({
13219
13219
  }
13220
13220
  if (!onlyActiveThreadChanged) {
13221
13221
  const positionsChanged = hasPositionsChanged(prevAllCommentPositions, allCommentPositions);
13222
- const hasComments = Object.keys(allCommentPositions).length > 0;
13223
- const shouldEmitPositions = positionsChanged || !hasEverEmitted && hasComments;
13222
+ const hasComments2 = Object.keys(allCommentPositions).length > 0;
13223
+ const shouldEmitPositions = positionsChanged || !hasEverEmitted && hasComments2;
13224
13224
  if (shouldEmitPositions) {
13225
13225
  prevAllCommentPositions = allCommentPositions;
13226
13226
  hasEverEmitted = true;
@@ -15351,7 +15351,7 @@ const canUseDOM = () => {
15351
15351
  return false;
15352
15352
  }
15353
15353
  };
15354
- const summaryVersion = "1.3.0-next.8";
15354
+ const summaryVersion = "1.3.0-next.9";
15355
15355
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15356
15356
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15357
15357
  function mapAttributes(attrs) {
@@ -17984,7 +17984,7 @@ class Editor extends EventEmitter {
17984
17984
  * Process collaboration migrations
17985
17985
  */
17986
17986
  processCollaborationMigrations() {
17987
- console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.8");
17987
+ console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.9");
17988
17988
  if (!this.options.ydoc) return;
17989
17989
  const metaMap = this.options.ydoc.getMap("meta");
17990
17990
  let docVersion = metaMap.get("version");
@@ -28215,7 +28215,9 @@ const deriveBlockVersion = (block) => {
28215
28215
  textRun.pmEnd ?? "",
28216
28216
  textRun.token ?? "",
28217
28217
  // Tracked changes - force re-render when added or removed tracked change
28218
- textRun.trackedChange ? 1 : 0
28218
+ textRun.trackedChange ? 1 : 0,
28219
+ // Comment annotations - force re-render when comments are enabled/disabled
28220
+ textRun.comments?.length ?? 0
28219
28221
  ].join(",");
28220
28222
  }).join("|");
28221
28223
  const attrs = block.attrs;
@@ -34087,6 +34089,9 @@ const hashCellBorders = (borders) => {
34087
34089
  if (borders.left) parts.push(`l:[${hashBorderSpec(borders.left)}]`);
34088
34090
  return parts.join(";");
34089
34091
  };
34092
+ function hasComments$1(run) {
34093
+ return "comments" in run && Array.isArray(run.comments) && run.comments.length > 0;
34094
+ }
34090
34095
  const MAX_CACHE_SIZE$1 = 1e4;
34091
34096
  const BYTES_PER_ENTRY_ESTIMATE = 5e3;
34092
34097
  const hashParagraphFrame = (frame) => {
@@ -34154,6 +34159,7 @@ const hashRuns = (block) => {
34154
34159
  fontFamily2 ? `ff:${fontFamily2}` : "",
34155
34160
  highlight ? `hl:${highlight}` : ""
34156
34161
  ].join("");
34162
+ const commentHash = hasComments$1(run) ? run.comments.map((c2) => `${c2.commentId ?? ""}:${c2.internal ? "1" : "0"}`).join("|") : "";
34157
34163
  let trackedKey = "";
34158
34164
  if (hasTrackedChange(run)) {
34159
34165
  const tc = run.trackedChange;
@@ -34161,7 +34167,8 @@ const hashRuns = (block) => {
34161
34167
  const afterHash = tc.after ? JSON.stringify(tc.after) : "";
34162
34168
  trackedKey = `|tc:${tc.kind ?? ""}:${tc.id ?? ""}:${tc.author ?? ""}:${tc.date ?? ""}:${beforeHash}:${afterHash}`;
34163
34169
  }
34164
- cellHashes.push(`${text}:${marks}${trackedKey}`);
34170
+ const commentKey = commentHash ? `|cm:${commentHash}` : "";
34171
+ cellHashes.push(`${text}:${marks}${trackedKey}${commentKey}`);
34165
34172
  }
34166
34173
  if (paragraphBlock.attrs) {
34167
34174
  const attrs = paragraphBlock.attrs;
@@ -35292,6 +35299,9 @@ function remeasureParagraph(block, maxWidth, firstLineIndent = 0) {
35292
35299
  const totalHeight = lines.reduce((s2, l) => s2 + l.lineHeight, 0);
35293
35300
  return { kind: "paragraph", lines, totalHeight };
35294
35301
  }
35302
+ function hasComments(run) {
35303
+ return "comments" in run && Array.isArray(run.comments) && run.comments.length > 0;
35304
+ }
35295
35305
  const computeDirtyRegions = (previous, next) => {
35296
35306
  const prevMap = new Map(previous.map((block, index2) => [block.id, { block, index: index2 }]));
35297
35307
  const nextMap = new Map(next.map((block, index2) => [block.id, { block, index: index2 }]));
@@ -35352,6 +35362,10 @@ const getTrackedChangeKey = (run) => {
35352
35362
  }
35353
35363
  return "";
35354
35364
  };
35365
+ const getCommentKey = (run) => {
35366
+ if (!hasComments(run)) return "";
35367
+ return run.comments.map((c2) => `${c2.commentId ?? ""}:${c2.internal ? "1" : "0"}`).join("|");
35368
+ };
35355
35369
  const paragraphSpacingEqual = (a, b) => {
35356
35370
  if (a === b) return true;
35357
35371
  if (!a || !b) return !a && !b;
@@ -35433,7 +35447,7 @@ const paragraphBlocksEqual = (a, b) => {
35433
35447
  for (let i = 0; i < a.runs.length; i += 1) {
35434
35448
  const runA = a.runs[i];
35435
35449
  const runB = b.runs[i];
35436
- if (("src" in runA || runA.kind === "lineBreak" || runA.kind === "break" || runA.kind === "fieldAnnotation" ? "" : runA.text) !== ("src" in runB || runB.kind === "lineBreak" || runB.kind === "break" || runB.kind === "fieldAnnotation" ? "" : runB.text) || ("bold" in runA ? runA.bold : false) !== ("bold" in runB ? runB.bold : false) || ("italic" in runA ? runA.italic : false) !== ("italic" in runB ? runB.italic : false) || ("color" in runA ? runA.color : void 0) !== ("color" in runB ? runB.color : void 0) || ("fontSize" in runA ? runA.fontSize : void 0) !== ("fontSize" in runB ? runB.fontSize : void 0) || ("fontFamily" in runA ? runA.fontFamily : void 0) !== ("fontFamily" in runB ? runB.fontFamily : void 0) || ("highlight" in runA ? runA.highlight : void 0) !== ("highlight" in runB ? runB.highlight : void 0) || getTrackedChangeKey(runA) !== getTrackedChangeKey(runB)) {
35450
+ if (("src" in runA || runA.kind === "lineBreak" || runA.kind === "break" || runA.kind === "fieldAnnotation" ? "" : runA.text) !== ("src" in runB || runB.kind === "lineBreak" || runB.kind === "break" || runB.kind === "fieldAnnotation" ? "" : runB.text) || ("bold" in runA ? runA.bold : false) !== ("bold" in runB ? runB.bold : false) || ("italic" in runA ? runA.italic : false) !== ("italic" in runB ? runB.italic : false) || ("color" in runA ? runA.color : void 0) !== ("color" in runB ? runB.color : void 0) || ("fontSize" in runA ? runA.fontSize : void 0) !== ("fontSize" in runB ? runB.fontSize : void 0) || ("fontFamily" in runA ? runA.fontFamily : void 0) !== ("fontFamily" in runB ? runB.fontFamily : void 0) || ("highlight" in runA ? runA.highlight : void 0) !== ("highlight" in runB ? runB.highlight : void 0) || getTrackedChangeKey(runA) !== getTrackedChangeKey(runB) || getCommentKey(runA) !== getCommentKey(runB)) {
35437
35451
  return false;
35438
35452
  }
35439
35453
  }
@@ -40183,7 +40197,7 @@ const resetRunFormatting = (run) => {
40183
40197
  delete run.link;
40184
40198
  delete run.letterSpacing;
40185
40199
  };
40186
- const applyFormatChangeMarks = (run, config, hyperlinkConfig, applyMarksToRun2, themeColors) => {
40200
+ const applyFormatChangeMarks = (run, config, hyperlinkConfig, applyMarksToRun2, themeColors, enableComments = true) => {
40187
40201
  const tracked = run.trackedChange;
40188
40202
  if (!tracked || tracked.kind !== "format") {
40189
40203
  return;
@@ -40208,7 +40222,7 @@ const applyFormatChangeMarks = (run, config, hyperlinkConfig, applyMarksToRun2,
40208
40222
  }
40209
40223
  resetRunFormatting(run);
40210
40224
  try {
40211
- applyMarksToRun2(run, beforeMarks, hyperlinkConfig, themeColors);
40225
+ applyMarksToRun2(run, beforeMarks, hyperlinkConfig, themeColors, void 0, enableComments);
40212
40226
  } catch (error) {
40213
40227
  if (vue.process$1.env.NODE_ENV === "development") {
40214
40228
  console.warn("[PM-Adapter] Error applying format change marks, resetting formatting:", error);
@@ -40216,7 +40230,7 @@ const applyFormatChangeMarks = (run, config, hyperlinkConfig, applyMarksToRun2,
40216
40230
  resetRunFormatting(run);
40217
40231
  }
40218
40232
  };
40219
- const applyTrackedChangesModeToRuns = (runs, config, hyperlinkConfig, applyMarksToRun2, themeColors) => {
40233
+ const applyTrackedChangesModeToRuns = (runs, config, hyperlinkConfig, applyMarksToRun2, themeColors, enableComments = true) => {
40220
40234
  if (!config) {
40221
40235
  return runs;
40222
40236
  }
@@ -40229,7 +40243,7 @@ const applyTrackedChangesModeToRuns = (runs, config, hyperlinkConfig, applyMarks
40229
40243
  } else {
40230
40244
  runs.forEach((run) => {
40231
40245
  if (isTextRun$1(run)) {
40232
- applyFormatChangeMarks(run, config, hyperlinkConfig, applyMarksToRun2, themeColors);
40246
+ applyFormatChangeMarks(run, config, hyperlinkConfig, applyMarksToRun2, themeColors, enableComments);
40233
40247
  }
40234
40248
  });
40235
40249
  }
@@ -40259,7 +40273,14 @@ const applyTrackedChangesModeToRuns = (runs, config, hyperlinkConfig, applyMarks
40259
40273
  } else {
40260
40274
  filtered.forEach((run) => {
40261
40275
  if (isTextRun$1(run)) {
40262
- applyFormatChangeMarks(run, config, hyperlinkConfig || DEFAULT_HYPERLINK_CONFIG$1, applyMarksToRun2, themeColors);
40276
+ applyFormatChangeMarks(
40277
+ run,
40278
+ config,
40279
+ hyperlinkConfig || DEFAULT_HYPERLINK_CONFIG$1,
40280
+ applyMarksToRun2,
40281
+ themeColors,
40282
+ enableComments
40283
+ );
40263
40284
  }
40264
40285
  });
40265
40286
  }
@@ -41203,7 +41224,10 @@ const applyTextStyleMark = (run, attrs, themeColors) => {
41203
41224
  const DEFAULT_HYPERLINK_CONFIG = {
41204
41225
  enableRichHyperlinks: false
41205
41226
  };
41206
- const applyMarksToRun = (run, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors, backgroundColor) => {
41227
+ const applyMarksToRun = (run, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors, backgroundColor, enableComments = true) => {
41228
+ if (!enableComments && "comments" in run && run.comments) {
41229
+ delete run.comments;
41230
+ }
41207
41231
  const isTabRun2 = run.kind === "tab";
41208
41232
  let markSetColor = false;
41209
41233
  marks.forEach((mark) => {
@@ -41250,7 +41274,7 @@ const applyMarksToRun = (run, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG,
41250
41274
  break;
41251
41275
  case "commentMark":
41252
41276
  case "comment": {
41253
- if (!isTabRun2) {
41277
+ if (!isTabRun2 && enableComments) {
41254
41278
  pushCommentAnnotation(run, mark.attrs ?? {});
41255
41279
  }
41256
41280
  break;
@@ -44876,7 +44900,7 @@ const applyInlineRunProperties = (run, runProperties) => {
44876
44900
  run.letterSpacing = twipsToPx$1(runProperties.letterSpacing);
44877
44901
  }
44878
44902
  };
44879
- function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converters, converterContext) {
44903
+ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converters, converterContext, enableComments = true) {
44880
44904
  const baseBlockId = nextBlockId("paragraph");
44881
44905
  const paragraphProps = typeof para.attrs?.paragraphProperties === "object" && para.attrs.paragraphProperties !== null ? para.attrs.paragraphProperties : {};
44882
44906
  const paragraphStyleId = typeof para.attrs?.styleId === "string" && para.attrs.styleId.trim() ? para.attrs.styleId : typeof paragraphProps.styleId === "string" && paragraphProps.styleId.trim() ? paragraphProps.styleId : null;
@@ -45050,7 +45074,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45050
45074
  [...node.marks ?? [], ...inheritedMarks ?? []],
45051
45075
  hyperlinkConfig,
45052
45076
  themeColors,
45053
- converterContext?.backgroundColor
45077
+ converterContext?.backgroundColor,
45078
+ enableComments
45054
45079
  );
45055
45080
  currentRuns.push(run);
45056
45081
  return;
@@ -45112,7 +45137,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45112
45137
  positions,
45113
45138
  defaultFont,
45114
45139
  defaultSize,
45115
- mergedMarks,
45140
+ [],
45141
+ // Empty marks - will be applied after linked styles
45116
45142
  activeSdt,
45117
45143
  hyperlinkConfig,
45118
45144
  themeColors
@@ -45121,6 +45147,14 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45121
45147
  applyRunStyles2(tokenRun, inlineStyleId, activeRunStyleId);
45122
45148
  applyBaseRunDefaults(tokenRun, baseRunDefaults, defaultFont, defaultSize);
45123
45149
  applyInlineRunProperties(tokenRun, activeRunProperties);
45150
+ applyMarksToRun(
45151
+ tokenRun,
45152
+ mergedMarks,
45153
+ hyperlinkConfig,
45154
+ themeColors,
45155
+ converterContext?.backgroundColor,
45156
+ enableComments
45157
+ );
45124
45158
  if (pageRefPos) {
45125
45159
  tokenRun.pmStart = pageRefPos.start;
45126
45160
  tokenRun.pmEnd = pageRefPos.end;
@@ -45194,7 +45228,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45194
45228
  mergedMarks,
45195
45229
  hyperlinkConfig,
45196
45230
  themeColors,
45197
- converterContext?.backgroundColor
45231
+ converterContext?.backgroundColor,
45232
+ enableComments
45198
45233
  );
45199
45234
  }
45200
45235
  console.debug("[token-debug] paragraph-token-run", {
@@ -45393,7 +45428,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45393
45428
  trackedChanges,
45394
45429
  hyperlinkConfig,
45395
45430
  applyMarksToRun,
45396
- themeColors
45431
+ themeColors,
45432
+ enableComments
45397
45433
  );
45398
45434
  if (trackedChanges.enabled && filteredRuns.length === 0) {
45399
45435
  return;
@@ -46292,6 +46328,7 @@ function toFlowBlocks(pmDoc, options) {
46292
46328
  const hyperlinkConfig = {
46293
46329
  enableRichHyperlinks: options?.enableRichHyperlinks ?? false
46294
46330
  };
46331
+ const enableComments = options?.enableComments ?? true;
46295
46332
  const themeColors = options?.themeColors;
46296
46333
  const converterContext = options?.converterContext;
46297
46334
  if (!doc2.content) {
@@ -46341,7 +46378,8 @@ function toFlowBlocks(pmDoc, options) {
46341
46378
  bookmarks2,
46342
46379
  hyperlinkConfig2,
46343
46380
  themeColorsParam ?? themeColors,
46344
- converterCtx ?? converterContext
46381
+ converterCtx ?? converterContext,
46382
+ enableComments
46345
46383
  );
46346
46384
  const tableConverter = (node, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
46347
46385
  node,
@@ -46380,6 +46418,7 @@ function toFlowBlocks(pmDoc, options) {
46380
46418
  listCounterContext: { getListCounter, incrementListCounter, resetListCounter },
46381
46419
  trackedChangesConfig,
46382
46420
  hyperlinkConfig,
46421
+ enableComments,
46383
46422
  bookmarks,
46384
46423
  sectionState: {
46385
46424
  ranges: sectionRanges,
@@ -46448,7 +46487,7 @@ function mergeDropCapParagraphs(blocks) {
46448
46487
  }
46449
46488
  return result;
46450
46489
  }
46451
- function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converterContext) {
46490
+ function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converterContext, enableComments = true) {
46452
46491
  return paragraphToFlowBlocks$1(
46453
46492
  para,
46454
46493
  nextBlockId,
@@ -46495,7 +46534,8 @@ function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaul
46495
46534
  }
46496
46535
  )
46497
46536
  },
46498
- converterContext
46537
+ converterContext,
46538
+ enableComments
46499
46539
  );
46500
46540
  }
46501
46541
  function tableNodeToBlock(node, nextBlockId, positions, defaultFont, defaultSize, styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, _paragraphToFlowBlocksParam, converterContext, options) {
@@ -50704,12 +50744,13 @@ class PresentationEditor extends EventEmitter {
50704
50744
  if (!validModes.includes(mode)) {
50705
50745
  throw new TypeError(`[PresentationEditor] Invalid mode "${mode}". Must be one of: ${validModes.join(", ")}`);
50706
50746
  }
50747
+ const modeChanged = this.#documentMode !== mode;
50707
50748
  this.#documentMode = mode;
50708
50749
  this.#editor.setDocumentMode(mode);
50709
50750
  this.#syncDocumentModeClass();
50710
50751
  this.#syncHiddenEditorA11yAttributes();
50711
50752
  const trackedChangesChanged = this.#syncTrackedChangesPreferences();
50712
- if (trackedChangesChanged) {
50753
+ if (modeChanged || trackedChangesChanged) {
50713
50754
  this.#pendingDocChange = true;
50714
50755
  this.#scheduleRerender();
50715
50756
  }
@@ -53114,12 +53155,14 @@ class PresentationEditor extends EventEmitter {
53114
53155
  } : void 0;
53115
53156
  const atomNodeTypes = getAtomNodeTypes(this.#editor?.schema ?? null);
53116
53157
  const positionMap = this.#editor?.state?.doc && docJson ? buildPositionMapFromPmDoc(this.#editor.state.doc, docJson) : null;
53158
+ const commentsEnabled = this.#documentMode !== "viewing";
53117
53159
  const result = toFlowBlocks(docJson, {
53118
53160
  mediaFiles: this.#editor?.storage?.image?.media,
53119
53161
  emitSectionBreaks: true,
53120
53162
  sectionMetadata,
53121
53163
  trackedChangesMode: this.#trackedChangesMode,
53122
53164
  enableTrackedChanges: this.#trackedChangesEnabled,
53165
+ enableComments: commentsEnabled,
53123
53166
  enableRichHyperlinks: true,
53124
53167
  themeColors: this.#editor?.converter?.themeColors ?? void 0,
53125
53168
  converterContext,
@@ -53250,10 +53293,12 @@ class PresentationEditor extends EventEmitter {
53250
53293
  const payload = { layout, blocks, measures, metrics };
53251
53294
  this.emit("layoutUpdated", payload);
53252
53295
  this.emit("paginationUpdate", payload);
53253
- const commentPositions = this.#collectCommentPositions();
53254
- const positionKeys = Object.keys(commentPositions);
53255
- if (positionKeys.length > 0) {
53256
- this.emit("commentPositions", { positions: commentPositions });
53296
+ if (this.#documentMode !== "viewing") {
53297
+ const commentPositions = this.#collectCommentPositions();
53298
+ const positionKeys = Object.keys(commentPositions);
53299
+ if (positionKeys.length > 0) {
53300
+ this.emit("commentPositions", { positions: commentPositions });
53301
+ }
53257
53302
  }
53258
53303
  if (this.#telemetryEmitter && metrics) {
53259
53304
  this.#telemetryEmitter({ type: "layout", data: { layout, blocks, measures, metrics } });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const index = require("./index-DzCJy9Bf.cjs");
3
- require("./SuperConverter-d7nvQrVD.cjs");
2
+ const index = require("./index-CqzJ4gdV.cjs");
3
+ require("./SuperConverter-BuhT_Z5G.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
6
6
  const provider = require("@hocuspocus/provider");
@@ -5495,6 +5495,9 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
5495
5495
  const handleEditorLocationsUpdate = (allCommentPositions) => {
5496
5496
  editorCommentPositions.value = allCommentPositions || {};
5497
5497
  };
5498
+ const clearEditorCommentPositions = () => {
5499
+ editorCommentPositions.value = {};
5500
+ };
5498
5501
  const getFloatingComments = vue.computed(() => {
5499
5502
  const comments = getGroupedComments.value?.parentComments.filter((c) => !c.resolvedTime).filter((c) => {
5500
5503
  const keys = Object.keys(editorCommentPositions.value);
@@ -5597,6 +5600,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
5597
5600
  processLoadedDocxComments,
5598
5601
  translateCommentsForExport,
5599
5602
  handleEditorLocationsUpdate,
5603
+ clearEditorCommentPositions,
5600
5604
  handleTrackedChangeUpdate
5601
5605
  };
5602
5606
  });
@@ -7461,7 +7465,7 @@ const _sfc_main = {
7461
7465
  __name: "SuperDoc",
7462
7466
  emits: ["selection-update"],
7463
7467
  setup(__props, { emit: __emit }) {
7464
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-fF1B6H-9.cjs")));
7468
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-D5wFkJWQ.cjs")));
7465
7469
  const superdocStore = useSuperdocStore();
7466
7470
  const commentsStore = useCommentsStore();
7467
7471
  const {
@@ -8367,7 +8371,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8367
8371
  this.config.colors = shuffleArray(this.config.colors);
8368
8372
  this.userColorMap = /* @__PURE__ */ new Map();
8369
8373
  this.colorIndex = 0;
8370
- this.version = "1.3.0-next.8";
8374
+ this.version = "1.3.0-next.9";
8371
8375
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8372
8376
  this.superdocId = config.superdocId || uuid.v4();
8373
8377
  this.colors = this.config.colors;
@@ -8884,7 +8888,8 @@ class SuperDoc extends eventemitter3.EventEmitter {
8884
8888
  }
8885
8889
  #setModeViewing() {
8886
8890
  this.toolbar.activeEditor = null;
8887
- this.setTrackedChangesPreferences({ mode: "original", enabled: false });
8891
+ this.setTrackedChangesPreferences({ mode: "original", enabled: true });
8892
+ this.commentsStore?.clearEditorCommentPositions?.();
8888
8893
  this.superdocStore.documents.forEach((doc) => {
8889
8894
  doc.removeComments();
8890
8895
  this.#applyDocumentMode(doc, "viewing");