@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.
@@ -36435,7 +36435,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36435
36435
  static getStoredSuperdocVersion(docx) {
36436
36436
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
36437
36437
  }
36438
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.3.0-next.8") {
36438
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.3.0-next.9") {
36439
36439
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
36440
36440
  }
36441
36441
  /**
@@ -49548,8 +49548,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
49548
49548
  }
49549
49549
  if (!onlyActiveThreadChanged) {
49550
49550
  const positionsChanged = hasPositionsChanged(prevAllCommentPositions, allCommentPositions);
49551
- const hasComments = Object.keys(allCommentPositions).length > 0;
49552
- const shouldEmitPositions = positionsChanged || !hasEverEmitted && hasComments;
49551
+ const hasComments2 = Object.keys(allCommentPositions).length > 0;
49552
+ const shouldEmitPositions = positionsChanged || !hasEverEmitted && hasComments2;
49553
49553
  if (shouldEmitPositions) {
49554
49554
  prevAllCommentPositions = allCommentPositions;
49555
49555
  hasEverEmitted = true;
@@ -52857,7 +52857,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
52857
52857
  }
52858
52858
  const xmlJson = JSON.parse(libExports.xml2json(contentTypesXml, null, 2));
52859
52859
  const types2 = xmlJson.elements?.find((el) => el.name === "Types") || {};
52860
- const hasComments = types2.elements?.some(
52860
+ const hasComments2 = types2.elements?.some(
52861
52861
  (el) => el.name === "Override" && el.attributes.PartName === "/word/comments.xml"
52862
52862
  );
52863
52863
  const hasCommentsExtended = types2.elements?.some(
@@ -52877,7 +52877,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
52877
52877
  };
52878
52878
  if (hasFile("word/comments.xml")) {
52879
52879
  const commentsDef = `<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" />`;
52880
- if (!hasComments) typesString += commentsDef;
52880
+ if (!hasComments2) typesString += commentsDef;
52881
52881
  }
52882
52882
  if (hasFile("word/commentsExtended.xml")) {
52883
52883
  const commentsExtendedDef = `<Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml" />`;
@@ -62145,7 +62145,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62145
62145
  return false;
62146
62146
  }
62147
62147
  };
62148
- const summaryVersion = "1.3.0-next.8";
62148
+ const summaryVersion = "1.3.0-next.9";
62149
62149
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
62150
62150
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
62151
62151
  function mapAttributes(attrs) {
@@ -64779,7 +64779,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64779
64779
  * Process collaboration migrations
64780
64780
  */
64781
64781
  processCollaborationMigrations() {
64782
- console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.8");
64782
+ console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.9");
64783
64783
  if (!this.options.ydoc) return;
64784
64784
  const metaMap = this.options.ydoc.getMap("meta");
64785
64785
  let docVersion = metaMap.get("version");
@@ -75012,7 +75012,9 @@ ${l}
75012
75012
  textRun.pmEnd ?? "",
75013
75013
  textRun.token ?? "",
75014
75014
  // Tracked changes - force re-render when added or removed tracked change
75015
- textRun.trackedChange ? 1 : 0
75015
+ textRun.trackedChange ? 1 : 0,
75016
+ // Comment annotations - force re-render when comments are enabled/disabled
75017
+ textRun.comments?.length ?? 0
75016
75018
  ].join(",");
75017
75019
  }).join("|");
75018
75020
  const attrs = block.attrs;
@@ -80883,6 +80885,9 @@ ${l}
80883
80885
  if (borders.left) parts.push(`l:[${hashBorderSpec(borders.left)}]`);
80884
80886
  return parts.join(";");
80885
80887
  };
80888
+ function hasComments$1(run2) {
80889
+ return "comments" in run2 && Array.isArray(run2.comments) && run2.comments.length > 0;
80890
+ }
80886
80891
  const MAX_CACHE_SIZE$1 = 1e4;
80887
80892
  const BYTES_PER_ENTRY_ESTIMATE = 5e3;
80888
80893
  const hashParagraphFrame = (frame) => {
@@ -80950,6 +80955,7 @@ ${l}
80950
80955
  fontFamily2 ? `ff:${fontFamily2}` : "",
80951
80956
  highlight ? `hl:${highlight}` : ""
80952
80957
  ].join("");
80958
+ const commentHash = hasComments$1(run2) ? run2.comments.map((c2) => `${c2.commentId ?? ""}:${c2.internal ? "1" : "0"}`).join("|") : "";
80953
80959
  let trackedKey = "";
80954
80960
  if (hasTrackedChange(run2)) {
80955
80961
  const tc = run2.trackedChange;
@@ -80957,7 +80963,8 @@ ${l}
80957
80963
  const afterHash = tc.after ? JSON.stringify(tc.after) : "";
80958
80964
  trackedKey = `|tc:${tc.kind ?? ""}:${tc.id ?? ""}:${tc.author ?? ""}:${tc.date ?? ""}:${beforeHash}:${afterHash}`;
80959
80965
  }
80960
- cellHashes.push(`${text2}:${marks}${trackedKey}`);
80966
+ const commentKey = commentHash ? `|cm:${commentHash}` : "";
80967
+ cellHashes.push(`${text2}:${marks}${trackedKey}${commentKey}`);
80961
80968
  }
80962
80969
  if (paragraphBlock.attrs) {
80963
80970
  const attrs = paragraphBlock.attrs;
@@ -82089,6 +82096,9 @@ ${l}
82089
82096
  const totalHeight = lines.reduce((s2, l) => s2 + l.lineHeight, 0);
82090
82097
  return { kind: "paragraph", lines, totalHeight };
82091
82098
  }
82099
+ function hasComments(run2) {
82100
+ return "comments" in run2 && Array.isArray(run2.comments) && run2.comments.length > 0;
82101
+ }
82092
82102
  const computeDirtyRegions = (previous2, next2) => {
82093
82103
  const prevMap = new Map(previous2.map((block, index2) => [block.id, { block, index: index2 }]));
82094
82104
  const nextMap = new Map(next2.map((block, index2) => [block.id, { block, index: index2 }]));
@@ -82149,6 +82159,10 @@ ${l}
82149
82159
  }
82150
82160
  return "";
82151
82161
  };
82162
+ const getCommentKey = (run2) => {
82163
+ if (!hasComments(run2)) return "";
82164
+ return run2.comments.map((c2) => `${c2.commentId ?? ""}:${c2.internal ? "1" : "0"}`).join("|");
82165
+ };
82152
82166
  const paragraphSpacingEqual = (a2, b2) => {
82153
82167
  if (a2 === b2) return true;
82154
82168
  if (!a2 || !b2) return !a2 && !b2;
@@ -82230,7 +82244,7 @@ ${l}
82230
82244
  for (let i2 = 0; i2 < a2.runs.length; i2 += 1) {
82231
82245
  const runA = a2.runs[i2];
82232
82246
  const runB = b2.runs[i2];
82233
- 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)) {
82247
+ 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)) {
82234
82248
  return false;
82235
82249
  }
82236
82250
  }
@@ -86972,7 +86986,7 @@ ${l}
86972
86986
  delete run2.link;
86973
86987
  delete run2.letterSpacing;
86974
86988
  };
86975
- const applyFormatChangeMarks = (run2, config2, hyperlinkConfig, applyMarksToRun2, themeColors) => {
86989
+ const applyFormatChangeMarks = (run2, config2, hyperlinkConfig, applyMarksToRun2, themeColors, enableComments = true) => {
86976
86990
  const tracked = run2.trackedChange;
86977
86991
  if (!tracked || tracked.kind !== "format") {
86978
86992
  return;
@@ -86994,12 +87008,12 @@ ${l}
86994
87008
  }
86995
87009
  resetRunFormatting(run2);
86996
87010
  try {
86997
- applyMarksToRun2(run2, beforeMarks, hyperlinkConfig, themeColors);
87011
+ applyMarksToRun2(run2, beforeMarks, hyperlinkConfig, themeColors, void 0, enableComments);
86998
87012
  } catch (error) {
86999
87013
  resetRunFormatting(run2);
87000
87014
  }
87001
87015
  };
87002
- const applyTrackedChangesModeToRuns = (runs2, config2, hyperlinkConfig, applyMarksToRun2, themeColors) => {
87016
+ const applyTrackedChangesModeToRuns = (runs2, config2, hyperlinkConfig, applyMarksToRun2, themeColors, enableComments = true) => {
87003
87017
  if (!config2) {
87004
87018
  return runs2;
87005
87019
  }
@@ -87012,7 +87026,7 @@ ${l}
87012
87026
  } else {
87013
87027
  runs2.forEach((run2) => {
87014
87028
  if (isTextRun$1(run2)) {
87015
- applyFormatChangeMarks(run2, config2, hyperlinkConfig, applyMarksToRun2, themeColors);
87029
+ applyFormatChangeMarks(run2, config2, hyperlinkConfig, applyMarksToRun2, themeColors, enableComments);
87016
87030
  }
87017
87031
  });
87018
87032
  }
@@ -87042,7 +87056,14 @@ ${l}
87042
87056
  } else {
87043
87057
  filtered.forEach((run2) => {
87044
87058
  if (isTextRun$1(run2)) {
87045
- applyFormatChangeMarks(run2, config2, hyperlinkConfig || DEFAULT_HYPERLINK_CONFIG$1, applyMarksToRun2, themeColors);
87059
+ applyFormatChangeMarks(
87060
+ run2,
87061
+ config2,
87062
+ hyperlinkConfig || DEFAULT_HYPERLINK_CONFIG$1,
87063
+ applyMarksToRun2,
87064
+ themeColors,
87065
+ enableComments
87066
+ );
87046
87067
  }
87047
87068
  });
87048
87069
  }
@@ -87953,7 +87974,10 @@ ${l}
87953
87974
  const DEFAULT_HYPERLINK_CONFIG = {
87954
87975
  enableRichHyperlinks: false
87955
87976
  };
87956
- const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors, backgroundColor) => {
87977
+ const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors, backgroundColor, enableComments = true) => {
87978
+ if (!enableComments && "comments" in run2 && run2.comments) {
87979
+ delete run2.comments;
87980
+ }
87957
87981
  const isTabRun2 = run2.kind === "tab";
87958
87982
  let markSetColor = false;
87959
87983
  marks.forEach((mark2) => {
@@ -88000,7 +88024,7 @@ ${l}
88000
88024
  break;
88001
88025
  case "commentMark":
88002
88026
  case "comment": {
88003
- if (!isTabRun2) {
88027
+ if (!isTabRun2 && enableComments) {
88004
88028
  pushCommentAnnotation(run2, mark2.attrs ?? {});
88005
88029
  }
88006
88030
  break;
@@ -91619,7 +91643,7 @@ ${l}
91619
91643
  run2.letterSpacing = twipsToPx$1(runProperties.letterSpacing);
91620
91644
  }
91621
91645
  };
91622
- function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converters, converterContext) {
91646
+ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converters, converterContext, enableComments = true) {
91623
91647
  const baseBlockId = nextBlockId("paragraph");
91624
91648
  const paragraphProps = typeof para.attrs?.paragraphProperties === "object" && para.attrs.paragraphProperties !== null ? para.attrs.paragraphProperties : {};
91625
91649
  const paragraphStyleId = typeof para.attrs?.styleId === "string" && para.attrs.styleId.trim() ? para.attrs.styleId : typeof paragraphProps.styleId === "string" && paragraphProps.styleId.trim() ? paragraphProps.styleId : null;
@@ -91793,7 +91817,8 @@ ${l}
91793
91817
  [...node2.marks ?? [], ...inheritedMarks ?? []],
91794
91818
  hyperlinkConfig,
91795
91819
  themeColors,
91796
- converterContext?.backgroundColor
91820
+ converterContext?.backgroundColor,
91821
+ enableComments
91797
91822
  );
91798
91823
  currentRuns.push(run2);
91799
91824
  return;
@@ -91855,7 +91880,8 @@ ${l}
91855
91880
  positions,
91856
91881
  defaultFont,
91857
91882
  defaultSize,
91858
- mergedMarks,
91883
+ [],
91884
+ // Empty marks - will be applied after linked styles
91859
91885
  activeSdt,
91860
91886
  hyperlinkConfig,
91861
91887
  themeColors
@@ -91864,6 +91890,14 @@ ${l}
91864
91890
  applyRunStyles2(tokenRun, inlineStyleId, activeRunStyleId);
91865
91891
  applyBaseRunDefaults(tokenRun, baseRunDefaults, defaultFont, defaultSize);
91866
91892
  applyInlineRunProperties(tokenRun, activeRunProperties);
91893
+ applyMarksToRun(
91894
+ tokenRun,
91895
+ mergedMarks,
91896
+ hyperlinkConfig,
91897
+ themeColors,
91898
+ converterContext?.backgroundColor,
91899
+ enableComments
91900
+ );
91867
91901
  if (pageRefPos) {
91868
91902
  tokenRun.pmStart = pageRefPos.start;
91869
91903
  tokenRun.pmEnd = pageRefPos.end;
@@ -91937,7 +91971,8 @@ ${l}
91937
91971
  mergedMarks,
91938
91972
  hyperlinkConfig,
91939
91973
  themeColors,
91940
- converterContext?.backgroundColor
91974
+ converterContext?.backgroundColor,
91975
+ enableComments
91941
91976
  );
91942
91977
  }
91943
91978
  console.debug("[token-debug] paragraph-token-run", {
@@ -92136,7 +92171,8 @@ ${l}
92136
92171
  trackedChanges,
92137
92172
  hyperlinkConfig,
92138
92173
  applyMarksToRun,
92139
- themeColors
92174
+ themeColors,
92175
+ enableComments
92140
92176
  );
92141
92177
  if (trackedChanges.enabled && filteredRuns.length === 0) {
92142
92178
  return;
@@ -93035,6 +93071,7 @@ ${l}
93035
93071
  const hyperlinkConfig = {
93036
93072
  enableRichHyperlinks: options?.enableRichHyperlinks ?? false
93037
93073
  };
93074
+ const enableComments = options?.enableComments ?? true;
93038
93075
  const themeColors = options?.themeColors;
93039
93076
  const converterContext = options?.converterContext;
93040
93077
  if (!doc2.content) {
@@ -93084,7 +93121,8 @@ ${l}
93084
93121
  bookmarks2,
93085
93122
  hyperlinkConfig2,
93086
93123
  themeColorsParam ?? themeColors,
93087
- converterCtx ?? converterContext
93124
+ converterCtx ?? converterContext,
93125
+ enableComments
93088
93126
  );
93089
93127
  const tableConverter = (node2, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
93090
93128
  node2,
@@ -93123,6 +93161,7 @@ ${l}
93123
93161
  listCounterContext: { getListCounter, incrementListCounter, resetListCounter },
93124
93162
  trackedChangesConfig,
93125
93163
  hyperlinkConfig,
93164
+ enableComments,
93126
93165
  bookmarks,
93127
93166
  sectionState: {
93128
93167
  ranges: sectionRanges,
@@ -93191,7 +93230,7 @@ ${l}
93191
93230
  }
93192
93231
  return result;
93193
93232
  }
93194
- function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converterContext) {
93233
+ function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, listCounterContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converterContext, enableComments = true) {
93195
93234
  return paragraphToFlowBlocks$1(
93196
93235
  para,
93197
93236
  nextBlockId,
@@ -93238,7 +93277,8 @@ ${l}
93238
93277
  }
93239
93278
  )
93240
93279
  },
93241
- converterContext
93280
+ converterContext,
93281
+ enableComments
93242
93282
  );
93243
93283
  }
93244
93284
  function tableNodeToBlock(node2, nextBlockId, positions, defaultFont, defaultSize, styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, _paragraphToFlowBlocksParam, converterContext, options) {
@@ -97447,12 +97487,13 @@ ${l}
97447
97487
  if (!validModes.includes(mode)) {
97448
97488
  throw new TypeError(`[PresentationEditor] Invalid mode "${mode}". Must be one of: ${validModes.join(", ")}`);
97449
97489
  }
97490
+ const modeChanged = this.#documentMode !== mode;
97450
97491
  this.#documentMode = mode;
97451
97492
  this.#editor.setDocumentMode(mode);
97452
97493
  this.#syncDocumentModeClass();
97453
97494
  this.#syncHiddenEditorA11yAttributes();
97454
97495
  const trackedChangesChanged = this.#syncTrackedChangesPreferences();
97455
- if (trackedChangesChanged) {
97496
+ if (modeChanged || trackedChangesChanged) {
97456
97497
  this.#pendingDocChange = true;
97457
97498
  this.#scheduleRerender();
97458
97499
  }
@@ -99828,12 +99869,14 @@ ${l}
99828
99869
  } : void 0;
99829
99870
  const atomNodeTypes = getAtomNodeTypes(this.#editor?.schema ?? null);
99830
99871
  const positionMap2 = this.#editor?.state?.doc && docJson ? buildPositionMapFromPmDoc(this.#editor.state.doc, docJson) : null;
99872
+ const commentsEnabled = this.#documentMode !== "viewing";
99831
99873
  const result = toFlowBlocks(docJson, {
99832
99874
  mediaFiles: this.#editor?.storage?.image?.media,
99833
99875
  emitSectionBreaks: true,
99834
99876
  sectionMetadata,
99835
99877
  trackedChangesMode: this.#trackedChangesMode,
99836
99878
  enableTrackedChanges: this.#trackedChangesEnabled,
99879
+ enableComments: commentsEnabled,
99837
99880
  enableRichHyperlinks: true,
99838
99881
  themeColors: this.#editor?.converter?.themeColors ?? void 0,
99839
99882
  converterContext,
@@ -99964,10 +100007,12 @@ ${l}
99964
100007
  const payload = { layout, blocks: blocks2, measures, metrics };
99965
100008
  this.emit("layoutUpdated", payload);
99966
100009
  this.emit("paginationUpdate", payload);
99967
- const commentPositions = this.#collectCommentPositions();
99968
- const positionKeys = Object.keys(commentPositions);
99969
- if (positionKeys.length > 0) {
99970
- this.emit("commentPositions", { positions: commentPositions });
100010
+ if (this.#documentMode !== "viewing") {
100011
+ const commentPositions = this.#collectCommentPositions();
100012
+ const positionKeys = Object.keys(commentPositions);
100013
+ if (positionKeys.length > 0) {
100014
+ this.emit("commentPositions", { positions: commentPositions });
100015
+ }
99971
100016
  }
99972
100017
  if (this.#telemetryEmitter && metrics) {
99973
100018
  this.#telemetryEmitter({ type: "layout", data: { layout, blocks: blocks2, measures, metrics } });
@@ -141257,6 +141302,9 @@ ${reason}`);
141257
141302
  const handleEditorLocationsUpdate = (allCommentPositions) => {
141258
141303
  editorCommentPositions.value = allCommentPositions || {};
141259
141304
  };
141305
+ const clearEditorCommentPositions = () => {
141306
+ editorCommentPositions.value = {};
141307
+ };
141260
141308
  const getFloatingComments = computed(() => {
141261
141309
  const comments = getGroupedComments.value?.parentComments.filter((c2) => !c2.resolvedTime).filter((c2) => {
141262
141310
  const keys2 = Object.keys(editorCommentPositions.value);
@@ -141359,6 +141407,7 @@ ${reason}`);
141359
141407
  processLoadedDocxComments,
141360
141408
  translateCommentsForExport,
141361
141409
  handleEditorLocationsUpdate,
141410
+ clearEditorCommentPositions,
141362
141411
  handleTrackedChangeUpdate
141363
141412
  };
141364
141413
  });
@@ -144129,7 +144178,7 @@ ${reason}`);
144129
144178
  this.config.colors = shuffleArray(this.config.colors);
144130
144179
  this.userColorMap = /* @__PURE__ */ new Map();
144131
144180
  this.colorIndex = 0;
144132
- this.version = "1.3.0-next.8";
144181
+ this.version = "1.3.0-next.9";
144133
144182
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
144134
144183
  this.superdocId = config2.superdocId || v4();
144135
144184
  this.colors = this.config.colors;
@@ -144646,7 +144695,8 @@ ${reason}`);
144646
144695
  }
144647
144696
  #setModeViewing() {
144648
144697
  this.toolbar.activeEditor = null;
144649
- this.setTrackedChangesPreferences({ mode: "original", enabled: false });
144698
+ this.setTrackedChangesPreferences({ mode: "original", enabled: true });
144699
+ this.commentsStore?.clearEditorCommentPositions?.();
144650
144700
  this.superdocStore.documents.forEach((doc2) => {
144651
144701
  doc2.removeComments();
144652
144702
  this.#applyDocumentMode(doc2, "viewing");