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

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,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-s5ZqooQe.es.js";
2
- import "./SuperConverter-lLx4GqcF.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-BEA-hKnM.es.js";
2
+ import "./SuperConverter-z20LprsX.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";
@@ -7448,7 +7448,7 @@ const _sfc_main = {
7448
7448
  __name: "SuperDoc",
7449
7449
  emits: ["selection-update"],
7450
7450
  setup(__props, { emit: __emit }) {
7451
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-GBLnj5Yg.es.js"));
7451
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DfR5FJ1X.es.js"));
7452
7452
  const superdocStore = useSuperdocStore();
7453
7453
  const commentsStore = useCommentsStore();
7454
7454
  const {
@@ -7489,6 +7489,7 @@ const _sfc_main = {
7489
7489
  commentsStore.proxy = proxy;
7490
7490
  const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
7491
7491
  const { uiFontFamily } = useUiFontFamily();
7492
+ const isViewingMode = () => proxy?.$superdoc?.config?.documentMode === "viewing";
7492
7493
  const commentsModuleConfig = computed(() => {
7493
7494
  const config = modules.comments;
7494
7495
  if (config === false || config == null) return null;
@@ -7583,6 +7584,10 @@ const _sfc_main = {
7583
7584
  const commentsConfig = proxy.$superdoc.config.modules?.comments;
7584
7585
  if (!commentsConfig || commentsConfig === false) return;
7585
7586
  if (!positions || Object.keys(positions).length === 0) return;
7587
+ if (isViewingMode()) {
7588
+ commentsStore.clearEditorCommentPositions?.();
7589
+ return;
7590
+ }
7586
7591
  const mappedPositions = presentationEditor.getCommentBounds(positions, layers.value);
7587
7592
  handleEditorLocationsUpdate(mappedPositions);
7588
7593
  });
@@ -7602,6 +7607,13 @@ const _sfc_main = {
7602
7607
  const onEditorSelectionChange = ({ editor, transaction }) => {
7603
7608
  if (skipSelectionUpdate.value) {
7604
7609
  skipSelectionUpdate.value = false;
7610
+ if (isViewingMode()) {
7611
+ resetSelection();
7612
+ }
7613
+ return;
7614
+ }
7615
+ if (isViewingMode()) {
7616
+ resetSelection();
7605
7617
  return;
7606
7618
  }
7607
7619
  const { documentId } = editor.options;
@@ -7780,6 +7792,10 @@ const _sfc_main = {
7780
7792
  const onEditorCommentLocationsUpdate = (doc, { allCommentIds: activeThreadId, allCommentPositions } = {}) => {
7781
7793
  const commentsConfig = proxy.$superdoc.config.modules?.comments;
7782
7794
  if (!commentsConfig || commentsConfig === false) return;
7795
+ if (isViewingMode()) {
7796
+ commentsStore.clearEditorCommentPositions?.();
7797
+ return;
7798
+ }
7783
7799
  const presentation = PresentationEditor.getInstance(doc.id);
7784
7800
  if (!presentation) {
7785
7801
  handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
@@ -7835,11 +7851,12 @@ const _sfc_main = {
7835
7851
  };
7836
7852
  const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
7837
7853
  const showCommentsSidebar = computed(() => {
7854
+ if (isViewingMode()) return false;
7838
7855
  return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
7839
7856
  });
7840
7857
  const showToolsFloatingMenu = computed(() => {
7841
7858
  if (!isCommentsEnabled.value) return false;
7842
- return toolsMenuPosition.top && !getConfig.value?.readOnly;
7859
+ return selectionPosition.value && toolsMenuPosition.top && !getConfig.value?.readOnly;
7843
7860
  });
7844
7861
  computed(() => {
7845
7862
  if (!isCommentsEnabled.value) return false;
@@ -7887,6 +7904,10 @@ const _sfc_main = {
7887
7904
  return style2;
7888
7905
  });
7889
7906
  const handleSelectionChange = (selection) => {
7907
+ if (isViewingMode()) {
7908
+ resetSelection();
7909
+ return;
7910
+ }
7890
7911
  if (!selection.selectionBounds || !isCommentsEnabled.value) return;
7891
7912
  resetSelection();
7892
7913
  const isMobileView = window.matchMedia("(max-width: 768px)").matches;
@@ -7912,12 +7933,14 @@ const _sfc_main = {
7912
7933
  };
7913
7934
  const resetSelection = () => {
7914
7935
  selectionPosition.value = null;
7936
+ toolsMenuPosition.top = null;
7915
7937
  };
7916
7938
  const updateSelection = ({ startX, startY, x, y, source }) => {
7917
7939
  const hasStartCoords = typeof startX === "number" || typeof startY === "number";
7918
7940
  const hasEndCoords = typeof x === "number" || typeof y === "number";
7919
7941
  if (!hasStartCoords && !hasEndCoords) {
7920
- return selectionPosition.value = null;
7942
+ resetSelection();
7943
+ return;
7921
7944
  }
7922
7945
  if (!selectionPosition.value) {
7923
7946
  if (startY == null || startX == null) return;
@@ -8170,7 +8193,7 @@ const _sfc_main = {
8170
8193
  };
8171
8194
  }
8172
8195
  };
8173
- const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1e96f708"]]);
8196
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5196811d"]]);
8174
8197
  const createSuperdocVueApp = () => {
8175
8198
  const app = createApp(App);
8176
8199
  const pinia = createPinia();
@@ -8354,7 +8377,7 @@ class SuperDoc extends EventEmitter {
8354
8377
  this.config.colors = shuffleArray(this.config.colors);
8355
8378
  this.userColorMap = /* @__PURE__ */ new Map();
8356
8379
  this.colorIndex = 0;
8357
- this.version = "1.3.0-next.9";
8380
+ this.version = "1.3.0";
8358
8381
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8359
8382
  this.superdocId = config.superdocId || v4();
8360
8383
  this.colors = this.config.colors;