@chaulapatrice/richtext-editor 0.1.7 → 0.1.9

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.
@@ -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 || "localhost", TA = {
16855
+ var wA = typeof window < "u" && 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,
@@ -22068,7 +22068,7 @@ var aF = !0;
22068
22068
  function oF({ className: e, format: t, loadingComponent: n, nodeKey: r, onError: i, onLoad: a, tweetID: o }) {
22069
22069
  let s = L(null), c = L(""), [l, u] = R(!1), d = P(async () => {
22070
22070
  try {
22071
- await window.twttr.widgets.createTweet(o, s.current), u(!1), aF = !1, a && a();
22071
+ typeof window < "u" && window.twttr && await window.twttr.widgets.createTweet(o, s.current), u(!1), aF = !1, a && a();
22072
22072
  } catch (e) {
22073
22073
  i && i(String(e));
22074
22074
  }
@@ -22487,7 +22487,7 @@ function Ase({ shouldPreserveNewLinesInMarkdown: e, useCollabV2: t }) {
22487
22487
  zM();
22488
22488
  let { isCollabActive: p } = By();
22489
22489
  F(() => {
22490
- EA.isCollab || KM(window.location.hash).then((e) => {
22490
+ EA.isCollab || typeof window > "u" || KM(window.location.hash).then((e) => {
22491
22491
  e && e.source === "Playground" && (n.setEditorState(Ej(n, e)), n.dispatchCommand(Lu, void 0));
22492
22492
  });
22493
22493
  }, [n]), F(() => vg(n.registerEditableListener((e) => {
@@ -22757,8 +22757,8 @@ function Lse() {
22757
22757
  }, []);
22758
22758
  }
22759
22759
  function Rse(e) {
22760
- let t = window.navigator.userAgentData;
22761
- return `${e} ${(t === void 0 ? window.innerWidth <= 800 && window.innerHeight <= 600 : t.mobile) ? "(SWIPE ⮕)" : "(TAB)"}`;
22760
+ let t = typeof window < "u" ? window.navigator.userAgentData : void 0;
22761
+ return `${e} ${(t === void 0 ? typeof window < "u" && window.innerWidth <= 800 && window.innerHeight <= 600 : t.mobile) ? "(SWIPE ⮕)" : "(TAB)"}`;
22762
22762
  }
22763
22763
  function zse() {
22764
22764
  let [e] = H(), t = Lse(), { toolbarState: n } = DF();
@@ -59092,7 +59092,7 @@ function sve({ nodeKey: e, data: t, width: n, height: r }) {
59092
59092
  //#endregion
59093
59093
  //#region src/nodes/ExcalidrawNode/index.tsx
59094
59094
  function cve(e) {
59095
- if (!window) return null;
59095
+ if (typeof window > "u") return null;
59096
59096
  let t = e.getAttribute("data-lexical-excalidraw-json"), n = window.getComputedStyle(e), r = n.getPropertyValue("height"), i = n.getPropertyValue("width");
59097
59097
  return t ? { node: U5(t, !i || i === "inherit" ? "inherit" : parseInt(i, 10), !r || r === "inherit" ? "inherit" : parseInt(r, 10)) } : null;
59098
59098
  }
@@ -59480,7 +59480,9 @@ function n7({ disabled: e = !1, buttonLabel: t, buttonAriaLabel: n, buttonClassN
59480
59480
  let e = l.current, t = c.current, n = Xg(t, !0);
59481
59481
  if (u && e !== null && t !== null) {
59482
59482
  let { top: r, left: i } = e.getBoundingClientRect();
59483
- t.style.top = `${r / n + e.offsetHeight + e7}px`, t.style.left = `${Math.min(i, window.innerWidth - t.offsetWidth - 20) / n}px`;
59483
+ t.style.top = `${r / n + e.offsetHeight + e7}px`;
59484
+ let a = typeof window < "u" ? window.innerWidth : 0;
59485
+ t.style.left = `${Math.min(i, a - t.offsetWidth - 20) / n}px`;
59484
59486
  }
59485
59487
  }, [
59486
59488
  c,
@@ -59550,6 +59552,7 @@ function n7({ disabled: e = !1, buttonLabel: t, buttonAriaLabel: n, buttonClassN
59550
59552
  //#endregion
59551
59553
  //#region src/nodes/LayoutContainerNode.ts
59552
59554
  function Cve(e) {
59555
+ if (typeof window > "u") return null;
59553
59556
  let t = window.getComputedStyle(e).getPropertyValue("grid-template-columns");
59554
59557
  return t ? { node: i7(t) } : null;
59555
59558
  }
@@ -61443,11 +61446,11 @@ function dye(e, t, n, r = !1, i = lye, a = uye) {
61443
61446
  t.style.opacity = "0", t.style.transform = "translate(-10000px, -10000px)";
61444
61447
  return;
61445
61448
  }
61446
- let s = t.getBoundingClientRect(), c = n.getBoundingClientRect(), l = o.getBoundingClientRect(), u = e.top - s.height - i, d = e.left - a, f = window.getSelection();
61449
+ let s = t.getBoundingClientRect(), c = n.getBoundingClientRect(), l = o.getBoundingClientRect(), u = e.top - s.height - i, d = e.left - a, f = typeof window < "u" ? window.getSelection() : null;
61447
61450
  if (f && f.rangeCount > 0) {
61448
61451
  let t = f.getRangeAt(0).startContainer;
61449
61452
  if (t.nodeType === Node.ELEMENT_NODE || t.parentElement) {
61450
- let n = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement, r = window.getComputedStyle(n).textAlign;
61453
+ let n = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement, r = typeof window < "u" ? window.getComputedStyle(n).textAlign : "";
61451
61454
  (r === "right" || r === "end") && (d = e.right - s.width + a);
61452
61455
  }
61453
61456
  }
@@ -61613,8 +61616,8 @@ function fye({ editor: e, anchorElem: t, isLink: n, isBold: r, isItalic: i, isUn
61613
61616
  y();
61614
61617
  });
61615
61618
  };
61616
- return window.addEventListener("resize", r), n && n.addEventListener("scroll", r), () => {
61617
- window.removeEventListener("resize", r), n && n.removeEventListener("scroll", r);
61619
+ return typeof window < "u" && window.addEventListener("resize", r), n && n.addEventListener("scroll", r), () => {
61620
+ typeof window < "u" && window.removeEventListener("resize", r), n && n.removeEventListener("scroll", r);
61618
61621
  };
61619
61622
  }, [
61620
61623
  e,
@@ -63144,25 +63147,25 @@ function cbe({ editor: e }) {
63144
63147
  }, c(o.current), f(e), document.addEventListener("pointerup", x(e));
63145
63148
  }, [l, x]), C = P(() => {
63146
63149
  if (l) {
63147
- let { height: e, width: t, top: n, left: i } = l.elem.getBoundingClientRect(), a = Xg(l.elem), o = {
63150
+ 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 = {
63148
63151
  bottom: {
63149
63152
  backgroundColor: "none",
63150
63153
  cursor: "row-resize",
63151
63154
  height: "16px",
63152
- left: `${window.scrollX + i}px`,
63153
- top: `${window.scrollY + n + e - 16 / 2}px`,
63155
+ left: `${o + i}px`,
63156
+ top: `${c + n + e - 16 / 2}px`,
63154
63157
  width: `${t}px`
63155
63158
  },
63156
63159
  right: {
63157
63160
  backgroundColor: "none",
63158
63161
  cursor: "col-resize",
63159
63162
  height: `${e}px`,
63160
- left: `${window.scrollX + i + t - 16 / 2}px`,
63161
- top: `${window.scrollY + n}px`,
63163
+ left: `${o + i + t - 16 / 2}px`,
63164
+ top: `${c + n}px`,
63162
63165
  width: "16px"
63163
63166
  }
63164
- }, c = r.current;
63165
- 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;
63167
+ }, f = r.current;
63168
+ 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;
63166
63169
  }
63167
63170
  return {
63168
63171
  bottom: null,
@@ -65212,16 +65215,16 @@ var exe = [
65212
65215
  r9,
65213
65216
  jX,
65214
65217
  X9
65215
- ], Q9 = "main", $9 = window.parent != null && window.parent.frames.right === window;
65218
+ ], Q9 = "main", $9 = typeof window < "u" && window.parent != null && window.parent.frames.right === window;
65216
65219
  function txe({ onChange: e, value: t }) {
65217
65220
  let { historyState: n } = NA(), { settings: { isCodeHighlighted: r, isCodeShiki: i, isCollab: a, useCollabV2: o, isAutocomplete: s, isMaxLength: c, isCharLimit: l, hasLinkAttributes: u, hasNestedTables: d, isCharLimitUtf8: f, isRichText: p, showTreeView: m, showTableOfContents: h, shouldUseLexicalContextMenu: g, shouldPreserveNewLinesInMarkdown: _, tableCellMerge: v, tableCellBackgroundColor: y, tableHorizontalScroll: b, shouldAllowHighlightingWithBrackets: x, selectionAlwaysOnDisplay: S, listStrictIndent: C } } = kA(), w = jD(), ee = a ? "Enter some collaborative rich text..." : p ? "Enter some rich text..." : "Enter some plain text...", [te, ne] = R(null), [re, ie] = R(!1), [ae] = H(), [oe, se] = R(ae), [ce, le] = R(!1);
65218
65221
  return F(() => {
65219
65222
  let e = () => {
65220
- let e = Tg && window.matchMedia("(max-width: 1025px)").matches;
65223
+ let e = Tg && typeof window < "u" && window.matchMedia("(max-width: 1025px)").matches;
65221
65224
  e !== re && ie(e);
65222
65225
  };
65223
- return e(), window.addEventListener("resize", e), () => {
65224
- window.removeEventListener("resize", e);
65226
+ return e(), typeof window < "u" && window.addEventListener("resize", e), () => {
65227
+ typeof window < "u" && window.removeEventListener("resize", e);
65225
65228
  };
65226
65229
  }, [re]), /* @__PURE__ */ V(z, { children: [
65227
65230
  p && /* @__PURE__ */ B(Bbe, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaulapatrice/richtext-editor",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "author": "Patrice Chaula",
5
5
  "license": "MIT",
6
6
  "repository": {