@jackuait/blok 0.6.0-beta.2 → 0.6.0-beta.4

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.
package/dist/blok.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { B as s, v as a } from "./chunks/blok-DgRJH56D.mjs";
2
- import { D as A } from "./chunks/inline-tool-convert-I0Hy4UKl.mjs";
1
+ import { B as s, v as a } from "./chunks/blok-DK-97ZTf.mjs";
2
+ import { D as A } from "./chunks/inline-tool-convert-BIwvipPw.mjs";
3
3
  export {
4
4
  s as Blok,
5
5
  A as DATA_ATTR,
@@ -20,7 +20,7 @@ var Co = (s, t) => {
20
20
  return e;
21
21
  };
22
22
  var Ie = (s, t, e) => Io(s, typeof t != "symbol" ? t + "" : t, e);
23
- import { L as ho, l as I, c as Zi, i as U, a as k, S as w, D as y, t as R, b as C, P as X, E as yn, g as wt, d as Ji, e as gr, f as Ye, h as st, j as A, k as le, m as zt, n as kr, s as Qi, o as uo, p as Bn, q as wn, r as T, u as Ko, v as hs, F as ae, w as Vo, x as ds, y as us, z as ut, A as tl, B as el, C as ol, I as nl, G as Wo, H as $e, J as Ke, K as Mt, M as br, N as Rt, O as K, Q as Ht, R as sl, T as rl, U as ps, V as il, W as ll, X as al, Y as cl, Z as hl, _ as mr, $ as dl, a0 as yr, a1 as Br, a2 as It, a3 as ul, a4 as wr, a5 as vr, a6 as pl, a7 as fl, a8 as gl, a9 as kl, aa as bl, ab as ml, ac as fs, ad as xr, ae as yl, af as Bl, ag as wl, ah as vl, ai as xl, aj as Tl, ak as Sl, al as Il } from "./inline-tool-convert-I0Hy4UKl.mjs";
23
+ import { L as ho, l as I, c as Zi, i as U, a as k, S as w, D as y, t as R, b as C, P as X, E as yn, g as wt, d as Ji, e as gr, f as Ye, h as st, j as A, k as le, m as zt, n as kr, s as Qi, o as uo, p as Bn, q as wn, r as T, u as Ko, v as hs, F as ae, w as Vo, x as ds, y as us, z as ut, A as tl, B as el, C as ol, I as nl, G as Wo, H as $e, J as Ke, K as Mt, M as br, N as Rt, O as K, Q as Ht, R as sl, T as rl, U as ps, V as il, W as ll, X as al, Y as cl, Z as hl, _ as mr, $ as dl, a0 as yr, a1 as Br, a2 as It, a3 as ul, a4 as wr, a5 as vr, a6 as pl, a7 as fl, a8 as gl, a9 as kl, aa as bl, ab as ml, ac as fs, ad as xr, ae as yl, af as Bl, ag as wl, ah as vl, ai as xl, aj as Tl, ak as Sl, al as Il } from "./inline-tool-convert-BIwvipPw.mjs";
24
24
  function Cl(s) {
25
25
  return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
26
26
  }
@@ -1728,7 +1728,7 @@ class Kl {
1728
1728
  * @returns {Promise<NotifierModule>} loaded notifier module
1729
1729
  */
1730
1730
  loadNotifierModule() {
1731
- return this.notifierModule !== null ? Promise.resolve(this.notifierModule) : (this.loadingPromise === null && (this.loadingPromise = import("./index-B3xelE-R.mjs").then((t) => {
1731
+ return this.notifierModule !== null ? Promise.resolve(this.notifierModule) : (this.loadingPromise === null && (this.loadingPromise = import("./index-jgHmMDND.mjs").then((t) => {
1732
1732
  const e = t;
1733
1733
  if (!this.isNotifierModule(e))
1734
1734
  throw new Error('notifier module does not expose a "show" method.');
@@ -13503,7 +13503,7 @@ class nu extends x {
13503
13503
  async ensureI18nextLoaded(t, e) {
13504
13504
  if (this.i18nextWrapper !== null)
13505
13505
  return;
13506
- const { loadI18next: o } = await import("./i18next-loader-DrgsjMmb.mjs");
13506
+ const { loadI18next: o } = await import("./i18next-loader-CRollibS.mjs");
13507
13507
  this.i18nextWrapper = await o(t, e);
13508
13508
  }
13509
13509
  /**
@@ -13677,7 +13677,7 @@ class Te {
13677
13677
  * Process paste of single Block tool content.
13678
13678
  */
13679
13679
  async processSingleBlock(t, e) {
13680
- const { Caret: o, BlockManager: n } = this.Blok, { currentBlock: r } = n, { Dom: i } = await import("./inline-tool-convert-I0Hy4UKl.mjs").then((a) => a.aI), l = i;
13680
+ const { Caret: o, BlockManager: n } = this.Blok, { currentBlock: r } = n, { Dom: i } = await import("./inline-tool-convert-BIwvipPw.mjs").then((a) => a.aI), l = i;
13681
13681
  if (!r || t.tool !== r.name || !l.containsOnlyInlineElements(t.content.innerHTML)) {
13682
13682
  await this.insertBlock(t, e);
13683
13683
  return;
@@ -1,4 +1,4 @@
1
- import { e as i } from "./blok-DgRJH56D.mjs";
1
+ import { e as i } from "./blok-DK-97ZTf.mjs";
2
2
  const l = async (e, r) => {
3
3
  const n = (await import("./i18next-CugVlwWp.mjs")).default.createInstance(), s = {
4
4
  lng: e,
@@ -1,4 +1,4 @@
1
- import { a2 as s, t as f } from "./inline-tool-convert-I0Hy4UKl.mjs";
1
+ import { a2 as s, t as f } from "./inline-tool-convert-BIwvipPw.mjs";
2
2
  const a = {
3
3
  wrapper: s(
4
4
  "fixed z-[2] bottom-5 left-5",
@@ -278,7 +278,7 @@ const d = {
278
278
  DELETE: 46
279
279
  }, Ae = {
280
280
  LEFT: 0
281
- }, Se = 650, Wt = () => "0.6.0-beta.2";
281
+ }, Se = 650, Wt = () => "0.6.0-beta.4";
282
282
  var Vt = /* @__PURE__ */ ((n) => (n.VERBOSE = "VERBOSE", n.INFO = "INFO", n.WARN = "WARN", n.ERROR = "ERROR", n))(Vt || {});
283
283
  const V = (n, t, e = "log", o, s = "color: inherit") => {
284
284
  const i = typeof console == "undefined" ? void 0 : console;
package/dist/full.mjs CHANGED
@@ -12,8 +12,8 @@ var e = (a, l, o) => l in a ? n(a, l, { enumerable: !0, configurable: !0, writab
12
12
  }, r = (a, l) => t(a, c(l));
13
13
  import { List as p, Header as f, Paragraph as I, Link as k, Italic as u, Bold as B } from "./tools.mjs";
14
14
  import { defaultBlockTools as v, defaultInlineTools as A } from "./tools.mjs";
15
- import { B as H, v as P } from "./chunks/blok-DgRJH56D.mjs";
16
- import { D as _ } from "./chunks/inline-tool-convert-I0Hy4UKl.mjs";
15
+ import { B as H, v as P } from "./chunks/blok-DK-97ZTf.mjs";
16
+ import { D as _ } from "./chunks/inline-tool-convert-BIwvipPw.mjs";
17
17
  const m = {
18
18
  paragraph: {
19
19
  class: I,
package/dist/tools.mjs CHANGED
@@ -10,8 +10,8 @@ var kt = (i, t, e) => t in i ? Ee(i, t, { enumerable: !0, configurable: !0, writ
10
10
  Le.call(t, e) && kt(i, e, t[e]);
11
11
  return i;
12
12
  }, tt = (i, t) => ke(i, xe(t));
13
- import { t as v, D as E, am as Re, an as Be, _ as Ie, ao as De, ap as Ne, aq as Pe, ar as _e, as as He, at as Me, au as te, av as ee, aw as ne, o as Oe, p as xt, a5 as Tt, a3 as $e, J as se, ax as Ge, Q as oe, P as F, ay as We, az as qe, a0 as Lt, aA as Fe, aB as ze, aC as Ve, aD as Ue, aE as Ke, z as O, aF as je, aG as Xe, S as et, aH as Ye, l as Ze, a8 as Je } from "./chunks/inline-tool-convert-I0Hy4UKl.mjs";
14
- import { ab as fo } from "./chunks/inline-tool-convert-I0Hy4UKl.mjs";
13
+ import { t as v, D as E, am as Re, an as Be, _ as Ie, ao as De, ap as Ne, aq as Pe, ar as _e, as as He, at as Me, au as te, av as ee, aw as ne, o as Oe, p as xt, a5 as Tt, a3 as $e, J as se, ax as Ge, Q as oe, P as F, ay as We, az as qe, a0 as Lt, aA as Fe, aB as ze, aC as Ve, aD as Ue, aE as Ke, z as O, aF as je, aG as Xe, S as et, aH as Ye, l as Ze, a8 as Je } from "./chunks/inline-tool-convert-BIwvipPw.mjs";
14
+ import { ab as fo } from "./chunks/inline-tool-convert-BIwvipPw.mjs";
15
15
  const ie = (i) => {
16
16
  if (!i || !i.includes("data-blok-fake-background"))
17
17
  return i;
@@ -326,10 +326,10 @@ const q = class q {
326
326
  */
327
327
  buildSettingsFromToolboxEntries(t) {
328
328
  return t.map((e) => {
329
- var c, d, h, u;
330
- const n = e.data, s = (c = n == null ? void 0 : n.level) != null ? c : this.defaultLevel.number, o = q.DEFAULT_LEVELS.find((f) => f.number === s), r = (d = o == null ? void 0 : o.name) != null ? d : `Heading ${s}`, l = this.resolveToolboxEntryTitle(e, r);
329
+ var c, d, h, p;
330
+ const n = e.data, s = (c = n == null ? void 0 : n.level) != null ? c : this.defaultLevel.number, o = q.DEFAULT_LEVELS.find((m) => m.number === s), r = (d = o == null ? void 0 : o.name) != null ? d : `Heading ${s}`, l = this.resolveToolboxEntryTitle(e, r);
331
331
  return {
332
- icon: (u = (h = e.icon) != null ? h : o == null ? void 0 : o.icon) != null ? u : Be,
332
+ icon: (p = (h = e.icon) != null ? h : o == null ? void 0 : o.icon) != null ? p : Be,
333
333
  title: l,
334
334
  onActivate: () => this.setLevel(s),
335
335
  closeOnActivate: !0,
@@ -632,9 +632,9 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
632
632
  keydownHandler: c
633
633
  });
634
634
  if (h.contentElement && l(h.contentElement), h.checkboxElement && !e) {
635
- const u = h.checkboxElement;
636
- u.addEventListener("change", () => {
637
- a(u.checked, h.contentElement);
635
+ const p = h.checkboxElement;
636
+ p.addEventListener("change", () => {
637
+ a(p.checked, h.contentElement);
638
638
  });
639
639
  }
640
640
  return d.replaceChild(h.wrapper, r), h.wrapper;
@@ -647,10 +647,10 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
647
647
  };
648
648
  return i.start !== void 0 && i.start !== 1 && (o.start = i.start), i.depth !== void 0 && i.depth > 0 && (o.depth = i.depth), o;
649
649
  }, Cn = (i, t, e, n, s) => {
650
- var m, y, b;
650
+ var f, y, b;
651
651
  if (!e)
652
652
  return { newData: i, inPlace: !1 };
653
- const o = (m = i.depth) != null ? m : 0, r = (y = t.depth) != null ? y : 0, l = i.style, a = t.style;
653
+ const o = (f = i.depth) != null ? f : 0, r = (y = t.depth) != null ? y : 0, l = i.style, a = t.style;
654
654
  if (l !== a)
655
655
  return { newData: i, inPlace: !1 };
656
656
  const c = "depth" in t ? t.depth : 0, d = tt(L(L({}, i), t), {
@@ -864,8 +864,8 @@ const Pn = (i, t) => {
864
864
  const l = t.getBlockIndex(i.id);
865
865
  if (l == null)
866
866
  return;
867
- const a = de(i, e), c = he(i, n) || "ordered", d = n.getSiblingIndex(l, a, c), u = n.getGroupStartValue(l, a, d, c) + d, f = n.formatNumber(u, a);
868
- r.textContent = f;
867
+ const a = de(i, e), c = he(i, n) || "ordered", d = n.getSiblingIndex(l, a, c), p = n.getGroupStartValue(l, a, d, c) + d, m = n.formatNumber(p, a);
868
+ r.textContent = m;
869
869
  }, $n = (i, t, e, n, s, o, r, l) => {
870
870
  const a = (c) => {
871
871
  if (c >= t)
@@ -912,7 +912,7 @@ const Pn = (i, t) => {
912
912
  e === "start" ? (r.setStart(s, 0), r.collapse(!0)) : (r.selectNodeContents(s), r.collapse(!1)), o.removeAllRanges(), o.addRange(r), i.caret.updateLastCaretAfterPosition();
913
913
  });
914
914
  }, Wn = async (i) => {
915
- var m;
915
+ var f;
916
916
  const { api: t, blockId: e, data: n, element: s, getContentElement: o } = i, r = window.getSelection();
917
917
  if (!r || !s) return;
918
918
  const l = o();
@@ -922,7 +922,7 @@ const Pn = (i, t) => {
922
922
  await qn(i);
923
923
  return;
924
924
  }
925
- const c = r.getRangeAt(0), { beforeContent: d, afterContent: h } = An(l, c), u = e && (m = t.blocks.getBlockIndex(e)) != null ? m : t.blocks.getCurrentBlockIndex();
925
+ const c = r.getRangeAt(0), { beforeContent: d, afterContent: h } = An(l, c), p = e && (f = t.blocks.getBlockIndex(e)) != null ? f : t.blocks.getCurrentBlockIndex();
926
926
  if (!e) {
927
927
  l.innerHTML = d, n.text = d;
928
928
  const y = t.blocks.insert(w, {
@@ -930,11 +930,11 @@ const Pn = (i, t) => {
930
930
  style: n.style,
931
931
  checked: !1,
932
932
  depth: n.depth
933
- }, void 0, u + 1, !0);
933
+ }, void 0, p + 1, !0);
934
934
  Y(t, y, "start");
935
935
  return;
936
936
  }
937
- const f = t.blocks.splitBlock(
937
+ const m = t.blocks.splitBlock(
938
938
  e,
939
939
  { text: d },
940
940
  w,
@@ -944,9 +944,9 @@ const Pn = (i, t) => {
944
944
  checked: !1,
945
945
  depth: n.depth
946
946
  },
947
- u + 1
947
+ p + 1
948
948
  );
949
- n.text = d, Y(t, f, "start");
949
+ n.text = d, Y(t, m, "start");
950
950
  }, qn = async (i) => {
951
951
  const { api: t, blockId: e, getDepth: n } = i;
952
952
  if (n() > 0) {
@@ -963,7 +963,7 @@ const Pn = (i, t) => {
963
963
  const d = c.getRangeAt(0), h = r();
964
964
  if (!h) return;
965
965
  a();
966
- const u = s.text, f = l();
966
+ const p = s.text, m = l();
967
967
  if (xn(h, d) && !c.isCollapsed) {
968
968
  t.preventDefault(), h.innerHTML = "", s.text = "";
969
969
  const b = document.createRange();
@@ -972,10 +972,10 @@ const Pn = (i, t) => {
972
972
  }
973
973
  if (!kn(h, d) || (t.preventDefault(), n === void 0))
974
974
  return;
975
- const y = await e.blocks.convert(n, "paragraph", { text: u });
976
- f > 0 && requestAnimationFrame(() => {
975
+ const y = await e.blocks.convert(n, "paragraph", { text: p });
976
+ m > 0 && requestAnimationFrame(() => {
977
977
  const b = y.holder;
978
- b && (b.style.marginLeft = `${f * V}px`, b.setAttribute("data-blok-depth", String(f)));
978
+ b && (b.style.marginLeft = `${m * V}px`, b.setAttribute("data-blok-depth", String(m)));
979
979
  }), Y(e, y, "start");
980
980
  }, zn = async (i, t) => {
981
981
  const { api: e, blockId: n, data: s, syncContentFromDOM: o, getDepth: r } = i, l = e.blocks.getCurrentBlockIndex();
@@ -987,10 +987,10 @@ const Pn = (i, t) => {
987
987
  o();
988
988
  const h = c + 1;
989
989
  s.depth = h;
990
- const u = await e.blocks.update(n || "", tt(L({}, s), {
990
+ const p = await e.blocks.update(n || "", tt(L({}, s), {
991
991
  depth: h
992
992
  }));
993
- Y(e, u);
993
+ Y(e, p);
994
994
  }, pe = async (i) => {
995
995
  const { api: t, blockId: e, data: n, syncContentFromDOM: s, getDepth: o } = i, r = o();
996
996
  if (r === 0) return;
@@ -1311,12 +1311,12 @@ class jn {
1311
1311
  if (o == null)
1312
1312
  return;
1313
1313
  const r = this.depthValidator.getBlockDepth(t), l = this.getBlockStyle(t) || "ordered", a = this.markerCalculator.getSiblingIndex(o, r, l), c = this.markerCalculator.getGroupStartValue(o, r, a, l), h = (a === 0 && c === 1 ? (() => {
1314
- const f = n.closest("[data-list-start]"), m = f == null ? void 0 : f.getAttribute("data-list-start");
1315
- if (!m) return c;
1316
- const y = parseInt(m, 10);
1314
+ const m = n.closest("[data-list-start]"), f = m == null ? void 0 : m.getAttribute("data-list-start");
1315
+ if (!f) return c;
1316
+ const y = parseInt(f, 10);
1317
1317
  return isNaN(y) ? c : y;
1318
- })() : c) + a, u = this.markerCalculator.formatNumber(h, r);
1319
- s.textContent = u;
1318
+ })() : c) + a, p = this.markerCalculator.formatNumber(h, r);
1319
+ s.textContent = p;
1320
1320
  }
1321
1321
  }
1322
1322
  const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
@@ -1881,7 +1881,7 @@ class cs {
1881
1881
  e && (e.setAttribute("width", $t), e.setAttribute("height", $t), e.setAttribute("viewBox", "0 0 24 24"), e.classList.add("text-gray-500", "pointer-events-none"));
1882
1882
  }
1883
1883
  }
1884
- const g = "data-blok-table-row", p = "data-blok-table-cell", $ = 1, nt = `${$}px solid #d1d5db`, ds = [
1884
+ const g = "data-blok-table-row", u = "data-blok-table-cell", $ = 1, nt = `${$}px solid #d1d5db`, ds = [
1885
1885
  "flex"
1886
1886
  ], hs = [
1887
1887
  "py-1",
@@ -1921,7 +1921,7 @@ class ps {
1921
1921
  getData(t) {
1922
1922
  const e = t.querySelectorAll(`[${g}]`), n = [];
1923
1923
  return e.forEach((s) => {
1924
- const o = s.querySelectorAll(`[${p}]`), r = [];
1924
+ const o = s.querySelectorAll(`[${u}]`), r = [];
1925
1925
  o.forEach((l) => {
1926
1926
  r.push(this.getCellContent(l));
1927
1927
  }), n.push(r);
@@ -1959,7 +1959,7 @@ class ps {
1959
1959
  */
1960
1960
  convertToPixelWidths(t, e) {
1961
1961
  t.forEach((n) => {
1962
- n.querySelectorAll(`[${p}]`).forEach((o, r) => {
1962
+ n.querySelectorAll(`[${u}]`).forEach((o, r) => {
1963
1963
  if (r < e.length) {
1964
1964
  const l = o;
1965
1965
  l.style.width = `${e[r]}px`;
@@ -1971,12 +1971,12 @@ class ps {
1971
1971
  * Add column in px mode: keep existing widths, add new column at half the average width
1972
1972
  */
1973
1973
  addColumnPx(t, e, n) {
1974
- const s = t[0], o = s == null ? void 0 : s.querySelectorAll(`[${p}]`), r = Array.from(o != null ? o : []).reduce(
1974
+ const s = t[0], o = s == null ? void 0 : s.querySelectorAll(`[${u}]`), r = Array.from(o != null ? o : []).reduce(
1975
1975
  (a, c) => a + (parseFloat(c.style.width) || 0),
1976
1976
  0
1977
1977
  ), l = e > 0 ? Math.round(r / e / 2 * 100) / 100 : 0;
1978
1978
  t.forEach((a) => {
1979
- const c = a.querySelectorAll(`[${p}]`), d = n === void 0 || n >= c.length, h = this.createCell(`${l}px`);
1979
+ const c = a.querySelectorAll(`[${u}]`), d = n === void 0 || n >= c.length, h = this.createCell(`${l}px`);
1980
1980
  if (!d) {
1981
1981
  a.insertBefore(h, c[n]);
1982
1982
  return;
@@ -1990,11 +1990,11 @@ class ps {
1990
1990
  addColumnPercent(t, e, n) {
1991
1991
  const o = 1 - 0.5 / e;
1992
1992
  t.forEach((r) => {
1993
- r.querySelectorAll(`[${p}]`).forEach((u) => {
1994
- const f = u, m = parseFloat(f.style.width) || 100 / e, y = Math.round(m * o * 100) / 100;
1995
- f.style.width = `${y}%`;
1993
+ r.querySelectorAll(`[${u}]`).forEach((p) => {
1994
+ const m = p, f = parseFloat(m.style.width) || 100 / e, y = Math.round(f * o * 100) / 100;
1995
+ m.style.width = `${y}%`;
1996
1996
  });
1997
- const a = Math.round(100 / e / 2 * 100) / 100, c = r.querySelectorAll(`[${p}]`), d = n === void 0 || n >= c.length, h = this.createCell(`${a}%`);
1997
+ const a = Math.round(100 / e / 2 * 100) / 100, c = r.querySelectorAll(`[${u}]`), d = n === void 0 || n >= c.length, h = this.createCell(`${a}%`);
1998
1998
  if (!d) {
1999
1999
  r.insertBefore(h, c[n]);
2000
2000
  return;
@@ -2007,7 +2007,7 @@ class ps {
2007
2007
  */
2008
2008
  deleteColumn(t, e) {
2009
2009
  t.querySelectorAll(`[${g}]`).forEach((s) => {
2010
- const o = s.querySelectorAll(`[${p}]`);
2010
+ const o = s.querySelectorAll(`[${u}]`);
2011
2011
  e >= o.length || o[e].remove();
2012
2012
  });
2013
2013
  }
@@ -2034,12 +2034,12 @@ class ps {
2034
2034
  if (e === n)
2035
2035
  return;
2036
2036
  t.querySelectorAll(`[${g}]`).forEach((o) => {
2037
- const r = Array.from(o.querySelectorAll(`[${p}]`));
2037
+ const r = Array.from(o.querySelectorAll(`[${u}]`));
2038
2038
  if (e >= r.length || n >= r.length)
2039
2039
  return;
2040
2040
  const l = r[e];
2041
2041
  l.remove();
2042
- const a = Array.from(o.querySelectorAll(`[${p}]`));
2042
+ const a = Array.from(o.querySelectorAll(`[${u}]`));
2043
2043
  n >= a.length ? o.appendChild(l) : o.insertBefore(l, a[n]);
2044
2044
  });
2045
2045
  }
@@ -2054,7 +2054,7 @@ class ps {
2054
2054
  */
2055
2055
  getColumnCount(t) {
2056
2056
  const e = t.querySelector(`[${g}]`);
2057
- return e ? e.querySelectorAll(`[${p}]`).length : 0;
2057
+ return e ? e.querySelectorAll(`[${u}]`).length : 0;
2058
2058
  }
2059
2059
  /**
2060
2060
  * Get a specific cell element
@@ -2063,7 +2063,7 @@ class ps {
2063
2063
  const s = t.querySelectorAll(`[${g}]`);
2064
2064
  if (e >= s.length)
2065
2065
  return null;
2066
- const o = s[e].querySelectorAll(`[${p}]`);
2066
+ const o = s[e].querySelectorAll(`[${u}]`);
2067
2067
  return n >= o.length ? null : o[n];
2068
2068
  }
2069
2069
  /**
@@ -2073,7 +2073,7 @@ class ps {
2073
2073
  const e = t.querySelector(`[${g}]`);
2074
2074
  if (!e)
2075
2075
  return [];
2076
- const n = e.querySelectorAll(`[${p}]`), s = [];
2076
+ const n = e.querySelectorAll(`[${u}]`), s = [];
2077
2077
  return n.forEach((o) => {
2078
2078
  const r = parseFloat(o.style.width);
2079
2079
  s.push(isNaN(r) ? 0 : r);
@@ -2099,7 +2099,7 @@ class ps {
2099
2099
  const e = t.querySelector(`[${g}]`);
2100
2100
  if (!e)
2101
2101
  return "%";
2102
- const n = e.querySelector(`[${p}]`);
2102
+ const n = e.querySelector(`[${u}]`);
2103
2103
  return n && n.style.width.endsWith("px") ? "px" : "%";
2104
2104
  }
2105
2105
  /**
@@ -2109,7 +2109,7 @@ class ps {
2109
2109
  const e = t.querySelector(`[${g}]`);
2110
2110
  if (!e)
2111
2111
  return [];
2112
- const n = e.querySelectorAll(`[${p}]`);
2112
+ const n = e.querySelectorAll(`[${u}]`);
2113
2113
  return Array.from(n).map((s) => s.style.width);
2114
2114
  }
2115
2115
  /**
@@ -2126,7 +2126,7 @@ class ps {
2126
2126
  */
2127
2127
  createCell(t) {
2128
2128
  const e = document.createElement("div");
2129
- e.className = v(hs), e.style.borderRight = nt, e.style.borderBottom = nt, e.style.flexShrink = "0", e.style.overflow = "hidden", e.style.overflowWrap = "break-word", t !== void 0 && (e.style.width = typeof t == "string" ? t : `${t}%`), e.setAttribute(p, "");
2129
+ e.className = v(hs), e.style.borderRight = nt, e.style.borderBottom = nt, e.style.flexShrink = "0", e.style.overflow = "hidden", e.style.overflowWrap = "break-word", t !== void 0 && (e.style.width = typeof t == "string" ? t : `${t}%`), e.setAttribute(u, "");
2130
2130
  const n = document.createElement("div");
2131
2131
  return n.setAttribute(B, ""), e.appendChild(n), e;
2132
2132
  }
@@ -2139,7 +2139,7 @@ class gs {
2139
2139
  return;
2140
2140
  const { type: n, detail: s } = e.event;
2141
2141
  if (n === "block-removed") {
2142
- this.recordRemovedBlockCell(s), this.gridElement.querySelectorAll(`[${p}]`).forEach((h) => {
2142
+ this.recordRemovedBlockCell(s), this.gridElement.querySelectorAll(`[${u}]`).forEach((h) => {
2143
2143
  this.cellsPendingCheck.add(h);
2144
2144
  }), this.schedulePendingCellCheck();
2145
2145
  return;
@@ -2272,20 +2272,20 @@ class gs {
2272
2272
  const r = e[o];
2273
2273
  if (!r)
2274
2274
  return;
2275
- const l = r.querySelectorAll(`[${p}]`), a = [];
2275
+ const l = r.querySelectorAll(`[${u}]`), a = [];
2276
2276
  s.forEach((c, d) => {
2277
2277
  const h = l[d];
2278
2278
  if (!h)
2279
2279
  return;
2280
- const u = h.querySelector(`[${B}]`);
2281
- if (u) {
2280
+ const p = h.querySelector(`[${B}]`);
2281
+ if (p) {
2282
2282
  if (fe(c))
2283
- this.mountBlocksInCell(u, c.blocks), a.push(c);
2283
+ this.mountBlocksInCell(p, c.blocks), a.push(c);
2284
2284
  else {
2285
- const f = typeof c == "string" ? c : "", m = this.api.blocks.insert("paragraph", { text: f }, {}, this.api.blocks.getBlocksCount(), !1);
2286
- u.appendChild(m.holder), a.push({ blocks: [m.id] });
2285
+ const m = typeof c == "string" ? c : "", f = this.api.blocks.insert("paragraph", { text: m }, {}, this.api.blocks.getBlocksCount(), !1);
2286
+ p.appendChild(f.holder), a.push({ blocks: [f.id] });
2287
2287
  }
2288
- this.stripPlaceholders(u);
2288
+ this.stripPlaceholders(p);
2289
2289
  }
2290
2290
  }), n.push(a);
2291
2291
  }), n;
@@ -2341,7 +2341,7 @@ class gs {
2341
2341
  findCellForAdjacentBlock(t) {
2342
2342
  if (t < 0 || t >= this.api.blocks.getBlocksCount())
2343
2343
  return null;
2344
- const e = this.api.blocks.getBlockByIndex(t), n = e == null ? void 0 : e.holder.closest(`[${p}]`);
2344
+ const e = this.api.blocks.getBlockByIndex(t), n = e == null ? void 0 : e.holder.closest(`[${u}]`);
2345
2345
  return n && this.gridElement.contains(n) ? n : null;
2346
2346
  }
2347
2347
  /**
@@ -2363,7 +2363,7 @@ class gs {
2363
2363
  recordRemovedBlockCell(t) {
2364
2364
  if (t.index === void 0)
2365
2365
  return;
2366
- const e = t.target.holder.closest(`[${p}]`);
2366
+ const e = t.target.holder.closest(`[${u}]`);
2367
2367
  e && this.gridElement.contains(e) && this.removedBlockCells.set(t.index, e);
2368
2368
  }
2369
2369
  /**
@@ -2476,7 +2476,7 @@ class As {
2476
2476
  */
2477
2477
  selectRow(t) {
2478
2478
  var s, o;
2479
- const n = (o = (s = this.grid.querySelectorAll(`[${g}]`)[0]) == null ? void 0 : s.querySelectorAll(`[${p}]`).length) != null ? o : 0;
2479
+ const n = (o = (s = this.grid.querySelectorAll(`[${g}]`)[0]) == null ? void 0 : s.querySelectorAll(`[${u}]`).length) != null ? o : 0;
2480
2480
  n !== 0 && this.showProgrammaticSelection(t, 0, t, n - 1);
2481
2481
  }
2482
2482
  /**
@@ -2562,19 +2562,19 @@ class As {
2562
2562
  const T = o[P];
2563
2563
  if (!T)
2564
2564
  continue;
2565
- const _ = T.querySelectorAll(`[${p}]`);
2565
+ const _ = T.querySelectorAll(`[${u}]`);
2566
2566
  for (let H = n; H <= s; H++) {
2567
2567
  const J = _[H];
2568
2568
  J && (J.setAttribute(ht, ""), this.selectedCells.push(J));
2569
2569
  }
2570
2570
  }
2571
- const r = (D = o[t]) == null ? void 0 : D.querySelectorAll(`[${p}]`)[n], l = (N = o[e]) == null ? void 0 : N.querySelectorAll(`[${p}]`)[s];
2571
+ const r = (D = o[t]) == null ? void 0 : D.querySelectorAll(`[${u}]`)[n], l = (N = o[e]) == null ? void 0 : N.querySelectorAll(`[${u}]`)[s];
2572
2572
  if (!r || !l)
2573
2573
  return;
2574
- const a = this.grid.getBoundingClientRect(), c = r.getBoundingClientRect(), d = l.getBoundingClientRect(), h = getComputedStyle(this.grid), u = parseFloat(h.borderTopWidth) || 0, f = parseFloat(h.borderLeftWidth) || 0;
2575
- let m = c.top - a.top - u, y = c.left - a.left - f;
2574
+ const a = this.grid.getBoundingClientRect(), c = r.getBoundingClientRect(), d = l.getBoundingClientRect(), h = getComputedStyle(this.grid), p = parseFloat(h.borderTopWidth) || 0, m = parseFloat(h.borderLeftWidth) || 0;
2575
+ let f = c.top - a.top - p, y = c.left - a.left - m;
2576
2576
  const b = d.right - c.left + 1, I = d.bottom - c.top + 1;
2577
- m -= 1, y -= 1, this.overlay || (this.overlay = document.createElement("div"), this.overlay.setAttribute("data-blok-table-selection-overlay", ""), this.overlay.style.position = "absolute", this.overlay.style.border = ys, this.overlay.style.pointerEvents = "none", this.overlay.style.boxSizing = "border-box", this.overlay.style.borderRadius = "2px", this.grid.appendChild(this.overlay)), this.overlay.style.top = `${m}px`, this.overlay.style.left = `${y}px`, this.overlay.style.width = `${b}px`, this.overlay.style.height = `${I}px`, this.pill || (this.pill = this.createPill(), this.grid.appendChild(this.pill)), this.pill.style.left = `${y + b - 1}px`, this.pill.style.top = `${m + I / 2}px`;
2577
+ f -= 1, y -= 1, this.overlay || (this.overlay = document.createElement("div"), this.overlay.setAttribute("data-blok-table-selection-overlay", ""), this.overlay.style.position = "absolute", this.overlay.style.border = ys, this.overlay.style.pointerEvents = "none", this.overlay.style.boxSizing = "border-box", this.overlay.style.borderRadius = "2px", this.grid.appendChild(this.overlay)), this.overlay.style.top = `${f}px`, this.overlay.style.left = `${y}px`, this.overlay.style.width = `${b}px`, this.overlay.style.height = `${I}px`, this.pill || (this.pill = this.createPill(), this.grid.appendChild(this.pill)), this.pill.style.left = `${y + b - 1}px`, this.pill.style.top = `${f + I / 2}px`;
2578
2578
  }
2579
2579
  createPill() {
2580
2580
  const t = document.createElement("div");
@@ -2632,7 +2632,7 @@ class As {
2632
2632
  }
2633
2633
  }
2634
2634
  resolveCellCoord(t) {
2635
- const e = t.closest(`[${p}]`);
2635
+ const e = t.closest(`[${u}]`);
2636
2636
  if (!e)
2637
2637
  return null;
2638
2638
  const n = e.closest(`[${g}]`);
@@ -2641,20 +2641,20 @@ class As {
2641
2641
  const o = Array.from(this.grid.querySelectorAll(`[${g}]`)).indexOf(n);
2642
2642
  if (o < 0)
2643
2643
  return null;
2644
- const l = Array.from(n.querySelectorAll(`[${p}]`)).indexOf(e);
2644
+ const l = Array.from(n.querySelectorAll(`[${u}]`)).indexOf(e);
2645
2645
  return l < 0 ? null : { row: o, col: l };
2646
2646
  }
2647
2647
  clampExtentToEdge(t) {
2648
- var c, d, h, u, f, m;
2648
+ var c, d, h, p, m, f;
2649
2649
  if (!this.anchorCell || !this.isSelecting)
2650
2650
  return;
2651
- const e = this.grid.getBoundingClientRect(), n = this.grid.querySelectorAll(`[${g}]`), s = n.length, o = (d = (c = n[0]) == null ? void 0 : c.querySelectorAll(`[${p}]`).length) != null ? d : 0;
2651
+ const e = this.grid.getBoundingClientRect(), n = this.grid.querySelectorAll(`[${g}]`), s = n.length, o = (d = (c = n[0]) == null ? void 0 : c.querySelectorAll(`[${u}]`).length) != null ? d : 0;
2652
2652
  if (s === 0 || o === 0)
2653
2653
  return;
2654
2654
  let r;
2655
- t.clientY < e.top ? r = 0 : t.clientY > e.bottom ? r = s - 1 : r = (u = (h = this.extentCell) == null ? void 0 : h.row) != null ? u : this.anchorCell.row;
2655
+ t.clientY < e.top ? r = 0 : t.clientY > e.bottom ? r = s - 1 : r = (p = (h = this.extentCell) == null ? void 0 : h.row) != null ? p : this.anchorCell.row;
2656
2656
  let l;
2657
- t.clientX < e.left ? l = 0 : t.clientX > e.right ? l = o - 1 : l = (m = (f = this.extentCell) == null ? void 0 : f.col) != null ? m : this.anchorCell.col;
2657
+ t.clientX < e.left ? l = 0 : t.clientX > e.right ? l = o - 1 : l = (f = (m = this.extentCell) == null ? void 0 : m.col) != null ? f : this.anchorCell.col;
2658
2658
  const a = { row: r, col: l };
2659
2659
  (!this.extentCell || this.extentCell.row !== a.row || this.extentCell.col !== a.col) && (this.extentCell = a, this.paintSelection());
2660
2660
  }
@@ -2663,14 +2663,14 @@ const lt = (i) => {
2663
2663
  const t = i.querySelector(`[${g}]`);
2664
2664
  if (!t)
2665
2665
  return [];
2666
- const e = t.querySelectorAll(`[${p}]`);
2666
+ const e = t.querySelectorAll(`[${u}]`);
2667
2667
  return Array.from(e).map(
2668
2668
  (n) => n.getBoundingClientRect().width
2669
2669
  );
2670
2670
  }, st = (i, t) => {
2671
2671
  const e = t.reduce((o, r) => o + r, 0), n = i;
2672
2672
  n.style.width = `${e + $}px`, i.querySelectorAll(`[${g}]`).forEach((o) => {
2673
- o.querySelectorAll(`[${p}]`).forEach((l, a) => {
2673
+ o.querySelectorAll(`[${u}]`).forEach((l, a) => {
2674
2674
  if (a < t.length) {
2675
2675
  const c = l;
2676
2676
  c.style.width = `${t[a]}px`;
@@ -2678,10 +2678,10 @@ const lt = (i) => {
2678
2678
  });
2679
2679
  });
2680
2680
  }, Es = (i, t) => {
2681
- const e = Array.from(i.querySelectorAll(`[${g}]`)), n = e.findIndex((r) => Array.from(r.querySelectorAll(`[${p}]`)).includes(t));
2681
+ const e = Array.from(i.querySelectorAll(`[${g}]`)), n = e.findIndex((r) => Array.from(r.querySelectorAll(`[${u}]`)).includes(t));
2682
2682
  if (n === -1)
2683
2683
  return null;
2684
- const o = Array.from(e[n].querySelectorAll(`[${p}]`)).indexOf(t);
2684
+ const o = Array.from(e[n].querySelectorAll(`[${u}]`)).indexOf(t);
2685
2685
  return { row: n, col: o };
2686
2686
  }, Ce = (i) => {
2687
2687
  var e;
@@ -2691,19 +2691,19 @@ const lt = (i) => {
2691
2691
  const n = i.querySelectorAll(`[${g}]`)[t];
2692
2692
  if (!n)
2693
2693
  return !0;
2694
- const s = n.querySelectorAll(`[${p}]`);
2694
+ const s = n.querySelectorAll(`[${u}]`);
2695
2695
  return Array.from(s).every((o) => Ce(o));
2696
2696
  }, xs = (i, t) => {
2697
2697
  const e = i.querySelectorAll(`[${g}]`);
2698
2698
  return Array.from(e).every((n) => {
2699
- const o = n.querySelectorAll(`[${p}]`)[t];
2699
+ const o = n.querySelectorAll(`[${u}]`)[t];
2700
2700
  return !o || Ce(o);
2701
2701
  });
2702
2702
  }, Ts = (i) => {
2703
2703
  const t = i.querySelectorAll(`[${g}]`), e = t[0];
2704
2704
  if (!e)
2705
2705
  return;
2706
- const n = e.querySelectorAll(`[${p}]`), s = Array.from(n).reduce(
2706
+ const n = e.querySelectorAll(`[${u}]`), s = Array.from(n).reduce(
2707
2707
  (r, l) => r + (parseFloat(l.style.width) || 0),
2708
2708
  0
2709
2709
  );
@@ -2711,7 +2711,7 @@ const lt = (i) => {
2711
2711
  return;
2712
2712
  const o = 100 / s;
2713
2713
  t.forEach((r) => {
2714
- r.querySelectorAll(`[${p}]`).forEach((a) => {
2714
+ r.querySelectorAll(`[${u}]`).forEach((a) => {
2715
2715
  const c = a, d = parseFloat(c.style.width) || 0;
2716
2716
  c.style.width = `${Math.round(d * o * 100) / 100}%`;
2717
2717
  });
@@ -2741,20 +2741,20 @@ const lt = (i) => {
2741
2741
  if (!i)
2742
2742
  return [];
2743
2743
  const s = i.querySelectorAll(`[${g}]`)[e];
2744
- return s ? (o = t == null ? void 0 : t.getBlockIdsFromCells(s.querySelectorAll(`[${p}]`))) != null ? o : [] : [];
2744
+ return s ? (o = t == null ? void 0 : t.getBlockIdsFromCells(s.querySelectorAll(`[${u}]`))) != null ? o : [] : [];
2745
2745
  }, Is = (i, t, e) => {
2746
2746
  var o;
2747
2747
  if (!i)
2748
2748
  return [];
2749
2749
  const n = i.querySelectorAll(`[${g}]`), s = [];
2750
2750
  return n.forEach((r) => {
2751
- const l = r.querySelectorAll(`[${p}]`);
2751
+ const l = r.querySelectorAll(`[${u}]`);
2752
2752
  e < l.length && s.push(l[e]);
2753
2753
  }), (o = t == null ? void 0 : t.getBlockIdsFromCells(s)) != null ? o : [];
2754
2754
  }, pt = (i, t, e, n) => {
2755
2755
  const o = i.querySelectorAll(`[${g}]`)[t];
2756
2756
  if (o && n) {
2757
- const r = o.querySelectorAll(`[${p}]`);
2757
+ const r = o.querySelectorAll(`[${u}]`);
2758
2758
  n.deleteBlocks(n.getBlockIdsFromCells(r));
2759
2759
  }
2760
2760
  e.deleteRow(i, t);
@@ -2762,13 +2762,13 @@ const lt = (i) => {
2762
2762
  if (s) {
2763
2763
  const o = i.querySelectorAll(`[${g}]`), r = [];
2764
2764
  o.forEach((l) => {
2765
- const a = l.querySelectorAll(`[${p}]`);
2765
+ const a = l.querySelectorAll(`[${u}]`);
2766
2766
  t < a.length && r.push(a[t]);
2767
2767
  }), s.deleteBlocks(s.getBlockIdsFromCells(r));
2768
2768
  }
2769
2769
  return n.deleteColumn(i, t), Rs(e, t);
2770
2770
  }, W = (i, t) => {
2771
- i.querySelectorAll(`[${p}]`).forEach((n) => {
2771
+ i.querySelectorAll(`[${u}]`).forEach((n) => {
2772
2772
  t == null || t.ensureCellHasBlock(n);
2773
2773
  });
2774
2774
  }, Ds = (i, t, e) => {
@@ -2777,7 +2777,7 @@ const lt = (i) => {
2777
2777
  const r = n[o];
2778
2778
  if (!r)
2779
2779
  return;
2780
- const l = r.querySelectorAll(`[${p}]`);
2780
+ const l = r.querySelectorAll(`[${u}]`);
2781
2781
  s.forEach((a, c) => {
2782
2782
  const d = l[c];
2783
2783
  if (!d)
@@ -2785,9 +2785,11 @@ const lt = (i) => {
2785
2785
  const h = d.querySelector(`[${B}]`);
2786
2786
  if (h) {
2787
2787
  if (!fe(a)) {
2788
- const u = typeof a == "string" ? a : "", f = e.blocks.insert(
2788
+ if (h.querySelectorAll("[data-blok-id]").length > 0)
2789
+ return;
2790
+ const m = typeof a == "string" ? a : "", f = e.blocks.insert(
2789
2791
  "paragraph",
2790
- { text: u },
2792
+ { text: m },
2791
2793
  {},
2792
2794
  void 0,
2793
2795
  !0
@@ -2795,18 +2797,18 @@ const lt = (i) => {
2795
2797
  f != null && f.holder && h.appendChild(f.holder);
2796
2798
  return;
2797
2799
  }
2798
- for (const u of a.blocks) {
2799
- const f = e.blocks.getBlockIndex(u);
2800
- if (f === void 0)
2800
+ for (const p of a.blocks) {
2801
+ const m = e.blocks.getBlockIndex(p);
2802
+ if (m === void 0)
2801
2803
  continue;
2802
- const m = e.blocks.getBlockByIndex(f);
2803
- m && h.appendChild(m.holder);
2804
+ const f = e.blocks.getBlockByIndex(m);
2805
+ f && h.appendChild(f.holder);
2804
2806
  }
2805
2807
  }
2806
2808
  });
2807
2809
  });
2808
2810
  }, Ns = (i, t) => {
2809
- var l, a, c, d, h, u, f, m, y, b;
2811
+ var l, a, c, d, h, p, m, f, y, b;
2810
2812
  if (!(typeof i == "object" && i !== null && "content" in i))
2811
2813
  return {
2812
2814
  withHeadings: (l = t.withHeadings) != null ? l : !1,
@@ -2816,15 +2818,15 @@ const lt = (i) => {
2816
2818
  };
2817
2819
  const n = i, s = (d = (c = n.content) == null ? void 0 : c[0]) == null ? void 0 : d.length, o = n.colWidths, r = o && s && o.length === s ? o : void 0;
2818
2820
  return {
2819
- withHeadings: (u = (h = n.withHeadings) != null ? h : t.withHeadings) != null ? u : !1,
2820
- withHeadingColumn: (f = n.withHeadingColumn) != null ? f : !1,
2821
- stretched: (y = (m = n.stretched) != null ? m : t.stretched) != null ? y : !1,
2821
+ withHeadings: (p = (h = n.withHeadings) != null ? h : t.withHeadings) != null ? p : !1,
2822
+ withHeadingColumn: (m = n.withHeadingColumn) != null ? m : !1,
2823
+ stretched: (y = (f = n.stretched) != null ? f : t.stretched) != null ? y : !1,
2822
2824
  content: (b = n.content) != null ? b : [],
2823
2825
  colWidths: r
2824
2826
  };
2825
2827
  }, Ps = (i, t) => {
2826
2828
  i.addEventListener("keydown", (e) => {
2827
- const s = e.target.closest(`[${p}]`);
2829
+ const s = e.target.closest(`[${u}]`);
2828
2830
  if (!s)
2829
2831
  return;
2830
2832
  const o = Es(i, s);
@@ -2848,10 +2850,10 @@ const lt = (i) => {
2848
2850
  const e = i.firstElementChild;
2849
2851
  if (!e)
2850
2852
  return;
2851
- e.querySelectorAll(`[${p}]`).forEach((s) => {
2853
+ e.querySelectorAll(`[${u}]`).forEach((s) => {
2852
2854
  s.removeAttribute("data-blok-table-heading-col");
2853
2855
  }), t && e.querySelectorAll(`[${g}]`).forEach((o) => {
2854
- const r = o.querySelector(`[${p}]`);
2856
+ const r = o.querySelector(`[${u}]`);
2855
2857
  r && r.setAttribute("data-blok-table-heading-col", "");
2856
2858
  });
2857
2859
  }, Vt = "data-blok-table-resize", _s = "data-blok-table-cell", Hs = "data-blok-table-row", Ms = 50, ft = 16;
@@ -2993,12 +2995,12 @@ const $s = [
2993
2995
  const h = () => {
2994
2996
  c.style.backgroundColor = o.active ? "#3b82f6" : "#d1d5db", d.style.left = o.active ? "16px" : "2px";
2995
2997
  };
2996
- return h(), r.addEventListener("click", (u) => {
2997
- u.stopPropagation(), o.active = !o.active, h(), s(o.active);
2998
+ return h(), r.addEventListener("click", (p) => {
2999
+ p.stopPropagation(), o.active = !o.active, h(), s(o.active);
2998
3000
  }), r;
2999
3001
  }, Kt = 10, zs = "data-blok-table-drag-ghost", bt = (i) => {
3000
3002
  const t = i.querySelector(`[${g}]`);
3001
- return t ? Array.from(t.querySelectorAll(`[${p}]`)).reduce(
3003
+ return t ? Array.from(t.querySelectorAll(`[${u}]`)).reduce(
3002
3004
  (n, s) => {
3003
3005
  const o = n[n.length - 1];
3004
3006
  return [...n, o + s.offsetWidth];
@@ -3052,14 +3054,14 @@ class Vs {
3052
3054
  const e = t[this.dragFromIndex];
3053
3055
  if (!e)
3054
3056
  return;
3055
- e.querySelectorAll(`[${p}]`).forEach((s) => {
3057
+ e.querySelectorAll(`[${u}]`).forEach((s) => {
3056
3058
  const o = s;
3057
3059
  o.style.backgroundColor = "#dbeafe", o.style.opacity = "0.6", this.dragOverlayCells.push(o);
3058
3060
  });
3059
3061
  }
3060
3062
  highlightColumnCells(t) {
3061
3063
  t.forEach((e) => {
3062
- const n = e.querySelectorAll(`[${p}]`);
3064
+ const n = e.querySelectorAll(`[${u}]`);
3063
3065
  if (this.dragFromIndex >= n.length)
3064
3066
  return;
3065
3067
  const s = n[this.dragFromIndex];
@@ -3136,7 +3138,7 @@ class Vs {
3136
3138
  const t = this.grid.querySelectorAll(`[${g}]`), e = t[0], n = t[t.length - 1];
3137
3139
  if (!e || !n)
3138
3140
  return null;
3139
- const s = e.querySelectorAll(`[${p}]`)[this.dragFromIndex], o = n.querySelectorAll(`[${p}]`)[this.dragFromIndex];
3141
+ const s = e.querySelectorAll(`[${u}]`)[this.dragFromIndex], o = n.querySelectorAll(`[${u}]`)[this.dragFromIndex];
3140
3142
  if (!s || !o)
3141
3143
  return null;
3142
3144
  const r = s.getBoundingClientRect(), l = o.getBoundingClientRect();
@@ -3147,7 +3149,7 @@ class Vs {
3147
3149
  if (!e || !this.ghostEl)
3148
3150
  return;
3149
3151
  const n = this.ghostEl.style;
3150
- n.display = "flex", n.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${p}]`).forEach((o) => {
3152
+ n.display = "flex", n.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${u}]`).forEach((o) => {
3151
3153
  var a;
3152
3154
  const r = o, l = r.cloneNode(!0);
3153
3155
  l.style.width = `${r.offsetWidth}px`, l.style.flexShrink = "0", l.removeAttribute("contenteditable"), (a = this.ghostEl) == null || a.appendChild(l);
@@ -3159,7 +3161,7 @@ class Vs {
3159
3161
  const t = this.grid.querySelectorAll(`[${g}]`), e = this.ghostEl.style;
3160
3162
  e.display = "flex", e.flexDirection = "column", t.forEach((n) => {
3161
3163
  var l;
3162
- const s = n.querySelectorAll(`[${p}]`);
3164
+ const s = n.querySelectorAll(`[${u}]`);
3163
3165
  if (this.dragFromIndex >= s.length)
3164
3166
  return;
3165
3167
  const o = s[this.dragFromIndex], r = o.cloneNode(!0);
@@ -3309,7 +3311,7 @@ class Zs {
3309
3311
  handleMouseOver(t) {
3310
3312
  if (this.isGripInteractionLocked())
3311
3313
  return;
3312
- const n = t.target.closest(`[${p}]`);
3314
+ const n = t.target.closest(`[${u}]`);
3313
3315
  if (!n)
3314
3316
  return;
3315
3317
  this.clearHideTimeout();
@@ -3326,7 +3328,7 @@ class Zs {
3326
3328
  const s = Array.from(this.grid.querySelectorAll(`[${g}]`)).indexOf(e);
3327
3329
  if (s < 0)
3328
3330
  return null;
3329
- const r = Array.from(e.querySelectorAll(`[${p}]`)).indexOf(t);
3331
+ const r = Array.from(e.querySelectorAll(`[${u}]`)).indexOf(t);
3330
3332
  return r < 0 ? null : { row: s, col: r };
3331
3333
  }
3332
3334
  /**
@@ -3602,11 +3604,11 @@ class co {
3602
3604
  onPaste(t) {
3603
3605
  var d, h;
3604
3606
  const e = t.detail.data, n = e.querySelectorAll("tr"), s = [];
3605
- n.forEach((u) => {
3606
- const f = u.querySelectorAll("td, th"), m = [];
3607
- f.forEach((y) => {
3608
- m.push(y.innerHTML);
3609
- }), m.length > 0 && s.push(m);
3607
+ n.forEach((p) => {
3608
+ const m = p.querySelectorAll("td, th"), f = [];
3609
+ m.forEach((y) => {
3610
+ f.push(y.innerHTML);
3611
+ }), f.length > 0 && s.push(f);
3610
3612
  });
3611
3613
  const o = e.querySelector("thead") !== null, r = ((d = n[0]) == null ? void 0 : d.querySelector("th")) !== null, l = o || r;
3612
3614
  if (this.data = {
@@ -3977,8 +3979,8 @@ const z = (i) => {
3977
3979
  checkForRecordDeletion(t) {
3978
3980
  const { boundary: e, boldElement: n, allowedLength: s } = t, o = e.textContent, r = o.replace(/\u200B/g, ""), l = o.startsWith("​"), a = /^\s/.test(r), c = t.hasTypedContent && !l && n.textContent.length <= s, d = t.hasLeadingSpace && t.hasTypedContent && !a;
3979
3981
  if (c && d) {
3980
- const h = o.replace(/^[\u200B\s]+/, ""), u = t.leadingWhitespace || " ";
3981
- e.textContent = `${u}${h}`;
3982
+ const h = o.replace(/^[\u200B\s]+/, ""), p = t.leadingWhitespace || " ";
3983
+ e.textContent = `${p}${h}`;
3982
3984
  }
3983
3985
  c && this.records.delete(t);
3984
3986
  }
@@ -4000,18 +4002,18 @@ const z = (i) => {
4000
4002
  const h = Number(c);
4001
4003
  if (!Number.isFinite(h))
4002
4004
  return;
4003
- const u = d, f = u.textContent;
4004
- if (f.length <= h)
4005
+ const p = d, m = p.textContent;
4006
+ if (m.length <= h)
4005
4007
  return;
4006
- const m = f.slice(0, h), y = f.slice(h);
4007
- u.textContent = m;
4008
+ const f = m.slice(0, h), y = m.slice(h);
4009
+ p.textContent = f;
4008
4010
  const b = y.match(/^[\u00A0\s]+/);
4009
4011
  if (b && !a.hasAttribute(S.LEADING_WHITESPACE) && a.setAttribute(S.LEADING_WHITESPACE, b[0]), y.length === 0)
4010
4012
  return;
4011
4013
  const I = a.textContent, D = I + y, N = (At = a.getAttribute(S.LEADING_WHITESPACE)) != null ? At : "", T = N.length > 0 && I.length === 0 && !D.startsWith(N) ? N + D : D, _ = document.createTextNode(T);
4012
4014
  for (; a.firstChild; )
4013
4015
  a.removeChild(a.firstChild);
4014
- if (a.appendChild(_), !(t != null && t.isCollapsed) || !vt(t.focusNode, u))
4016
+ if (a.appendChild(_), !(t != null && t.isCollapsed) || !vt(t.focusNode, p))
4015
4017
  return;
4016
4018
  const H = document.createRange(), J = _.textContent.length;
4017
4019
  H.setStart(_, J), H.collapse(!0), t.removeAllRanges(), t.addRange(H);
@@ -4037,16 +4039,16 @@ const z = (i) => {
4037
4039
  const c = Number(a), d = l.textContent;
4038
4040
  if (!Number.isFinite(c))
4039
4041
  return;
4040
- const h = d.length > c, u = h ? this.splitCollapsedBoldText(l, c, d) : null, f = l.getAttribute(S.PREV_LENGTH), m = f ? Number(f) : NaN, y = l.previousSibling, b = (y == null ? void 0 : y.nodeType) === Node.TEXT_NODE ? y : null, I = (N = b == null ? void 0 : b.textContent) != null ? N : "", D = !!(f && Number.isFinite(m) && b && I.length > m);
4042
+ const h = d.length > c, p = h ? this.splitCollapsedBoldText(l, c, d) : null, m = l.getAttribute(S.PREV_LENGTH), f = m ? Number(m) : NaN, y = l.previousSibling, b = (y == null ? void 0 : y.nodeType) === Node.TEXT_NODE ? y : null, I = (N = b == null ? void 0 : b.textContent) != null ? N : "", D = !!(m && Number.isFinite(f) && b && I.length > f);
4041
4043
  if (D && b) {
4042
- const T = I.slice(0, m), _ = I.slice(m);
4044
+ const T = I.slice(0, f), _ = I.slice(f);
4043
4045
  b.textContent = T;
4044
4046
  const H = document.createTextNode(_);
4045
4047
  (P = l.parentNode) == null || P.insertBefore(H, l.nextSibling);
4046
4048
  }
4047
- if (D && l.removeAttribute(S.PREV_LENGTH), t != null && t.isCollapsed && u && vt(t.focusNode, l)) {
4048
- const T = document.createRange(), _ = u.textContent.length;
4049
- T.setStart(u, _), T.collapse(!0), t.removeAllRanges(), t.addRange(T);
4049
+ if (D && l.removeAttribute(S.PREV_LENGTH), t != null && t.isCollapsed && p && vt(t.focusNode, l)) {
4050
+ const T = document.createRange(), _ = p.textContent.length;
4051
+ T.setStart(p, _), T.collapse(!0), t.removeAllRanges(), t.addRange(T);
4050
4052
  }
4051
4053
  h && l.removeAttribute(S.COLLAPSED_LENGTH);
4052
4054
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackuait/blok",
3
- "version": "0.6.0-beta.2",
3
+ "version": "0.6.0-beta.4",
4
4
  "description": "Blok — headless, highly extensible rich text editor built for developers who need to implement a block-based editing experience (similar to Notion) without building it from scratch",
5
5
  "module": "dist/blok.mjs",
6
6
  "types": "./types/index.d.ts",
@@ -311,6 +311,13 @@ export const mountCellBlocksReadOnly = (
311
311
 
312
312
  if (!isCellWithBlocks(cellContent)) {
313
313
  // Handle legacy string content by creating a paragraph block
314
+ // Check if container already has blocks to ensure idempotency
315
+ const existingBlocks = container.querySelectorAll('[data-blok-id]');
316
+
317
+ if (existingBlocks.length > 0) {
318
+ return;
319
+ }
320
+
314
321
  const legacyText = typeof cellContent === 'string' ? cellContent : '';
315
322
  const insertedBlock = api.blocks.insert(
316
323
  'paragraph',