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

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-BCb-TePJ.mjs";
2
- import { D as A } from "./chunks/inline-tool-convert-Y0pOGkpb.mjs";
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";
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-Y0pOGkpb.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-I0Hy4UKl.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-B9OatijR.mjs").then((t) => {
1731
+ return this.notifierModule !== null ? Promise.resolve(this.notifierModule) : (this.loadingPromise === null && (this.loadingPromise = import("./index-B3xelE-R.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-O9hLUUxC.mjs");
13506
+ const { loadI18next: o } = await import("./i18next-loader-DrgsjMmb.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-Y0pOGkpb.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-I0Hy4UKl.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-BCb-TePJ.mjs";
1
+ import { e as i } from "./blok-DgRJH56D.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-Y0pOGkpb.mjs";
1
+ import { a2 as s, t as f } from "./inline-tool-convert-I0Hy4UKl.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.1";
281
+ }, Se = 650, Wt = () => "0.6.0-beta.2";
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-BCb-TePJ.mjs";
16
- import { D as _ } from "./chunks/inline-tool-convert-Y0pOGkpb.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";
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-Y0pOGkpb.mjs";
14
- import { ab as fo } from "./chunks/inline-tool-convert-Y0pOGkpb.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-I0Hy4UKl.mjs";
14
+ import { ab as fo } from "./chunks/inline-tool-convert-I0Hy4UKl.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, p;
329
+ var c, d, h, u;
330
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);
331
331
  return {
332
- icon: (p = (h = e.icon) != null ? h : o == null ? void 0 : o.icon) != null ? p : Be,
332
+ icon: (u = (h = e.icon) != null ? h : o == null ? void 0 : o.icon) != null ? u : 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 p = h.checkboxElement;
636
- p.addEventListener("change", () => {
637
- a(p.checked, h.contentElement);
635
+ const u = h.checkboxElement;
636
+ u.addEventListener("change", () => {
637
+ a(u.checked, h.contentElement);
638
638
  });
639
639
  }
640
640
  return d.replaceChild(h.wrapper, r), h.wrapper;
@@ -864,7 +864,7 @@ 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), p = n.getGroupStartValue(l, a, d, c) + d, f = n.formatNumber(p, a);
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
868
  r.textContent = f;
869
869
  }, $n = (i, t, e, n, s, o, r, l) => {
870
870
  const a = (c) => {
@@ -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), p = e && (m = t.blocks.getBlockIndex(e)) != null ? m : t.blocks.getCurrentBlockIndex();
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();
926
926
  if (!e) {
927
927
  l.innerHTML = d, n.text = d;
928
928
  const y = t.blocks.insert(w, {
@@ -930,7 +930,7 @@ const Pn = (i, t) => {
930
930
  style: n.style,
931
931
  checked: !1,
932
932
  depth: n.depth
933
- }, void 0, p + 1, !0);
933
+ }, void 0, u + 1, !0);
934
934
  Y(t, y, "start");
935
935
  return;
936
936
  }
@@ -944,7 +944,7 @@ const Pn = (i, t) => {
944
944
  checked: !1,
945
945
  depth: n.depth
946
946
  },
947
- p + 1
947
+ u + 1
948
948
  );
949
949
  n.text = d, Y(t, f, "start");
950
950
  }, qn = async (i) => {
@@ -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 p = s.text, f = l();
966
+ const u = s.text, f = l();
967
967
  if (xn(h, d) && !c.isCollapsed) {
968
968
  t.preventDefault(), h.innerHTML = "", s.text = "";
969
969
  const b = document.createRange();
@@ -972,7 +972,7 @@ 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: p });
975
+ const y = await e.blocks.convert(n, "paragraph", { text: u });
976
976
  f > 0 && requestAnimationFrame(() => {
977
977
  const b = y.holder;
978
978
  b && (b.style.marginLeft = `${f * V}px`, b.setAttribute("data-blok-depth", String(f)));
@@ -987,10 +987,10 @@ const Pn = (i, t) => {
987
987
  o();
988
988
  const h = c + 1;
989
989
  s.depth = h;
990
- const p = await e.blocks.update(n || "", tt(L({}, s), {
990
+ const u = await e.blocks.update(n || "", tt(L({}, s), {
991
991
  depth: h
992
992
  }));
993
- Y(e, p);
993
+ Y(e, u);
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;
@@ -1315,8 +1315,8 @@ class jn {
1315
1315
  if (!m) return c;
1316
1316
  const y = parseInt(m, 10);
1317
1317
  return isNaN(y) ? c : y;
1318
- })() : c) + a, p = this.markerCalculator.formatNumber(h, r);
1319
- s.textContent = p;
1318
+ })() : c) + a, u = this.markerCalculator.formatNumber(h, r);
1319
+ s.textContent = u;
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", u = "data-blok-table-cell", $ = 1, nt = `${$}px solid #d1d5db`, ds = [
1884
+ const g = "data-blok-table-row", p = "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(`[${u}]`), r = [];
1924
+ const o = s.querySelectorAll(`[${p}]`), 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(`[${u}]`).forEach((o, r) => {
1962
+ n.querySelectorAll(`[${p}]`).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(`[${u}]`), r = Array.from(o != null ? o : []).reduce(
1974
+ const s = t[0], o = s == null ? void 0 : s.querySelectorAll(`[${p}]`), 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(`[${u}]`), d = n === void 0 || n >= c.length, h = this.createCell(`${l}px`);
1979
+ const c = a.querySelectorAll(`[${p}]`), 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(`[${u}]`).forEach((p) => {
1994
- const f = p, m = parseFloat(f.style.width) || 100 / e, y = Math.round(m * o * 100) / 100;
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
1995
  f.style.width = `${y}%`;
1996
1996
  });
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}%`);
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}%`);
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(`[${u}]`);
2010
+ const o = s.querySelectorAll(`[${p}]`);
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(`[${u}]`));
2037
+ const r = Array.from(o.querySelectorAll(`[${p}]`));
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(`[${u}]`));
2042
+ const a = Array.from(o.querySelectorAll(`[${p}]`));
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(`[${u}]`).length : 0;
2057
+ return e ? e.querySelectorAll(`[${p}]`).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(`[${u}]`);
2066
+ const o = s[e].querySelectorAll(`[${p}]`);
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(`[${u}]`), s = [];
2076
+ const n = e.querySelectorAll(`[${p}]`), 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(`[${u}]`);
2102
+ const n = e.querySelector(`[${p}]`);
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(`[${u}]`);
2112
+ const n = e.querySelectorAll(`[${p}]`);
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(u, "");
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, "");
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(`[${u}]`).forEach((h) => {
2142
+ this.recordRemovedBlockCell(s), this.gridElement.querySelectorAll(`[${p}]`).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(`[${u}]`), a = [];
2275
+ const l = r.querySelectorAll(`[${p}]`), a = [];
2276
2276
  s.forEach((c, d) => {
2277
2277
  const h = l[d];
2278
2278
  if (!h)
2279
2279
  return;
2280
- const p = h.querySelector(`[${B}]`);
2281
- if (p) {
2280
+ const u = h.querySelector(`[${B}]`);
2281
+ if (u) {
2282
2282
  if (fe(c))
2283
- this.mountBlocksInCell(p, c.blocks), a.push(c);
2283
+ this.mountBlocksInCell(u, c.blocks), a.push(c);
2284
2284
  else {
2285
2285
  const f = typeof c == "string" ? c : "", m = this.api.blocks.insert("paragraph", { text: f }, {}, this.api.blocks.getBlocksCount(), !1);
2286
- p.appendChild(m.holder), a.push({ blocks: [m.id] });
2286
+ u.appendChild(m.holder), a.push({ blocks: [m.id] });
2287
2287
  }
2288
- this.stripPlaceholders(p);
2288
+ this.stripPlaceholders(u);
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(`[${u}]`);
2344
+ const e = this.api.blocks.getBlockByIndex(t), n = e == null ? void 0 : e.holder.closest(`[${p}]`);
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(`[${u}]`);
2366
+ const e = t.target.holder.closest(`[${p}]`);
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(`[${u}]`).length) != null ? o : 0;
2479
+ const n = (o = (s = this.grid.querySelectorAll(`[${g}]`)[0]) == null ? void 0 : s.querySelectorAll(`[${p}]`).length) != null ? o : 0;
2480
2480
  n !== 0 && this.showProgrammaticSelection(t, 0, t, n - 1);
2481
2481
  }
2482
2482
  /**
@@ -2562,17 +2562,17 @@ class As {
2562
2562
  const T = o[P];
2563
2563
  if (!T)
2564
2564
  continue;
2565
- const _ = T.querySelectorAll(`[${u}]`);
2565
+ const _ = T.querySelectorAll(`[${p}]`);
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(`[${u}]`)[n], l = (N = o[e]) == null ? void 0 : N.querySelectorAll(`[${u}]`)[s];
2571
+ const r = (D = o[t]) == null ? void 0 : D.querySelectorAll(`[${p}]`)[n], l = (N = o[e]) == null ? void 0 : N.querySelectorAll(`[${p}]`)[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), p = parseFloat(h.borderTopWidth) || 0, f = parseFloat(h.borderLeftWidth) || 0;
2575
- let m = c.top - a.top - p, y = c.left - a.left - f;
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;
2576
2576
  const b = d.right - c.left + 1, I = d.bottom - c.top + 1;
2577
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`;
2578
2578
  }
@@ -2632,7 +2632,7 @@ class As {
2632
2632
  }
2633
2633
  }
2634
2634
  resolveCellCoord(t) {
2635
- const e = t.closest(`[${u}]`);
2635
+ const e = t.closest(`[${p}]`);
2636
2636
  if (!e)
2637
2637
  return null;
2638
2638
  const n = e.closest(`[${g}]`);
@@ -2641,18 +2641,18 @@ 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(`[${u}]`)).indexOf(e);
2644
+ const l = Array.from(n.querySelectorAll(`[${p}]`)).indexOf(e);
2645
2645
  return l < 0 ? null : { row: o, col: l };
2646
2646
  }
2647
2647
  clampExtentToEdge(t) {
2648
- var c, d, h, p, f, m;
2648
+ var c, d, h, u, f, m;
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(`[${u}]`).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(`[${p}]`).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 = (p = (h = this.extentCell) == null ? void 0 : h.row) != null ? p : this.anchorCell.row;
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;
2656
2656
  let l;
2657
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;
2658
2658
  const a = { row: r, col: l };
@@ -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(`[${u}]`);
2666
+ const e = t.querySelectorAll(`[${p}]`);
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(`[${u}]`).forEach((l, a) => {
2673
+ o.querySelectorAll(`[${p}]`).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(`[${u}]`)).includes(t));
2681
+ const e = Array.from(i.querySelectorAll(`[${g}]`)), n = e.findIndex((r) => Array.from(r.querySelectorAll(`[${p}]`)).includes(t));
2682
2682
  if (n === -1)
2683
2683
  return null;
2684
- const o = Array.from(e[n].querySelectorAll(`[${u}]`)).indexOf(t);
2684
+ const o = Array.from(e[n].querySelectorAll(`[${p}]`)).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(`[${u}]`);
2694
+ const s = n.querySelectorAll(`[${p}]`);
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(`[${u}]`)[t];
2699
+ const o = n.querySelectorAll(`[${p}]`)[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(`[${u}]`), s = Array.from(n).reduce(
2706
+ const n = e.querySelectorAll(`[${p}]`), 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(`[${u}]`).forEach((a) => {
2714
+ r.querySelectorAll(`[${p}]`).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(`[${u}]`))) != null ? o : [] : [];
2744
+ return s ? (o = t == null ? void 0 : t.getBlockIdsFromCells(s.querySelectorAll(`[${p}]`))) != 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(`[${u}]`);
2751
+ const l = r.querySelectorAll(`[${p}]`);
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(`[${u}]`);
2757
+ const r = o.querySelectorAll(`[${p}]`);
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(`[${u}]`);
2765
+ const a = l.querySelectorAll(`[${p}]`);
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(`[${u}]`).forEach((n) => {
2771
+ i.querySelectorAll(`[${p}]`).forEach((n) => {
2772
2772
  t == null || t.ensureCellHasBlock(n);
2773
2773
  });
2774
2774
  }, Ds = (i, t, e) => {
@@ -2777,24 +2777,36 @@ const lt = (i) => {
2777
2777
  const r = n[o];
2778
2778
  if (!r)
2779
2779
  return;
2780
- const l = r.querySelectorAll(`[${u}]`);
2780
+ const l = r.querySelectorAll(`[${p}]`);
2781
2781
  s.forEach((a, c) => {
2782
2782
  const d = l[c];
2783
2783
  if (!d)
2784
2784
  return;
2785
2785
  const h = d.querySelector(`[${B}]`);
2786
- if (h && fe(a))
2787
- for (const p of a.blocks) {
2788
- const f = e.blocks.getBlockIndex(p);
2786
+ if (h) {
2787
+ if (!fe(a)) {
2788
+ const u = typeof a == "string" ? a : "", f = e.blocks.insert(
2789
+ "paragraph",
2790
+ { text: u },
2791
+ {},
2792
+ void 0,
2793
+ !0
2794
+ );
2795
+ f != null && f.holder && h.appendChild(f.holder);
2796
+ return;
2797
+ }
2798
+ for (const u of a.blocks) {
2799
+ const f = e.blocks.getBlockIndex(u);
2789
2800
  if (f === void 0)
2790
2801
  continue;
2791
2802
  const m = e.blocks.getBlockByIndex(f);
2792
2803
  m && h.appendChild(m.holder);
2793
2804
  }
2805
+ }
2794
2806
  });
2795
2807
  });
2796
2808
  }, Ns = (i, t) => {
2797
- var l, a, c, d, h, p, f, m, y, b;
2809
+ var l, a, c, d, h, u, f, m, y, b;
2798
2810
  if (!(typeof i == "object" && i !== null && "content" in i))
2799
2811
  return {
2800
2812
  withHeadings: (l = t.withHeadings) != null ? l : !1,
@@ -2804,7 +2816,7 @@ const lt = (i) => {
2804
2816
  };
2805
2817
  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;
2806
2818
  return {
2807
- withHeadings: (p = (h = n.withHeadings) != null ? h : t.withHeadings) != null ? p : !1,
2819
+ withHeadings: (u = (h = n.withHeadings) != null ? h : t.withHeadings) != null ? u : !1,
2808
2820
  withHeadingColumn: (f = n.withHeadingColumn) != null ? f : !1,
2809
2821
  stretched: (y = (m = n.stretched) != null ? m : t.stretched) != null ? y : !1,
2810
2822
  content: (b = n.content) != null ? b : [],
@@ -2812,7 +2824,7 @@ const lt = (i) => {
2812
2824
  };
2813
2825
  }, Ps = (i, t) => {
2814
2826
  i.addEventListener("keydown", (e) => {
2815
- const s = e.target.closest(`[${u}]`);
2827
+ const s = e.target.closest(`[${p}]`);
2816
2828
  if (!s)
2817
2829
  return;
2818
2830
  const o = Es(i, s);
@@ -2836,10 +2848,10 @@ const lt = (i) => {
2836
2848
  const e = i.firstElementChild;
2837
2849
  if (!e)
2838
2850
  return;
2839
- e.querySelectorAll(`[${u}]`).forEach((s) => {
2851
+ e.querySelectorAll(`[${p}]`).forEach((s) => {
2840
2852
  s.removeAttribute("data-blok-table-heading-col");
2841
2853
  }), t && e.querySelectorAll(`[${g}]`).forEach((o) => {
2842
- const r = o.querySelector(`[${u}]`);
2854
+ const r = o.querySelector(`[${p}]`);
2843
2855
  r && r.setAttribute("data-blok-table-heading-col", "");
2844
2856
  });
2845
2857
  }, Vt = "data-blok-table-resize", _s = "data-blok-table-cell", Hs = "data-blok-table-row", Ms = 50, ft = 16;
@@ -2981,12 +2993,12 @@ const $s = [
2981
2993
  const h = () => {
2982
2994
  c.style.backgroundColor = o.active ? "#3b82f6" : "#d1d5db", d.style.left = o.active ? "16px" : "2px";
2983
2995
  };
2984
- return h(), r.addEventListener("click", (p) => {
2985
- p.stopPropagation(), o.active = !o.active, h(), s(o.active);
2996
+ return h(), r.addEventListener("click", (u) => {
2997
+ u.stopPropagation(), o.active = !o.active, h(), s(o.active);
2986
2998
  }), r;
2987
2999
  }, Kt = 10, zs = "data-blok-table-drag-ghost", bt = (i) => {
2988
3000
  const t = i.querySelector(`[${g}]`);
2989
- return t ? Array.from(t.querySelectorAll(`[${u}]`)).reduce(
3001
+ return t ? Array.from(t.querySelectorAll(`[${p}]`)).reduce(
2990
3002
  (n, s) => {
2991
3003
  const o = n[n.length - 1];
2992
3004
  return [...n, o + s.offsetWidth];
@@ -3040,14 +3052,14 @@ class Vs {
3040
3052
  const e = t[this.dragFromIndex];
3041
3053
  if (!e)
3042
3054
  return;
3043
- e.querySelectorAll(`[${u}]`).forEach((s) => {
3055
+ e.querySelectorAll(`[${p}]`).forEach((s) => {
3044
3056
  const o = s;
3045
3057
  o.style.backgroundColor = "#dbeafe", o.style.opacity = "0.6", this.dragOverlayCells.push(o);
3046
3058
  });
3047
3059
  }
3048
3060
  highlightColumnCells(t) {
3049
3061
  t.forEach((e) => {
3050
- const n = e.querySelectorAll(`[${u}]`);
3062
+ const n = e.querySelectorAll(`[${p}]`);
3051
3063
  if (this.dragFromIndex >= n.length)
3052
3064
  return;
3053
3065
  const s = n[this.dragFromIndex];
@@ -3124,7 +3136,7 @@ class Vs {
3124
3136
  const t = this.grid.querySelectorAll(`[${g}]`), e = t[0], n = t[t.length - 1];
3125
3137
  if (!e || !n)
3126
3138
  return null;
3127
- const s = e.querySelectorAll(`[${u}]`)[this.dragFromIndex], o = n.querySelectorAll(`[${u}]`)[this.dragFromIndex];
3139
+ const s = e.querySelectorAll(`[${p}]`)[this.dragFromIndex], o = n.querySelectorAll(`[${p}]`)[this.dragFromIndex];
3128
3140
  if (!s || !o)
3129
3141
  return null;
3130
3142
  const r = s.getBoundingClientRect(), l = o.getBoundingClientRect();
@@ -3135,7 +3147,7 @@ class Vs {
3135
3147
  if (!e || !this.ghostEl)
3136
3148
  return;
3137
3149
  const n = this.ghostEl.style;
3138
- n.display = "flex", n.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${u}]`).forEach((o) => {
3150
+ n.display = "flex", n.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${p}]`).forEach((o) => {
3139
3151
  var a;
3140
3152
  const r = o, l = r.cloneNode(!0);
3141
3153
  l.style.width = `${r.offsetWidth}px`, l.style.flexShrink = "0", l.removeAttribute("contenteditable"), (a = this.ghostEl) == null || a.appendChild(l);
@@ -3147,7 +3159,7 @@ class Vs {
3147
3159
  const t = this.grid.querySelectorAll(`[${g}]`), e = this.ghostEl.style;
3148
3160
  e.display = "flex", e.flexDirection = "column", t.forEach((n) => {
3149
3161
  var l;
3150
- const s = n.querySelectorAll(`[${u}]`);
3162
+ const s = n.querySelectorAll(`[${p}]`);
3151
3163
  if (this.dragFromIndex >= s.length)
3152
3164
  return;
3153
3165
  const o = s[this.dragFromIndex], r = o.cloneNode(!0);
@@ -3297,7 +3309,7 @@ class Zs {
3297
3309
  handleMouseOver(t) {
3298
3310
  if (this.isGripInteractionLocked())
3299
3311
  return;
3300
- const n = t.target.closest(`[${u}]`);
3312
+ const n = t.target.closest(`[${p}]`);
3301
3313
  if (!n)
3302
3314
  return;
3303
3315
  this.clearHideTimeout();
@@ -3314,7 +3326,7 @@ class Zs {
3314
3326
  const s = Array.from(this.grid.querySelectorAll(`[${g}]`)).indexOf(e);
3315
3327
  if (s < 0)
3316
3328
  return null;
3317
- const r = Array.from(e.querySelectorAll(`[${u}]`)).indexOf(t);
3329
+ const r = Array.from(e.querySelectorAll(`[${p}]`)).indexOf(t);
3318
3330
  return r < 0 ? null : { row: s, col: r };
3319
3331
  }
3320
3332
  /**
@@ -3590,8 +3602,8 @@ class co {
3590
3602
  onPaste(t) {
3591
3603
  var d, h;
3592
3604
  const e = t.detail.data, n = e.querySelectorAll("tr"), s = [];
3593
- n.forEach((p) => {
3594
- const f = p.querySelectorAll("td, th"), m = [];
3605
+ n.forEach((u) => {
3606
+ const f = u.querySelectorAll("td, th"), m = [];
3595
3607
  f.forEach((y) => {
3596
3608
  m.push(y.innerHTML);
3597
3609
  }), m.length > 0 && s.push(m);
@@ -3965,8 +3977,8 @@ const z = (i) => {
3965
3977
  checkForRecordDeletion(t) {
3966
3978
  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;
3967
3979
  if (c && d) {
3968
- const h = o.replace(/^[\u200B\s]+/, ""), p = t.leadingWhitespace || " ";
3969
- e.textContent = `${p}${h}`;
3980
+ const h = o.replace(/^[\u200B\s]+/, ""), u = t.leadingWhitespace || " ";
3981
+ e.textContent = `${u}${h}`;
3970
3982
  }
3971
3983
  c && this.records.delete(t);
3972
3984
  }
@@ -3988,18 +4000,18 @@ const z = (i) => {
3988
4000
  const h = Number(c);
3989
4001
  if (!Number.isFinite(h))
3990
4002
  return;
3991
- const p = d, f = p.textContent;
4003
+ const u = d, f = u.textContent;
3992
4004
  if (f.length <= h)
3993
4005
  return;
3994
4006
  const m = f.slice(0, h), y = f.slice(h);
3995
- p.textContent = m;
4007
+ u.textContent = m;
3996
4008
  const b = y.match(/^[\u00A0\s]+/);
3997
4009
  if (b && !a.hasAttribute(S.LEADING_WHITESPACE) && a.setAttribute(S.LEADING_WHITESPACE, b[0]), y.length === 0)
3998
4010
  return;
3999
4011
  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);
4000
4012
  for (; a.firstChild; )
4001
4013
  a.removeChild(a.firstChild);
4002
- if (a.appendChild(_), !(t != null && t.isCollapsed) || !vt(t.focusNode, p))
4014
+ if (a.appendChild(_), !(t != null && t.isCollapsed) || !vt(t.focusNode, u))
4003
4015
  return;
4004
4016
  const H = document.createRange(), J = _.textContent.length;
4005
4017
  H.setStart(_, J), H.collapse(!0), t.removeAllRanges(), t.addRange(H);
@@ -4025,16 +4037,16 @@ const z = (i) => {
4025
4037
  const c = Number(a), d = l.textContent;
4026
4038
  if (!Number.isFinite(c))
4027
4039
  return;
4028
- const h = d.length > c, p = 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);
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);
4029
4041
  if (D && b) {
4030
4042
  const T = I.slice(0, m), _ = I.slice(m);
4031
4043
  b.textContent = T;
4032
4044
  const H = document.createTextNode(_);
4033
4045
  (P = l.parentNode) == null || P.insertBefore(H, l.nextSibling);
4034
4046
  }
4035
- if (D && l.removeAttribute(S.PREV_LENGTH), t != null && t.isCollapsed && p && vt(t.focusNode, l)) {
4036
- const T = document.createRange(), _ = p.textContent.length;
4037
- T.setStart(p, _), T.collapse(!0), t.removeAllRanges(), t.addRange(T);
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);
4038
4050
  }
4039
4051
  h && l.removeAttribute(S.COLLAPSED_LENGTH);
4040
4052
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackuait/blok",
3
- "version": "0.6.0-beta.1",
3
+ "version": "0.6.0-beta.2",
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",
@@ -310,6 +310,18 @@ export const mountCellBlocksReadOnly = (
310
310
  }
311
311
 
312
312
  if (!isCellWithBlocks(cellContent)) {
313
+ // Handle legacy string content by creating a paragraph block
314
+ const legacyText = typeof cellContent === 'string' ? cellContent : '';
315
+ const insertedBlock = api.blocks.insert(
316
+ 'paragraph',
317
+ { text: legacyText },
318
+ {},
319
+ undefined,
320
+ true
321
+ );
322
+
323
+ insertedBlock?.holder && container.appendChild(insertedBlock.holder);
324
+
313
325
  return;
314
326
  }
315
327