@blocknote/core 0.46.2 → 0.47.0

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.
Files changed (47) hide show
  1. package/dist/{BlockNoteSchema-BkXw8HJ6.js → BlockNoteSchema-1r-ln0Q0.js} +2 -2
  2. package/dist/{BlockNoteSchema-BkXw8HJ6.js.map → BlockNoteSchema-1r-ln0Q0.js.map} +1 -1
  3. package/dist/{BlockNoteSchema-DmFDeA0n.cjs → BlockNoteSchema-DT4bdXj5.cjs} +2 -2
  4. package/dist/{BlockNoteSchema-DmFDeA0n.cjs.map → BlockNoteSchema-DT4bdXj5.cjs.map} +1 -1
  5. package/dist/{TrailingNode-CxM966vN.js → TrailingNode-DZag-Nvu.js} +448 -444
  6. package/dist/TrailingNode-DZag-Nvu.js.map +1 -0
  7. package/dist/TrailingNode-tesI8f7N.cjs +2 -0
  8. package/dist/TrailingNode-tesI8f7N.cjs.map +1 -0
  9. package/dist/blocknote.cjs +4 -4
  10. package/dist/blocknote.cjs.map +1 -1
  11. package/dist/blocknote.js +1053 -1014
  12. package/dist/blocknote.js.map +1 -1
  13. package/dist/blocks.cjs +1 -1
  14. package/dist/blocks.js +2 -2
  15. package/dist/{defaultBlocks-DE5GNdJH.js → defaultBlocks-BSOEW3GR.js} +3 -3
  16. package/dist/defaultBlocks-BSOEW3GR.js.map +1 -0
  17. package/dist/defaultBlocks-D049Pbme.cjs +6 -0
  18. package/dist/defaultBlocks-D049Pbme.cjs.map +1 -0
  19. package/dist/extensions.cjs +1 -1
  20. package/dist/extensions.js +3 -3
  21. package/dist/locales.cjs +1 -1
  22. package/dist/locales.cjs.map +1 -1
  23. package/dist/locales.js +813 -28
  24. package/dist/locales.js.map +1 -1
  25. package/dist/style.css +1 -1
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/webpack-stats.json +1 -1
  28. package/package.json +1 -1
  29. package/src/blocks/ListItem/CheckListItem/block.test.ts +61 -0
  30. package/src/blocks/ListItem/CheckListItem/block.ts +4 -0
  31. package/src/editor/Block.css +2 -2
  32. package/src/editor/transformPasted.ts +69 -0
  33. package/src/extensions/SideMenu/SideMenu.ts +44 -0
  34. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +37 -11
  35. package/src/i18n/locales/fa.ts +390 -0
  36. package/src/i18n/locales/index.ts +2 -0
  37. package/src/i18n/locales/uz.ts +421 -0
  38. package/types/src/blocks/ListItem/CheckListItem/block.test.d.ts +1 -0
  39. package/types/src/i18n/locales/fa.d.ts +320 -0
  40. package/types/src/i18n/locales/index.d.ts +2 -0
  41. package/types/src/i18n/locales/uz.d.ts +2 -0
  42. package/dist/TrailingNode-CxM966vN.js.map +0 -1
  43. package/dist/TrailingNode-D-CZ76FS.cjs +0 -2
  44. package/dist/TrailingNode-D-CZ76FS.cjs.map +0 -1
  45. package/dist/defaultBlocks-DE5GNdJH.js.map +0 -1
  46. package/dist/defaultBlocks-DosClM5E.cjs +0 -6
  47. package/dist/defaultBlocks-DosClM5E.cjs.map +0 -1
package/dist/blocknote.js CHANGED
@@ -1,81 +1,81 @@
1
- var Oe = Object.defineProperty;
2
- var Fe = (o, e, t) => e in o ? Oe(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var h = (o, e, t) => Fe(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { Slice as N, Fragment as A, DOMSerializer as he, DOMParser as $e, Node as He } from "prosemirror-model";
5
- import { ReplaceStep as Ve, ReplaceAroundStep as V } from "prosemirror-transform";
6
- import { n as U, i as O, g as C, b as J, a as b, t as Ue, U as F, q as _, r as $, d as ze, s as Ge, u as Re, v as Y, w as B, x as me, y as je, z as ke, A as z } from "./blockToNode-BNoNIXU7.js";
7
- import { B as ds, G as us, C as ps, D as fs, N as hs, E as ms, O as ks, F as gs, H as bs, I as ys, L as Ss, J as Bs, M as Cs, K as xs } from "./blockToNode-BNoNIXU7.js";
8
- import { ak as H, al as We, am as qe, an as Ke, aj as x, a as Je, ao as Ye, ap as Qe, a5 as Xe, a8 as G, aq as Ze, ar as et, a6 as tt, as as Q, a9 as ge, at as ot } from "./defaultBlocks-DE5GNdJH.js";
9
- import { aw as ws, av as Ms, E as Ts, F as Ps, r as vs, N as Is, a4 as As, ad as _s, aG as Ds, ax as Ls, b as Ns, d as Os, e as Fs, a0 as $s, aM as Hs, au as Vs, c as Us, f as zs, ag as Gs, ah as Rs, aB as js, x as Ws, y as qs, A as Ks, z as Js, g as Ys, h as Qs, T as Xs, j as Zs, k as er, l as tr, n as or, o as nr, q as sr, s as rr, w as ar, aC as ir, aH as cr, B as lr, C as dr, H as ur, I as pr, J as fr, K as hr, aE as mr, aI as kr, M as gr, D as br, G as yr, S as Sr, O as Br, Q as Cr, W as xr, U as Er, _ as wr, Z as Mr, a2 as Tr, Y as Pr, X as vr, R as Ir, $ as Ar, m as _r, aN as Dr, aK as Lr, az as Nr, af as Or, i as Fr, ay as $r, aD as Hr, ae as Vr, a7 as Ur, t as zr, u as Gr, v as Rr, aJ as jr, ai as Wr, aL as qr, a1 as Kr, V as Jr, p as Yr, a3 as Qr, aF as Xr, L as Zr, aO as ea, P as ta, aA as oa } from "./defaultBlocks-DE5GNdJH.js";
10
- import { j as nt, k as be, l as st, m as rt, n as at, c as R, F as it, Y as ct, a as lt, b as dt, S as ut, B as ye, D as pt, L as ft, N as ht, P as mt, g as kt, i as gt, H as bt, h as yt, e as St, V as Bt, d as Ct } from "./TrailingNode-CxM966vN.js";
11
- import { s as xt, B as Et } from "./BlockNoteSchema-BkXw8HJ6.js";
12
- import { C as sa, b as ra, c as aa, a as ia, g as ca, u as la, w as da } from "./BlockNoteSchema-BkXw8HJ6.js";
13
- import { Node as D, Extension as E, mergeAttributes as wt, Mark as X, extensions as I, isNodeSelection as Mt, posToDOMRect as Tt, selectionToInsertionEnd as Pt, getSchema as vt, createDocument as It, Editor as At } from "@tiptap/core";
1
+ var Fe = Object.defineProperty;
2
+ var $e = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var h = (n, e, t) => $e(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Slice as N, Fragment as A, DOMSerializer as he, DOMParser as He, Node as Ve } from "prosemirror-model";
5
+ import { ReplaceStep as Ue, ReplaceAroundStep as z } from "prosemirror-transform";
6
+ import { n as G, i as O, g as C, b as Q, a as S, t as ze, U as F, q as _, r as $, d as Ge, s as Re, u as je, v as X, w as B, x as me, y as We, z as ke, A as R } from "./blockToNode-BNoNIXU7.js";
7
+ import { B as fs, G as hs, C as ms, D as ks, N as bs, E as gs, O as ys, F as Ss, H as Bs, I as Cs, L as Es, J as xs, M as Ms, K as ws } from "./blockToNode-BNoNIXU7.js";
8
+ import { ak as V, al as qe, am as Ke, an as Je, aj as E, a as Ye, ao as Qe, ap as Xe, a5 as Ze, a8 as j, aq as et, ar as tt, a6 as ot, as as Z, a9 as be, at as nt } from "./defaultBlocks-BSOEW3GR.js";
9
+ import { aw as Ps, av as vs, E as Is, F as As, r as _s, N as Ds, a4 as Ls, ad as Ns, aG as Os, ax as Fs, b as $s, d as Hs, e as Vs, a0 as Us, aM as zs, au as Gs, c as Rs, f as js, ag as Ws, ah as qs, aB as Ks, x as Js, y as Ys, A as Qs, z as Xs, g as Zs, h as er, T as tr, j as or, k as nr, l as sr, n as rr, o as ar, q as ir, s as cr, w as lr, aC as dr, aH as ur, B as pr, C as fr, H as hr, I as mr, J as kr, K as br, aE as gr, aI as yr, M as Sr, D as Br, G as Cr, S as Er, O as xr, Q as Mr, W as wr, U as Tr, _ as Pr, Z as vr, a2 as Ir, Y as Ar, X as _r, R as Dr, $ as Lr, m as Nr, aN as Or, aK as Fr, az as $r, af as Hr, i as Vr, ay as Ur, aD as zr, ae as Gr, a7 as Rr, t as jr, u as Wr, v as qr, aJ as Kr, ai as Jr, aL as Yr, a1 as Qr, V as Xr, p as Zr, a3 as ea, aF as ta, L as oa, aO as na, P as sa, aA as ra } from "./defaultBlocks-BSOEW3GR.js";
10
+ import { j as st, k as ge, l as rt, m as at, n as it, c as W, F as ct, Y as lt, a as dt, b as ut, S as pt, B as ye, D as ft, L as ht, N as mt, P as kt, g as bt, i as gt, H as yt, h as St, e as Bt, V as Ct, d as Et } from "./TrailingNode-DZag-Nvu.js";
11
+ import { s as xt, B as Mt } from "./BlockNoteSchema-1r-ln0Q0.js";
12
+ import { C as ia, b as ca, c as la, a as da, g as ua, u as pa, w as fa } from "./BlockNoteSchema-1r-ln0Q0.js";
13
+ import { Node as D, Extension as x, mergeAttributes as wt, Mark as ee, extensions as I, isNodeSelection as Tt, posToDOMRect as Pt, selectionToInsertionEnd as vt, findParentNodeClosestToPos as It, getSchema as At, createDocument as _t, Editor as Dt } from "@tiptap/core";
14
14
  import { E as Se } from "./EventEmitter-CjSwpTbz.js";
15
- import { Fragment as Z, Slice as ne } from "@tiptap/pm/model";
16
- import { e as _t } from "./en-njEqD7AG.js";
17
- import { inputRules as Dt, InputRule as Lt } from "@handlewithcare/prosemirror-inputrules";
18
- import { keymap as Nt } from "@tiptap/pm/keymap";
19
- import { c as Ot, o as Ft } from "./BlockNoteExtension-C2X7LW-V.js";
20
- import { a as pa } from "./BlockNoteExtension-C2X7LW-V.js";
21
- import { Gapcursor as $t } from "@tiptap/extensions/gap-cursor";
22
- import { Link as Ht } from "@tiptap/extension-link";
23
- import { Text as Vt } from "@tiptap/extension-text";
24
- import { NodeSelection as L, TextSelection as w, Plugin as ee } from "prosemirror-state";
25
- import { CellSelection as te, TableMap as se } from "prosemirror-tables";
26
- import { S as Ut } from "./ShowSelection-B0ch3unP.js";
27
- import zt from "remark-gfm";
28
- import Gt from "remark-parse";
29
- import Rt, { defaultHandlers as re } from "remark-rehype";
30
- import jt from "rehype-stringify";
31
- import { unified as Wt } from "unified";
32
- import { TextSelection as qt } from "@tiptap/pm/state";
33
- function Kt(o, e) {
15
+ import { Fragment as H, Slice as U } from "@tiptap/pm/model";
16
+ import { e as Lt } from "./en-njEqD7AG.js";
17
+ import { inputRules as Nt, InputRule as Ot } from "@handlewithcare/prosemirror-inputrules";
18
+ import { keymap as Ft } from "@tiptap/pm/keymap";
19
+ import { c as $t, o as Ht } from "./BlockNoteExtension-C2X7LW-V.js";
20
+ import { a as ma } from "./BlockNoteExtension-C2X7LW-V.js";
21
+ import { Gapcursor as Vt } from "@tiptap/extensions/gap-cursor";
22
+ import { Link as Ut } from "@tiptap/extension-link";
23
+ import { Text as zt } from "@tiptap/extension-text";
24
+ import { NodeSelection as L, TextSelection as M, Plugin as te } from "prosemirror-state";
25
+ import { CellSelection as oe, TableMap as se } from "prosemirror-tables";
26
+ import { S as Gt } from "./ShowSelection-B0ch3unP.js";
27
+ import Rt from "remark-gfm";
28
+ import jt from "remark-parse";
29
+ import Wt, { defaultHandlers as re } from "remark-rehype";
30
+ import qt from "rehype-stringify";
31
+ import { unified as Kt } from "unified";
32
+ import { TextSelection as Jt } from "@tiptap/pm/state";
33
+ function Yt(n, e) {
34
34
  const t = [
35
35
  {
36
- tag: `[data-inline-content-type="${o.type}"]`,
37
- contentElement: (n) => {
38
- const s = n;
36
+ tag: `[data-inline-content-type="${n.type}"]`,
37
+ contentElement: (o) => {
38
+ const s = o;
39
39
  return s.matches("[data-editable]") ? s : s.querySelector("[data-editable]") || s;
40
40
  }
41
41
  }
42
42
  ];
43
43
  return e && t.push({
44
44
  tag: "*",
45
- getAttrs(n) {
46
- if (typeof n == "string")
45
+ getAttrs(o) {
46
+ if (typeof o == "string")
47
47
  return !1;
48
- const s = e == null ? void 0 : e(n);
48
+ const s = e == null ? void 0 : e(o);
49
49
  return s === void 0 ? !1 : s;
50
50
  }
51
51
  }), t;
52
52
  }
53
- function ss(o, e) {
54
- var n;
53
+ function is(n, e) {
54
+ var o;
55
55
  const t = D.create({
56
- name: o.type,
56
+ name: n.type,
57
57
  inline: !0,
58
58
  group: "inline",
59
- draggable: (n = e.meta) == null ? void 0 : n.draggable,
60
- selectable: o.content === "styled",
61
- atom: o.content === "none",
62
- content: o.content === "styled" ? "inline*" : "",
59
+ draggable: (o = e.meta) == null ? void 0 : o.draggable,
60
+ selectable: n.content === "styled",
61
+ atom: n.content === "none",
62
+ content: n.content === "styled" ? "inline*" : "",
63
63
  addAttributes() {
64
- return qe(o.propSchema);
64
+ return Ke(n.propSchema);
65
65
  },
66
66
  addKeyboardShortcuts() {
67
- return We(o);
67
+ return qe(n);
68
68
  },
69
69
  parseHTML() {
70
- return Kt(
71
- o,
70
+ return Yt(
71
+ n,
72
72
  e.parse
73
73
  );
74
74
  },
75
75
  renderHTML({ node: s }) {
76
76
  const r = this.options.editor, a = e.render.call(
77
77
  { renderType: "dom", props: void 0 },
78
- U(
78
+ G(
79
79
  s,
80
80
  r.schema.inlineContentSchema,
81
81
  r.schema.styleSchema
@@ -85,18 +85,18 @@ function ss(o, e) {
85
85
  },
86
86
  r
87
87
  );
88
- return H(
88
+ return V(
89
89
  a,
90
- o.type,
90
+ n.type,
91
91
  s.attrs,
92
- o.propSchema
92
+ n.propSchema
93
93
  );
94
94
  },
95
95
  addNodeView() {
96
96
  return (s) => {
97
97
  const { node: r, getPos: a } = s, c = this.options.editor, i = e.render.call(
98
98
  { renderType: "nodeView", props: s },
99
- U(
99
+ G(
100
100
  r,
101
101
  c.schema.inlineContentSchema,
102
102
  c.schema.styleSchema
@@ -110,18 +110,18 @@ function ss(o, e) {
110
110
  },
111
111
  c
112
112
  );
113
- return H(
113
+ return V(
114
114
  i,
115
- o.type,
115
+ n.type,
116
116
  r.attrs,
117
- o.propSchema
117
+ n.propSchema
118
118
  );
119
119
  };
120
120
  }
121
121
  });
122
- return Ke(
122
+ return Je(
123
123
  t,
124
- o.propSchema,
124
+ n.propSchema,
125
125
  {
126
126
  ...e,
127
127
  toExternalHTML: e.toExternalHTML,
@@ -131,78 +131,78 @@ function ss(o, e) {
131
131
  r,
132
132
  a
133
133
  );
134
- return H(
134
+ return V(
135
135
  c,
136
- o.type,
136
+ n.type,
137
137
  s.props,
138
- o.propSchema
138
+ n.propSchema
139
139
  );
140
140
  }
141
141
  }
142
142
  );
143
143
  }
144
- function Jt(o, e, t, n = "before") {
145
- const s = typeof t == "string" ? t : t.id, r = C(o), a = e.map(
146
- (d) => J(d, r)
147
- ), c = x(s, o.doc);
144
+ function Qt(n, e, t, o = "before") {
145
+ const s = typeof t == "string" ? t : t.id, r = C(n), a = e.map(
146
+ (d) => Q(d, r)
147
+ ), c = E(s, n.doc);
148
148
  if (!c)
149
149
  throw new Error(`Block with ID ${s} not found`);
150
150
  let i = c.posBeforeNode;
151
- return n === "after" && (i += c.node.nodeSize), o.step(
152
- new Ve(i, i, new N(A.from(a), 0, 0))
151
+ return o === "after" && (i += c.node.nodeSize), n.step(
152
+ new Ue(i, i, new N(A.from(a), 0, 0))
153
153
  ), a.map(
154
- (d) => b(d, r)
154
+ (d) => S(d, r)
155
155
  );
156
156
  }
157
- function j(o) {
158
- if (!o || o.type.name !== "column")
157
+ function q(n) {
158
+ if (!n || n.type.name !== "column")
159
159
  throw new Error("Invalid columnPos: does not point to column node.");
160
- const e = o.firstChild;
160
+ const e = n.firstChild;
161
161
  if (!e)
162
162
  throw new Error("Invalid column: does not have child node.");
163
163
  const t = e.firstChild;
164
164
  if (!t)
165
165
  throw new Error("Invalid blockContainer: does not have child node.");
166
- return o.childCount === 1 && e.childCount === 1 && t.type.name === "paragraph" && t.content.content.length === 0;
166
+ return n.childCount === 1 && e.childCount === 1 && t.type.name === "paragraph" && t.content.content.length === 0;
167
167
  }
168
- function Yt(o, e) {
169
- const t = o.doc.resolve(e), n = t.nodeAfter;
170
- if (!n || n.type.name !== "columnList")
168
+ function Xt(n, e) {
169
+ const t = n.doc.resolve(e), o = t.nodeAfter;
170
+ if (!o || o.type.name !== "columnList")
171
171
  throw new Error(
172
172
  "Invalid columnListPos: does not point to columnList node."
173
173
  );
174
- for (let s = n.childCount - 1; s >= 0; s--) {
175
- const r = o.doc.resolve(t.pos + 1).posAtIndex(s), c = o.doc.resolve(r).nodeAfter;
174
+ for (let s = o.childCount - 1; s >= 0; s--) {
175
+ const r = n.doc.resolve(t.pos + 1).posAtIndex(s), c = n.doc.resolve(r).nodeAfter;
176
176
  if (!c || c.type.name !== "column")
177
177
  throw new Error("Invalid columnPos: does not point to column node.");
178
- j(c) && o.delete(r, r + c.nodeSize);
178
+ q(c) && n.delete(r, r + c.nodeSize);
179
179
  }
180
180
  }
181
- function W(o, e) {
182
- Yt(o, e);
183
- const n = o.doc.resolve(e).nodeAfter;
184
- if (!n || n.type.name !== "columnList")
181
+ function K(n, e) {
182
+ Xt(n, e);
183
+ const o = n.doc.resolve(e).nodeAfter;
184
+ if (!o || o.type.name !== "columnList")
185
185
  throw new Error(
186
186
  "Invalid columnListPos: does not point to columnList node."
187
187
  );
188
- if (n.childCount > 2)
188
+ if (o.childCount > 2)
189
189
  return;
190
- if (n.childCount < 2)
190
+ if (o.childCount < 2)
191
191
  throw new Error("Invalid columnList: contains fewer than two children.");
192
- const s = e + 1, a = o.doc.resolve(s).nodeAfter, c = e + n.nodeSize - 1, l = o.doc.resolve(c).nodeBefore;
192
+ const s = e + 1, a = n.doc.resolve(s).nodeAfter, c = e + o.nodeSize - 1, l = n.doc.resolve(c).nodeBefore;
193
193
  if (!a || !l)
194
194
  throw new Error("Invalid columnList: does not contain children.");
195
- const d = j(a), u = j(l);
195
+ const d = q(a), u = q(l);
196
196
  if (d && u) {
197
- o.delete(e, e + n.nodeSize);
197
+ n.delete(e, e + o.nodeSize);
198
198
  return;
199
199
  }
200
200
  if (d) {
201
- o.step(
202
- new V(
201
+ n.step(
202
+ new z(
203
203
  // Replaces `columnList`.
204
204
  e,
205
- e + n.nodeSize,
205
+ e + o.nodeSize,
206
206
  // Replaces with content of last `column`.
207
207
  c - l.nodeSize + 1,
208
208
  c - 1,
@@ -215,11 +215,11 @@ function W(o, e) {
215
215
  return;
216
216
  }
217
217
  if (u) {
218
- o.step(
219
- new V(
218
+ n.step(
219
+ new z(
220
220
  // Replaces `columnList`.
221
221
  e,
222
- e + n.nodeSize,
222
+ e + o.nodeSize,
223
223
  // Replaces with content of first `column`.
224
224
  s + 1,
225
225
  s + a.nodeSize - 1,
@@ -232,29 +232,29 @@ function W(o, e) {
232
232
  return;
233
233
  }
234
234
  }
235
- function ae(o, e, t) {
236
- const n = C(o), s = t.map(
237
- (u) => J(u, n)
235
+ function ae(n, e, t) {
236
+ const o = C(n), s = t.map(
237
+ (u) => Q(u, o)
238
238
  ), r = new Set(
239
239
  e.map(
240
240
  (u) => typeof u == "string" ? u : u.id
241
241
  )
242
242
  ), a = [], c = /* @__PURE__ */ new Set(), i = typeof e[0] == "string" ? e[0] : e[0].id;
243
243
  let l = 0;
244
- if (o.doc.descendants((u, p) => {
244
+ if (n.doc.descendants((u, p) => {
245
245
  if (r.size === 0)
246
246
  return !1;
247
247
  if (!u.type.isInGroup("bnBlock") || !r.has(u.attrs.id))
248
248
  return !0;
249
- if (a.push(b(u, n)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === i) {
250
- const g = o.doc.nodeSize;
251
- o.insert(p, s);
252
- const y = o.doc.nodeSize;
253
- l += g - y;
249
+ if (a.push(S(u, o)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === i) {
250
+ const b = n.doc.nodeSize;
251
+ n.insert(p, s);
252
+ const g = n.doc.nodeSize;
253
+ l += b - g;
254
254
  }
255
- const m = o.doc.nodeSize, f = o.doc.resolve(p - l);
256
- f.node().type.name === "column" ? c.add(f.before(-1)) : f.node().type.name === "columnList" && c.add(f.before()), f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ? o.delete(f.before(), f.after()) : o.delete(p - l, p - l + u.nodeSize);
257
- const k = o.doc.nodeSize;
255
+ const m = n.doc.nodeSize, f = n.doc.resolve(p - l);
256
+ f.node().type.name === "column" ? c.add(f.before(-1)) : f.node().type.name === "columnList" && c.add(f.before()), f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ? n.delete(f.before(), f.after()) : n.delete(p - l, p - l + u.nodeSize);
257
+ const k = n.doc.nodeSize;
258
258
  return l += m - k, !1;
259
259
  }), r.size > 0) {
260
260
  const u = [...r].join(`
@@ -263,31 +263,31 @@ function ae(o, e, t) {
263
263
  "Blocks with the following IDs could not be found in the editor: " + u
264
264
  );
265
265
  }
266
- return c.forEach((u) => W(o, u)), { insertedBlocks: s.map(
267
- (u) => b(u, n)
266
+ return c.forEach((u) => K(n, u)), { insertedBlocks: s.map(
267
+ (u) => S(u, o)
268
268
  ), removedBlocks: a };
269
269
  }
270
- function Qt(o, e, t, n, s) {
270
+ function Zt(n, e, t, o, s) {
271
271
  let r;
272
272
  if (e)
273
273
  if (typeof e == "string")
274
- r = O([e], o.pmSchema, n);
274
+ r = O([e], n.pmSchema, o);
275
275
  else if (Array.isArray(e))
276
- r = O(e, o.pmSchema, n);
276
+ r = O(e, n.pmSchema, o);
277
277
  else if (e.type === "tableContent")
278
- r = Ue(e, o.pmSchema);
278
+ r = ze(e, n.pmSchema);
279
279
  else
280
280
  throw new F(e.type);
281
281
  else throw new Error("blockContent is required");
282
282
  const c = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
283
283
  for (const i of r)
284
- if (i.type.name !== "text" && o.schema.inlineContentSchema[i.type.name]) {
285
- const l = o.schema.inlineContentSpecs[i.type.name].implementation;
284
+ if (i.type.name !== "text" && n.schema.inlineContentSchema[i.type.name]) {
285
+ const l = n.schema.inlineContentSpecs[i.type.name].implementation;
286
286
  if (l) {
287
- const d = U(
287
+ const d = G(
288
288
  i,
289
- o.schema.inlineContentSchema,
290
- o.schema.styleSchema
289
+ n.schema.inlineContentSchema,
290
+ n.schema.styleSchema
291
291
  ), u = l.render.call(
292
292
  {
293
293
  renderType: "dom",
@@ -296,7 +296,7 @@ function Qt(o, e, t, n, s) {
296
296
  d,
297
297
  () => {
298
298
  },
299
- o
299
+ n
300
300
  );
301
301
  if (u) {
302
302
  if (c.appendChild(u.dom), u.contentDOM) {
@@ -314,8 +314,8 @@ function Qt(o, e, t, n, s) {
314
314
  i.textContent
315
315
  );
316
316
  for (const d of i.marks.toReversed())
317
- if (d.type.name in o.schema.styleSpecs) {
318
- const u = o.schema.styleSpecs[d.type.name].implementation.render(d.attrs.stringValue, o);
317
+ if (d.type.name in n.schema.styleSpecs) {
318
+ const u = n.schema.styleSpecs[d.type.name].implementation.render(d.attrs.stringValue, n);
319
319
  u.contentDOM.appendChild(l), l = u.dom;
320
320
  } else {
321
321
  const u = d.type.spec.toDOM(d, !0), p = he.renderSpec(document, u);
@@ -331,41 +331,41 @@ function Qt(o, e, t, n, s) {
331
331
  }
332
332
  return c;
333
333
  }
334
- function Xt(o, e, t, n) {
334
+ function eo(n, e, t, o) {
335
335
  var u, p, m, f, k;
336
- const s = o.pmSchema.nodes.blockContainer, r = e.props || {};
337
- for (const [g, y] of Object.entries(
338
- o.schema.blockSchema[e.type].propSchema
336
+ const s = n.pmSchema.nodes.blockContainer, r = e.props || {};
337
+ for (const [b, g] of Object.entries(
338
+ n.schema.blockSchema[e.type].propSchema
339
339
  ))
340
- !(g in r) && y.default !== void 0 && (r[g] = y.default);
341
- const a = e.children || [], i = o.blockImplementations[e.type].implementation.render.call(
340
+ !(b in r) && g.default !== void 0 && (r[b] = g.default);
341
+ const a = e.children || [], i = n.blockImplementations[e.type].implementation.render.call(
342
342
  {
343
343
  renderType: "dom",
344
344
  props: void 0
345
345
  },
346
346
  { ...e, props: r, children: a },
347
- o
347
+ n
348
348
  );
349
349
  if (i.contentDOM && e.content) {
350
- const g = Qt(
351
- o,
350
+ const b = Zt(
351
+ n,
352
352
  e.content,
353
353
  // TODO
354
354
  t,
355
355
  e.type,
356
- n
356
+ o
357
357
  );
358
- i.contentDOM.appendChild(g);
358
+ i.contentDOM.appendChild(b);
359
359
  }
360
- if (o.pmSchema.nodes[e.type].isInGroup("bnBlock")) {
360
+ if (n.pmSchema.nodes[e.type].isInGroup("bnBlock")) {
361
361
  if (e.children && e.children.length > 0) {
362
- const g = Be(
363
- o,
362
+ const b = Be(
363
+ n,
364
364
  e.children,
365
365
  t,
366
- n
366
+ o
367
367
  );
368
- (u = i.contentDOM) == null || u.append(g);
368
+ (u = i.contentDOM) == null || u.append(b);
369
369
  }
370
370
  return i.dom;
371
371
  }
@@ -377,72 +377,72 @@ function Xt(o, e, t, n) {
377
377
  })
378
378
  );
379
379
  return (f = d.contentDOM) == null || f.appendChild(i.dom), e.children && e.children.length > 0 && ((k = d.contentDOM) == null || k.appendChild(
380
- Ce(o, e.children, t, n)
380
+ Ce(n, e.children, t, o)
381
381
  )), d.dom;
382
382
  }
383
- function Be(o, e, t, n) {
384
- const r = ((n == null ? void 0 : n.document) ?? document).createDocumentFragment();
383
+ function Be(n, e, t, o) {
384
+ const r = ((o == null ? void 0 : o.document) ?? document).createDocumentFragment();
385
385
  for (const a of e) {
386
- const c = Xt(o, a, t, n);
386
+ const c = eo(n, a, t, o);
387
387
  r.appendChild(c);
388
388
  }
389
389
  return r;
390
390
  }
391
- const Ce = (o, e, t, n) => {
391
+ const Ce = (n, e, t, o) => {
392
392
  var c;
393
- const s = o.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), a = Be(o, e, t, n);
393
+ const s = n.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), a = Be(n, e, t, o);
394
394
  return (c = r.contentDOM) == null || c.appendChild(a), r.dom;
395
- }, Zt = (o) => (o.querySelectorAll(
395
+ }, to = (n) => (n.querySelectorAll(
396
396
  '[data-content-type="numberedListItem"]'
397
397
  ).forEach((t) => {
398
398
  var s, r;
399
- const n = (r = (s = t.closest(".bn-block-outer")) == null ? void 0 : s.previousElementSibling) == null ? void 0 : r.querySelector(
399
+ const o = (r = (s = t.closest(".bn-block-outer")) == null ? void 0 : s.previousElementSibling) == null ? void 0 : r.querySelector(
400
400
  '[data-content-type="numberedListItem"]'
401
401
  );
402
- if (!n)
402
+ if (!o)
403
403
  t.setAttribute(
404
404
  "data-index",
405
405
  t.getAttribute("data-start") || "1"
406
406
  );
407
407
  else {
408
- const a = n.getAttribute("data-index");
408
+ const a = o.getAttribute("data-index");
409
409
  t.setAttribute(
410
410
  "data-index",
411
411
  (parseInt(a || "0") + 1).toString()
412
412
  );
413
413
  }
414
- }), o), eo = (o) => (o.querySelectorAll(
414
+ }), n), oo = (n) => (n.querySelectorAll(
415
415
  '[data-content-type="checkListItem"] input'
416
416
  ).forEach((t) => {
417
417
  t.disabled = !0;
418
- }), o), to = (o) => (o.querySelectorAll(
418
+ }), n), no = (n) => (n.querySelectorAll(
419
419
  '.bn-toggle-wrapper[data-show-children="false"]'
420
420
  ).forEach((t) => {
421
421
  t.setAttribute("data-show-children", "true");
422
- }), o), oo = (o) => (o.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
422
+ }), n), so = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
423
423
  t.setAttribute(
424
424
  "style",
425
- `--default-cell-min-width: ${Je}px;`
425
+ `--default-cell-min-width: ${Ye}px;`
426
426
  ), t.setAttribute("data-show-children", "true");
427
- }), o), no = (o) => (o.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
427
+ }), n), ro = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
428
428
  var r;
429
- const n = document.createElement("div");
430
- n.className = "tableWrapper";
429
+ const o = document.createElement("div");
430
+ o.className = "tableWrapper";
431
431
  const s = document.createElement("div");
432
- s.className = "tableWrapper-inner", n.appendChild(s), (r = t.parentElement) == null || r.appendChild(n), n.appendChild(t);
433
- }), o), so = (o) => (o.querySelectorAll(
432
+ s.className = "tableWrapper-inner", o.appendChild(s), (r = t.parentElement) == null || r.appendChild(o), o.appendChild(t);
433
+ }), n), ao = (n) => (n.querySelectorAll(
434
434
  ".bn-inline-content:empty"
435
435
  ).forEach((t) => {
436
- const n = document.createElement("span");
437
- n.className = "ProseMirror-trailingBreak", n.setAttribute("style", "display: inline-block;"), t.appendChild(n);
438
- }), o), ro = (o, e) => {
439
- const t = he.fromSchema(o), n = [
440
- Zt,
441
- eo,
436
+ const o = document.createElement("span");
437
+ o.className = "ProseMirror-trailingBreak", o.setAttribute("style", "display: inline-block;"), t.appendChild(o);
438
+ }), n), io = (n, e) => {
439
+ const t = he.fromSchema(n), o = [
442
440
  to,
443
441
  oo,
444
442
  no,
445
- so
443
+ so,
444
+ ro,
445
+ ao
446
446
  ];
447
447
  return {
448
448
  serializeBlocks: (s, r) => {
@@ -452,16 +452,16 @@ const Ce = (o, e, t, n) => {
452
452
  t,
453
453
  r
454
454
  );
455
- for (const c of n)
455
+ for (const c of o)
456
456
  a = c(a);
457
457
  return a.outerHTML;
458
458
  }
459
459
  };
460
460
  };
461
- function ao(o) {
462
- return o.transact((e) => {
461
+ function co(n) {
462
+ return n.transact((e) => {
463
463
  const t = _(e.doc, e.selection.anchor);
464
- if (e.selection instanceof te)
464
+ if (e.selection instanceof oe)
465
465
  return {
466
466
  type: "cell",
467
467
  anchorBlockId: t.node.attrs.id,
@@ -474,117 +474,117 @@ function ao(o) {
474
474
  anchorBlockId: t.node.attrs.id
475
475
  };
476
476
  {
477
- const n = _(e.doc, e.selection.head);
477
+ const o = _(e.doc, e.selection.head);
478
478
  return {
479
479
  type: "text",
480
480
  anchorBlockId: t.node.attrs.id,
481
- headBlockId: n.node.attrs.id,
481
+ headBlockId: o.node.attrs.id,
482
482
  anchorOffset: e.selection.anchor - t.posBeforeNode,
483
- headOffset: e.selection.head - n.posBeforeNode
483
+ headOffset: e.selection.head - o.posBeforeNode
484
484
  };
485
485
  }
486
486
  });
487
487
  }
488
- function io(o, e) {
488
+ function lo(n, e) {
489
489
  var s, r;
490
- const t = (s = x(e.anchorBlockId, o.doc)) == null ? void 0 : s.posBeforeNode;
490
+ const t = (s = E(e.anchorBlockId, n.doc)) == null ? void 0 : s.posBeforeNode;
491
491
  if (t === void 0)
492
492
  throw new Error(
493
493
  `Could not find block with ID ${e.anchorBlockId} to update selection`
494
494
  );
495
- let n;
495
+ let o;
496
496
  if (e.type === "cell")
497
- n = te.create(
498
- o.doc,
497
+ o = oe.create(
498
+ n.doc,
499
499
  t + e.anchorCellOffset,
500
500
  t + e.headCellOffset
501
501
  );
502
502
  else if (e.type === "node")
503
- n = L.create(o.doc, t + 1);
503
+ o = L.create(n.doc, t + 1);
504
504
  else {
505
- const a = (r = x(e.headBlockId, o.doc)) == null ? void 0 : r.posBeforeNode;
505
+ const a = (r = E(e.headBlockId, n.doc)) == null ? void 0 : r.posBeforeNode;
506
506
  if (a === void 0)
507
507
  throw new Error(
508
508
  `Could not find block with ID ${e.headBlockId} to update selection`
509
509
  );
510
- n = w.create(
511
- o.doc,
510
+ o = M.create(
511
+ n.doc,
512
512
  t + e.anchorOffset,
513
513
  a + e.headOffset
514
514
  );
515
515
  }
516
- o.setSelection(n);
516
+ n.setSelection(o);
517
517
  }
518
- function q(o) {
519
- return o.map((e) => e.type === "columnList" ? e.children.map((t) => q(t.children)).flat() : {
518
+ function J(n) {
519
+ return n.map((e) => e.type === "columnList" ? e.children.map((t) => J(t.children)).flat() : {
520
520
  ...e,
521
- children: q(e.children)
521
+ children: J(e.children)
522
522
  }).flat();
523
523
  }
524
- function xe(o, e, t) {
525
- o.transact((n) => {
524
+ function Ee(n, e, t) {
525
+ n.transact((o) => {
526
526
  var a;
527
- const s = ((a = o.getSelection()) == null ? void 0 : a.blocks) || [
528
- o.getTextCursorPosition().block
529
- ], r = ao(o);
530
- o.removeBlocks(s), o.insertBlocks(q(s), e, t), io(n, r);
527
+ const s = ((a = n.getSelection()) == null ? void 0 : a.blocks) || [
528
+ n.getTextCursorPosition().block
529
+ ], r = co(n);
530
+ n.removeBlocks(s), n.insertBlocks(J(s), e, t), lo(o, r);
531
531
  });
532
532
  }
533
- function Ee(o) {
534
- return !o || o.type !== "columnList";
533
+ function xe(n) {
534
+ return !n || n.type !== "columnList";
535
535
  }
536
- function we(o, e, t) {
537
- let n, s;
538
- if (e ? e.children.length > 0 ? (n = e.children[e.children.length - 1], s = "after") : (n = e, s = "before") : t && (n = t, s = "before"), !n || !s)
536
+ function Me(n, e, t) {
537
+ let o, s;
538
+ if (e ? e.children.length > 0 ? (o = e.children[e.children.length - 1], s = "after") : (o = e, s = "before") : t && (o = t, s = "before"), !o || !s)
539
539
  return;
540
- const r = o.getParentBlock(n);
541
- return Ee(r) ? { referenceBlock: n, placement: s } : we(
542
- o,
543
- s === "after" ? n : o.getPrevBlock(n),
540
+ const r = n.getParentBlock(o);
541
+ return xe(r) ? { referenceBlock: o, placement: s } : Me(
542
+ n,
543
+ s === "after" ? o : n.getPrevBlock(o),
544
544
  r
545
545
  );
546
546
  }
547
- function Me(o, e, t) {
548
- let n, s;
549
- if (e ? e.children.length > 0 ? (n = e.children[0], s = "before") : (n = e, s = "after") : t && (n = t, s = "after"), !n || !s)
547
+ function we(n, e, t) {
548
+ let o, s;
549
+ if (e ? e.children.length > 0 ? (o = e.children[0], s = "before") : (o = e, s = "after") : t && (o = t, s = "after"), !o || !s)
550
550
  return;
551
- const r = o.getParentBlock(n);
552
- return Ee(r) ? { referenceBlock: n, placement: s } : Me(
553
- o,
554
- s === "before" ? n : o.getNextBlock(n),
551
+ const r = n.getParentBlock(o);
552
+ return xe(r) ? { referenceBlock: o, placement: s } : we(
553
+ n,
554
+ s === "before" ? o : n.getNextBlock(o),
555
555
  r
556
556
  );
557
557
  }
558
- function co(o) {
559
- o.transact(() => {
560
- const e = o.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || o.getTextCursorPosition().block, n = we(
561
- o,
562
- o.getPrevBlock(t),
563
- o.getParentBlock(t)
558
+ function uo(n) {
559
+ n.transact(() => {
560
+ const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || n.getTextCursorPosition().block, o = Me(
561
+ n,
562
+ n.getPrevBlock(t),
563
+ n.getParentBlock(t)
564
564
  );
565
- n && xe(
566
- o,
567
- n.referenceBlock,
568
- n.placement
565
+ o && Ee(
566
+ n,
567
+ o.referenceBlock,
568
+ o.placement
569
569
  );
570
570
  });
571
571
  }
572
- function lo(o) {
573
- o.transact(() => {
574
- const e = o.getSelection(), t = (e == null ? void 0 : e.blocks[(e == null ? void 0 : e.blocks.length) - 1]) || o.getTextCursorPosition().block, n = Me(
575
- o,
576
- o.getNextBlock(t),
577
- o.getParentBlock(t)
572
+ function po(n) {
573
+ n.transact(() => {
574
+ const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[(e == null ? void 0 : e.blocks.length) - 1]) || n.getTextCursorPosition().block, o = we(
575
+ n,
576
+ n.getNextBlock(t),
577
+ n.getParentBlock(t)
578
578
  );
579
- n && xe(
580
- o,
581
- n.referenceBlock,
582
- n.placement
579
+ o && Ee(
580
+ n,
581
+ o.referenceBlock,
582
+ o.placement
583
583
  );
584
584
  });
585
585
  }
586
- function uo(o, e, t) {
587
- const { $from: n, $to: s } = o.selection, r = n.blockRange(
586
+ function fo(n, e, t) {
587
+ const { $from: o, $to: s } = n.selection, r = o.blockRange(
588
588
  s,
589
589
  (f) => f.childCount > 0 && (f.type.name === "blockGroup" || f.type.name === "column")
590
590
  // change necessary to not look at first item child type
@@ -605,8 +605,8 @@ function uo(o, e, t) {
605
605
  l ? 3 : 1,
606
606
  0
607
607
  ), p = r.start, m = r.end;
608
- return o.step(
609
- new V(
608
+ return n.step(
609
+ new z(
610
610
  p - (l ? 3 : 1),
611
611
  m,
612
612
  p,
@@ -617,60 +617,60 @@ function uo(o, e, t) {
617
617
  )
618
618
  ).scrollIntoView(), !0;
619
619
  }
620
- function Te(o) {
621
- return o.transact((e) => uo(
620
+ function Te(n) {
621
+ return n.transact((e) => fo(
622
622
  e,
623
- o.pmSchema.nodes.blockContainer,
624
- o.pmSchema.nodes.blockGroup
623
+ n.pmSchema.nodes.blockContainer,
624
+ n.pmSchema.nodes.blockGroup
625
625
  ));
626
626
  }
627
- function po(o) {
628
- o._tiptapEditor.commands.liftListItem("blockContainer");
627
+ function ho(n) {
628
+ n._tiptapEditor.commands.liftListItem("blockContainer");
629
629
  }
630
- function fo(o) {
631
- return o.transact((e) => {
630
+ function mo(n) {
631
+ return n.transact((e) => {
632
632
  const { bnBlock: t } = $(e);
633
633
  return e.doc.resolve(t.beforePos).nodeBefore !== null;
634
634
  });
635
635
  }
636
- function ho(o) {
637
- return o.transact((e) => {
636
+ function ko(n) {
637
+ return n.transact((e) => {
638
638
  const { bnBlock: t } = $(e);
639
639
  return e.doc.resolve(t.beforePos).depth > 1;
640
640
  });
641
641
  }
642
- function mo(o, e) {
643
- const t = typeof e == "string" ? e : e.id, n = C(o), s = x(t, o);
642
+ function bo(n, e) {
643
+ const t = typeof e == "string" ? e : e.id, o = C(n), s = E(t, n);
644
644
  if (s)
645
- return b(s.node, n);
645
+ return S(s.node, o);
646
646
  }
647
- function ko(o, e) {
648
- const t = typeof e == "string" ? e : e.id, n = x(t, o), s = C(o);
649
- if (!n)
647
+ function go(n, e) {
648
+ const t = typeof e == "string" ? e : e.id, o = E(t, n), s = C(n);
649
+ if (!o)
650
650
  return;
651
- const a = o.resolve(n.posBeforeNode).nodeBefore;
651
+ const a = n.resolve(o.posBeforeNode).nodeBefore;
652
652
  if (a)
653
- return b(a, s);
653
+ return S(a, s);
654
654
  }
655
- function go(o, e) {
656
- const t = typeof e == "string" ? e : e.id, n = x(t, o), s = C(o);
657
- if (!n)
655
+ function yo(n, e) {
656
+ const t = typeof e == "string" ? e : e.id, o = E(t, n), s = C(n);
657
+ if (!o)
658
658
  return;
659
- const a = o.resolve(
660
- n.posBeforeNode + n.node.nodeSize
659
+ const a = n.resolve(
660
+ o.posBeforeNode + o.node.nodeSize
661
661
  ).nodeAfter;
662
662
  if (a)
663
- return b(a, s);
663
+ return S(a, s);
664
664
  }
665
- function bo(o, e) {
666
- const t = typeof e == "string" ? e : e.id, n = C(o), s = x(t, o);
665
+ function So(n, e) {
666
+ const t = typeof e == "string" ? e : e.id, o = C(n), s = E(t, n);
667
667
  if (!s)
668
668
  return;
669
- const r = o.resolve(s.posBeforeNode), a = r.node(), c = r.node(-1), i = c.type.name !== "doc" ? a.type.name === "blockGroup" ? c : a : void 0;
669
+ const r = n.resolve(s.posBeforeNode), a = r.node(), c = r.node(-1), i = c.type.name !== "doc" ? a.type.name === "blockGroup" ? c : a : void 0;
670
670
  if (i)
671
- return b(i, n);
671
+ return S(i, o);
672
672
  }
673
- class yo {
673
+ class Bo {
674
674
  constructor(e) {
675
675
  this.editor = e;
676
676
  }
@@ -679,7 +679,7 @@ class yo {
679
679
  * @returns A snapshot of all top-level (non-nested) blocks in the editor.
680
680
  */
681
681
  get document() {
682
- return this.editor.transact((e) => ze(e.doc, this.editor.pmSchema));
682
+ return this.editor.transact((e) => Ge(e.doc, this.editor.pmSchema));
683
683
  }
684
684
  /**
685
685
  * Gets a snapshot of an existing block from the editor.
@@ -689,7 +689,7 @@ class yo {
689
689
  * matching block was found.
690
690
  */
691
691
  getBlock(e) {
692
- return this.editor.transact((t) => mo(t.doc, e));
692
+ return this.editor.transact((t) => bo(t.doc, e));
693
693
  }
694
694
  /**
695
695
  * Gets a snapshot of the previous sibling of an existing block from the
@@ -701,7 +701,7 @@ class yo {
701
701
  * in the document.
702
702
  */
703
703
  getPrevBlock(e) {
704
- return this.editor.transact((t) => ko(t.doc, e));
704
+ return this.editor.transact((t) => go(t.doc, e));
705
705
  }
706
706
  /**
707
707
  * Gets a snapshot of the next sibling of an existing block from the editor.
@@ -712,7 +712,7 @@ class yo {
712
712
  * the document.
713
713
  */
714
714
  getNextBlock(e) {
715
- return this.editor.transact((t) => go(t.doc, e));
715
+ return this.editor.transact((t) => yo(t.doc, e));
716
716
  }
717
717
  /**
718
718
  * Gets a snapshot of the parent of an existing block from the editor.
@@ -723,7 +723,7 @@ class yo {
723
723
  */
724
724
  getParentBlock(e) {
725
725
  return this.editor.transact(
726
- (t) => bo(t.doc, e)
726
+ (t) => So(t.doc, e)
727
727
  );
728
728
  }
729
729
  /**
@@ -732,8 +732,8 @@ class yo {
732
732
  * @param reverse Whether the blocks should be traversed in reverse order.
733
733
  */
734
734
  forEachBlock(e, t = !1) {
735
- const n = this.document.slice();
736
- t && n.reverse();
735
+ const o = this.document.slice();
736
+ t && o.reverse();
737
737
  function s(r) {
738
738
  for (const a of r) {
739
739
  if (e(a) === !1)
@@ -744,7 +744,7 @@ class yo {
744
744
  }
745
745
  return !0;
746
746
  }
747
- s(n);
747
+ s(o);
748
748
  }
749
749
  /**
750
750
  * Inserts new blocks into the editor. If a block's `id` is undefined, BlockNote generates one automatically. Throws an
@@ -754,9 +754,9 @@ class yo {
754
754
  * @param placement Whether the blocks should be inserted just before, just after, or nested inside the
755
755
  * `referenceBlock`.
756
756
  */
757
- insertBlocks(e, t, n = "before") {
757
+ insertBlocks(e, t, o = "before") {
758
758
  return this.editor.transact(
759
- (s) => Jt(s, e, t, n)
759
+ (s) => Qt(s, e, t, o)
760
760
  );
761
761
  }
762
762
  /**
@@ -767,7 +767,7 @@ class yo {
767
767
  * @param update A partial block which defines how the existing block should be changed.
768
768
  */
769
769
  updateBlock(e, t) {
770
- return this.editor.transact((n) => Ye(n, e, t));
770
+ return this.editor.transact((o) => Qe(o, e, t));
771
771
  }
772
772
  /**
773
773
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
@@ -787,14 +787,14 @@ class yo {
787
787
  */
788
788
  replaceBlocks(e, t) {
789
789
  return this.editor.transact(
790
- (n) => ae(n, e, t)
790
+ (o) => ae(o, e, t)
791
791
  );
792
792
  }
793
793
  /**
794
794
  * Checks if the block containing the text cursor can be nested.
795
795
  */
796
796
  canNestBlock() {
797
- return fo(this.editor);
797
+ return mo(this.editor);
798
798
  }
799
799
  /**
800
800
  * Nests the block containing the text cursor into the block above it.
@@ -806,13 +806,13 @@ class yo {
806
806
  * Checks if the block containing the text cursor is nested.
807
807
  */
808
808
  canUnnestBlock() {
809
- return ho(this.editor);
809
+ return ko(this.editor);
810
810
  }
811
811
  /**
812
812
  * Lifts the block containing the text cursor out of its parent.
813
813
  */
814
814
  unnestBlock() {
815
- po(this.editor);
815
+ ho(this.editor);
816
816
  }
817
817
  /**
818
818
  * Moves the selected blocks up. If the previous block has children, moves
@@ -820,7 +820,7 @@ class yo {
820
820
  * current blocks share a common parent, moves them out of & before it.
821
821
  */
822
822
  moveBlocksUp() {
823
- return co(this.editor);
823
+ return uo(this.editor);
824
824
  }
825
825
  /**
826
826
  * Moves the selected blocks down. If the next block has children, moves
@@ -828,16 +828,16 @@ class yo {
828
828
  * current blocks share a common parent, moves them out of & after it.
829
829
  */
830
830
  moveBlocksDown() {
831
- return lo(this.editor);
831
+ return po(this.editor);
832
832
  }
833
833
  }
834
- class So extends Se {
834
+ class Co extends Se {
835
835
  constructor(e) {
836
836
  super(), this.editor = e, e.on("create", () => {
837
837
  e._tiptapEditor.on(
838
838
  "update",
839
- ({ transaction: t, appendedTransactions: n }) => {
840
- this.emit("onChange", { editor: e, transaction: t, appendedTransactions: n });
839
+ ({ transaction: t, appendedTransactions: o }) => {
840
+ this.emit("onChange", { editor: e, transaction: t, appendedTransactions: o });
841
841
  }
842
842
  ), e._tiptapEditor.on("selectionUpdate", ({ transaction: t }) => {
843
843
  this.emit("onSelectionChange", { editor: e, transaction: t });
@@ -852,32 +852,32 @@ class So extends Se {
852
852
  * Register a callback that will be called when the editor changes.
853
853
  */
854
854
  onChange(e, t = !0) {
855
- const n = ({
855
+ const o = ({
856
856
  transaction: s,
857
857
  appendedTransactions: r
858
858
  }) => {
859
859
  !t && ie(s) || e(this.editor, {
860
860
  getChanges() {
861
- return nt(
861
+ return st(
862
862
  s,
863
863
  r
864
864
  );
865
865
  }
866
866
  });
867
867
  };
868
- return this.on("onChange", n), () => {
869
- this.off("onChange", n);
868
+ return this.on("onChange", o), () => {
869
+ this.off("onChange", o);
870
870
  };
871
871
  }
872
872
  /**
873
873
  * Register a callback that will be called when the selection changes.
874
874
  */
875
875
  onSelectionChange(e, t = !1) {
876
- const n = (s) => {
876
+ const o = (s) => {
877
877
  !t && ie(s.transaction) || e(this.editor);
878
878
  };
879
- return this.on("onSelectionChange", n), () => {
880
- this.off("onSelectionChange", n);
879
+ return this.on("onSelectionChange", o), () => {
880
+ this.off("onSelectionChange", o);
881
881
  };
882
882
  }
883
883
  /**
@@ -897,118 +897,118 @@ class So extends Se {
897
897
  };
898
898
  }
899
899
  }
900
- function ie(o) {
901
- return !!o.getMeta("y-sync$");
900
+ function ie(n) {
901
+ return !!n.getMeta("y-sync$");
902
902
  }
903
- function Bo(o) {
904
- return Array.prototype.indexOf.call(o.parentElement.childNodes, o);
903
+ function Eo(n) {
904
+ return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
905
905
  }
906
- function Co(o) {
907
- return o.nodeType === 3 && !/\S/.test(o.nodeValue || "");
906
+ function xo(n) {
907
+ return n.nodeType === 3 && !/\S/.test(n.nodeValue || "");
908
908
  }
909
- function xo(o) {
910
- o.querySelectorAll("li > ul, li > ol").forEach((e) => {
911
- const t = Bo(e), n = e.parentElement, s = Array.from(n.childNodes).slice(
909
+ function Mo(n) {
910
+ n.querySelectorAll("li > ul, li > ol").forEach((e) => {
911
+ const t = Eo(e), o = e.parentElement, s = Array.from(o.childNodes).slice(
912
912
  t + 1
913
913
  );
914
914
  e.remove(), s.forEach((r) => {
915
915
  r.remove();
916
- }), n.insertAdjacentElement("afterend", e), s.reverse().forEach((r) => {
917
- if (Co(r))
916
+ }), o.insertAdjacentElement("afterend", e), s.reverse().forEach((r) => {
917
+ if (xo(r))
918
918
  return;
919
919
  const a = document.createElement("li");
920
920
  a.append(r), e.insertAdjacentElement("afterend", a);
921
- }), n.childNodes.length === 0 && n.remove();
921
+ }), o.childNodes.length === 0 && o.remove();
922
922
  });
923
923
  }
924
- function Eo(o) {
925
- o.querySelectorAll("li + ul, li + ol").forEach((e) => {
924
+ function wo(n) {
925
+ n.querySelectorAll("li + ul, li + ol").forEach((e) => {
926
926
  var r, a;
927
- const t = e.previousElementSibling, n = document.createElement("div");
928
- t.insertAdjacentElement("afterend", n), n.append(t);
927
+ const t = e.previousElementSibling, o = document.createElement("div");
928
+ t.insertAdjacentElement("afterend", o), o.append(t);
929
929
  const s = document.createElement("div");
930
- for (s.setAttribute("data-node-type", "blockGroup"), n.append(s); ((r = n.nextElementSibling) == null ? void 0 : r.nodeName) === "UL" || ((a = n.nextElementSibling) == null ? void 0 : a.nodeName) === "OL"; )
931
- s.append(n.nextElementSibling);
930
+ for (s.setAttribute("data-node-type", "blockGroup"), o.append(s); ((r = o.nextElementSibling) == null ? void 0 : r.nodeName) === "UL" || ((a = o.nextElementSibling) == null ? void 0 : a.nodeName) === "OL"; )
931
+ s.append(o.nextElementSibling);
932
932
  });
933
933
  }
934
934
  let ce = null;
935
- function wo() {
935
+ function To() {
936
936
  return ce || (ce = document.implementation.createHTMLDocument("title"));
937
937
  }
938
- function Mo(o) {
939
- if (typeof o == "string") {
940
- const e = wo().createElement("div");
941
- e.innerHTML = o, o = e;
938
+ function Po(n) {
939
+ if (typeof n == "string") {
940
+ const e = To().createElement("div");
941
+ e.innerHTML = n, n = e;
942
942
  }
943
- return xo(o), Eo(o), o;
943
+ return Mo(n), wo(n), n;
944
944
  }
945
- function Pe(o, e) {
946
- const t = Mo(o), s = $e.fromSchema(e).parse(t, {
945
+ function Pe(n, e) {
946
+ const t = Po(n), s = He.fromSchema(e).parse(t, {
947
947
  topNode: e.nodes.blockGroup.create()
948
948
  }), r = [];
949
949
  for (let a = 0; a < s.childCount; a++)
950
- r.push(b(s.child(a), e));
950
+ r.push(S(s.child(a), e));
951
951
  return r;
952
952
  }
953
- function To(o, e) {
954
- const t = e.value ? e.value : "", n = {};
955
- e.lang && (n["data-language"] = e.lang);
953
+ function vo(n, e) {
954
+ const t = e.value ? e.value : "", o = {};
955
+ e.lang && (o["data-language"] = e.lang);
956
956
  let s = {
957
957
  type: "element",
958
958
  tagName: "code",
959
- properties: n,
959
+ properties: o,
960
960
  children: [{ type: "text", value: t }]
961
961
  };
962
- return e.meta && (s.data = { meta: e.meta }), o.patch(e, s), s = o.applyData(e, s), s = {
962
+ return e.meta && (s.data = { meta: e.meta }), n.patch(e, s), s = n.applyData(e, s), s = {
963
963
  type: "element",
964
964
  tagName: "pre",
965
965
  properties: {},
966
966
  children: [s]
967
- }, o.patch(e, s), s;
967
+ }, n.patch(e, s), s;
968
968
  }
969
- function Po(o, e) {
969
+ function Io(n, e) {
970
970
  var r;
971
- const t = String((e == null ? void 0 : e.url) || ""), n = e != null && e.title ? String(e.title) : void 0;
971
+ const t = String((e == null ? void 0 : e.url) || ""), o = e != null && e.title ? String(e.title) : void 0;
972
972
  let s = {
973
973
  type: "element",
974
974
  tagName: "video",
975
975
  properties: {
976
976
  src: t,
977
- "data-name": n,
977
+ "data-name": o,
978
978
  "data-url": t,
979
979
  controls: !0
980
980
  },
981
981
  children: []
982
982
  };
983
- return (r = o.patch) == null || r.call(o, e, s), s = o.applyData ? o.applyData(e, s) : s, s;
983
+ return (r = n.patch) == null || r.call(n, e, s), s = n.applyData ? n.applyData(e, s) : s, s;
984
984
  }
985
- function ve(o) {
986
- return Wt().use(Gt).use(zt).use(Rt, {
985
+ function ve(n) {
986
+ return Kt().use(jt).use(Rt).use(Wt, {
987
987
  handlers: {
988
988
  ...re,
989
- image: (t, n) => {
990
- const s = String((n == null ? void 0 : n.url) || "");
991
- return Qe(s) ? Po(t, n) : re.image(t, n);
989
+ image: (t, o) => {
990
+ const s = String((o == null ? void 0 : o.url) || "");
991
+ return Xe(s) ? Io(t, o) : re.image(t, o);
992
992
  },
993
- code: To,
994
- blockquote: (t, n) => {
993
+ code: vo,
994
+ blockquote: (t, o) => {
995
995
  const s = {
996
996
  type: "element",
997
997
  tagName: "blockquote",
998
998
  properties: {},
999
999
  // The only difference from the original is that we don't wrap the children with line endings
1000
- children: t.wrap(t.all(n), !1)
1000
+ children: t.wrap(t.all(o), !1)
1001
1001
  };
1002
- return t.patch(n, s), t.applyData(n, s);
1002
+ return t.patch(o, s), t.applyData(o, s);
1003
1003
  }
1004
1004
  }
1005
- }).use(jt).processSync(o).value;
1005
+ }).use(qt).processSync(n).value;
1006
1006
  }
1007
- function vo(o, e) {
1008
- const t = ve(o);
1007
+ function Ao(n, e) {
1008
+ const t = ve(n);
1009
1009
  return Pe(t, e);
1010
1010
  }
1011
- class Io {
1011
+ class _o {
1012
1012
  constructor(e) {
1013
1013
  this.editor = e;
1014
1014
  }
@@ -1020,7 +1020,7 @@ class Io {
1020
1020
  * @returns The blocks, serialized as an HTML string.
1021
1021
  */
1022
1022
  blocksToHTMLLossy(e = this.editor.document) {
1023
- return be(
1023
+ return ge(
1024
1024
  this.editor.pmSchema,
1025
1025
  this.editor
1026
1026
  ).exportBlocks(e, {});
@@ -1035,7 +1035,7 @@ class Io {
1035
1035
  * @returns The blocks, serialized as an HTML string.
1036
1036
  */
1037
1037
  blocksToFullHTML(e = this.editor.document) {
1038
- return ro(
1038
+ return io(
1039
1039
  this.editor.pmSchema,
1040
1040
  this.editor
1041
1041
  ).serializeBlocks(e, {});
@@ -1057,7 +1057,7 @@ class Io {
1057
1057
  * @returns The blocks, serialized as a Markdown string.
1058
1058
  */
1059
1059
  blocksToMarkdownLossy(e = this.editor.document) {
1060
- return st(e, this.editor.pmSchema, this.editor, {});
1060
+ return rt(e, this.editor.pmSchema, this.editor, {});
1061
1061
  }
1062
1062
  /**
1063
1063
  * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
@@ -1067,7 +1067,7 @@ class Io {
1067
1067
  * @returns The blocks parsed from the Markdown string.
1068
1068
  */
1069
1069
  tryParseMarkdownToBlocks(e) {
1070
- return vo(e, this.editor.pmSchema);
1070
+ return Ao(e, this.editor.pmSchema);
1071
1071
  }
1072
1072
  /**
1073
1073
  * Paste HTML into the editor. Defaults to converting HTML to BlockNote HTML.
@@ -1076,12 +1076,12 @@ class Io {
1076
1076
  */
1077
1077
  pasteHTML(e, t = !1) {
1078
1078
  var s;
1079
- let n = e;
1079
+ let o = e;
1080
1080
  if (!t) {
1081
1081
  const r = this.tryParseHTMLToBlocks(e);
1082
- n = this.blocksToFullHTML(r);
1082
+ o = this.blocksToFullHTML(r);
1083
1083
  }
1084
- n && ((s = this.editor.prosemirrorView) == null || s.pasteHTML(n));
1084
+ o && ((s = this.editor.prosemirrorView) == null || s.pasteHTML(o));
1085
1085
  }
1086
1086
  /**
1087
1087
  * Paste text into the editor. Defaults to interpreting text as markdown.
@@ -1100,7 +1100,7 @@ class Io {
1100
1100
  return this.pasteHTML(t);
1101
1101
  }
1102
1102
  }
1103
- const oe = [
1103
+ const ne = [
1104
1104
  "vscode-editor-data",
1105
1105
  "blocknote/html",
1106
1106
  "text/markdown",
@@ -1108,28 +1108,28 @@ const oe = [
1108
1108
  "text/plain",
1109
1109
  "Files"
1110
1110
  ];
1111
- function Ao(o, e) {
1112
- if (!o.startsWith(".") || !e.startsWith("."))
1111
+ function Do(n, e) {
1112
+ if (!n.startsWith(".") || !e.startsWith("."))
1113
1113
  throw new Error("The strings provided are not valid file extensions.");
1114
- return o === e;
1114
+ return n === e;
1115
1115
  }
1116
- function _o(o, e) {
1117
- const t = o.split("/"), n = e.split("/");
1116
+ function Lo(n, e) {
1117
+ const t = n.split("/"), o = e.split("/");
1118
1118
  if (t.length !== 2)
1119
- throw new Error(`The string ${o} is not a valid MIME type.`);
1120
- if (n.length !== 2)
1119
+ throw new Error(`The string ${n} is not a valid MIME type.`);
1120
+ if (o.length !== 2)
1121
1121
  throw new Error(`The string ${e} is not a valid MIME type.`);
1122
- return t[1] === "*" || n[1] === "*" ? t[0] === n[0] : (t[0] === "*" || n[0] === "*" || t[0] === n[0]) && t[1] === n[1];
1122
+ return t[1] === "*" || o[1] === "*" ? t[0] === o[0] : (t[0] === "*" || o[0] === "*" || t[0] === o[0]) && t[1] === o[1];
1123
1123
  }
1124
- function le(o, e, t, n = "after") {
1124
+ function le(n, e, t, o = "after") {
1125
1125
  let s;
1126
- return Array.isArray(e.content) && e.content.length === 0 ? s = o.updateBlock(e, t).id : s = o.insertBlocks(
1126
+ return Array.isArray(e.content) && e.content.length === 0 ? s = n.updateBlock(e, t).id : s = n.insertBlocks(
1127
1127
  [t],
1128
1128
  e,
1129
- n
1129
+ o
1130
1130
  )[0].id, s;
1131
1131
  }
1132
- async function Ie(o, e) {
1132
+ async function Ie(n, e) {
1133
1133
  var r;
1134
1134
  if (!e.uploadFile) {
1135
1135
  console.warn(
@@ -1137,26 +1137,26 @@ async function Ie(o, e) {
1137
1137
  );
1138
1138
  return;
1139
1139
  }
1140
- const t = "dataTransfer" in o ? o.dataTransfer : o.clipboardData;
1140
+ const t = "dataTransfer" in n ? n.dataTransfer : n.clipboardData;
1141
1141
  if (t === null)
1142
1142
  return;
1143
- let n = null;
1144
- for (const a of oe)
1143
+ let o = null;
1144
+ for (const a of ne)
1145
1145
  if (t.types.includes(a)) {
1146
- n = a;
1146
+ o = a;
1147
1147
  break;
1148
1148
  }
1149
- if (n !== "Files")
1149
+ if (o !== "Files")
1150
1150
  return;
1151
1151
  const s = t.items;
1152
1152
  if (s) {
1153
- o.preventDefault();
1153
+ n.preventDefault();
1154
1154
  for (let a = 0; a < s.length; a++) {
1155
1155
  let c = "file";
1156
1156
  for (const l of Object.values(e.schema.blockSpecs))
1157
1157
  for (const d of ((r = l.implementation.meta) == null ? void 0 : r.fileBlockAccept) || []) {
1158
1158
  const u = d.startsWith("."), p = s[a].getAsFile();
1159
- if (p && (!u && p.type && _o(s[a].type, d) || u && Ao(
1159
+ if (p && (!u && p.type && Lo(s[a].type, d) || u && Do(
1160
1160
  "." + p.name.split(".").pop(),
1161
1161
  d
1162
1162
  ))) {
@@ -1173,26 +1173,26 @@ async function Ie(o, e) {
1173
1173
  }
1174
1174
  };
1175
1175
  let d;
1176
- if (o.type === "paste") {
1176
+ if (n.type === "paste") {
1177
1177
  const m = e.getTextCursorPosition().block;
1178
1178
  d = le(e, m, l);
1179
- } else if (o.type === "drop") {
1179
+ } else if (n.type === "drop") {
1180
1180
  const m = {
1181
- left: o.clientX,
1182
- top: o.clientY
1181
+ left: n.clientX,
1182
+ top: n.clientY
1183
1183
  }, f = e.prosemirrorView.posAtCoords(m);
1184
1184
  if (!f)
1185
1185
  return;
1186
1186
  d = e.transact((k) => {
1187
- var S;
1188
- const g = _(k.doc, f.pos), y = (S = e.domElement) == null ? void 0 : S.querySelector(
1189
- `[data-id="${g.node.attrs.id}"]`
1190
- ), T = y == null ? void 0 : y.getBoundingClientRect();
1187
+ var y;
1188
+ const b = _(k.doc, f.pos), g = (y = e.domElement) == null ? void 0 : y.querySelector(
1189
+ `[data-id="${b.node.attrs.id}"]`
1190
+ ), w = g == null ? void 0 : g.getBoundingClientRect();
1191
1191
  return le(
1192
1192
  e,
1193
- e.getBlock(g.node.attrs.id),
1193
+ e.getBlock(b.node.attrs.id),
1194
1194
  l,
1195
- T && (T.top + T.bottom) / 2 > m.top ? "before" : "after"
1195
+ w && (w.top + w.bottom) / 2 > m.top ? "before" : "after"
1196
1196
  );
1197
1197
  });
1198
1198
  } else
@@ -1207,104 +1207,104 @@ async function Ie(o, e) {
1207
1207
  }
1208
1208
  }
1209
1209
  }
1210
- const Do = (o) => E.create({
1210
+ const No = (n) => x.create({
1211
1211
  name: "dropFile",
1212
1212
  addProseMirrorPlugins() {
1213
1213
  return [
1214
- new ee({
1214
+ new te({
1215
1215
  props: {
1216
1216
  handleDOMEvents: {
1217
1217
  drop(e, t) {
1218
- if (!o.isEditable)
1218
+ if (!n.isEditable)
1219
1219
  return;
1220
- let n = null;
1221
- for (const s of oe)
1220
+ let o = null;
1221
+ for (const s of ne)
1222
1222
  if (t.dataTransfer.types.includes(s)) {
1223
- n = s;
1223
+ o = s;
1224
1224
  break;
1225
1225
  }
1226
- return n === null ? !0 : n === "Files" ? (Ie(t, o), !0) : !1;
1226
+ return o === null ? !0 : o === "Files" ? (Ie(t, n), !0) : !1;
1227
1227
  }
1228
1228
  }
1229
1229
  }
1230
1230
  })
1231
1231
  ];
1232
1232
  }
1233
- }), Lo = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, No = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, Oo = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Fo = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, $o = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Ho = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, Vo = /\n{2} {0,3}-{2,48}\n{2}/, Uo = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, zo = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, Go = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Ro = /^\s*\|(.+\|)+\s*$/m, jo = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Wo = /^\s*\|(.+\|)+\s*$/m, qo = (o) => Lo.test(o) || No.test(o) || Oo.test(o) || Fo.test(o) || $o.test(o) || Ho.test(o) || Vo.test(o) || Uo.test(o) || zo.test(o) || Go.test(o) || Ro.test(o) || jo.test(o) || Wo.test(o);
1234
- async function Ko(o, e) {
1233
+ }), Oo = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, Fo = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, $o = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Ho = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, Vo = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Uo = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, zo = /\n{2} {0,3}-{2,48}\n{2}/, Go = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, Ro = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, jo = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Wo = /^\s*\|(.+\|)+\s*$/m, qo = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Ko = /^\s*\|(.+\|)+\s*$/m, Jo = (n) => Oo.test(n) || Fo.test(n) || $o.test(n) || Ho.test(n) || Vo.test(n) || Uo.test(n) || zo.test(n) || Go.test(n) || Ro.test(n) || jo.test(n) || Wo.test(n) || qo.test(n) || Ko.test(n);
1234
+ async function Yo(n, e) {
1235
1235
  const { schema: t } = e.state;
1236
- if (!o.clipboardData)
1236
+ if (!n.clipboardData)
1237
1237
  return !1;
1238
- const n = o.clipboardData.getData("text/plain");
1239
- if (!n)
1238
+ const o = n.clipboardData.getData("text/plain");
1239
+ if (!o)
1240
1240
  return !1;
1241
1241
  if (!t.nodes.codeBlock)
1242
- return e.pasteText(n), !0;
1243
- const s = o.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0, a = r == null ? void 0 : r.mode;
1242
+ return e.pasteText(o), !0;
1243
+ const s = n.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0, a = r == null ? void 0 : r.mode;
1244
1244
  return a ? (e.pasteHTML(
1245
- `<pre><code class="language-${a}">${n.replace(
1245
+ `<pre><code class="language-${a}">${o.replace(
1246
1246
  /\r\n?/g,
1247
1247
  `
1248
1248
  `
1249
1249
  )}</code></pre>`
1250
1250
  ), !0) : !1;
1251
1251
  }
1252
- function Jo({
1253
- event: o,
1252
+ function Qo({
1253
+ event: n,
1254
1254
  editor: e,
1255
1255
  prioritizeMarkdownOverHTML: t,
1256
- plainTextAsMarkdown: n
1256
+ plainTextAsMarkdown: o
1257
1257
  }) {
1258
1258
  var c;
1259
1259
  if (e.transact(
1260
1260
  (i) => i.selection.$from.parent.type.spec.code && i.selection.$to.parent.type.spec.code
1261
1261
  )) {
1262
- const i = (c = o.clipboardData) == null ? void 0 : c.getData("text/plain");
1262
+ const i = (c = n.clipboardData) == null ? void 0 : c.getData("text/plain");
1263
1263
  if (i)
1264
1264
  return e.pasteText(i), !0;
1265
1265
  }
1266
1266
  let r;
1267
- for (const i of oe)
1268
- if (o.clipboardData.types.includes(i)) {
1267
+ for (const i of ne)
1268
+ if (n.clipboardData.types.includes(i)) {
1269
1269
  r = i;
1270
1270
  break;
1271
1271
  }
1272
1272
  if (!r)
1273
1273
  return !0;
1274
1274
  if (r === "vscode-editor-data")
1275
- return Ko(o, e.prosemirrorView), !0;
1275
+ return Yo(n, e.prosemirrorView), !0;
1276
1276
  if (r === "Files")
1277
- return Ie(o, e), !0;
1278
- const a = o.clipboardData.getData(r);
1277
+ return Ie(n, e), !0;
1278
+ const a = n.clipboardData.getData(r);
1279
1279
  if (r === "blocknote/html")
1280
1280
  return e.pasteHTML(a, !0), !0;
1281
1281
  if (r === "text/markdown")
1282
1282
  return e.pasteMarkdown(a), !0;
1283
1283
  if (t) {
1284
- const i = o.clipboardData.getData("text/plain");
1285
- if (qo(i))
1284
+ const i = n.clipboardData.getData("text/plain");
1285
+ if (Jo(i))
1286
1286
  return e.pasteMarkdown(i), !0;
1287
1287
  }
1288
- return r === "text/html" ? (e.pasteHTML(a), !0) : n ? (e.pasteMarkdown(a), !0) : (e.pasteText(a), !0);
1288
+ return r === "text/html" ? (e.pasteHTML(a), !0) : o ? (e.pasteMarkdown(a), !0) : (e.pasteText(a), !0);
1289
1289
  }
1290
- const Yo = (o, e) => E.create({
1290
+ const Xo = (n, e) => x.create({
1291
1291
  name: "pasteFromClipboard",
1292
1292
  addProseMirrorPlugins() {
1293
1293
  return [
1294
- new ee({
1294
+ new te({
1295
1295
  props: {
1296
1296
  handleDOMEvents: {
1297
- paste(t, n) {
1298
- if (n.preventDefault(), !!o.isEditable)
1297
+ paste(t, o) {
1298
+ if (o.preventDefault(), !!n.isEditable)
1299
1299
  return e({
1300
- event: n,
1301
- editor: o,
1300
+ event: o,
1301
+ editor: n,
1302
1302
  defaultPasteHandler: ({
1303
1303
  prioritizeMarkdownOverHTML: s = !0,
1304
1304
  plainTextAsMarkdown: r = !0
1305
- } = {}) => Jo({
1306
- event: n,
1307
- editor: o,
1305
+ } = {}) => Qo({
1306
+ event: o,
1307
+ editor: n,
1308
1308
  prioritizeMarkdownOverHTML: s,
1309
1309
  plainTextAsMarkdown: r
1310
1310
  })
@@ -1316,30 +1316,30 @@ const Yo = (o, e) => E.create({
1316
1316
  ];
1317
1317
  }
1318
1318
  });
1319
- function Qo(o, e, t) {
1319
+ function Zo(n, e, t) {
1320
1320
  var c;
1321
- let n = !1;
1322
- const s = o.state.selection instanceof te;
1321
+ let o = !1;
1322
+ const s = n.state.selection instanceof oe;
1323
1323
  if (!s) {
1324
- const i = o.state.doc.slice(
1325
- o.state.selection.from,
1326
- o.state.selection.to,
1324
+ const i = n.state.doc.slice(
1325
+ n.state.selection.from,
1326
+ n.state.selection.to,
1327
1327
  !1
1328
1328
  ).content, l = [];
1329
1329
  for (let d = 0; d < i.childCount; d++)
1330
1330
  l.push(i.child(d));
1331
- n = l.find(
1331
+ o = l.find(
1332
1332
  (d) => d.type.isInGroup("bnBlock") || d.type.name === "blockGroup" || d.type.spec.group === "blockContent"
1333
- ) === void 0, n && (e = i);
1333
+ ) === void 0, o && (e = i);
1334
1334
  }
1335
1335
  let r;
1336
- const a = be(
1337
- o.state.schema,
1336
+ const a = ge(
1337
+ n.state.schema,
1338
1338
  t
1339
1339
  );
1340
1340
  if (s) {
1341
1341
  ((c = e.firstChild) == null ? void 0 : c.type.name) === "table" && (e = e.firstChild.content);
1342
- const i = Ge(
1342
+ const i = Re(
1343
1343
  e,
1344
1344
  t.schema.inlineContentSchema,
1345
1345
  t.schema.styleSchema
@@ -1348,64 +1348,64 @@ function Qo(o, e, t) {
1348
1348
  i,
1349
1349
  {}
1350
1350
  )}</table>`;
1351
- } else if (n) {
1352
- const i = Re(
1351
+ } else if (o) {
1352
+ const i = je(
1353
1353
  e,
1354
1354
  t.schema.inlineContentSchema,
1355
1355
  t.schema.styleSchema
1356
1356
  );
1357
1357
  r = a.exportInlineContent(i, {});
1358
1358
  } else {
1359
- const i = at(e);
1359
+ const i = it(e);
1360
1360
  r = a.exportBlocks(i, {});
1361
1361
  }
1362
1362
  return r;
1363
1363
  }
1364
- function Ae(o, e) {
1365
- "node" in o.state.selection && o.state.selection.node.type.spec.group === "blockContent" && e.transact(
1364
+ function Ae(n, e) {
1365
+ "node" in n.state.selection && n.state.selection.node.type.spec.group === "blockContent" && e.transact(
1366
1366
  (a) => a.setSelection(
1367
- new L(a.doc.resolve(o.state.selection.from - 1))
1367
+ new L(a.doc.resolve(n.state.selection.from - 1))
1368
1368
  )
1369
1369
  );
1370
- const t = o.serializeForClipboard(
1371
- o.state.selection.content()
1372
- ).dom.innerHTML, n = o.state.selection.content().content, s = Qo(
1373
- o,
1370
+ const t = n.serializeForClipboard(
1371
+ n.state.selection.content()
1372
+ ).dom.innerHTML, o = n.state.selection.content().content, s = Zo(
1374
1373
  n,
1374
+ o,
1375
1375
  e
1376
- ), r = rt(s);
1376
+ ), r = at(s);
1377
1377
  return { clipboardHTML: t, externalHTML: s, markdown: r };
1378
1378
  }
1379
1379
  const de = () => {
1380
- const o = window.getSelection();
1381
- if (!o || o.isCollapsed)
1380
+ const n = window.getSelection();
1381
+ if (!n || n.isCollapsed)
1382
1382
  return !0;
1383
- let e = o.focusNode;
1383
+ let e = n.focusNode;
1384
1384
  for (; e; ) {
1385
1385
  if (e instanceof HTMLElement && e.getAttribute("contenteditable") === "false")
1386
1386
  return !0;
1387
1387
  e = e.parentElement;
1388
1388
  }
1389
1389
  return !1;
1390
- }, ue = (o, e, t) => {
1390
+ }, ue = (n, e, t) => {
1391
1391
  t.preventDefault(), t.clipboardData.clearData();
1392
- const { clipboardHTML: n, externalHTML: s, markdown: r } = Ae(
1392
+ const { clipboardHTML: o, externalHTML: s, markdown: r } = Ae(
1393
1393
  e,
1394
- o
1394
+ n
1395
1395
  );
1396
- t.clipboardData.setData("blocknote/html", n), t.clipboardData.setData("text/html", s), t.clipboardData.setData("text/plain", r);
1397
- }, Xo = (o) => E.create({
1396
+ t.clipboardData.setData("blocknote/html", o), t.clipboardData.setData("text/html", s), t.clipboardData.setData("text/plain", r);
1397
+ }, en = (n) => x.create({
1398
1398
  name: "copyToClipboard",
1399
1399
  addProseMirrorPlugins() {
1400
1400
  return [
1401
- new ee({
1401
+ new te({
1402
1402
  props: {
1403
1403
  handleDOMEvents: {
1404
1404
  copy(e, t) {
1405
- return de() || ue(o, e, t), !0;
1405
+ return de() || ue(n, e, t), !0;
1406
1406
  },
1407
1407
  cut(e, t) {
1408
- return de() || (ue(o, e, t), e.editable && e.dispatch(e.state.tr.deleteSelection())), !0;
1408
+ return de() || (ue(n, e, t), e.editable && e.dispatch(e.state.tr.deleteSelection())), !0;
1409
1409
  },
1410
1410
  // This is for the use-case in which only a block without content
1411
1411
  // is selected, e.g. an image block, and dragged (not using the
@@ -1413,34 +1413,34 @@ const de = () => {
1413
1413
  dragstart(e, t) {
1414
1414
  if (!("node" in e.state.selection) || e.state.selection.node.type.spec.group !== "blockContent")
1415
1415
  return;
1416
- o.transact(
1416
+ n.transact(
1417
1417
  (a) => a.setSelection(
1418
1418
  new L(
1419
1419
  a.doc.resolve(e.state.selection.from - 1)
1420
1420
  )
1421
1421
  )
1422
1422
  ), t.preventDefault(), t.dataTransfer.clearData();
1423
- const { clipboardHTML: n, externalHTML: s, markdown: r } = Ae(e, o);
1424
- return t.dataTransfer.setData("blocknote/html", n), t.dataTransfer.setData("text/html", s), t.dataTransfer.setData("text/plain", r), !0;
1423
+ const { clipboardHTML: o, externalHTML: s, markdown: r } = Ae(e, n);
1424
+ return t.dataTransfer.setData("blocknote/html", o), t.dataTransfer.setData("text/html", s), t.dataTransfer.setData("text/plain", r), !0;
1425
1425
  }
1426
1426
  }
1427
1427
  }
1428
1428
  })
1429
1429
  ];
1430
1430
  }
1431
- }), Zo = E.create({
1431
+ }), tn = x.create({
1432
1432
  name: "blockBackgroundColor",
1433
1433
  addGlobalAttributes() {
1434
1434
  return [
1435
1435
  {
1436
1436
  types: ["tableCell", "tableHeader"],
1437
1437
  attributes: {
1438
- backgroundColor: Xe()
1438
+ backgroundColor: Ze()
1439
1439
  }
1440
1440
  }
1441
1441
  ];
1442
1442
  }
1443
- }), en = D.create({
1443
+ }), on = D.create({
1444
1444
  name: "hardBreak",
1445
1445
  inline: !0,
1446
1446
  group: "inline",
@@ -1450,61 +1450,61 @@ const de = () => {
1450
1450
  parseHTML() {
1451
1451
  return [{ tag: "br" }];
1452
1452
  },
1453
- renderHTML({ HTMLAttributes: o }) {
1454
- return ["br", wt(this.options.HTMLAttributes, o)];
1453
+ renderHTML({ HTMLAttributes: n }) {
1454
+ return ["br", wt(this.options.HTMLAttributes, n)];
1455
1455
  },
1456
1456
  renderText() {
1457
1457
  return `
1458
1458
  `;
1459
1459
  }
1460
- }), K = (o, e) => {
1461
- const t = o.resolve(e), n = t.index();
1462
- if (n === 0)
1460
+ }), Y = (n, e) => {
1461
+ const t = n.resolve(e), o = t.index();
1462
+ if (o === 0)
1463
1463
  return;
1464
- const s = t.posAtIndex(n - 1);
1465
- return Y(
1466
- o.resolve(s)
1464
+ const s = t.posAtIndex(o - 1);
1465
+ return X(
1466
+ n.resolve(s)
1467
1467
  );
1468
- }, _e = (o, e) => {
1468
+ }, _e = (n, e) => {
1469
1469
  for (; e.childContainer; ) {
1470
- const t = e.childContainer.node, n = o.resolve(e.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
1471
- e = Y(o.resolve(n));
1470
+ const t = e.childContainer.node, o = n.resolve(e.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
1471
+ e = X(n.resolve(o));
1472
1472
  }
1473
1473
  return e;
1474
- }, tn = (o, e) => o.isBlockContainer && o.blockContent.node.type.spec.content === "inline*" && o.blockContent.node.childCount > 0 && e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*", on = (o, e, t, n) => {
1475
- if (!n.isBlockContainer)
1474
+ }, nn = (n, e) => n.isBlockContainer && n.blockContent.node.type.spec.content === "inline*" && n.blockContent.node.childCount > 0 && e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*", sn = (n, e, t, o) => {
1475
+ if (!o.isBlockContainer)
1476
1476
  throw new Error(
1477
- `Attempted to merge block at position ${n.bnBlock.beforePos} into previous block at position ${t.bnBlock.beforePos}, but next block is not a block container`
1477
+ `Attempted to merge block at position ${o.bnBlock.beforePos} into previous block at position ${t.bnBlock.beforePos}, but next block is not a block container`
1478
1478
  );
1479
- if (n.childContainer) {
1480
- const s = o.doc.resolve(
1481
- n.childContainer.beforePos + 1
1482
- ), r = o.doc.resolve(
1483
- n.childContainer.afterPos - 1
1479
+ if (o.childContainer) {
1480
+ const s = n.doc.resolve(
1481
+ o.childContainer.beforePos + 1
1482
+ ), r = n.doc.resolve(
1483
+ o.childContainer.afterPos - 1
1484
1484
  ), a = s.blockRange(r);
1485
1485
  if (e) {
1486
- const c = o.doc.resolve(n.bnBlock.beforePos);
1487
- o.tr.lift(a, c.depth);
1486
+ const c = n.doc.resolve(o.bnBlock.beforePos);
1487
+ n.tr.lift(a, c.depth);
1488
1488
  }
1489
1489
  }
1490
1490
  if (e) {
1491
1491
  if (!t.isBlockContainer)
1492
1492
  throw new Error(
1493
- `Attempted to merge block at position ${n.bnBlock.beforePos} into previous block at position ${t.bnBlock.beforePos}, but previous block is not a block container`
1493
+ `Attempted to merge block at position ${o.bnBlock.beforePos} into previous block at position ${t.bnBlock.beforePos}, but previous block is not a block container`
1494
1494
  );
1495
1495
  e(
1496
- o.tr.delete(
1496
+ n.tr.delete(
1497
1497
  t.blockContent.afterPos - 1,
1498
- n.blockContent.beforePos + 1
1498
+ o.blockContent.beforePos + 1
1499
1499
  )
1500
1500
  );
1501
1501
  }
1502
1502
  return !0;
1503
- }, pe = (o) => ({
1503
+ }, pe = (n) => ({
1504
1504
  state: e,
1505
1505
  dispatch: t
1506
1506
  }) => {
1507
- const n = e.doc.resolve(o), s = Y(n), r = K(
1507
+ const o = e.doc.resolve(n), s = X(o), r = Y(
1508
1508
  e.doc,
1509
1509
  s.bnBlock.beforePos
1510
1510
  );
@@ -1514,13 +1514,13 @@ const de = () => {
1514
1514
  e.doc,
1515
1515
  r
1516
1516
  );
1517
- return tn(a, s) ? on(e, t, a, s) : !1;
1518
- }, nn = E.create({
1517
+ return nn(a, s) ? sn(e, t, a, s) : !1;
1518
+ }, rn = x.create({
1519
1519
  priority: 50,
1520
1520
  // TODO: The shortcuts need a refactor. Do we want to use a command priority
1521
1521
  // design as there is now, or clump the logic into a single function?
1522
1522
  addKeyboardShortcuts() {
1523
- const o = () => this.editor.commands.first(({ chain: n, commands: s }) => [
1523
+ const n = () => this.editor.commands.first(({ chain: o, commands: s }) => [
1524
1524
  // Deletes the selection if it's not empty.
1525
1525
  () => s.deleteSelection(),
1526
1526
  // Undoes an input rule if one was triggered in the last editor state change.
@@ -1532,7 +1532,7 @@ const de = () => {
1532
1532
  return !1;
1533
1533
  const c = r.selection.from === a.blockContent.beforePos + 1, i = a.blockContent.node.type.name === "paragraph";
1534
1534
  return c && !i ? s.command(
1535
- et(a.bnBlock.beforePos, {
1535
+ tt(a.bnBlock.beforePos, {
1536
1536
  type: "paragraph",
1537
1537
  props: {}
1538
1538
  })
@@ -1553,7 +1553,7 @@ const de = () => {
1553
1553
  if (!a.isBlockContainer)
1554
1554
  return !1;
1555
1555
  const { bnBlock: c, blockContent: i } = a, l = r.selection.from === i.beforePos + 1, d = r.selection.empty, u = c.beforePos;
1556
- return l && d ? n().command(pe(u)).scrollIntoView().run() : !1;
1556
+ return l && d ? o().command(pe(u)).scrollIntoView().run() : !1;
1557
1557
  }),
1558
1558
  () => s.command(({ state: r, tr: a, dispatch: c }) => {
1559
1559
  const i = B(r);
@@ -1564,50 +1564,54 @@ const de = () => {
1564
1564
  return !1;
1565
1565
  const m = a.doc.resolve(i.bnBlock.beforePos), f = a.doc.resolve(m.before()), k = f.before();
1566
1566
  if (c) {
1567
- const g = a.doc.slice(
1567
+ const b = a.doc.slice(
1568
1568
  i.bnBlock.beforePos,
1569
1569
  i.bnBlock.afterPos
1570
1570
  ).content;
1571
1571
  a.delete(
1572
1572
  i.bnBlock.beforePos,
1573
1573
  i.bnBlock.afterPos
1574
- ), f.index() === 0 ? (W(a, k), a.insert(k, g), a.setSelection(
1575
- w.near(a.doc.resolve(k))
1576
- )) : (a.insert(f.pos - 1, g), a.setSelection(
1577
- w.near(a.doc.resolve(f.pos - 1))
1578
- ), W(a, k));
1574
+ ), f.index() === 0 ? (K(a, k), a.insert(k, b), a.setSelection(
1575
+ M.near(a.doc.resolve(k))
1576
+ )) : (a.insert(f.pos - 1, b), a.setSelection(
1577
+ M.near(a.doc.resolve(f.pos - 1))
1578
+ ), K(a, k));
1579
1579
  }
1580
1580
  return !0;
1581
1581
  }),
1582
1582
  // Deletes the current block if it's an empty block with inline content,
1583
1583
  // and moves the selection to the previous block.
1584
1584
  () => s.command(({ state: r }) => {
1585
+ var i;
1585
1586
  const a = B(r);
1586
1587
  if (!a.isBlockContainer)
1587
1588
  return !1;
1588
1589
  if (a.blockContent.node.childCount === 0 && a.blockContent.node.type.spec.content === "inline*") {
1589
- const i = K(
1590
+ const l = Y(
1590
1591
  r.doc,
1591
1592
  a.bnBlock.beforePos
1592
1593
  );
1593
- if (!i || !i.isBlockContainer)
1594
+ if (!l || !l.isBlockContainer)
1594
1595
  return !1;
1595
- let l = n();
1596
- if (i.blockContent.node.type.spec.content === "tableRow+") {
1597
- const f = a.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
1598
- l = l.setTextSelection(
1599
- f
1596
+ let d = o();
1597
+ if (a.childContainer && d.insertContentAt(
1598
+ a.bnBlock.afterPos,
1599
+ (i = a.childContainer) == null ? void 0 : i.node.content
1600
+ ), l.blockContent.node.type.spec.content === "tableRow+") {
1601
+ const k = a.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
1602
+ d = d.setTextSelection(
1603
+ k
1600
1604
  );
1601
- } else if (i.blockContent.node.type.spec.content === "") {
1602
- const d = i.blockContent.afterPos - i.blockContent.node.nodeSize;
1603
- l = l.setNodeSelection(
1604
- d
1605
+ } else if (l.blockContent.node.type.spec.content === "") {
1606
+ const u = l.blockContent.afterPos - l.blockContent.node.nodeSize;
1607
+ d = d.setNodeSelection(
1608
+ u
1605
1609
  );
1606
1610
  } else {
1607
- const d = i.blockContent.afterPos - i.blockContent.node.nodeSize;
1608
- l = l.setTextSelection(d);
1611
+ const u = l.blockContent.afterPos - 1;
1612
+ d = d.setTextSelection(u);
1609
1613
  }
1610
- return l.deleteRange({
1614
+ return d.deleteRange({
1611
1615
  from: a.bnBlock.beforePos,
1612
1616
  to: a.bnBlock.afterPos
1613
1617
  }).scrollIntoView().run();
@@ -1621,7 +1625,7 @@ const de = () => {
1621
1625
  const a = B(r);
1622
1626
  if (!a.isBlockContainer)
1623
1627
  throw new Error("todo");
1624
- const c = r.selection.from === a.blockContent.beforePos + 1, i = r.selection.empty, l = K(
1628
+ const c = r.selection.from === a.blockContent.beforePos + 1, i = r.selection.empty, l = Y(
1625
1629
  r.doc,
1626
1630
  a.bnBlock.beforePos
1627
1631
  );
@@ -1633,7 +1637,7 @@ const de = () => {
1633
1637
  if (!d.isBlockContainer)
1634
1638
  throw new Error("todo");
1635
1639
  if (d.blockContent.node.type.spec.content === "" || d.blockContent.node.type.spec.content === "inline*" && d.blockContent.node.childCount === 0)
1636
- return n().cut(
1640
+ return o().cut(
1637
1641
  {
1638
1642
  from: a.bnBlock.beforePos,
1639
1643
  to: a.bnBlock.afterPos
@@ -1646,13 +1650,13 @@ const de = () => {
1646
1650
  }
1647
1651
  return !1;
1648
1652
  })
1649
- ]), e = () => this.editor.commands.first(({ commands: n }) => [
1653
+ ]), e = () => this.editor.commands.first(({ commands: o }) => [
1650
1654
  // Deletes the selection if it's not empty.
1651
- () => n.deleteSelection(),
1655
+ () => o.deleteSelection(),
1652
1656
  // Merges block with the next one (at the same nesting level or lower),
1653
1657
  // if one exists, the block has no children, and the selection is at the
1654
1658
  // end of the block.
1655
- () => n.command(({ state: s }) => {
1659
+ () => o.command(({ state: s }) => {
1656
1660
  const r = B(s);
1657
1661
  if (!r.isBlockContainer)
1658
1662
  return !1;
@@ -1662,14 +1666,14 @@ const de = () => {
1662
1666
  childContainer: i
1663
1667
  } = r, { depth: l } = s.doc.resolve(a.beforePos), d = a.afterPos === s.doc.nodeSize - 3, u = s.selection.from === c.afterPos - 1, p = s.selection.empty;
1664
1668
  if (!d && u && p && !(i !== void 0)) {
1665
- let f = l, k = a.afterPos + 1, g = s.doc.resolve(k).depth;
1666
- for (; g < f; )
1667
- f = g, k += 2, g = s.doc.resolve(k).depth;
1668
- return n.command(pe(k - 1));
1669
+ let f = l, k = a.afterPos + 1, b = s.doc.resolve(k).depth;
1670
+ for (; b < f; )
1671
+ f = b, k += 2, b = s.doc.resolve(k).depth;
1672
+ return o.command(pe(k - 1));
1669
1673
  }
1670
1674
  return !1;
1671
1675
  })
1672
- ]), t = (n = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
1676
+ ]), t = (o = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
1673
1677
  // Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
1674
1678
  // of the block.
1675
1679
  () => s.command(({ state: a }) => {
@@ -1688,7 +1692,7 @@ const de = () => {
1688
1692
  if (
1689
1693
  // If shortcut is not configured, or is configured as "shift+enter",
1690
1694
  // create a hard break for shift+enter, but not for enter.
1691
- i === "shift+enter" && n || // If shortcut is configured as "enter", create a hard break for
1695
+ i === "shift+enter" && o || // If shortcut is configured as "enter", create a hard break for
1692
1696
  // both enter and shift+enter.
1693
1697
  i === "enter"
1694
1698
  ) {
@@ -1706,17 +1710,27 @@ const de = () => {
1706
1710
  }),
1707
1711
  // Creates a new block and moves the selection to it if the current one is empty, while the selection is also
1708
1712
  // empty & at the start of the block.
1709
- () => s.command(({ state: a, dispatch: c }) => {
1710
- const i = B(a);
1711
- if (!i.isBlockContainer)
1713
+ () => s.command(({ state: a, dispatch: c, tr: i }) => {
1714
+ var k;
1715
+ const l = B(a);
1716
+ if (!l.isBlockContainer)
1712
1717
  return !1;
1713
- const { bnBlock: l, blockContent: d } = i, u = a.selection.$anchor.parentOffset === 0, p = a.selection.anchor === a.selection.head, m = d.node.childCount === 0;
1714
- if (u && p && m) {
1715
- const f = l.afterPos, k = f + 2;
1718
+ const { bnBlock: d, blockContent: u } = l, p = a.selection.$anchor.parentOffset === 0, m = a.selection.anchor === a.selection.head, f = u.node.childCount === 0;
1719
+ if (p && m && f) {
1720
+ const b = d.afterPos, g = b + 2;
1716
1721
  if (c) {
1717
- const g = a.schema.nodes.blockContainer.createAndFill();
1718
- a.tr.insert(f, g).scrollIntoView(), a.tr.setSelection(
1719
- new w(a.doc.resolve(k))
1722
+ const w = a.schema.nodes.blockContainer.createAndFill(
1723
+ void 0,
1724
+ [
1725
+ a.schema.nodes.paragraph.createAndFill() || void 0,
1726
+ (k = l.childContainer) == null ? void 0 : k.node
1727
+ ].filter((y) => y !== void 0)
1728
+ );
1729
+ i.insert(b, w).setSelection(
1730
+ new M(i.doc.resolve(g))
1731
+ ).scrollIntoView(), l.childContainer && i.delete(
1732
+ l.childContainer.beforePos,
1733
+ l.childContainer.afterPos
1720
1734
  );
1721
1735
  }
1722
1736
  return !0;
@@ -1731,7 +1745,7 @@ const de = () => {
1731
1745
  return !1;
1732
1746
  const { blockContent: l } = i, d = a.selection.$anchor.parentOffset === 0;
1733
1747
  return l.node.childCount === 0 ? !1 : (c().deleteSelection().command(
1734
- Ze(
1748
+ et(
1735
1749
  a.selection.from,
1736
1750
  d,
1737
1751
  d
@@ -1740,19 +1754,19 @@ const de = () => {
1740
1754
  })
1741
1755
  ]);
1742
1756
  return {
1743
- Backspace: o,
1757
+ Backspace: n,
1744
1758
  Delete: e,
1745
1759
  Enter: () => t(),
1746
1760
  "Shift-Enter": () => t(!0),
1747
1761
  // Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
1748
1762
  // editor since the browser will try to use tab for keyboard navigation.
1749
1763
  Tab: () => {
1750
- var n, s;
1751
- return this.options.tabBehavior !== "prefer-indent" && ((n = this.options.editor.getExtension(R)) != null && n.store.state || ((s = this.options.editor.getExtension(G)) == null ? void 0 : s.store.state) !== void 0) ? !1 : Te(this.options.editor);
1764
+ var o, s;
1765
+ return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(W)) != null && o.store.state || ((s = this.options.editor.getExtension(j)) == null ? void 0 : s.store.state) !== void 0) ? !1 : Te(this.options.editor);
1752
1766
  },
1753
1767
  "Shift-Tab": () => {
1754
- var n, s;
1755
- return this.options.tabBehavior !== "prefer-indent" && ((n = this.options.editor.getExtension(R)) != null && n.store.state || ((s = this.options.editor.getExtension(G)) == null ? void 0 : s.store.state) !== void 0) ? !1 : this.editor.commands.liftListItem("blockContainer");
1768
+ var o, s;
1769
+ return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(W)) != null && o.store.state || ((s = this.options.editor.getExtension(j)) == null ? void 0 : s.store.state) !== void 0) ? !1 : this.editor.commands.liftListItem("blockContainer");
1756
1770
  },
1757
1771
  "Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
1758
1772
  "Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
@@ -1761,7 +1775,7 @@ const de = () => {
1761
1775
  "Shift-Mod-z": () => this.options.editor.redo()
1762
1776
  };
1763
1777
  }
1764
- }), sn = X.create({
1778
+ }), an = ee.create({
1765
1779
  name: "insertion",
1766
1780
  inclusive: !1,
1767
1781
  excludes: "deletion modification insertion",
@@ -1771,8 +1785,8 @@ const de = () => {
1771
1785
  // note: validate is supported in prosemirror but not in tiptap, so this doesn't actually work (considered not critical)
1772
1786
  };
1773
1787
  },
1774
- extendMarkSchema(o) {
1775
- return o.name !== "insertion" ? {} : {
1788
+ extendMarkSchema(n) {
1789
+ return n.name !== "insertion" ? {} : {
1776
1790
  blocknoteIgnore: !0,
1777
1791
  inclusive: !1,
1778
1792
  toDOM(e, t) {
@@ -1799,7 +1813,7 @@ const de = () => {
1799
1813
  ]
1800
1814
  };
1801
1815
  }
1802
- }), rn = X.create({
1816
+ }), cn = ee.create({
1803
1817
  name: "deletion",
1804
1818
  inclusive: !1,
1805
1819
  excludes: "insertion modification deletion",
@@ -1809,8 +1823,8 @@ const de = () => {
1809
1823
  // note: validate is supported in prosemirror but not in tiptap
1810
1824
  };
1811
1825
  },
1812
- extendMarkSchema(o) {
1813
- return o.name !== "deletion" ? {} : {
1826
+ extendMarkSchema(n) {
1827
+ return n.name !== "deletion" ? {} : {
1814
1828
  blocknoteIgnore: !0,
1815
1829
  inclusive: !1,
1816
1830
  // attrs: {
@@ -1840,7 +1854,7 @@ const de = () => {
1840
1854
  ]
1841
1855
  };
1842
1856
  }
1843
- }), an = X.create({
1857
+ }), ln = ee.create({
1844
1858
  name: "modification",
1845
1859
  inclusive: !1,
1846
1860
  excludes: "deletion insertion",
@@ -1853,8 +1867,8 @@ const de = () => {
1853
1867
  newValue: { default: null }
1854
1868
  };
1855
1869
  },
1856
- extendMarkSchema(o) {
1857
- return o.name !== "modification" ? {} : {
1870
+ extendMarkSchema(n) {
1871
+ return n.name !== "modification" ? {} : {
1858
1872
  blocknoteIgnore: !0,
1859
1873
  inclusive: !1,
1860
1874
  // attrs: {
@@ -1903,7 +1917,7 @@ const de = () => {
1903
1917
  ]
1904
1918
  };
1905
1919
  }
1906
- }), cn = E.create({
1920
+ }), dn = x.create({
1907
1921
  name: "textAlignment",
1908
1922
  addGlobalAttributes() {
1909
1923
  return [
@@ -1916,34 +1930,34 @@ const de = () => {
1916
1930
  attributes: {
1917
1931
  textAlignment: {
1918
1932
  default: "left",
1919
- parseHTML: (o) => o.getAttribute("data-text-alignment"),
1920
- renderHTML: (o) => o.textAlignment === "left" ? {} : {
1921
- "data-text-alignment": o.textAlignment
1933
+ parseHTML: (n) => n.getAttribute("data-text-alignment"),
1934
+ renderHTML: (n) => n.textAlignment === "left" ? {} : {
1935
+ "data-text-alignment": n.textAlignment
1922
1936
  }
1923
1937
  }
1924
1938
  }
1925
1939
  }
1926
1940
  ];
1927
1941
  }
1928
- }), ln = E.create({
1942
+ }), un = x.create({
1929
1943
  name: "blockTextColor",
1930
1944
  addGlobalAttributes() {
1931
1945
  return [
1932
1946
  {
1933
1947
  types: ["table", "tableCell", "tableHeader"],
1934
1948
  attributes: {
1935
- textColor: tt()
1949
+ textColor: ot()
1936
1950
  }
1937
1951
  }
1938
1952
  ];
1939
1953
  }
1940
- }), dn = {
1954
+ }), pn = {
1941
1955
  blockColor: "data-block-color",
1942
1956
  blockStyle: "data-block-style",
1943
1957
  id: "data-id",
1944
1958
  depth: "data-depth",
1945
1959
  depthChange: "data-depth-change"
1946
- }, un = D.create({
1960
+ }, fn = D.create({
1947
1961
  name: "blockContainer",
1948
1962
  group: "blockGroupChild bnBlock",
1949
1963
  // A block always contains content, and optionally a blockGroup which contains nested blocks
@@ -1956,12 +1970,12 @@ const de = () => {
1956
1970
  return [
1957
1971
  {
1958
1972
  tag: "div[data-node-type=" + this.name + "]",
1959
- getAttrs: (o) => {
1960
- if (typeof o == "string")
1973
+ getAttrs: (n) => {
1974
+ if (typeof n == "string")
1961
1975
  return !1;
1962
1976
  const e = {};
1963
- for (const [t, n] of Object.entries(dn))
1964
- o.getAttribute(n) && (e[t] = o.getAttribute(n));
1977
+ for (const [t, o] of Object.entries(pn))
1978
+ n.getAttribute(o) && (e[t] = n.getAttribute(o));
1965
1979
  return e;
1966
1980
  }
1967
1981
  },
@@ -1972,25 +1986,25 @@ const de = () => {
1972
1986
  }
1973
1987
  ];
1974
1988
  },
1975
- renderHTML({ HTMLAttributes: o }) {
1989
+ renderHTML({ HTMLAttributes: n }) {
1976
1990
  var s;
1977
1991
  const e = document.createElement("div");
1978
1992
  e.className = "bn-block-outer", e.setAttribute("data-node-type", "blockOuter");
1979
- for (const [r, a] of Object.entries(o))
1993
+ for (const [r, a] of Object.entries(n))
1980
1994
  r !== "class" && e.setAttribute(r, a);
1981
1995
  const t = {
1982
1996
  ...((s = this.options.domAttributes) == null ? void 0 : s.block) || {},
1983
- ...o
1984
- }, n = document.createElement("div");
1985
- n.className = Q("bn-block", t.class), n.setAttribute("data-node-type", this.name);
1997
+ ...n
1998
+ }, o = document.createElement("div");
1999
+ o.className = Z("bn-block", t.class), o.setAttribute("data-node-type", this.name);
1986
2000
  for (const [r, a] of Object.entries(t))
1987
- r !== "class" && n.setAttribute(r, a);
1988
- return e.appendChild(n), {
2001
+ r !== "class" && o.setAttribute(r, a);
2002
+ return e.appendChild(o), {
1989
2003
  dom: e,
1990
- contentDOM: n
2004
+ contentDOM: o
1991
2005
  };
1992
2006
  }
1993
- }), pn = D.create({
2007
+ }), hn = D.create({
1994
2008
  name: "blockGroup",
1995
2009
  group: "childContainer",
1996
2010
  content: "blockGroupChild+",
@@ -1999,17 +2013,17 @@ const de = () => {
1999
2013
  return [
2000
2014
  {
2001
2015
  tag: "div",
2002
- getAttrs: (o) => typeof o == "string" ? !1 : o.getAttribute("data-node-type") === "blockGroup" ? null : !1
2016
+ getAttrs: (n) => typeof n == "string" ? !1 : n.getAttribute("data-node-type") === "blockGroup" ? null : !1
2003
2017
  }
2004
2018
  ];
2005
2019
  },
2006
- renderHTML({ HTMLAttributes: o }) {
2007
- var n;
2020
+ renderHTML({ HTMLAttributes: n }) {
2021
+ var o;
2008
2022
  const e = {
2009
- ...((n = this.options.domAttributes) == null ? void 0 : n.blockGroup) || {},
2010
- ...o
2023
+ ...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
2024
+ ...n
2011
2025
  }, t = document.createElement("div");
2012
- t.className = Q(
2026
+ t.className = Z(
2013
2027
  "bn-block-group",
2014
2028
  e.class
2015
2029
  ), t.setAttribute("data-node-type", "blockGroup");
@@ -2020,117 +2034,117 @@ const de = () => {
2020
2034
  contentDOM: t
2021
2035
  };
2022
2036
  }
2023
- }), fn = D.create({
2037
+ }), mn = D.create({
2024
2038
  name: "doc",
2025
2039
  topNode: !0,
2026
2040
  content: "blockGroup",
2027
2041
  marks: "insertion modification deletion"
2028
- }), hn = Ot(
2029
- ({ options: o }) => ({
2042
+ }), kn = $t(
2043
+ ({ options: n }) => ({
2030
2044
  key: "collaboration",
2031
2045
  blockNoteExtensions: [
2032
- it(o),
2033
- ct(o),
2034
- lt(o),
2035
- dt(),
2036
- ut(o)
2046
+ ct(n),
2047
+ lt(n),
2048
+ dt(n),
2049
+ ut(),
2050
+ pt(n)
2037
2051
  ]
2038
2052
  })
2039
2053
  );
2040
2054
  let fe = !1;
2041
- function mn(o, e) {
2055
+ function bn(n, e) {
2042
2056
  const t = [
2043
2057
  I.ClipboardTextSerializer,
2044
2058
  I.Commands,
2045
2059
  I.Editable,
2046
2060
  I.FocusEvents,
2047
2061
  I.Tabindex,
2048
- $t,
2062
+ Vt,
2049
2063
  me.configure({
2050
2064
  // everything from bnBlock group (nodes that represent a BlockNote block should have an id)
2051
2065
  types: ["blockContainer", "columnList", "column"],
2052
2066
  setIdAttribute: e.setIdAttribute
2053
2067
  }),
2054
- en,
2055
- Vt,
2068
+ on,
2069
+ zt,
2056
2070
  // marks:
2057
- sn,
2058
- rn,
2059
2071
  an,
2060
- Ht.extend({
2072
+ cn,
2073
+ ln,
2074
+ Ut.extend({
2061
2075
  inclusive: !1
2062
2076
  }).configure({
2063
- defaultProtocol: Ct,
2077
+ defaultProtocol: Et,
2064
2078
  // only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
2065
- protocols: fe ? [] : Bt
2079
+ protocols: fe ? [] : Ct
2066
2080
  }),
2067
- ...Object.values(o.schema.styleSpecs).map((n) => n.implementation.mark.configure({
2068
- editor: o
2081
+ ...Object.values(n.schema.styleSpecs).map((o) => o.implementation.mark.configure({
2082
+ editor: n
2069
2083
  })),
2070
- ln,
2071
- Zo,
2072
- cn,
2084
+ un,
2085
+ tn,
2086
+ dn,
2073
2087
  // make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
2074
- E.create({
2088
+ x.create({
2075
2089
  name: "OverrideEscape",
2076
2090
  addKeyboardShortcuts: () => ({
2077
2091
  Escape: () => {
2078
- var n;
2079
- return (n = o.getExtension(ge)) != null && n.shown() ? !1 : (o.blur(), !0);
2092
+ var o;
2093
+ return (o = n.getExtension(be)) != null && o.shown() ? !1 : (n.blur(), !0);
2080
2094
  }
2081
2095
  })
2082
2096
  }),
2083
2097
  // nodes
2084
- fn,
2085
- un.configure({
2086
- editor: o,
2098
+ mn,
2099
+ fn.configure({
2100
+ editor: n,
2087
2101
  domAttributes: e.domAttributes
2088
2102
  }),
2089
- nn.configure({
2090
- editor: o,
2103
+ rn.configure({
2104
+ editor: n,
2091
2105
  tabBehavior: e.tabBehavior
2092
2106
  }),
2093
- pn.configure({
2107
+ hn.configure({
2094
2108
  domAttributes: e.domAttributes
2095
2109
  }),
2096
- ...Object.values(o.schema.inlineContentSpecs).filter((n) => n.config !== "link" && n.config !== "text").map((n) => n.implementation.node.configure({
2097
- editor: o
2110
+ ...Object.values(n.schema.inlineContentSpecs).filter((o) => o.config !== "link" && o.config !== "text").map((o) => o.implementation.node.configure({
2111
+ editor: n
2098
2112
  })),
2099
- ...Object.values(o.schema.blockSpecs).flatMap((n) => [
2113
+ ...Object.values(n.schema.blockSpecs).flatMap((o) => [
2100
2114
  // the node extension implementations
2101
- ..."node" in n.implementation ? [
2102
- n.implementation.node.configure({
2103
- editor: o,
2115
+ ..."node" in o.implementation ? [
2116
+ o.implementation.node.configure({
2117
+ editor: n,
2104
2118
  domAttributes: e.domAttributes
2105
2119
  })
2106
2120
  ] : []
2107
2121
  ]),
2108
- Xo(o),
2109
- Yo(
2110
- o,
2111
- e.pasteHandler || ((n) => n.defaultPasteHandler())
2122
+ en(n),
2123
+ Xo(
2124
+ n,
2125
+ e.pasteHandler || ((o) => o.defaultPasteHandler())
2112
2126
  ),
2113
- Do(o)
2127
+ No(n)
2114
2128
  ];
2115
2129
  return fe = !0, t;
2116
2130
  }
2117
- function kn(o, e) {
2131
+ function gn(n, e) {
2118
2132
  const t = [
2119
2133
  ye(),
2120
- pt(e),
2121
- G(e),
2122
- R(e),
2123
2134
  ft(e),
2124
- ht(),
2125
- mt(e),
2126
- Ut(e),
2135
+ j(e),
2136
+ W(e),
2137
+ ht(e),
2138
+ mt(),
2127
2139
  kt(e),
2128
- ge(e),
2140
+ Gt(e),
2141
+ bt(e),
2142
+ be(e),
2129
2143
  ...e.trailingBlock !== !1 ? [gt()] : []
2130
2144
  ];
2131
- return e.collaboration ? t.push(hn(e.collaboration)) : t.push(bt()), "table" in o.schema.blockSpecs && t.push(yt(e)), e.animations !== !1 && t.push(St()), t;
2145
+ return e.collaboration ? t.push(kn(e.collaboration)) : t.push(yt()), "table" in n.schema.blockSpecs && t.push(St(e)), e.animations !== !1 && t.push(Bt()), t;
2132
2146
  }
2133
- class gn {
2147
+ class yn {
2134
2148
  constructor(e, t) {
2135
2149
  /**
2136
2150
  * A set of extension keys which are disabled by the options
@@ -2154,27 +2168,27 @@ class gn {
2154
2168
  */
2155
2169
  h(this, "extensionPlugins", /* @__PURE__ */ new Map());
2156
2170
  this.editor = e, this.options = t, e.onMount(() => {
2157
- for (const n of this.extensions)
2158
- if (n.mount) {
2159
- const s = new window.AbortController(), r = n.mount({
2171
+ for (const o of this.extensions)
2172
+ if (o.mount) {
2173
+ const s = new window.AbortController(), r = o.mount({
2160
2174
  dom: e.prosemirrorView.dom,
2161
2175
  root: e.prosemirrorView.root,
2162
2176
  signal: s.signal
2163
2177
  });
2164
2178
  r && s.signal.addEventListener("abort", () => {
2165
2179
  r();
2166
- }), this.abortMap.set(n, s);
2180
+ }), this.abortMap.set(o, s);
2167
2181
  }
2168
2182
  }), e.onUnmount(() => {
2169
- for (const [n, s] of this.abortMap.entries())
2170
- this.abortMap.delete(n), s.abort();
2183
+ for (const [o, s] of this.abortMap.entries())
2184
+ this.abortMap.delete(o), s.abort();
2171
2185
  }), this.disabledExtensions = new Set(t.disableExtensions || []);
2172
- for (const n of kn(this.editor, this.options))
2173
- this.addExtension(n);
2174
- for (const n of this.options.extensions ?? [])
2175
- this.addExtension(n);
2176
- for (const n of Object.values(this.editor.schema.blockSpecs))
2177
- for (const s of n.extensions ?? [])
2186
+ for (const o of gn(this.editor, this.options))
2187
+ this.addExtension(o);
2188
+ for (const o of this.options.extensions ?? [])
2189
+ this.addExtension(o);
2190
+ for (const o of Object.values(this.editor.schema.blockSpecs))
2191
+ for (const s of o.extensions ?? [])
2178
2192
  this.addExtension(s);
2179
2193
  }
2180
2194
  /**
@@ -2189,8 +2203,8 @@ class gn {
2189
2203
  console.warn("No extensions found to register", e);
2190
2204
  return;
2191
2205
  }
2192
- const n = t.map((a) => this.addExtension(a)).filter(Boolean), s = /* @__PURE__ */ new Set();
2193
- for (const a of n)
2206
+ const o = t.map((a) => this.addExtension(a)).filter(Boolean), s = /* @__PURE__ */ new Set();
2207
+ for (const a of o)
2194
2208
  a != null && a.tiptapExtensions && console.warn(
2195
2209
  `Extension ${a.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,
2196
2210
  a
@@ -2213,12 +2227,12 @@ class gn {
2213
2227
  let t;
2214
2228
  if (typeof e == "function" ? t = e({ editor: this.editor }) : t = e, !(!t || this.disabledExtensions.has(t.key))) {
2215
2229
  if (typeof e == "function") {
2216
- const n = t[Ft];
2217
- typeof n == "function" && this.extensionFactories.set(n, t);
2230
+ const o = t[Ht];
2231
+ typeof o == "function" && this.extensionFactories.set(o, t);
2218
2232
  }
2219
2233
  if (this.extensions.push(t), t.blockNoteExtensions)
2220
- for (const n of t.blockNoteExtensions)
2221
- this.addExtension(n);
2234
+ for (const o of t.blockNoteExtensions)
2235
+ this.addExtension(o);
2222
2236
  return t;
2223
2237
  }
2224
2238
  }
@@ -2230,16 +2244,16 @@ class gn {
2230
2244
  resolveExtensions(e) {
2231
2245
  const t = [];
2232
2246
  if (typeof e == "function") {
2233
- const n = this.extensionFactories.get(e);
2234
- n && t.push(n);
2247
+ const o = this.extensionFactories.get(e);
2248
+ o && t.push(o);
2235
2249
  } else if (Array.isArray(e))
2236
- for (const n of e)
2237
- t.push(...this.resolveExtensions(n));
2250
+ for (const o of e)
2251
+ t.push(...this.resolveExtensions(o));
2238
2252
  else if (typeof e == "object" && "key" in e)
2239
2253
  t.push(e);
2240
2254
  else if (typeof e == "string") {
2241
- const n = this.extensions.find((s) => s.key === e);
2242
- n && t.push(n);
2255
+ const o = this.extensions.find((s) => s.key === e);
2256
+ o && t.push(o);
2243
2257
  }
2244
2258
  return t;
2245
2259
  }
@@ -2255,7 +2269,7 @@ class gn {
2255
2269
  console.warn("No extensions found to unregister", e);
2256
2270
  return;
2257
2271
  }
2258
- let n = !1;
2272
+ let o = !1;
2259
2273
  const s = /* @__PURE__ */ new Set();
2260
2274
  for (const a of t) {
2261
2275
  this.extensions = this.extensions.filter((i) => i !== a), this.extensionFactories.forEach((i, l) => {
@@ -2264,7 +2278,7 @@ class gn {
2264
2278
  const c = this.extensionPlugins.get(a);
2265
2279
  c == null || c.forEach((i) => {
2266
2280
  s.add(i);
2267
- }), this.extensionPlugins.delete(a), a.tiptapExtensions && !n && (n = !0, console.warn(
2281
+ }), this.extensionPlugins.delete(a), a.tiptapExtensions && !o && (o = !0, console.warn(
2268
2282
  `Extension ${a.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,
2269
2283
  e
2270
2284
  ));
@@ -2279,39 +2293,39 @@ class gn {
2279
2293
  * @returns void
2280
2294
  */
2281
2295
  updatePlugins(e) {
2282
- const t = this.editor.prosemirrorState, n = t.reconfigure({
2296
+ const t = this.editor.prosemirrorState, o = t.reconfigure({
2283
2297
  plugins: e(t.plugins.slice())
2284
2298
  });
2285
- this.editor.prosemirrorView.updateState(n);
2299
+ this.editor.prosemirrorView.updateState(o);
2286
2300
  }
2287
2301
  /**
2288
2302
  * Get all the extensions that are registered to the editor
2289
2303
  */
2290
2304
  getTiptapExtensions() {
2291
2305
  var s;
2292
- const e = mn(
2306
+ const e = bn(
2293
2307
  this.editor,
2294
2308
  this.options
2295
- ).filter((r) => !this.disabledExtensions.has(r.name)), t = xt(this.extensions), n = /* @__PURE__ */ new Map();
2309
+ ).filter((r) => !this.disabledExtensions.has(r.name)), t = xt(this.extensions), o = /* @__PURE__ */ new Map();
2296
2310
  for (const r of this.extensions) {
2297
2311
  r.tiptapExtensions && e.push(...r.tiptapExtensions);
2298
2312
  const a = t(r.key), { plugins: c, inputRules: i } = this.getProsemirrorPluginsFromExtension(r);
2299
2313
  c.length && e.push(
2300
- E.create({
2314
+ x.create({
2301
2315
  name: r.key,
2302
2316
  priority: a,
2303
2317
  addProseMirrorPlugins: () => c
2304
2318
  })
2305
- ), i.length && (n.has(a) || n.set(a, []), n.get(a).push(...i));
2319
+ ), i.length && (o.has(a) || o.set(a, []), o.get(a).push(...i));
2306
2320
  }
2307
2321
  e.push(
2308
- E.create({
2322
+ x.create({
2309
2323
  name: "blocknote-input-rules",
2310
2324
  addProseMirrorPlugins() {
2311
2325
  const r = [];
2312
- return Array.from(n.keys()).sort().reverse().forEach((a) => {
2313
- r.push(...n.get(a));
2314
- }), [Dt({ rules: r })];
2326
+ return Array.from(o.keys()).sort().reverse().forEach((a) => {
2327
+ r.push(...o.get(a));
2328
+ }), [Nt({ rules: r })];
2315
2329
  }
2316
2330
  })
2317
2331
  );
@@ -2327,9 +2341,9 @@ class gn {
2327
2341
  */
2328
2342
  getProsemirrorPluginsFromExtension(e) {
2329
2343
  var s, r, a;
2330
- const t = [...e.prosemirrorPlugins ?? []], n = [];
2331
- return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules: n } : (this.extensionPlugins.set(e, t), (a = e.inputRules) != null && a.length && n.push(
2332
- ...e.inputRules.map((c) => new Lt(c.find, (i, l, d, u) => {
2344
+ const t = [...e.prosemirrorPlugins ?? []], o = [];
2345
+ return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules: o } : (this.extensionPlugins.set(e, t), (a = e.inputRules) != null && a.length && o.push(
2346
+ ...e.inputRules.map((c) => new Ot(c.find, (i, l, d, u) => {
2333
2347
  const p = c.replace({
2334
2348
  match: l,
2335
2349
  range: { from: d, to: u },
@@ -2340,12 +2354,12 @@ class gn {
2340
2354
  if (this.editor.schema.blockSchema[m.block.type].content !== "inline")
2341
2355
  return null;
2342
2356
  const f = $(i.tr), k = i.tr.deleteRange(d, u);
2343
- return ot(k, f.bnBlock.beforePos, p), k;
2357
+ return nt(k, f.bnBlock.beforePos, p), k;
2344
2358
  }
2345
2359
  return null;
2346
2360
  }))
2347
2361
  ), Object.keys(e.keyboardShortcuts || {}).length && t.push(
2348
- Nt(
2362
+ Ft(
2349
2363
  Object.fromEntries(
2350
2364
  Object.entries(e.keyboardShortcuts).map(([c, i]) => [
2351
2365
  c,
@@ -2353,7 +2367,7 @@ class gn {
2353
2367
  ])
2354
2368
  )
2355
2369
  )
2356
- ), { plugins: t, inputRules: n });
2370
+ ), { plugins: t, inputRules: o });
2357
2371
  }
2358
2372
  /**
2359
2373
  * Get all extensions
@@ -2365,7 +2379,7 @@ class gn {
2365
2379
  }
2366
2380
  getExtension(e) {
2367
2381
  if (typeof e == "string") {
2368
- const t = this.extensions.find((n) => n.key === e);
2382
+ const t = this.extensions.find((o) => o.key === e);
2369
2383
  return t || void 0;
2370
2384
  } else if (typeof e == "function") {
2371
2385
  const t = this.extensionFactories.get(e);
@@ -2380,42 +2394,42 @@ class gn {
2380
2394
  return typeof e == "string" ? this.extensions.some((t) => t.key === e) : typeof e == "object" && "key" in e ? this.extensions.some((t) => t.key === e.key) : typeof e == "function" ? this.extensionFactories.has(e) : !1;
2381
2395
  }
2382
2396
  }
2383
- function bn(o, e) {
2384
- let { $from: t, $to: n } = e;
2385
- if (t.pos > t.start() && t.pos < o.content.size) {
2386
- const s = o.textBetween(t.pos, t.pos + 1);
2397
+ function Sn(n, e) {
2398
+ let { $from: t, $to: o } = e;
2399
+ if (t.pos > t.start() && t.pos < n.content.size) {
2400
+ const s = n.textBetween(t.pos, t.pos + 1);
2387
2401
  if (/^[\w\p{P}]$/u.test(s)) {
2388
- const a = o.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
2389
- a && (t = o.resolve(t.pos - a[0].length));
2402
+ const a = n.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
2403
+ a && (t = n.resolve(t.pos - a[0].length));
2390
2404
  }
2391
2405
  }
2392
- if (n.pos < n.end() && n.pos > 0) {
2393
- const s = o.textBetween(n.pos - 1, n.pos);
2406
+ if (o.pos < o.end() && o.pos > 0) {
2407
+ const s = n.textBetween(o.pos - 1, o.pos);
2394
2408
  if (/^[\w\p{P}]$/u.test(s)) {
2395
- const a = o.textBetween(n.pos, n.end()).match(/^[\w\p{P}]+/u);
2396
- a && (n = o.resolve(n.pos + a[0].length));
2409
+ const a = n.textBetween(o.pos, o.end()).match(/^[\w\p{P}]+/u);
2410
+ a && (o = n.resolve(o.pos + a[0].length));
2397
2411
  }
2398
2412
  }
2399
- return { $from: t, $to: n, from: t.pos, to: n.pos };
2413
+ return { $from: t, $to: o, from: t.pos, to: o.pos };
2400
2414
  }
2401
- function yn(o) {
2402
- const e = C(o);
2403
- if (o.selection.empty || "node" in o.selection)
2415
+ function Bn(n) {
2416
+ const e = C(n);
2417
+ if (n.selection.empty || "node" in n.selection)
2404
2418
  return;
2405
- const t = o.doc.resolve(
2406
- _(o.doc, o.selection.from).posBeforeNode
2407
- ), n = o.doc.resolve(
2408
- _(o.doc, o.selection.to).posBeforeNode
2419
+ const t = n.doc.resolve(
2420
+ _(n.doc, n.selection.from).posBeforeNode
2421
+ ), o = n.doc.resolve(
2422
+ _(n.doc, n.selection.to).posBeforeNode
2409
2423
  ), s = (l, d) => {
2410
- const u = t.posAtIndex(l, d), p = o.doc.resolve(u).nodeAfter;
2424
+ const u = t.posAtIndex(l, d), p = n.doc.resolve(u).nodeAfter;
2411
2425
  if (!p)
2412
2426
  throw new Error(
2413
2427
  `Error getting selection - node not found at position ${u}`
2414
2428
  );
2415
- return b(p, e);
2416
- }, r = [], a = t.sharedDepth(n.pos), c = t.index(a), i = n.index(a);
2429
+ return S(p, e);
2430
+ }, r = [], a = t.sharedDepth(o.pos), c = t.index(a), i = o.index(a);
2417
2431
  if (t.depth > a) {
2418
- r.push(b(t.nodeAfter, e));
2432
+ r.push(S(t.nodeAfter, e));
2419
2433
  for (let l = t.depth; l > a; l--)
2420
2434
  if (t.node(l).type.isInGroup("childContainer")) {
2421
2435
  const u = t.index(l) + 1, p = t.node(l).childCount;
@@ -2428,28 +2442,28 @@ function yn(o) {
2428
2442
  r.push(s(l, a));
2429
2443
  if (r.length === 0)
2430
2444
  throw new Error(
2431
- `Error getting selection - selection doesn't span any blocks (${o.selection})`
2445
+ `Error getting selection - selection doesn't span any blocks (${n.selection})`
2432
2446
  );
2433
2447
  return {
2434
2448
  blocks: r
2435
2449
  };
2436
2450
  }
2437
- function Sn(o, e, t) {
2438
- const n = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r = C(o), a = ke(r);
2439
- if (n === s)
2451
+ function Cn(n, e, t) {
2452
+ const o = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r = C(n), a = ke(r);
2453
+ if (o === s)
2440
2454
  throw new Error(
2441
- `Attempting to set selection with the same anchor and head blocks (id ${n})`
2455
+ `Attempting to set selection with the same anchor and head blocks (id ${o})`
2442
2456
  );
2443
- const c = x(n, o.doc);
2457
+ const c = E(o, n.doc);
2444
2458
  if (!c)
2445
- throw new Error(`Block with ID ${n} not found`);
2446
- const i = x(s, o.doc);
2459
+ throw new Error(`Block with ID ${o} not found`);
2460
+ const i = E(s, n.doc);
2447
2461
  if (!i)
2448
2462
  throw new Error(`Block with ID ${s} not found`);
2449
- const l = z(c), d = z(i), u = a.blockSchema[l.blockNoteType], p = a.blockSchema[d.blockNoteType];
2463
+ const l = R(c), d = R(i), u = a.blockSchema[l.blockNoteType], p = a.blockSchema[d.blockNoteType];
2450
2464
  if (!l.isBlockContainer || u.content === "none")
2451
2465
  throw new Error(
2452
- `Attempting to set selection anchor in block without content (id ${n})`
2466
+ `Attempting to set selection anchor in block without content (id ${o})`
2453
2467
  );
2454
2468
  if (!d.isBlockContainer || p.content === "none")
2455
2469
  throw new Error(
@@ -2462,29 +2476,29 @@ function Sn(o, e, t) {
2462
2476
  } else
2463
2477
  m = l.blockContent.beforePos + 1;
2464
2478
  if (p.content === "table") {
2465
- const k = se.get(d.blockContent.node), g = d.blockContent.beforePos + k.positionAt(
2479
+ const k = se.get(d.blockContent.node), b = d.blockContent.beforePos + k.positionAt(
2466
2480
  k.height - 1,
2467
2481
  k.width - 1,
2468
2482
  d.blockContent.node
2469
- ) + 1, y = o.doc.resolve(g).nodeAfter.nodeSize;
2470
- f = g + y - 2;
2483
+ ) + 1, g = n.doc.resolve(b).nodeAfter.nodeSize;
2484
+ f = b + g - 2;
2471
2485
  } else
2472
2486
  f = d.blockContent.afterPos - 1;
2473
- o.setSelection(w.create(o.doc, m, f));
2487
+ n.setSelection(M.create(n.doc, m, f));
2474
2488
  }
2475
- function Bn(o, e = !1) {
2476
- const t = C(o), n = e ? bn(o.doc, o.selection) : o.selection;
2477
- let s = n.$from, r = n.$to;
2489
+ function En(n, e = !1) {
2490
+ const t = C(n), o = e ? Sn(n.doc, n.selection) : n.selection;
2491
+ let s = o.$from, r = o.$to;
2478
2492
  for (; r.parentOffset >= r.parent.nodeSize - 2 && r.depth > 0; )
2479
- r = o.doc.resolve(r.pos + 1);
2493
+ r = n.doc.resolve(r.pos + 1);
2480
2494
  for (; r.parentOffset === 0 && r.depth > 0; )
2481
- r = o.doc.resolve(r.pos - 1);
2495
+ r = n.doc.resolve(r.pos - 1);
2482
2496
  for (; s.parentOffset === 0 && s.depth > 0; )
2483
- s = o.doc.resolve(s.pos - 1);
2497
+ s = n.doc.resolve(s.pos - 1);
2484
2498
  for (; s.parentOffset >= s.parent.nodeSize - 2 && s.depth > 0; )
2485
- s = o.doc.resolve(s.pos + 1);
2486
- const a = je(
2487
- o.doc.slice(s.pos, r.pos, !0),
2499
+ s = n.doc.resolve(s.pos + 1);
2500
+ const a = We(
2501
+ n.doc.slice(s.pos, r.pos, !0),
2488
2502
  t
2489
2503
  );
2490
2504
  return {
@@ -2495,47 +2509,47 @@ function Bn(o, e = !1) {
2495
2509
  ...a
2496
2510
  };
2497
2511
  }
2498
- function Cn(o) {
2499
- const { bnBlock: e } = $(o), t = C(o.doc), n = o.doc.resolve(e.beforePos), s = n.nodeBefore, r = o.doc.resolve(e.afterPos).nodeAfter;
2512
+ function xn(n) {
2513
+ const { bnBlock: e } = $(n), t = C(n.doc), o = n.doc.resolve(e.beforePos), s = o.nodeBefore, r = n.doc.resolve(e.afterPos).nodeAfter;
2500
2514
  let a;
2501
- return n.depth > 1 && (a = n.node(), a.type.isInGroup("bnBlock") || (a = n.node(n.depth - 1))), {
2502
- block: b(e.node, t),
2503
- prevBlock: s === null ? void 0 : b(s, t),
2504
- nextBlock: r === null ? void 0 : b(r, t),
2505
- parentBlock: a === void 0 ? void 0 : b(a, t)
2515
+ return o.depth > 1 && (a = o.node(), a.type.isInGroup("bnBlock") || (a = o.node(o.depth - 1))), {
2516
+ block: S(e.node, t),
2517
+ prevBlock: s === null ? void 0 : S(s, t),
2518
+ nextBlock: r === null ? void 0 : S(r, t),
2519
+ parentBlock: a === void 0 ? void 0 : S(a, t)
2506
2520
  };
2507
2521
  }
2508
- function De(o, e, t = "start") {
2509
- const n = typeof e == "string" ? e : e.id, s = C(o.doc), r = ke(s), a = x(n, o.doc);
2522
+ function De(n, e, t = "start") {
2523
+ const o = typeof e == "string" ? e : e.id, s = C(n.doc), r = ke(s), a = E(o, n.doc);
2510
2524
  if (!a)
2511
- throw new Error(`Block with ID ${n} not found`);
2512
- const c = z(a), i = r.blockSchema[c.blockNoteType].content;
2525
+ throw new Error(`Block with ID ${o} not found`);
2526
+ const c = R(a), i = r.blockSchema[c.blockNoteType].content;
2513
2527
  if (c.isBlockContainer) {
2514
2528
  const l = c.blockContent;
2515
2529
  if (i === "none") {
2516
- o.setSelection(L.create(o.doc, l.beforePos));
2530
+ n.setSelection(L.create(n.doc, l.beforePos));
2517
2531
  return;
2518
2532
  }
2519
2533
  if (i === "inline")
2520
- t === "start" ? o.setSelection(
2521
- w.create(o.doc, l.beforePos + 1)
2522
- ) : o.setSelection(
2523
- w.create(o.doc, l.afterPos - 1)
2534
+ t === "start" ? n.setSelection(
2535
+ M.create(n.doc, l.beforePos + 1)
2536
+ ) : n.setSelection(
2537
+ M.create(n.doc, l.afterPos - 1)
2524
2538
  );
2525
2539
  else if (i === "table")
2526
- t === "start" ? o.setSelection(
2527
- w.create(o.doc, l.beforePos + 4)
2528
- ) : o.setSelection(
2529
- w.create(o.doc, l.afterPos - 4)
2540
+ t === "start" ? n.setSelection(
2541
+ M.create(n.doc, l.beforePos + 4)
2542
+ ) : n.setSelection(
2543
+ M.create(n.doc, l.afterPos - 4)
2530
2544
  );
2531
2545
  else
2532
2546
  throw new F(i);
2533
2547
  } else {
2534
2548
  const l = t === "start" ? c.childContainer.node.firstChild : c.childContainer.node.lastChild;
2535
- De(o, l.attrs.id, t);
2549
+ De(n, l.attrs.id, t);
2536
2550
  }
2537
2551
  }
2538
- class xn {
2552
+ class Mn {
2539
2553
  constructor(e) {
2540
2554
  this.editor = e;
2541
2555
  }
@@ -2546,7 +2560,7 @@ class xn {
2546
2560
  * If the selection starts / ends halfway through a block, the returned data will contain the entire block.
2547
2561
  */
2548
2562
  getSelection() {
2549
- return this.editor.transact((e) => yn(e));
2563
+ return this.editor.transact((e) => Bn(e));
2550
2564
  }
2551
2565
  /**
2552
2566
  * Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
@@ -2556,7 +2570,7 @@ class xn {
2556
2570
  * only the part of the block that is included in the selection.
2557
2571
  */
2558
2572
  getSelectionCutBlocks(e = !1) {
2559
- return this.editor.transact((t) => Bn(t, e));
2573
+ return this.editor.transact((t) => En(t, e));
2560
2574
  }
2561
2575
  /**
2562
2576
  * Sets the selection to a range of blocks.
@@ -2564,14 +2578,14 @@ class xn {
2564
2578
  * @param endBlock The identifier of the block that should be the end of the selection.
2565
2579
  */
2566
2580
  setSelection(e, t) {
2567
- return this.editor.transact((n) => Sn(n, e, t));
2581
+ return this.editor.transact((o) => Cn(o, e, t));
2568
2582
  }
2569
2583
  /**
2570
2584
  * Gets a snapshot of the current text cursor position.
2571
2585
  * @returns A snapshot of the current text cursor position.
2572
2586
  */
2573
2587
  getTextCursorPosition() {
2574
- return this.editor.transact((e) => Cn(e));
2588
+ return this.editor.transact((e) => xn(e));
2575
2589
  }
2576
2590
  /**
2577
2591
  * Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could
@@ -2581,7 +2595,7 @@ class xn {
2581
2595
  */
2582
2596
  setTextCursorPosition(e, t = "start") {
2583
2597
  return this.editor.transact(
2584
- (n) => De(n, e, t)
2598
+ (o) => De(o, e, t)
2585
2599
  );
2586
2600
  }
2587
2601
  /**
@@ -2590,20 +2604,20 @@ class xn {
2590
2604
  getSelectionBoundingBox() {
2591
2605
  if (!this.editor.prosemirrorView)
2592
2606
  return;
2593
- const { selection: e } = this.editor.prosemirrorState, { ranges: t } = e, n = Math.min(...t.map((r) => r.$from.pos)), s = Math.max(...t.map((r) => r.$to.pos));
2594
- if (Mt(e)) {
2595
- const r = this.editor.prosemirrorView.nodeDOM(n);
2607
+ const { selection: e } = this.editor.prosemirrorState, { ranges: t } = e, o = Math.min(...t.map((r) => r.$from.pos)), s = Math.max(...t.map((r) => r.$to.pos));
2608
+ if (Tt(e)) {
2609
+ const r = this.editor.prosemirrorView.nodeDOM(o);
2596
2610
  if (r)
2597
2611
  return r.getBoundingClientRect();
2598
2612
  }
2599
- return Tt(
2613
+ return Pt(
2600
2614
  this.editor.prosemirrorView,
2601
- n,
2615
+ o,
2602
2616
  s
2603
2617
  ).toJSON();
2604
2618
  }
2605
2619
  }
2606
- class En {
2620
+ class wn {
2607
2621
  constructor(e) {
2608
2622
  /**
2609
2623
  * Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
@@ -2649,8 +2663,8 @@ class En {
2649
2663
  );
2650
2664
  if (this.isInCan)
2651
2665
  return this.canExec(e);
2652
- const t = this.prosemirrorState, n = this.prosemirrorView;
2653
- return e(t, (r) => this.prosemirrorView.dispatch(r), n);
2666
+ const t = this.prosemirrorState, o = this.prosemirrorView;
2667
+ return e(t, (r) => this.prosemirrorView.dispatch(r), o);
2654
2668
  }
2655
2669
  /**
2656
2670
  * Check if a command can be executed. A command should return `false` if it is not valid in the current state.
@@ -2669,8 +2683,8 @@ class En {
2669
2683
  throw new Error(
2670
2684
  "`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call"
2671
2685
  );
2672
- const t = this.prosemirrorState, n = this.prosemirrorView;
2673
- return e(t, void 0, n);
2686
+ const t = this.prosemirrorState, o = this.prosemirrorView;
2687
+ return e(t, void 0, o);
2674
2688
  }
2675
2689
  /**
2676
2690
  * Execute a function within a "blocknote transaction".
@@ -2696,9 +2710,9 @@ class En {
2696
2710
  return e(this.activeTransaction);
2697
2711
  try {
2698
2712
  this.activeTransaction = this.editor._tiptapEditor.state.tr;
2699
- const t = e(this.activeTransaction), n = this.activeTransaction;
2700
- return this.activeTransaction = null, n && // Only dispatch if the transaction was actually modified in some way
2701
- (n.docChanged || n.selectionSet || n.scrolledIntoView || n.storedMarksSet || !n.isGeneric) && this.prosemirrorView.dispatch(n), t;
2713
+ const t = e(this.activeTransaction), o = this.activeTransaction;
2714
+ return this.activeTransaction = null, o && // Only dispatch if the transaction was actually modified in some way
2715
+ (o.docChanged || o.selectionSet || o.scrolledIntoView || o.storedMarksSet || !o.isGeneric) && this.prosemirrorView.dispatch(o), t;
2702
2716
  } finally {
2703
2717
  this.activeTransaction = null;
2704
2718
  }
@@ -2779,17 +2793,17 @@ class En {
2779
2793
  throw new Error("No redo plugin found");
2780
2794
  }
2781
2795
  }
2782
- function wn(o, e, t, n = { updateSelection: !0 }) {
2796
+ function Tn(n, e, t, o = { updateSelection: !0 }) {
2783
2797
  let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, a = !0, c = !0, i = "";
2784
2798
  if (t.forEach((l) => {
2785
2799
  l.check(), a && l.isText && l.marks.length === 0 ? i += l.text : a = !1, c = c ? l.isBlock : !1;
2786
2800
  }), s === r && c) {
2787
- const { parent: l } = o.doc.resolve(s);
2801
+ const { parent: l } = n.doc.resolve(s);
2788
2802
  l.isTextblock && !l.type.spec.code && !l.childCount && (s -= 1, r += 1);
2789
2803
  }
2790
- return a ? o.insertText(i, s, r) : o.replaceWith(s, r, t), n.updateSelection && Pt(o, o.steps.length - 1, -1), !0;
2804
+ return a ? n.insertText(i, s, r) : n.replaceWith(s, r, t), o.updateSelection && vt(n, n.steps.length - 1, -1), !0;
2791
2805
  }
2792
- class Mn {
2806
+ class Pn {
2793
2807
  constructor(e) {
2794
2808
  this.editor = e;
2795
2809
  }
@@ -2799,15 +2813,15 @@ class Mn {
2799
2813
  * @param content can be a string, or array of partial inline content elements
2800
2814
  */
2801
2815
  insertInlineContent(e, { updateSelection: t = !1 } = {}) {
2802
- const n = O(e, this.editor.pmSchema);
2816
+ const o = O(e, this.editor.pmSchema);
2803
2817
  this.editor.transact((s) => {
2804
- wn(
2818
+ Tn(
2805
2819
  s,
2806
2820
  {
2807
2821
  from: s.selection.from,
2808
2822
  to: s.selection.to
2809
2823
  },
2810
- n,
2824
+ o,
2811
2825
  {
2812
2826
  updateSelection: t
2813
2827
  }
@@ -2819,8 +2833,8 @@ class Mn {
2819
2833
  */
2820
2834
  getActiveStyles() {
2821
2835
  return this.editor.transact((e) => {
2822
- const t = {}, n = e.selection.$to.marks();
2823
- for (const s of n) {
2836
+ const t = {}, o = e.selection.$to.marks();
2837
+ for (const s of o) {
2824
2838
  const r = this.editor.schema.styleSchema[s.type.name];
2825
2839
  if (!r) {
2826
2840
  // Links are not considered styles in blocknote
@@ -2838,7 +2852,7 @@ class Mn {
2838
2852
  * @param styles The styles to add.
2839
2853
  */
2840
2854
  addStyles(e) {
2841
- for (const [t, n] of Object.entries(e)) {
2855
+ for (const [t, o] of Object.entries(e)) {
2842
2856
  const s = this.editor.schema.styleSchema[t];
2843
2857
  if (!s)
2844
2858
  throw new Error(`style ${t} not found in styleSchema`);
@@ -2846,7 +2860,7 @@ class Mn {
2846
2860
  this.editor._tiptapEditor.commands.setMark(t);
2847
2861
  else if (s.propSchema === "string")
2848
2862
  this.editor._tiptapEditor.commands.setMark(t, {
2849
- stringValue: n
2863
+ stringValue: o
2850
2864
  });
2851
2865
  else
2852
2866
  throw new F(s.propSchema);
@@ -2865,7 +2879,7 @@ class Mn {
2865
2879
  * @param styles The styles to toggle.
2866
2880
  */
2867
2881
  toggleStyles(e) {
2868
- for (const [t, n] of Object.entries(e)) {
2882
+ for (const [t, o] of Object.entries(e)) {
2869
2883
  const s = this.editor.schema.styleSchema[t];
2870
2884
  if (!s)
2871
2885
  throw new Error(`style ${t} not found in styleSchema`);
@@ -2873,7 +2887,7 @@ class Mn {
2873
2887
  this.editor._tiptapEditor.commands.toggleMark(t);
2874
2888
  else if (s.propSchema === "string")
2875
2889
  this.editor._tiptapEditor.commands.toggleMark(t, {
2876
- stringValue: n
2890
+ stringValue: o
2877
2891
  });
2878
2892
  else
2879
2893
  throw new F(s.propSchema);
@@ -2899,65 +2913,90 @@ class Mn {
2899
2913
  createLink(e, t) {
2900
2914
  if (e === "")
2901
2915
  return;
2902
- const n = this.editor.pmSchema.mark("link", { href: e });
2916
+ const o = this.editor.pmSchema.mark("link", { href: e });
2903
2917
  this.editor.transact((s) => {
2904
2918
  const { from: r, to: a } = s.selection;
2905
- t ? s.insertText(t, r, a).addMark(r, r + t.length, n) : s.setSelection(qt.create(s.doc, a)).addMark(
2919
+ t ? s.insertText(t, r, a).addMark(r, r + t.length, o) : s.setSelection(Jt.create(s.doc, a)).addMark(
2906
2920
  r,
2907
2921
  a,
2908
- n
2922
+ o
2909
2923
  );
2910
2924
  });
2911
2925
  }
2912
2926
  }
2913
- function Tn(o, e) {
2927
+ function vn(n) {
2928
+ return It(n.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
2929
+ }
2930
+ function Le(n, e) {
2931
+ var s;
2932
+ const t = e.nodes.hardBreak;
2933
+ let o = H.empty;
2934
+ return n.forEach((r) => {
2935
+ r.isTextblock && r.childCount > 0 ? (o = o.append(r.content), o = o.addToEnd(t.create())) : r.isText ? o = o.addToEnd(r) : r.isBlock && r.childCount > 0 && (o = o.append(
2936
+ Le(r.content, e)
2937
+ ), o = o.addToEnd(t.create()));
2938
+ }), ((s = o.lastChild) == null ? void 0 : s.type) === t && (o = o.cut(0, o.size - 1)), o;
2939
+ }
2940
+ function In(n, e) {
2914
2941
  const t = [];
2915
- return o.forEach((n, s, r) => {
2916
- r !== e && t.push(n);
2917
- }), Z.from(t);
2942
+ return n.forEach((o, s, r) => {
2943
+ r !== e && t.push(o);
2944
+ }), H.from(t);
2918
2945
  }
2919
- function Pn(o, e) {
2946
+ function An(n, e) {
2920
2947
  const t = [];
2921
- for (let n = 0; n < o.childCount; n++)
2922
- if (o.child(n).type.name === "tableRow")
2948
+ for (let o = 0; o < n.childCount; o++)
2949
+ if (n.child(o).type.name === "tableRow")
2923
2950
  if (t.length > 0 && t[t.length - 1].type.name === "table") {
2924
- const s = t[t.length - 1], r = s.copy(s.content.addToEnd(o.child(n)));
2951
+ const s = t[t.length - 1], r = s.copy(s.content.addToEnd(n.child(o)));
2925
2952
  t[t.length - 1] = r;
2926
2953
  } else {
2927
2954
  const s = e.nodes.table.createChecked(
2928
2955
  void 0,
2929
- o.child(n)
2956
+ n.child(o)
2930
2957
  );
2931
2958
  t.push(s);
2932
2959
  }
2933
2960
  else
2934
- t.push(o.child(n));
2935
- return o = Z.from(t), o;
2936
- }
2937
- function vn(o, e) {
2938
- let t = Z.from(o.content);
2939
- if (t = Pn(t, e.state.schema), !In(t, e))
2940
- return new ne(t, o.openStart, o.openEnd);
2941
- for (let n = 0; n < t.childCount; n++)
2942
- if (t.child(n).type.spec.group === "blockContent") {
2943
- const s = [t.child(n)];
2944
- if (n + 1 < t.childCount && t.child(n + 1).type.name === "blockGroup") {
2945
- const a = t.child(n + 1).child(0).child(0);
2946
- (a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (s.push(t.child(n + 1)), t = Tn(t, n + 1));
2961
+ t.push(n.child(o));
2962
+ return n = H.from(t), n;
2963
+ }
2964
+ function _n(n, e) {
2965
+ let t = H.from(n.content);
2966
+ if (t = An(t, e.state.schema), vn(e)) {
2967
+ let o = !1;
2968
+ if (t.descendants((s) => {
2969
+ s.type.isInGroup("tableContent") && (o = !0);
2970
+ }), !o && // is the content valid for a table paragraph?
2971
+ !e.state.schema.nodes.tableParagraph.validContent(t))
2972
+ return new U(
2973
+ Le(t, e.state.schema),
2974
+ 0,
2975
+ 0
2976
+ );
2977
+ }
2978
+ if (!Dn(t, e))
2979
+ return new U(t, n.openStart, n.openEnd);
2980
+ for (let o = 0; o < t.childCount; o++)
2981
+ if (t.child(o).type.spec.group === "blockContent") {
2982
+ const s = [t.child(o)];
2983
+ if (o + 1 < t.childCount && t.child(o + 1).type.name === "blockGroup") {
2984
+ const a = t.child(o + 1).child(0).child(0);
2985
+ (a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (s.push(t.child(o + 1)), t = In(t, o + 1));
2947
2986
  }
2948
2987
  const r = e.state.schema.nodes.blockContainer.createChecked(
2949
2988
  void 0,
2950
2989
  s
2951
2990
  );
2952
- t = t.replaceChild(n, r);
2991
+ t = t.replaceChild(o, r);
2953
2992
  }
2954
- return new ne(t, o.openStart, o.openEnd);
2993
+ return new U(t, n.openStart, n.openEnd);
2955
2994
  }
2956
- function In(o, e) {
2995
+ function Dn(n, e) {
2957
2996
  var r, a;
2958
- const t = o.childCount === 1, n = ((r = o.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((a = o.firstChild) == null ? void 0 : a.type.spec.content) === "tableRow+";
2997
+ const t = n.childCount === 1, o = ((r = n.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((a = n.firstChild) == null ? void 0 : a.type.spec.content) === "tableRow+";
2959
2998
  if (t) {
2960
- if (n)
2999
+ if (o)
2961
3000
  return !1;
2962
3001
  if (s) {
2963
3002
  const c = B(e.state);
@@ -2967,14 +3006,14 @@ function In(o, e) {
2967
3006
  }
2968
3007
  return !0;
2969
3008
  }
2970
- const An = {
3009
+ const Ln = {
2971
3010
  enableInputRules: !0,
2972
3011
  enablePasteRules: !0,
2973
3012
  enableCoreExtensions: !1
2974
3013
  };
2975
- class Le extends Se {
3014
+ class Ne extends Se {
2976
3015
  constructor(t) {
2977
- var l, d, u, p, m, f, k, g, y, T;
3016
+ var l, d, u, p, m, f, k, b, g, w;
2978
3017
  super();
2979
3018
  /**
2980
3019
  * The underlying prosemirror schema
@@ -3054,7 +3093,7 @@ class Le extends Se {
3054
3093
  h(this, "unmount", () => {
3055
3094
  this._tiptapEditor.unmount();
3056
3095
  });
3057
- this.options = t, this.dictionary = t.dictionary || _t, this.settings = {
3096
+ this.options = t, this.dictionary = t.dictionary || Lt, this.settings = {
3058
3097
  tables: {
3059
3098
  splitCells: ((l = t == null ? void 0 : t.tables) == null ? void 0 : l.splitCells) ?? !1,
3060
3099
  cellBackgroundColor: ((d = t == null ? void 0 : t.tables) == null ? void 0 : d.cellBackgroundColor) ?? !1,
@@ -3062,61 +3101,61 @@ class Le extends Se {
3062
3101
  headers: ((p = t == null ? void 0 : t.tables) == null ? void 0 : p.headers) ?? !1
3063
3102
  }
3064
3103
  };
3065
- const n = {
3104
+ const o = {
3066
3105
  defaultStyles: !0,
3067
- schema: t.schema || Et.create(),
3106
+ schema: t.schema || Mt.create(),
3068
3107
  ...t,
3069
3108
  placeholders: {
3070
3109
  ...this.dictionary.placeholders,
3071
3110
  ...t.placeholders
3072
3111
  }
3073
3112
  };
3074
- if (this.schema = n.schema, this.blockImplementations = n.schema.blockSpecs, this.inlineContentImplementations = n.schema.inlineContentSpecs, this.styleImplementations = n.schema.styleSpecs, n.uploadFile) {
3075
- const S = n.uploadFile;
3076
- this.uploadFile = async (P, M) => {
3113
+ if (this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, o.uploadFile) {
3114
+ const y = o.uploadFile;
3115
+ this.uploadFile = async (P, T) => {
3077
3116
  this.onUploadStartCallbacks.forEach(
3078
- (v) => v.apply(this, [M])
3117
+ (v) => v.apply(this, [T])
3079
3118
  );
3080
3119
  try {
3081
- return await S(P, M);
3120
+ return await y(P, T);
3082
3121
  } finally {
3083
3122
  this.onUploadEndCallbacks.forEach(
3084
- (v) => v.apply(this, [M])
3123
+ (v) => v.apply(this, [T])
3085
3124
  );
3086
3125
  }
3087
3126
  };
3088
3127
  }
3089
- this.resolveFileUrl = n.resolveFileUrl, this._eventManager = new So(this), this._extensionManager = new gn(this, n);
3128
+ this.resolveFileUrl = o.resolveFileUrl, this._eventManager = new Co(this), this._extensionManager = new yn(this, o);
3090
3129
  const s = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
3091
- r && n.initialContent && console.warn(
3130
+ r && o.initialContent && console.warn(
3092
3131
  "When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
3093
3132
  );
3094
3133
  const a = {
3095
- ...An,
3096
- ...n._tiptapOptions,
3134
+ ...Ln,
3135
+ ...o._tiptapOptions,
3097
3136
  element: null,
3098
- autofocus: n.autofocus ?? !1,
3137
+ autofocus: o.autofocus ?? !1,
3099
3138
  extensions: s,
3100
3139
  editorProps: {
3101
- ...(m = n._tiptapOptions) == null ? void 0 : m.editorProps,
3140
+ ...(m = o._tiptapOptions) == null ? void 0 : m.editorProps,
3102
3141
  attributes: {
3103
3142
  // As of TipTap v2.5.0 the tabIndex is removed when the editor is not
3104
3143
  // editable, so you can't focus it. We want to revert this as we have
3105
3144
  // UI behaviour that relies on it.
3106
3145
  tabIndex: "0",
3107
- ...(k = (f = n._tiptapOptions) == null ? void 0 : f.editorProps) == null ? void 0 : k.attributes,
3108
- ...(g = n.domAttributes) == null ? void 0 : g.editor,
3109
- class: Q(
3146
+ ...(k = (f = o._tiptapOptions) == null ? void 0 : f.editorProps) == null ? void 0 : k.attributes,
3147
+ ...(b = o.domAttributes) == null ? void 0 : b.editor,
3148
+ class: Z(
3110
3149
  "bn-editor",
3111
- n.defaultStyles ? "bn-default-styles" : "",
3112
- ((T = (y = n.domAttributes) == null ? void 0 : y.editor) == null ? void 0 : T.class) || ""
3150
+ o.defaultStyles ? "bn-default-styles" : "",
3151
+ ((w = (g = o.domAttributes) == null ? void 0 : g.editor) == null ? void 0 : w.class) || ""
3113
3152
  )
3114
3153
  },
3115
- transformPasted: vn
3154
+ transformPasted: _n
3116
3155
  }
3117
3156
  };
3118
3157
  try {
3119
- const S = n.initialContent || (r ? [
3158
+ const y = o.initialContent || (r ? [
3120
3159
  {
3121
3160
  type: "paragraph",
3122
3161
  id: "initialBlockId"
@@ -3127,46 +3166,46 @@ class Le extends Se {
3127
3166
  id: me.options.generateID()
3128
3167
  }
3129
3168
  ]);
3130
- if (!Array.isArray(S) || S.length === 0)
3169
+ if (!Array.isArray(y) || y.length === 0)
3131
3170
  throw new Error(
3132
- "initialContent must be a non-empty array of blocks, received: " + S
3171
+ "initialContent must be a non-empty array of blocks, received: " + y
3133
3172
  );
3134
- const P = vt(a.extensions), M = S.map(
3135
- (Ne) => J(Ne, P, this.schema.styleSchema).toJSON()
3136
- ), v = It(
3173
+ const P = At(a.extensions), T = y.map(
3174
+ (Oe) => Q(Oe, P, this.schema.styleSchema).toJSON()
3175
+ ), v = _t(
3137
3176
  {
3138
3177
  type: "doc",
3139
3178
  content: [
3140
3179
  {
3141
3180
  type: "blockGroup",
3142
- content: M
3181
+ content: T
3143
3182
  }
3144
3183
  ]
3145
3184
  },
3146
3185
  P,
3147
3186
  a.parseOptions
3148
3187
  );
3149
- this._tiptapEditor = new At({
3188
+ this._tiptapEditor = new Dt({
3150
3189
  ...a,
3151
3190
  content: v.toJSON()
3152
3191
  }), this.pmSchema = this._tiptapEditor.schema;
3153
- } catch (S) {
3192
+ } catch (y) {
3154
3193
  throw new Error(
3155
3194
  "Error creating document from blocks passed as `initialContent`",
3156
- { cause: S }
3195
+ { cause: y }
3157
3196
  );
3158
3197
  }
3159
3198
  let c;
3160
3199
  const i = this.pmSchema.nodes.doc.createAndFill;
3161
- this.pmSchema.nodes.doc.createAndFill = (...S) => {
3200
+ this.pmSchema.nodes.doc.createAndFill = (...y) => {
3162
3201
  if (c)
3163
3202
  return c;
3164
- const P = i.apply(this.pmSchema.nodes.doc, S), M = JSON.parse(JSON.stringify(P.toJSON()));
3165
- return M.content[0].content[0].attrs.id = "initialBlockId", c = He.fromJSON(this.pmSchema, M), c;
3166
- }, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new yo(this), this._exportManager = new Io(this), this._selectionManager = new xn(this), this._stateManager = new En(this), this._styleManager = new Mn(this), this.emit("create");
3203
+ const P = i.apply(this.pmSchema.nodes.doc, y), T = JSON.parse(JSON.stringify(P.toJSON()));
3204
+ return T.content[0].content[0].attrs.id = "initialBlockId", c = Ve.fromJSON(this.pmSchema, T), c;
3205
+ }, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new Bo(this), this._exportManager = new _o(this), this._selectionManager = new Mn(this), this._stateManager = new wn(this), this._styleManager = new Pn(this), this.emit("create");
3167
3206
  }
3168
3207
  static create(t) {
3169
- return new Le(t ?? {});
3208
+ return new Ne(t ?? {});
3170
3209
  }
3171
3210
  /**
3172
3211
  * BlockNote extensions that are added to the editor, keyed by the extension key
@@ -3269,14 +3308,14 @@ class Le extends Se {
3269
3308
  // TODO move to extension
3270
3309
  onUploadStart(t) {
3271
3310
  return this.onUploadStartCallbacks.push(t), () => {
3272
- const n = this.onUploadStartCallbacks.indexOf(t);
3273
- n > -1 && this.onUploadStartCallbacks.splice(n, 1);
3311
+ const o = this.onUploadStartCallbacks.indexOf(t);
3312
+ o > -1 && this.onUploadStartCallbacks.splice(o, 1);
3274
3313
  };
3275
3314
  }
3276
3315
  onUploadEnd(t) {
3277
3316
  return this.onUploadEndCallbacks.push(t), () => {
3278
- const n = this.onUploadEndCallbacks.indexOf(t);
3279
- n > -1 && this.onUploadEndCallbacks.splice(n, 1);
3317
+ const o = this.onUploadEndCallbacks.indexOf(t);
3318
+ o > -1 && this.onUploadEndCallbacks.splice(o, 1);
3280
3319
  };
3281
3320
  }
3282
3321
  /**
@@ -3340,8 +3379,8 @@ class Le extends Se {
3340
3379
  * @param callback The callback to execute for each block. Returning `false` stops the traversal.
3341
3380
  * @param reverse Whether the blocks should be traversed in reverse order.
3342
3381
  */
3343
- forEachBlock(t, n = !1) {
3344
- this._blockManager.forEachBlock(t, n);
3382
+ forEachBlock(t, o = !1) {
3383
+ this._blockManager.forEachBlock(t, o);
3345
3384
  }
3346
3385
  /**
3347
3386
  * Executes a callback whenever the editor's contents change.
@@ -3382,8 +3421,8 @@ class Le extends Se {
3382
3421
  * @param targetBlock The identifier of an existing block that the text cursor should be moved to.
3383
3422
  * @param placement Whether the text cursor should be placed at the start or end of the block.
3384
3423
  */
3385
- setTextCursorPosition(t, n = "start") {
3386
- return this._selectionManager.setTextCursorPosition(t, n);
3424
+ setTextCursorPosition(t, o = "start") {
3425
+ return this._selectionManager.setTextCursorPosition(t, o);
3387
3426
  }
3388
3427
  /**
3389
3428
  * Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
@@ -3409,8 +3448,8 @@ class Le extends Se {
3409
3448
  * @param startBlock The identifier of the block that should be the start of the selection.
3410
3449
  * @param endBlock The identifier of the block that should be the end of the selection.
3411
3450
  */
3412
- setSelection(t, n) {
3413
- return this._selectionManager.setSelection(t, n);
3451
+ setSelection(t, o) {
3452
+ return this._selectionManager.setSelection(t, o);
3414
3453
  }
3415
3454
  /**
3416
3455
  * Checks if the editor is currently editable, or if it's locked.
@@ -3434,10 +3473,10 @@ class Le extends Se {
3434
3473
  * @param placement Whether the blocks should be inserted just before, just after, or nested inside the
3435
3474
  * `referenceBlock`.
3436
3475
  */
3437
- insertBlocks(t, n, s = "before") {
3476
+ insertBlocks(t, o, s = "before") {
3438
3477
  return this._blockManager.insertBlocks(
3439
3478
  t,
3440
- n,
3479
+ o,
3441
3480
  s
3442
3481
  );
3443
3482
  }
@@ -3448,8 +3487,8 @@ class Le extends Se {
3448
3487
  * @param blockToUpdate The block that should be updated.
3449
3488
  * @param update A partial block which defines how the existing block should be changed.
3450
3489
  */
3451
- updateBlock(t, n) {
3452
- return this._blockManager.updateBlock(t, n);
3490
+ updateBlock(t, o) {
3491
+ return this._blockManager.updateBlock(t, o);
3453
3492
  }
3454
3493
  /**
3455
3494
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
@@ -3465,8 +3504,8 @@ class Le extends Se {
3465
3504
  * @param blocksToRemove An array of blocks that should be replaced.
3466
3505
  * @param blocksToInsert An array of partial blocks to replace the old ones with.
3467
3506
  */
3468
- replaceBlocks(t, n) {
3469
- return this._blockManager.replaceBlocks(t, n);
3507
+ replaceBlocks(t, o) {
3508
+ return this._blockManager.replaceBlocks(t, o);
3470
3509
  }
3471
3510
  /**
3472
3511
  * Undo the last action.
@@ -3485,8 +3524,8 @@ class Le extends Se {
3485
3524
  *
3486
3525
  * @param content can be a string, or array of partial inline content elements
3487
3526
  */
3488
- insertInlineContent(t, { updateSelection: n = !1 } = {}) {
3489
- this._styleManager.insertInlineContent(t, { updateSelection: n });
3527
+ insertInlineContent(t, { updateSelection: o = !1 } = {}) {
3528
+ this._styleManager.insertInlineContent(t, { updateSelection: o });
3490
3529
  }
3491
3530
  /**
3492
3531
  * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
@@ -3532,8 +3571,8 @@ class Le extends Se {
3532
3571
  * @param url The link URL.
3533
3572
  * @param text The text to display the link with.
3534
3573
  */
3535
- createLink(t, n) {
3536
- this._styleManager.createLink(t, n);
3574
+ createLink(t, o) {
3575
+ this._styleManager.createLink(t, o);
3537
3576
  }
3538
3577
  /**
3539
3578
  * Checks if the block containing the text cursor can be nested.
@@ -3632,8 +3671,8 @@ class Le extends Se {
3632
3671
  * @param callback The callback to execute.
3633
3672
  * @returns A function to remove the callback.
3634
3673
  */
3635
- onChange(t, n) {
3636
- return this._eventManager.onChange(t, n);
3674
+ onChange(t, o) {
3675
+ return this._eventManager.onChange(t, o);
3637
3676
  }
3638
3677
  /**
3639
3678
  * A callback function that runs whenever the text cursor position or selection changes.
@@ -3641,10 +3680,10 @@ class Le extends Se {
3641
3680
  * @param callback The callback to execute.
3642
3681
  * @returns A function to remove the callback.
3643
3682
  */
3644
- onSelectionChange(t, n) {
3683
+ onSelectionChange(t, o) {
3645
3684
  return this._eventManager.onSelectionChange(
3646
3685
  t,
3647
- n
3686
+ o
3648
3687
  );
3649
3688
  }
3650
3689
  /**
@@ -3685,8 +3724,8 @@ class Le extends Se {
3685
3724
  * @param html The HTML to paste.
3686
3725
  * @param raw Whether to paste the HTML as is, or to convert it to BlockNote HTML.
3687
3726
  */
3688
- pasteHTML(t, n = !1) {
3689
- this._exportManager.pasteHTML(t, n);
3727
+ pasteHTML(t, o = !1) {
3728
+ this._exportManager.pasteHTML(t, o);
3690
3729
  }
3691
3730
  /**
3692
3731
  * Paste text into the editor. Defaults to interpreting text as markdown.
@@ -3703,19 +3742,19 @@ class Le extends Se {
3703
3742
  return this._exportManager.pasteMarkdown(t);
3704
3743
  }
3705
3744
  }
3706
- class rs {
3707
- constructor(e, t, n) {
3708
- this.mappings = t, this.options = n;
3745
+ class cs {
3746
+ constructor(e, t, o) {
3747
+ this.mappings = t, this.options = o;
3709
3748
  }
3710
3749
  async resolveFile(e) {
3711
- var n;
3712
- if (!((n = this.options) != null && n.resolveFileUrl))
3750
+ var o;
3751
+ if (!((o = this.options) != null && o.resolveFileUrl))
3713
3752
  return (await fetch(e)).blob();
3714
3753
  const t = await this.options.resolveFileUrl(e);
3715
3754
  return t instanceof Blob ? t : (await fetch(t)).blob();
3716
3755
  }
3717
3756
  mapStyles(e) {
3718
- return Object.entries(e).map(([n, s]) => this.mappings.styleMapping[n](s, this));
3757
+ return Object.entries(e).map(([o, s]) => this.mappings.styleMapping[o](s, this));
3719
3758
  }
3720
3759
  mapInlineContent(e) {
3721
3760
  return this.mappings.inlineContentMapping[e.type](
@@ -3726,27 +3765,27 @@ class rs {
3726
3765
  transformInlineContent(e) {
3727
3766
  return e.map((t) => this.mapInlineContent(t));
3728
3767
  }
3729
- async mapBlock(e, t, n, s) {
3768
+ async mapBlock(e, t, o, s) {
3730
3769
  return this.mappings.blockMapping[e.type](
3731
3770
  e,
3732
3771
  this,
3733
3772
  t,
3734
- n,
3773
+ o,
3735
3774
  s
3736
3775
  );
3737
3776
  }
3738
3777
  }
3739
- function as(o) {
3778
+ function ls(n) {
3740
3779
  return {
3741
3780
  createBlockMapping: (e) => e,
3742
3781
  createInlineContentMapping: (e) => e,
3743
3782
  createStyleMapping: (e) => e
3744
3783
  };
3745
3784
  }
3746
- function is(o, ...e) {
3747
- const t = [...o];
3748
- for (const n of e)
3749
- for (const s of n) {
3785
+ function ds(n, ...e) {
3786
+ const t = [...n];
3787
+ for (const o of e)
3788
+ for (const s of o) {
3750
3789
  const r = t.findLastIndex(
3751
3790
  (a) => a.group === s.group
3752
3791
  );
@@ -3755,172 +3794,172 @@ function is(o, ...e) {
3755
3794
  return t;
3756
3795
  }
3757
3796
  export {
3758
- Le as BlockNoteEditor,
3759
- Et as BlockNoteSchema,
3760
- ws as COLORS_DARK_MODE_DEFAULT,
3761
- Ms as COLORS_DEFAULT,
3762
- sa as CustomBlockNoteSchema,
3763
- Ts as EMPTY_CELL_HEIGHT,
3764
- Je as EMPTY_CELL_WIDTH,
3797
+ Ne as BlockNoteEditor,
3798
+ Mt as BlockNoteSchema,
3799
+ Ps as COLORS_DARK_MODE_DEFAULT,
3800
+ vs as COLORS_DEFAULT,
3801
+ ia as CustomBlockNoteSchema,
3802
+ Is as EMPTY_CELL_HEIGHT,
3803
+ Ye as EMPTY_CELL_WIDTH,
3765
3804
  Se as EventEmitter,
3766
- rs as Exporter,
3767
- Ps as FILE_AUDIO_ICON_SVG,
3768
- vs as FILE_IMAGE_ICON_SVG,
3769
- Is as FILE_VIDEO_ICON_SVG,
3805
+ cs as Exporter,
3806
+ As as FILE_AUDIO_ICON_SVG,
3807
+ _s as FILE_IMAGE_ICON_SVG,
3808
+ Ds as FILE_VIDEO_ICON_SVG,
3770
3809
  Pe as HTMLToBlocks,
3771
3810
  me as UniqueID,
3772
3811
  F as UnreachableCaseError,
3773
- As as addDefaultPropsExternalHTML,
3774
- H as addInlineContentAttributes,
3775
- We as addInlineContentKeyboardShortcuts,
3776
- _s as addNodeAndExtensionsToSpec,
3777
- Ds as addStyleAttributes,
3778
- Ls as applyNonSelectableBlockFix,
3779
- ds as assertEmpty,
3780
- Ns as audioParse,
3781
- Os as audioRender,
3782
- Fs as audioToExternalHTML,
3783
- $s as blockHasType,
3784
- J as blockToNode,
3785
- st as blocksToMarkdown,
3786
- Hs as camelToDataKebab,
3787
- Vs as captureCellAnchor,
3788
- ra as checkPageBreakBlocksInSchema,
3789
- rt as cleanHTMLToMarkdown,
3790
- is as combineByGroup,
3791
- Re as contentNodeToInlineContent,
3792
- Ge as contentNodeToTableContent,
3793
- Us as createAudioBlockConfig,
3794
- zs as createAudioBlockSpec,
3795
- Gs as createBlockConfig,
3796
- Rs as createBlockSpec,
3797
- js as createBlockSpecFromTiptapNode,
3798
- Ws as createBulletListItemBlockConfig,
3799
- qs as createBulletListItemBlockSpec,
3800
- Ks as createCheckListItemBlockSpec,
3801
- Js as createCheckListItemConfig,
3802
- Ys as createCodeBlockConfig,
3803
- Qs as createCodeBlockSpec,
3804
- Xs as createDefaultBlockDOMOutputSpec,
3805
- Zs as createDividerBlockConfig,
3806
- er as createDividerBlockSpec,
3807
- Ot as createExtension,
3808
- be as createExternalHTMLExporter,
3809
- tr as createFileBlockConfig,
3810
- or as createFileBlockSpec,
3811
- nr as createHeadingBlockConfig,
3812
- sr as createHeadingBlockSpec,
3813
- rr as createImageBlockConfig,
3814
- ar as createImageBlockSpec,
3815
- ss as createInlineContentSpec,
3816
- Ke as createInlineContentSpecFromTipTapNode,
3817
- ro as createInternalHTMLSerializer,
3818
- ir as createInternalInlineContentSpec,
3819
- cr as createInternalStyleSpec,
3820
- lr as createNumberedListItemBlockConfig,
3821
- dr as createNumberedListItemBlockSpec,
3822
- aa as createPageBreakBlockConfig,
3823
- ia as createPageBreakBlockSpec,
3824
- ur as createParagraphBlockConfig,
3825
- pr as createParagraphBlockSpec,
3826
- fr as createQuoteBlockConfig,
3827
- hr as createQuoteBlockSpec,
3828
- pa as createStore,
3829
- mr as createStyleSpec,
3830
- kr as createStyleSpecFromTipTapMark,
3831
- gr as createTableBlockSpec,
3832
- br as createToggleListItemBlockConfig,
3833
- yr as createToggleListItemBlockSpec,
3834
- Sr as createToggleWrapper,
3835
- Br as createVideoBlockConfig,
3836
- Cr as createVideoBlockSpec,
3837
- xr as defaultBlockSpecs,
3838
- Er as defaultBlockToHTML,
3839
- wr as defaultInlineContentSchema,
3840
- Mr as defaultInlineContentSpecs,
3841
- Tr as defaultProps,
3842
- Pr as defaultStyleSchema,
3843
- vr as defaultStyleSpecs,
3844
- Ir as defaultToggledState,
3845
- ze as docToBlocks,
3846
- Ar as editorHasBlockWithType,
3847
- bn as expandPMRangeToWords,
3848
- _r as fileParse,
3849
- Dr as filenameFromURL,
3850
- W as fixColumnList,
3851
- Lr as formatKeyboardShortcut,
3852
- Xe as getBackgroundColorAttribute,
3853
- mo as getBlock,
3854
- us as getBlockCache,
3855
- Nr as getBlockFromPos,
3856
- z as getBlockInfo,
3857
- Y as getBlockInfoFromResolvedPos,
3812
+ Ls as addDefaultPropsExternalHTML,
3813
+ V as addInlineContentAttributes,
3814
+ qe as addInlineContentKeyboardShortcuts,
3815
+ Ns as addNodeAndExtensionsToSpec,
3816
+ Os as addStyleAttributes,
3817
+ Fs as applyNonSelectableBlockFix,
3818
+ fs as assertEmpty,
3819
+ $s as audioParse,
3820
+ Hs as audioRender,
3821
+ Vs as audioToExternalHTML,
3822
+ Us as blockHasType,
3823
+ Q as blockToNode,
3824
+ rt as blocksToMarkdown,
3825
+ zs as camelToDataKebab,
3826
+ Gs as captureCellAnchor,
3827
+ ca as checkPageBreakBlocksInSchema,
3828
+ at as cleanHTMLToMarkdown,
3829
+ ds as combineByGroup,
3830
+ je as contentNodeToInlineContent,
3831
+ Re as contentNodeToTableContent,
3832
+ Rs as createAudioBlockConfig,
3833
+ js as createAudioBlockSpec,
3834
+ Ws as createBlockConfig,
3835
+ qs as createBlockSpec,
3836
+ Ks as createBlockSpecFromTiptapNode,
3837
+ Js as createBulletListItemBlockConfig,
3838
+ Ys as createBulletListItemBlockSpec,
3839
+ Qs as createCheckListItemBlockSpec,
3840
+ Xs as createCheckListItemConfig,
3841
+ Zs as createCodeBlockConfig,
3842
+ er as createCodeBlockSpec,
3843
+ tr as createDefaultBlockDOMOutputSpec,
3844
+ or as createDividerBlockConfig,
3845
+ nr as createDividerBlockSpec,
3846
+ $t as createExtension,
3847
+ ge as createExternalHTMLExporter,
3848
+ sr as createFileBlockConfig,
3849
+ rr as createFileBlockSpec,
3850
+ ar as createHeadingBlockConfig,
3851
+ ir as createHeadingBlockSpec,
3852
+ cr as createImageBlockConfig,
3853
+ lr as createImageBlockSpec,
3854
+ is as createInlineContentSpec,
3855
+ Je as createInlineContentSpecFromTipTapNode,
3856
+ io as createInternalHTMLSerializer,
3857
+ dr as createInternalInlineContentSpec,
3858
+ ur as createInternalStyleSpec,
3859
+ pr as createNumberedListItemBlockConfig,
3860
+ fr as createNumberedListItemBlockSpec,
3861
+ la as createPageBreakBlockConfig,
3862
+ da as createPageBreakBlockSpec,
3863
+ hr as createParagraphBlockConfig,
3864
+ mr as createParagraphBlockSpec,
3865
+ kr as createQuoteBlockConfig,
3866
+ br as createQuoteBlockSpec,
3867
+ ma as createStore,
3868
+ gr as createStyleSpec,
3869
+ yr as createStyleSpecFromTipTapMark,
3870
+ Sr as createTableBlockSpec,
3871
+ Br as createToggleListItemBlockConfig,
3872
+ Cr as createToggleListItemBlockSpec,
3873
+ Er as createToggleWrapper,
3874
+ xr as createVideoBlockConfig,
3875
+ Mr as createVideoBlockSpec,
3876
+ wr as defaultBlockSpecs,
3877
+ Tr as defaultBlockToHTML,
3878
+ Pr as defaultInlineContentSchema,
3879
+ vr as defaultInlineContentSpecs,
3880
+ Ir as defaultProps,
3881
+ Ar as defaultStyleSchema,
3882
+ _r as defaultStyleSpecs,
3883
+ Dr as defaultToggledState,
3884
+ Ge as docToBlocks,
3885
+ Lr as editorHasBlockWithType,
3886
+ Sn as expandPMRangeToWords,
3887
+ Nr as fileParse,
3888
+ Or as filenameFromURL,
3889
+ K as fixColumnList,
3890
+ Fr as formatKeyboardShortcut,
3891
+ Ze as getBackgroundColorAttribute,
3892
+ bo as getBlock,
3893
+ hs as getBlockCache,
3894
+ $r as getBlockFromPos,
3895
+ R as getBlockInfo,
3896
+ X as getBlockInfoFromResolvedPos,
3858
3897
  B as getBlockInfoFromSelection,
3859
3898
  $ as getBlockInfoFromTransaction,
3860
- ps as getBlockInfoWithManualOffset,
3899
+ ms as getBlockInfoWithManualOffset,
3861
3900
  ke as getBlockNoteSchema,
3862
- fs as getBlockSchema,
3863
- nt as getBlocksChangedByTransaction,
3864
- hs as getColspan,
3865
- Kt as getInlineContentParseRules,
3866
- ms as getInlineContentSchema,
3867
- Or as getInlineContentSchemaFromSpecs,
3868
- Fr as getLanguageId,
3901
+ ks as getBlockSchema,
3902
+ st as getBlocksChangedByTransaction,
3903
+ bs as getColspan,
3904
+ Yt as getInlineContentParseRules,
3905
+ gs as getInlineContentSchema,
3906
+ Hr as getInlineContentSchemaFromSpecs,
3907
+ Vr as getLanguageId,
3869
3908
  _ as getNearestBlockPos,
3870
- go as getNextBlock,
3871
- x as getNodeById,
3872
- ca as getPageBreakSlashMenuItems,
3873
- bo as getParentBlock,
3874
- $r as getParseRules,
3909
+ yo as getNextBlock,
3910
+ E as getNodeById,
3911
+ ua as getPageBreakSlashMenuItems,
3912
+ So as getParentBlock,
3913
+ Ur as getParseRules,
3875
3914
  C as getPmSchema,
3876
- ko as getPrevBlock,
3877
- ks as getRowspan,
3878
- Hr as getStyleParseRules,
3879
- gs as getStyleSchema,
3880
- Vr as getStyleSchemaFromSpecs,
3881
- Ur as getTextAlignmentAttribute,
3882
- tt as getTextColorAttribute,
3883
- zr as imageParse,
3884
- Gr as imageRender,
3885
- Rr as imageToExternalHTML,
3915
+ go as getPrevBlock,
3916
+ ys as getRowspan,
3917
+ zr as getStyleParseRules,
3918
+ Ss as getStyleSchema,
3919
+ Gr as getStyleSchemaFromSpecs,
3920
+ Rr as getTextAlignmentAttribute,
3921
+ ot as getTextColorAttribute,
3922
+ jr as imageParse,
3923
+ Wr as imageRender,
3924
+ qr as imageToExternalHTML,
3886
3925
  O as inlineContentToNodes,
3887
- Jt as insertBlocks,
3888
- jr as isAppleOS,
3889
- j as isEmptyColumn,
3890
- bs as isLinkInlineContent,
3891
- Wr as isNodeBlock,
3892
- ys as isPartialLinkInlineContent,
3893
- Ss as isPartialTableCell,
3894
- qr as isSafari,
3895
- Bs as isStyledTextInlineContent,
3896
- Cs as isTableCell,
3897
- Kr as isTableCellSelection,
3898
- Qe as isVideoUrl,
3899
- xs as mapTableCell,
3900
- as as mappingFactory,
3901
- vo as markdownToBlocks,
3926
+ Qt as insertBlocks,
3927
+ Kr as isAppleOS,
3928
+ q as isEmptyColumn,
3929
+ Bs as isLinkInlineContent,
3930
+ Jr as isNodeBlock,
3931
+ Cs as isPartialLinkInlineContent,
3932
+ Es as isPartialTableCell,
3933
+ Yr as isSafari,
3934
+ xs as isStyledTextInlineContent,
3935
+ Ms as isTableCell,
3936
+ Qr as isTableCellSelection,
3937
+ Xe as isVideoUrl,
3938
+ ws as mapTableCell,
3939
+ ls as mappingFactory,
3940
+ Ao as markdownToBlocks,
3902
3941
  ve as markdownToHTML,
3903
- Q as mergeCSSClasses,
3904
- Jr as mergeParagraphs,
3905
- b as nodeToBlock,
3906
- U as nodeToCustomInlineContent,
3907
- Yr as parseAudioElement,
3908
- Qr as parseDefaultProps,
3909
- qe as propsToAttributes,
3910
- je as prosemirrorSliceToSlicedBlocks,
3942
+ Z as mergeCSSClasses,
3943
+ Xr as mergeParagraphs,
3944
+ S as nodeToBlock,
3945
+ G as nodeToCustomInlineContent,
3946
+ Zr as parseAudioElement,
3947
+ ea as parseDefaultProps,
3948
+ Ke as propsToAttributes,
3949
+ We as prosemirrorSliceToSlicedBlocks,
3911
3950
  ae as removeAndInsertBlocks,
3912
- Yt as removeEmptyColumns,
3951
+ Xt as removeEmptyColumns,
3913
3952
  Ae as selectedFragmentToHTML,
3914
- Xr as stylePropsToAttributes,
3915
- Ue as tableContentToNodes,
3916
- Zr as tablePropSchema,
3917
- ea as trackPosition,
3918
- Ye as updateBlock,
3919
- et as updateBlockCommand,
3920
- ot as updateBlockTr,
3921
- la as uploadToTmpFilesDotOrg_DEV_ONLY,
3922
- ta as videoParse,
3923
- da as withPageBreak,
3924
- oa as wrapInBlockStructure
3953
+ ta as stylePropsToAttributes,
3954
+ ze as tableContentToNodes,
3955
+ oa as tablePropSchema,
3956
+ na as trackPosition,
3957
+ Qe as updateBlock,
3958
+ tt as updateBlockCommand,
3959
+ nt as updateBlockTr,
3960
+ pa as uploadToTmpFilesDotOrg_DEV_ONLY,
3961
+ sa as videoParse,
3962
+ fa as withPageBreak,
3963
+ ra as wrapInBlockStructure
3925
3964
  };
3926
3965
  //# sourceMappingURL=blocknote.js.map