@chaulapatrice/richtext-editor 0.1.6 → 0.1.8

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.
@@ -16842,7 +16842,7 @@ var pA = 3e4, vse = (e, t) => console.warn(`Permission denied to access ${e.url}
16842
16842
  connect() {
16843
16843
  this.shouldConnect = !0, !this.wsconnected && this.ws === null && (hA(this), this.connectBc());
16844
16844
  }
16845
- }, _A = new URL(window.location.href), vA = new URLSearchParams(_A.search), yA = vA.get("collabEndpoint") || "ws://localhost:1234", bA = "playground", xA = vA.get("collabId") || "0";
16845
+ }, _A = new URL(window?.location?.href || "http://localhost:3000/"), vA = new URLSearchParams(_A.search), yA = vA.get("collabEndpoint") || "ws://localhost:1234", bA = "playground", xA = vA.get("collabId") || "0";
16846
16846
  function SA(e, t) {
16847
16847
  let n = t.get(e);
16848
16848
  return n === void 0 ? (n = new jS(), t.set(e, n)) : n.load(), CA(e, n);
@@ -16852,7 +16852,7 @@ function CA(e, t) {
16852
16852
  }
16853
16853
  //#endregion
16854
16854
  //#region src/appSettings.ts
16855
- var wA = window.location.hostname, TA = {
16855
+ var wA = window?.location?.hostname || "localhost", TA = {
16856
16856
  disableBeforeInput: !1,
16857
16857
  emptyEditor: wA !== "playground.lexical.dev" && wA !== "lexical-playground.vercel.app",
16858
16858
  hasLinkAttributes: !1,
@@ -16897,6 +16897,7 @@ var wA = window.location.hostname, TA = {
16897
16897
  });
16898
16898
  }, kA = () => lc(DA);
16899
16899
  function AA(e, t) {
16900
+ if (!window) return;
16900
16901
  let n = new URL(window.location.href), r = new URLSearchParams(n.search);
16901
16902
  t === TA[e] ? r.delete(e) : r.set(e, String(t)), n.search = r.toString(), window.history.pushState(null, "", n.toString());
16902
16903
  }
@@ -19957,8 +19958,8 @@ function BM({ onClose: e, children: t, title: n, closeOnClickOutside: r }) {
19957
19958
  let n = t.target;
19958
19959
  i.current !== null && Rm(n) && !i.current.contains(n) && r && e();
19959
19960
  }, o = i.current;
19960
- return o !== null && (t = o.parentElement, t !== null && t.addEventListener("click", a)), window.addEventListener("keydown", n), () => {
19961
- window.removeEventListener("keydown", n), t !== null && t?.removeEventListener("click", a);
19961
+ return o !== null && (t = o.parentElement, t !== null && t.addEventListener("click", a)), typeof window < "u" && window.addEventListener("keydown", n), () => {
19962
+ typeof window < "u" && window.removeEventListener("keydown", n), t !== null && t?.removeEventListener("click", a);
19962
19963
  };
19963
19964
  }, [r, e]), /* @__PURE__ */ B("div", {
19964
19965
  className: "Modal__overlay",
@@ -22486,7 +22487,7 @@ function Ase({ shouldPreserveNewLinesInMarkdown: e, useCollabV2: t }) {
22486
22487
  zM();
22487
22488
  let { isCollabActive: p } = By();
22488
22489
  F(() => {
22489
- EA.isCollab || KM(window.location.hash).then((e) => {
22490
+ EA.isCollab || typeof window > "u" || KM(window.location.hash).then((e) => {
22490
22491
  e && e.source === "Playground" && (n.setEditorState(Ej(n, e)), n.dispatchCommand(Lu, void 0));
22491
22492
  });
22492
22493
  }, [n]), F(() => vg(n.registerEditableListener((e) => {
@@ -59091,6 +59092,7 @@ function sve({ nodeKey: e, data: t, width: n, height: r }) {
59091
59092
  //#endregion
59092
59093
  //#region src/nodes/ExcalidrawNode/index.tsx
59093
59094
  function cve(e) {
59095
+ if (!window) return null;
59094
59096
  let t = e.getAttribute("data-lexical-excalidraw-json"), n = window.getComputedStyle(e), r = n.getPropertyValue("height"), i = n.getPropertyValue("width");
59095
59097
  return t ? { node: U5(t, !i || i === "inherit" ? "inherit" : parseInt(i, 10), !r || r === "inherit" ? "inherit" : parseInt(r, 10)) } : null;
59096
59098
  }
@@ -59548,6 +59550,7 @@ function n7({ disabled: e = !1, buttonLabel: t, buttonAriaLabel: n, buttonClassN
59548
59550
  //#endregion
59549
59551
  //#region src/nodes/LayoutContainerNode.ts
59550
59552
  function Cve(e) {
59553
+ if (typeof window > "u") return null;
59551
59554
  let t = window.getComputedStyle(e).getPropertyValue("grid-template-columns");
59552
59555
  return t ? { node: i7(t) } : null;
59553
59556
  }
@@ -61611,8 +61614,8 @@ function fye({ editor: e, anchorElem: t, isLink: n, isBold: r, isItalic: i, isUn
61611
61614
  y();
61612
61615
  });
61613
61616
  };
61614
- return window.addEventListener("resize", r), n && n.addEventListener("scroll", r), () => {
61615
- window.removeEventListener("resize", r), n && n.removeEventListener("scroll", r);
61617
+ return typeof window < "u" && window.addEventListener("resize", r), n && n.addEventListener("scroll", r), () => {
61618
+ typeof window < "u" && window.removeEventListener("resize", r), n && n.removeEventListener("scroll", r);
61616
61619
  };
61617
61620
  }, [
61618
61621
  e,
@@ -63142,25 +63145,25 @@ function cbe({ editor: e }) {
63142
63145
  }, c(o.current), f(e), document.addEventListener("pointerup", x(e));
63143
63146
  }, [l, x]), C = P(() => {
63144
63147
  if (l) {
63145
- let { height: e, width: t, top: n, left: i } = l.elem.getBoundingClientRect(), a = Xg(l.elem), o = {
63148
+ let { height: e, width: t, top: n, left: i } = l.elem.getBoundingClientRect(), a = Xg(l.elem), o = typeof window < "u" ? window.scrollX : 0, c = typeof window < "u" ? window.scrollY : 0, u = {
63146
63149
  bottom: {
63147
63150
  backgroundColor: "none",
63148
63151
  cursor: "row-resize",
63149
63152
  height: "16px",
63150
- left: `${window.scrollX + i}px`,
63151
- top: `${window.scrollY + n + e - 16 / 2}px`,
63153
+ left: `${o + i}px`,
63154
+ top: `${c + n + e - 16 / 2}px`,
63152
63155
  width: `${t}px`
63153
63156
  },
63154
63157
  right: {
63155
63158
  backgroundColor: "none",
63156
63159
  cursor: "col-resize",
63157
63160
  height: `${e}px`,
63158
- left: `${window.scrollX + i + t - 16 / 2}px`,
63159
- top: `${window.scrollY + n}px`,
63161
+ left: `${o + i + t - 16 / 2}px`,
63162
+ top: `${c + n}px`,
63160
63163
  width: "16px"
63161
63164
  }
63162
- }, c = r.current;
63163
- return d && s && c ? (g(d) ? (o[d].left = `${window.scrollX + c.left}px`, o[d].top = `${window.scrollY + s.y / a}px`, o[d].height = "3px", o[d].width = `${c.width}px`) : (o[d].top = `${window.scrollY + c.top}px`, o[d].left = `${window.scrollX + s.x / a}px`, o[d].width = "3px", o[d].height = `${c.height}px`), o[d].backgroundColor = "#adf", o[d].mixBlendMode = "unset") : !d && p === "right" && (o.right.background = `linear-gradient(90deg, transparent 7px, ${x9} 7px, ${x9} 9px, transparent 9px)`, o.right.mixBlendMode = "unset", c && (o.right.top = `${window.scrollY + c.top}px`, o.right.height = `${c.height}px`)), o;
63165
+ }, f = r.current;
63166
+ return d && s && f ? (g(d) ? (u[d].left = `${o + f.left}px`, u[d].top = `${c + s.y / a}px`, u[d].height = "3px", u[d].width = `${f.width}px`) : (u[d].top = `${c + f.top}px`, u[d].left = `${o + s.x / a}px`, u[d].width = "3px", u[d].height = `${f.height}px`), u[d].backgroundColor = "#adf", u[d].mixBlendMode = "unset") : !d && p === "right" && (u.right.background = `linear-gradient(90deg, transparent 7px, ${x9} 7px, ${x9} 9px, transparent 9px)`, u.right.mixBlendMode = "unset", f && (u.right.top = `${c + f.top}px`, u.right.height = `${f.height}px`)), u;
63164
63167
  }
63165
63168
  return {
63166
63169
  bottom: null,
@@ -63650,8 +63653,8 @@ function kbe({ x: e, y: t, nodeKey: n, color: r, caption: i }) {
63650
63653
  let t = a.getRootElement(), n = o.current;
63651
63654
  t !== null && n !== null && (e.rootElementRect = t.getBoundingClientRect(), F9(n, e));
63652
63655
  };
63653
- return window.addEventListener("resize", r), () => {
63654
- window.removeEventListener("resize", r), n();
63656
+ return typeof window < "u" && window.addEventListener("resize", r), () => {
63657
+ typeof window < "u" && window.removeEventListener("resize", r), n();
63655
63658
  };
63656
63659
  }, [a]), F(() => {
63657
63660
  let e = o.current;
@@ -65044,8 +65047,8 @@ function qbe() {
65044
65047
  }, d = function() {
65045
65048
  a = !0;
65046
65049
  };
65047
- return window.addEventListener("keydown", l, !0), window.addEventListener("selectionchange", o, !0), window.addEventListener("beforeinput", c, !0), window.addEventListener("paste", u, !0), window.addEventListener("cut", d, !0), () => {
65048
- window.removeEventListener("keydown", l, !0), window.removeEventListener("selectionchange", o, !0), window.removeEventListener("beforeinput", c, !0), window.removeEventListener("paste", u, !0), window.removeEventListener("cut", d, !0);
65050
+ return typeof window < "u" && (window.addEventListener("keydown", l, !0), window.addEventListener("selectionchange", o, !0), window.addEventListener("beforeinput", c, !0), window.addEventListener("paste", u, !0), window.addEventListener("cut", d, !0)), () => {
65051
+ typeof window < "u" && (window.removeEventListener("keydown", l, !0), window.removeEventListener("selectionchange", o, !0), window.removeEventListener("beforeinput", c, !0), window.removeEventListener("paste", u, !0), window.removeEventListener("cut", d, !0));
65049
65052
  };
65050
65053
  }, [e]), null;
65051
65054
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaulapatrice/richtext-editor",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "author": "Patrice Chaula",
5
5
  "license": "MIT",
6
6
  "repository": {