@harbour-enterprises/superdoc 1.3.0-next.12 → 1.3.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.
@@ -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.12") {
36438
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.3.0-next.14") {
36439
36439
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
36440
36440
  }
36441
36441
  /**
@@ -62245,7 +62245,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62245
62245
  return false;
62246
62246
  }
62247
62247
  };
62248
- const summaryVersion = "1.3.0-next.12";
62248
+ const summaryVersion = "1.3.0-next.14";
62249
62249
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
62250
62250
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
62251
62251
  function mapAttributes(attrs) {
@@ -64878,7 +64878,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64878
64878
  * Process collaboration migrations
64879
64879
  */
64880
64880
  processCollaborationMigrations() {
64881
- console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.12");
64881
+ console.debug("[checkVersionMigrations] Current editor version", "1.3.0-next.14");
64882
64882
  if (!this.options.ydoc) return;
64883
64883
  const metaMap = this.options.ydoc.getMap("meta");
64884
64884
  let docVersion = metaMap.get("version");
@@ -95485,10 +95485,13 @@ ${l}
95485
95485
  };
95486
95486
  }
95487
95487
  const originX = currentLine.width;
95488
- const { target, nextIndex, stop } = getNextTabStopPx(currentLine.width, tabStops, tabStopCursor);
95488
+ const effectiveIndent = lines.length === 0 ? indentLeft + rawFirstLineOffset : indentLeft;
95489
+ const absCurrentX = currentLine.width + effectiveIndent;
95490
+ const { target, nextIndex, stop } = getNextTabStopPx(absCurrentX, tabStops, tabStopCursor);
95489
95491
  tabStopCursor = nextIndex;
95490
- const clampedTarget = Math.min(target, currentLine.maxWidth);
95491
- const tabAdvance = Math.max(0, clampedTarget - currentLine.width);
95492
+ const maxAbsWidth = currentLine.maxWidth + effectiveIndent;
95493
+ const clampedTarget = Math.min(target, maxAbsWidth);
95494
+ const tabAdvance = Math.max(0, clampedTarget - absCurrentX);
95492
95495
  currentLine.width = roundValue(currentLine.width + tabAdvance);
95493
95496
  run2.width = tabAdvance;
95494
95497
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, 12);
@@ -95496,8 +95499,9 @@ ${l}
95496
95499
  currentLine.toChar = 1;
95497
95500
  if (stop && stop.leader && stop.leader !== "none") {
95498
95501
  const leaderStyle = stop.leader;
95499
- const from2 = Math.min(originX, clampedTarget);
95500
- const to = Math.max(originX, clampedTarget);
95502
+ const relativeTarget = clampedTarget - effectiveIndent;
95503
+ const from2 = Math.min(originX, relativeTarget);
95504
+ const to = Math.max(originX, relativeTarget);
95501
95505
  if (!currentLine.leaders) currentLine.leaders = [];
95502
95506
  currentLine.leaders.push({ from: from2, to, style: leaderStyle });
95503
95507
  }
@@ -95506,27 +95510,28 @@ ${l}
95506
95510
  if (stop.val === "end" || stop.val === "center" || stop.val === "decimal") {
95507
95511
  const groupMeasure = measureTabAlignmentGroup(runIndex + 1, runsToProcess, ctx2, decimalSeparator);
95508
95512
  if (groupMeasure.totalWidth > 0) {
95513
+ const relativeTarget = clampedTarget - effectiveIndent;
95509
95514
  let groupStartX;
95510
95515
  if (stop.val === "end") {
95511
- groupStartX = Math.max(0, clampedTarget - groupMeasure.totalWidth);
95516
+ groupStartX = Math.max(0, relativeTarget - groupMeasure.totalWidth);
95512
95517
  } else if (stop.val === "center") {
95513
- groupStartX = Math.max(0, clampedTarget - groupMeasure.totalWidth / 2);
95518
+ groupStartX = Math.max(0, relativeTarget - groupMeasure.totalWidth / 2);
95514
95519
  } else {
95515
95520
  const beforeDecimal = groupMeasure.beforeDecimalWidth ?? groupMeasure.totalWidth;
95516
- groupStartX = Math.max(0, clampedTarget - beforeDecimal);
95521
+ groupStartX = Math.max(0, relativeTarget - beforeDecimal);
95517
95522
  }
95518
95523
  activeTabGroup = {
95519
95524
  measure: groupMeasure,
95520
95525
  startX: groupStartX,
95521
95526
  currentX: groupStartX,
95522
- target: clampedTarget,
95527
+ target: relativeTarget,
95523
95528
  val: stop.val
95524
95529
  };
95525
95530
  currentLine.width = roundValue(groupStartX);
95526
95531
  }
95527
95532
  pendingTabAlignment = null;
95528
95533
  } else {
95529
- pendingTabAlignment = { target: clampedTarget, val: stop.val };
95534
+ pendingTabAlignment = { target: clampedTarget - effectiveIndent, val: stop.val };
95530
95535
  }
95531
95536
  } else {
95532
95537
  pendingTabAlignment = null;
@@ -96167,10 +96172,13 @@ ${l}
96167
96172
  };
96168
96173
  }
96169
96174
  const originX = currentLine.width;
96170
- const { target, nextIndex, stop } = getNextTabStopPx(currentLine.width, tabStops, tabStopCursor);
96175
+ const effectiveIndent = lines.length === 0 ? indentLeft + rawFirstLineOffset : indentLeft;
96176
+ const absCurrentX = currentLine.width + effectiveIndent;
96177
+ const { target, nextIndex, stop } = getNextTabStopPx(absCurrentX, tabStops, tabStopCursor);
96171
96178
  tabStopCursor = nextIndex;
96172
- const clampedTarget = Math.min(target, currentLine.maxWidth);
96173
- const tabAdvance = Math.max(0, clampedTarget - currentLine.width);
96179
+ const maxAbsWidth = currentLine.maxWidth + effectiveIndent;
96180
+ const clampedTarget = Math.min(target, maxAbsWidth);
96181
+ const tabAdvance = Math.max(0, clampedTarget - absCurrentX);
96174
96182
  currentLine.width = roundValue(currentLine.width + tabAdvance);
96175
96183
  currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
96176
96184
  currentLine.maxFontSize = Math.max(currentLine.maxFontSize, run2.fontSize);
@@ -96179,14 +96187,15 @@ ${l}
96179
96187
  charPosInRun += 1;
96180
96188
  if (stop) {
96181
96189
  validateTabStopVal(stop);
96182
- pendingTabAlignment = { target: clampedTarget, val: stop.val };
96190
+ pendingTabAlignment = { target: clampedTarget - effectiveIndent, val: stop.val };
96183
96191
  } else {
96184
96192
  pendingTabAlignment = null;
96185
96193
  }
96186
96194
  if (stop && stop.leader && stop.leader !== "none" && stop.leader !== "middleDot") {
96187
96195
  const leaderStyle = stop.leader;
96188
- const from2 = Math.min(originX, clampedTarget);
96189
- const to = Math.max(originX, clampedTarget);
96196
+ const relativeTarget = clampedTarget - effectiveIndent;
96197
+ const from2 = Math.min(originX, relativeTarget);
96198
+ const to = Math.max(originX, relativeTarget);
96190
96199
  if (!currentLine.leaders) currentLine.leaders = [];
96191
96200
  currentLine.leaders.push({ from: from2, to, style: leaderStyle });
96192
96201
  }
@@ -101543,7 +101552,7 @@ ${l}
101543
101552
  const zoom = this.#layoutOptions.zoom ?? 1;
101544
101553
  const layoutMode = this.#layoutOptions.layoutMode ?? "vertical";
101545
101554
  const pages = this.#layoutState.layout?.pages;
101546
- const pageGap = this.#layoutState.layout?.pageGap ?? this.#getEffectivePageGap();
101555
+ const pageGap = this.#getEffectivePageGap();
101547
101556
  const defaultWidth = this.#layoutOptions.pageSize?.w ?? DEFAULT_PAGE_SIZE.w;
101548
101557
  const defaultHeight = this.#layoutOptions.pageSize?.h ?? DEFAULT_PAGE_SIZE.h;
101549
101558
  let maxWidth = defaultWidth;
@@ -105309,12 +105318,18 @@ ${l}
105309
105318
  return null;
105310
105319
  }
105311
105320
  function extractParagraphContext(node2, startPos, helpers2, depth = 0) {
105312
- const paragraphProperties = getResolvedParagraphProperties(node2) ?? {};
105321
+ const paragraphProperties = getResolvedParagraphProperties(node2) ?? node2.attrs?.paragraphProperties ?? {};
105313
105322
  const alignmentAliases = { left: "start", right: "end" };
105314
105323
  let tabStops = [];
105315
105324
  if (Array.isArray(paragraphProperties.tabStops)) {
105316
105325
  tabStops = paragraphProperties.tabStops.map((stop) => {
105317
105326
  const ref2 = stop?.tab;
105327
+ if (!ref2 && stop?.pos != null) {
105328
+ return {
105329
+ ...stop,
105330
+ pos: twipsToPixels(Number(stop.pos) || 0)
105331
+ };
105332
+ }
105318
105333
  if (!ref2) return stop || null;
105319
105334
  const rawType = ref2.tabType || "start";
105320
105335
  const mappedVal = alignmentAliases[rawType] || rawType;
@@ -106580,6 +106595,13 @@ ${l}
106580
106595
  pos: entry.pos,
106581
106596
  nodeSize: node2.nodeSize
106582
106597
  });
106598
+ } else if (node2.type.name === "lineBreak" || node2.type.name === "hardBreak") {
106599
+ spans.push({
106600
+ type: node2.type.name,
106601
+ spanId,
106602
+ pos: entry.pos,
106603
+ nodeSize: node2.nodeSize
106604
+ });
106583
106605
  } else if (node2.type.name === "text") {
106584
106606
  spans.push({
106585
106607
  type: "text",
@@ -106629,6 +106651,7 @@ ${l}
106629
106651
  paragraphNode
106630
106652
  } = request;
106631
106653
  const tabs = {};
106654
+ const leftIndentPx = request.indents?.left ?? 0;
106632
106655
  let currentX = indentWidth;
106633
106656
  const measureText2 = (span) => {
106634
106657
  if (view && typeof span.from === "number" && typeof span.to === "number") {
@@ -106641,6 +106664,8 @@ ${l}
106641
106664
  const span = spans[i2];
106642
106665
  if (span.type === "text") {
106643
106666
  currentX += measureText2(span);
106667
+ } else if (span.type === "lineBreak" || span.type === "hardBreak") {
106668
+ currentX = leftIndentPx;
106644
106669
  } else if (span.type === "tab") {
106645
106670
  const followingText = collectFollowingText(spans, i2 + 1);
106646
106671
  let measureTextCallback;
@@ -106736,7 +106761,7 @@ ${l}
106736
106761
  let text2 = "";
106737
106762
  for (let i2 = startIndex; i2 < spans.length; i2++) {
106738
106763
  const span = spans[i2];
106739
- if (span.type === "tab") break;
106764
+ if (span.type === "tab" || span.type === "lineBreak" || span.type === "hardBreak") break;
106740
106765
  if (span.type === "text") text2 += span.text || "";
106741
106766
  }
106742
106767
  return text2;
@@ -106746,7 +106771,7 @@ ${l}
106746
106771
  let to = null;
106747
106772
  for (let i2 = startIndex; i2 < spans.length; i2++) {
106748
106773
  const span = spans[i2];
106749
- if (span.type === "tab") break;
106774
+ if (span.type === "tab" || span.type === "lineBreak" || span.type === "hardBreak") break;
106750
106775
  if (span.type === "text" && typeof span.from === "number" && typeof span.to === "number") {
106751
106776
  if (from2 === null) from2 = span.from;
106752
106777
  to = span.to;
@@ -125735,7 +125760,7 @@ ${style2}
125735
125760
  };
125736
125761
  return ResizeObserverController2;
125737
125762
  })();
125738
- var ResizeObserver = (function() {
125763
+ var ResizeObserver$1 = (function() {
125739
125764
  function ResizeObserver2(callback) {
125740
125765
  if (arguments.length === 0) {
125741
125766
  throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
@@ -125774,7 +125799,7 @@ ${style2}
125774
125799
  class ResizeObserverDelegate {
125775
125800
  constructor() {
125776
125801
  this.handleResize = this.handleResize.bind(this);
125777
- this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver)(this.handleResize);
125802
+ this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver$1)(this.handleResize);
125778
125803
  this.elHandlersMap = /* @__PURE__ */ new Map();
125779
125804
  }
125780
125805
  handleResize(entries) {
@@ -138687,6 +138712,31 @@ ${style2}
138687
138712
  },
138688
138713
  { immediate: true, deep: true }
138689
138714
  );
138715
+ watch(
138716
+ () => props.options?.rulerContainer,
138717
+ () => {
138718
+ nextTick(() => {
138719
+ syncRulerOffset();
138720
+ setupRulerObservers();
138721
+ });
138722
+ },
138723
+ { immediate: true }
138724
+ );
138725
+ watch(
138726
+ rulersVisible,
138727
+ (visible) => {
138728
+ nextTick(() => {
138729
+ if (visible) {
138730
+ syncRulerOffset();
138731
+ setupRulerObservers();
138732
+ } else {
138733
+ rulerHostStyle.value = {};
138734
+ cleanupRulerObservers();
138735
+ }
138736
+ });
138737
+ },
138738
+ { immediate: true }
138739
+ );
138690
138740
  const containerStyle = computed(() => {
138691
138741
  let maxWidth = 8.5 * 96;
138692
138742
  const ed = editor.value;
@@ -138711,6 +138761,71 @@ ${style2}
138711
138761
  minWidth: `${scaledWidth}px`
138712
138762
  };
138713
138763
  });
138764
+ const rulerHostStyle = ref({});
138765
+ const rulerContainerEl = ref(null);
138766
+ let editorResizeObserver = null;
138767
+ let rulerContainerResizeObserver = null;
138768
+ let layoutUpdatedHandler = null;
138769
+ const resolveRulerContainer = () => {
138770
+ const container = props.options?.rulerContainer;
138771
+ if (!container) return null;
138772
+ if (typeof container === "string") {
138773
+ const doc2 = editorWrapper.value?.ownerDocument ?? document;
138774
+ return doc2.querySelector(container);
138775
+ }
138776
+ return container instanceof HTMLElement ? container : null;
138777
+ };
138778
+ const getViewportRect2 = () => {
138779
+ const host = editorWrapper.value;
138780
+ if (!host) return null;
138781
+ const viewport2 = host.querySelector(".presentation-editor__viewport");
138782
+ const target = viewport2 ?? host;
138783
+ return target.getBoundingClientRect();
138784
+ };
138785
+ const syncRulerOffset = () => {
138786
+ if (!rulersVisible.value) {
138787
+ rulerHostStyle.value = {};
138788
+ return;
138789
+ }
138790
+ rulerContainerEl.value = resolveRulerContainer();
138791
+ if (!rulerContainerEl.value) {
138792
+ rulerHostStyle.value = {};
138793
+ return;
138794
+ }
138795
+ const viewportRect = getViewportRect2();
138796
+ if (!viewportRect) return;
138797
+ const hostRect = rulerContainerEl.value.getBoundingClientRect();
138798
+ const paddingLeft = Math.max(0, viewportRect.left - hostRect.left);
138799
+ const paddingRight = Math.max(0, hostRect.right - viewportRect.right);
138800
+ rulerHostStyle.value = {
138801
+ paddingLeft: `${paddingLeft}px`,
138802
+ paddingRight: `${paddingRight}px`
138803
+ };
138804
+ };
138805
+ const cleanupRulerObservers = () => {
138806
+ if (editorResizeObserver) {
138807
+ editorResizeObserver.disconnect();
138808
+ editorResizeObserver = null;
138809
+ }
138810
+ if (rulerContainerResizeObserver) {
138811
+ rulerContainerResizeObserver.disconnect();
138812
+ rulerContainerResizeObserver = null;
138813
+ }
138814
+ };
138815
+ const setupRulerObservers = () => {
138816
+ cleanupRulerObservers();
138817
+ if (typeof ResizeObserver === "undefined") return;
138818
+ const viewportHost = editorWrapper.value;
138819
+ const rulerHost = resolveRulerContainer();
138820
+ if (viewportHost) {
138821
+ editorResizeObserver = new ResizeObserver(() => syncRulerOffset());
138822
+ editorResizeObserver.observe(viewportHost);
138823
+ }
138824
+ if (rulerHost) {
138825
+ rulerContainerResizeObserver = new ResizeObserver(() => syncRulerOffset());
138826
+ rulerContainerResizeObserver.observe(rulerHost);
138827
+ }
138828
+ };
138714
138829
  const message = useMessage();
138715
138830
  const editorWrapper = ref(null);
138716
138831
  const editorElem = ref(null);
@@ -139022,7 +139137,7 @@ ${style2}
139022
139137
  presentationEditor.on("imageDeselected", () => {
139023
139138
  clearSelectedImage();
139024
139139
  });
139025
- presentationEditor.on("layoutUpdated", () => {
139140
+ layoutUpdatedHandler = () => {
139026
139141
  if (imageResizeState.visible && imageResizeState.blockId) {
139027
139142
  const escapedBlockId = CSS.escape(imageResizeState.blockId);
139028
139143
  const newElement = editorElem.value?.querySelector(
@@ -139055,13 +139170,17 @@ ${style2}
139055
139170
  clearSelectedImage();
139056
139171
  }
139057
139172
  }
139058
- });
139173
+ nextTick(() => syncRulerOffset());
139174
+ };
139175
+ presentationEditor.on("layoutUpdated", layoutUpdatedHandler);
139059
139176
  zoomChangeHandler = ({ zoom }) => {
139060
139177
  currentZoom.value = zoom;
139178
+ nextTick(() => syncRulerOffset());
139061
139179
  };
139062
139180
  presentationEditor.on("zoomChange", zoomChangeHandler);
139063
139181
  if (typeof presentationEditor.zoom === "number") {
139064
139182
  currentZoom.value = presentationEditor.zoom;
139183
+ nextTick(() => syncRulerOffset());
139065
139184
  }
139066
139185
  }
139067
139186
  editor.value.on("paginationUpdate", () => {
@@ -139121,6 +139240,11 @@ ${style2}
139121
139240
  onMounted(() => {
139122
139241
  initializeData();
139123
139242
  if (props.options?.suppressSkeletonLoader || !props.options?.collaborationProvider) editorReady.value = true;
139243
+ window.addEventListener("resize", syncRulerOffset, { passive: true });
139244
+ nextTick(() => {
139245
+ syncRulerOffset();
139246
+ setupRulerObservers();
139247
+ });
139124
139248
  });
139125
139249
  const handleMarginClick = (event) => {
139126
139250
  if (event.button !== 0) {
@@ -139151,6 +139275,12 @@ ${style2}
139151
139275
  editor.value.off("zoomChange", zoomChangeHandler);
139152
139276
  zoomChangeHandler = null;
139153
139277
  }
139278
+ if (editor.value instanceof PresentationEditor && layoutUpdatedHandler) {
139279
+ editor.value.off("layoutUpdated", layoutUpdatedHandler);
139280
+ layoutUpdatedHandler = null;
139281
+ }
139282
+ cleanupRulerObservers();
139283
+ window.removeEventListener("resize", syncRulerOffset);
139154
139284
  editor.value?.destroy();
139155
139285
  editor.value = null;
139156
139286
  });
@@ -139162,18 +139292,28 @@ ${style2}
139162
139292
  __props.options.rulerContainer && rulersVisible.value && !!activeEditor.value ? (openBlock(), createBlock(Teleport, {
139163
139293
  key: 0,
139164
139294
  to: __props.options.rulerContainer
139295
+ }, [
139296
+ createBaseVNode("div", {
139297
+ class: "ruler-host",
139298
+ style: normalizeStyle(rulerHostStyle.value)
139299
+ }, [
139300
+ createVNode(Ruler, {
139301
+ class: "ruler superdoc-ruler",
139302
+ editor: activeEditor.value,
139303
+ onMarginChange: handleMarginChange
139304
+ }, null, 8, ["editor"])
139305
+ ], 4)
139306
+ ], 8, ["to"])) : rulersVisible.value && !!activeEditor.value ? (openBlock(), createElementBlock("div", {
139307
+ key: 1,
139308
+ class: "ruler-host",
139309
+ style: normalizeStyle(rulerHostStyle.value)
139165
139310
  }, [
139166
139311
  createVNode(Ruler, {
139167
- class: "ruler superdoc-ruler",
139312
+ class: "ruler",
139168
139313
  editor: activeEditor.value,
139169
139314
  onMarginChange: handleMarginChange
139170
139315
  }, null, 8, ["editor"])
139171
- ], 8, ["to"])) : rulersVisible.value && !!activeEditor.value ? (openBlock(), createBlock(Ruler, {
139172
- key: 1,
139173
- class: "ruler",
139174
- editor: activeEditor.value,
139175
- onMarginChange: handleMarginChange
139176
- }, null, 8, ["editor"])) : createCommentVNode("", true),
139316
+ ], 4)) : createCommentVNode("", true),
139177
139317
  createBaseVNode("div", {
139178
139318
  class: "super-editor",
139179
139319
  ref_key: "editorWrapper",
@@ -139278,7 +139418,7 @@ ${style2}
139278
139418
  };
139279
139419
  }
139280
139420
  });
139281
- const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-3e9da07c"]]);
139421
+ const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-f5c4f915"]]);
139282
139422
  const _hoisted_1$h = ["innerHTML"];
139283
139423
  const _sfc_main$i = {
139284
139424
  __name: "SuperInput",
@@ -143451,6 +143591,7 @@ ${reason}`);
143451
143591
  commentsStore.proxy = proxy;
143452
143592
  const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
143453
143593
  const { uiFontFamily } = useUiFontFamily();
143594
+ const isViewingMode = () => proxy?.$superdoc?.config?.documentMode === "viewing";
143454
143595
  const commentsModuleConfig = computed(() => {
143455
143596
  const config2 = modules.comments;
143456
143597
  if (config2 === false || config2 == null) return null;
@@ -143545,6 +143686,10 @@ ${reason}`);
143545
143686
  const commentsConfig = proxy.$superdoc.config.modules?.comments;
143546
143687
  if (!commentsConfig || commentsConfig === false) return;
143547
143688
  if (!positions || Object.keys(positions).length === 0) return;
143689
+ if (isViewingMode()) {
143690
+ commentsStore.clearEditorCommentPositions?.();
143691
+ return;
143692
+ }
143548
143693
  const mappedPositions = presentationEditor.getCommentBounds(positions, layers.value);
143549
143694
  handleEditorLocationsUpdate(mappedPositions);
143550
143695
  });
@@ -143564,6 +143709,13 @@ ${reason}`);
143564
143709
  const onEditorSelectionChange = ({ editor, transaction }) => {
143565
143710
  if (skipSelectionUpdate.value) {
143566
143711
  skipSelectionUpdate.value = false;
143712
+ if (isViewingMode()) {
143713
+ resetSelection();
143714
+ }
143715
+ return;
143716
+ }
143717
+ if (isViewingMode()) {
143718
+ resetSelection();
143567
143719
  return;
143568
143720
  }
143569
143721
  const { documentId } = editor.options;
@@ -143742,6 +143894,10 @@ ${reason}`);
143742
143894
  const onEditorCommentLocationsUpdate = (doc2, { allCommentIds: activeThreadId, allCommentPositions } = {}) => {
143743
143895
  const commentsConfig = proxy.$superdoc.config.modules?.comments;
143744
143896
  if (!commentsConfig || commentsConfig === false) return;
143897
+ if (isViewingMode()) {
143898
+ commentsStore.clearEditorCommentPositions?.();
143899
+ return;
143900
+ }
143745
143901
  const presentation = PresentationEditor.getInstance(doc2.id);
143746
143902
  if (!presentation) {
143747
143903
  handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
@@ -143797,11 +143953,12 @@ ${reason}`);
143797
143953
  };
143798
143954
  const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
143799
143955
  const showCommentsSidebar = computed(() => {
143956
+ if (isViewingMode()) return false;
143800
143957
  return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
143801
143958
  });
143802
143959
  const showToolsFloatingMenu = computed(() => {
143803
143960
  if (!isCommentsEnabled.value) return false;
143804
- return toolsMenuPosition.top && !getConfig2.value?.readOnly;
143961
+ return selectionPosition.value && toolsMenuPosition.top && !getConfig2.value?.readOnly;
143805
143962
  });
143806
143963
  computed(() => {
143807
143964
  if (!isCommentsEnabled.value) return false;
@@ -143849,6 +144006,10 @@ ${reason}`);
143849
144006
  return style2;
143850
144007
  });
143851
144008
  const handleSelectionChange = (selection) => {
144009
+ if (isViewingMode()) {
144010
+ resetSelection();
144011
+ return;
144012
+ }
143852
144013
  if (!selection.selectionBounds || !isCommentsEnabled.value) return;
143853
144014
  resetSelection();
143854
144015
  const isMobileView = window.matchMedia("(max-width: 768px)").matches;
@@ -143874,12 +144035,14 @@ ${reason}`);
143874
144035
  };
143875
144036
  const resetSelection = () => {
143876
144037
  selectionPosition.value = null;
144038
+ toolsMenuPosition.top = null;
143877
144039
  };
143878
144040
  const updateSelection2 = ({ startX, startY, x: x2, y: y2, source }) => {
143879
144041
  const hasStartCoords = typeof startX === "number" || typeof startY === "number";
143880
144042
  const hasEndCoords = typeof x2 === "number" || typeof y2 === "number";
143881
144043
  if (!hasStartCoords && !hasEndCoords) {
143882
- return selectionPosition.value = null;
144044
+ resetSelection();
144045
+ return;
143883
144046
  }
143884
144047
  if (!selectionPosition.value) {
143885
144048
  if (startY == null || startX == null) return;
@@ -144132,7 +144295,7 @@ ${reason}`);
144132
144295
  };
144133
144296
  }
144134
144297
  };
144135
- const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-1e96f708"]]);
144298
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5196811d"]]);
144136
144299
  const createSuperdocVueApp = () => {
144137
144300
  const app = createApp(App);
144138
144301
  const pinia = createPinia();
@@ -144316,7 +144479,7 @@ ${reason}`);
144316
144479
  this.config.colors = shuffleArray(this.config.colors);
144317
144480
  this.userColorMap = /* @__PURE__ */ new Map();
144318
144481
  this.colorIndex = 0;
144319
- this.version = "1.3.0-next.12";
144482
+ this.version = "1.3.0-next.14";
144320
144483
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
144321
144484
  this.superdocId = config2.superdocId || v4();
144322
144485
  this.colors = this.config.colors;