@harbour-enterprises/superdoc 0.12.9 → 0.12.11

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 { k as md, g as yd, c as bd, l as jo, f as Wo, a as wd, x as Sd, z as Dd, $ as vd, d as Fd } from "./chunks/super-editor.es-BI8I7zQw.es.js";
2
- import { O as Ib, w as Cb, i as fb } from "./chunks/super-editor.es-BI8I7zQw.es.js";
1
+ import { k as md, g as yd, c as bd, l as jo, f as Wo, a as wd, x as Sd, z as Dd, $ as vd, d as Fd } from "./chunks/super-editor.es-DlmgQ4J3.es.js";
2
+ import { O as Ib, w as Cb, i as fb } from "./chunks/super-editor.es-DlmgQ4J3.es.js";
3
3
  import { Y as Vl, r as W, Z as ui, p as Ge, _ as Vn, a as ae, $ as zn, a0 as ua, D as dt, i as ht, q as ji, l as wt, y as Fe, a1 as kd, N as Zt, u as qt, a2 as xd, a3 as Rd, a4 as Xo, g as Ji, K as Us, O as jr, j as Ii, k as Di, h as da, U as Nd, s as Md, A as Wr, F as jt, R as GA, m as Ct, E as mi, I as ms, C as re, V as Ld, S as Gd, W as Td, J as qi, P as Es, G as ar, Q as Ud, H as Hd, T as Pd, b as ye, o as fe, t as yi, x as bi, z as zl, f as We, B as ri, e as Ze, v as hi, w as Qi, n as Xs, a5 as Zl, d as gn, c as $l, X as Od, a6 as Jd } from "./chunks/vue-DKS68Dra.es.js";
4
4
  import { B as qn } from "./chunks/jszip-OpmRHhd4.es.js";
5
5
  import { B as Yd } from "./chunks/blank-docx-BRvkcuiv.es.js";
@@ -32718,7 +32718,7 @@ class hb extends eg {
32718
32718
  this.config = {
32719
32719
  ...this.config,
32720
32720
  ...t
32721
- }, this.config.colors = NI(this.config.colors), this.userColorMap = /* @__PURE__ */ new Map(), this.colorIndex = 0, this.version = "0.12.9", console.debug("🦋 [superdoc] Using SuperDoc version:", this.version), this.superdocId = t.superdocId || ig(), this.colors = this.config.colors, this.#t(), await this.#r(this.config.modules), this.#i(), this.#s(), this.user = this.config.user, this.users = this.config.users || [], this.socket = null, this.isDev = this.config.isDev || !1, this.activeEditor = null, this.comments = [], this.app.mount(this.config.selector), this.readyEditors = 0, this.isLocked = this.config.isLocked || !1, this.lockedBy = this.config.lockedBy || null, this.#a();
32721
+ }, this.config.colors = NI(this.config.colors), this.userColorMap = /* @__PURE__ */ new Map(), this.colorIndex = 0, this.version = "0.12.11", console.debug("🦋 [superdoc] Using SuperDoc version:", this.version), this.superdocId = t.superdocId || ig(), this.colors = this.config.colors, this.#t(), await this.#r(this.config.modules), this.#i(), this.#s(), this.user = this.config.user, this.users = this.config.users || [], this.socket = null, this.isDev = this.config.isDev || !1, this.activeEditor = null, this.comments = [], this.app.mount(this.config.selector), this.readyEditors = 0, this.isLocked = this.config.isLocked || !1, this.lockedBy = this.config.lockedBy || null, this.#a();
32722
32722
  }
32723
32723
  /**
32724
32724
  * Get the number of editors that are required for this superdoc
@@ -24219,7 +24219,7 @@ Actual: ` + p3.attribValue
24219
24219
  return;
24220
24220
  }
24221
24221
  }
24222
- static updateDocumentVersion(e = this.convertedXml, t = "0.12.9") {
24222
+ static updateDocumentVersion(e = this.convertedXml, t = "0.12.11") {
24223
24223
  const n = "docProps/custom.xml";
24224
24224
  e[n] || (e[n] = Nu$2());
24225
24225
  const i3 = e["docProps/custom.xml"];
@@ -24543,7 +24543,7 @@ Actual: ` + p3.attribValue
24543
24543
  function Nu$2() {
24544
24544
  return Kf$2;
24545
24545
  }
24546
- function Iu$2(r22 = 2, e = "0.12.9") {
24546
+ function Iu$2(r22 = 2, e = "0.12.11") {
24547
24547
  return {
24548
24548
  type: "element",
24549
24549
  name: "property",
@@ -36904,14 +36904,15 @@ Actual: ` + p3.attribValue
36904
36904
  }, r0$1 = (e) => ({ rawHtml: e }), o0$1 = (e) => ({ displayLabel: e }), i0$1 = (e) => ({ imageSrc: e }), s0$1 = (e) => ({ displayLabel: e }), a0$1 = (e, t) => ({ displayLabel: p0$1(e, t.input_format) }), l0$1 = (e) => (e.startsWith("http") || (e = `http://${e}`), { linkUrl: e }), c0$1 = (e) => ({ displayLabel: {
36905
36905
  YES: "Yes",
36906
36906
  NO: "No"
36907
- }[e[0].toUpperCase()] }), d0$1 = ({ editor: e, tr: t, annotationValues: n }) => {
36908
- const { state: r } = e, { doc: o } = r, i3 = [];
36909
- return o.descendants((s, a) => {
36910
- s.type.name === "table" && i3.push({ node: s, pos: a });
36911
- }), i3.reverse().forEach((s) => {
36912
- u0$1({ tableNode: s, annotationValues: n, tr: t, editor: e });
36907
+ }[e[0].toUpperCase()] }), d0$1 = ({ state: e, tr: t, annotationValues: n }) => {
36908
+ const { doc: r } = e, o = [];
36909
+ return r.descendants((i3, s) => {
36910
+ i3.type.name === "table" && o.push({ node: i3, pos: s });
36911
+ }), o.reverse().forEach(({ pos: i3 }) => {
36912
+ const s = t.doc.nodeAt(i3);
36913
+ !s || s.type.name !== "table" || u0$1({ tableNode: { node: s, pos: i3 }, annotationValues: n, tr: t, state: e });
36913
36914
  }), t;
36914
- }, u0$1 = ({ tableNode: e, annotationValues: t, tr: n, editor: r }) => {
36915
+ }, u0$1 = ({ tableNode: e, annotationValues: t, tr: n, state: r }) => {
36915
36916
  let o = null, i3 = null;
36916
36917
  const {
36917
36918
  tableRow: s,
@@ -36923,7 +36924,7 @@ Actual: ` + p3.attribValue
36923
36924
  if (o) return true;
36924
36925
  if (w.type === s && (i3 = { node: w, pos: x3 }), w.type === l) {
36925
36926
  const y = Oi$1(w.attrs.fieldId, t);
36926
- Array.isArray(y) && (o = i3);
36927
+ Array.isArray(y) && w.attrs.generatorIndex === null && (o = i3);
36927
36928
  }
36928
36929
  }), !o) return;
36929
36930
  const { node: d, pos: u } = o, f3 = n.mapping.map(e.pos + u), p3 = f3 + d.nodeSize;
@@ -37635,7 +37636,7 @@ Actual: ` + p3.attribValue
37635
37636
  * @returns {Object | void} Migration results
37636
37637
  */
37637
37638
  processCollaborationMigrations() {
37638
- if (console.debug("[checkVersionMigrations] Current editor version", "0.12.9"), !this.options.ydoc) return;
37639
+ if (console.debug("[checkVersionMigrations] Current editor version", "0.12.11"), !this.options.ydoc) return;
37639
37640
  let r = this.options.ydoc.getMap("meta").get("version");
37640
37641
  r || (r = "initial"), console.debug("[checkVersionMigrations] Document version", r);
37641
37642
  const o = wl$1(r) || [], s = this.state.plugins.find((c3) => c3.key.startsWith("y-sync"));
@@ -37710,7 +37711,7 @@ Actual: ` + p3.attribValue
37710
37711
  annotate(n = [], r = []) {
37711
37712
  const { state: o, view: i3, schema: s } = this;
37712
37713
  let a = o.tr;
37713
- a = to$2.processTables({ editor: this, tr: a, annotationValues: n }), a = to$2.annotateDocument({
37714
+ a = to$2.processTables({ state: this.state, tr: a, annotationValues: n }), a = to$2.annotateDocument({
37714
37715
  tr: a,
37715
37716
  schema: s,
37716
37717
  annotationValues: n,
@@ -37718,6 +37719,25 @@ Actual: ` + p3.attribValue
37718
37719
  editor: this
37719
37720
  }), a.docChanged && i3.dispatch(a.scrollIntoView());
37720
37721
  }
37722
+ /**
37723
+ * Preview annotations in the editor. It stores a copy of the original state.
37724
+ * This can be reverted via closePreview()
37725
+ *
37726
+ * @param {Object[]} annotationValues
37727
+ * @param {string[]} hiddenIds
37728
+ * @returns {void}
37729
+ */
37730
+ previewAnnotations(n = [], r = []) {
37731
+ this.originalState = this.view.state, this.annotate(n, r);
37732
+ }
37733
+ /**
37734
+ * If there is a preview active, this will revert the editor to the original state.
37735
+ *
37736
+ * @returns {void}
37737
+ */
37738
+ closePreview() {
37739
+ this.originalState && this.view.updateState(this.originalState);
37740
+ }
37721
37741
  };
37722
37742
  rn$1 = /* @__PURE__ */ new WeakMap(), Es = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakSet(), /**
37723
37743
  * Initialize the container element for the editor
@@ -54731,7 +54751,7 @@ ${t}
54731
54751
  const t = ref(xa$1()), n = e.type, o = ref(e.name), i3 = e.command, c3 = e.noArgumentCommand, a = ref(e.icon), l = ref(e.group || "center"), d = ref(e.allowWithoutEditor), u = ref(e.attributes || {}), r = e.disabled || false, w = ref(e.disabled), v = ref(false), b = ref(false), y = ref(e.style), g = ref(e.isNarrow), L3 = ref(e.isWide), D3 = ref(e.minWidth), p3 = ref(e.suppressActiveHighlight || false), S = ref(e.argument), F = ref(null), O3 = ref(null), W = ref(e.iconColor), oe2 = ref(e.hasCaret), ue2 = ref(e.dropdownStyles), ve2 = ref(e.tooltip), ge2 = ref(e.tooltipVisible), Y = ref(e.tooltipTimeout), T = ref(e.defaultLabel), H3 = ref(e.label), B3 = ref(e.hideLabel), z3 = ref(e.inlineTextInputVisible), G3 = ref(e.hasInlineTextInput), K3 = ref(e.markName), ce2 = ref(e.labelAttr), se2 = ref(e.selectedValue), ke2 = ref(e.dropdownValueKey), Ie2 = ref(e.inputRef || null), be2 = ref([]);
54732
54752
  if (e.options) {
54733
54753
  if (!Array.isArray(e.options)) throw new Error("Invalid toolbar item options - " + e.options);
54734
- be2.value.push(...e.options);
54754
+ be2.value?.push(...e.options);
54735
54755
  }
54736
54756
  const _e2 = (ae2) => {
54737
54757
  xe2(ae2), !p3.value && (v.value = true);
@@ -56611,7 +56631,9 @@ ${t}
56611
56631
  */
56612
56632
  dt = function() {
56613
56633
  if (!this.activeEditor || !this.activeEditor.converter || !this.activeEditor.converter.docHiglightColors.size) return;
56614
- const t = this.toolbarItems.find((a) => a.name.value === "highlight"), n = jn(), o = 7, i3 = Array.from(this.activeEditor.converter.docHiglightColors).reduce((a, l, d) => {
56634
+ const t = this.toolbarItems.find((a) => a.name.value === "highlight");
56635
+ if (!t) return;
56636
+ const n = jn(), o = 7, i3 = Array.from(this.activeEditor.converter.docHiglightColors).reduce((a, l, d) => {
56615
56637
  const u = Math.floor(d / o);
56616
56638
  return a[u] || (a[u] = []), n.includes(l) || a[u].push(f(l)), a;
56617
56639
  }, []), c3 = {
@@ -72039,7 +72061,7 @@ ${style2}
72039
72061
  this.config.colors = shuffleArray(this.config.colors);
72040
72062
  this.userColorMap = /* @__PURE__ */ new Map();
72041
72063
  this.colorIndex = 0;
72042
- this.version = "0.12.9";
72064
+ this.version = "0.12.11";
72043
72065
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
72044
72066
  this.superdocId = config.superdocId || v4();
72045
72067
  this.colors = this.config.colors;