@blocknote/core 0.46.2 → 0.47.1

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 (54) hide show
  1. package/dist/{BlockNoteSchema-DmFDeA0n.cjs → BlockNoteSchema-CwhtPpVC.cjs} +2 -2
  2. package/dist/{BlockNoteSchema-DmFDeA0n.cjs.map → BlockNoteSchema-CwhtPpVC.cjs.map} +1 -1
  3. package/dist/{BlockNoteSchema-BkXw8HJ6.js → BlockNoteSchema-dmbNkHA-.js} +2 -2
  4. package/dist/{BlockNoteSchema-BkXw8HJ6.js.map → BlockNoteSchema-dmbNkHA-.js.map} +1 -1
  5. package/dist/TrailingNode-DHOdUVUO.cjs +2 -0
  6. package/dist/TrailingNode-DHOdUVUO.cjs.map +1 -0
  7. package/dist/{TrailingNode-CxM966vN.js → TrailingNode-F9hX_UlQ.js} +451 -445
  8. package/dist/TrailingNode-F9hX_UlQ.js.map +1 -0
  9. package/dist/blocknote.cjs +4 -4
  10. package/dist/blocknote.cjs.map +1 -1
  11. package/dist/blocknote.js +1624 -1370
  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-DosClM5E.cjs → defaultBlocks-CSB5GiAu.cjs} +4 -4
  16. package/dist/defaultBlocks-CSB5GiAu.cjs.map +1 -0
  17. package/dist/{defaultBlocks-DE5GNdJH.js → defaultBlocks-Caw1U1oV.js} +49 -46
  18. package/dist/defaultBlocks-Caw1U1oV.js.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/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +30 -7
  30. package/src/blocks/ListItem/CheckListItem/block.test.ts +61 -0
  31. package/src/blocks/ListItem/CheckListItem/block.ts +4 -0
  32. package/src/editor/Block.css +2 -2
  33. package/src/editor/transformPasted.ts +69 -0
  34. package/src/extensions/Collaboration/YCursorPlugin.ts +3 -1
  35. package/src/extensions/SideMenu/SideMenu.ts +44 -0
  36. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +191 -0
  37. package/src/extensions/SuggestionMenu/SuggestionMenu.ts +28 -11
  38. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +470 -64
  39. package/src/i18n/locales/fa.ts +390 -0
  40. package/src/i18n/locales/index.ts +2 -0
  41. package/src/i18n/locales/uz.ts +421 -0
  42. package/src/schema/blocks/createSpec.ts +2 -0
  43. package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +5 -0
  44. package/types/src/blocks/ListItem/CheckListItem/block.test.d.ts +1 -0
  45. package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +12 -3
  46. package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +1 -0
  47. package/types/src/i18n/locales/fa.d.ts +320 -0
  48. package/types/src/i18n/locales/index.d.ts +2 -0
  49. package/types/src/i18n/locales/uz.d.ts +2 -0
  50. package/dist/TrailingNode-CxM966vN.js.map +0 -1
  51. package/dist/TrailingNode-D-CZ76FS.cjs +0 -2
  52. package/dist/TrailingNode-D-CZ76FS.cjs.map +0 -1
  53. package/dist/defaultBlocks-DE5GNdJH.js.map +0 -1
  54. 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";
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) {
1
+ var Fe = Object.defineProperty;
2
+ var Ve = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var k = (n, e, t) => Ve(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Slice as F, Fragment as w, DOMSerializer as me, DOMParser as Ue, Node as ze } from "prosemirror-model";
5
+ import { ReplaceStep as Re, ReplaceAroundStep as W } from "prosemirror-transform";
6
+ import { n as q, i as V, g as E, b as Z, a as C, t as Ge, U, q as D, r as z, d as je, s as We, u as qe, v, w as B, x as ke, y as Ke, z as be, A as K } from "./blockToNode-BNoNIXU7.js";
7
+ import { B as ms, G as ks, C as bs, D as gs, N as Bs, E as ys, O as Cs, F as Ss, H as xs, I as Es, L as Ps, J as Ts, M as Ms, K as ws } from "./blockToNode-BNoNIXU7.js";
8
+ import { ak as G, al as Je, am as Ye, an as Qe, aj as P, a as Xe, ao as Ze, ap as et, a5 as tt, a8 as J, aq as ot, ar as nt, a6 as st, as as ee, a9 as ge, at as rt } from "./defaultBlocks-Caw1U1oV.js";
9
+ import { aw as Is, av as As, E as Ns, F as _s, r as Ls, N as Ds, a4 as Os, ad as $s, aG as Hs, ax as Fs, b as Vs, d as Us, e as zs, a0 as Rs, aM as Gs, au as js, c as Ws, f as qs, ag as Ks, ah as Js, aB as Ys, x as Qs, y as Xs, A as Zs, z as er, g as tr, h as or, T as nr, j as sr, k as rr, l as ir, n as ar, o as cr, q as lr, s as dr, w as ur, aC as pr, aH as fr, B as hr, C as mr, H as kr, I as br, J as gr, K as Br, aE as yr, aI as Cr, M as Sr, D as xr, G as Er, S as Pr, O as Tr, Q as Mr, W as wr, U as vr, _ as Ir, Z as Ar, a2 as Nr, Y as _r, X as Lr, R as Dr, $ as Or, m as $r, aN as Hr, aK as Fr, az as Vr, af as Ur, i as zr, ay as Rr, aD as Gr, ae as jr, a7 as Wr, t as qr, u as Kr, v as Jr, aJ as Yr, ai as Qr, aL as Xr, a1 as Zr, V as ei, p as ti, a3 as oi, aF as ni, L as si, aO as ri, P as ii, aA as ai } from "./defaultBlocks-Caw1U1oV.js";
10
+ import { j as it, k as Be, l as at, m as ct, n as lt, c as Y, F as dt, Y as ut, a as pt, b as ft, S as ht, B as ye, D as mt, L as kt, N as bt, P as gt, g as Bt, i as yt, H as Ct, h as St, e as xt, V as Et, d as Pt } from "./TrailingNode-F9hX_UlQ.js";
11
+ import { s as Tt, B as Mt } from "./BlockNoteSchema-dmbNkHA-.js";
12
+ import { C as li, b as di, c as ui, a as pi, g as fi, u as hi, w as mi } from "./BlockNoteSchema-dmbNkHA-.js";
13
+ import { Node as O, Extension as T, mergeAttributes as wt, Mark as te, extensions as N, isNodeSelection as vt, posToDOMRect as It, selectionToInsertionEnd as At, findParentNodeClosestToPos as Nt, getSchema as _t, createDocument as Lt, Editor as Dt } from "@tiptap/core";
14
+ import { E as Ce } from "./EventEmitter-CjSwpTbz.js";
15
+ import { Fragment as R, Slice as j } from "@tiptap/pm/model";
16
+ import { e as Ot } from "./en-njEqD7AG.js";
17
+ import { inputRules as $t, InputRule as Ht } from "@handlewithcare/prosemirror-inputrules";
18
+ import { keymap as Ft } from "@tiptap/pm/keymap";
19
+ import { c as Vt, o as Ut } from "./BlockNoteExtension-C2X7LW-V.js";
20
+ import { a as bi } from "./BlockNoteExtension-C2X7LW-V.js";
21
+ import { Gapcursor as zt } from "@tiptap/extensions/gap-cursor";
22
+ import { Link as Rt } from "@tiptap/extension-link";
23
+ import { Text as Gt } from "@tiptap/extension-text";
24
+ import { NodeSelection as $, TextSelection as S, Plugin as oe } from "prosemirror-state";
25
+ import { CellSelection as ne, TableMap as re } from "prosemirror-tables";
26
+ import { S as jt } from "./ShowSelection-B0ch3unP.js";
27
+ import Wt from "remark-gfm";
28
+ import qt from "remark-parse";
29
+ import Kt, { defaultHandlers as ie } from "remark-rehype";
30
+ import Jt from "rehype-stringify";
31
+ import { unified as Yt } from "unified";
32
+ import { TextSelection as Qt } from "@tiptap/pm/state";
33
+ function Xt(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;
55
- const t = D.create({
56
- name: o.type,
53
+ function ls(n, e) {
54
+ var o;
55
+ const t = O.create({
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 Ye(n.propSchema);
65
65
  },
66
66
  addKeyboardShortcuts() {
67
- return We(o);
67
+ return Je(n);
68
68
  },
69
69
  parseHTML() {
70
- return Kt(
71
- o,
70
+ return Xt(
71
+ n,
72
72
  e.parse
73
73
  );
74
74
  },
75
75
  renderHTML({ node: s }) {
76
- const r = this.options.editor, a = e.render.call(
76
+ const r = this.options.editor, i = e.render.call(
77
77
  { renderType: "dom", props: void 0 },
78
- U(
78
+ q(
79
79
  s,
80
80
  r.schema.inlineContentSchema,
81
81
  r.schema.styleSchema
@@ -85,129 +85,129 @@ function ss(o, e) {
85
85
  },
86
86
  r
87
87
  );
88
- return H(
89
- a,
90
- o.type,
88
+ return G(
89
+ i,
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
- const { node: r, getPos: a } = s, c = this.options.editor, i = e.render.call(
97
+ const { node: r, getPos: i } = s, l = this.options.editor, a = e.render.call(
98
98
  { renderType: "nodeView", props: s },
99
- U(
99
+ q(
100
100
  r,
101
- c.schema.inlineContentSchema,
102
- c.schema.styleSchema
101
+ l.schema.inlineContentSchema,
102
+ l.schema.styleSchema
103
103
  ),
104
104
  // TODO: fix cast
105
- (l) => {
106
- const d = O([l], c.pmSchema), u = a();
107
- u && c.transact(
105
+ (c) => {
106
+ const d = V([c], l.pmSchema), u = i();
107
+ u && l.transact(
108
108
  (p) => p.replaceWith(u, u + r.nodeSize, d)
109
109
  );
110
110
  },
111
- c
111
+ l
112
112
  );
113
- return H(
114
- i,
115
- o.type,
113
+ return G(
114
+ a,
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 Qe(
123
123
  t,
124
- o.propSchema,
124
+ n.propSchema,
125
125
  {
126
126
  ...e,
127
127
  toExternalHTML: e.toExternalHTML,
128
- render(s, r, a) {
129
- const c = e.render(
128
+ render(s, r, i) {
129
+ const l = e.render(
130
130
  s,
131
131
  r,
132
- a
132
+ i
133
133
  );
134
- return H(
135
- c,
136
- o.type,
134
+ return G(
135
+ l,
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);
148
- if (!c)
144
+ function Zt(n, e, t, o = "before") {
145
+ const s = typeof t == "string" ? t : t.id, r = E(n), i = e.map(
146
+ (d) => Z(d, r)
147
+ ), l = P(s, n.doc);
148
+ if (!l)
149
149
  throw new Error(`Block with ID ${s} not found`);
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))
153
- ), a.map(
154
- (d) => b(d, r)
150
+ let a = l.posBeforeNode;
151
+ return o === "after" && (a += l.node.nodeSize), n.step(
152
+ new Re(a, a, new F(w.from(i), 0, 0))
153
+ ), i.map(
154
+ (d) => C(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 eo(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;
176
- if (!c || c.type.name !== "column")
174
+ for (let s = o.childCount - 1; s >= 0; s--) {
175
+ const r = n.doc.resolve(t.pos + 1).posAtIndex(s), l = n.doc.resolve(r).nodeAfter;
176
+ if (!l || l.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(l) && n.delete(r, r + l.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 H(n, e) {
182
+ eo(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;
193
- if (!a || !l)
192
+ const s = e + 1, i = n.doc.resolve(s).nodeAfter, l = e + o.nodeSize - 1, c = n.doc.resolve(l).nodeBefore;
193
+ if (!i || !c)
194
194
  throw new Error("Invalid columnList: does not contain children.");
195
- const d = j(a), u = j(l);
195
+ const d = Q(i), u = Q(c);
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 W(
203
203
  // Replaces `columnList`.
204
204
  e,
205
- e + n.nodeSize,
205
+ e + o.nodeSize,
206
206
  // Replaces with content of last `column`.
207
- c - l.nodeSize + 1,
208
- c - 1,
207
+ l - c.nodeSize + 1,
208
+ l - 1,
209
209
  // Doesn't append anything.
210
- N.empty,
210
+ F.empty,
211
211
  0,
212
212
  !1
213
213
  )
@@ -215,16 +215,16 @@ function W(o, e) {
215
215
  return;
216
216
  }
217
217
  if (u) {
218
- o.step(
219
- new V(
218
+ n.step(
219
+ new W(
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
- s + a.nodeSize - 1,
225
+ s + i.nodeSize - 1,
226
226
  // Doesn't append anything.
227
- N.empty,
227
+ F.empty,
228
228
  0,
229
229
  !1
230
230
  )
@@ -232,30 +232,30 @@ 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 = E(n), s = t.map(
237
+ (u) => Z(u, o)
238
238
  ), r = new Set(
239
239
  e.map(
240
240
  (u) => typeof u == "string" ? u : u.id
241
241
  )
242
- ), a = [], c = /* @__PURE__ */ new Set(), i = typeof e[0] == "string" ? e[0] : e[0].id;
243
- let l = 0;
244
- if (o.doc.descendants((u, p) => {
242
+ ), i = [], l = /* @__PURE__ */ new Set(), a = typeof e[0] == "string" ? e[0] : e[0].id;
243
+ let c = 0;
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 (i.push(C(u, o)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === a) {
250
+ const b = n.doc.nodeSize;
251
+ n.insert(p, s);
252
+ const g = n.doc.nodeSize;
253
+ c += 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;
258
- return l += m - k, !1;
255
+ const h = n.doc.nodeSize, f = n.doc.resolve(p - c);
256
+ f.node().type.name === "column" ? l.add(f.before(-1)) : f.node().type.name === "columnList" && l.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 - c, p - c + u.nodeSize);
257
+ const m = n.doc.nodeSize;
258
+ return c += h - m, !1;
259
259
  }), r.size > 0) {
260
260
  const u = [...r].join(`
261
261
  `);
@@ -263,32 +263,32 @@ 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)
268
- ), removedBlocks: a };
266
+ return l.forEach((u) => H(n, u)), { insertedBlocks: s.map(
267
+ (u) => C(u, o)
268
+ ), removedBlocks: i };
269
269
  }
270
- function Qt(o, e, t, n, s) {
270
+ function to(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 = V([e], n.pmSchema, o);
275
275
  else if (Array.isArray(e))
276
- r = O(e, o.pmSchema, n);
276
+ r = V(e, n.pmSchema, o);
277
277
  else if (e.type === "tableContent")
278
- r = Ue(e, o.pmSchema);
278
+ r = Ge(e, n.pmSchema);
279
279
  else
280
- throw new F(e.type);
280
+ throw new U(e.type);
281
281
  else throw new Error("blockContent is required");
282
- const c = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
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;
286
- if (l) {
287
- const d = U(
288
- i,
289
- o.schema.inlineContentSchema,
290
- o.schema.styleSchema
291
- ), u = l.render.call(
282
+ const l = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
283
+ for (const a of r)
284
+ if (a.type.name !== "text" && n.schema.inlineContentSchema[a.type.name]) {
285
+ const c = n.schema.inlineContentSpecs[a.type.name].implementation;
286
+ if (c) {
287
+ const d = q(
288
+ a,
289
+ n.schema.inlineContentSchema,
290
+ n.schema.styleSchema
291
+ ), u = c.render.call(
292
292
  {
293
293
  renderType: "dom",
294
294
  props: void 0
@@ -296,12 +296,12 @@ 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
- if (c.appendChild(u.dom), u.contentDOM) {
302
+ if (l.appendChild(u.dom), u.contentDOM) {
303
303
  const p = t.serializeFragment(
304
- i.content,
304
+ a.content,
305
305
  s
306
306
  );
307
307
  u.contentDOM.dataset.editable = "", u.contentDOM.appendChild(p);
@@ -309,368 +309,368 @@ function Qt(o, e, t, n, s) {
309
309
  continue;
310
310
  }
311
311
  }
312
- } else if (i.type.name === "text") {
313
- let l = document.createTextNode(
314
- i.textContent
312
+ } else if (a.type.name === "text") {
313
+ let c = document.createTextNode(
314
+ a.textContent
315
315
  );
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);
319
- u.contentDOM.appendChild(l), l = u.dom;
316
+ for (const d of a.marks.toReversed())
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
+ u.contentDOM.appendChild(c), c = u.dom;
320
320
  } else {
321
- const u = d.type.spec.toDOM(d, !0), p = he.renderSpec(document, u);
322
- p.contentDOM.appendChild(l), l = p.dom;
321
+ const u = d.type.spec.toDOM(d, !0), p = me.renderSpec(document, u);
322
+ p.contentDOM.appendChild(c), c = p.dom;
323
323
  }
324
- c.appendChild(l);
324
+ l.appendChild(c);
325
325
  } else {
326
- const l = t.serializeFragment(
327
- A.from([i]),
326
+ const c = t.serializeFragment(
327
+ w.from([a]),
328
328
  s
329
329
  );
330
- c.appendChild(l);
330
+ l.appendChild(c);
331
331
  }
332
- return c;
332
+ return l;
333
333
  }
334
- function Xt(o, e, t, n) {
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
334
+ function oo(n, e, t, o) {
335
+ var u, p, h, f, m;
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 i = e.children || [], a = n.blockImplementations[e.type].implementation.render.call(
342
342
  {
343
343
  renderType: "dom",
344
344
  props: void 0
345
345
  },
346
- { ...e, props: r, children: a },
347
- o
346
+ { ...e, props: r, children: i },
347
+ n
348
348
  );
349
- if (i.contentDOM && e.content) {
350
- const g = Qt(
351
- o,
349
+ if (a.contentDOM && e.content) {
350
+ const b = to(
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
+ a.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 = Se(
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 = a.contentDOM) == null || u.append(b);
369
369
  }
370
- return i.dom;
370
+ return a.dom;
371
371
  }
372
- const d = (m = (p = s.spec) == null ? void 0 : p.toDOM) == null ? void 0 : m.call(
372
+ const d = (h = (p = s.spec) == null ? void 0 : p.toDOM) == null ? void 0 : h.call(
373
373
  p,
374
374
  s.create({
375
375
  id: e.id,
376
376
  ...r
377
377
  })
378
378
  );
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)
379
+ return (f = d.contentDOM) == null || f.appendChild(a.dom), e.children && e.children.length > 0 && ((m = d.contentDOM) == null || m.appendChild(
380
+ xe(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();
385
- for (const a of e) {
386
- const c = Xt(o, a, t, n);
387
- r.appendChild(c);
383
+ function Se(n, e, t, o) {
384
+ const r = ((o == null ? void 0 : o.document) ?? document).createDocumentFragment();
385
+ for (const i of e) {
386
+ const l = oo(n, i, t, o);
387
+ r.appendChild(l);
388
388
  }
389
389
  return r;
390
390
  }
391
- const Ce = (o, e, t, n) => {
392
- var c;
393
- const s = o.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), a = Be(o, e, t, n);
394
- return (c = r.contentDOM) == null || c.appendChild(a), r.dom;
395
- }, Zt = (o) => (o.querySelectorAll(
391
+ const xe = (n, e, t, o) => {
392
+ var l;
393
+ const s = n.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), i = Se(n, e, t, o);
394
+ return (l = r.contentDOM) == null || l.appendChild(i), r.dom;
395
+ }, no = (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 i = o.getAttribute("data-index");
409
409
  t.setAttribute(
410
410
  "data-index",
411
- (parseInt(a || "0") + 1).toString()
411
+ (parseInt(i || "0") + 1).toString()
412
412
  );
413
413
  }
414
- }), o), eo = (o) => (o.querySelectorAll(
414
+ }), n), so = (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), ro = (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), io = (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: ${Xe}px;`
426
426
  ), t.setAttribute("data-show-children", "true");
427
- }), o), no = (o) => (o.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
427
+ }), n), ao = (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), co = (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,
442
- to,
443
- oo,
436
+ const o = document.createElement("span");
437
+ o.className = "ProseMirror-trailingBreak", o.setAttribute("style", "display: inline-block;"), t.appendChild(o);
438
+ }), n), lo = (n, e) => {
439
+ const t = me.fromSchema(n), o = [
444
440
  no,
445
- so
441
+ so,
442
+ ro,
443
+ io,
444
+ ao,
445
+ co
446
446
  ];
447
447
  return {
448
448
  serializeBlocks: (s, r) => {
449
- let a = Ce(
449
+ let i = xe(
450
450
  e,
451
451
  s,
452
452
  t,
453
453
  r
454
454
  );
455
- for (const c of n)
456
- a = c(a);
457
- return a.outerHTML;
455
+ for (const l of o)
456
+ i = l(i);
457
+ return i.outerHTML;
458
458
  }
459
459
  };
460
460
  };
461
- function ao(o) {
462
- return o.transact((e) => {
463
- const t = _(e.doc, e.selection.anchor);
464
- if (e.selection instanceof te)
461
+ function uo(n) {
462
+ return n.transact((e) => {
463
+ const t = D(e.doc, e.selection.anchor);
464
+ if (e.selection instanceof ne)
465
465
  return {
466
466
  type: "cell",
467
467
  anchorBlockId: t.node.attrs.id,
468
468
  anchorCellOffset: e.selection.$anchorCell.pos - t.posBeforeNode,
469
469
  headCellOffset: e.selection.$headCell.pos - t.posBeforeNode
470
470
  };
471
- if (e.selection instanceof L)
471
+ if (e.selection instanceof $)
472
472
  return {
473
473
  type: "node",
474
474
  anchorBlockId: t.node.attrs.id
475
475
  };
476
476
  {
477
- const n = _(e.doc, e.selection.head);
477
+ const o = D(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 po(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 = P(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 = ne.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 = $.create(n.doc, t + 1);
504
504
  else {
505
- const a = (r = x(e.headBlockId, o.doc)) == null ? void 0 : r.posBeforeNode;
506
- if (a === void 0)
505
+ const i = (r = P(e.headBlockId, n.doc)) == null ? void 0 : r.posBeforeNode;
506
+ if (i === 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 = S.create(
511
+ n.doc,
512
512
  t + e.anchorOffset,
513
- a + e.headOffset
513
+ i + 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 X(n) {
519
+ return n.map((e) => e.type === "columnList" ? e.children.map((t) => X(t.children)).flat() : {
520
520
  ...e,
521
- children: q(e.children)
521
+ children: X(e.children)
522
522
  }).flat();
523
523
  }
524
- function xe(o, e, t) {
525
- o.transact((n) => {
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);
524
+ function Ee(n, e, t) {
525
+ n.transact((o) => {
526
+ var i;
527
+ const s = ((i = n.getSelection()) == null ? void 0 : i.blocks) || [
528
+ n.getTextCursorPosition().block
529
+ ], r = uo(n);
530
+ n.removeBlocks(s), n.insertBlocks(X(s), e, t), po(o, r);
531
531
  });
532
532
  }
533
- function Ee(o) {
534
- return !o || o.type !== "columnList";
533
+ function Pe(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 Te(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 Pe(r) ? { referenceBlock: o, placement: s } : Te(
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 Me(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 Pe(r) ? { referenceBlock: o, placement: s } : Me(
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 fo(n) {
559
+ n.transact(() => {
560
+ const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || n.getTextCursorPosition().block, o = Te(
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 ho(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 = Me(
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 mo(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
591
591
  );
592
592
  if (!r)
593
593
  return !1;
594
- const a = r.startIndex;
595
- if (a === 0)
594
+ const i = r.startIndex;
595
+ if (i === 0)
596
596
  return !1;
597
- const i = r.parent.child(a - 1);
598
- if (i.type !== e)
597
+ const a = r.parent.child(i - 1);
598
+ if (a.type !== e)
599
599
  return !1;
600
- const l = i.lastChild && i.lastChild.type === t, d = A.from(l ? e.create() : null), u = new N(
601
- A.from(
602
- e.create(null, A.from(t.create(null, d)))
600
+ const c = a.lastChild && a.lastChild.type === t, d = w.from(c ? e.create() : null), u = new F(
601
+ w.from(
602
+ e.create(null, w.from(t.create(null, d)))
603
603
  // change necessary to create "groupType" instead of parent.type
604
604
  ),
605
- l ? 3 : 1,
605
+ c ? 3 : 1,
606
606
  0
607
- ), p = r.start, m = r.end;
608
- return o.step(
609
- new V(
610
- p - (l ? 3 : 1),
611
- m,
607
+ ), p = r.start, h = r.end;
608
+ return n.step(
609
+ new W(
610
+ p - (c ? 3 : 1),
611
+ h,
612
612
  p,
613
- m,
613
+ h,
614
614
  u,
615
615
  1,
616
616
  !0
617
617
  )
618
618
  ).scrollIntoView(), !0;
619
619
  }
620
- function Te(o) {
621
- return o.transact((e) => uo(
620
+ function we(n) {
621
+ return n.transact((e) => mo(
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 ko(n) {
628
+ n._tiptapEditor.commands.liftListItem("blockContainer");
629
629
  }
630
- function fo(o) {
631
- return o.transact((e) => {
632
- const { bnBlock: t } = $(e);
630
+ function bo(n) {
631
+ return n.transact((e) => {
632
+ const { bnBlock: t } = z(e);
633
633
  return e.doc.resolve(t.beforePos).nodeBefore !== null;
634
634
  });
635
635
  }
636
- function ho(o) {
637
- return o.transact((e) => {
638
- const { bnBlock: t } = $(e);
636
+ function go(n) {
637
+ return n.transact((e) => {
638
+ const { bnBlock: t } = z(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 = E(n), s = P(t, n);
644
644
  if (s)
645
- return b(s.node, n);
645
+ return C(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 yo(n, e) {
648
+ const t = typeof e == "string" ? e : e.id, o = P(t, n), s = E(n);
649
+ if (!o)
650
650
  return;
651
- const a = o.resolve(n.posBeforeNode).nodeBefore;
652
- if (a)
653
- return b(a, s);
651
+ const i = n.resolve(o.posBeforeNode).nodeBefore;
652
+ if (i)
653
+ return C(i, 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 Co(n, e) {
656
+ const t = typeof e == "string" ? e : e.id, o = P(t, n), s = E(n);
657
+ if (!o)
658
658
  return;
659
- const a = o.resolve(
660
- n.posBeforeNode + n.node.nodeSize
659
+ const i = n.resolve(
660
+ o.posBeforeNode + o.node.nodeSize
661
661
  ).nodeAfter;
662
- if (a)
663
- return b(a, s);
662
+ if (i)
663
+ return C(i, 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 = E(n), s = P(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;
670
- if (i)
671
- return b(i, n);
669
+ const r = n.resolve(s.posBeforeNode), i = r.node(), l = r.node(-1), a = l.type.name !== "doc" ? i.type.name === "blockGroup" ? l : i : void 0;
670
+ if (a)
671
+ return C(a, o);
672
672
  }
673
- class yo {
673
+ class xo {
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) => je(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) => yo(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) => Co(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,19 +732,19 @@ 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
- for (const a of r) {
739
- if (e(a) === !1)
738
+ for (const i of r) {
739
+ if (e(i) === !1)
740
740
  return !1;
741
- const c = t ? a.children.slice().reverse() : a.children;
742
- if (!s(c))
741
+ const l = t ? i.children.slice().reverse() : i.children;
742
+ if (!s(l))
743
743
  return !1;
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) => Zt(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) => Ze(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,32 +787,32 @@ 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 bo(this.editor);
798
798
  }
799
799
  /**
800
800
  * Nests the block containing the text cursor into the block above it.
801
801
  */
802
802
  nestBlock() {
803
- Te(this.editor);
803
+ we(this.editor);
804
804
  }
805
805
  /**
806
806
  * Checks if the block containing the text cursor is nested.
807
807
  */
808
808
  canUnnestBlock() {
809
- return ho(this.editor);
809
+ return go(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
+ ko(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 fo(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 ho(this.editor);
832
832
  }
833
833
  }
834
- class So extends Se {
834
+ class Eo extends Ce {
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
- !t && ie(s) || e(this.editor, {
859
+ !t && ce(s) || e(this.editor, {
860
860
  getChanges() {
861
- return nt(
861
+ return it(
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) => {
877
- !t && ie(s.transaction) || e(this.editor);
876
+ const o = (s) => {
877
+ !t && ce(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 ce(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 Po(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 To(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 = Po(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 (To(r))
918
918
  return;
919
- const a = document.createElement("li");
920
- a.append(r), e.insertAdjacentElement("afterend", a);
921
- }), n.childNodes.length === 0 && n.remove();
919
+ const i = document.createElement("li");
920
+ i.append(r), e.insertAdjacentElement("afterend", i);
921
+ }), o.childNodes.length === 0 && o.remove();
922
922
  });
923
923
  }
924
- function Eo(o) {
925
- o.querySelectorAll("li + ul, li + ol").forEach((e) => {
926
- var r, a;
927
- const t = e.previousElementSibling, n = document.createElement("div");
928
- t.insertAdjacentElement("afterend", n), n.append(t);
924
+ function wo(n) {
925
+ n.querySelectorAll("li + ul, li + ol").forEach((e) => {
926
+ var r, i;
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" || ((i = o.nextElementSibling) == null ? void 0 : i.nodeName) === "OL"; )
931
+ s.append(o.nextElementSibling);
932
932
  });
933
933
  }
934
- let ce = null;
935
- function wo() {
936
- return ce || (ce = document.implementation.createHTMLDocument("title"));
934
+ let le = null;
935
+ function vo() {
936
+ return le || (le = 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 Io(n) {
939
+ if (typeof n == "string") {
940
+ const e = vo().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 ve(n, e) {
946
+ const t = Io(n), s = Ue.fromSchema(e).parse(t, {
947
947
  topNode: e.nodes.blockGroup.create()
948
948
  }), r = [];
949
- for (let a = 0; a < s.childCount; a++)
950
- r.push(b(s.child(a), e));
949
+ for (let i = 0; i < s.childCount; i++)
950
+ r.push(C(s.child(i), 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 Ao(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 No(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 Ie(n) {
986
+ return Yt().use(qt).use(Wt).use(Kt, {
987
987
  handlers: {
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);
988
+ ...ie,
989
+ image: (t, o) => {
990
+ const s = String((o == null ? void 0 : o.url) || "");
991
+ return et(s) ? No(t, o) : ie.image(t, o);
992
992
  },
993
- code: To,
994
- blockquote: (t, n) => {
993
+ code: Ao,
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(Jt).processSync(n).value;
1006
1006
  }
1007
- function vo(o, e) {
1008
- const t = ve(o);
1009
- return Pe(t, e);
1007
+ function _o(n, e) {
1008
+ const t = Ie(n);
1009
+ return ve(t, e);
1010
1010
  }
1011
- class Io {
1011
+ class Lo {
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 Be(
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 lo(
1039
1039
  this.editor.pmSchema,
1040
1040
  this.editor
1041
1041
  ).serializeBlocks(e, {});
@@ -1048,7 +1048,7 @@ class Io {
1048
1048
  * @returns The blocks parsed from the HTML string.
1049
1049
  */
1050
1050
  tryParseHTMLToBlocks(e) {
1051
- return Pe(e, this.editor.pmSchema);
1051
+ return ve(e, this.editor.pmSchema);
1052
1052
  }
1053
1053
  /**
1054
1054
  * Serializes blocks into a Markdown string. The output is simplified as Markdown does not support all features of
@@ -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 at(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 _o(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.
@@ -1096,11 +1096,11 @@ class Io {
1096
1096
  * @param markdown The markdown to paste.
1097
1097
  */
1098
1098
  pasteMarkdown(e) {
1099
- const t = ve(e);
1099
+ const t = Ie(e);
1100
1100
  return this.pasteHTML(t);
1101
1101
  }
1102
1102
  }
1103
- const oe = [
1103
+ const se = [
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 Oo(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 de(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 Ae(n, e) {
1133
1133
  var r;
1134
1134
  if (!e.uploadFile) {
1135
1135
  console.warn(
@@ -1137,67 +1137,67 @@ 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)
1145
- if (t.types.includes(a)) {
1146
- n = a;
1143
+ let o = null;
1144
+ for (const i of se)
1145
+ if (t.types.includes(i)) {
1146
+ o = i;
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();
1154
- for (let a = 0; a < s.length; a++) {
1155
- let c = "file";
1156
- for (const l of Object.values(e.schema.blockSpecs))
1157
- for (const d of ((r = l.implementation.meta) == null ? void 0 : r.fileBlockAccept) || []) {
1158
- const u = d.startsWith("."), p = s[a].getAsFile();
1159
- if (p && (!u && p.type && _o(s[a].type, d) || u && Ao(
1153
+ n.preventDefault();
1154
+ for (let i = 0; i < s.length; i++) {
1155
+ let l = "file";
1156
+ for (const c of Object.values(e.schema.blockSpecs))
1157
+ for (const d of ((r = c.implementation.meta) == null ? void 0 : r.fileBlockAccept) || []) {
1158
+ const u = d.startsWith("."), p = s[i].getAsFile();
1159
+ if (p && (!u && p.type && Oo(s[i].type, d) || u && Do(
1160
1160
  "." + p.name.split(".").pop(),
1161
1161
  d
1162
1162
  ))) {
1163
- c = l.config.type;
1163
+ l = c.config.type;
1164
1164
  break;
1165
1165
  }
1166
1166
  }
1167
- const i = s[a].getAsFile();
1168
- if (i) {
1169
- const l = {
1170
- type: c,
1167
+ const a = s[i].getAsFile();
1168
+ if (a) {
1169
+ const c = {
1170
+ type: l,
1171
1171
  props: {
1172
- name: i.name
1172
+ name: a.name
1173
1173
  }
1174
1174
  };
1175
1175
  let d;
1176
- if (o.type === "paste") {
1177
- const m = e.getTextCursorPosition().block;
1178
- d = le(e, m, l);
1179
- } else if (o.type === "drop") {
1180
- const m = {
1181
- left: o.clientX,
1182
- top: o.clientY
1183
- }, f = e.prosemirrorView.posAtCoords(m);
1176
+ if (n.type === "paste") {
1177
+ const h = e.getTextCursorPosition().block;
1178
+ d = de(e, h, c);
1179
+ } else if (n.type === "drop") {
1180
+ const h = {
1181
+ left: n.clientX,
1182
+ top: n.clientY
1183
+ }, f = e.prosemirrorView.posAtCoords(h);
1184
1184
  if (!f)
1185
1185
  return;
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();
1191
- return le(
1186
+ d = e.transact((m) => {
1187
+ var y;
1188
+ const b = D(m.doc, f.pos), g = (y = e.domElement) == null ? void 0 : y.querySelector(
1189
+ `[data-id="${b.node.attrs.id}"]`
1190
+ ), x = g == null ? void 0 : g.getBoundingClientRect();
1191
+ return de(
1192
1192
  e,
1193
- e.getBlock(g.node.attrs.id),
1194
- l,
1195
- T && (T.top + T.bottom) / 2 > m.top ? "before" : "after"
1193
+ e.getBlock(b.node.attrs.id),
1194
+ c,
1195
+ x && (x.top + x.bottom) / 2 > h.top ? "before" : "after"
1196
1196
  );
1197
1197
  });
1198
1198
  } else
1199
1199
  return;
1200
- const u = await e.uploadFile(i, d), p = typeof u == "string" ? {
1200
+ const u = await e.uploadFile(a, d), p = typeof u == "string" ? {
1201
1201
  props: {
1202
1202
  url: u
1203
1203
  }
@@ -1207,104 +1207,104 @@ async function Ie(o, e) {
1207
1207
  }
1208
1208
  }
1209
1209
  }
1210
- const Do = (o) => E.create({
1210
+ const $o = (n) => T.create({
1211
1211
  name: "dropFile",
1212
1212
  addProseMirrorPlugins() {
1213
1213
  return [
1214
- new ee({
1214
+ new oe({
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 se)
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" ? (Ae(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
+ }), Ho = /(^|\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)/, Vo = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Uo = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, zo = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Ro = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, Go = /\n{2} {0,3}-{2,48}\n{2}/, jo = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, Wo = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, qo = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Ko = /^\s*\|(.+\|)+\s*$/m, Jo = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Yo = /^\s*\|(.+\|)+\s*$/m, Qo = (n) => Ho.test(n) || Fo.test(n) || Vo.test(n) || Uo.test(n) || zo.test(n) || Ro.test(n) || Go.test(n) || jo.test(n) || Wo.test(n) || qo.test(n) || Ko.test(n) || Jo.test(n) || Yo.test(n);
1234
+ async function Xo(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;
1244
- return a ? (e.pasteHTML(
1245
- `<pre><code class="language-${a}">${n.replace(
1242
+ return e.pasteText(o), !0;
1243
+ const s = n.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0, i = r == null ? void 0 : r.mode;
1244
+ return i ? (e.pasteHTML(
1245
+ `<pre><code class="language-${i}">${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 Zo({
1253
+ event: n,
1254
1254
  editor: e,
1255
1255
  prioritizeMarkdownOverHTML: t,
1256
- plainTextAsMarkdown: n
1256
+ plainTextAsMarkdown: o
1257
1257
  }) {
1258
- var c;
1258
+ var l;
1259
1259
  if (e.transact(
1260
- (i) => i.selection.$from.parent.type.spec.code && i.selection.$to.parent.type.spec.code
1260
+ (a) => a.selection.$from.parent.type.spec.code && a.selection.$to.parent.type.spec.code
1261
1261
  )) {
1262
- const i = (c = o.clipboardData) == null ? void 0 : c.getData("text/plain");
1263
- if (i)
1264
- return e.pasteText(i), !0;
1262
+ const a = (l = n.clipboardData) == null ? void 0 : l.getData("text/plain");
1263
+ if (a)
1264
+ return e.pasteText(a), !0;
1265
1265
  }
1266
1266
  let r;
1267
- for (const i of oe)
1268
- if (o.clipboardData.types.includes(i)) {
1269
- r = i;
1267
+ for (const a of se)
1268
+ if (n.clipboardData.types.includes(a)) {
1269
+ r = a;
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 Xo(n, e.prosemirrorView), !0;
1276
1276
  if (r === "Files")
1277
- return Ie(o, e), !0;
1278
- const a = o.clipboardData.getData(r);
1277
+ return Ae(n, e), !0;
1278
+ const i = n.clipboardData.getData(r);
1279
1279
  if (r === "blocknote/html")
1280
- return e.pasteHTML(a, !0), !0;
1280
+ return e.pasteHTML(i, !0), !0;
1281
1281
  if (r === "text/markdown")
1282
- return e.pasteMarkdown(a), !0;
1282
+ return e.pasteMarkdown(i), !0;
1283
1283
  if (t) {
1284
- const i = o.clipboardData.getData("text/plain");
1285
- if (qo(i))
1286
- return e.pasteMarkdown(i), !0;
1284
+ const a = n.clipboardData.getData("text/plain");
1285
+ if (Qo(a))
1286
+ return e.pasteMarkdown(a), !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(i), !0) : o ? (e.pasteMarkdown(i), !0) : (e.pasteText(i), !0);
1289
1289
  }
1290
- const Yo = (o, e) => E.create({
1290
+ const en = (n, e) => T.create({
1291
1291
  name: "pasteFromClipboard",
1292
1292
  addProseMirrorPlugins() {
1293
1293
  return [
1294
- new ee({
1294
+ new oe({
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
+ } = {}) => Zo({
1306
+ event: o,
1307
+ editor: n,
1308
1308
  prioritizeMarkdownOverHTML: s,
1309
1309
  plainTextAsMarkdown: r
1310
1310
  })
@@ -1316,96 +1316,96 @@ const Yo = (o, e) => E.create({
1316
1316
  ];
1317
1317
  }
1318
1318
  });
1319
- function Qo(o, e, t) {
1320
- var c;
1321
- let n = !1;
1322
- const s = o.state.selection instanceof te;
1319
+ function tn(n, e, t) {
1320
+ var l;
1321
+ let o = !1;
1322
+ const s = n.state.selection instanceof ne;
1323
1323
  if (!s) {
1324
- const i = o.state.doc.slice(
1325
- o.state.selection.from,
1326
- o.state.selection.to,
1324
+ const a = n.state.doc.slice(
1325
+ n.state.selection.from,
1326
+ n.state.selection.to,
1327
1327
  !1
1328
- ).content, l = [];
1329
- for (let d = 0; d < i.childCount; d++)
1330
- l.push(i.child(d));
1331
- n = l.find(
1328
+ ).content, c = [];
1329
+ for (let d = 0; d < a.childCount; d++)
1330
+ c.push(a.child(d));
1331
+ o = c.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 = a);
1334
1334
  }
1335
1335
  let r;
1336
- const a = be(
1337
- o.state.schema,
1336
+ const i = Be(
1337
+ n.state.schema,
1338
1338
  t
1339
1339
  );
1340
1340
  if (s) {
1341
- ((c = e.firstChild) == null ? void 0 : c.type.name) === "table" && (e = e.firstChild.content);
1342
- const i = Ge(
1341
+ ((l = e.firstChild) == null ? void 0 : l.type.name) === "table" && (e = e.firstChild.content);
1342
+ const a = We(
1343
1343
  e,
1344
1344
  t.schema.inlineContentSchema,
1345
1345
  t.schema.styleSchema
1346
1346
  );
1347
- r = `<table>${a.exportInlineContent(
1348
- i,
1347
+ r = `<table>${i.exportInlineContent(
1348
+ a,
1349
1349
  {}
1350
1350
  )}</table>`;
1351
- } else if (n) {
1352
- const i = Re(
1351
+ } else if (o) {
1352
+ const a = qe(
1353
1353
  e,
1354
1354
  t.schema.inlineContentSchema,
1355
1355
  t.schema.styleSchema
1356
1356
  );
1357
- r = a.exportInlineContent(i, {});
1357
+ r = i.exportInlineContent(a, {});
1358
1358
  } else {
1359
- const i = at(e);
1360
- r = a.exportBlocks(i, {});
1359
+ const a = lt(e);
1360
+ r = i.exportBlocks(a, {});
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(
1366
- (a) => a.setSelection(
1367
- new L(a.doc.resolve(o.state.selection.from - 1))
1364
+ function Ne(n, e) {
1365
+ "node" in n.state.selection && n.state.selection.node.type.spec.group === "blockContent" && e.transact(
1366
+ (i) => i.setSelection(
1367
+ new $(i.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 = tn(
1374
1373
  n,
1374
+ o,
1375
1375
  e
1376
- ), r = rt(s);
1376
+ ), r = ct(s);
1377
1377
  return { clipboardHTML: t, externalHTML: s, markdown: r };
1378
1378
  }
1379
- const de = () => {
1380
- const o = window.getSelection();
1381
- if (!o || o.isCollapsed)
1379
+ const ue = () => {
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
+ }, pe = (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 } = Ne(
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
+ }, on = (n) => T.create({
1398
1398
  name: "copyToClipboard",
1399
1399
  addProseMirrorPlugins() {
1400
1400
  return [
1401
- new ee({
1401
+ new oe({
1402
1402
  props: {
1403
1403
  handleDOMEvents: {
1404
1404
  copy(e, t) {
1405
- return de() || ue(o, e, t), !0;
1405
+ return ue() || pe(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 ue() || (pe(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(
1417
- (a) => a.setSelection(
1418
- new L(
1419
- a.doc.resolve(e.state.selection.from - 1)
1416
+ n.transact(
1417
+ (i) => i.setSelection(
1418
+ new $(
1419
+ i.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 } = Ne(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
+ }), nn = T.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: tt()
1439
1439
  }
1440
1440
  }
1441
1441
  ];
1442
1442
  }
1443
- }), en = D.create({
1443
+ }), sn = O.create({
1444
1444
  name: "hardBreak",
1445
1445
  inline: !0,
1446
1446
  group: "inline",
@@ -1450,89 +1450,103 @@ 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
+ }), _e = (n, e) => {
1461
+ var l;
1462
+ const t = n.resolve(e), o = t.depth - 1, s = t.before(o), r = n.resolve(s).nodeAfter;
1463
+ return r ? (l = r.type.spec.group) != null && l.includes("bnBlock") ? v(
1464
+ n.resolve(s)
1465
+ ) : _e(n, s) : void 0;
1466
+ }, L = (n, e) => {
1467
+ const t = n.resolve(e), o = t.index();
1468
+ if (o === 0)
1469
+ return;
1470
+ const s = t.posAtIndex(o - 1);
1471
+ return v(
1472
+ n.resolve(s)
1473
+ );
1474
+ }, _ = (n, e) => {
1475
+ const t = n.resolve(e), o = t.index();
1476
+ if (o === t.node().childCount - 1)
1463
1477
  return;
1464
- const s = t.posAtIndex(n - 1);
1465
- return Y(
1466
- o.resolve(s)
1478
+ const s = t.posAtIndex(o + 1);
1479
+ return v(
1480
+ n.resolve(s)
1467
1481
  );
1468
- }, _e = (o, e) => {
1482
+ }, Le = (n, e) => {
1469
1483
  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));
1484
+ const t = e.childContainer.node, o = n.resolve(e.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
1485
+ e = v(n.resolve(o));
1472
1486
  }
1473
1487
  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)
1488
+ }, rn = (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*", an = (n, e, t, o) => {
1489
+ if (!o.isBlockContainer)
1476
1490
  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`
1491
+ `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
1492
  );
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
1484
- ), a = s.blockRange(r);
1493
+ if (o.childContainer) {
1494
+ const s = n.doc.resolve(
1495
+ o.childContainer.beforePos + 1
1496
+ ), r = n.doc.resolve(
1497
+ o.childContainer.afterPos - 1
1498
+ ), i = s.blockRange(r);
1485
1499
  if (e) {
1486
- const c = o.doc.resolve(n.bnBlock.beforePos);
1487
- o.tr.lift(a, c.depth);
1500
+ const l = n.doc.resolve(o.bnBlock.beforePos);
1501
+ n.tr.lift(i, l.depth);
1488
1502
  }
1489
1503
  }
1490
1504
  if (e) {
1491
1505
  if (!t.isBlockContainer)
1492
1506
  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`
1507
+ `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
1508
  );
1495
1509
  e(
1496
- o.tr.delete(
1510
+ n.tr.delete(
1497
1511
  t.blockContent.afterPos - 1,
1498
- n.blockContent.beforePos + 1
1512
+ o.blockContent.beforePos + 1
1499
1513
  )
1500
1514
  );
1501
1515
  }
1502
1516
  return !0;
1503
- }, pe = (o) => ({
1517
+ }, fe = (n) => ({
1504
1518
  state: e,
1505
1519
  dispatch: t
1506
1520
  }) => {
1507
- const n = e.doc.resolve(o), s = Y(n), r = K(
1521
+ const o = e.doc.resolve(n), s = v(o), r = L(
1508
1522
  e.doc,
1509
1523
  s.bnBlock.beforePos
1510
1524
  );
1511
1525
  if (!r)
1512
1526
  return !1;
1513
- const a = _e(
1527
+ const i = Le(
1514
1528
  e.doc,
1515
1529
  r
1516
1530
  );
1517
- return tn(a, s) ? on(e, t, a, s) : !1;
1518
- }, nn = E.create({
1531
+ return rn(i, s) ? an(e, t, i, s) : !1;
1532
+ }, cn = T.create({
1519
1533
  priority: 50,
1520
1534
  // TODO: The shortcuts need a refactor. Do we want to use a command priority
1521
1535
  // design as there is now, or clump the logic into a single function?
1522
1536
  addKeyboardShortcuts() {
1523
- const o = () => this.editor.commands.first(({ chain: n, commands: s }) => [
1537
+ const n = () => this.editor.commands.first(({ chain: o, commands: s }) => [
1524
1538
  // Deletes the selection if it's not empty.
1525
1539
  () => s.deleteSelection(),
1526
1540
  // Undoes an input rule if one was triggered in the last editor state change.
1527
1541
  () => s.undoInputRule(),
1528
1542
  // Reverts block content type to a paragraph if the selection is at the start of the block.
1529
1543
  () => s.command(({ state: r }) => {
1530
- const a = B(r);
1531
- if (!a.isBlockContainer)
1544
+ const i = B(r);
1545
+ if (!i.isBlockContainer)
1532
1546
  return !1;
1533
- const c = r.selection.from === a.blockContent.beforePos + 1, i = a.blockContent.node.type.name === "paragraph";
1534
- return c && !i ? s.command(
1535
- et(a.bnBlock.beforePos, {
1547
+ const l = r.selection.from === i.blockContent.beforePos + 1, a = i.blockContent.node.type.name === "paragraph";
1548
+ return l && !a ? s.command(
1549
+ nt(i.bnBlock.beforePos, {
1536
1550
  type: "paragraph",
1537
1551
  props: {}
1538
1552
  })
@@ -1540,76 +1554,104 @@ const de = () => {
1540
1554
  }),
1541
1555
  // Removes a level of nesting if the block is indented if the selection is at the start of the block.
1542
1556
  () => s.command(({ state: r }) => {
1543
- const a = B(r);
1544
- if (!a.isBlockContainer)
1557
+ const i = B(r);
1558
+ if (!i.isBlockContainer)
1545
1559
  return !1;
1546
- const { blockContent: c } = a;
1547
- return r.selection.from === c.beforePos + 1 ? s.liftListItem("blockContainer") : !1;
1560
+ const { blockContent: l } = i;
1561
+ return r.selection.from === l.beforePos + 1 ? s.liftListItem("blockContainer") : !1;
1548
1562
  }),
1549
1563
  // Merges block with the previous one if it isn't indented, and the selection is at the start of the
1550
1564
  // block. The target block for merging must contain inline content.
1551
1565
  () => s.command(({ state: r }) => {
1566
+ const i = B(r);
1567
+ if (!i.isBlockContainer)
1568
+ return !1;
1569
+ const { bnBlock: l, blockContent: a } = i, c = L(
1570
+ r.doc,
1571
+ i.bnBlock.beforePos
1572
+ );
1573
+ if (!c || !c.isBlockContainer || c.blockContent.node.type.spec.content !== "inline*")
1574
+ return !1;
1575
+ const d = r.selection.from === a.beforePos + 1, u = r.selection.empty, p = l.beforePos;
1576
+ return d && u ? o().command(fe(p)).scrollIntoView().run() : !1;
1577
+ }),
1578
+ // If the previous block is a columnList, moves the current block to
1579
+ // the end of the last column in it.
1580
+ () => s.command(({ state: r, tr: i, dispatch: l }) => {
1552
1581
  const a = B(r);
1553
1582
  if (!a.isBlockContainer)
1554
1583
  return !1;
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;
1584
+ const c = L(
1585
+ r.doc,
1586
+ a.bnBlock.beforePos
1587
+ );
1588
+ if (!c || c.isBlockContainer)
1589
+ return !1;
1590
+ if (l) {
1591
+ const d = c.bnBlock.afterPos - 1, u = i.doc.resolve(d - 1);
1592
+ return i.delete(
1593
+ a.bnBlock.beforePos,
1594
+ a.bnBlock.afterPos
1595
+ ), i.insert(u.pos, a.bnBlock.node), i.setSelection(
1596
+ S.near(i.doc.resolve(u.pos + 1))
1597
+ ), !0;
1598
+ }
1599
+ return !1;
1557
1600
  }),
1558
- () => s.command(({ state: r, tr: a, dispatch: c }) => {
1559
- const i = B(r);
1560
- if (!i.isBlockContainer || !(a.selection.from === i.blockContent.beforePos + 1))
1601
+ // If the block is the first in a column, moves it to the end of the
1602
+ // previous column. If there is no previous column, moves it above the
1603
+ // columnList.
1604
+ () => s.command(({ state: r, tr: i, dispatch: l }) => {
1605
+ const a = B(r);
1606
+ if (!a.isBlockContainer || !(i.selection.from === a.blockContent.beforePos + 1))
1561
1607
  return !1;
1562
- const d = a.doc.resolve(i.bnBlock.beforePos);
1608
+ const d = i.doc.resolve(a.bnBlock.beforePos);
1563
1609
  if (d.nodeBefore || d.node().type.name !== "column")
1564
1610
  return !1;
1565
- const m = a.doc.resolve(i.bnBlock.beforePos), f = a.doc.resolve(m.before()), k = f.before();
1566
- if (c) {
1567
- const g = a.doc.slice(
1568
- i.bnBlock.beforePos,
1569
- i.bnBlock.afterPos
1570
- ).content;
1571
- a.delete(
1572
- i.bnBlock.beforePos,
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));
1579
- }
1580
- return !0;
1611
+ const h = i.doc.resolve(a.bnBlock.beforePos), f = i.doc.resolve(h.before()), m = f.before();
1612
+ return l && (i.delete(
1613
+ a.bnBlock.beforePos,
1614
+ a.bnBlock.afterPos
1615
+ ), H(i, m), f.pos === m + 1 ? (i.insert(m, a.bnBlock.node), i.setSelection(
1616
+ S.near(i.doc.resolve(m))
1617
+ )) : (i.insert(f.pos - 1, a.bnBlock.node), i.setSelection(
1618
+ S.near(i.doc.resolve(f.pos))
1619
+ ))), !0;
1581
1620
  }),
1582
1621
  // Deletes the current block if it's an empty block with inline content,
1583
1622
  // and moves the selection to the previous block.
1584
1623
  () => s.command(({ state: r }) => {
1585
- const a = B(r);
1586
- if (!a.isBlockContainer)
1624
+ var a;
1625
+ const i = B(r);
1626
+ if (!i.isBlockContainer)
1587
1627
  return !1;
1588
- if (a.blockContent.node.childCount === 0 && a.blockContent.node.type.spec.content === "inline*") {
1589
- const i = K(
1628
+ if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
1629
+ const c = L(
1590
1630
  r.doc,
1591
- a.bnBlock.beforePos
1631
+ i.bnBlock.beforePos
1592
1632
  );
1593
- if (!i || !i.isBlockContainer)
1633
+ if (!c || !c.isBlockContainer)
1594
1634
  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
1635
+ let d = o();
1636
+ if (i.childContainer && d.insertContentAt(
1637
+ i.bnBlock.afterPos,
1638
+ (a = i.childContainer) == null ? void 0 : a.node.content
1639
+ ), c.blockContent.node.type.spec.content === "tableRow+") {
1640
+ const m = i.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
1641
+ d = d.setTextSelection(
1642
+ m
1600
1643
  );
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
1644
+ } else if (c.blockContent.node.type.spec.content === "")
1645
+ d = d.setNodeSelection(
1646
+ c.blockContent.beforePos
1605
1647
  );
1606
- } else {
1607
- const d = i.blockContent.afterPos - i.blockContent.node.nodeSize;
1608
- l = l.setTextSelection(d);
1648
+ else {
1649
+ const u = c.blockContent.afterPos - 1;
1650
+ d = d.setTextSelection(u);
1609
1651
  }
1610
- return l.deleteRange({
1611
- from: a.bnBlock.beforePos,
1612
- to: a.bnBlock.afterPos
1652
+ return d.deleteRange({
1653
+ from: i.bnBlock.beforePos,
1654
+ to: i.bnBlock.afterPos
1613
1655
  }).scrollIntoView().run();
1614
1656
  }
1615
1657
  return !1;
@@ -1618,25 +1660,25 @@ const de = () => {
1618
1660
  // when the selection is empty and at the start of the block. Moves the
1619
1661
  // current block into the deleted block's place.
1620
1662
  () => s.command(({ state: r }) => {
1621
- const a = B(r);
1622
- if (!a.isBlockContainer)
1623
- throw new Error("todo");
1624
- const c = r.selection.from === a.blockContent.beforePos + 1, i = r.selection.empty, l = K(
1663
+ const i = B(r);
1664
+ if (!i.isBlockContainer)
1665
+ return !1;
1666
+ const l = r.selection.from === i.blockContent.beforePos + 1, a = r.selection.empty, c = L(
1625
1667
  r.doc,
1626
- a.bnBlock.beforePos
1668
+ i.bnBlock.beforePos
1627
1669
  );
1628
- if (l && c && i) {
1629
- const d = _e(
1670
+ if (c && l && a) {
1671
+ const d = Le(
1630
1672
  r.doc,
1631
- l
1673
+ c
1632
1674
  );
1633
1675
  if (!d.isBlockContainer)
1634
- throw new Error("todo");
1676
+ return !1;
1635
1677
  if (d.blockContent.node.type.spec.content === "" || d.blockContent.node.type.spec.content === "inline*" && d.blockContent.node.childCount === 0)
1636
- return n().cut(
1678
+ return o().cut(
1637
1679
  {
1638
- from: a.bnBlock.beforePos,
1639
- to: a.bnBlock.afterPos
1680
+ from: i.bnBlock.beforePos,
1681
+ to: i.bnBlock.afterPos
1640
1682
  },
1641
1683
  d.bnBlock.afterPos
1642
1684
  ).deleteRange({
@@ -1646,51 +1688,228 @@ const de = () => {
1646
1688
  }
1647
1689
  return !1;
1648
1690
  })
1649
- ]), e = () => this.editor.commands.first(({ commands: n }) => [
1691
+ ]), e = () => this.editor.commands.first(({ chain: o, commands: s }) => [
1650
1692
  // Deletes the selection if it's not empty.
1651
- () => n.deleteSelection(),
1693
+ () => s.deleteSelection(),
1694
+ // Deletes the first child block and un-nests its children, if the
1695
+ // selection is empty and at the end of the current block. If both the
1696
+ // parent and child blocks have inline content, the child block's
1697
+ // content is appended to the parent's. The child block's own children
1698
+ // are unindented before it's deleted.
1699
+ () => s.command(({ state: r }) => {
1700
+ var p;
1701
+ const i = B(r);
1702
+ if (!i.isBlockContainer || !i.childContainer)
1703
+ return !1;
1704
+ const { blockContent: l, childContainer: a } = i, c = r.selection.from === l.afterPos - 1, d = r.selection.empty, u = v(
1705
+ r.doc.resolve(a.beforePos + 1)
1706
+ );
1707
+ if (!u.isBlockContainer)
1708
+ return !1;
1709
+ if (c && d) {
1710
+ const h = u.blockContent.node, f = h.type.spec.content === "inline*", m = l.node.type.spec.content === "inline*";
1711
+ return o().insertContentAt(
1712
+ u.bnBlock.afterPos,
1713
+ ((p = u.childContainer) == null ? void 0 : p.node.content) || w.empty
1714
+ ).deleteRange(
1715
+ // Deletes whole child container if there's only one child.
1716
+ a.node.childCount === 1 ? {
1717
+ from: a.beforePos,
1718
+ to: a.afterPos
1719
+ } : {
1720
+ from: u.bnBlock.beforePos,
1721
+ to: u.bnBlock.afterPos
1722
+ }
1723
+ ).insertContentAt(
1724
+ r.selection.from,
1725
+ f && m ? h.content : null
1726
+ ).setTextSelection(r.selection.from).scrollIntoView().run();
1727
+ }
1728
+ return !1;
1729
+ }),
1652
1730
  // Merges block with the next one (at the same nesting level or lower),
1653
1731
  // if one exists, the block has no children, and the selection is at the
1654
1732
  // end of the block.
1655
- () => n.command(({ state: s }) => {
1656
- const r = B(s);
1657
- if (!r.isBlockContainer)
1733
+ () => s.command(({ state: r }) => {
1734
+ const i = B(r);
1735
+ if (!i.isBlockContainer)
1736
+ return !1;
1737
+ const { bnBlock: l, blockContent: a } = i, c = _(
1738
+ r.doc,
1739
+ i.bnBlock.beforePos
1740
+ );
1741
+ if (!c || !c.isBlockContainer)
1742
+ return !1;
1743
+ const d = r.selection.from === a.afterPos - 1, u = r.selection.empty, p = l.afterPos;
1744
+ return d && u ? o().command(fe(p)).scrollIntoView().run() : !1;
1745
+ }),
1746
+ // If the previous block is a columnList, moves the current block to
1747
+ // the end of the last column in it.
1748
+ () => s.command(({ state: r, tr: i, dispatch: l }) => {
1749
+ const a = B(r);
1750
+ if (!a.isBlockContainer)
1658
1751
  return !1;
1659
- const {
1660
- bnBlock: a,
1661
- blockContent: c,
1662
- childContainer: i
1663
- } = 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
- 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));
1752
+ const c = _(
1753
+ r.doc,
1754
+ a.bnBlock.beforePos
1755
+ );
1756
+ if (!c || c.isBlockContainer)
1757
+ return !1;
1758
+ if (l) {
1759
+ const d = c.bnBlock.beforePos + 1, u = i.doc.resolve(d + 1);
1760
+ return i.delete(
1761
+ u.pos,
1762
+ u.pos + u.nodeAfter.nodeSize
1763
+ ), H(i, c.bnBlock.beforePos), i.insert(a.bnBlock.afterPos, u.nodeAfter), i.setSelection(
1764
+ S.near(i.doc.resolve(u.pos))
1765
+ ), !0;
1766
+ }
1767
+ return !1;
1768
+ }),
1769
+ // If the block is the last in a column, moves it to the start of the
1770
+ // next column. If there is no next column, moves it below the
1771
+ // columnList.
1772
+ () => s.command(({ state: r, tr: i, dispatch: l }) => {
1773
+ const a = B(r);
1774
+ if (!a.isBlockContainer || !(i.selection.from === a.blockContent.afterPos - 1))
1775
+ return !1;
1776
+ const d = i.doc.resolve(a.bnBlock.afterPos);
1777
+ if (d.nodeAfter || d.node().type.name !== "column")
1778
+ return !1;
1779
+ const h = i.doc.resolve(a.bnBlock.afterPos), f = i.doc.resolve(h.after()), m = f.after();
1780
+ if (l) {
1781
+ const b = f.pos === m - 1 ? m : f.pos + 1, g = v(
1782
+ i.doc.resolve(b)
1783
+ );
1784
+ i.delete(
1785
+ g.bnBlock.beforePos,
1786
+ g.bnBlock.afterPos
1787
+ ), H(
1788
+ i,
1789
+ m - f.node().nodeSize
1790
+ ), i.insert(h.pos, g.bnBlock.node), i.setSelection(
1791
+ S.near(i.doc.resolve(b))
1792
+ );
1793
+ }
1794
+ return !0;
1795
+ }),
1796
+ // Deletes the next block at either the same or lower nesting level, if
1797
+ // the selection is empty and at the end of the block. If both the
1798
+ // current and next blocks have inline content, the next block's
1799
+ // content is appended to the current block's. The next block's own
1800
+ // children are unindented before it's deleted.
1801
+ () => s.command(({ state: r }) => {
1802
+ var d;
1803
+ const i = B(r);
1804
+ if (!i.isBlockContainer)
1805
+ return !1;
1806
+ const { blockContent: l } = i, a = r.selection.from === l.afterPos - 1, c = r.selection.empty;
1807
+ if (a && c) {
1808
+ const u = (b, g) => {
1809
+ const x = _(b, g);
1810
+ if (x)
1811
+ return x;
1812
+ const y = _e(b, g);
1813
+ if (y)
1814
+ return u(
1815
+ b,
1816
+ y.bnBlock.beforePos
1817
+ );
1818
+ }, p = u(
1819
+ r.doc,
1820
+ i.bnBlock.beforePos
1821
+ );
1822
+ if (!p || !p.isBlockContainer)
1823
+ return !1;
1824
+ const h = p.blockContent.node, f = h.type.spec.content === "inline*", m = l.node.type.spec.content === "inline*";
1825
+ return o().insertContentAt(
1826
+ p.bnBlock.afterPos,
1827
+ ((d = p.childContainer) == null ? void 0 : d.node.content) || w.empty
1828
+ ).deleteRange({
1829
+ from: p.bnBlock.beforePos,
1830
+ to: p.bnBlock.afterPos
1831
+ }).insertContentAt(
1832
+ r.selection.from,
1833
+ f && m ? h.content : null
1834
+ ).setTextSelection(r.selection.from).scrollIntoView().run();
1835
+ }
1836
+ return !1;
1837
+ }),
1838
+ // Deletes the current block if it's an empty block with inline content,
1839
+ // and moves the selection to the next block.
1840
+ () => s.command(({ state: r }) => {
1841
+ const i = B(r);
1842
+ if (!i.isBlockContainer)
1843
+ return !1;
1844
+ if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
1845
+ const a = _(
1846
+ r.doc,
1847
+ i.bnBlock.beforePos
1848
+ );
1849
+ if (!a || !a.isBlockContainer)
1850
+ return !1;
1851
+ let c = o();
1852
+ if (a.blockContent.node.type.spec.content === "tableRow+") {
1853
+ const f = i.bnBlock.afterPos + 1 + 1 + 1 + 1 + 1;
1854
+ c = c.setTextSelection(
1855
+ f
1856
+ );
1857
+ } else a.blockContent.node.type.spec.content === "" ? c = c.setNodeSelection(
1858
+ a.blockContent.beforePos
1859
+ ) : c = c.setTextSelection(
1860
+ a.blockContent.beforePos + 1
1861
+ );
1862
+ return c.deleteRange({
1863
+ from: i.bnBlock.beforePos,
1864
+ to: i.bnBlock.afterPos
1865
+ }).scrollIntoView().run();
1866
+ }
1867
+ return !1;
1868
+ }),
1869
+ // Deletes next block if it contains no content and isn't a table,
1870
+ // when the selection is empty and at the end of the block. Moves the
1871
+ // current block into the deleted block's place.
1872
+ () => s.command(({ state: r }) => {
1873
+ const i = B(r);
1874
+ if (!i.isBlockContainer)
1875
+ return !1;
1876
+ const l = r.selection.from === i.blockContent.afterPos - 1, a = r.selection.empty, c = _(
1877
+ r.doc,
1878
+ i.bnBlock.beforePos
1879
+ );
1880
+ if (!c || !c.isBlockContainer)
1881
+ return !1;
1882
+ if (c && l && a && (c.blockContent.node.type.spec.content === "" || c.blockContent.node.type.spec.content === "inline*" && c.blockContent.node.childCount === 0)) {
1883
+ const u = c.bnBlock.node.lastChild.content;
1884
+ return o().deleteRange({
1885
+ from: c.bnBlock.beforePos,
1886
+ to: c.bnBlock.afterPos
1887
+ }).insertContentAt(i.bnBlock.afterPos, c.bnBlock.node.childCount === 2 ? u : null).run();
1669
1888
  }
1670
1889
  return !1;
1671
1890
  })
1672
- ]), t = (n = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
1891
+ ]), t = (o = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
1673
1892
  // Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
1674
1893
  // of the block.
1675
- () => s.command(({ state: a }) => {
1676
- const c = B(a);
1677
- if (!c.isBlockContainer)
1894
+ () => s.command(({ state: i }) => {
1895
+ const l = B(i);
1896
+ if (!l.isBlockContainer)
1678
1897
  return !1;
1679
- const { bnBlock: i, blockContent: l } = c, { depth: d } = a.doc.resolve(i.beforePos), u = a.selection.$anchor.parentOffset === 0, p = a.selection.anchor === a.selection.head, m = l.node.childCount === 0, f = d > 1;
1680
- return u && p && m && f ? s.liftListItem("blockContainer") : !1;
1898
+ const { bnBlock: a, blockContent: c } = l, { depth: d } = i.doc.resolve(a.beforePos), u = i.selection.$anchor.parentOffset === 0, p = i.selection.anchor === i.selection.head, h = c.node.childCount === 0, f = d > 1;
1899
+ return u && p && h && f ? s.liftListItem("blockContainer") : !1;
1681
1900
  }),
1682
1901
  // Creates a hard break if block is configured to do so.
1683
- () => s.command(({ state: a }) => {
1684
- var l;
1685
- const c = B(a), i = ((l = this.options.editor.schema.blockSchema[c.blockNoteType].meta) == null ? void 0 : l.hardBreakShortcut) ?? "shift+enter";
1686
- if (i === "none")
1902
+ () => s.command(({ state: i }) => {
1903
+ var c;
1904
+ const l = B(i), a = ((c = this.options.editor.schema.blockSchema[l.blockNoteType].meta) == null ? void 0 : c.hardBreakShortcut) ?? "shift+enter";
1905
+ if (a === "none")
1687
1906
  return !1;
1688
1907
  if (
1689
1908
  // If shortcut is not configured, or is configured as "shift+enter",
1690
1909
  // 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
1910
+ a === "shift+enter" && o || // If shortcut is configured as "enter", create a hard break for
1692
1911
  // both enter and shift+enter.
1693
- i === "enter"
1912
+ a === "enter"
1694
1913
  ) {
1695
1914
  const d = r.storedMarks || r.selection.$head.marks().filter(
1696
1915
  (u) => this.editor.extensionManager.splittableMarks.includes(
@@ -1706,17 +1925,27 @@ const de = () => {
1706
1925
  }),
1707
1926
  // Creates a new block and moves the selection to it if the current one is empty, while the selection is also
1708
1927
  // empty & at the start of the block.
1709
- () => s.command(({ state: a, dispatch: c }) => {
1710
- const i = B(a);
1711
- if (!i.isBlockContainer)
1928
+ () => s.command(({ state: i, dispatch: l, tr: a }) => {
1929
+ var m;
1930
+ const c = B(i);
1931
+ if (!c.isBlockContainer)
1712
1932
  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;
1716
- 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))
1933
+ const { bnBlock: d, blockContent: u } = c, p = i.selection.$anchor.parentOffset === 0, h = i.selection.anchor === i.selection.head, f = u.node.childCount === 0;
1934
+ if (p && h && f) {
1935
+ const b = d.afterPos, g = b + 2;
1936
+ if (l) {
1937
+ const x = i.schema.nodes.blockContainer.createAndFill(
1938
+ void 0,
1939
+ [
1940
+ i.schema.nodes.paragraph.createAndFill() || void 0,
1941
+ (m = c.childContainer) == null ? void 0 : m.node
1942
+ ].filter((y) => y !== void 0)
1943
+ );
1944
+ a.insert(b, x).setSelection(
1945
+ new S(a.doc.resolve(g))
1946
+ ).scrollIntoView(), c.childContainer && a.delete(
1947
+ c.childContainer.beforePos,
1948
+ c.childContainer.afterPos
1720
1949
  );
1721
1950
  }
1722
1951
  return !0;
@@ -1725,14 +1954,14 @@ const de = () => {
1725
1954
  }),
1726
1955
  // Splits the current block, moving content inside that's after the cursor to a new text block below. Also
1727
1956
  // deletes the selection beforehand, if it's not empty.
1728
- () => s.command(({ state: a, chain: c }) => {
1729
- const i = B(a);
1730
- if (!i.isBlockContainer)
1957
+ () => s.command(({ state: i, chain: l }) => {
1958
+ const a = B(i);
1959
+ if (!a.isBlockContainer)
1731
1960
  return !1;
1732
- const { blockContent: l } = i, d = a.selection.$anchor.parentOffset === 0;
1733
- return l.node.childCount === 0 ? !1 : (c().deleteSelection().command(
1734
- Ze(
1735
- a.selection.from,
1961
+ const { blockContent: c } = a, d = i.selection.$anchor.parentOffset === 0;
1962
+ return c.node.childCount === 0 ? !1 : (l().deleteSelection().command(
1963
+ ot(
1964
+ i.selection.from,
1736
1965
  d,
1737
1966
  d
1738
1967
  )
@@ -1740,19 +1969,19 @@ const de = () => {
1740
1969
  })
1741
1970
  ]);
1742
1971
  return {
1743
- Backspace: o,
1972
+ Backspace: n,
1744
1973
  Delete: e,
1745
1974
  Enter: () => t(),
1746
1975
  "Shift-Enter": () => t(!0),
1747
1976
  // Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
1748
1977
  // editor since the browser will try to use tab for keyboard navigation.
1749
1978
  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);
1979
+ var o, s;
1980
+ return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(Y)) != null && o.store.state || ((s = this.options.editor.getExtension(J)) == null ? void 0 : s.store.state) !== void 0) ? !1 : we(this.options.editor);
1752
1981
  },
1753
1982
  "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");
1983
+ var o, s;
1984
+ return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(Y)) != 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
1985
  },
1757
1986
  "Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
1758
1987
  "Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
@@ -1761,7 +1990,7 @@ const de = () => {
1761
1990
  "Shift-Mod-z": () => this.options.editor.redo()
1762
1991
  };
1763
1992
  }
1764
- }), sn = X.create({
1993
+ }), ln = te.create({
1765
1994
  name: "insertion",
1766
1995
  inclusive: !1,
1767
1996
  excludes: "deletion modification insertion",
@@ -1771,8 +2000,8 @@ const de = () => {
1771
2000
  // note: validate is supported in prosemirror but not in tiptap, so this doesn't actually work (considered not critical)
1772
2001
  };
1773
2002
  },
1774
- extendMarkSchema(o) {
1775
- return o.name !== "insertion" ? {} : {
2003
+ extendMarkSchema(n) {
2004
+ return n.name !== "insertion" ? {} : {
1776
2005
  blocknoteIgnore: !0,
1777
2006
  inclusive: !1,
1778
2007
  toDOM(e, t) {
@@ -1799,7 +2028,7 @@ const de = () => {
1799
2028
  ]
1800
2029
  };
1801
2030
  }
1802
- }), rn = X.create({
2031
+ }), dn = te.create({
1803
2032
  name: "deletion",
1804
2033
  inclusive: !1,
1805
2034
  excludes: "insertion modification deletion",
@@ -1809,8 +2038,8 @@ const de = () => {
1809
2038
  // note: validate is supported in prosemirror but not in tiptap
1810
2039
  };
1811
2040
  },
1812
- extendMarkSchema(o) {
1813
- return o.name !== "deletion" ? {} : {
2041
+ extendMarkSchema(n) {
2042
+ return n.name !== "deletion" ? {} : {
1814
2043
  blocknoteIgnore: !0,
1815
2044
  inclusive: !1,
1816
2045
  // attrs: {
@@ -1840,7 +2069,7 @@ const de = () => {
1840
2069
  ]
1841
2070
  };
1842
2071
  }
1843
- }), an = X.create({
2072
+ }), un = te.create({
1844
2073
  name: "modification",
1845
2074
  inclusive: !1,
1846
2075
  excludes: "deletion insertion",
@@ -1853,8 +2082,8 @@ const de = () => {
1853
2082
  newValue: { default: null }
1854
2083
  };
1855
2084
  },
1856
- extendMarkSchema(o) {
1857
- return o.name !== "modification" ? {} : {
2085
+ extendMarkSchema(n) {
2086
+ return n.name !== "modification" ? {} : {
1858
2087
  blocknoteIgnore: !0,
1859
2088
  inclusive: !1,
1860
2089
  // attrs: {
@@ -1903,7 +2132,7 @@ const de = () => {
1903
2132
  ]
1904
2133
  };
1905
2134
  }
1906
- }), cn = E.create({
2135
+ }), pn = T.create({
1907
2136
  name: "textAlignment",
1908
2137
  addGlobalAttributes() {
1909
2138
  return [
@@ -1916,34 +2145,34 @@ const de = () => {
1916
2145
  attributes: {
1917
2146
  textAlignment: {
1918
2147
  default: "left",
1919
- parseHTML: (o) => o.getAttribute("data-text-alignment"),
1920
- renderHTML: (o) => o.textAlignment === "left" ? {} : {
1921
- "data-text-alignment": o.textAlignment
2148
+ parseHTML: (n) => n.getAttribute("data-text-alignment"),
2149
+ renderHTML: (n) => n.textAlignment === "left" ? {} : {
2150
+ "data-text-alignment": n.textAlignment
1922
2151
  }
1923
2152
  }
1924
2153
  }
1925
2154
  }
1926
2155
  ];
1927
2156
  }
1928
- }), ln = E.create({
2157
+ }), fn = T.create({
1929
2158
  name: "blockTextColor",
1930
2159
  addGlobalAttributes() {
1931
2160
  return [
1932
2161
  {
1933
2162
  types: ["table", "tableCell", "tableHeader"],
1934
2163
  attributes: {
1935
- textColor: tt()
2164
+ textColor: st()
1936
2165
  }
1937
2166
  }
1938
2167
  ];
1939
2168
  }
1940
- }), dn = {
2169
+ }), hn = {
1941
2170
  blockColor: "data-block-color",
1942
2171
  blockStyle: "data-block-style",
1943
2172
  id: "data-id",
1944
2173
  depth: "data-depth",
1945
2174
  depthChange: "data-depth-change"
1946
- }, un = D.create({
2175
+ }, mn = O.create({
1947
2176
  name: "blockContainer",
1948
2177
  group: "blockGroupChild bnBlock",
1949
2178
  // A block always contains content, and optionally a blockGroup which contains nested blocks
@@ -1956,12 +2185,12 @@ const de = () => {
1956
2185
  return [
1957
2186
  {
1958
2187
  tag: "div[data-node-type=" + this.name + "]",
1959
- getAttrs: (o) => {
1960
- if (typeof o == "string")
2188
+ getAttrs: (n) => {
2189
+ if (typeof n == "string")
1961
2190
  return !1;
1962
2191
  const e = {};
1963
- for (const [t, n] of Object.entries(dn))
1964
- o.getAttribute(n) && (e[t] = o.getAttribute(n));
2192
+ for (const [t, o] of Object.entries(hn))
2193
+ n.getAttribute(o) && (e[t] = n.getAttribute(o));
1965
2194
  return e;
1966
2195
  }
1967
2196
  },
@@ -1972,25 +2201,25 @@ const de = () => {
1972
2201
  }
1973
2202
  ];
1974
2203
  },
1975
- renderHTML({ HTMLAttributes: o }) {
2204
+ renderHTML({ HTMLAttributes: n }) {
1976
2205
  var s;
1977
2206
  const e = document.createElement("div");
1978
2207
  e.className = "bn-block-outer", e.setAttribute("data-node-type", "blockOuter");
1979
- for (const [r, a] of Object.entries(o))
1980
- r !== "class" && e.setAttribute(r, a);
2208
+ for (const [r, i] of Object.entries(n))
2209
+ r !== "class" && e.setAttribute(r, i);
1981
2210
  const t = {
1982
2211
  ...((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);
1986
- for (const [r, a] of Object.entries(t))
1987
- r !== "class" && n.setAttribute(r, a);
1988
- return e.appendChild(n), {
2212
+ ...n
2213
+ }, o = document.createElement("div");
2214
+ o.className = ee("bn-block", t.class), o.setAttribute("data-node-type", this.name);
2215
+ for (const [r, i] of Object.entries(t))
2216
+ r !== "class" && o.setAttribute(r, i);
2217
+ return e.appendChild(o), {
1989
2218
  dom: e,
1990
- contentDOM: n
2219
+ contentDOM: o
1991
2220
  };
1992
2221
  }
1993
- }), pn = D.create({
2222
+ }), kn = O.create({
1994
2223
  name: "blockGroup",
1995
2224
  group: "childContainer",
1996
2225
  content: "blockGroupChild+",
@@ -1999,17 +2228,17 @@ const de = () => {
1999
2228
  return [
2000
2229
  {
2001
2230
  tag: "div",
2002
- getAttrs: (o) => typeof o == "string" ? !1 : o.getAttribute("data-node-type") === "blockGroup" ? null : !1
2231
+ getAttrs: (n) => typeof n == "string" ? !1 : n.getAttribute("data-node-type") === "blockGroup" ? null : !1
2003
2232
  }
2004
2233
  ];
2005
2234
  },
2006
- renderHTML({ HTMLAttributes: o }) {
2007
- var n;
2235
+ renderHTML({ HTMLAttributes: n }) {
2236
+ var o;
2008
2237
  const e = {
2009
- ...((n = this.options.domAttributes) == null ? void 0 : n.blockGroup) || {},
2010
- ...o
2238
+ ...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
2239
+ ...n
2011
2240
  }, t = document.createElement("div");
2012
- t.className = Q(
2241
+ t.className = ee(
2013
2242
  "bn-block-group",
2014
2243
  e.class
2015
2244
  ), t.setAttribute("data-node-type", "blockGroup");
@@ -2020,161 +2249,161 @@ const de = () => {
2020
2249
  contentDOM: t
2021
2250
  };
2022
2251
  }
2023
- }), fn = D.create({
2252
+ }), bn = O.create({
2024
2253
  name: "doc",
2025
2254
  topNode: !0,
2026
2255
  content: "blockGroup",
2027
2256
  marks: "insertion modification deletion"
2028
- }), hn = Ot(
2029
- ({ options: o }) => ({
2257
+ }), gn = Vt(
2258
+ ({ options: n }) => ({
2030
2259
  key: "collaboration",
2031
2260
  blockNoteExtensions: [
2032
- it(o),
2033
- ct(o),
2034
- lt(o),
2035
- dt(),
2036
- ut(o)
2261
+ dt(n),
2262
+ ut(n),
2263
+ pt(n),
2264
+ ft(),
2265
+ ht(n)
2037
2266
  ]
2038
2267
  })
2039
2268
  );
2040
- let fe = !1;
2041
- function mn(o, e) {
2269
+ let he = !1;
2270
+ function Bn(n, e) {
2042
2271
  const t = [
2043
- I.ClipboardTextSerializer,
2044
- I.Commands,
2045
- I.Editable,
2046
- I.FocusEvents,
2047
- I.Tabindex,
2048
- $t,
2049
- me.configure({
2272
+ N.ClipboardTextSerializer,
2273
+ N.Commands,
2274
+ N.Editable,
2275
+ N.FocusEvents,
2276
+ N.Tabindex,
2277
+ zt,
2278
+ ke.configure({
2050
2279
  // everything from bnBlock group (nodes that represent a BlockNote block should have an id)
2051
2280
  types: ["blockContainer", "columnList", "column"],
2052
2281
  setIdAttribute: e.setIdAttribute
2053
2282
  }),
2054
- en,
2055
- Vt,
2056
- // marks:
2057
2283
  sn,
2058
- rn,
2059
- an,
2060
- Ht.extend({
2284
+ Gt,
2285
+ // marks:
2286
+ ln,
2287
+ dn,
2288
+ un,
2289
+ Rt.extend({
2061
2290
  inclusive: !1
2062
2291
  }).configure({
2063
- defaultProtocol: Ct,
2292
+ defaultProtocol: Pt,
2064
2293
  // only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
2065
- protocols: fe ? [] : Bt
2294
+ protocols: he ? [] : Et
2066
2295
  }),
2067
- ...Object.values(o.schema.styleSpecs).map((n) => n.implementation.mark.configure({
2068
- editor: o
2296
+ ...Object.values(n.schema.styleSpecs).map((o) => o.implementation.mark.configure({
2297
+ editor: n
2069
2298
  })),
2070
- ln,
2071
- Zo,
2072
- cn,
2299
+ fn,
2300
+ nn,
2301
+ pn,
2073
2302
  // make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
2074
- E.create({
2303
+ T.create({
2075
2304
  name: "OverrideEscape",
2076
2305
  addKeyboardShortcuts: () => ({
2077
2306
  Escape: () => {
2078
- var n;
2079
- return (n = o.getExtension(ge)) != null && n.shown() ? !1 : (o.blur(), !0);
2307
+ var o;
2308
+ return (o = n.getExtension(ge)) != null && o.shown() ? !1 : (n.blur(), !0);
2080
2309
  }
2081
2310
  })
2082
2311
  }),
2083
2312
  // nodes
2084
- fn,
2085
- un.configure({
2086
- editor: o,
2313
+ bn,
2314
+ mn.configure({
2315
+ editor: n,
2087
2316
  domAttributes: e.domAttributes
2088
2317
  }),
2089
- nn.configure({
2090
- editor: o,
2318
+ cn.configure({
2319
+ editor: n,
2091
2320
  tabBehavior: e.tabBehavior
2092
2321
  }),
2093
- pn.configure({
2322
+ kn.configure({
2094
2323
  domAttributes: e.domAttributes
2095
2324
  }),
2096
- ...Object.values(o.schema.inlineContentSpecs).filter((n) => n.config !== "link" && n.config !== "text").map((n) => n.implementation.node.configure({
2097
- editor: o
2325
+ ...Object.values(n.schema.inlineContentSpecs).filter((o) => o.config !== "link" && o.config !== "text").map((o) => o.implementation.node.configure({
2326
+ editor: n
2098
2327
  })),
2099
- ...Object.values(o.schema.blockSpecs).flatMap((n) => [
2328
+ ...Object.values(n.schema.blockSpecs).flatMap((o) => [
2100
2329
  // the node extension implementations
2101
- ..."node" in n.implementation ? [
2102
- n.implementation.node.configure({
2103
- editor: o,
2330
+ ..."node" in o.implementation ? [
2331
+ o.implementation.node.configure({
2332
+ editor: n,
2104
2333
  domAttributes: e.domAttributes
2105
2334
  })
2106
2335
  ] : []
2107
2336
  ]),
2108
- Xo(o),
2109
- Yo(
2110
- o,
2111
- e.pasteHandler || ((n) => n.defaultPasteHandler())
2337
+ on(n),
2338
+ en(
2339
+ n,
2340
+ e.pasteHandler || ((o) => o.defaultPasteHandler())
2112
2341
  ),
2113
- Do(o)
2342
+ $o(n)
2114
2343
  ];
2115
- return fe = !0, t;
2344
+ return he = !0, t;
2116
2345
  }
2117
- function kn(o, e) {
2346
+ function yn(n, e) {
2118
2347
  const t = [
2119
2348
  ye(),
2120
- pt(e),
2121
- G(e),
2122
- R(e),
2123
- ft(e),
2124
- ht(),
2125
2349
  mt(e),
2126
- Ut(e),
2350
+ J(e),
2351
+ Y(e),
2127
2352
  kt(e),
2353
+ bt(),
2354
+ gt(e),
2355
+ jt(e),
2356
+ Bt(e),
2128
2357
  ge(e),
2129
- ...e.trailingBlock !== !1 ? [gt()] : []
2358
+ ...e.trailingBlock !== !1 ? [yt()] : []
2130
2359
  ];
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;
2360
+ return e.collaboration ? t.push(gn(e.collaboration)) : t.push(Ct()), "table" in n.schema.blockSpecs && t.push(St(e)), e.animations !== !1 && t.push(xt()), t;
2132
2361
  }
2133
- class gn {
2362
+ class Cn {
2134
2363
  constructor(e, t) {
2135
2364
  /**
2136
2365
  * A set of extension keys which are disabled by the options
2137
2366
  */
2138
- h(this, "disabledExtensions", /* @__PURE__ */ new Set());
2367
+ k(this, "disabledExtensions", /* @__PURE__ */ new Set());
2139
2368
  /**
2140
2369
  * A list of all the extensions that are registered to the editor
2141
2370
  */
2142
- h(this, "extensions", []);
2371
+ k(this, "extensions", []);
2143
2372
  /**
2144
2373
  * A map of all the abort controllers for each extension that has an init method defined
2145
2374
  */
2146
- h(this, "abortMap", /* @__PURE__ */ new Map());
2375
+ k(this, "abortMap", /* @__PURE__ */ new Map());
2147
2376
  /**
2148
2377
  * A map of all the extension factories that are registered to the editor
2149
2378
  */
2150
- h(this, "extensionFactories", /* @__PURE__ */ new Map());
2379
+ k(this, "extensionFactories", /* @__PURE__ */ new Map());
2151
2380
  /**
2152
2381
  * Because a single blocknote extension can both have it's own prosemirror plugins & additional generated ones (e.g. keymap & input rules plugins)
2153
2382
  * We need to keep track of all the plugins for each extension, so that we can remove them when the extension is unregistered
2154
2383
  */
2155
- h(this, "extensionPlugins", /* @__PURE__ */ new Map());
2384
+ k(this, "extensionPlugins", /* @__PURE__ */ new Map());
2156
2385
  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({
2386
+ for (const o of this.extensions)
2387
+ if (o.mount) {
2388
+ const s = new window.AbortController(), r = o.mount({
2160
2389
  dom: e.prosemirrorView.dom,
2161
2390
  root: e.prosemirrorView.root,
2162
2391
  signal: s.signal
2163
2392
  });
2164
2393
  r && s.signal.addEventListener("abort", () => {
2165
2394
  r();
2166
- }), this.abortMap.set(n, s);
2395
+ }), this.abortMap.set(o, s);
2167
2396
  }
2168
2397
  }), e.onUnmount(() => {
2169
- for (const [n, s] of this.abortMap.entries())
2170
- this.abortMap.delete(n), s.abort();
2398
+ for (const [o, s] of this.abortMap.entries())
2399
+ this.abortMap.delete(o), s.abort();
2171
2400
  }), 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 ?? [])
2401
+ for (const o of yn(this.editor, this.options))
2402
+ this.addExtension(o);
2403
+ for (const o of this.options.extensions ?? [])
2404
+ this.addExtension(o);
2405
+ for (const o of Object.values(this.editor.schema.blockSpecs))
2406
+ for (const s of o.extensions ?? [])
2178
2407
  this.addExtension(s);
2179
2408
  }
2180
2409
  /**
@@ -2189,20 +2418,20 @@ class gn {
2189
2418
  console.warn("No extensions found to register", e);
2190
2419
  return;
2191
2420
  }
2192
- const n = t.map((a) => this.addExtension(a)).filter(Boolean), s = /* @__PURE__ */ new Set();
2193
- for (const a of n)
2194
- a != null && a.tiptapExtensions && console.warn(
2195
- `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
- a
2197
- ), (r = a == null ? void 0 : a.inputRules) != null && r.length && console.warn(
2198
- `Extension ${a.key} has input rules, 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.`,
2199
- a
2200
- ), this.getProsemirrorPluginsFromExtension(a).plugins.forEach(
2201
- (c) => {
2202
- s.add(c);
2421
+ const o = t.map((i) => this.addExtension(i)).filter(Boolean), s = /* @__PURE__ */ new Set();
2422
+ for (const i of o)
2423
+ i != null && i.tiptapExtensions && console.warn(
2424
+ `Extension ${i.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.`,
2425
+ i
2426
+ ), (r = i == null ? void 0 : i.inputRules) != null && r.length && console.warn(
2427
+ `Extension ${i.key} has input rules, 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.`,
2428
+ i
2429
+ ), this.getProsemirrorPluginsFromExtension(i).plugins.forEach(
2430
+ (l) => {
2431
+ s.add(l);
2203
2432
  }
2204
2433
  );
2205
- this.updatePlugins((a) => [...a, ...s]);
2434
+ this.updatePlugins((i) => [...i, ...s]);
2206
2435
  }
2207
2436
  /**
2208
2437
  * Register an extension to the editor
@@ -2213,12 +2442,12 @@ class gn {
2213
2442
  let t;
2214
2443
  if (typeof e == "function" ? t = e({ editor: this.editor }) : t = e, !(!t || this.disabledExtensions.has(t.key))) {
2215
2444
  if (typeof e == "function") {
2216
- const n = t[Ft];
2217
- typeof n == "function" && this.extensionFactories.set(n, t);
2445
+ const o = t[Ut];
2446
+ typeof o == "function" && this.extensionFactories.set(o, t);
2218
2447
  }
2219
2448
  if (this.extensions.push(t), t.blockNoteExtensions)
2220
- for (const n of t.blockNoteExtensions)
2221
- this.addExtension(n);
2449
+ for (const o of t.blockNoteExtensions)
2450
+ this.addExtension(o);
2222
2451
  return t;
2223
2452
  }
2224
2453
  }
@@ -2230,16 +2459,16 @@ class gn {
2230
2459
  resolveExtensions(e) {
2231
2460
  const t = [];
2232
2461
  if (typeof e == "function") {
2233
- const n = this.extensionFactories.get(e);
2234
- n && t.push(n);
2462
+ const o = this.extensionFactories.get(e);
2463
+ o && t.push(o);
2235
2464
  } else if (Array.isArray(e))
2236
- for (const n of e)
2237
- t.push(...this.resolveExtensions(n));
2465
+ for (const o of e)
2466
+ t.push(...this.resolveExtensions(o));
2238
2467
  else if (typeof e == "object" && "key" in e)
2239
2468
  t.push(e);
2240
2469
  else if (typeof e == "string") {
2241
- const n = this.extensions.find((s) => s.key === e);
2242
- n && t.push(n);
2470
+ const o = this.extensions.find((s) => s.key === e);
2471
+ o && t.push(o);
2243
2472
  }
2244
2473
  return t;
2245
2474
  }
@@ -2255,22 +2484,22 @@ class gn {
2255
2484
  console.warn("No extensions found to unregister", e);
2256
2485
  return;
2257
2486
  }
2258
- let n = !1;
2487
+ let o = !1;
2259
2488
  const s = /* @__PURE__ */ new Set();
2260
- for (const a of t) {
2261
- this.extensions = this.extensions.filter((i) => i !== a), this.extensionFactories.forEach((i, l) => {
2262
- i === a && this.extensionFactories.delete(l);
2263
- }), (r = this.abortMap.get(a)) == null || r.abort(), this.abortMap.delete(a);
2264
- const c = this.extensionPlugins.get(a);
2265
- c == null || c.forEach((i) => {
2266
- s.add(i);
2267
- }), this.extensionPlugins.delete(a), a.tiptapExtensions && !n && (n = !0, console.warn(
2268
- `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.`,
2489
+ for (const i of t) {
2490
+ this.extensions = this.extensions.filter((a) => a !== i), this.extensionFactories.forEach((a, c) => {
2491
+ a === i && this.extensionFactories.delete(c);
2492
+ }), (r = this.abortMap.get(i)) == null || r.abort(), this.abortMap.delete(i);
2493
+ const l = this.extensionPlugins.get(i);
2494
+ l == null || l.forEach((a) => {
2495
+ s.add(a);
2496
+ }), this.extensionPlugins.delete(i), i.tiptapExtensions && !o && (o = !0, console.warn(
2497
+ `Extension ${i.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
2498
  e
2270
2499
  ));
2271
2500
  }
2272
2501
  this.updatePlugins(
2273
- (a) => a.filter((c) => !s.has(c))
2502
+ (i) => i.filter((l) => !s.has(l))
2274
2503
  );
2275
2504
  }
2276
2505
  /**
@@ -2279,39 +2508,39 @@ class gn {
2279
2508
  * @returns void
2280
2509
  */
2281
2510
  updatePlugins(e) {
2282
- const t = this.editor.prosemirrorState, n = t.reconfigure({
2511
+ const t = this.editor.prosemirrorState, o = t.reconfigure({
2283
2512
  plugins: e(t.plugins.slice())
2284
2513
  });
2285
- this.editor.prosemirrorView.updateState(n);
2514
+ this.editor.prosemirrorView.updateState(o);
2286
2515
  }
2287
2516
  /**
2288
2517
  * Get all the extensions that are registered to the editor
2289
2518
  */
2290
2519
  getTiptapExtensions() {
2291
2520
  var s;
2292
- const e = mn(
2521
+ const e = Bn(
2293
2522
  this.editor,
2294
2523
  this.options
2295
- ).filter((r) => !this.disabledExtensions.has(r.name)), t = xt(this.extensions), n = /* @__PURE__ */ new Map();
2524
+ ).filter((r) => !this.disabledExtensions.has(r.name)), t = Tt(this.extensions), o = /* @__PURE__ */ new Map();
2296
2525
  for (const r of this.extensions) {
2297
2526
  r.tiptapExtensions && e.push(...r.tiptapExtensions);
2298
- const a = t(r.key), { plugins: c, inputRules: i } = this.getProsemirrorPluginsFromExtension(r);
2299
- c.length && e.push(
2300
- E.create({
2527
+ const i = t(r.key), { plugins: l, inputRules: a } = this.getProsemirrorPluginsFromExtension(r);
2528
+ l.length && e.push(
2529
+ T.create({
2301
2530
  name: r.key,
2302
- priority: a,
2303
- addProseMirrorPlugins: () => c
2531
+ priority: i,
2532
+ addProseMirrorPlugins: () => l
2304
2533
  })
2305
- ), i.length && (n.has(a) || n.set(a, []), n.get(a).push(...i));
2534
+ ), a.length && (o.has(i) || o.set(i, []), o.get(i).push(...a));
2306
2535
  }
2307
2536
  e.push(
2308
- E.create({
2537
+ T.create({
2309
2538
  name: "blocknote-input-rules",
2310
2539
  addProseMirrorPlugins() {
2311
2540
  const r = [];
2312
- return Array.from(n.keys()).sort().reverse().forEach((a) => {
2313
- r.push(...n.get(a));
2314
- }), [Dt({ rules: r })];
2541
+ return Array.from(o.keys()).sort().reverse().forEach((i) => {
2542
+ r.push(...o.get(i));
2543
+ }), [$t({ rules: r })];
2315
2544
  }
2316
2545
  })
2317
2546
  );
@@ -2326,34 +2555,34 @@ class gn {
2326
2555
  * - input rules
2327
2556
  */
2328
2557
  getProsemirrorPluginsFromExtension(e) {
2329
- 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) => {
2333
- const p = c.replace({
2334
- match: l,
2558
+ var s, r, i;
2559
+ const t = [...e.prosemirrorPlugins ?? []], o = [];
2560
+ 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), (i = e.inputRules) != null && i.length && o.push(
2561
+ ...e.inputRules.map((l) => new Ht(l.find, (a, c, d, u) => {
2562
+ const p = l.replace({
2563
+ match: c,
2335
2564
  range: { from: d, to: u },
2336
2565
  editor: this.editor
2337
2566
  });
2338
2567
  if (p) {
2339
- const m = this.editor.getTextCursorPosition();
2340
- if (this.editor.schema.blockSchema[m.block.type].content !== "inline")
2568
+ const h = this.editor.getTextCursorPosition();
2569
+ if (this.editor.schema.blockSchema[h.block.type].content !== "inline")
2341
2570
  return null;
2342
- const f = $(i.tr), k = i.tr.deleteRange(d, u);
2343
- return ot(k, f.bnBlock.beforePos, p), k;
2571
+ const f = z(a.tr), m = a.tr.deleteRange(d, u);
2572
+ return rt(m, f.bnBlock.beforePos, p), m;
2344
2573
  }
2345
2574
  return null;
2346
2575
  }))
2347
2576
  ), Object.keys(e.keyboardShortcuts || {}).length && t.push(
2348
- Nt(
2577
+ Ft(
2349
2578
  Object.fromEntries(
2350
- Object.entries(e.keyboardShortcuts).map(([c, i]) => [
2351
- c,
2352
- () => i({ editor: this.editor })
2579
+ Object.entries(e.keyboardShortcuts).map(([l, a]) => [
2580
+ l,
2581
+ () => a({ editor: this.editor })
2353
2582
  ])
2354
2583
  )
2355
2584
  )
2356
- ), { plugins: t, inputRules: n });
2585
+ ), { plugins: t, inputRules: o });
2357
2586
  }
2358
2587
  /**
2359
2588
  * Get all extensions
@@ -2365,7 +2594,7 @@ class gn {
2365
2594
  }
2366
2595
  getExtension(e) {
2367
2596
  if (typeof e == "string") {
2368
- const t = this.extensions.find((n) => n.key === e);
2597
+ const t = this.extensions.find((o) => o.key === e);
2369
2598
  return t || void 0;
2370
2599
  } else if (typeof e == "function") {
2371
2600
  const t = this.extensionFactories.get(e);
@@ -2380,111 +2609,111 @@ class gn {
2380
2609
  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
2610
  }
2382
2611
  }
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);
2612
+ function Sn(n, e) {
2613
+ let { $from: t, $to: o } = e;
2614
+ if (t.pos > t.start() && t.pos < n.content.size) {
2615
+ const s = n.textBetween(t.pos, t.pos + 1);
2387
2616
  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));
2617
+ const i = n.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
2618
+ i && (t = n.resolve(t.pos - i[0].length));
2390
2619
  }
2391
2620
  }
2392
- if (n.pos < n.end() && n.pos > 0) {
2393
- const s = o.textBetween(n.pos - 1, n.pos);
2621
+ if (o.pos < o.end() && o.pos > 0) {
2622
+ const s = n.textBetween(o.pos - 1, o.pos);
2394
2623
  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));
2624
+ const i = n.textBetween(o.pos, o.end()).match(/^[\w\p{P}]+/u);
2625
+ i && (o = n.resolve(o.pos + i[0].length));
2397
2626
  }
2398
2627
  }
2399
- return { $from: t, $to: n, from: t.pos, to: n.pos };
2628
+ return { $from: t, $to: o, from: t.pos, to: o.pos };
2400
2629
  }
2401
- function yn(o) {
2402
- const e = C(o);
2403
- if (o.selection.empty || "node" in o.selection)
2630
+ function xn(n) {
2631
+ const e = E(n);
2632
+ if (n.selection.empty || "node" in n.selection)
2404
2633
  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
2409
- ), s = (l, d) => {
2410
- const u = t.posAtIndex(l, d), p = o.doc.resolve(u).nodeAfter;
2634
+ const t = n.doc.resolve(
2635
+ D(n.doc, n.selection.from).posBeforeNode
2636
+ ), o = n.doc.resolve(
2637
+ D(n.doc, n.selection.to).posBeforeNode
2638
+ ), s = (c, d) => {
2639
+ const u = t.posAtIndex(c, d), p = n.doc.resolve(u).nodeAfter;
2411
2640
  if (!p)
2412
2641
  throw new Error(
2413
2642
  `Error getting selection - node not found at position ${u}`
2414
2643
  );
2415
- return b(p, e);
2416
- }, r = [], a = t.sharedDepth(n.pos), c = t.index(a), i = n.index(a);
2417
- if (t.depth > a) {
2418
- r.push(b(t.nodeAfter, e));
2419
- for (let l = t.depth; l > a; l--)
2420
- if (t.node(l).type.isInGroup("childContainer")) {
2421
- const u = t.index(l) + 1, p = t.node(l).childCount;
2422
- for (let m = u; m < p; m++)
2423
- r.push(s(m, l));
2644
+ return C(p, e);
2645
+ }, r = [], i = t.sharedDepth(o.pos), l = t.index(i), a = o.index(i);
2646
+ if (t.depth > i) {
2647
+ r.push(C(t.nodeAfter, e));
2648
+ for (let c = t.depth; c > i; c--)
2649
+ if (t.node(c).type.isInGroup("childContainer")) {
2650
+ const u = t.index(c) + 1, p = t.node(c).childCount;
2651
+ for (let h = u; h < p; h++)
2652
+ r.push(s(h, c));
2424
2653
  }
2425
2654
  } else
2426
- r.push(s(c, a));
2427
- for (let l = c + 1; l <= i; l++)
2428
- r.push(s(l, a));
2655
+ r.push(s(l, i));
2656
+ for (let c = l + 1; c <= a; c++)
2657
+ r.push(s(c, i));
2429
2658
  if (r.length === 0)
2430
2659
  throw new Error(
2431
- `Error getting selection - selection doesn't span any blocks (${o.selection})`
2660
+ `Error getting selection - selection doesn't span any blocks (${n.selection})`
2432
2661
  );
2433
2662
  return {
2434
2663
  blocks: r
2435
2664
  };
2436
2665
  }
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)
2666
+ function En(n, e, t) {
2667
+ const o = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r = E(n), i = be(r);
2668
+ if (o === s)
2440
2669
  throw new Error(
2441
- `Attempting to set selection with the same anchor and head blocks (id ${n})`
2670
+ `Attempting to set selection with the same anchor and head blocks (id ${o})`
2442
2671
  );
2443
- const c = x(n, o.doc);
2444
- if (!c)
2445
- throw new Error(`Block with ID ${n} not found`);
2446
- const i = x(s, o.doc);
2447
- if (!i)
2672
+ const l = P(o, n.doc);
2673
+ if (!l)
2674
+ throw new Error(`Block with ID ${o} not found`);
2675
+ const a = P(s, n.doc);
2676
+ if (!a)
2448
2677
  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];
2450
- if (!l.isBlockContainer || u.content === "none")
2678
+ const c = K(l), d = K(a), u = i.blockSchema[c.blockNoteType], p = i.blockSchema[d.blockNoteType];
2679
+ if (!c.isBlockContainer || u.content === "none")
2451
2680
  throw new Error(
2452
- `Attempting to set selection anchor in block without content (id ${n})`
2681
+ `Attempting to set selection anchor in block without content (id ${o})`
2453
2682
  );
2454
2683
  if (!d.isBlockContainer || p.content === "none")
2455
2684
  throw new Error(
2456
2685
  `Attempting to set selection anchor in block without content (id ${s})`
2457
2686
  );
2458
- let m, f;
2687
+ let h, f;
2459
2688
  if (u.content === "table") {
2460
- const k = se.get(l.blockContent.node);
2461
- m = l.blockContent.beforePos + k.positionAt(0, 0, l.blockContent.node) + 1 + 2;
2689
+ const m = re.get(c.blockContent.node);
2690
+ h = c.blockContent.beforePos + m.positionAt(0, 0, c.blockContent.node) + 1 + 2;
2462
2691
  } else
2463
- m = l.blockContent.beforePos + 1;
2692
+ h = c.blockContent.beforePos + 1;
2464
2693
  if (p.content === "table") {
2465
- const k = se.get(d.blockContent.node), g = d.blockContent.beforePos + k.positionAt(
2466
- k.height - 1,
2467
- k.width - 1,
2694
+ const m = re.get(d.blockContent.node), b = d.blockContent.beforePos + m.positionAt(
2695
+ m.height - 1,
2696
+ m.width - 1,
2468
2697
  d.blockContent.node
2469
- ) + 1, y = o.doc.resolve(g).nodeAfter.nodeSize;
2470
- f = g + y - 2;
2698
+ ) + 1, g = n.doc.resolve(b).nodeAfter.nodeSize;
2699
+ f = b + g - 2;
2471
2700
  } else
2472
2701
  f = d.blockContent.afterPos - 1;
2473
- o.setSelection(w.create(o.doc, m, f));
2702
+ n.setSelection(S.create(n.doc, h, f));
2474
2703
  }
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;
2704
+ function Pn(n, e = !1) {
2705
+ const t = E(n), o = e ? Sn(n.doc, n.selection) : n.selection;
2706
+ let s = o.$from, r = o.$to;
2478
2707
  for (; r.parentOffset >= r.parent.nodeSize - 2 && r.depth > 0; )
2479
- r = o.doc.resolve(r.pos + 1);
2708
+ r = n.doc.resolve(r.pos + 1);
2480
2709
  for (; r.parentOffset === 0 && r.depth > 0; )
2481
- r = o.doc.resolve(r.pos - 1);
2710
+ r = n.doc.resolve(r.pos - 1);
2482
2711
  for (; s.parentOffset === 0 && s.depth > 0; )
2483
- s = o.doc.resolve(s.pos - 1);
2712
+ s = n.doc.resolve(s.pos - 1);
2484
2713
  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),
2714
+ s = n.doc.resolve(s.pos + 1);
2715
+ const i = Ke(
2716
+ n.doc.slice(s.pos, r.pos, !0),
2488
2717
  t
2489
2718
  );
2490
2719
  return {
@@ -2492,50 +2721,50 @@ function Bn(o, e = !1) {
2492
2721
  startPos: s.pos,
2493
2722
  endPos: r.pos
2494
2723
  },
2495
- ...a
2724
+ ...i
2496
2725
  };
2497
2726
  }
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;
2500
- 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)
2727
+ function Tn(n) {
2728
+ const { bnBlock: e } = z(n), t = E(n.doc), o = n.doc.resolve(e.beforePos), s = o.nodeBefore, r = n.doc.resolve(e.afterPos).nodeAfter;
2729
+ let i;
2730
+ return o.depth > 1 && (i = o.node(), i.type.isInGroup("bnBlock") || (i = o.node(o.depth - 1))), {
2731
+ block: C(e.node, t),
2732
+ prevBlock: s === null ? void 0 : C(s, t),
2733
+ nextBlock: r === null ? void 0 : C(r, t),
2734
+ parentBlock: i === void 0 ? void 0 : C(i, t)
2506
2735
  };
2507
2736
  }
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);
2510
- if (!a)
2511
- throw new Error(`Block with ID ${n} not found`);
2512
- const c = z(a), i = r.blockSchema[c.blockNoteType].content;
2513
- if (c.isBlockContainer) {
2514
- const l = c.blockContent;
2515
- if (i === "none") {
2516
- o.setSelection(L.create(o.doc, l.beforePos));
2737
+ function De(n, e, t = "start") {
2738
+ const o = typeof e == "string" ? e : e.id, s = E(n.doc), r = be(s), i = P(o, n.doc);
2739
+ if (!i)
2740
+ throw new Error(`Block with ID ${o} not found`);
2741
+ const l = K(i), a = r.blockSchema[l.blockNoteType].content;
2742
+ if (l.isBlockContainer) {
2743
+ const c = l.blockContent;
2744
+ if (a === "none") {
2745
+ n.setSelection($.create(n.doc, c.beforePos));
2517
2746
  return;
2518
2747
  }
2519
- 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)
2748
+ if (a === "inline")
2749
+ t === "start" ? n.setSelection(
2750
+ S.create(n.doc, c.beforePos + 1)
2751
+ ) : n.setSelection(
2752
+ S.create(n.doc, c.afterPos - 1)
2524
2753
  );
2525
- 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)
2754
+ else if (a === "table")
2755
+ t === "start" ? n.setSelection(
2756
+ S.create(n.doc, c.beforePos + 4)
2757
+ ) : n.setSelection(
2758
+ S.create(n.doc, c.afterPos - 4)
2530
2759
  );
2531
2760
  else
2532
- throw new F(i);
2761
+ throw new U(a);
2533
2762
  } else {
2534
- const l = t === "start" ? c.childContainer.node.firstChild : c.childContainer.node.lastChild;
2535
- De(o, l.attrs.id, t);
2763
+ const c = t === "start" ? l.childContainer.node.firstChild : l.childContainer.node.lastChild;
2764
+ De(n, c.attrs.id, t);
2536
2765
  }
2537
2766
  }
2538
- class xn {
2767
+ class Mn {
2539
2768
  constructor(e) {
2540
2769
  this.editor = e;
2541
2770
  }
@@ -2546,7 +2775,7 @@ class xn {
2546
2775
  * If the selection starts / ends halfway through a block, the returned data will contain the entire block.
2547
2776
  */
2548
2777
  getSelection() {
2549
- return this.editor.transact((e) => yn(e));
2778
+ return this.editor.transact((e) => xn(e));
2550
2779
  }
2551
2780
  /**
2552
2781
  * Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
@@ -2556,7 +2785,7 @@ class xn {
2556
2785
  * only the part of the block that is included in the selection.
2557
2786
  */
2558
2787
  getSelectionCutBlocks(e = !1) {
2559
- return this.editor.transact((t) => Bn(t, e));
2788
+ return this.editor.transact((t) => Pn(t, e));
2560
2789
  }
2561
2790
  /**
2562
2791
  * Sets the selection to a range of blocks.
@@ -2564,14 +2793,14 @@ class xn {
2564
2793
  * @param endBlock The identifier of the block that should be the end of the selection.
2565
2794
  */
2566
2795
  setSelection(e, t) {
2567
- return this.editor.transact((n) => Sn(n, e, t));
2796
+ return this.editor.transact((o) => En(o, e, t));
2568
2797
  }
2569
2798
  /**
2570
2799
  * Gets a snapshot of the current text cursor position.
2571
2800
  * @returns A snapshot of the current text cursor position.
2572
2801
  */
2573
2802
  getTextCursorPosition() {
2574
- return this.editor.transact((e) => Cn(e));
2803
+ return this.editor.transact((e) => Tn(e));
2575
2804
  }
2576
2805
  /**
2577
2806
  * Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could
@@ -2581,7 +2810,7 @@ class xn {
2581
2810
  */
2582
2811
  setTextCursorPosition(e, t = "start") {
2583
2812
  return this.editor.transact(
2584
- (n) => De(n, e, t)
2813
+ (o) => De(o, e, t)
2585
2814
  );
2586
2815
  }
2587
2816
  /**
@@ -2590,27 +2819,27 @@ class xn {
2590
2819
  getSelectionBoundingBox() {
2591
2820
  if (!this.editor.prosemirrorView)
2592
2821
  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);
2822
+ 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));
2823
+ if (vt(e)) {
2824
+ const r = this.editor.prosemirrorView.nodeDOM(o);
2596
2825
  if (r)
2597
2826
  return r.getBoundingClientRect();
2598
2827
  }
2599
- return Tt(
2828
+ return It(
2600
2829
  this.editor.prosemirrorView,
2601
- n,
2830
+ o,
2602
2831
  s
2603
2832
  ).toJSON();
2604
2833
  }
2605
2834
  }
2606
- class En {
2835
+ class wn {
2607
2836
  constructor(e) {
2608
2837
  /**
2609
2838
  * Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
2610
2839
  */
2611
- h(this, "activeTransaction", null);
2840
+ k(this, "activeTransaction", null);
2612
2841
  // Flag to indicate if we're in a `can` call
2613
- h(this, "isInCan", !1);
2842
+ k(this, "isInCan", !1);
2614
2843
  this.editor = e;
2615
2844
  }
2616
2845
  /**
@@ -2649,8 +2878,8 @@ class En {
2649
2878
  );
2650
2879
  if (this.isInCan)
2651
2880
  return this.canExec(e);
2652
- const t = this.prosemirrorState, n = this.prosemirrorView;
2653
- return e(t, (r) => this.prosemirrorView.dispatch(r), n);
2881
+ const t = this.prosemirrorState, o = this.prosemirrorView;
2882
+ return e(t, (r) => this.prosemirrorView.dispatch(r), o);
2654
2883
  }
2655
2884
  /**
2656
2885
  * Check if a command can be executed. A command should return `false` if it is not valid in the current state.
@@ -2669,8 +2898,8 @@ class En {
2669
2898
  throw new Error(
2670
2899
  "`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call"
2671
2900
  );
2672
- const t = this.prosemirrorState, n = this.prosemirrorView;
2673
- return e(t, void 0, n);
2901
+ const t = this.prosemirrorState, o = this.prosemirrorView;
2902
+ return e(t, void 0, o);
2674
2903
  }
2675
2904
  /**
2676
2905
  * Execute a function within a "blocknote transaction".
@@ -2696,9 +2925,9 @@ class En {
2696
2925
  return e(this.activeTransaction);
2697
2926
  try {
2698
2927
  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;
2928
+ const t = e(this.activeTransaction), o = this.activeTransaction;
2929
+ return this.activeTransaction = null, o && // Only dispatch if the transaction was actually modified in some way
2930
+ (o.docChanged || o.selectionSet || o.scrolledIntoView || o.storedMarksSet || !o.isGeneric) && this.prosemirrorView.dispatch(o), t;
2702
2931
  } finally {
2703
2932
  this.activeTransaction = null;
2704
2933
  }
@@ -2779,17 +3008,17 @@ class En {
2779
3008
  throw new Error("No redo plugin found");
2780
3009
  }
2781
3010
  }
2782
- function wn(o, e, t, n = { updateSelection: !0 }) {
2783
- let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, a = !0, c = !0, i = "";
2784
- if (t.forEach((l) => {
2785
- l.check(), a && l.isText && l.marks.length === 0 ? i += l.text : a = !1, c = c ? l.isBlock : !1;
2786
- }), s === r && c) {
2787
- const { parent: l } = o.doc.resolve(s);
2788
- l.isTextblock && !l.type.spec.code && !l.childCount && (s -= 1, r += 1);
2789
- }
2790
- return a ? o.insertText(i, s, r) : o.replaceWith(s, r, t), n.updateSelection && Pt(o, o.steps.length - 1, -1), !0;
3011
+ function vn(n, e, t, o = { updateSelection: !0 }) {
3012
+ let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, i = !0, l = !0, a = "";
3013
+ if (t.forEach((c) => {
3014
+ c.check(), i && c.isText && c.marks.length === 0 ? a += c.text : i = !1, l = l ? c.isBlock : !1;
3015
+ }), s === r && l) {
3016
+ const { parent: c } = n.doc.resolve(s);
3017
+ c.isTextblock && !c.type.spec.code && !c.childCount && (s -= 1, r += 1);
3018
+ }
3019
+ return i ? n.insertText(a, s, r) : n.replaceWith(s, r, t), o.updateSelection && At(n, n.steps.length - 1, -1), !0;
2791
3020
  }
2792
- class Mn {
3021
+ class In {
2793
3022
  constructor(e) {
2794
3023
  this.editor = e;
2795
3024
  }
@@ -2799,15 +3028,15 @@ class Mn {
2799
3028
  * @param content can be a string, or array of partial inline content elements
2800
3029
  */
2801
3030
  insertInlineContent(e, { updateSelection: t = !1 } = {}) {
2802
- const n = O(e, this.editor.pmSchema);
3031
+ const o = V(e, this.editor.pmSchema);
2803
3032
  this.editor.transact((s) => {
2804
- wn(
3033
+ vn(
2805
3034
  s,
2806
3035
  {
2807
3036
  from: s.selection.from,
2808
3037
  to: s.selection.to
2809
3038
  },
2810
- n,
3039
+ o,
2811
3040
  {
2812
3041
  updateSelection: t
2813
3042
  }
@@ -2819,8 +3048,8 @@ class Mn {
2819
3048
  */
2820
3049
  getActiveStyles() {
2821
3050
  return this.editor.transact((e) => {
2822
- const t = {}, n = e.selection.$to.marks();
2823
- for (const s of n) {
3051
+ const t = {}, o = e.selection.$to.marks();
3052
+ for (const s of o) {
2824
3053
  const r = this.editor.schema.styleSchema[s.type.name];
2825
3054
  if (!r) {
2826
3055
  // Links are not considered styles in blocknote
@@ -2838,7 +3067,7 @@ class Mn {
2838
3067
  * @param styles The styles to add.
2839
3068
  */
2840
3069
  addStyles(e) {
2841
- for (const [t, n] of Object.entries(e)) {
3070
+ for (const [t, o] of Object.entries(e)) {
2842
3071
  const s = this.editor.schema.styleSchema[t];
2843
3072
  if (!s)
2844
3073
  throw new Error(`style ${t} not found in styleSchema`);
@@ -2846,10 +3075,10 @@ class Mn {
2846
3075
  this.editor._tiptapEditor.commands.setMark(t);
2847
3076
  else if (s.propSchema === "string")
2848
3077
  this.editor._tiptapEditor.commands.setMark(t, {
2849
- stringValue: n
3078
+ stringValue: o
2850
3079
  });
2851
3080
  else
2852
- throw new F(s.propSchema);
3081
+ throw new U(s.propSchema);
2853
3082
  }
2854
3083
  }
2855
3084
  /**
@@ -2865,7 +3094,7 @@ class Mn {
2865
3094
  * @param styles The styles to toggle.
2866
3095
  */
2867
3096
  toggleStyles(e) {
2868
- for (const [t, n] of Object.entries(e)) {
3097
+ for (const [t, o] of Object.entries(e)) {
2869
3098
  const s = this.editor.schema.styleSchema[t];
2870
3099
  if (!s)
2871
3100
  throw new Error(`style ${t} not found in styleSchema`);
@@ -2873,10 +3102,10 @@ class Mn {
2873
3102
  this.editor._tiptapEditor.commands.toggleMark(t);
2874
3103
  else if (s.propSchema === "string")
2875
3104
  this.editor._tiptapEditor.commands.toggleMark(t, {
2876
- stringValue: n
3105
+ stringValue: o
2877
3106
  });
2878
3107
  else
2879
- throw new F(s.propSchema);
3108
+ throw new U(s.propSchema);
2880
3109
  }
2881
3110
  }
2882
3111
  /**
@@ -2899,110 +3128,135 @@ class Mn {
2899
3128
  createLink(e, t) {
2900
3129
  if (e === "")
2901
3130
  return;
2902
- const n = this.editor.pmSchema.mark("link", { href: e });
3131
+ const o = this.editor.pmSchema.mark("link", { href: e });
2903
3132
  this.editor.transact((s) => {
2904
- 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(
3133
+ const { from: r, to: i } = s.selection;
3134
+ t ? s.insertText(t, r, i).addMark(r, r + t.length, o) : s.setSelection(Qt.create(s.doc, i)).addMark(
2906
3135
  r,
2907
- a,
2908
- n
3136
+ i,
3137
+ o
2909
3138
  );
2910
3139
  });
2911
3140
  }
2912
3141
  }
2913
- function Tn(o, e) {
3142
+ function An(n) {
3143
+ return Nt(n.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
3144
+ }
3145
+ function Oe(n, e) {
3146
+ var s;
3147
+ const t = e.nodes.hardBreak;
3148
+ let o = R.empty;
3149
+ return n.forEach((r) => {
3150
+ 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(
3151
+ Oe(r.content, e)
3152
+ ), o = o.addToEnd(t.create()));
3153
+ }), ((s = o.lastChild) == null ? void 0 : s.type) === t && (o = o.cut(0, o.size - 1)), o;
3154
+ }
3155
+ function Nn(n, e) {
2914
3156
  const t = [];
2915
- return o.forEach((n, s, r) => {
2916
- r !== e && t.push(n);
2917
- }), Z.from(t);
3157
+ return n.forEach((o, s, r) => {
3158
+ r !== e && t.push(o);
3159
+ }), R.from(t);
2918
3160
  }
2919
- function Pn(o, e) {
3161
+ function _n(n, e) {
2920
3162
  const t = [];
2921
- for (let n = 0; n < o.childCount; n++)
2922
- if (o.child(n).type.name === "tableRow")
3163
+ for (let o = 0; o < n.childCount; o++)
3164
+ if (n.child(o).type.name === "tableRow")
2923
3165
  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)));
3166
+ const s = t[t.length - 1], r = s.copy(s.content.addToEnd(n.child(o)));
2925
3167
  t[t.length - 1] = r;
2926
3168
  } else {
2927
3169
  const s = e.nodes.table.createChecked(
2928
3170
  void 0,
2929
- o.child(n)
3171
+ n.child(o)
2930
3172
  );
2931
3173
  t.push(s);
2932
3174
  }
2933
3175
  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));
3176
+ t.push(n.child(o));
3177
+ return n = R.from(t), n;
3178
+ }
3179
+ function Ln(n, e) {
3180
+ let t = R.from(n.content);
3181
+ if (t = _n(t, e.state.schema), An(e)) {
3182
+ let o = !1;
3183
+ if (t.descendants((s) => {
3184
+ s.type.isInGroup("tableContent") && (o = !0);
3185
+ }), !o && // is the content valid for a table paragraph?
3186
+ !e.state.schema.nodes.tableParagraph.validContent(t))
3187
+ return new j(
3188
+ Oe(t, e.state.schema),
3189
+ 0,
3190
+ 0
3191
+ );
3192
+ }
3193
+ if (!Dn(t, e))
3194
+ return new j(t, n.openStart, n.openEnd);
3195
+ for (let o = 0; o < t.childCount; o++)
3196
+ if (t.child(o).type.spec.group === "blockContent") {
3197
+ const s = [t.child(o)];
3198
+ if (o + 1 < t.childCount && t.child(o + 1).type.name === "blockGroup") {
3199
+ const i = t.child(o + 1).child(0).child(0);
3200
+ (i.type.name === "bulletListItem" || i.type.name === "numberedListItem" || i.type.name === "checkListItem") && (s.push(t.child(o + 1)), t = Nn(t, o + 1));
2947
3201
  }
2948
3202
  const r = e.state.schema.nodes.blockContainer.createChecked(
2949
3203
  void 0,
2950
3204
  s
2951
3205
  );
2952
- t = t.replaceChild(n, r);
3206
+ t = t.replaceChild(o, r);
2953
3207
  }
2954
- return new ne(t, o.openStart, o.openEnd);
3208
+ return new j(t, n.openStart, n.openEnd);
2955
3209
  }
2956
- function In(o, e) {
2957
- 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+";
3210
+ function Dn(n, e) {
3211
+ var r, i;
3212
+ const t = n.childCount === 1, o = ((r = n.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((i = n.firstChild) == null ? void 0 : i.type.spec.content) === "tableRow+";
2959
3213
  if (t) {
2960
- if (n)
3214
+ if (o)
2961
3215
  return !1;
2962
3216
  if (s) {
2963
- const c = B(e.state);
2964
- if (c.isBlockContainer)
2965
- return !(c.blockContent.node.type.spec.content === "tableRow+");
3217
+ const l = B(e.state);
3218
+ if (l.isBlockContainer)
3219
+ return !(l.blockContent.node.type.spec.content === "tableRow+");
2966
3220
  }
2967
3221
  }
2968
3222
  return !0;
2969
3223
  }
2970
- const An = {
3224
+ const On = {
2971
3225
  enableInputRules: !0,
2972
3226
  enablePasteRules: !0,
2973
3227
  enableCoreExtensions: !1
2974
3228
  };
2975
- class Le extends Se {
3229
+ class $e extends Ce {
2976
3230
  constructor(t) {
2977
- var l, d, u, p, m, f, k, g, y, T;
3231
+ var c, d, u, p, h, f, m, b, g, x;
2978
3232
  super();
2979
3233
  /**
2980
3234
  * The underlying prosemirror schema
2981
3235
  */
2982
- h(this, "pmSchema");
2983
- h(this, "_tiptapEditor");
3236
+ k(this, "pmSchema");
3237
+ k(this, "_tiptapEditor");
2984
3238
  /**
2985
3239
  * Used by React to store a reference to an `ElementRenderer` helper utility to make sure we can render React elements
2986
3240
  * in the correct context (used by `ReactRenderUtil`)
2987
3241
  */
2988
- h(this, "elementRenderer", null);
3242
+ k(this, "elementRenderer", null);
2989
3243
  /**
2990
3244
  * Cache of all blocks. This makes sure we don't have to "recompute" blocks if underlying Prosemirror Nodes haven't changed.
2991
3245
  * This is especially useful when we want to keep track of the same block across multiple operations,
2992
3246
  * with this cache, blocks stay the same object reference (referential equality with ===).
2993
3247
  */
2994
- h(this, "blockCache", /* @__PURE__ */ new WeakMap());
3248
+ k(this, "blockCache", /* @__PURE__ */ new WeakMap());
2995
3249
  /**
2996
3250
  * The dictionary contains translations for the editor.
2997
3251
  */
2998
- h(this, "dictionary");
3252
+ k(this, "dictionary");
2999
3253
  /**
3000
3254
  * The schema of the editor. The schema defines which Blocks, InlineContent, and Styles are available in the editor.
3001
3255
  */
3002
- h(this, "schema");
3003
- h(this, "blockImplementations");
3004
- h(this, "inlineContentImplementations");
3005
- h(this, "styleImplementations");
3256
+ k(this, "schema");
3257
+ k(this, "blockImplementations");
3258
+ k(this, "inlineContentImplementations");
3259
+ k(this, "styleImplementations");
3006
3260
  /**
3007
3261
  * The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).
3008
3262
  * This method should set when creating the editor as this is application-specific.
@@ -3012,111 +3266,111 @@ class Le extends Se {
3012
3266
  * @param file The file that should be uploaded.
3013
3267
  * @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)
3014
3268
  */
3015
- h(this, "uploadFile");
3016
- h(this, "onUploadStartCallbacks", []);
3017
- h(this, "onUploadEndCallbacks", []);
3018
- h(this, "resolveFileUrl");
3269
+ k(this, "uploadFile");
3270
+ k(this, "onUploadStartCallbacks", []);
3271
+ k(this, "onUploadEndCallbacks", []);
3272
+ k(this, "resolveFileUrl");
3019
3273
  /**
3020
3274
  * Editor settings
3021
3275
  */
3022
- h(this, "settings");
3276
+ k(this, "settings");
3023
3277
  // Manager instances
3024
- h(this, "_blockManager");
3025
- h(this, "_eventManager");
3026
- h(this, "_exportManager");
3027
- h(this, "_extensionManager");
3028
- h(this, "_selectionManager");
3029
- h(this, "_stateManager");
3030
- h(this, "_styleManager");
3278
+ k(this, "_blockManager");
3279
+ k(this, "_eventManager");
3280
+ k(this, "_exportManager");
3281
+ k(this, "_extensionManager");
3282
+ k(this, "_selectionManager");
3283
+ k(this, "_stateManager");
3284
+ k(this, "_styleManager");
3031
3285
  /**
3032
3286
  * Remove extension(s) from the editor
3033
3287
  */
3034
- h(this, "unregisterExtension", (...t) => this._extensionManager.unregisterExtension(...t));
3288
+ k(this, "unregisterExtension", (...t) => this._extensionManager.unregisterExtension(...t));
3035
3289
  /**
3036
3290
  * Register extension(s) to the editor
3037
3291
  */
3038
- h(this, "registerExtension", (...t) => this._extensionManager.registerExtension(...t));
3292
+ k(this, "registerExtension", (...t) => this._extensionManager.registerExtension(...t));
3039
3293
  /**
3040
3294
  * Get an extension from the editor
3041
3295
  */
3042
- h(this, "getExtension", (...t) => this._extensionManager.getExtension(...t));
3296
+ k(this, "getExtension", (...t) => this._extensionManager.getExtension(...t));
3043
3297
  /**
3044
3298
  * Mount the editor to a DOM element.
3045
3299
  *
3046
3300
  * @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
3047
3301
  */
3048
- h(this, "mount", (t) => {
3302
+ k(this, "mount", (t) => {
3049
3303
  this._tiptapEditor.mount({ mount: t });
3050
3304
  });
3051
3305
  /**
3052
3306
  * Unmount the editor from the DOM element it is bound to
3053
3307
  */
3054
- h(this, "unmount", () => {
3308
+ k(this, "unmount", () => {
3055
3309
  this._tiptapEditor.unmount();
3056
3310
  });
3057
- this.options = t, this.dictionary = t.dictionary || _t, this.settings = {
3311
+ this.options = t, this.dictionary = t.dictionary || Ot, this.settings = {
3058
3312
  tables: {
3059
- splitCells: ((l = t == null ? void 0 : t.tables) == null ? void 0 : l.splitCells) ?? !1,
3313
+ splitCells: ((c = t == null ? void 0 : t.tables) == null ? void 0 : c.splitCells) ?? !1,
3060
3314
  cellBackgroundColor: ((d = t == null ? void 0 : t.tables) == null ? void 0 : d.cellBackgroundColor) ?? !1,
3061
3315
  cellTextColor: ((u = t == null ? void 0 : t.tables) == null ? void 0 : u.cellTextColor) ?? !1,
3062
3316
  headers: ((p = t == null ? void 0 : t.tables) == null ? void 0 : p.headers) ?? !1
3063
3317
  }
3064
3318
  };
3065
- const n = {
3319
+ const o = {
3066
3320
  defaultStyles: !0,
3067
- schema: t.schema || Et.create(),
3321
+ schema: t.schema || Mt.create(),
3068
3322
  ...t,
3069
3323
  placeholders: {
3070
3324
  ...this.dictionary.placeholders,
3071
3325
  ...t.placeholders
3072
3326
  }
3073
3327
  };
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) => {
3328
+ if (this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, o.uploadFile) {
3329
+ const y = o.uploadFile;
3330
+ this.uploadFile = async (I, M) => {
3077
3331
  this.onUploadStartCallbacks.forEach(
3078
- (v) => v.apply(this, [M])
3332
+ (A) => A.apply(this, [M])
3079
3333
  );
3080
3334
  try {
3081
- return await S(P, M);
3335
+ return await y(I, M);
3082
3336
  } finally {
3083
3337
  this.onUploadEndCallbacks.forEach(
3084
- (v) => v.apply(this, [M])
3338
+ (A) => A.apply(this, [M])
3085
3339
  );
3086
3340
  }
3087
3341
  };
3088
3342
  }
3089
- this.resolveFileUrl = n.resolveFileUrl, this._eventManager = new So(this), this._extensionManager = new gn(this, n);
3343
+ this.resolveFileUrl = o.resolveFileUrl, this._eventManager = new Eo(this), this._extensionManager = new Cn(this, o);
3090
3344
  const s = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
3091
- r && n.initialContent && console.warn(
3345
+ r && o.initialContent && console.warn(
3092
3346
  "When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
3093
3347
  );
3094
- const a = {
3095
- ...An,
3096
- ...n._tiptapOptions,
3348
+ const i = {
3349
+ ...On,
3350
+ ...o._tiptapOptions,
3097
3351
  element: null,
3098
- autofocus: n.autofocus ?? !1,
3352
+ autofocus: o.autofocus ?? !1,
3099
3353
  extensions: s,
3100
3354
  editorProps: {
3101
- ...(m = n._tiptapOptions) == null ? void 0 : m.editorProps,
3355
+ ...(h = o._tiptapOptions) == null ? void 0 : h.editorProps,
3102
3356
  attributes: {
3103
3357
  // As of TipTap v2.5.0 the tabIndex is removed when the editor is not
3104
3358
  // editable, so you can't focus it. We want to revert this as we have
3105
3359
  // UI behaviour that relies on it.
3106
3360
  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(
3361
+ ...(m = (f = o._tiptapOptions) == null ? void 0 : f.editorProps) == null ? void 0 : m.attributes,
3362
+ ...(b = o.domAttributes) == null ? void 0 : b.editor,
3363
+ class: ee(
3110
3364
  "bn-editor",
3111
- n.defaultStyles ? "bn-default-styles" : "",
3112
- ((T = (y = n.domAttributes) == null ? void 0 : y.editor) == null ? void 0 : T.class) || ""
3365
+ o.defaultStyles ? "bn-default-styles" : "",
3366
+ ((x = (g = o.domAttributes) == null ? void 0 : g.editor) == null ? void 0 : x.class) || ""
3113
3367
  )
3114
3368
  },
3115
- transformPasted: vn
3369
+ transformPasted: Ln
3116
3370
  }
3117
3371
  };
3118
3372
  try {
3119
- const S = n.initialContent || (r ? [
3373
+ const y = o.initialContent || (r ? [
3120
3374
  {
3121
3375
  type: "paragraph",
3122
3376
  id: "initialBlockId"
@@ -3124,16 +3378,16 @@ class Le extends Se {
3124
3378
  ] : [
3125
3379
  {
3126
3380
  type: "paragraph",
3127
- id: me.options.generateID()
3381
+ id: ke.options.generateID()
3128
3382
  }
3129
3383
  ]);
3130
- if (!Array.isArray(S) || S.length === 0)
3384
+ if (!Array.isArray(y) || y.length === 0)
3131
3385
  throw new Error(
3132
- "initialContent must be a non-empty array of blocks, received: " + S
3386
+ "initialContent must be a non-empty array of blocks, received: " + y
3133
3387
  );
3134
- const P = vt(a.extensions), M = S.map(
3135
- (Ne) => J(Ne, P, this.schema.styleSchema).toJSON()
3136
- ), v = It(
3388
+ const I = _t(i.extensions), M = y.map(
3389
+ (He) => Z(He, I, this.schema.styleSchema).toJSON()
3390
+ ), A = Lt(
3137
3391
  {
3138
3392
  type: "doc",
3139
3393
  content: [
@@ -3143,30 +3397,30 @@ class Le extends Se {
3143
3397
  }
3144
3398
  ]
3145
3399
  },
3146
- P,
3147
- a.parseOptions
3400
+ I,
3401
+ i.parseOptions
3148
3402
  );
3149
- this._tiptapEditor = new At({
3150
- ...a,
3151
- content: v.toJSON()
3403
+ this._tiptapEditor = new Dt({
3404
+ ...i,
3405
+ content: A.toJSON()
3152
3406
  }), this.pmSchema = this._tiptapEditor.schema;
3153
- } catch (S) {
3407
+ } catch (y) {
3154
3408
  throw new Error(
3155
3409
  "Error creating document from blocks passed as `initialContent`",
3156
- { cause: S }
3410
+ { cause: y }
3157
3411
  );
3158
3412
  }
3159
- let c;
3160
- const i = this.pmSchema.nodes.doc.createAndFill;
3161
- this.pmSchema.nodes.doc.createAndFill = (...S) => {
3162
- if (c)
3163
- 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");
3413
+ let l;
3414
+ const a = this.pmSchema.nodes.doc.createAndFill;
3415
+ this.pmSchema.nodes.doc.createAndFill = (...y) => {
3416
+ if (l)
3417
+ return l;
3418
+ const I = a.apply(this.pmSchema.nodes.doc, y), M = JSON.parse(JSON.stringify(I.toJSON()));
3419
+ return M.content[0].content[0].attrs.id = "initialBlockId", l = ze.fromJSON(this.pmSchema, M), l;
3420
+ }, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new xo(this), this._exportManager = new Lo(this), this._selectionManager = new Mn(this), this._stateManager = new wn(this), this._styleManager = new In(this), this.emit("create");
3167
3421
  }
3168
3422
  static create(t) {
3169
- return new Le(t ?? {});
3423
+ return new $e(t ?? {});
3170
3424
  }
3171
3425
  /**
3172
3426
  * BlockNote extensions that are added to the editor, keyed by the extension key
@@ -3269,14 +3523,14 @@ class Le extends Se {
3269
3523
  // TODO move to extension
3270
3524
  onUploadStart(t) {
3271
3525
  return this.onUploadStartCallbacks.push(t), () => {
3272
- const n = this.onUploadStartCallbacks.indexOf(t);
3273
- n > -1 && this.onUploadStartCallbacks.splice(n, 1);
3526
+ const o = this.onUploadStartCallbacks.indexOf(t);
3527
+ o > -1 && this.onUploadStartCallbacks.splice(o, 1);
3274
3528
  };
3275
3529
  }
3276
3530
  onUploadEnd(t) {
3277
3531
  return this.onUploadEndCallbacks.push(t), () => {
3278
- const n = this.onUploadEndCallbacks.indexOf(t);
3279
- n > -1 && this.onUploadEndCallbacks.splice(n, 1);
3532
+ const o = this.onUploadEndCallbacks.indexOf(t);
3533
+ o > -1 && this.onUploadEndCallbacks.splice(o, 1);
3280
3534
  };
3281
3535
  }
3282
3536
  /**
@@ -3340,8 +3594,8 @@ class Le extends Se {
3340
3594
  * @param callback The callback to execute for each block. Returning `false` stops the traversal.
3341
3595
  * @param reverse Whether the blocks should be traversed in reverse order.
3342
3596
  */
3343
- forEachBlock(t, n = !1) {
3344
- this._blockManager.forEachBlock(t, n);
3597
+ forEachBlock(t, o = !1) {
3598
+ this._blockManager.forEachBlock(t, o);
3345
3599
  }
3346
3600
  /**
3347
3601
  * Executes a callback whenever the editor's contents change.
@@ -3382,8 +3636,8 @@ class Le extends Se {
3382
3636
  * @param targetBlock The identifier of an existing block that the text cursor should be moved to.
3383
3637
  * @param placement Whether the text cursor should be placed at the start or end of the block.
3384
3638
  */
3385
- setTextCursorPosition(t, n = "start") {
3386
- return this._selectionManager.setTextCursorPosition(t, n);
3639
+ setTextCursorPosition(t, o = "start") {
3640
+ return this._selectionManager.setTextCursorPosition(t, o);
3387
3641
  }
3388
3642
  /**
3389
3643
  * Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
@@ -3409,8 +3663,8 @@ class Le extends Se {
3409
3663
  * @param startBlock The identifier of the block that should be the start of the selection.
3410
3664
  * @param endBlock The identifier of the block that should be the end of the selection.
3411
3665
  */
3412
- setSelection(t, n) {
3413
- return this._selectionManager.setSelection(t, n);
3666
+ setSelection(t, o) {
3667
+ return this._selectionManager.setSelection(t, o);
3414
3668
  }
3415
3669
  /**
3416
3670
  * Checks if the editor is currently editable, or if it's locked.
@@ -3434,10 +3688,10 @@ class Le extends Se {
3434
3688
  * @param placement Whether the blocks should be inserted just before, just after, or nested inside the
3435
3689
  * `referenceBlock`.
3436
3690
  */
3437
- insertBlocks(t, n, s = "before") {
3691
+ insertBlocks(t, o, s = "before") {
3438
3692
  return this._blockManager.insertBlocks(
3439
3693
  t,
3440
- n,
3694
+ o,
3441
3695
  s
3442
3696
  );
3443
3697
  }
@@ -3448,8 +3702,8 @@ class Le extends Se {
3448
3702
  * @param blockToUpdate The block that should be updated.
3449
3703
  * @param update A partial block which defines how the existing block should be changed.
3450
3704
  */
3451
- updateBlock(t, n) {
3452
- return this._blockManager.updateBlock(t, n);
3705
+ updateBlock(t, o) {
3706
+ return this._blockManager.updateBlock(t, o);
3453
3707
  }
3454
3708
  /**
3455
3709
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
@@ -3465,8 +3719,8 @@ class Le extends Se {
3465
3719
  * @param blocksToRemove An array of blocks that should be replaced.
3466
3720
  * @param blocksToInsert An array of partial blocks to replace the old ones with.
3467
3721
  */
3468
- replaceBlocks(t, n) {
3469
- return this._blockManager.replaceBlocks(t, n);
3722
+ replaceBlocks(t, o) {
3723
+ return this._blockManager.replaceBlocks(t, o);
3470
3724
  }
3471
3725
  /**
3472
3726
  * Undo the last action.
@@ -3485,8 +3739,8 @@ class Le extends Se {
3485
3739
  *
3486
3740
  * @param content can be a string, or array of partial inline content elements
3487
3741
  */
3488
- insertInlineContent(t, { updateSelection: n = !1 } = {}) {
3489
- this._styleManager.insertInlineContent(t, { updateSelection: n });
3742
+ insertInlineContent(t, { updateSelection: o = !1 } = {}) {
3743
+ this._styleManager.insertInlineContent(t, { updateSelection: o });
3490
3744
  }
3491
3745
  /**
3492
3746
  * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
@@ -3532,8 +3786,8 @@ class Le extends Se {
3532
3786
  * @param url The link URL.
3533
3787
  * @param text The text to display the link with.
3534
3788
  */
3535
- createLink(t, n) {
3536
- this._styleManager.createLink(t, n);
3789
+ createLink(t, o) {
3790
+ this._styleManager.createLink(t, o);
3537
3791
  }
3538
3792
  /**
3539
3793
  * Checks if the block containing the text cursor can be nested.
@@ -3632,8 +3886,8 @@ class Le extends Se {
3632
3886
  * @param callback The callback to execute.
3633
3887
  * @returns A function to remove the callback.
3634
3888
  */
3635
- onChange(t, n) {
3636
- return this._eventManager.onChange(t, n);
3889
+ onChange(t, o) {
3890
+ return this._eventManager.onChange(t, o);
3637
3891
  }
3638
3892
  /**
3639
3893
  * A callback function that runs whenever the text cursor position or selection changes.
@@ -3641,10 +3895,10 @@ class Le extends Se {
3641
3895
  * @param callback The callback to execute.
3642
3896
  * @returns A function to remove the callback.
3643
3897
  */
3644
- onSelectionChange(t, n) {
3898
+ onSelectionChange(t, o) {
3645
3899
  return this._eventManager.onSelectionChange(
3646
3900
  t,
3647
- n
3901
+ o
3648
3902
  );
3649
3903
  }
3650
3904
  /**
@@ -3685,8 +3939,8 @@ class Le extends Se {
3685
3939
  * @param html The HTML to paste.
3686
3940
  * @param raw Whether to paste the HTML as is, or to convert it to BlockNote HTML.
3687
3941
  */
3688
- pasteHTML(t, n = !1) {
3689
- this._exportManager.pasteHTML(t, n);
3942
+ pasteHTML(t, o = !1) {
3943
+ this._exportManager.pasteHTML(t, o);
3690
3944
  }
3691
3945
  /**
3692
3946
  * Paste text into the editor. Defaults to interpreting text as markdown.
@@ -3703,19 +3957,19 @@ class Le extends Se {
3703
3957
  return this._exportManager.pasteMarkdown(t);
3704
3958
  }
3705
3959
  }
3706
- class rs {
3707
- constructor(e, t, n) {
3708
- this.mappings = t, this.options = n;
3960
+ class ds {
3961
+ constructor(e, t, o) {
3962
+ this.mappings = t, this.options = o;
3709
3963
  }
3710
3964
  async resolveFile(e) {
3711
- var n;
3712
- if (!((n = this.options) != null && n.resolveFileUrl))
3965
+ var o;
3966
+ if (!((o = this.options) != null && o.resolveFileUrl))
3713
3967
  return (await fetch(e)).blob();
3714
3968
  const t = await this.options.resolveFileUrl(e);
3715
3969
  return t instanceof Blob ? t : (await fetch(t)).blob();
3716
3970
  }
3717
3971
  mapStyles(e) {
3718
- return Object.entries(e).map(([n, s]) => this.mappings.styleMapping[n](s, this));
3972
+ return Object.entries(e).map(([o, s]) => this.mappings.styleMapping[o](s, this));
3719
3973
  }
3720
3974
  mapInlineContent(e) {
3721
3975
  return this.mappings.inlineContentMapping[e.type](
@@ -3726,201 +3980,201 @@ class rs {
3726
3980
  transformInlineContent(e) {
3727
3981
  return e.map((t) => this.mapInlineContent(t));
3728
3982
  }
3729
- async mapBlock(e, t, n, s) {
3983
+ async mapBlock(e, t, o, s) {
3730
3984
  return this.mappings.blockMapping[e.type](
3731
3985
  e,
3732
3986
  this,
3733
3987
  t,
3734
- n,
3988
+ o,
3735
3989
  s
3736
3990
  );
3737
3991
  }
3738
3992
  }
3739
- function as(o) {
3993
+ function us(n) {
3740
3994
  return {
3741
3995
  createBlockMapping: (e) => e,
3742
3996
  createInlineContentMapping: (e) => e,
3743
3997
  createStyleMapping: (e) => e
3744
3998
  };
3745
3999
  }
3746
- function is(o, ...e) {
3747
- const t = [...o];
3748
- for (const n of e)
3749
- for (const s of n) {
4000
+ function ps(n, ...e) {
4001
+ const t = [...n];
4002
+ for (const o of e)
4003
+ for (const s of o) {
3750
4004
  const r = t.findLastIndex(
3751
- (a) => a.group === s.group
4005
+ (i) => i.group === s.group
3752
4006
  );
3753
4007
  r === -1 ? t.push(s) : t.splice(r + 1, 0, s);
3754
4008
  }
3755
4009
  return t;
3756
4010
  }
3757
4011
  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,
3765
- 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,
3770
- Pe as HTMLToBlocks,
3771
- me as UniqueID,
3772
- 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,
4012
+ $e as BlockNoteEditor,
4013
+ Mt as BlockNoteSchema,
4014
+ Is as COLORS_DARK_MODE_DEFAULT,
4015
+ As as COLORS_DEFAULT,
4016
+ li as CustomBlockNoteSchema,
4017
+ Ns as EMPTY_CELL_HEIGHT,
4018
+ Xe as EMPTY_CELL_WIDTH,
4019
+ Ce as EventEmitter,
4020
+ ds as Exporter,
4021
+ _s as FILE_AUDIO_ICON_SVG,
4022
+ Ls as FILE_IMAGE_ICON_SVG,
4023
+ Ds as FILE_VIDEO_ICON_SVG,
4024
+ ve as HTMLToBlocks,
4025
+ ke as UniqueID,
4026
+ U as UnreachableCaseError,
4027
+ Os as addDefaultPropsExternalHTML,
4028
+ G as addInlineContentAttributes,
4029
+ Je as addInlineContentKeyboardShortcuts,
4030
+ $s as addNodeAndExtensionsToSpec,
4031
+ Hs as addStyleAttributes,
4032
+ Fs as applyNonSelectableBlockFix,
4033
+ ms as assertEmpty,
4034
+ Vs as audioParse,
4035
+ Us as audioRender,
4036
+ zs as audioToExternalHTML,
4037
+ Rs as blockHasType,
4038
+ Z as blockToNode,
4039
+ at as blocksToMarkdown,
4040
+ Gs as camelToDataKebab,
4041
+ js as captureCellAnchor,
4042
+ di as checkPageBreakBlocksInSchema,
4043
+ ct as cleanHTMLToMarkdown,
4044
+ ps as combineByGroup,
4045
+ qe as contentNodeToInlineContent,
4046
+ We as contentNodeToTableContent,
4047
+ Ws as createAudioBlockConfig,
4048
+ qs as createAudioBlockSpec,
4049
+ Ks as createBlockConfig,
4050
+ Js as createBlockSpec,
4051
+ Ys as createBlockSpecFromTiptapNode,
4052
+ Qs as createBulletListItemBlockConfig,
4053
+ Xs as createBulletListItemBlockSpec,
4054
+ Zs as createCheckListItemBlockSpec,
4055
+ er as createCheckListItemConfig,
4056
+ tr as createCodeBlockConfig,
4057
+ or as createCodeBlockSpec,
4058
+ nr as createDefaultBlockDOMOutputSpec,
4059
+ sr as createDividerBlockConfig,
4060
+ rr as createDividerBlockSpec,
4061
+ Vt as createExtension,
4062
+ Be as createExternalHTMLExporter,
4063
+ ir as createFileBlockConfig,
4064
+ ar as createFileBlockSpec,
4065
+ cr as createHeadingBlockConfig,
4066
+ lr as createHeadingBlockSpec,
4067
+ dr as createImageBlockConfig,
4068
+ ur as createImageBlockSpec,
4069
+ ls as createInlineContentSpec,
4070
+ Qe as createInlineContentSpecFromTipTapNode,
4071
+ lo as createInternalHTMLSerializer,
4072
+ pr as createInternalInlineContentSpec,
4073
+ fr as createInternalStyleSpec,
4074
+ hr as createNumberedListItemBlockConfig,
4075
+ mr as createNumberedListItemBlockSpec,
4076
+ ui as createPageBreakBlockConfig,
4077
+ pi as createPageBreakBlockSpec,
4078
+ kr as createParagraphBlockConfig,
4079
+ br as createParagraphBlockSpec,
4080
+ gr as createQuoteBlockConfig,
4081
+ Br as createQuoteBlockSpec,
4082
+ bi as createStore,
4083
+ yr as createStyleSpec,
4084
+ Cr as createStyleSpecFromTipTapMark,
4085
+ Sr as createTableBlockSpec,
4086
+ xr as createToggleListItemBlockConfig,
4087
+ Er as createToggleListItemBlockSpec,
4088
+ Pr as createToggleWrapper,
4089
+ Tr as createVideoBlockConfig,
4090
+ Mr as createVideoBlockSpec,
4091
+ wr as defaultBlockSpecs,
4092
+ vr as defaultBlockToHTML,
4093
+ Ir as defaultInlineContentSchema,
4094
+ Ar as defaultInlineContentSpecs,
4095
+ Nr as defaultProps,
4096
+ _r as defaultStyleSchema,
4097
+ Lr as defaultStyleSpecs,
4098
+ Dr as defaultToggledState,
4099
+ je as docToBlocks,
4100
+ Or as editorHasBlockWithType,
4101
+ Sn as expandPMRangeToWords,
4102
+ $r as fileParse,
4103
+ Hr as filenameFromURL,
4104
+ H as fixColumnList,
4105
+ Fr as formatKeyboardShortcut,
4106
+ tt as getBackgroundColorAttribute,
4107
+ Bo as getBlock,
4108
+ ks as getBlockCache,
4109
+ Vr as getBlockFromPos,
4110
+ K as getBlockInfo,
4111
+ v as getBlockInfoFromResolvedPos,
3858
4112
  B as getBlockInfoFromSelection,
3859
- $ as getBlockInfoFromTransaction,
3860
- ps as getBlockInfoWithManualOffset,
3861
- 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,
3869
- _ as getNearestBlockPos,
3870
- go as getNextBlock,
3871
- x as getNodeById,
3872
- ca as getPageBreakSlashMenuItems,
3873
- bo as getParentBlock,
3874
- $r as getParseRules,
3875
- 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,
3886
- 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,
3902
- 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,
4113
+ z as getBlockInfoFromTransaction,
4114
+ bs as getBlockInfoWithManualOffset,
4115
+ be as getBlockNoteSchema,
4116
+ gs as getBlockSchema,
4117
+ it as getBlocksChangedByTransaction,
4118
+ Bs as getColspan,
4119
+ Xt as getInlineContentParseRules,
4120
+ ys as getInlineContentSchema,
4121
+ Ur as getInlineContentSchemaFromSpecs,
4122
+ zr as getLanguageId,
4123
+ D as getNearestBlockPos,
4124
+ Co as getNextBlock,
4125
+ P as getNodeById,
4126
+ fi as getPageBreakSlashMenuItems,
4127
+ So as getParentBlock,
4128
+ Rr as getParseRules,
4129
+ E as getPmSchema,
4130
+ yo as getPrevBlock,
4131
+ Cs as getRowspan,
4132
+ Gr as getStyleParseRules,
4133
+ Ss as getStyleSchema,
4134
+ jr as getStyleSchemaFromSpecs,
4135
+ Wr as getTextAlignmentAttribute,
4136
+ st as getTextColorAttribute,
4137
+ qr as imageParse,
4138
+ Kr as imageRender,
4139
+ Jr as imageToExternalHTML,
4140
+ V as inlineContentToNodes,
4141
+ Zt as insertBlocks,
4142
+ Yr as isAppleOS,
4143
+ Q as isEmptyColumn,
4144
+ xs as isLinkInlineContent,
4145
+ Qr as isNodeBlock,
4146
+ Es as isPartialLinkInlineContent,
4147
+ Ps as isPartialTableCell,
4148
+ Xr as isSafari,
4149
+ Ts as isStyledTextInlineContent,
4150
+ Ms as isTableCell,
4151
+ Zr as isTableCellSelection,
4152
+ et as isVideoUrl,
4153
+ ws as mapTableCell,
4154
+ us as mappingFactory,
4155
+ _o as markdownToBlocks,
4156
+ Ie as markdownToHTML,
4157
+ ee as mergeCSSClasses,
4158
+ ei as mergeParagraphs,
4159
+ C as nodeToBlock,
4160
+ q as nodeToCustomInlineContent,
4161
+ ti as parseAudioElement,
4162
+ oi as parseDefaultProps,
4163
+ Ye as propsToAttributes,
4164
+ Ke as prosemirrorSliceToSlicedBlocks,
3911
4165
  ae as removeAndInsertBlocks,
3912
- Yt as removeEmptyColumns,
3913
- 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
4166
+ eo as removeEmptyColumns,
4167
+ Ne as selectedFragmentToHTML,
4168
+ ni as stylePropsToAttributes,
4169
+ Ge as tableContentToNodes,
4170
+ si as tablePropSchema,
4171
+ ri as trackPosition,
4172
+ Ze as updateBlock,
4173
+ nt as updateBlockCommand,
4174
+ rt as updateBlockTr,
4175
+ hi as uploadToTmpFilesDotOrg_DEV_ONLY,
4176
+ ii as videoParse,
4177
+ mi as withPageBreak,
4178
+ ai as wrapInBlockStructure
3925
4179
  };
3926
4180
  //# sourceMappingURL=blocknote.js.map