@blocknote/core 0.25.1 → 0.25.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/blocknote.js CHANGED
@@ -6909,7 +6909,7 @@ function ve(e, o) {
6909
6909
  });
6910
6910
  }
6911
6911
  function qt(e, o, t) {
6912
- var r;
6912
+ var r, a;
6913
6913
  const i = {
6914
6914
  type: "tableContent",
6915
6915
  columnWidths: [],
@@ -6917,37 +6917,37 @@ function qt(e, o, t) {
6917
6917
  headerCols: void 0,
6918
6918
  rows: []
6919
6919
  }, n = [];
6920
- e.content.forEach((a, s, l) => {
6921
- const d = {
6920
+ e.content.forEach((s, l, d) => {
6921
+ const c = {
6922
6922
  cells: []
6923
6923
  };
6924
- l === 0 && a.content.forEach((c) => {
6925
- let u = c.attrs.colwidth;
6926
- u == null && (u = new Array(c.attrs.colspan ?? 1).fill(void 0)), i.columnWidths.push(...u);
6927
- }), d.cells = a.content.content.map((c, u) => (n[l] || (n[l] = []), n[l][u] = c.type.name === "tableHeader", {
6924
+ d === 0 && s.content.forEach((u) => {
6925
+ let m = u.attrs.colwidth;
6926
+ m == null && (m = new Array(u.attrs.colspan ?? 1).fill(void 0)), i.columnWidths.push(...m);
6927
+ }), c.cells = s.content.content.map((u, m) => (n[d] || (n[d] = []), n[d][m] = u.type.name === "tableHeader", {
6928
6928
  type: "tableCell",
6929
- content: c.content.content.map(
6930
- (h) => Ae(h, o, t)
6931
- ).reduce((h, g) => {
6932
- if (!h.length)
6933
- return g;
6934
- const f = h[h.length - 1], b = g[0];
6935
- return X(f) && X(b) && JSON.stringify(f.styles) === JSON.stringify(b.styles) ? (f.text += `
6936
- ` + b.text, h.push(...g.slice(1)), h) : (h.push(...g), h);
6929
+ content: u.content.content.map(
6930
+ (g) => Ae(g, o, t)
6931
+ ).reduce((g, f) => {
6932
+ if (!g.length)
6933
+ return f;
6934
+ const b = g[g.length - 1], k = f[0];
6935
+ return X(b) && X(k) && JSON.stringify(b.styles) === JSON.stringify(k.styles) ? (b.text += `
6936
+ ` + k.text, g.push(...f.slice(1)), g) : (g.push(...f), g);
6937
6937
  }, []),
6938
6938
  props: {
6939
- colspan: c.attrs.colspan,
6940
- rowspan: c.attrs.rowspan,
6941
- backgroundColor: c.attrs.backgroundColor,
6942
- textColor: c.attrs.textColor,
6943
- textAlignment: c.attrs.textAlignment
6939
+ colspan: u.attrs.colspan,
6940
+ rowspan: u.attrs.rowspan,
6941
+ backgroundColor: u.attrs.backgroundColor,
6942
+ textColor: u.attrs.textColor,
6943
+ textAlignment: u.attrs.textAlignment
6944
6944
  }
6945
- })), i.rows.push(d);
6945
+ })), i.rows.push(c);
6946
6946
  });
6947
- for (let a = 0; a < n.length; a++)
6948
- n[a].every((s) => s) && (i.headerRows = (i.headerRows ?? 0) + 1);
6949
- for (let a = 0; a < ((r = n[0]) == null ? void 0 : r.length); a++)
6950
- n.every((s) => s[a]) && (i.headerCols = (i.headerCols ?? 0) + 1);
6947
+ for (let s = 0; s < n.length; s++)
6948
+ (r = n[s]) != null && r.every((l) => l) && (i.headerRows = (i.headerRows ?? 0) + 1);
6949
+ for (let s = 0; s < ((a = n[0]) == null ? void 0 : a.length); s++)
6950
+ n != null && n.every((l) => l[s]) && (i.headerCols = (i.headerCols ?? 0) + 1);
6951
6951
  return i;
6952
6952
  }
6953
6953
  function Ae(e, o, t) {
@@ -11084,8 +11084,6 @@ const Mt = () => {
11084
11084
  excludes: "",
11085
11085
  inclusive: !1,
11086
11086
  keepOnSplit: !0,
11087
- group: "blocknoteIgnore",
11088
- // ignore in blocknote json
11089
11087
  addAttributes() {
11090
11088
  return {
11091
11089
  // orphans are marks that currently don't have an active thread. It could be
@@ -11345,7 +11343,8 @@ class va extends W {
11345
11343
  head: r.head,
11346
11344
  anchor: r.anchor
11347
11345
  },
11348
- yjs: Li(a.binding, n.state)
11346
+ yjs: a ? Li(a.binding, n.state) : void 0
11347
+ // if we're not using yjs
11349
11348
  };
11350
11349
  await this.threadStore.addThreadToDocument({
11351
11350
  threadId: i.id,
@@ -13068,9 +13067,7 @@ class ts {
13068
13067
  (h) => h.tagName === "TD" || h.tagName === "TH"
13069
13068
  );
13070
13069
  if (i.length === 0)
13071
- throw new Error(
13072
- "Could not find table cell element that the mouse cursor is hovering over."
13073
- );
13070
+ return;
13074
13071
  const n = i[0];
13075
13072
  let r = !1;
13076
13073
  const a = Ee(n.parentElement), s = Ee(n), l = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, c = (this.state.draggingState.draggedCellOrientation === "row" ? a : s) !== l;
@@ -14037,12 +14034,9 @@ class Ro extends W {
14037
14034
  }
14038
14035
  this.resolveFileUrl = n.resolveFileUrl, this.headless = n._headless;
14039
14036
  const r = "collaboration" in this.extensions || "liveblocksExtension" in this.extensions;
14040
- if (r && n.initialContent && console.warn(
14037
+ r && n.initialContent && console.warn(
14041
14038
  "When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
14042
- ), n.comments && !r)
14043
- throw new Error(
14044
- "Comments are only supported when collaboration is enabled, please set the collaboration option"
14045
- );
14039
+ );
14046
14040
  const a = n.initialContent || (r ? [
14047
14041
  {
14048
14042
  type: "paragraph",