@harbour-enterprises/superdoc 0.23.0-next.4 → 0.23.0-next.6

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.
Files changed (41) hide show
  1. package/dist/chunks/{PdfViewer-vQ-IdNED.es.js → PdfViewer-BlOezZGN.es.js} +2 -2
  2. package/dist/chunks/{PdfViewer-D9qubRJ_.cjs → PdfViewer-D89-VJvM.cjs} +2 -2
  3. package/dist/chunks/{eventemitter3-CZv6vEhA.es.js → eventemitter3-CR2eBWft.es.js} +1 -1
  4. package/dist/chunks/{eventemitter3-B_kO1Pxm.cjs → eventemitter3-DSRogsNq.cjs} +1 -1
  5. package/dist/chunks/{index-BTv5rNmt.cjs → index-9hY1WuxT.cjs} +30 -13
  6. package/dist/chunks/{index-DGxFKkbG.es.js → index-DTw4eF5D.es.js} +30 -13
  7. package/dist/chunks/{jszip-b7l8QkfH.cjs → jszip-B4LDL19y.cjs} +1 -1
  8. package/dist/chunks/{jszip-B8KIZSNe.es.js → jszip-DAXEPCUv.es.js} +1 -1
  9. package/dist/chunks/{super-editor.es-wyeeDloA.cjs → super-editor.es-C8gNFcB_.cjs} +34 -32
  10. package/dist/chunks/{super-editor.es-DRBPtyog.es.js → super-editor.es-C9Ql0kHS.es.js} +34 -32
  11. package/dist/chunks/{vue-DWle4Cai.cjs → vue-DKMj1I9B.cjs} +39 -42
  12. package/dist/chunks/{vue-CXxsqYcP.es.js → vue-ZWZLQtoU.es.js} +39 -42
  13. package/dist/chunks/xml-js-Bbc0NeKa.es.js +2 -0
  14. package/dist/chunks/xml-js-CWV8R-ek.cjs +3 -0
  15. package/dist/core/SuperDoc.d.ts.map +1 -1
  16. package/dist/core/types/index.d.ts.map +1 -1
  17. package/dist/stores/superdoc-store.d.ts.map +1 -1
  18. package/dist/style.css +31 -27
  19. package/dist/super-editor/ai-writer.es.js +2 -2
  20. package/dist/super-editor/chunks/{converter-BVirrB35.js → converter-ClnqoStR.js} +16 -18
  21. package/dist/super-editor/chunks/{docx-zipper-Cpb9d2an.js → docx-zipper-DC28ucAi.js} +1 -1
  22. package/dist/super-editor/chunks/{editor-CqnpAm6f.js → editor-DLan-MJ6.js} +19 -15
  23. package/dist/super-editor/chunks/{toolbar-DnEbb4lv.js → toolbar-CekMv4Mk.js} +2 -2
  24. package/dist/super-editor/converter.es.js +1 -1
  25. package/dist/super-editor/docx-zipper.es.js +2 -2
  26. package/dist/super-editor/editor.es.js +3 -3
  27. package/dist/super-editor/file-zipper.es.js +1 -1
  28. package/dist/super-editor/src/core/Attribute.d.ts +2 -2
  29. package/dist/super-editor/src/core/Schema.d.ts +2 -2
  30. package/dist/super-editor/style.css +4 -0
  31. package/dist/super-editor/super-editor.es.js +6 -6
  32. package/dist/super-editor/toolbar.es.js +2 -2
  33. package/dist/super-editor.cjs +2 -2
  34. package/dist/super-editor.es.js +2 -2
  35. package/dist/superdoc.cjs +4 -4
  36. package/dist/superdoc.es.js +4 -4
  37. package/dist/superdoc.umd.js +92 -73
  38. package/dist/superdoc.umd.js.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/chunks/xml-js-CX8FH0He.cjs +0 -3
  41. package/dist/chunks/xml-js-D0tLGmKu.es.js +0 -2
@@ -1,5 +1,5 @@
1
- import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-CXxsqYcP.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-DGxFKkbG.es.js";
1
+ import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-ZWZLQtoU.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-DTw4eF5D.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const vue = require("./vue-DWle4Cai.cjs");
4
- const superdoc = require("./index-BTv5rNmt.cjs");
3
+ const vue = require("./vue-DKMj1I9B.cjs");
4
+ const superdoc = require("./index-9hY1WuxT.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-B8KIZSNe.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-DAXEPCUv.es.js";
2
2
  var eventemitter3 = { exports: {} };
3
3
  var hasRequiredEventemitter3;
4
4
  function requireEventemitter3() {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-b7l8QkfH.cjs");
2
+ const jszip = require("./jszip-B4LDL19y.cjs");
3
3
  var eventemitter3 = { exports: {} };
4
4
  var hasRequiredEventemitter3;
5
5
  function requireEventemitter3() {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-wyeeDloA.cjs");
3
- const vue = require("./vue-DWle4Cai.cjs");
4
- const jszip = require("./jszip-b7l8QkfH.cjs");
2
+ const superEditor_es = require("./super-editor.es-C8gNFcB_.cjs");
3
+ const vue = require("./vue-DKMj1I9B.cjs");
4
+ const jszip = require("./jszip-B4LDL19y.cjs");
5
5
  const blankDocx = require("./blank-docx-CPqX9RF5.cjs");
6
- const eventemitter3 = require("./eventemitter3-B_kO1Pxm.cjs");
6
+ const eventemitter3 = require("./eventemitter3-DSRogsNq.cjs");
7
7
  const provider = require("@hocuspocus/provider");
8
8
  const Y = require("yjs");
9
9
  const uuid = require("./uuid-CQzaMNgL.cjs");
@@ -4025,6 +4025,9 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
4025
4025
  documentUsers.value = configUsers || [];
4026
4026
  Object.assign(user, configUser);
4027
4027
  Object.assign(modules, configModules);
4028
+ if (!Object.prototype.hasOwnProperty.call(modules, "comments")) {
4029
+ modules.comments = {};
4030
+ }
4028
4031
  if (!configDocs?.length && !config.modules.collaboration) {
4029
4032
  const newDoc = await getFileObject(blankDocx.BlankDOCX, "blank.docx", DOCX);
4030
4033
  const newDocConfig = {
@@ -17414,7 +17417,7 @@ const _sfc_main = {
17414
17417
  __name: "SuperDoc",
17415
17418
  emits: ["selection-update"],
17416
17419
  setup(__props, { emit: __emit }) {
17417
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-D9qubRJ_.cjs")));
17420
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-D89-VJvM.cjs")));
17418
17421
  const superdocStore = useSuperdocStore();
17419
17422
  const commentsStore = useCommentsStore();
17420
17423
  const {
@@ -17447,6 +17450,11 @@ const _sfc_main = {
17447
17450
  const { proxy } = vue.getCurrentInstance();
17448
17451
  commentsStore.proxy = proxy;
17449
17452
  const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
17453
+ const commentsModuleConfig = vue.computed(() => {
17454
+ const config = modules.comments;
17455
+ if (config === false || config == null) return null;
17456
+ return config;
17457
+ });
17450
17458
  const layers = vue.ref(null);
17451
17459
  const commentsLayer = vue.ref(null);
17452
17460
  const toolsMenuPosition = vue.reactive({ top: null, right: "-25px", zIndex: 101 });
@@ -17594,7 +17602,7 @@ const _sfc_main = {
17594
17602
  rulers: doc.rulers,
17595
17603
  isInternal: proxy.$superdoc.config.isInternal,
17596
17604
  annotations: proxy.$superdoc.config.annotations,
17597
- isCommentsEnabled: proxy.$superdoc.config.modules?.comments,
17605
+ isCommentsEnabled: Boolean(commentsModuleConfig.value),
17598
17606
  isAiEnabled: proxy.$superdoc.config.modules?.ai,
17599
17607
  slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
17600
17608
  onBeforeCreate: onEditorBeforeCreate,
@@ -17625,7 +17633,8 @@ const _sfc_main = {
17625
17633
  return options;
17626
17634
  };
17627
17635
  const onEditorCommentLocationsUpdate = ({ allCommentIds: activeThreadId, allCommentPositions }) => {
17628
- if (!proxy.$superdoc.config.modules?.comments) return;
17636
+ const commentsConfig = proxy.$superdoc.config.modules?.comments;
17637
+ if (!commentsConfig || commentsConfig === false) return;
17629
17638
  handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
17630
17639
  };
17631
17640
  const onEditorCommentsUpdate = (params2 = {}) => {
@@ -17647,7 +17656,7 @@ const _sfc_main = {
17647
17656
  proxy.$superdoc.config.onTransaction({ editor, transaction, duration: duration2 });
17648
17657
  }
17649
17658
  };
17650
- const isCommentsEnabled = vue.computed(() => "comments" in modules);
17659
+ const isCommentsEnabled = vue.computed(() => Boolean(commentsModuleConfig.value));
17651
17660
  const showCommentsSidebar = vue.computed(() => {
17652
17661
  return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
17653
17662
  });
@@ -17657,13 +17666,14 @@ const _sfc_main = {
17657
17666
  });
17658
17667
  vue.computed(() => {
17659
17668
  if (!isCommentsEnabled.value) return false;
17660
- !getConfig?.readOnly && selectionPosition.value;
17669
+ return !getConfig.value?.readOnly && selectionPosition.value;
17661
17670
  });
17662
17671
  vue.watch(showCommentsSidebar, (value) => {
17663
17672
  proxy.$superdoc.broadcastSidebarToggle(value);
17664
17673
  });
17665
17674
  const scrollToComment = (commentId) => {
17666
- if (!proxy.$superdoc.config?.modules?.comments) return;
17675
+ const commentsConfig = proxy.$superdoc.config?.modules?.comments;
17676
+ if (!commentsConfig || commentsConfig === false) return;
17667
17677
  const element = document.querySelector(`[data-thread-id=${commentId}]`);
17668
17678
  if (element) {
17669
17679
  element.scrollIntoView({ behavior: "smooth", block: "start" });
@@ -17671,7 +17681,8 @@ const _sfc_main = {
17671
17681
  }
17672
17682
  };
17673
17683
  vue.onMounted(() => {
17674
- if (isCommentsEnabled.value && !modules.comments.readOnly) {
17684
+ const config = commentsModuleConfig.value;
17685
+ if (config && !config.readOnly) {
17675
17686
  document.addEventListener("mousedown", handleDocumentMouseDown);
17676
17687
  }
17677
17688
  });
@@ -17793,6 +17804,7 @@ const _sfc_main = {
17793
17804
  };
17794
17805
  const shouldShowSelection = vue.computed(() => {
17795
17806
  const config = proxy.$superdoc.config.modules?.comments;
17807
+ if (!config || config === false) return false;
17796
17808
  return !config.readOnly;
17797
17809
  });
17798
17810
  const handleSuperEditorPageMarginsChange = (doc, params2) => {
@@ -17959,7 +17971,7 @@ const _sfc_main = {
17959
17971
  };
17960
17972
  }
17961
17973
  };
17962
- const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3f71b1bf"]]);
17974
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-45f44b6e"]]);
17963
17975
  const createSuperdocVueApp = () => {
17964
17976
  const app = vue.createApp(App);
17965
17977
  const pinia = createPinia();
@@ -18058,6 +18070,10 @@ class SuperDoc extends eventemitter3.EventEmitter {
18058
18070
  ...this.config,
18059
18071
  ...config
18060
18072
  };
18073
+ this.config.modules = this.config.modules || {};
18074
+ if (!Object.prototype.hasOwnProperty.call(this.config.modules, "comments")) {
18075
+ this.config.modules.comments = {};
18076
+ }
18061
18077
  this.config.colors = shuffleArray(this.config.colors);
18062
18078
  this.userColorMap = /* @__PURE__ */ new Map();
18063
18079
  this.colorIndex = 0;
@@ -18192,7 +18208,8 @@ class SuperDoc extends eventemitter3.EventEmitter {
18192
18208
  this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
18193
18209
  }
18194
18210
  this.superdocStore.init(this.config);
18195
- this.commentsStore.init(this.config.modules.comments);
18211
+ const commentsModuleConfig = this.config.modules.comments;
18212
+ this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
18196
18213
  }
18197
18214
  #initListeners() {
18198
18215
  this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
@@ -1,8 +1,8 @@
1
- import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-DRBPtyog.es.js";
2
- import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-CXxsqYcP.es.js";
3
- import { B as Buffer$2 } from "./jszip-B8KIZSNe.es.js";
1
+ import { q as index$1, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-C9Ql0kHS.es.js";
2
+ import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-ZWZLQtoU.es.js";
3
+ import { B as Buffer$2 } from "./jszip-DAXEPCUv.es.js";
4
4
  import { B as BlankDOCX } from "./blank-docx-iwdyG9RH.es.js";
5
- import { E as EventEmitter } from "./eventemitter3-CZv6vEhA.es.js";
5
+ import { E as EventEmitter } from "./eventemitter3-CR2eBWft.es.js";
6
6
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
7
7
  import * as Y from "yjs";
8
8
  import { Doc, Map as Map$2 } from "yjs";
@@ -4008,6 +4008,9 @@ const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
4008
4008
  documentUsers.value = configUsers || [];
4009
4009
  Object.assign(user, configUser);
4010
4010
  Object.assign(modules, configModules);
4011
+ if (!Object.prototype.hasOwnProperty.call(modules, "comments")) {
4012
+ modules.comments = {};
4013
+ }
4011
4014
  if (!configDocs?.length && !config.modules.collaboration) {
4012
4015
  const newDoc = await getFileObject(BlankDOCX, "blank.docx", DOCX);
4013
4016
  const newDocConfig = {
@@ -17397,7 +17400,7 @@ const _sfc_main = {
17397
17400
  __name: "SuperDoc",
17398
17401
  emits: ["selection-update"],
17399
17402
  setup(__props, { emit: __emit }) {
17400
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-vQ-IdNED.es.js"));
17403
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BlOezZGN.es.js"));
17401
17404
  const superdocStore = useSuperdocStore();
17402
17405
  const commentsStore = useCommentsStore();
17403
17406
  const {
@@ -17430,6 +17433,11 @@ const _sfc_main = {
17430
17433
  const { proxy } = getCurrentInstance();
17431
17434
  commentsStore.proxy = proxy;
17432
17435
  const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
17436
+ const commentsModuleConfig = computed(() => {
17437
+ const config = modules.comments;
17438
+ if (config === false || config == null) return null;
17439
+ return config;
17440
+ });
17433
17441
  const layers = ref(null);
17434
17442
  const commentsLayer = ref(null);
17435
17443
  const toolsMenuPosition = reactive({ top: null, right: "-25px", zIndex: 101 });
@@ -17577,7 +17585,7 @@ const _sfc_main = {
17577
17585
  rulers: doc.rulers,
17578
17586
  isInternal: proxy.$superdoc.config.isInternal,
17579
17587
  annotations: proxy.$superdoc.config.annotations,
17580
- isCommentsEnabled: proxy.$superdoc.config.modules?.comments,
17588
+ isCommentsEnabled: Boolean(commentsModuleConfig.value),
17581
17589
  isAiEnabled: proxy.$superdoc.config.modules?.ai,
17582
17590
  slashMenuConfig: proxy.$superdoc.config.modules?.slashMenu,
17583
17591
  onBeforeCreate: onEditorBeforeCreate,
@@ -17608,7 +17616,8 @@ const _sfc_main = {
17608
17616
  return options;
17609
17617
  };
17610
17618
  const onEditorCommentLocationsUpdate = ({ allCommentIds: activeThreadId, allCommentPositions }) => {
17611
- if (!proxy.$superdoc.config.modules?.comments) return;
17619
+ const commentsConfig = proxy.$superdoc.config.modules?.comments;
17620
+ if (!commentsConfig || commentsConfig === false) return;
17612
17621
  handleEditorLocationsUpdate(allCommentPositions, activeThreadId);
17613
17622
  };
17614
17623
  const onEditorCommentsUpdate = (params2 = {}) => {
@@ -17630,7 +17639,7 @@ const _sfc_main = {
17630
17639
  proxy.$superdoc.config.onTransaction({ editor, transaction, duration: duration2 });
17631
17640
  }
17632
17641
  };
17633
- const isCommentsEnabled = computed(() => "comments" in modules);
17642
+ const isCommentsEnabled = computed(() => Boolean(commentsModuleConfig.value));
17634
17643
  const showCommentsSidebar = computed(() => {
17635
17644
  return pendingComment.value || getFloatingComments.value?.length > 0 && isReady.value && layers.value && isCommentsEnabled.value && !isCommentsListVisible.value;
17636
17645
  });
@@ -17640,13 +17649,14 @@ const _sfc_main = {
17640
17649
  });
17641
17650
  computed(() => {
17642
17651
  if (!isCommentsEnabled.value) return false;
17643
- !getConfig?.readOnly && selectionPosition.value;
17652
+ return !getConfig.value?.readOnly && selectionPosition.value;
17644
17653
  });
17645
17654
  watch(showCommentsSidebar, (value) => {
17646
17655
  proxy.$superdoc.broadcastSidebarToggle(value);
17647
17656
  });
17648
17657
  const scrollToComment = (commentId) => {
17649
- if (!proxy.$superdoc.config?.modules?.comments) return;
17658
+ const commentsConfig = proxy.$superdoc.config?.modules?.comments;
17659
+ if (!commentsConfig || commentsConfig === false) return;
17650
17660
  const element = document.querySelector(`[data-thread-id=${commentId}]`);
17651
17661
  if (element) {
17652
17662
  element.scrollIntoView({ behavior: "smooth", block: "start" });
@@ -17654,7 +17664,8 @@ const _sfc_main = {
17654
17664
  }
17655
17665
  };
17656
17666
  onMounted(() => {
17657
- if (isCommentsEnabled.value && !modules.comments.readOnly) {
17667
+ const config = commentsModuleConfig.value;
17668
+ if (config && !config.readOnly) {
17658
17669
  document.addEventListener("mousedown", handleDocumentMouseDown);
17659
17670
  }
17660
17671
  });
@@ -17776,6 +17787,7 @@ const _sfc_main = {
17776
17787
  };
17777
17788
  const shouldShowSelection = computed(() => {
17778
17789
  const config = proxy.$superdoc.config.modules?.comments;
17790
+ if (!config || config === false) return false;
17779
17791
  return !config.readOnly;
17780
17792
  });
17781
17793
  const handleSuperEditorPageMarginsChange = (doc, params2) => {
@@ -17942,7 +17954,7 @@ const _sfc_main = {
17942
17954
  };
17943
17955
  }
17944
17956
  };
17945
- const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3f71b1bf"]]);
17957
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-45f44b6e"]]);
17946
17958
  const createSuperdocVueApp = () => {
17947
17959
  const app = createApp(App);
17948
17960
  const pinia = createPinia();
@@ -18041,6 +18053,10 @@ class SuperDoc extends EventEmitter {
18041
18053
  ...this.config,
18042
18054
  ...config
18043
18055
  };
18056
+ this.config.modules = this.config.modules || {};
18057
+ if (!Object.prototype.hasOwnProperty.call(this.config.modules, "comments")) {
18058
+ this.config.modules.comments = {};
18059
+ }
18044
18060
  this.config.colors = shuffleArray(this.config.colors);
18045
18061
  this.userColorMap = /* @__PURE__ */ new Map();
18046
18062
  this.colorIndex = 0;
@@ -18175,7 +18191,8 @@ class SuperDoc extends EventEmitter {
18175
18191
  this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
18176
18192
  }
18177
18193
  this.superdocStore.init(this.config);
18178
- this.commentsStore.init(this.config.modules.comments);
18194
+ const commentsModuleConfig = this.config.modules.comments;
18195
+ this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
18179
18196
  }
18180
18197
  #initListeners() {
18181
18198
  this.on("editorBeforeCreate", this.config.onEditorBeforeCreate);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- require("./vue-DWle4Cai.cjs");
2
+ require("./vue-DKMj1I9B.cjs");
3
3
  var buffer = {};
4
4
  var base64Js = {};
5
5
  base64Js.byteLength = byteLength;
@@ -1,4 +1,4 @@
1
- import "./vue-CXxsqYcP.es.js";
1
+ import "./vue-ZWZLQtoU.es.js";
2
2
  var buffer = {};
3
3
  var base64Js = {};
4
4
  base64Js.byteLength = byteLength;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const vue = require("./vue-DWle4Cai.cjs");
2
+ const vue = require("./vue-DKMj1I9B.cjs");
3
3
  const Y = require("yjs");
4
4
  function _interopNamespaceDefault(e) {
5
5
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -5111,6 +5111,19 @@ function requireSafeRegexTest() {
5111
5111
  };
5112
5112
  return safeRegexTest;
5113
5113
  }
5114
+ var generatorFunction;
5115
+ var hasRequiredGeneratorFunction;
5116
+ function requireGeneratorFunction() {
5117
+ if (hasRequiredGeneratorFunction) return generatorFunction;
5118
+ hasRequiredGeneratorFunction = 1;
5119
+ const cached = (
5120
+ /** @type {GeneratorFunctionConstructor} */
5121
+ function* () {
5122
+ }.constructor
5123
+ );
5124
+ generatorFunction = () => cached;
5125
+ return generatorFunction;
5126
+ }
5114
5127
  var isGeneratorFunction;
5115
5128
  var hasRequiredIsGeneratorFunction;
5116
5129
  function requireIsGeneratorFunction() {
@@ -5123,16 +5136,7 @@ function requireIsGeneratorFunction() {
5123
5136
  var getProto2 = requireGetProto();
5124
5137
  var toStr = callBound2("Object.prototype.toString");
5125
5138
  var fnToStr = callBound2("Function.prototype.toString");
5126
- var getGeneratorFunc = function() {
5127
- if (!hasToStringTag) {
5128
- return false;
5129
- }
5130
- try {
5131
- return Function("return function*() {}")();
5132
- } catch (e) {
5133
- }
5134
- };
5135
- var GeneratorFunction;
5139
+ var getGeneratorFunction = /* @__PURE__ */ requireGeneratorFunction();
5136
5140
  isGeneratorFunction = function isGeneratorFunction2(fn2) {
5137
5141
  if (typeof fn2 !== "function") {
5138
5142
  return false;
@@ -5147,14 +5151,8 @@ function requireIsGeneratorFunction() {
5147
5151
  if (!getProto2) {
5148
5152
  return false;
5149
5153
  }
5150
- if (typeof GeneratorFunction === "undefined") {
5151
- var generatorFunc = getGeneratorFunc();
5152
- GeneratorFunction = generatorFunc ? (
5153
- /** @type {GeneratorFunctionConstructor} */
5154
- getProto2(generatorFunc)
5155
- ) : false;
5156
- }
5157
- return getProto2(fn2) === GeneratorFunction;
5154
+ var GeneratorFunction = getGeneratorFunction();
5155
+ return GeneratorFunction && getProto2(fn2) === GeneratorFunction.prototype;
5158
5156
  };
5159
5157
  return isGeneratorFunction;
5160
5158
  }
@@ -42092,8 +42090,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
42092
42090
  let $to = parse.doc.resolveNoCache(change.endB - parse.from);
42093
42091
  let $fromA = doc2.resolve(change.start);
42094
42092
  let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
42095
- let nextSel;
42096
- if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) && (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) && nextSel.head > $from.pos) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
42093
+ if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
42097
42094
  view.input.lastIOSEnter = 0;
42098
42095
  return;
42099
42096
  }
@@ -54356,10 +54353,11 @@ const StructuredContentCommands = Extension.create({
54356
54353
  return true;
54357
54354
  },
54358
54355
  /**
54359
- * Updates a structured content attributes or content.
54356
+ * Updates a single structured content field by its unique ID.
54357
+ * IDs are unique identifiers, so this will update at most one field.
54360
54358
  * If the updated node does not match the schema, it will not be updated.
54361
54359
  * @category Command
54362
- * @param {string} id
54360
+ * @param {string} id - Unique identifier of the field
54363
54361
  * @param {StructuredContentUpdate} options
54364
54362
  */
54365
54363
  updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -54400,10 +54398,12 @@ const StructuredContentCommands = Extension.create({
54400
54398
  return true;
54401
54399
  },
54402
54400
  /**
54403
- * Updates a structured content attributes or content by alias.
54404
- * If the updated node does not match the schema, it will not be updated.
54401
+ * Updates all structured content fields with the same alias.
54402
+ * Unlike IDs (which are unique), aliases can be shared across multiple fields.
54403
+ * This will update every field that matches the given alias.
54404
+ * If any updated node does not match the schema, no updates will be applied.
54405
54405
  * @category Command
54406
- * @param {string} alias
54406
+ * @param {string} alias - Shared identifier for fields (e.g., "customer_name")
54407
54407
  * @param {StructuredContentUpdate} options
54408
54408
  */
54409
54409
  updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -54412,11 +54412,8 @@ const StructuredContentCommands = Extension.create({
54412
54412
  return true;
54413
54413
  }
54414
54414
  const { schema } = editor;
54415
- if (dispatch) {
54416
- const structuredContent = structuredContentTags[0];
54417
- const { pos, node } = structuredContent;
54418
- const posFrom = pos;
54419
- const posTo = pos + node.nodeSize;
54415
+ const updates = [];
54416
+ for (const { pos, node } of structuredContentTags) {
54420
54417
  let content = null;
54421
54418
  if (options.text) {
54422
54419
  content = schema.text(options.text);
@@ -54435,11 +54432,16 @@ const StructuredContentCommands = Extension.create({
54435
54432
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54436
54433
  try {
54437
54434
  updatedNode.check();
54435
+ updates.push({ pos, node: updatedNode, size: node.nodeSize });
54438
54436
  } catch {
54439
54437
  console.error("Updated node does not conform to the schema");
54440
54438
  return false;
54441
54439
  }
54442
- tr.replaceWith(posFrom, posTo, updatedNode);
54440
+ }
54441
+ if (dispatch) {
54442
+ updates.reverse().forEach(({ pos, node, size: size2 }) => {
54443
+ tr.replaceWith(pos, pos + size2, node);
54444
+ });
54443
54445
  }
54444
54446
  return true;
54445
54447
  },
@@ -1,4 +1,4 @@
1
- import { g as global$2, c as createElementBlock, o as openBlock, a as createBaseVNode, r as ref$1, b as createApp, d as computed, F as Fragment$1, e as renderList, n as normalizeClass, w as withModifiers, f as createCommentVNode, t as toDisplayString, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, p as getCurrentInstance, q as onDeactivated, s as nextTick, u as createBlock, v as createVNode, x as unref, y as withCtx, z as createTextVNode, A as normalizeStyle, B as h$1, C as toRef, D as provide, E as mergeProps, G as cloneVNode, T as Text$2, H as withDirectives, I as watchEffect, J as shallowRef, K as vModelText, L as withKeys, M as reactive, N as readonly, O as Transition, P as vShow, Q as Comment, R as renderSlot, S as onActivated, U as Teleport, V as isVNode, W as onUnmounted, X as resolveDynamicComponent, Y as normalizeProps, Z as guardReactiveProps, _ as markRaw } from "./vue-CXxsqYcP.es.js";
1
+ import { g as global$2, c as createElementBlock, o as openBlock, a as createBaseVNode, r as ref$1, b as createApp, d as computed, F as Fragment$1, e as renderList, n as normalizeClass, w as withModifiers, f as createCommentVNode, t as toDisplayString, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, p as getCurrentInstance, q as onDeactivated, s as nextTick, u as createBlock, v as createVNode, x as unref, y as withCtx, z as createTextVNode, A as normalizeStyle, B as h$1, C as toRef, D as provide, E as mergeProps, G as cloneVNode, T as Text$2, H as withDirectives, I as watchEffect, J as shallowRef, K as vModelText, L as withKeys, M as reactive, N as readonly, O as Transition, P as vShow, Q as Comment, R as renderSlot, S as onActivated, U as Teleport, V as isVNode, W as onUnmounted, X as resolveDynamicComponent, Y as normalizeProps, Z as guardReactiveProps, _ as markRaw } from "./vue-ZWZLQtoU.es.js";
2
2
  import * as Y from "yjs";
3
3
  import { UndoManager, Item as Item$2, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
4
4
  var __defProp$2 = Object.defineProperty;
@@ -5094,6 +5094,19 @@ function requireSafeRegexTest() {
5094
5094
  };
5095
5095
  return safeRegexTest;
5096
5096
  }
5097
+ var generatorFunction;
5098
+ var hasRequiredGeneratorFunction;
5099
+ function requireGeneratorFunction() {
5100
+ if (hasRequiredGeneratorFunction) return generatorFunction;
5101
+ hasRequiredGeneratorFunction = 1;
5102
+ const cached = (
5103
+ /** @type {GeneratorFunctionConstructor} */
5104
+ function* () {
5105
+ }.constructor
5106
+ );
5107
+ generatorFunction = () => cached;
5108
+ return generatorFunction;
5109
+ }
5097
5110
  var isGeneratorFunction;
5098
5111
  var hasRequiredIsGeneratorFunction;
5099
5112
  function requireIsGeneratorFunction() {
@@ -5106,16 +5119,7 @@ function requireIsGeneratorFunction() {
5106
5119
  var getProto2 = requireGetProto();
5107
5120
  var toStr = callBound2("Object.prototype.toString");
5108
5121
  var fnToStr = callBound2("Function.prototype.toString");
5109
- var getGeneratorFunc = function() {
5110
- if (!hasToStringTag) {
5111
- return false;
5112
- }
5113
- try {
5114
- return Function("return function*() {}")();
5115
- } catch (e) {
5116
- }
5117
- };
5118
- var GeneratorFunction;
5122
+ var getGeneratorFunction = /* @__PURE__ */ requireGeneratorFunction();
5119
5123
  isGeneratorFunction = function isGeneratorFunction2(fn2) {
5120
5124
  if (typeof fn2 !== "function") {
5121
5125
  return false;
@@ -5130,14 +5134,8 @@ function requireIsGeneratorFunction() {
5130
5134
  if (!getProto2) {
5131
5135
  return false;
5132
5136
  }
5133
- if (typeof GeneratorFunction === "undefined") {
5134
- var generatorFunc = getGeneratorFunc();
5135
- GeneratorFunction = generatorFunc ? (
5136
- /** @type {GeneratorFunctionConstructor} */
5137
- getProto2(generatorFunc)
5138
- ) : false;
5139
- }
5140
- return getProto2(fn2) === GeneratorFunction;
5137
+ var GeneratorFunction = getGeneratorFunction();
5138
+ return GeneratorFunction && getProto2(fn2) === GeneratorFunction.prototype;
5141
5139
  };
5142
5140
  return isGeneratorFunction;
5143
5141
  }
@@ -42075,8 +42073,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
42075
42073
  let $to = parse.doc.resolveNoCache(change.endB - parse.from);
42076
42074
  let $fromA = doc2.resolve(change.start);
42077
42075
  let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
42078
- let nextSel;
42079
- if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", "")) && (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) && nextSel.head > $from.pos) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
42076
+ if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
42080
42077
  view.input.lastIOSEnter = 0;
42081
42078
  return;
42082
42079
  }
@@ -54339,10 +54336,11 @@ const StructuredContentCommands = Extension.create({
54339
54336
  return true;
54340
54337
  },
54341
54338
  /**
54342
- * Updates a structured content attributes or content.
54339
+ * Updates a single structured content field by its unique ID.
54340
+ * IDs are unique identifiers, so this will update at most one field.
54343
54341
  * If the updated node does not match the schema, it will not be updated.
54344
54342
  * @category Command
54345
- * @param {string} id
54343
+ * @param {string} id - Unique identifier of the field
54346
54344
  * @param {StructuredContentUpdate} options
54347
54345
  */
54348
54346
  updateStructuredContentById: (id, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -54383,10 +54381,12 @@ const StructuredContentCommands = Extension.create({
54383
54381
  return true;
54384
54382
  },
54385
54383
  /**
54386
- * Updates a structured content attributes or content by alias.
54387
- * If the updated node does not match the schema, it will not be updated.
54384
+ * Updates all structured content fields with the same alias.
54385
+ * Unlike IDs (which are unique), aliases can be shared across multiple fields.
54386
+ * This will update every field that matches the given alias.
54387
+ * If any updated node does not match the schema, no updates will be applied.
54388
54388
  * @category Command
54389
- * @param {string} alias
54389
+ * @param {string} alias - Shared identifier for fields (e.g., "customer_name")
54390
54390
  * @param {StructuredContentUpdate} options
54391
54391
  */
54392
54392
  updateStructuredContentByAlias: (alias, options = {}) => ({ editor, dispatch, state: state2, tr }) => {
@@ -54395,11 +54395,8 @@ const StructuredContentCommands = Extension.create({
54395
54395
  return true;
54396
54396
  }
54397
54397
  const { schema } = editor;
54398
- if (dispatch) {
54399
- const structuredContent = structuredContentTags[0];
54400
- const { pos, node } = structuredContent;
54401
- const posFrom = pos;
54402
- const posTo = pos + node.nodeSize;
54398
+ const updates = [];
54399
+ for (const { pos, node } of structuredContentTags) {
54403
54400
  let content = null;
54404
54401
  if (options.text) {
54405
54402
  content = schema.text(options.text);
@@ -54418,11 +54415,16 @@ const StructuredContentCommands = Extension.create({
54418
54415
  const updatedNode = node.type.create({ ...node.attrs, ...options.attrs }, content, node.marks);
54419
54416
  try {
54420
54417
  updatedNode.check();
54418
+ updates.push({ pos, node: updatedNode, size: node.nodeSize });
54421
54419
  } catch {
54422
54420
  console.error("Updated node does not conform to the schema");
54423
54421
  return false;
54424
54422
  }
54425
- tr.replaceWith(posFrom, posTo, updatedNode);
54423
+ }
54424
+ if (dispatch) {
54425
+ updates.reverse().forEach(({ pos, node, size: size2 }) => {
54426
+ tr.replaceWith(pos, pos + size2, node);
54427
+ });
54426
54428
  }
54427
54429
  return true;
54428
54430
  },