@harbour-enterprises/superdoc 0.10.65 → 0.10.67

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.
@@ -15265,17 +15265,27 @@ function mv(t) {
15265
15265
  }
15266
15266
  const D6 = (t) => {
15267
15267
  const { nodes: e, nodeListHandler: n } = t;
15268
- if (e.length === 0 || !(e[0].name === "w:del" || e[0].name === "w:ins"))
15268
+ if (e.length === 0 || !(e[0].name === "w:del" || e[0].name === "w:ins" || e[0].name === "w:sdt"))
15269
15269
  return { nodes: [], consumed: 0 };
15270
- const r = e[0], { name: o } = r, { attributes: i, elements: s } = Fo(r), a = n.handler({ ...t, insideTrackChange: !0, nodes: s }), l = o === "w:del" ? wt : Wt, c = {
15271
- id: i["w:id"],
15272
- date: i["w:date"],
15273
- author: i["w:author"],
15274
- authorEmail: i["w:authorEmail"]
15270
+ const r = e[0];
15271
+ let o;
15272
+ if (["w:ins", "w:del"].includes(r.name))
15273
+ o = r;
15274
+ else {
15275
+ const d = r.elements.find((f) => f.name === "w:sdtContent")?.elements.find((f) => ["w:ins", "w:del"].includes(f.name));
15276
+ d && (o = d);
15277
+ }
15278
+ if (!o)
15279
+ return { nodes: [], consumed: 0 };
15280
+ const { name: i } = o, { attributes: s, elements: a } = Fo(o), l = n.handler({ ...t, insideTrackChange: !0, nodes: a }), c = i === "w:del" ? wt : Wt, u = {
15281
+ id: s["w:id"],
15282
+ date: s["w:date"],
15283
+ author: s["w:author"],
15284
+ authorEmail: s["w:authorEmail"]
15275
15285
  };
15276
- return a.forEach((u) => {
15277
- u.marks === void 0 && (u.marks = []), u.marks.push({ type: l, attrs: c });
15278
- }), { nodes: a, consumed: 1 };
15286
+ return l.forEach((d) => {
15287
+ d.marks === void 0 && (d.marks = []), d.marks.push({ type: c, attrs: u });
15288
+ }), { nodes: l, consumed: 1 };
15279
15289
  }, _6 = {
15280
15290
  handlerName: "trackChangeNodeHandler",
15281
15291
  handler: D6
@@ -16558,7 +16568,7 @@ const hs = class Tv {
16558
16568
  return;
16559
16569
  }
16560
16570
  }
16561
- static updateDocumentVersion(e = this.convertedXml, n = "0.10.65") {
16571
+ static updateDocumentVersion(e = this.convertedXml, n = "0.10.67") {
16562
16572
  const r = "docProps/custom.xml";
16563
16573
  e[r] || (e[r] = Ov());
16564
16574
  const o = e["docProps/custom.xml"];
@@ -16607,18 +16617,20 @@ const hs = class Tv {
16607
16617
  }, []), r = this.convertedXml["word/_rels/fontTable.xml.rels"]?.elements.find((s) => s.name === "Relationships") || {}, { elements: o } = r;
16608
16618
  let i = "";
16609
16619
  for (const s of n) {
16610
- const a = o.find((m) => m.attributes.Id === s.attributes["r:id"])?.attributes?.Target;
16620
+ const a = o.find((y) => y.attributes.Id === s.attributes["r:id"])?.attributes?.Target;
16611
16621
  if (!a) return;
16612
- const l = r4(this.fonts[`word/${a}`], s.attributes["w:fontKey"]);
16622
+ const l = this.fonts[`word/${a}`]?.buffer;
16613
16623
  if (!l) return;
16614
- const c = new Blob([l], { type: "font/ttf" }), u = URL.createObjectURL(c), d = s.name.includes("Regular"), f = s.name.includes("Bold"), p = s.name.includes("Italic"), h = s.name.includes("Light");
16624
+ const c = r4(l, s.attributes["w:fontKey"]);
16625
+ if (!c) return;
16626
+ const u = new Blob([c], { type: "font/ttf" }), d = URL.createObjectURL(u), f = s.name.includes("Regular"), p = s.name.includes("Bold"), h = s.name.includes("Italic"), m = s.name.includes("Light");
16615
16627
  i += `
16616
16628
  @font-face {
16617
- font-style: ${p ? "italic" : "normal"};
16618
- font-weight: ${d ? "normal" : f ? "bold" : h ? "200" : "normal"};
16629
+ font-style: ${h ? "italic" : "normal"};
16630
+ font-weight: ${f ? "normal" : p ? "bold" : m ? "200" : "normal"};
16619
16631
  font-display: swap;
16620
16632
  font-family: ${s.fontFamily};
16621
- src: url(${u}) format('truetype');
16633
+ src: url(${d}) format('truetype');
16622
16634
  }
16623
16635
  `;
16624
16636
  }
@@ -16819,7 +16831,7 @@ function R$(t) {
16819
16831
  function Ov() {
16820
16832
  return i4;
16821
16833
  }
16822
- function Mv(t = 2, e = "0.10.65") {
16834
+ function Mv(t = 2, e = "0.10.67") {
16823
16835
  return {
16824
16836
  type: "element",
16825
16837
  name: "property",
@@ -19190,8 +19202,8 @@ let ay = class {
19190
19202
  const p = new File([u], c.name, { type: u.type }), h = URL.createObjectURL(p);
19191
19203
  this.media[c.name] = h;
19192
19204
  }
19193
- else if (!n && c.name.startsWith("word/fonts") && c.name !== "word/fonts/") {
19194
- const u = await c.async("arraybuffer");
19205
+ else if (c.name.startsWith("word/fonts") && c.name !== "word/fonts/") {
19206
+ const u = await c.async("uint8array");
19195
19207
  this.fonts[c.name] = u;
19196
19208
  }
19197
19209
  }
@@ -29291,7 +29303,7 @@ const w8 = class $x extends yM {
29291
29303
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
29292
29304
  */
29293
29305
  processCollaborationMigrations() {
29294
- if (console.debug("[checkVersionMigrations] Current editor version", "0.10.65"), !this.options.ydoc) return;
29306
+ if (console.debug("[checkVersionMigrations] Current editor version", "0.10.67"), !this.options.ydoc) return;
29295
29307
  let e = this.options.ydoc.getMap("meta").get("version");
29296
29308
  e || (e = "initial"), console.debug("[checkVersionMigrations] Document version", e);
29297
29309
  const n = iw(e) || [], r = this.state.plugins.find((i) => i.key.startsWith("y-sync"));
@@ -29324,7 +29336,7 @@ pi = /* @__PURE__ */ new WeakMap(), xx = /* @__PURE__ */ new WeakMap(), We = /*
29324
29336
  }
29325
29337
  t.element = t.isHeadless ? null : t.element || document.createElement("div");
29326
29338
  }, Sx = function(t) {
29327
- Ne(this, We, nd).call(this), Ne(this, We, rd).call(this), Ne(this, We, od).call(this), Ne(this, We, Tf).call(this), Ne(this, We, Of).call(this), Ne(this, We, sw).call(this), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("contentError", this.options.onContentError), this.on("exception", this.options.onException), Ne(this, We, ad).call(this), this.initDefaultStyles(), this.setDocumentMode(t.documentMode), !this.options.isHeadless && (this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", Ne(this, We, td)), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("trackedChangesUpdate", this.options.onTrackedChangesUpdate), this.on("commentsLoaded", this.options.onCommentsLoaded), this.on("commentClick", this.options.onCommentClicked), this.on("commentsUpdate", this.options.onCommentsUpdate), this.on("locked", this.options.onDocumentLocked), this.on("collaborationReady", Ne(this, We, aw)), this.on("paginationUpdate", this.options.onPaginationUpdate), this.on("comment-positions", this.options.onCommentLocationsUpdate), this.initializeCollaborationData(), this.options.ydoc || (Ne(this, We, ys).call(this), Ne(this, We, gs).call(this)), window.setTimeout(() => {
29339
+ Ne(this, We, nd).call(this), Ne(this, We, rd).call(this), Ne(this, We, od).call(this), Ne(this, We, Tf).call(this), Ne(this, We, Of).call(this), this.options.isHeadless || Ne(this, We, sw).call(this), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("contentError", this.options.onContentError), this.on("exception", this.options.onException), Ne(this, We, ad).call(this), this.initDefaultStyles(), this.setDocumentMode(t.documentMode), !this.options.isHeadless && (this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", Ne(this, We, td)), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("trackedChangesUpdate", this.options.onTrackedChangesUpdate), this.on("commentsLoaded", this.options.onCommentsLoaded), this.on("commentClick", this.options.onCommentClicked), this.on("commentsUpdate", this.options.onCommentsUpdate), this.on("locked", this.options.onDocumentLocked), this.on("collaborationReady", Ne(this, We, aw)), this.on("paginationUpdate", this.options.onPaginationUpdate), this.on("comment-positions", this.options.onCommentLocationsUpdate), this.initializeCollaborationData(), this.options.ydoc || (Ne(this, We, ys).call(this), Ne(this, We, gs).call(this)), window.setTimeout(() => {
29328
29340
  this.isDestroyed || this.emit("create", { editor: this });
29329
29341
  }, 0));
29330
29342
  }, Cf = function(t) {