@harbour-enterprises/superdoc 0.11.39 → 0.11.41

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.
@@ -16756,7 +16756,7 @@ const ws = class H1 {
16756
16756
  return;
16757
16757
  }
16758
16758
  }
16759
- static updateDocumentVersion(e = this.convertedXml, n = "0.11.39") {
16759
+ static updateDocumentVersion(e = this.convertedXml, n = "0.11.41") {
16760
16760
  const r = "docProps/custom.xml";
16761
16761
  e[r] || (e[r] = V1());
16762
16762
  const o = e["docProps/custom.xml"];
@@ -17019,7 +17019,7 @@ function tT(t) {
17019
17019
  function V1() {
17020
17020
  return k4;
17021
17021
  }
17022
- function W1(t = 2, e = "0.11.39") {
17022
+ function W1(t = 2, e = "0.11.41") {
17023
17023
  return {
17024
17024
  type: "element",
17025
17025
  name: "property",
@@ -29771,7 +29771,7 @@ const J_ = class qx extends e_ {
29771
29771
  * @returns {Object | void} Migration results
29772
29772
  */
29773
29773
  processCollaborationMigrations() {
29774
- if (console.debug("[checkVersionMigrations] Current editor version", "0.11.39"), !this.options.ydoc) return;
29774
+ if (console.debug("[checkVersionMigrations] Current editor version", "0.11.41"), !this.options.ydoc) return;
29775
29775
  let e = this.options.ydoc.getMap("meta").get("version");
29776
29776
  e || (e = "initial"), console.debug("[checkVersionMigrations] Document version", e);
29777
29777
  const n = mw(e) || [], r = this.state.plugins.find((i) => i.key.startsWith("y-sync"));
@@ -46158,7 +46158,7 @@ const rU = {
46158
46158
  }, m = (g, v) => {
46159
46159
  h();
46160
46160
  const x = g.dropdownValueKey.value ? v[g.dropdownValueKey.value] : v.label;
46161
- n("command", { item: g, argument: x });
46161
+ n("command", { item: g, argument: x, option: v });
46162
46162
  }, y = (g) => {
46163
46163
  h();
46164
46164
  };
@@ -46239,7 +46239,7 @@ const rU = {
46239
46239
  ], 2))), 128))
46240
46240
  ], 4));
46241
46241
  }
46242
- }, $l = /* @__PURE__ */ St(cU, [["__scopeId", "data-v-7a2db351"]]), uU = {
46242
+ }, $l = /* @__PURE__ */ St(cU, [["__scopeId", "data-v-01872c2d"]]), uU = {
46243
46243
  __name: "Toolbar",
46244
46244
  emits: ["command", "toggle", "select"],
46245
46245
  setup(t, { emit: e }) {
@@ -46259,8 +46259,8 @@ const rU = {
46259
46259
  }
46260
46260
  }, c = PR(async () => {
46261
46261
  await n.$toolbar.onToolbarResize(), r.value += 1;
46262
- }, 300), u = ({ item: d, argument: p }) => {
46263
- n.$toolbar.emitCommand({ item: d, argument: p });
46262
+ }, 300), u = ({ item: d, argument: p, option: f }) => {
46263
+ n.$toolbar.emitCommand({ item: d, argument: p, option: f });
46264
46264
  };
46265
46265
  return (d, p) => (xe(), Ee("div", {
46266
46266
  class: "superdoc-toolbar",
@@ -46288,7 +46288,7 @@ const rU = {
46288
46288
  }, null, 8, ["toolbar-items"])) : nt("", !0)
46289
46289
  ]));
46290
46290
  }
46291
- }, dU = /* @__PURE__ */ St(uU, [["__scopeId", "data-v-ac3df73e"]]), pU = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights", CS = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
46291
+ }, dU = /* @__PURE__ */ St(uU, [["__scopeId", "data-v-abd0fb95"]]), pU = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights", CS = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
46292
46292
  async function $S(t, e = {}) {
46293
46293
  const n = e.apiKey, r = e.endpoint || pU;
46294
46294
  try {
@@ -48233,7 +48233,8 @@ class HV extends MU {
48233
48233
  groups: null,
48234
48234
  editor: null,
48235
48235
  aiApiKey: null,
48236
- aiEndpoint: null
48236
+ aiEndpoint: null,
48237
+ customButtons: []
48237
48238
  }), Nb(this, As, {
48238
48239
  /**
48239
48240
  * Handles zoom level changes
@@ -48475,7 +48476,7 @@ class HV extends MU {
48475
48476
  * @returns {ToolbarItem[]} An array of toolbar items in the specified group
48476
48477
  */
48477
48478
  getToolbarItemByGroup(e) {
48478
- return this.toolbarItems.filter((n) => n.group.value === e);
48479
+ return this.toolbarItems.filter((n) => (n.group?.value || "center") === e);
48479
48480
  }
48480
48481
  /**
48481
48482
  * Get a toolbar item by name
@@ -48537,16 +48538,22 @@ class HV extends MU {
48537
48538
  * @param {*} [params.argument] - The argument passed to the command
48538
48539
  * @returns {*} The result of the executed command, undefined if no result is returned
48539
48540
  */
48540
- emitCommand({ item: e, argument: n }) {
48541
+ emitCommand({ item: e, argument: n, option: r }) {
48541
48542
  this.activeEditor?.focus();
48542
- const { command: r } = e;
48543
- if (r) {
48544
- if (this.log("(emmitCommand) Command:", r, e, n), r in qd(this, As))
48545
- return qd(this, As)[r]({ item: e, argument: n });
48546
- if (r in this.activeEditor?.commands)
48547
- this.activeEditor.commands[r](n), this.updateToolbarState();
48543
+ const { command: o } = e;
48544
+ if (o) {
48545
+ if (this.log("(emmitCommand) Command:", o, `
48546
+ item:`, e, `
48547
+ argument:`, n, `
48548
+ option:`, r), o in qd(this, As))
48549
+ return qd(this, As)[o]({ item: e, argument: n });
48550
+ if (o in this.activeEditor?.commands)
48551
+ this.activeEditor.commands[o](n);
48552
+ else if (typeof o == "function")
48553
+ o({ item: e, argument: n, option: r });
48548
48554
  else
48549
- throw new Error(`[super-toolbar 🎨] Command not found: ${r}`);
48555
+ throw new Error(`[super-toolbar 🎨] Command not found: ${o}`);
48556
+ this.updateToolbarState();
48550
48557
  }
48551
48558
  }
48552
48559
  }
@@ -48566,14 +48573,15 @@ IS = function() {
48566
48573
  * @returns {void}
48567
48574
  */
48568
48575
  yf = function(t, e, n = !1) {
48569
- const r = document.documentElement.clientWidth, { defaultItems: o, overflowItems: i } = UH(t, n, r, this.role, e);
48570
- let s = [
48571
- ...o.map((l) => l.name.value),
48572
- ...i.map((l) => l.name.value)
48576
+ const r = document.documentElement.clientWidth, { defaultItems: o, overflowItems: i } = UH(t, n, r, this.role, e), s = this.config.customButtons || [];
48577
+ s.length && o.push(...s.map((c) => Je({ ...c })));
48578
+ let a = [
48579
+ ...o.map((c) => c.name.value),
48580
+ ...i.map((c) => c.name.value)
48573
48581
  ];
48574
- this.config.groups && (s = Object.values(this.config.groups).flatMap((l) => l));
48575
- const a = o.filter((l) => s.includes(l.name.value)).filter((l) => !this.config.excludeItems.includes(l.name.value));
48576
- this.toolbarItems = a, this.overflowItems = i.filter((l) => s.includes(l.name.value));
48582
+ this.config.groups && (a = Object.values(this.config.groups).flatMap((c) => c));
48583
+ const l = o.filter((c) => a.includes(c.name.value)).filter((c) => !this.config.excludeItems.includes(c.name.value));
48584
+ this.toolbarItems = l, this.overflowItems = i.filter((c) => a.includes(c.name.value));
48577
48585
  }, /**
48578
48586
  * Initialize default fonts from the editor
48579
48587
  * @private