@blocknote/core 0.44.1 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/BlockNoteExtension-BWw0r8Gy.cjs.map +1 -1
  2. package/dist/BlockNoteExtension-C2X7LW-V.js.map +1 -1
  3. package/dist/{BlockNoteSchema-C-l154WP.js → BlockNoteSchema-BOW16JHv.js} +2 -2
  4. package/dist/{BlockNoteSchema-C-l154WP.js.map → BlockNoteSchema-BOW16JHv.js.map} +1 -1
  5. package/dist/{BlockNoteSchema-B4gm-Qco.cjs → BlockNoteSchema-CzZbr4Ed.cjs} +2 -2
  6. package/dist/{BlockNoteSchema-B4gm-Qco.cjs.map → BlockNoteSchema-CzZbr4Ed.cjs.map} +1 -1
  7. package/dist/{TrailingNode-B_zPMWxw.js → TrailingNode-8cXFaQUm.js} +484 -487
  8. package/dist/TrailingNode-8cXFaQUm.js.map +1 -0
  9. package/dist/TrailingNode-DPu6X9ym.cjs +2 -0
  10. package/dist/TrailingNode-DPu6X9ym.cjs.map +1 -0
  11. package/dist/{blockToNode-DBNbhwwC.js → blockToNode-BNoNIXU7.js} +2 -2
  12. package/dist/{blockToNode-DBNbhwwC.js.map → blockToNode-BNoNIXU7.js.map} +1 -1
  13. package/dist/{blockToNode-w7H99R6p.cjs → blockToNode-CumVjgem.cjs} +2 -2
  14. package/dist/{blockToNode-w7H99R6p.cjs.map → blockToNode-CumVjgem.cjs.map} +1 -1
  15. package/dist/blocknote.cjs +4 -4
  16. package/dist/blocknote.cjs.map +1 -1
  17. package/dist/blocknote.js +1180 -1128
  18. package/dist/blocknote.js.map +1 -1
  19. package/dist/blocks.cjs +1 -1
  20. package/dist/blocks.js +2 -2
  21. package/dist/defaultBlocks-D1cc0lV9.cjs +6 -0
  22. package/dist/defaultBlocks-D1cc0lV9.cjs.map +1 -0
  23. package/dist/{defaultBlocks-DgA_mtQV.js → defaultBlocks-DvCGYzqu.js} +164 -202
  24. package/dist/defaultBlocks-DvCGYzqu.js.map +1 -0
  25. package/dist/extensions.cjs +1 -1
  26. package/dist/extensions.js +3 -3
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/dist/webpack-stats.json +1 -1
  29. package/dist/yjs.cjs +1 -1
  30. package/dist/yjs.js +1 -1
  31. package/package.json +15 -15
  32. package/src/api/blockManipulation/selections/selection.ts +9 -4
  33. package/src/api/blockManipulation/tables/tables.test.ts +140 -0
  34. package/src/api/blockManipulation/tables/tables.ts +1 -1
  35. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +1 -1
  36. package/src/api/parsers/markdown/parseMarkdown.ts +11 -0
  37. package/src/blocks/ListItem/CheckListItem/block.ts +2 -2
  38. package/src/editor/BlockNoteEditor.test.ts +60 -1
  39. package/src/editor/BlockNoteEditor.ts +22 -35
  40. package/src/editor/BlockNoteExtension.ts +5 -0
  41. package/src/editor/managers/EventManager.ts +1 -1
  42. package/src/editor/managers/ExtensionManager/extensions.ts +2 -12
  43. package/src/editor/managers/ExtensionManager/index.ts +7 -2
  44. package/src/editor/managers/SelectionManager.ts +10 -10
  45. package/src/extensions/BlockChange/BlockChange.ts +2 -2
  46. package/src/extensions/Collaboration/Collaboration.ts +55 -0
  47. package/src/extensions/Collaboration/ForkYDoc.ts +4 -9
  48. package/src/extensions/Collaboration/YCursorPlugin.ts +56 -60
  49. package/src/extensions/Collaboration/YSync.ts +2 -2
  50. package/src/extensions/Collaboration/YUndo.ts +2 -2
  51. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +40 -68
  52. package/src/extensions/TableHandles/TableHandles.ts +9 -5
  53. package/src/index.ts +2 -1
  54. package/src/schema/blocks/createSpec.ts +3 -0
  55. package/src/util/expandToWords.ts +38 -0
  56. package/types/src/api/blockManipulation/selections/selection.d.ts +1 -1
  57. package/types/src/editor/BlockNoteEditor.d.ts +12 -32
  58. package/types/src/editor/BlockNoteExtension.d.ts +4 -0
  59. package/types/src/editor/managers/SelectionManager.d.ts +4 -4
  60. package/types/src/extensions/Collaboration/Collaboration.d.ts +76 -0
  61. package/types/src/extensions/Collaboration/ForkYDoc.d.ts +2 -11
  62. package/types/src/extensions/Collaboration/YCursorPlugin.d.ts +3 -11
  63. package/types/src/extensions/Collaboration/YSync.d.ts +2 -4
  64. package/types/src/extensions/Collaboration/YUndo.d.ts +1 -1
  65. package/types/src/index.d.ts +2 -1
  66. package/types/src/util/expandToWords.d.ts +13 -0
  67. package/dist/TrailingNode-B_zPMWxw.js.map +0 -1
  68. package/dist/TrailingNode-CRHrgOnK.cjs +0 -2
  69. package/dist/TrailingNode-CRHrgOnK.cjs.map +0 -1
  70. package/dist/defaultBlocks-DLJ4Q1_J.cjs +0 -6
  71. package/dist/defaultBlocks-DLJ4Q1_J.cjs.map +0 -1
  72. package/dist/defaultBlocks-DgA_mtQV.js.map +0 -1
package/dist/blocknote.js CHANGED
@@ -1,208 +1,208 @@
1
- var Ne = Object.defineProperty;
2
- var Oe = (n, e, t) => e in n ? Ne(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var h = (n, e, t) => Oe(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { Slice as N, Fragment as A, DOMSerializer as he, DOMParser as Fe, Node as He } from "prosemirror-model";
5
- import { ReplaceStep as $e, ReplaceAroundStep as V } from "prosemirror-transform";
6
- import { n as U, i as O, g as B, b as Y, a as b, t as Ve, U as F, q as _, r as H, d as Ue, s as ze, u as Ge, v as q, w as S, x as me, y as Re, z as ke, A as z } from "./blockToNode-DBNbhwwC.js";
7
- import { B as es, G as ts, C as os, D as ns, N as ss, E as rs, O as is, F as as, H as cs, I as ls, L as ds, J as us, M as ps, K as fs } from "./blockToNode-DBNbhwwC.js";
8
- import { ak as $, al as je, am as We, an as Ke, aj as E, ao as Je, ap as Ye, a5 as qe, a8 as G, aq as Qe, ar as Xe, a6 as Ze, as as Q, a9 as ge, at as et } from "./defaultBlocks-DgA_mtQV.js";
9
- import { aw as ms, av as ks, E as gs, a as bs, F as ys, r as Ss, N as Bs, a4 as Cs, ad as Es, aG as xs, ax as Ms, b as ws, d as Ts, e as Ps, a0 as vs, aM as Is, au as As, c as _s, f as Ds, ag as Ls, ah as Ns, aB as Os, x as Fs, y as Hs, A as $s, z as Vs, g as Us, h as zs, T as Gs, j as Rs, k as js, l as Ws, n as Ks, o as Js, q as Ys, s as qs, w as Qs, aC as Xs, aH as Zs, B as er, C as tr, H as or, I as nr, J as sr, K as rr, aE as ir, aI as ar, M as cr, D as lr, G as dr, S as ur, O as pr, Q as fr, W as hr, U as mr, _ as kr, Z as gr, a2 as br, Y as yr, X as Sr, R as Br, $ as Cr, m as Er, aN as xr, aK as Mr, az as wr, af as Tr, i as Pr, ay as vr, aD as Ir, ae as Ar, a7 as _r, t as Dr, u as Lr, v as Nr, aJ as Or, ai as Fr, aL as Hr, a1 as $r, V as Vr, p as Ur, a3 as zr, aF as Gr, L as Rr, aO as jr, P as Wr, aA as Kr } from "./defaultBlocks-DgA_mtQV.js";
10
- import { j as tt, k as be, l as ot, m as nt, n as st, c as R, B as rt, D as it, L as at, N as ct, P as lt, g as dt, i as ut, F as pt, Y as ft, a as ht, b as mt, S as kt, H as gt, h as bt, e as yt, V as St, d as Bt } from "./TrailingNode-B_zPMWxw.js";
11
- import { s as Ct, B as Et } from "./BlockNoteSchema-C-l154WP.js";
12
- import { C as Yr, b as qr, c as Qr, a as Xr, g as Zr, u as ei, w as ti } from "./BlockNoteSchema-C-l154WP.js";
13
- import { Node as D, Extension as x, mergeAttributes as xt, Mark as X, extensions as I, isNodeSelection as Mt, posToDOMRect as wt, selectionToInsertionEnd as Tt, getSchema as Pt, createDocument as vt, Editor as It } from "@tiptap/core";
14
- import { E as ye } from "./EventEmitter-CjSwpTbz.js";
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 q, 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 ns, G as ss, C as rs, D as is, N as as, E as cs, O as ls, F as ds, H as us, I as ps, L as fs, J as hs, M as ms, K as ks } from "./blockToNode-BNoNIXU7.js";
8
+ import { ak as H, al as We, am as Ke, an as Je, aj as x, ao as qe, ap as Ye, a5 as Qe, a8 as G, aq as Xe, ar as Ze, a6 as et, as as Q, a9 as ge, at as tt } from "./defaultBlocks-DvCGYzqu.js";
9
+ import { aw as bs, av as ys, E as Ss, a as Bs, F as Cs, r as xs, N as Es, a4 as Ms, ad as ws, aG as Ts, ax as Ps, b as vs, d as Is, e as As, a0 as _s, aM as Ds, au as Ls, c as Ns, f as Os, ag as Fs, ah as $s, aB as Hs, x as Vs, y as Us, A as zs, z as Gs, g as Rs, h as js, T as Ws, j as Ks, k as Js, l as qs, n as Ys, o as Qs, q as Xs, s as Zs, w as er, aC as tr, aH as or, B as nr, C as sr, H as rr, I as ir, J as ar, K as cr, aE as lr, aI as dr, M as ur, D as pr, G as fr, S as hr, O as mr, Q as kr, W as gr, U as br, _ as yr, Z as Sr, a2 as Br, Y as Cr, X as xr, R as Er, $ as Mr, m as wr, aN as Tr, aK as Pr, az as vr, af as Ir, i as Ar, ay as _r, aD as Dr, ae as Lr, a7 as Nr, t as Or, u as Fr, v as $r, aJ as Hr, ai as Vr, aL as Ur, a1 as zr, V as Gr, p as Rr, a3 as jr, aF as Wr, L as Kr, aO as Jr, P as qr, aA as Yr } from "./defaultBlocks-DvCGYzqu.js";
10
+ import { j as ot, k as be, l as nt, m as st, n as rt, c as R, F as it, Y as at, a as ct, b as lt, S as dt, B as ye, D as ut, L as pt, N as ft, P as ht, g as mt, i as kt, H as gt, h as bt, e as yt, V as St, d as Bt } from "./TrailingNode-8cXFaQUm.js";
11
+ import { s as Ct, B as xt } from "./BlockNoteSchema-BOW16JHv.js";
12
+ import { C as Xr, b as Zr, c as ei, a as ti, g as oi, u as ni, w as si } from "./BlockNoteSchema-BOW16JHv.js";
13
+ import { Node as D, Extension as E, mergeAttributes as Et, Mark as X, extensions as I, isNodeSelection as Mt, posToDOMRect as wt, selectionToInsertionEnd as Tt, getSchema as Pt, createDocument as vt, Editor as It } from "@tiptap/core";
14
+ import { E as Se } from "./EventEmitter-CjSwpTbz.js";
15
15
  import { Fragment as Z, Slice as ne } from "@tiptap/pm/model";
16
16
  import { e as At } from "./en-njEqD7AG.js";
17
17
  import { inputRules as _t, InputRule as Dt } from "@handlewithcare/prosemirror-inputrules";
18
18
  import { keymap as Lt } from "@tiptap/pm/keymap";
19
- import { o as Nt } from "./BlockNoteExtension-C2X7LW-V.js";
20
- import { c as ni, a as si } from "./BlockNoteExtension-C2X7LW-V.js";
21
- import { Gapcursor as Ot } from "@tiptap/extension-gapcursor";
22
- import { Link as Ft } from "@tiptap/extension-link";
19
+ import { c as Nt, o as Ot } from "./BlockNoteExtension-C2X7LW-V.js";
20
+ import { a as ii } from "./BlockNoteExtension-C2X7LW-V.js";
21
+ import { Gapcursor as Ft } from "@tiptap/extension-gapcursor";
22
+ import { Link as $t } from "@tiptap/extension-link";
23
23
  import { Text as Ht } from "@tiptap/extension-text";
24
24
  import { NodeSelection as L, TextSelection as M, Plugin as ee } from "prosemirror-state";
25
25
  import { CellSelection as te, TableMap as se } from "prosemirror-tables";
26
- import { S as $t } from "./ShowSelection-Dz-NEase.js";
27
- import Vt from "remark-gfm";
28
- import Ut from "remark-parse";
29
- import zt, { defaultHandlers as re } from "remark-rehype";
30
- import Gt from "rehype-stringify";
31
- import { unified as Rt } from "unified";
32
- import { TextSelection as jt } from "@tiptap/pm/state";
33
- function Wt(n, e) {
26
+ import { S as Vt } from "./ShowSelection-Dz-NEase.js";
27
+ import Ut from "remark-gfm";
28
+ import zt from "remark-parse";
29
+ import Gt, { defaultHandlers as re } from "remark-rehype";
30
+ import Rt from "rehype-stringify";
31
+ import { unified as jt } from "unified";
32
+ import { TextSelection as Wt } from "@tiptap/pm/state";
33
+ function Kt(o, e) {
34
34
  const t = [
35
35
  {
36
- tag: `[data-inline-content-type="${n.type}"]`,
37
- contentElement: (o) => {
38
- const s = o;
36
+ tag: `[data-inline-content-type="${o.type}"]`,
37
+ contentElement: (n) => {
38
+ const s = n;
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(o) {
46
- if (typeof o == "string")
45
+ getAttrs(n) {
46
+ if (typeof n == "string")
47
47
  return !1;
48
- const s = e == null ? void 0 : e(o);
48
+ const s = e == null ? void 0 : e(n);
49
49
  return s === void 0 ? !1 : s;
50
50
  }
51
51
  }), t;
52
52
  }
53
- function Jn(n, e) {
54
- var o;
53
+ function Qn(o, e) {
54
+ var n;
55
55
  const t = D.create({
56
- name: n.type,
56
+ name: o.type,
57
57
  inline: !0,
58
58
  group: "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*" : "",
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*" : "",
63
63
  addAttributes() {
64
- return We(n.propSchema);
64
+ return Ke(o.propSchema);
65
65
  },
66
66
  addKeyboardShortcuts() {
67
- return je(n);
67
+ return We(o);
68
68
  },
69
69
  parseHTML() {
70
- return Wt(
71
- n,
70
+ return Kt(
71
+ o,
72
72
  e.parse
73
73
  );
74
74
  },
75
75
  renderHTML({ node: s }) {
76
- const i = this.options.editor, r = e.render.call(
76
+ const r = this.options.editor, i = e.render.call(
77
77
  { renderType: "dom", props: void 0 },
78
78
  U(
79
79
  s,
80
- i.schema.inlineContentSchema,
81
- i.schema.styleSchema
80
+ r.schema.inlineContentSchema,
81
+ r.schema.styleSchema
82
82
  ),
83
83
  // TODO: fix cast
84
84
  () => {
85
85
  },
86
- i
86
+ r
87
87
  );
88
- return $(
89
- r,
90
- n.type,
88
+ return H(
89
+ i,
90
+ o.type,
91
91
  s.attrs,
92
- n.propSchema
92
+ o.propSchema
93
93
  );
94
94
  },
95
95
  addNodeView() {
96
96
  return (s) => {
97
- const { node: i, getPos: r } = s, c = this.options.editor, a = e.render.call(
97
+ const { node: r, getPos: i } = s, c = this.options.editor, a = e.render.call(
98
98
  { renderType: "nodeView", props: s },
99
99
  U(
100
- i,
100
+ r,
101
101
  c.schema.inlineContentSchema,
102
102
  c.schema.styleSchema
103
103
  ),
104
104
  // TODO: fix cast
105
105
  (l) => {
106
- const d = O([l], c.pmSchema), u = r();
106
+ const d = O([l], c.pmSchema), u = i();
107
107
  u && c.transact(
108
- (p) => p.replaceWith(u, u + i.nodeSize, d)
108
+ (p) => p.replaceWith(u, u + r.nodeSize, d)
109
109
  );
110
110
  },
111
111
  c
112
112
  );
113
- return $(
113
+ return H(
114
114
  a,
115
- n.type,
116
- i.attrs,
117
- n.propSchema
115
+ o.type,
116
+ r.attrs,
117
+ o.propSchema
118
118
  );
119
119
  };
120
120
  }
121
121
  });
122
- return Ke(
122
+ return Je(
123
123
  t,
124
- n.propSchema,
124
+ o.propSchema,
125
125
  {
126
126
  ...e,
127
127
  toExternalHTML: e.toExternalHTML,
128
- render(s, i, r) {
128
+ render(s, r, i) {
129
129
  const c = e.render(
130
130
  s,
131
- i,
132
- r
131
+ r,
132
+ i
133
133
  );
134
- return $(
134
+ return H(
135
135
  c,
136
- n.type,
136
+ o.type,
137
137
  s.props,
138
- n.propSchema
138
+ o.propSchema
139
139
  );
140
140
  }
141
141
  }
142
142
  );
143
143
  }
144
- function Kt(n, e, t, o = "before") {
145
- const s = typeof t == "string" ? t : t.id, i = B(n), r = e.map(
146
- (d) => Y(d, i)
147
- ), c = E(s, n.doc);
144
+ function Jt(o, e, t, n = "before") {
145
+ const s = typeof t == "string" ? t : t.id, r = C(o), i = e.map(
146
+ (d) => q(d, r)
147
+ ), c = x(s, o.doc);
148
148
  if (!c)
149
149
  throw new Error(`Block with ID ${s} not found`);
150
150
  let a = c.posBeforeNode;
151
- return o === "after" && (a += c.node.nodeSize), n.step(
152
- new $e(a, a, new N(A.from(r), 0, 0))
153
- ), r.map(
154
- (d) => b(d, i)
151
+ return n === "after" && (a += c.node.nodeSize), o.step(
152
+ new Ve(a, a, new N(A.from(i), 0, 0))
153
+ ), i.map(
154
+ (d) => b(d, r)
155
155
  );
156
156
  }
157
- function j(n) {
158
- if (!n || n.type.name !== "column")
157
+ function j(o) {
158
+ if (!o || o.type.name !== "column")
159
159
  throw new Error("Invalid columnPos: does not point to column node.");
160
- const e = n.firstChild;
160
+ const e = o.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 n.childCount === 1 && e.childCount === 1 && t.type.name === "paragraph" && t.content.content.length === 0;
166
+ return o.childCount === 1 && e.childCount === 1 && t.type.name === "paragraph" && t.content.content.length === 0;
167
167
  }
168
- function Jt(n, e) {
169
- const t = n.doc.resolve(e), o = t.nodeAfter;
170
- if (!o || o.type.name !== "columnList")
168
+ function qt(o, e) {
169
+ const t = o.doc.resolve(e), n = t.nodeAfter;
170
+ if (!n || n.type.name !== "columnList")
171
171
  throw new Error(
172
172
  "Invalid columnListPos: does not point to columnList node."
173
173
  );
174
- for (let s = o.childCount - 1; s >= 0; s--) {
175
- const i = n.doc.resolve(t.pos + 1).posAtIndex(s), c = n.doc.resolve(i).nodeAfter;
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
176
  if (!c || c.type.name !== "column")
177
177
  throw new Error("Invalid columnPos: does not point to column node.");
178
- j(c) && n.delete(i, i + c.nodeSize);
178
+ j(c) && o.delete(r, r + c.nodeSize);
179
179
  }
180
180
  }
181
- function W(n, e) {
182
- Jt(n, e);
183
- const o = n.doc.resolve(e).nodeAfter;
184
- if (!o || o.type.name !== "columnList")
181
+ function W(o, e) {
182
+ qt(o, e);
183
+ const n = o.doc.resolve(e).nodeAfter;
184
+ if (!n || n.type.name !== "columnList")
185
185
  throw new Error(
186
186
  "Invalid columnListPos: does not point to columnList node."
187
187
  );
188
- if (o.childCount > 2)
188
+ if (n.childCount > 2)
189
189
  return;
190
- if (o.childCount < 2)
190
+ if (n.childCount < 2)
191
191
  throw new Error("Invalid columnList: contains fewer than two children.");
192
- const s = e + 1, r = n.doc.resolve(s).nodeAfter, c = e + o.nodeSize - 1, l = n.doc.resolve(c).nodeBefore;
193
- if (!r || !l)
192
+ const s = e + 1, i = o.doc.resolve(s).nodeAfter, c = e + n.nodeSize - 1, l = o.doc.resolve(c).nodeBefore;
193
+ if (!i || !l)
194
194
  throw new Error("Invalid columnList: does not contain children.");
195
- const d = j(r), u = j(l);
195
+ const d = j(i), u = j(l);
196
196
  if (d && u) {
197
- n.delete(e, e + o.nodeSize);
197
+ o.delete(e, e + n.nodeSize);
198
198
  return;
199
199
  }
200
200
  if (d) {
201
- n.step(
201
+ o.step(
202
202
  new V(
203
203
  // Replaces `columnList`.
204
204
  e,
205
- e + o.nodeSize,
205
+ e + n.nodeSize,
206
206
  // Replaces with content of last `column`.
207
207
  c - l.nodeSize + 1,
208
208
  c - 1,
@@ -215,14 +215,14 @@ function W(n, e) {
215
215
  return;
216
216
  }
217
217
  if (u) {
218
- n.step(
218
+ o.step(
219
219
  new V(
220
220
  // Replaces `columnList`.
221
221
  e,
222
- e + o.nodeSize,
222
+ e + n.nodeSize,
223
223
  // Replaces with content of first `column`.
224
224
  s + 1,
225
- s + r.nodeSize - 1,
225
+ s + i.nodeSize - 1,
226
226
  // Doesn't append anything.
227
227
  N.empty,
228
228
  0,
@@ -232,62 +232,62 @@ function W(n, e) {
232
232
  return;
233
233
  }
234
234
  }
235
- function ie(n, e, t) {
236
- const o = B(n), s = t.map(
237
- (u) => Y(u, o)
238
- ), i = new Set(
235
+ function ie(o, e, t) {
236
+ const n = C(o), s = t.map(
237
+ (u) => q(u, n)
238
+ ), r = new Set(
239
239
  e.map(
240
240
  (u) => typeof u == "string" ? u : u.id
241
241
  )
242
- ), r = [], c = /* @__PURE__ */ new Set(), a = typeof e[0] == "string" ? e[0] : e[0].id;
242
+ ), i = [], c = /* @__PURE__ */ new Set(), a = typeof e[0] == "string" ? e[0] : e[0].id;
243
243
  let l = 0;
244
- if (n.doc.descendants((u, p) => {
245
- if (i.size === 0)
244
+ if (o.doc.descendants((u, p) => {
245
+ if (r.size === 0)
246
246
  return !1;
247
- if (!u.type.isInGroup("bnBlock") || !i.has(u.attrs.id))
247
+ if (!u.type.isInGroup("bnBlock") || !r.has(u.attrs.id))
248
248
  return !0;
249
- if (r.push(b(u, o)), i.delete(u.attrs.id), t.length > 0 && u.attrs.id === a) {
250
- const g = n.doc.nodeSize;
251
- n.insert(p, s);
252
- const y = n.doc.nodeSize;
249
+ if (i.push(b(u, n)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === a) {
250
+ const g = o.doc.nodeSize;
251
+ o.insert(p, s);
252
+ const y = o.doc.nodeSize;
253
253
  l += g - y;
254
254
  }
255
- const m = n.doc.nodeSize, f = n.doc.resolve(p - l);
256
- f.node().type.name === "column" ? c.add(f.before(-1)) : f.node().type.name === "columnList" && c.add(f.before()), f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ? n.delete(f.before(), f.after()) : n.delete(p - l, p - l + u.nodeSize);
257
- const k = n.doc.nodeSize;
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
258
  return l += m - k, !1;
259
- }), i.size > 0) {
260
- const u = [...i].join(`
259
+ }), r.size > 0) {
260
+ const u = [...r].join(`
261
261
  `);
262
262
  throw Error(
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(n, u)), { insertedBlocks: s.map(
267
- (u) => b(u, o)
268
- ), removedBlocks: r };
266
+ return c.forEach((u) => W(o, u)), { insertedBlocks: s.map(
267
+ (u) => b(u, n)
268
+ ), removedBlocks: i };
269
269
  }
270
- function Yt(n, e, t, o, s) {
271
- let i;
270
+ function Yt(o, e, t, n, s) {
271
+ let r;
272
272
  if (e)
273
273
  if (typeof e == "string")
274
- i = O([e], n.pmSchema, o);
274
+ r = O([e], o.pmSchema, n);
275
275
  else if (Array.isArray(e))
276
- i = O(e, n.pmSchema, o);
276
+ r = O(e, o.pmSchema, n);
277
277
  else if (e.type === "tableContent")
278
- i = Ve(e, n.pmSchema);
278
+ r = Ue(e, o.pmSchema);
279
279
  else
280
280
  throw new F(e.type);
281
281
  else throw new Error("blockContent is required");
282
282
  const c = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
283
- for (const a of i)
284
- if (a.type.name !== "text" && n.schema.inlineContentSchema[a.type.name]) {
285
- const l = n.schema.inlineContentSpecs[a.type.name].implementation;
283
+ for (const a of r)
284
+ if (a.type.name !== "text" && o.schema.inlineContentSchema[a.type.name]) {
285
+ const l = o.schema.inlineContentSpecs[a.type.name].implementation;
286
286
  if (l) {
287
287
  const d = U(
288
288
  a,
289
- n.schema.inlineContentSchema,
290
- n.schema.styleSchema
289
+ o.schema.inlineContentSchema,
290
+ o.schema.styleSchema
291
291
  ), u = l.render.call(
292
292
  {
293
293
  renderType: "dom",
@@ -296,7 +296,7 @@ function Yt(n, e, t, o, s) {
296
296
  d,
297
297
  () => {
298
298
  },
299
- n
299
+ o
300
300
  );
301
301
  if (u) {
302
302
  if (c.appendChild(u.dom), u.contentDOM) {
@@ -314,8 +314,8 @@ function Yt(n, e, t, o, s) {
314
314
  a.textContent
315
315
  );
316
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);
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
319
  u.contentDOM.appendChild(l), l = u.dom;
320
320
  } else {
321
321
  const u = d.type.spec.toDOM(d, !0), p = he.renderSpec(document, u);
@@ -331,39 +331,39 @@ function Yt(n, e, t, o, s) {
331
331
  }
332
332
  return c;
333
333
  }
334
- function qt(n, e, t, o) {
334
+ function Qt(o, e, t, n) {
335
335
  var u, p, m, f, k;
336
- const s = n.pmSchema.nodes.blockContainer, i = e.props || {};
336
+ const s = o.pmSchema.nodes.blockContainer, r = e.props || {};
337
337
  for (const [g, y] of Object.entries(
338
- n.schema.blockSchema[e.type].propSchema
338
+ o.schema.blockSchema[e.type].propSchema
339
339
  ))
340
- !(g in i) && y.default !== void 0 && (i[g] = y.default);
341
- const r = e.children || [], a = n.blockImplementations[e.type].implementation.render.call(
340
+ !(g in r) && y.default !== void 0 && (r[g] = y.default);
341
+ const i = e.children || [], a = o.blockImplementations[e.type].implementation.render.call(
342
342
  {
343
343
  renderType: "dom",
344
344
  props: void 0
345
345
  },
346
- { ...e, props: i, children: r },
347
- n
346
+ { ...e, props: r, children: i },
347
+ o
348
348
  );
349
349
  if (a.contentDOM && e.content) {
350
350
  const g = Yt(
351
- n,
351
+ o,
352
352
  e.content,
353
353
  // TODO
354
354
  t,
355
355
  e.type,
356
- o
356
+ n
357
357
  );
358
358
  a.contentDOM.appendChild(g);
359
359
  }
360
- if (n.pmSchema.nodes[e.type].isInGroup("bnBlock")) {
360
+ if (o.pmSchema.nodes[e.type].isInGroup("bnBlock")) {
361
361
  if (e.children && e.children.length > 0) {
362
- const g = Se(
363
- n,
362
+ const g = Be(
363
+ o,
364
364
  e.children,
365
365
  t,
366
- o
366
+ n
367
367
  );
368
368
  (u = a.contentDOM) == null || u.append(g);
369
369
  }
@@ -373,33 +373,33 @@ function qt(n, e, t, o) {
373
373
  p,
374
374
  s.create({
375
375
  id: e.id,
376
- ...i
376
+ ...r
377
377
  })
378
378
  );
379
379
  return (f = d.contentDOM) == null || f.appendChild(a.dom), e.children && e.children.length > 0 && ((k = d.contentDOM) == null || k.appendChild(
380
- Be(n, e.children, t, o)
380
+ Ce(o, e.children, t, n)
381
381
  )), d.dom;
382
382
  }
383
- function Se(n, e, t, o) {
384
- const i = ((o == null ? void 0 : o.document) ?? document).createDocumentFragment();
385
- for (const r of e) {
386
- const c = qt(n, r, t, o);
387
- i.appendChild(c);
383
+ function Be(o, e, t, n) {
384
+ const r = ((n == null ? void 0 : n.document) ?? document).createDocumentFragment();
385
+ for (const i of e) {
386
+ const c = Qt(o, i, t, n);
387
+ r.appendChild(c);
388
388
  }
389
- return i;
389
+ return r;
390
390
  }
391
- const Be = (n, e, t, o) => {
391
+ const Ce = (o, e, t, n) => {
392
392
  var c;
393
- const s = n.pmSchema.nodes.blockGroup, i = s.spec.toDOM(s.create({})), r = Se(n, e, t, o);
394
- return (c = i.contentDOM) == null || c.appendChild(r), i.dom;
395
- }, Qt = (n, e) => {
396
- const t = he.fromSchema(n);
393
+ const s = o.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), i = Be(o, e, t, n);
394
+ return (c = r.contentDOM) == null || c.appendChild(i), r.dom;
395
+ }, Xt = (o, e) => {
396
+ const t = he.fromSchema(o);
397
397
  return {
398
- serializeBlocks: (o, s) => Be(e, o, t, s).outerHTML
398
+ serializeBlocks: (n, s) => Ce(e, n, t, s).outerHTML
399
399
  };
400
400
  };
401
- function Xt(n) {
402
- return n.transact((e) => {
401
+ function Zt(o) {
402
+ return o.transact((e) => {
403
403
  const t = _(e.doc, e.selection.anchor);
404
404
  if (e.selection instanceof te)
405
405
  return {
@@ -414,127 +414,127 @@ function Xt(n) {
414
414
  anchorBlockId: t.node.attrs.id
415
415
  };
416
416
  {
417
- const o = _(e.doc, e.selection.head);
417
+ const n = _(e.doc, e.selection.head);
418
418
  return {
419
419
  type: "text",
420
420
  anchorBlockId: t.node.attrs.id,
421
- headBlockId: o.node.attrs.id,
421
+ headBlockId: n.node.attrs.id,
422
422
  anchorOffset: e.selection.anchor - t.posBeforeNode,
423
- headOffset: e.selection.head - o.posBeforeNode
423
+ headOffset: e.selection.head - n.posBeforeNode
424
424
  };
425
425
  }
426
426
  });
427
427
  }
428
- function Zt(n, e) {
429
- var s, i;
430
- const t = (s = E(e.anchorBlockId, n.doc)) == null ? void 0 : s.posBeforeNode;
428
+ function eo(o, e) {
429
+ var s, r;
430
+ const t = (s = x(e.anchorBlockId, o.doc)) == null ? void 0 : s.posBeforeNode;
431
431
  if (t === void 0)
432
432
  throw new Error(
433
433
  `Could not find block with ID ${e.anchorBlockId} to update selection`
434
434
  );
435
- let o;
435
+ let n;
436
436
  if (e.type === "cell")
437
- o = te.create(
438
- n.doc,
437
+ n = te.create(
438
+ o.doc,
439
439
  t + e.anchorCellOffset,
440
440
  t + e.headCellOffset
441
441
  );
442
442
  else if (e.type === "node")
443
- o = L.create(n.doc, t + 1);
443
+ n = L.create(o.doc, t + 1);
444
444
  else {
445
- const r = (i = E(e.headBlockId, n.doc)) == null ? void 0 : i.posBeforeNode;
446
- if (r === void 0)
445
+ const i = (r = x(e.headBlockId, o.doc)) == null ? void 0 : r.posBeforeNode;
446
+ if (i === void 0)
447
447
  throw new Error(
448
448
  `Could not find block with ID ${e.headBlockId} to update selection`
449
449
  );
450
- o = M.create(
451
- n.doc,
450
+ n = M.create(
451
+ o.doc,
452
452
  t + e.anchorOffset,
453
- r + e.headOffset
453
+ i + e.headOffset
454
454
  );
455
455
  }
456
- n.setSelection(o);
456
+ o.setSelection(n);
457
457
  }
458
- function K(n) {
459
- return n.map((e) => e.type === "columnList" ? e.children.map((t) => K(t.children)).flat() : {
458
+ function K(o) {
459
+ return o.map((e) => e.type === "columnList" ? e.children.map((t) => K(t.children)).flat() : {
460
460
  ...e,
461
461
  children: K(e.children)
462
462
  }).flat();
463
463
  }
464
- function Ce(n, e, t) {
465
- n.transact((o) => {
466
- var r;
467
- const s = ((r = n.getSelection()) == null ? void 0 : r.blocks) || [
468
- n.getTextCursorPosition().block
469
- ], i = Xt(n);
470
- n.removeBlocks(s), n.insertBlocks(K(s), e, t), Zt(o, i);
464
+ function xe(o, e, t) {
465
+ o.transact((n) => {
466
+ var i;
467
+ const s = ((i = o.getSelection()) == null ? void 0 : i.blocks) || [
468
+ o.getTextCursorPosition().block
469
+ ], r = Zt(o);
470
+ o.removeBlocks(s), o.insertBlocks(K(s), e, t), eo(n, r);
471
471
  });
472
472
  }
473
- function Ee(n) {
474
- return !n || n.type !== "columnList";
473
+ function Ee(o) {
474
+ return !o || o.type !== "columnList";
475
475
  }
476
- function xe(n, e, t) {
477
- let o, s;
478
- 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)
476
+ function Me(o, e, t) {
477
+ let n, s;
478
+ 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)
479
479
  return;
480
- const i = n.getParentBlock(o);
481
- return Ee(i) ? { referenceBlock: o, placement: s } : xe(
482
- n,
483
- s === "after" ? o : n.getPrevBlock(o),
484
- i
480
+ const r = o.getParentBlock(n);
481
+ return Ee(r) ? { referenceBlock: n, placement: s } : Me(
482
+ o,
483
+ s === "after" ? n : o.getPrevBlock(n),
484
+ r
485
485
  );
486
486
  }
487
- function Me(n, e, t) {
488
- let o, s;
489
- if (e ? e.children.length > 0 ? (o = e.children[0], s = "before") : (o = e, s = "after") : t && (o = t, s = "after"), !o || !s)
487
+ function we(o, e, t) {
488
+ let n, s;
489
+ if (e ? e.children.length > 0 ? (n = e.children[0], s = "before") : (n = e, s = "after") : t && (n = t, s = "after"), !n || !s)
490
490
  return;
491
- const i = n.getParentBlock(o);
492
- return Ee(i) ? { referenceBlock: o, placement: s } : Me(
493
- n,
494
- s === "before" ? o : n.getNextBlock(o),
495
- i
491
+ const r = o.getParentBlock(n);
492
+ return Ee(r) ? { referenceBlock: n, placement: s } : we(
493
+ o,
494
+ s === "before" ? n : o.getNextBlock(n),
495
+ r
496
496
  );
497
497
  }
498
- function eo(n) {
499
- n.transact(() => {
500
- const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || n.getTextCursorPosition().block, o = xe(
501
- n,
502
- n.getPrevBlock(t),
503
- n.getParentBlock(t)
498
+ function to(o) {
499
+ o.transact(() => {
500
+ const e = o.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || o.getTextCursorPosition().block, n = Me(
501
+ o,
502
+ o.getPrevBlock(t),
503
+ o.getParentBlock(t)
504
504
  );
505
- o && Ce(
506
- n,
507
- o.referenceBlock,
508
- o.placement
505
+ n && xe(
506
+ o,
507
+ n.referenceBlock,
508
+ n.placement
509
509
  );
510
510
  });
511
511
  }
512
- function to(n) {
513
- n.transact(() => {
514
- const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[(e == null ? void 0 : e.blocks.length) - 1]) || n.getTextCursorPosition().block, o = Me(
515
- n,
516
- n.getNextBlock(t),
517
- n.getParentBlock(t)
512
+ function oo(o) {
513
+ o.transact(() => {
514
+ const e = o.getSelection(), t = (e == null ? void 0 : e.blocks[(e == null ? void 0 : e.blocks.length) - 1]) || o.getTextCursorPosition().block, n = we(
515
+ o,
516
+ o.getNextBlock(t),
517
+ o.getParentBlock(t)
518
518
  );
519
- o && Ce(
520
- n,
521
- o.referenceBlock,
522
- o.placement
519
+ n && xe(
520
+ o,
521
+ n.referenceBlock,
522
+ n.placement
523
523
  );
524
524
  });
525
525
  }
526
- function oo(n, e, t) {
527
- const { $from: o, $to: s } = n.selection, i = o.blockRange(
526
+ function no(o, e, t) {
527
+ const { $from: n, $to: s } = o.selection, r = n.blockRange(
528
528
  s,
529
529
  (f) => f.childCount > 0 && (f.type.name === "blockGroup" || f.type.name === "column")
530
530
  // change necessary to not look at first item child type
531
531
  );
532
- if (!i)
532
+ if (!r)
533
533
  return !1;
534
- const r = i.startIndex;
535
- if (r === 0)
534
+ const i = r.startIndex;
535
+ if (i === 0)
536
536
  return !1;
537
- const a = i.parent.child(r - 1);
537
+ const a = r.parent.child(i - 1);
538
538
  if (a.type !== e)
539
539
  return !1;
540
540
  const l = a.lastChild && a.lastChild.type === t, d = A.from(l ? e.create() : null), u = new N(
@@ -544,8 +544,8 @@ function oo(n, e, t) {
544
544
  ),
545
545
  l ? 3 : 1,
546
546
  0
547
- ), p = i.start, m = i.end;
548
- return n.step(
547
+ ), p = r.start, m = r.end;
548
+ return o.step(
549
549
  new V(
550
550
  p - (l ? 3 : 1),
551
551
  m,
@@ -557,60 +557,60 @@ function oo(n, e, t) {
557
557
  )
558
558
  ).scrollIntoView(), !0;
559
559
  }
560
- function we(n) {
561
- return n.transact((e) => oo(
560
+ function Te(o) {
561
+ return o.transact((e) => no(
562
562
  e,
563
- n.pmSchema.nodes.blockContainer,
564
- n.pmSchema.nodes.blockGroup
563
+ o.pmSchema.nodes.blockContainer,
564
+ o.pmSchema.nodes.blockGroup
565
565
  ));
566
566
  }
567
- function no(n) {
568
- n._tiptapEditor.commands.liftListItem("blockContainer");
567
+ function so(o) {
568
+ o._tiptapEditor.commands.liftListItem("blockContainer");
569
569
  }
570
- function so(n) {
571
- return n.transact((e) => {
572
- const { bnBlock: t } = H(e);
570
+ function ro(o) {
571
+ return o.transact((e) => {
572
+ const { bnBlock: t } = $(e);
573
573
  return e.doc.resolve(t.beforePos).nodeBefore !== null;
574
574
  });
575
575
  }
576
- function ro(n) {
577
- return n.transact((e) => {
578
- const { bnBlock: t } = H(e);
576
+ function io(o) {
577
+ return o.transact((e) => {
578
+ const { bnBlock: t } = $(e);
579
579
  return e.doc.resolve(t.beforePos).depth > 1;
580
580
  });
581
581
  }
582
- function io(n, e) {
583
- const t = typeof e == "string" ? e : e.id, o = B(n), s = E(t, n);
582
+ function ao(o, e) {
583
+ const t = typeof e == "string" ? e : e.id, n = C(o), s = x(t, o);
584
584
  if (s)
585
- return b(s.node, o);
585
+ return b(s.node, n);
586
586
  }
587
- function ao(n, e) {
588
- const t = typeof e == "string" ? e : e.id, o = E(t, n), s = B(n);
589
- if (!o)
587
+ function co(o, e) {
588
+ const t = typeof e == "string" ? e : e.id, n = x(t, o), s = C(o);
589
+ if (!n)
590
590
  return;
591
- const r = n.resolve(o.posBeforeNode).nodeBefore;
592
- if (r)
593
- return b(r, s);
591
+ const i = o.resolve(n.posBeforeNode).nodeBefore;
592
+ if (i)
593
+ return b(i, s);
594
594
  }
595
- function co(n, e) {
596
- const t = typeof e == "string" ? e : e.id, o = E(t, n), s = B(n);
597
- if (!o)
595
+ function lo(o, e) {
596
+ const t = typeof e == "string" ? e : e.id, n = x(t, o), s = C(o);
597
+ if (!n)
598
598
  return;
599
- const r = n.resolve(
600
- o.posBeforeNode + o.node.nodeSize
599
+ const i = o.resolve(
600
+ n.posBeforeNode + n.node.nodeSize
601
601
  ).nodeAfter;
602
- if (r)
603
- return b(r, s);
602
+ if (i)
603
+ return b(i, s);
604
604
  }
605
- function lo(n, e) {
606
- const t = typeof e == "string" ? e : e.id, o = B(n), s = E(t, n);
605
+ function uo(o, e) {
606
+ const t = typeof e == "string" ? e : e.id, n = C(o), s = x(t, o);
607
607
  if (!s)
608
608
  return;
609
- const i = n.resolve(s.posBeforeNode), r = i.node(), c = i.node(-1), a = c.type.name !== "doc" ? r.type.name === "blockGroup" ? c : r : void 0;
609
+ const r = o.resolve(s.posBeforeNode), i = r.node(), c = r.node(-1), a = c.type.name !== "doc" ? i.type.name === "blockGroup" ? c : i : void 0;
610
610
  if (a)
611
- return b(a, o);
611
+ return b(a, n);
612
612
  }
613
- class uo {
613
+ class po {
614
614
  constructor(e) {
615
615
  this.editor = e;
616
616
  }
@@ -619,7 +619,7 @@ class uo {
619
619
  * @returns A snapshot of all top-level (non-nested) blocks in the editor.
620
620
  */
621
621
  get document() {
622
- return this.editor.transact((e) => Ue(e.doc, this.editor.pmSchema));
622
+ return this.editor.transact((e) => ze(e.doc, this.editor.pmSchema));
623
623
  }
624
624
  /**
625
625
  * Gets a snapshot of an existing block from the editor.
@@ -629,7 +629,7 @@ class uo {
629
629
  * matching block was found.
630
630
  */
631
631
  getBlock(e) {
632
- return this.editor.transact((t) => io(t.doc, e));
632
+ return this.editor.transact((t) => ao(t.doc, e));
633
633
  }
634
634
  /**
635
635
  * Gets a snapshot of the previous sibling of an existing block from the
@@ -641,7 +641,7 @@ class uo {
641
641
  * in the document.
642
642
  */
643
643
  getPrevBlock(e) {
644
- return this.editor.transact((t) => ao(t.doc, e));
644
+ return this.editor.transact((t) => co(t.doc, e));
645
645
  }
646
646
  /**
647
647
  * Gets a snapshot of the next sibling of an existing block from the editor.
@@ -652,7 +652,7 @@ class uo {
652
652
  * the document.
653
653
  */
654
654
  getNextBlock(e) {
655
- return this.editor.transact((t) => co(t.doc, e));
655
+ return this.editor.transact((t) => lo(t.doc, e));
656
656
  }
657
657
  /**
658
658
  * Gets a snapshot of the parent of an existing block from the editor.
@@ -663,7 +663,7 @@ class uo {
663
663
  */
664
664
  getParentBlock(e) {
665
665
  return this.editor.transact(
666
- (t) => lo(t.doc, e)
666
+ (t) => uo(t.doc, e)
667
667
  );
668
668
  }
669
669
  /**
@@ -672,19 +672,19 @@ class uo {
672
672
  * @param reverse Whether the blocks should be traversed in reverse order.
673
673
  */
674
674
  forEachBlock(e, t = !1) {
675
- const o = this.document.slice();
676
- t && o.reverse();
677
- function s(i) {
678
- for (const r of i) {
679
- if (e(r) === !1)
675
+ const n = this.document.slice();
676
+ t && n.reverse();
677
+ function s(r) {
678
+ for (const i of r) {
679
+ if (e(i) === !1)
680
680
  return !1;
681
- const c = t ? r.children.slice().reverse() : r.children;
681
+ const c = t ? i.children.slice().reverse() : i.children;
682
682
  if (!s(c))
683
683
  return !1;
684
684
  }
685
685
  return !0;
686
686
  }
687
- s(o);
687
+ s(n);
688
688
  }
689
689
  /**
690
690
  * Inserts new blocks into the editor. If a block's `id` is undefined, BlockNote generates one automatically. Throws an
@@ -694,9 +694,9 @@ class uo {
694
694
  * @param placement Whether the blocks should be inserted just before, just after, or nested inside the
695
695
  * `referenceBlock`.
696
696
  */
697
- insertBlocks(e, t, o = "before") {
697
+ insertBlocks(e, t, n = "before") {
698
698
  return this.editor.transact(
699
- (s) => Kt(s, e, t, o)
699
+ (s) => Jt(s, e, t, n)
700
700
  );
701
701
  }
702
702
  /**
@@ -707,7 +707,7 @@ class uo {
707
707
  * @param update A partial block which defines how the existing block should be changed.
708
708
  */
709
709
  updateBlock(e, t) {
710
- return this.editor.transact((o) => Je(o, e, t));
710
+ return this.editor.transact((n) => qe(n, e, t));
711
711
  }
712
712
  /**
713
713
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
@@ -727,32 +727,32 @@ class uo {
727
727
  */
728
728
  replaceBlocks(e, t) {
729
729
  return this.editor.transact(
730
- (o) => ie(o, e, t)
730
+ (n) => ie(n, e, t)
731
731
  );
732
732
  }
733
733
  /**
734
734
  * Checks if the block containing the text cursor can be nested.
735
735
  */
736
736
  canNestBlock() {
737
- return so(this.editor);
737
+ return ro(this.editor);
738
738
  }
739
739
  /**
740
740
  * Nests the block containing the text cursor into the block above it.
741
741
  */
742
742
  nestBlock() {
743
- we(this.editor);
743
+ Te(this.editor);
744
744
  }
745
745
  /**
746
746
  * Checks if the block containing the text cursor is nested.
747
747
  */
748
748
  canUnnestBlock() {
749
- return ro(this.editor);
749
+ return io(this.editor);
750
750
  }
751
751
  /**
752
752
  * Lifts the block containing the text cursor out of its parent.
753
753
  */
754
754
  unnestBlock() {
755
- no(this.editor);
755
+ so(this.editor);
756
756
  }
757
757
  /**
758
758
  * Moves the selected blocks up. If the previous block has children, moves
@@ -760,7 +760,7 @@ class uo {
760
760
  * current blocks share a common parent, moves them out of & before it.
761
761
  */
762
762
  moveBlocksUp() {
763
- return eo(this.editor);
763
+ return to(this.editor);
764
764
  }
765
765
  /**
766
766
  * Moves the selected blocks down. If the next block has children, moves
@@ -768,16 +768,16 @@ class uo {
768
768
  * current blocks share a common parent, moves them out of & after it.
769
769
  */
770
770
  moveBlocksDown() {
771
- return to(this.editor);
771
+ return oo(this.editor);
772
772
  }
773
773
  }
774
- class po extends ye {
774
+ class fo extends Se {
775
775
  constructor(e) {
776
776
  super(), this.editor = e, e.on("create", () => {
777
777
  e._tiptapEditor.on(
778
778
  "update",
779
- ({ transaction: t, appendedTransactions: o }) => {
780
- this.emit("onChange", { editor: e, transaction: t, appendedTransactions: o });
779
+ ({ transaction: t, appendedTransactions: n }) => {
780
+ this.emit("onChange", { editor: e, transaction: t, appendedTransactions: n });
781
781
  }
782
782
  ), e._tiptapEditor.on("selectionUpdate", ({ transaction: t }) => {
783
783
  this.emit("onSelectionChange", { editor: e, transaction: t });
@@ -792,32 +792,32 @@ class po extends ye {
792
792
  * Register a callback that will be called when the editor changes.
793
793
  */
794
794
  onChange(e, t = !0) {
795
- const o = ({
795
+ const n = ({
796
796
  transaction: s,
797
- appendedTransactions: i
797
+ appendedTransactions: r
798
798
  }) => {
799
799
  !t && ae(s) || e(this.editor, {
800
800
  getChanges() {
801
- return tt(
801
+ return ot(
802
802
  s,
803
- i
803
+ r
804
804
  );
805
805
  }
806
806
  });
807
807
  };
808
- return this.on("onChange", o), () => {
809
- this.off("onChange", o);
808
+ return this.on("onChange", n), () => {
809
+ this.off("onChange", n);
810
810
  };
811
811
  }
812
812
  /**
813
813
  * Register a callback that will be called when the selection changes.
814
814
  */
815
815
  onSelectionChange(e, t = !1) {
816
- const o = (s) => {
816
+ const n = (s) => {
817
817
  !t && ae(s.transaction) || e(this.editor);
818
818
  };
819
- return this.on("onSelectionChange", o), () => {
820
- this.off("onSelectionChange", o);
819
+ return this.on("onSelectionChange", n), () => {
820
+ this.off("onSelectionChange", n);
821
821
  };
822
822
  }
823
823
  /**
@@ -837,108 +837,118 @@ class po extends ye {
837
837
  };
838
838
  }
839
839
  }
840
- function ae(n) {
841
- return !!n.getMeta("y-sync$");
840
+ function ae(o) {
841
+ return !!o.getMeta("y-sync$");
842
842
  }
843
- function fo(n) {
844
- return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
843
+ function ho(o) {
844
+ return Array.prototype.indexOf.call(o.parentElement.childNodes, o);
845
845
  }
846
- function ho(n) {
847
- return n.nodeType === 3 && !/\S/.test(n.nodeValue || "");
846
+ function mo(o) {
847
+ return o.nodeType === 3 && !/\S/.test(o.nodeValue || "");
848
848
  }
849
- function mo(n) {
850
- n.querySelectorAll("li > ul, li > ol").forEach((e) => {
851
- const t = fo(e), o = e.parentElement, s = Array.from(o.childNodes).slice(
849
+ function ko(o) {
850
+ o.querySelectorAll("li > ul, li > ol").forEach((e) => {
851
+ const t = ho(e), n = e.parentElement, s = Array.from(n.childNodes).slice(
852
852
  t + 1
853
853
  );
854
- e.remove(), s.forEach((i) => {
855
- i.remove();
856
- }), o.insertAdjacentElement("afterend", e), s.reverse().forEach((i) => {
857
- if (ho(i))
854
+ e.remove(), s.forEach((r) => {
855
+ r.remove();
856
+ }), n.insertAdjacentElement("afterend", e), s.reverse().forEach((r) => {
857
+ if (mo(r))
858
858
  return;
859
- const r = document.createElement("li");
860
- r.append(i), e.insertAdjacentElement("afterend", r);
861
- }), o.childNodes.length === 0 && o.remove();
859
+ const i = document.createElement("li");
860
+ i.append(r), e.insertAdjacentElement("afterend", i);
861
+ }), n.childNodes.length === 0 && n.remove();
862
862
  });
863
863
  }
864
- function ko(n) {
865
- n.querySelectorAll("li + ul, li + ol").forEach((e) => {
866
- var i, r;
867
- const t = e.previousElementSibling, o = document.createElement("div");
868
- t.insertAdjacentElement("afterend", o), o.append(t);
864
+ function go(o) {
865
+ o.querySelectorAll("li + ul, li + ol").forEach((e) => {
866
+ var r, i;
867
+ const t = e.previousElementSibling, n = document.createElement("div");
868
+ t.insertAdjacentElement("afterend", n), n.append(t);
869
869
  const s = document.createElement("div");
870
- for (s.setAttribute("data-node-type", "blockGroup"), o.append(s); ((i = o.nextElementSibling) == null ? void 0 : i.nodeName) === "UL" || ((r = o.nextElementSibling) == null ? void 0 : r.nodeName) === "OL"; )
871
- s.append(o.nextElementSibling);
870
+ for (s.setAttribute("data-node-type", "blockGroup"), n.append(s); ((r = n.nextElementSibling) == null ? void 0 : r.nodeName) === "UL" || ((i = n.nextElementSibling) == null ? void 0 : i.nodeName) === "OL"; )
871
+ s.append(n.nextElementSibling);
872
872
  });
873
873
  }
874
874
  let ce = null;
875
- function go() {
875
+ function bo() {
876
876
  return ce || (ce = document.implementation.createHTMLDocument("title"));
877
877
  }
878
- function bo(n) {
879
- if (typeof n == "string") {
880
- const e = go().createElement("div");
881
- e.innerHTML = n, n = e;
878
+ function yo(o) {
879
+ if (typeof o == "string") {
880
+ const e = bo().createElement("div");
881
+ e.innerHTML = o, o = e;
882
882
  }
883
- return mo(n), ko(n), n;
883
+ return ko(o), go(o), o;
884
884
  }
885
- function Te(n, e) {
886
- const t = bo(n), s = Fe.fromSchema(e).parse(t, {
885
+ function Pe(o, e) {
886
+ const t = yo(o), s = $e.fromSchema(e).parse(t, {
887
887
  topNode: e.nodes.blockGroup.create()
888
- }), i = [];
889
- for (let r = 0; r < s.childCount; r++)
890
- i.push(b(s.child(r), e));
891
- return i;
892
- }
893
- function yo(n, e) {
894
- const t = e.value ? e.value : "", o = {};
895
- e.lang && (o["data-language"] = e.lang);
888
+ }), r = [];
889
+ for (let i = 0; i < s.childCount; i++)
890
+ r.push(b(s.child(i), e));
891
+ return r;
892
+ }
893
+ function So(o, e) {
894
+ const t = e.value ? e.value : "", n = {};
895
+ e.lang && (n["data-language"] = e.lang);
896
896
  let s = {
897
897
  type: "element",
898
898
  tagName: "code",
899
- properties: o,
899
+ properties: n,
900
900
  children: [{ type: "text", value: t }]
901
901
  };
902
- return e.meta && (s.data = { meta: e.meta }), n.patch(e, s), s = n.applyData(e, s), s = {
902
+ return e.meta && (s.data = { meta: e.meta }), o.patch(e, s), s = o.applyData(e, s), s = {
903
903
  type: "element",
904
904
  tagName: "pre",
905
905
  properties: {},
906
906
  children: [s]
907
- }, n.patch(e, s), s;
907
+ }, o.patch(e, s), s;
908
908
  }
909
- function So(n, e) {
910
- var i;
911
- const t = String((e == null ? void 0 : e.url) || ""), o = e != null && e.title ? String(e.title) : void 0;
909
+ function Bo(o, e) {
910
+ var r;
911
+ const t = String((e == null ? void 0 : e.url) || ""), n = e != null && e.title ? String(e.title) : void 0;
912
912
  let s = {
913
913
  type: "element",
914
914
  tagName: "video",
915
915
  properties: {
916
916
  src: t,
917
- "data-name": o,
917
+ "data-name": n,
918
918
  "data-url": t,
919
919
  controls: !0
920
920
  },
921
921
  children: []
922
922
  };
923
- return (i = n.patch) == null || i.call(n, e, s), s = n.applyData ? n.applyData(e, s) : s, s;
923
+ return (r = o.patch) == null || r.call(o, e, s), s = o.applyData ? o.applyData(e, s) : s, s;
924
924
  }
925
- function Pe(n) {
926
- return Rt().use(Ut).use(Vt).use(zt, {
925
+ function ve(o) {
926
+ return jt().use(zt).use(Ut).use(Gt, {
927
927
  handlers: {
928
928
  ...re,
929
- image: (t, o) => {
930
- const s = String((o == null ? void 0 : o.url) || "");
931
- return Ye(s) ? So(t, o) : re.image(t, o);
929
+ image: (t, n) => {
930
+ const s = String((n == null ? void 0 : n.url) || "");
931
+ return Ye(s) ? Bo(t, n) : re.image(t, n);
932
932
  },
933
- code: yo
933
+ code: So,
934
+ blockquote: (t, n) => {
935
+ const s = {
936
+ type: "element",
937
+ tagName: "blockquote",
938
+ properties: {},
939
+ // The only difference from the original is that we don't wrap the children with line endings
940
+ children: t.wrap(t.all(n), !1)
941
+ };
942
+ return t.patch(n, s), t.applyData(n, s);
943
+ }
934
944
  }
935
- }).use(Gt).processSync(n).value;
945
+ }).use(Rt).processSync(o).value;
936
946
  }
937
- function Bo(n, e) {
938
- const t = Pe(n);
939
- return Te(t, e);
947
+ function Co(o, e) {
948
+ const t = ve(o);
949
+ return Pe(t, e);
940
950
  }
941
- class Co {
951
+ class xo {
942
952
  constructor(e) {
943
953
  this.editor = e;
944
954
  }
@@ -965,7 +975,7 @@ class Co {
965
975
  * @returns The blocks, serialized as an HTML string.
966
976
  */
967
977
  blocksToFullHTML(e = this.editor.document) {
968
- return Qt(
978
+ return Xt(
969
979
  this.editor.pmSchema,
970
980
  this.editor
971
981
  ).serializeBlocks(e, {});
@@ -978,7 +988,7 @@ class Co {
978
988
  * @returns The blocks parsed from the HTML string.
979
989
  */
980
990
  tryParseHTMLToBlocks(e) {
981
- return Te(e, this.editor.pmSchema);
991
+ return Pe(e, this.editor.pmSchema);
982
992
  }
983
993
  /**
984
994
  * Serializes blocks into a Markdown string. The output is simplified as Markdown does not support all features of
@@ -987,7 +997,7 @@ class Co {
987
997
  * @returns The blocks, serialized as a Markdown string.
988
998
  */
989
999
  blocksToMarkdownLossy(e = this.editor.document) {
990
- return ot(e, this.editor.pmSchema, this.editor, {});
1000
+ return nt(e, this.editor.pmSchema, this.editor, {});
991
1001
  }
992
1002
  /**
993
1003
  * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
@@ -997,7 +1007,7 @@ class Co {
997
1007
  * @returns The blocks parsed from the Markdown string.
998
1008
  */
999
1009
  tryParseMarkdownToBlocks(e) {
1000
- return Bo(e, this.editor.pmSchema);
1010
+ return Co(e, this.editor.pmSchema);
1001
1011
  }
1002
1012
  /**
1003
1013
  * Paste HTML into the editor. Defaults to converting HTML to BlockNote HTML.
@@ -1006,12 +1016,12 @@ class Co {
1006
1016
  */
1007
1017
  pasteHTML(e, t = !1) {
1008
1018
  var s;
1009
- let o = e;
1019
+ let n = e;
1010
1020
  if (!t) {
1011
- const i = this.tryParseHTMLToBlocks(e);
1012
- o = this.blocksToFullHTML(i);
1021
+ const r = this.tryParseHTMLToBlocks(e);
1022
+ n = this.blocksToFullHTML(r);
1013
1023
  }
1014
- o && ((s = this.editor.prosemirrorView) == null || s.pasteHTML(o));
1024
+ n && ((s = this.editor.prosemirrorView) == null || s.pasteHTML(n));
1015
1025
  }
1016
1026
  /**
1017
1027
  * Paste text into the editor. Defaults to interpreting text as markdown.
@@ -1026,7 +1036,7 @@ class Co {
1026
1036
  * @param markdown The markdown to paste.
1027
1037
  */
1028
1038
  pasteMarkdown(e) {
1029
- const t = Pe(e);
1039
+ const t = ve(e);
1030
1040
  return this.pasteHTML(t);
1031
1041
  }
1032
1042
  }
@@ -1038,55 +1048,55 @@ const oe = [
1038
1048
  "text/plain",
1039
1049
  "Files"
1040
1050
  ];
1041
- function Eo(n, e) {
1042
- if (!n.startsWith(".") || !e.startsWith("."))
1051
+ function Eo(o, e) {
1052
+ if (!o.startsWith(".") || !e.startsWith("."))
1043
1053
  throw new Error("The strings provided are not valid file extensions.");
1044
- return n === e;
1054
+ return o === e;
1045
1055
  }
1046
- function xo(n, e) {
1047
- const t = n.split("/"), o = e.split("/");
1056
+ function Mo(o, e) {
1057
+ const t = o.split("/"), n = e.split("/");
1048
1058
  if (t.length !== 2)
1049
- throw new Error(`The string ${n} is not a valid MIME type.`);
1050
- if (o.length !== 2)
1059
+ throw new Error(`The string ${o} is not a valid MIME type.`);
1060
+ if (n.length !== 2)
1051
1061
  throw new Error(`The string ${e} is not a valid MIME type.`);
1052
- return t[1] === "*" || o[1] === "*" ? t[0] === o[0] : (t[0] === "*" || o[0] === "*" || t[0] === o[0]) && t[1] === o[1];
1062
+ return t[1] === "*" || n[1] === "*" ? t[0] === n[0] : (t[0] === "*" || n[0] === "*" || t[0] === n[0]) && t[1] === n[1];
1053
1063
  }
1054
- function le(n, e, t, o = "after") {
1064
+ function le(o, e, t, n = "after") {
1055
1065
  let s;
1056
- return Array.isArray(e.content) && e.content.length === 0 ? s = n.updateBlock(e, t).id : s = n.insertBlocks(
1066
+ return Array.isArray(e.content) && e.content.length === 0 ? s = o.updateBlock(e, t).id : s = o.insertBlocks(
1057
1067
  [t],
1058
1068
  e,
1059
- o
1069
+ n
1060
1070
  )[0].id, s;
1061
1071
  }
1062
- async function ve(n, e) {
1063
- var i;
1072
+ async function Ie(o, e) {
1073
+ var r;
1064
1074
  if (!e.uploadFile) {
1065
1075
  console.warn(
1066
1076
  "Attempted ot insert file, but uploadFile is not set in the BlockNote editor options"
1067
1077
  );
1068
1078
  return;
1069
1079
  }
1070
- const t = "dataTransfer" in n ? n.dataTransfer : n.clipboardData;
1080
+ const t = "dataTransfer" in o ? o.dataTransfer : o.clipboardData;
1071
1081
  if (t === null)
1072
1082
  return;
1073
- let o = null;
1074
- for (const r of oe)
1075
- if (t.types.includes(r)) {
1076
- o = r;
1083
+ let n = null;
1084
+ for (const i of oe)
1085
+ if (t.types.includes(i)) {
1086
+ n = i;
1077
1087
  break;
1078
1088
  }
1079
- if (o !== "Files")
1089
+ if (n !== "Files")
1080
1090
  return;
1081
1091
  const s = t.items;
1082
1092
  if (s) {
1083
- n.preventDefault();
1084
- for (let r = 0; r < s.length; r++) {
1093
+ o.preventDefault();
1094
+ for (let i = 0; i < s.length; i++) {
1085
1095
  let c = "file";
1086
1096
  for (const l of Object.values(e.schema.blockSpecs))
1087
- for (const d of ((i = l.implementation.meta) == null ? void 0 : i.fileBlockAccept) || []) {
1088
- const u = d.startsWith("."), p = s[r].getAsFile();
1089
- if (p && (!u && p.type && xo(s[r].type, d) || u && Eo(
1097
+ for (const d of ((r = l.implementation.meta) == null ? void 0 : r.fileBlockAccept) || []) {
1098
+ const u = d.startsWith("."), p = s[i].getAsFile();
1099
+ if (p && (!u && p.type && Mo(s[i].type, d) || u && Eo(
1090
1100
  "." + p.name.split(".").pop(),
1091
1101
  d
1092
1102
  ))) {
@@ -1094,7 +1104,7 @@ async function ve(n, e) {
1094
1104
  break;
1095
1105
  }
1096
1106
  }
1097
- const a = s[r].getAsFile();
1107
+ const a = s[i].getAsFile();
1098
1108
  if (a) {
1099
1109
  const l = {
1100
1110
  type: c,
@@ -1103,18 +1113,19 @@ async function ve(n, e) {
1103
1113
  }
1104
1114
  };
1105
1115
  let d;
1106
- if (n.type === "paste") {
1116
+ if (o.type === "paste") {
1107
1117
  const m = e.getTextCursorPosition().block;
1108
1118
  d = le(e, m, l);
1109
- } else if (n.type === "drop") {
1119
+ } else if (o.type === "drop") {
1110
1120
  const m = {
1111
- left: n.clientX,
1112
- top: n.clientY
1121
+ left: o.clientX,
1122
+ top: o.clientY
1113
1123
  }, f = e.prosemirrorView.posAtCoords(m);
1114
1124
  if (!f)
1115
1125
  return;
1116
1126
  d = e.transact((k) => {
1117
- const g = _(k.doc, f.pos), y = e.prosemirrorView.dom.querySelector(
1127
+ var S;
1128
+ const g = _(k.doc, f.pos), y = (S = e.domElement) == null ? void 0 : S.querySelector(
1118
1129
  `[data-id="${g.node.attrs.id}"]`
1119
1130
  ), T = y == null ? void 0 : y.getBoundingClientRect();
1120
1131
  return le(
@@ -1136,7 +1147,7 @@ async function ve(n, e) {
1136
1147
  }
1137
1148
  }
1138
1149
  }
1139
- const Mo = (n) => x.create({
1150
+ const wo = (o) => E.create({
1140
1151
  name: "dropFile",
1141
1152
  addProseMirrorPlugins() {
1142
1153
  return [
@@ -1144,98 +1155,98 @@ const Mo = (n) => x.create({
1144
1155
  props: {
1145
1156
  handleDOMEvents: {
1146
1157
  drop(e, t) {
1147
- if (!n.isEditable)
1158
+ if (!o.isEditable)
1148
1159
  return;
1149
- let o = null;
1160
+ let n = null;
1150
1161
  for (const s of oe)
1151
1162
  if (t.dataTransfer.types.includes(s)) {
1152
- o = s;
1163
+ n = s;
1153
1164
  break;
1154
1165
  }
1155
- return o === null ? !0 : o === "Files" ? (ve(t, n), !0) : !1;
1166
+ return n === null ? !0 : n === "Files" ? (Ie(t, o), !0) : !1;
1156
1167
  }
1157
1168
  }
1158
1169
  }
1159
1170
  })
1160
1171
  ];
1161
1172
  }
1162
- }), wo = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, To = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, Po = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, vo = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, Io = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Ao = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, _o = /\n{2} {0,3}-{2,48}\n{2}/, Do = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, Lo = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, No = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Oo = /^\s*\|(.+\|)+\s*$/m, Fo = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Ho = /^\s*\|(.+\|)+\s*$/m, $o = (n) => wo.test(n) || To.test(n) || Po.test(n) || vo.test(n) || Io.test(n) || Ao.test(n) || _o.test(n) || Do.test(n) || Lo.test(n) || No.test(n) || Oo.test(n) || Fo.test(n) || Ho.test(n);
1163
- async function Vo(n, e) {
1173
+ }), To = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, Po = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, vo = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Io = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, Ao = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, _o = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, Do = /\n{2} {0,3}-{2,48}\n{2}/, Lo = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, No = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, Oo = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Fo = /^\s*\|(.+\|)+\s*$/m, $o = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Ho = /^\s*\|(.+\|)+\s*$/m, Vo = (o) => To.test(o) || Po.test(o) || vo.test(o) || Io.test(o) || Ao.test(o) || _o.test(o) || Do.test(o) || Lo.test(o) || No.test(o) || Oo.test(o) || Fo.test(o) || $o.test(o) || Ho.test(o);
1174
+ async function Uo(o, e) {
1164
1175
  const { schema: t } = e.state;
1165
- if (!n.clipboardData)
1176
+ if (!o.clipboardData)
1166
1177
  return !1;
1167
- const o = n.clipboardData.getData("text/plain");
1168
- if (!o)
1178
+ const n = o.clipboardData.getData("text/plain");
1179
+ if (!n)
1169
1180
  return !1;
1170
1181
  if (!t.nodes.codeBlock)
1171
- return e.pasteText(o), !0;
1172
- const s = n.clipboardData.getData("vscode-editor-data"), i = s ? JSON.parse(s) : void 0, r = i == null ? void 0 : i.mode;
1173
- return r ? (e.pasteHTML(
1174
- `<pre><code class="language-${r}">${o.replace(
1182
+ return e.pasteText(n), !0;
1183
+ const s = o.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0, i = r == null ? void 0 : r.mode;
1184
+ return i ? (e.pasteHTML(
1185
+ `<pre><code class="language-${i}">${n.replace(
1175
1186
  /\r\n?/g,
1176
1187
  `
1177
1188
  `
1178
1189
  )}</code></pre>`
1179
1190
  ), !0) : !1;
1180
1191
  }
1181
- function Uo({
1182
- event: n,
1192
+ function zo({
1193
+ event: o,
1183
1194
  editor: e,
1184
1195
  prioritizeMarkdownOverHTML: t,
1185
- plainTextAsMarkdown: o
1196
+ plainTextAsMarkdown: n
1186
1197
  }) {
1187
1198
  var c;
1188
1199
  if (e.transact(
1189
1200
  (a) => a.selection.$from.parent.type.spec.code && a.selection.$to.parent.type.spec.code
1190
1201
  )) {
1191
- const a = (c = n.clipboardData) == null ? void 0 : c.getData("text/plain");
1202
+ const a = (c = o.clipboardData) == null ? void 0 : c.getData("text/plain");
1192
1203
  if (a)
1193
1204
  return e.pasteText(a), !0;
1194
1205
  }
1195
- let i;
1206
+ let r;
1196
1207
  for (const a of oe)
1197
- if (n.clipboardData.types.includes(a)) {
1198
- i = a;
1208
+ if (o.clipboardData.types.includes(a)) {
1209
+ r = a;
1199
1210
  break;
1200
1211
  }
1201
- if (!i)
1212
+ if (!r)
1202
1213
  return !0;
1203
- if (i === "vscode-editor-data")
1204
- return Vo(n, e.prosemirrorView), !0;
1205
- if (i === "Files")
1206
- return ve(n, e), !0;
1207
- const r = n.clipboardData.getData(i);
1208
- if (i === "blocknote/html")
1209
- return e.pasteHTML(r, !0), !0;
1210
- if (i === "text/markdown")
1211
- return e.pasteMarkdown(r), !0;
1214
+ if (r === "vscode-editor-data")
1215
+ return Uo(o, e.prosemirrorView), !0;
1216
+ if (r === "Files")
1217
+ return Ie(o, e), !0;
1218
+ const i = o.clipboardData.getData(r);
1219
+ if (r === "blocknote/html")
1220
+ return e.pasteHTML(i, !0), !0;
1221
+ if (r === "text/markdown")
1222
+ return e.pasteMarkdown(i), !0;
1212
1223
  if (t) {
1213
- const a = n.clipboardData.getData("text/plain");
1214
- if ($o(a))
1224
+ const a = o.clipboardData.getData("text/plain");
1225
+ if (Vo(a))
1215
1226
  return e.pasteMarkdown(a), !0;
1216
1227
  }
1217
- return i === "text/html" ? (e.pasteHTML(r), !0) : o ? (e.pasteMarkdown(r), !0) : (e.pasteText(r), !0);
1228
+ return r === "text/html" ? (e.pasteHTML(i), !0) : n ? (e.pasteMarkdown(i), !0) : (e.pasteText(i), !0);
1218
1229
  }
1219
- const zo = (n, e) => x.create({
1230
+ const Go = (o, e) => E.create({
1220
1231
  name: "pasteFromClipboard",
1221
1232
  addProseMirrorPlugins() {
1222
1233
  return [
1223
1234
  new ee({
1224
1235
  props: {
1225
1236
  handleDOMEvents: {
1226
- paste(t, o) {
1227
- if (o.preventDefault(), !!n.isEditable)
1237
+ paste(t, n) {
1238
+ if (n.preventDefault(), !!o.isEditable)
1228
1239
  return e({
1229
- event: o,
1230
- editor: n,
1240
+ event: n,
1241
+ editor: o,
1231
1242
  defaultPasteHandler: ({
1232
1243
  prioritizeMarkdownOverHTML: s = !0,
1233
- plainTextAsMarkdown: i = !0
1234
- } = {}) => Uo({
1235
- event: o,
1236
- editor: n,
1244
+ plainTextAsMarkdown: r = !0
1245
+ } = {}) => zo({
1246
+ event: n,
1247
+ editor: o,
1237
1248
  prioritizeMarkdownOverHTML: s,
1238
- plainTextAsMarkdown: i
1249
+ plainTextAsMarkdown: r
1239
1250
  })
1240
1251
  });
1241
1252
  }
@@ -1245,85 +1256,85 @@ const zo = (n, e) => x.create({
1245
1256
  ];
1246
1257
  }
1247
1258
  });
1248
- function Go(n, e, t) {
1259
+ function Ro(o, e, t) {
1249
1260
  var c;
1250
- let o = !1;
1251
- const s = n.state.selection instanceof te;
1261
+ let n = !1;
1262
+ const s = o.state.selection instanceof te;
1252
1263
  if (!s) {
1253
- const a = n.state.doc.slice(
1254
- n.state.selection.from,
1255
- n.state.selection.to,
1264
+ const a = o.state.doc.slice(
1265
+ o.state.selection.from,
1266
+ o.state.selection.to,
1256
1267
  !1
1257
1268
  ).content, l = [];
1258
1269
  for (let d = 0; d < a.childCount; d++)
1259
1270
  l.push(a.child(d));
1260
- o = l.find(
1271
+ n = l.find(
1261
1272
  (d) => d.type.isInGroup("bnBlock") || d.type.name === "blockGroup" || d.type.spec.group === "blockContent"
1262
- ) === void 0, o && (e = a);
1273
+ ) === void 0, n && (e = a);
1263
1274
  }
1264
- let i;
1265
- const r = be(
1266
- n.state.schema,
1275
+ let r;
1276
+ const i = be(
1277
+ o.state.schema,
1267
1278
  t
1268
1279
  );
1269
1280
  if (s) {
1270
1281
  ((c = e.firstChild) == null ? void 0 : c.type.name) === "table" && (e = e.firstChild.content);
1271
- const a = ze(
1282
+ const a = Ge(
1272
1283
  e,
1273
1284
  t.schema.inlineContentSchema,
1274
1285
  t.schema.styleSchema
1275
1286
  );
1276
- i = `<table>${r.exportInlineContent(
1287
+ r = `<table>${i.exportInlineContent(
1277
1288
  a,
1278
1289
  {}
1279
1290
  )}</table>`;
1280
- } else if (o) {
1281
- const a = Ge(
1291
+ } else if (n) {
1292
+ const a = Re(
1282
1293
  e,
1283
1294
  t.schema.inlineContentSchema,
1284
1295
  t.schema.styleSchema
1285
1296
  );
1286
- i = r.exportInlineContent(a, {});
1297
+ r = i.exportInlineContent(a, {});
1287
1298
  } else {
1288
- const a = st(e);
1289
- i = r.exportBlocks(a, {});
1299
+ const a = rt(e);
1300
+ r = i.exportBlocks(a, {});
1290
1301
  }
1291
- return i;
1302
+ return r;
1292
1303
  }
1293
- function Ie(n, e) {
1294
- "node" in n.state.selection && n.state.selection.node.type.spec.group === "blockContent" && e.transact(
1295
- (r) => r.setSelection(
1296
- new L(r.doc.resolve(n.state.selection.from - 1))
1304
+ function Ae(o, e) {
1305
+ "node" in o.state.selection && o.state.selection.node.type.spec.group === "blockContent" && e.transact(
1306
+ (i) => i.setSelection(
1307
+ new L(i.doc.resolve(o.state.selection.from - 1))
1297
1308
  )
1298
1309
  );
1299
- const t = n.serializeForClipboard(
1300
- n.state.selection.content()
1301
- ).dom.innerHTML, o = n.state.selection.content().content, s = Go(
1302
- n,
1310
+ const t = o.serializeForClipboard(
1311
+ o.state.selection.content()
1312
+ ).dom.innerHTML, n = o.state.selection.content().content, s = Ro(
1303
1313
  o,
1314
+ n,
1304
1315
  e
1305
- ), i = nt(s);
1306
- return { clipboardHTML: t, externalHTML: s, markdown: i };
1316
+ ), r = st(s);
1317
+ return { clipboardHTML: t, externalHTML: s, markdown: r };
1307
1318
  }
1308
1319
  const de = () => {
1309
- const n = window.getSelection();
1310
- if (!n || n.isCollapsed)
1320
+ const o = window.getSelection();
1321
+ if (!o || o.isCollapsed)
1311
1322
  return !0;
1312
- let e = n.focusNode;
1323
+ let e = o.focusNode;
1313
1324
  for (; e; ) {
1314
1325
  if (e instanceof HTMLElement && e.getAttribute("contenteditable") === "false")
1315
1326
  return !0;
1316
1327
  e = e.parentElement;
1317
1328
  }
1318
1329
  return !1;
1319
- }, ue = (n, e, t) => {
1330
+ }, ue = (o, e, t) => {
1320
1331
  t.preventDefault(), t.clipboardData.clearData();
1321
- const { clipboardHTML: o, externalHTML: s, markdown: i } = Ie(
1332
+ const { clipboardHTML: n, externalHTML: s, markdown: r } = Ae(
1322
1333
  e,
1323
- n
1334
+ o
1324
1335
  );
1325
- t.clipboardData.setData("blocknote/html", o), t.clipboardData.setData("text/html", s), t.clipboardData.setData("text/plain", i);
1326
- }, Ro = (n) => x.create({
1336
+ t.clipboardData.setData("blocknote/html", n), t.clipboardData.setData("text/html", s), t.clipboardData.setData("text/plain", r);
1337
+ }, jo = (o) => E.create({
1327
1338
  name: "copyToClipboard",
1328
1339
  addProseMirrorPlugins() {
1329
1340
  return [
@@ -1331,10 +1342,10 @@ const de = () => {
1331
1342
  props: {
1332
1343
  handleDOMEvents: {
1333
1344
  copy(e, t) {
1334
- return de() || ue(n, e, t), !0;
1345
+ return de() || ue(o, e, t), !0;
1335
1346
  },
1336
1347
  cut(e, t) {
1337
- return de() || (ue(n, e, t), e.editable && e.dispatch(e.state.tr.deleteSelection())), !0;
1348
+ return de() || (ue(o, e, t), e.editable && e.dispatch(e.state.tr.deleteSelection())), !0;
1338
1349
  },
1339
1350
  // This is for the use-case in which only a block without content
1340
1351
  // is selected, e.g. an image block, and dragged (not using the
@@ -1342,34 +1353,34 @@ const de = () => {
1342
1353
  dragstart(e, t) {
1343
1354
  if (!("node" in e.state.selection) || e.state.selection.node.type.spec.group !== "blockContent")
1344
1355
  return;
1345
- n.transact(
1346
- (r) => r.setSelection(
1356
+ o.transact(
1357
+ (i) => i.setSelection(
1347
1358
  new L(
1348
- r.doc.resolve(e.state.selection.from - 1)
1359
+ i.doc.resolve(e.state.selection.from - 1)
1349
1360
  )
1350
1361
  )
1351
1362
  ), t.preventDefault(), t.dataTransfer.clearData();
1352
- const { clipboardHTML: o, externalHTML: s, markdown: i } = Ie(e, n);
1353
- return t.dataTransfer.setData("blocknote/html", o), t.dataTransfer.setData("text/html", s), t.dataTransfer.setData("text/plain", i), !0;
1363
+ const { clipboardHTML: n, externalHTML: s, markdown: r } = Ae(e, o);
1364
+ return t.dataTransfer.setData("blocknote/html", n), t.dataTransfer.setData("text/html", s), t.dataTransfer.setData("text/plain", r), !0;
1354
1365
  }
1355
1366
  }
1356
1367
  }
1357
1368
  })
1358
1369
  ];
1359
1370
  }
1360
- }), jo = x.create({
1371
+ }), Wo = E.create({
1361
1372
  name: "blockBackgroundColor",
1362
1373
  addGlobalAttributes() {
1363
1374
  return [
1364
1375
  {
1365
1376
  types: ["tableCell", "tableHeader"],
1366
1377
  attributes: {
1367
- backgroundColor: qe()
1378
+ backgroundColor: Qe()
1368
1379
  }
1369
1380
  }
1370
1381
  ];
1371
1382
  }
1372
- }), Wo = D.create({
1383
+ }), Ko = D.create({
1373
1384
  name: "hardBreak",
1374
1385
  inline: !0,
1375
1386
  group: "inline",
@@ -1379,151 +1390,151 @@ const de = () => {
1379
1390
  parseHTML() {
1380
1391
  return [{ tag: "br" }];
1381
1392
  },
1382
- renderHTML({ HTMLAttributes: n }) {
1383
- return ["br", xt(this.options.HTMLAttributes, n)];
1393
+ renderHTML({ HTMLAttributes: o }) {
1394
+ return ["br", Et(this.options.HTMLAttributes, o)];
1384
1395
  },
1385
1396
  renderText() {
1386
1397
  return `
1387
1398
  `;
1388
1399
  }
1389
- }), J = (n, e) => {
1390
- const t = n.resolve(e), o = t.index();
1391
- if (o === 0)
1400
+ }), J = (o, e) => {
1401
+ const t = o.resolve(e), n = t.index();
1402
+ if (n === 0)
1392
1403
  return;
1393
- const s = t.posAtIndex(o - 1);
1394
- return q(
1395
- n.resolve(s)
1404
+ const s = t.posAtIndex(n - 1);
1405
+ return Y(
1406
+ o.resolve(s)
1396
1407
  );
1397
- }, Ae = (n, e) => {
1408
+ }, _e = (o, e) => {
1398
1409
  for (; e.childContainer; ) {
1399
- const t = e.childContainer.node, o = n.resolve(e.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
1400
- e = q(n.resolve(o));
1410
+ const t = e.childContainer.node, n = o.resolve(e.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
1411
+ e = Y(o.resolve(n));
1401
1412
  }
1402
1413
  return e;
1403
- }, Ko = (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*", Jo = (n, e, t, o) => {
1404
- if (!o.isBlockContainer)
1414
+ }, Jo = (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*", qo = (o, e, t, n) => {
1415
+ if (!n.isBlockContainer)
1405
1416
  throw new Error(
1406
- `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`
1417
+ `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`
1407
1418
  );
1408
- if (o.childContainer) {
1409
- const s = n.doc.resolve(
1410
- o.childContainer.beforePos + 1
1411
- ), i = n.doc.resolve(
1412
- o.childContainer.afterPos - 1
1413
- ), r = s.blockRange(i);
1419
+ if (n.childContainer) {
1420
+ const s = o.doc.resolve(
1421
+ n.childContainer.beforePos + 1
1422
+ ), r = o.doc.resolve(
1423
+ n.childContainer.afterPos - 1
1424
+ ), i = s.blockRange(r);
1414
1425
  if (e) {
1415
- const c = n.doc.resolve(o.bnBlock.beforePos);
1416
- n.tr.lift(r, c.depth);
1426
+ const c = o.doc.resolve(n.bnBlock.beforePos);
1427
+ o.tr.lift(i, c.depth);
1417
1428
  }
1418
1429
  }
1419
1430
  if (e) {
1420
1431
  if (!t.isBlockContainer)
1421
1432
  throw new Error(
1422
- `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`
1433
+ `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`
1423
1434
  );
1424
1435
  e(
1425
- n.tr.delete(
1436
+ o.tr.delete(
1426
1437
  t.blockContent.afterPos - 1,
1427
- o.blockContent.beforePos + 1
1438
+ n.blockContent.beforePos + 1
1428
1439
  )
1429
1440
  );
1430
1441
  }
1431
1442
  return !0;
1432
- }, pe = (n) => ({
1443
+ }, pe = (o) => ({
1433
1444
  state: e,
1434
1445
  dispatch: t
1435
1446
  }) => {
1436
- const o = e.doc.resolve(n), s = q(o), i = J(
1447
+ const n = e.doc.resolve(o), s = Y(n), r = J(
1437
1448
  e.doc,
1438
1449
  s.bnBlock.beforePos
1439
1450
  );
1440
- if (!i)
1451
+ if (!r)
1441
1452
  return !1;
1442
- const r = Ae(
1453
+ const i = _e(
1443
1454
  e.doc,
1444
- i
1455
+ r
1445
1456
  );
1446
- return Ko(r, s) ? Jo(e, t, r, s) : !1;
1447
- }, Yo = x.create({
1457
+ return Jo(i, s) ? qo(e, t, i, s) : !1;
1458
+ }, Yo = E.create({
1448
1459
  priority: 50,
1449
1460
  // TODO: The shortcuts need a refactor. Do we want to use a command priority
1450
1461
  // design as there is now, or clump the logic into a single function?
1451
1462
  addKeyboardShortcuts() {
1452
- const n = () => this.editor.commands.first(({ chain: o, commands: s }) => [
1463
+ const o = () => this.editor.commands.first(({ chain: n, commands: s }) => [
1453
1464
  // Deletes the selection if it's not empty.
1454
1465
  () => s.deleteSelection(),
1455
1466
  // Undoes an input rule if one was triggered in the last editor state change.
1456
1467
  () => s.undoInputRule(),
1457
1468
  // Reverts block content type to a paragraph if the selection is at the start of the block.
1458
- () => s.command(({ state: i }) => {
1459
- const r = S(i);
1460
- if (!r.isBlockContainer)
1469
+ () => s.command(({ state: r }) => {
1470
+ const i = B(r);
1471
+ if (!i.isBlockContainer)
1461
1472
  return !1;
1462
- const c = i.selection.from === r.blockContent.beforePos + 1, a = r.blockContent.node.type.name === "paragraph";
1473
+ const c = r.selection.from === i.blockContent.beforePos + 1, a = i.blockContent.node.type.name === "paragraph";
1463
1474
  return c && !a ? s.command(
1464
- Xe(r.bnBlock.beforePos, {
1475
+ Ze(i.bnBlock.beforePos, {
1465
1476
  type: "paragraph",
1466
1477
  props: {}
1467
1478
  })
1468
1479
  ) : !1;
1469
1480
  }),
1470
1481
  // Removes a level of nesting if the block is indented if the selection is at the start of the block.
1471
- () => s.command(({ state: i }) => {
1472
- const r = S(i);
1473
- if (!r.isBlockContainer)
1482
+ () => s.command(({ state: r }) => {
1483
+ const i = B(r);
1484
+ if (!i.isBlockContainer)
1474
1485
  return !1;
1475
- const { blockContent: c } = r;
1476
- return i.selection.from === c.beforePos + 1 ? s.liftListItem("blockContainer") : !1;
1486
+ const { blockContent: c } = i;
1487
+ return r.selection.from === c.beforePos + 1 ? s.liftListItem("blockContainer") : !1;
1477
1488
  }),
1478
1489
  // Merges block with the previous one if it isn't indented, and the selection is at the start of the
1479
1490
  // block. The target block for merging must contain inline content.
1480
- () => s.command(({ state: i }) => {
1481
- const r = S(i);
1482
- if (!r.isBlockContainer)
1491
+ () => s.command(({ state: r }) => {
1492
+ const i = B(r);
1493
+ if (!i.isBlockContainer)
1483
1494
  return !1;
1484
- const { bnBlock: c, blockContent: a } = r, l = i.selection.from === a.beforePos + 1, d = i.selection.empty, u = c.beforePos;
1485
- return l && d ? o().command(pe(u)).scrollIntoView().run() : !1;
1495
+ const { bnBlock: c, blockContent: a } = i, l = r.selection.from === a.beforePos + 1, d = r.selection.empty, u = c.beforePos;
1496
+ return l && d ? n().command(pe(u)).scrollIntoView().run() : !1;
1486
1497
  }),
1487
- () => s.command(({ state: i, tr: r, dispatch: c }) => {
1488
- const a = S(i);
1489
- if (!a.isBlockContainer || !(r.selection.from === a.blockContent.beforePos + 1))
1498
+ () => s.command(({ state: r, tr: i, dispatch: c }) => {
1499
+ const a = B(r);
1500
+ if (!a.isBlockContainer || !(i.selection.from === a.blockContent.beforePos + 1))
1490
1501
  return !1;
1491
- const d = r.doc.resolve(a.bnBlock.beforePos);
1502
+ const d = i.doc.resolve(a.bnBlock.beforePos);
1492
1503
  if (d.nodeBefore || d.node().type.name !== "column")
1493
1504
  return !1;
1494
- const m = r.doc.resolve(a.bnBlock.beforePos), f = r.doc.resolve(m.before()), k = f.before();
1505
+ const m = i.doc.resolve(a.bnBlock.beforePos), f = i.doc.resolve(m.before()), k = f.before();
1495
1506
  if (c) {
1496
- const g = r.doc.slice(
1507
+ const g = i.doc.slice(
1497
1508
  a.bnBlock.beforePos,
1498
1509
  a.bnBlock.afterPos
1499
1510
  ).content;
1500
- r.delete(
1511
+ i.delete(
1501
1512
  a.bnBlock.beforePos,
1502
1513
  a.bnBlock.afterPos
1503
- ), f.index() === 0 ? (W(r, k), r.insert(k, g), r.setSelection(
1504
- M.near(r.doc.resolve(k))
1505
- )) : (r.insert(f.pos - 1, g), r.setSelection(
1506
- M.near(r.doc.resolve(f.pos - 1))
1507
- ), W(r, k));
1514
+ ), f.index() === 0 ? (W(i, k), i.insert(k, g), i.setSelection(
1515
+ M.near(i.doc.resolve(k))
1516
+ )) : (i.insert(f.pos - 1, g), i.setSelection(
1517
+ M.near(i.doc.resolve(f.pos - 1))
1518
+ ), W(i, k));
1508
1519
  }
1509
1520
  return !0;
1510
1521
  }),
1511
1522
  // Deletes the current block if it's an empty block with inline content,
1512
1523
  // and moves the selection to the previous block.
1513
- () => s.command(({ state: i }) => {
1514
- const r = S(i);
1515
- if (!r.isBlockContainer)
1524
+ () => s.command(({ state: r }) => {
1525
+ const i = B(r);
1526
+ if (!i.isBlockContainer)
1516
1527
  return !1;
1517
- if (r.blockContent.node.childCount === 0 && r.blockContent.node.type.spec.content === "inline*") {
1528
+ if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
1518
1529
  const a = J(
1519
- i.doc,
1520
- r.bnBlock.beforePos
1530
+ r.doc,
1531
+ i.bnBlock.beforePos
1521
1532
  );
1522
1533
  if (!a || !a.isBlockContainer)
1523
1534
  return !1;
1524
- let l = o();
1535
+ let l = n();
1525
1536
  if (a.blockContent.node.type.spec.content === "tableRow+") {
1526
- const f = r.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
1537
+ const f = i.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
1527
1538
  l = l.setTextSelection(
1528
1539
  f
1529
1540
  );
@@ -1537,8 +1548,8 @@ const de = () => {
1537
1548
  l = l.setTextSelection(d);
1538
1549
  }
1539
1550
  return l.deleteRange({
1540
- from: r.bnBlock.beforePos,
1541
- to: r.bnBlock.afterPos
1551
+ from: i.bnBlock.beforePos,
1552
+ to: i.bnBlock.afterPos
1542
1553
  }).scrollIntoView().run();
1543
1554
  }
1544
1555
  return !1;
@@ -1546,26 +1557,26 @@ const de = () => {
1546
1557
  // Deletes previous block if it contains no content and isn't a table,
1547
1558
  // when the selection is empty and at the start of the block. Moves the
1548
1559
  // current block into the deleted block's place.
1549
- () => s.command(({ state: i }) => {
1550
- const r = S(i);
1551
- if (!r.isBlockContainer)
1560
+ () => s.command(({ state: r }) => {
1561
+ const i = B(r);
1562
+ if (!i.isBlockContainer)
1552
1563
  throw new Error("todo");
1553
- const c = i.selection.from === r.blockContent.beforePos + 1, a = i.selection.empty, l = J(
1554
- i.doc,
1555
- r.bnBlock.beforePos
1564
+ const c = r.selection.from === i.blockContent.beforePos + 1, a = r.selection.empty, l = J(
1565
+ r.doc,
1566
+ i.bnBlock.beforePos
1556
1567
  );
1557
1568
  if (l && c && a) {
1558
- const d = Ae(
1559
- i.doc,
1569
+ const d = _e(
1570
+ r.doc,
1560
1571
  l
1561
1572
  );
1562
1573
  if (!d.isBlockContainer)
1563
1574
  throw new Error("todo");
1564
1575
  if (d.blockContent.node.type.spec.content === "" || d.blockContent.node.type.spec.content === "inline*" && d.blockContent.node.childCount === 0)
1565
- return o().cut(
1576
+ return n().cut(
1566
1577
  {
1567
- from: r.bnBlock.beforePos,
1568
- to: r.bnBlock.afterPos
1578
+ from: i.bnBlock.beforePos,
1579
+ to: i.bnBlock.afterPos
1569
1580
  },
1570
1581
  d.bnBlock.afterPos
1571
1582
  ).deleteRange({
@@ -1575,77 +1586,77 @@ const de = () => {
1575
1586
  }
1576
1587
  return !1;
1577
1588
  })
1578
- ]), e = () => this.editor.commands.first(({ commands: o }) => [
1589
+ ]), e = () => this.editor.commands.first(({ commands: n }) => [
1579
1590
  // Deletes the selection if it's not empty.
1580
- () => o.deleteSelection(),
1591
+ () => n.deleteSelection(),
1581
1592
  // Merges block with the next one (at the same nesting level or lower),
1582
1593
  // if one exists, the block has no children, and the selection is at the
1583
1594
  // end of the block.
1584
- () => o.command(({ state: s }) => {
1585
- const i = S(s);
1586
- if (!i.isBlockContainer)
1595
+ () => n.command(({ state: s }) => {
1596
+ const r = B(s);
1597
+ if (!r.isBlockContainer)
1587
1598
  return !1;
1588
1599
  const {
1589
- bnBlock: r,
1600
+ bnBlock: i,
1590
1601
  blockContent: c,
1591
1602
  childContainer: a
1592
- } = i, { depth: l } = s.doc.resolve(r.beforePos), d = r.afterPos === s.doc.nodeSize - 3, u = s.selection.from === c.afterPos - 1, p = s.selection.empty;
1603
+ } = r, { depth: l } = s.doc.resolve(i.beforePos), d = i.afterPos === s.doc.nodeSize - 3, u = s.selection.from === c.afterPos - 1, p = s.selection.empty;
1593
1604
  if (!d && u && p && !(a !== void 0)) {
1594
- let f = l, k = r.afterPos + 1, g = s.doc.resolve(k).depth;
1605
+ let f = l, k = i.afterPos + 1, g = s.doc.resolve(k).depth;
1595
1606
  for (; g < f; )
1596
1607
  f = g, k += 2, g = s.doc.resolve(k).depth;
1597
- return o.command(pe(k - 1));
1608
+ return n.command(pe(k - 1));
1598
1609
  }
1599
1610
  return !1;
1600
1611
  })
1601
- ]), t = (o = !1) => this.editor.commands.first(({ commands: s, tr: i }) => [
1612
+ ]), t = (n = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
1602
1613
  // Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
1603
1614
  // of the block.
1604
- () => s.command(({ state: r }) => {
1605
- const c = S(r);
1615
+ () => s.command(({ state: i }) => {
1616
+ const c = B(i);
1606
1617
  if (!c.isBlockContainer)
1607
1618
  return !1;
1608
- const { bnBlock: a, blockContent: l } = c, { depth: d } = r.doc.resolve(a.beforePos), u = r.selection.$anchor.parentOffset === 0, p = r.selection.anchor === r.selection.head, m = l.node.childCount === 0, f = d > 1;
1619
+ const { bnBlock: a, blockContent: l } = c, { depth: d } = i.doc.resolve(a.beforePos), u = i.selection.$anchor.parentOffset === 0, p = i.selection.anchor === i.selection.head, m = l.node.childCount === 0, f = d > 1;
1609
1620
  return u && p && m && f ? s.liftListItem("blockContainer") : !1;
1610
1621
  }),
1611
1622
  // Creates a hard break if block is configured to do so.
1612
- () => s.command(({ state: r }) => {
1623
+ () => s.command(({ state: i }) => {
1613
1624
  var l;
1614
- const c = S(r), a = ((l = this.options.editor.schema.blockSchema[c.blockNoteType].meta) == null ? void 0 : l.hardBreakShortcut) ?? "shift+enter";
1625
+ const c = B(i), a = ((l = this.options.editor.schema.blockSchema[c.blockNoteType].meta) == null ? void 0 : l.hardBreakShortcut) ?? "shift+enter";
1615
1626
  if (a === "none")
1616
1627
  return !1;
1617
1628
  if (
1618
1629
  // If shortcut is not configured, or is configured as "shift+enter",
1619
1630
  // create a hard break for shift+enter, but not for enter.
1620
- a === "shift+enter" && o || // If shortcut is configured as "enter", create a hard break for
1631
+ a === "shift+enter" && n || // If shortcut is configured as "enter", create a hard break for
1621
1632
  // both enter and shift+enter.
1622
1633
  a === "enter"
1623
1634
  ) {
1624
- const d = i.storedMarks || i.selection.$head.marks().filter(
1635
+ const d = r.storedMarks || r.selection.$head.marks().filter(
1625
1636
  (u) => this.editor.extensionManager.splittableMarks.includes(
1626
1637
  u.type.name
1627
1638
  )
1628
1639
  );
1629
- return i.insert(
1630
- i.selection.head,
1631
- i.doc.type.schema.nodes.hardBreak.create()
1640
+ return r.insert(
1641
+ r.selection.head,
1642
+ r.doc.type.schema.nodes.hardBreak.create()
1632
1643
  ).ensureMarks(d), !0;
1633
1644
  }
1634
1645
  return !1;
1635
1646
  }),
1636
1647
  // Creates a new block and moves the selection to it if the current one is empty, while the selection is also
1637
1648
  // empty & at the start of the block.
1638
- () => s.command(({ state: r, dispatch: c }) => {
1639
- const a = S(r);
1649
+ () => s.command(({ state: i, dispatch: c }) => {
1650
+ const a = B(i);
1640
1651
  if (!a.isBlockContainer)
1641
1652
  return !1;
1642
- const { bnBlock: l, blockContent: d } = a, u = r.selection.$anchor.parentOffset === 0, p = r.selection.anchor === r.selection.head, m = d.node.childCount === 0;
1653
+ const { bnBlock: l, blockContent: d } = a, u = i.selection.$anchor.parentOffset === 0, p = i.selection.anchor === i.selection.head, m = d.node.childCount === 0;
1643
1654
  if (u && p && m) {
1644
1655
  const f = l.afterPos, k = f + 2;
1645
1656
  if (c) {
1646
- const g = r.schema.nodes.blockContainer.createAndFill();
1647
- r.tr.insert(f, g).scrollIntoView(), r.tr.setSelection(
1648
- new M(r.doc.resolve(k))
1657
+ const g = i.schema.nodes.blockContainer.createAndFill();
1658
+ i.tr.insert(f, g).scrollIntoView(), i.tr.setSelection(
1659
+ new M(i.doc.resolve(k))
1649
1660
  );
1650
1661
  }
1651
1662
  return !0;
@@ -1654,14 +1665,14 @@ const de = () => {
1654
1665
  }),
1655
1666
  // Splits the current block, moving content inside that's after the cursor to a new text block below. Also
1656
1667
  // deletes the selection beforehand, if it's not empty.
1657
- () => s.command(({ state: r, chain: c }) => {
1658
- const a = S(r);
1668
+ () => s.command(({ state: i, chain: c }) => {
1669
+ const a = B(i);
1659
1670
  if (!a.isBlockContainer)
1660
1671
  return !1;
1661
- const { blockContent: l } = a, d = r.selection.$anchor.parentOffset === 0;
1672
+ const { blockContent: l } = a, d = i.selection.$anchor.parentOffset === 0;
1662
1673
  return l.node.childCount === 0 ? !1 : (c().deleteSelection().command(
1663
- Qe(
1664
- r.selection.from,
1674
+ Xe(
1675
+ i.selection.from,
1665
1676
  d,
1666
1677
  d
1667
1678
  )
@@ -1669,19 +1680,19 @@ const de = () => {
1669
1680
  })
1670
1681
  ]);
1671
1682
  return {
1672
- Backspace: n,
1683
+ Backspace: o,
1673
1684
  Delete: e,
1674
1685
  Enter: () => t(),
1675
1686
  "Shift-Enter": () => t(!0),
1676
1687
  // Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
1677
1688
  // editor since the browser will try to use tab for keyboard navigation.
1678
1689
  Tab: () => {
1679
- var o, s;
1680
- return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(R)) != null && o.store.state || ((s = this.options.editor.getExtension(G)) == null ? void 0 : s.store.state) !== void 0) ? !1 : we(this.options.editor);
1690
+ var n, s;
1691
+ 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);
1681
1692
  },
1682
1693
  "Shift-Tab": () => {
1683
- var o, s;
1684
- return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(R)) != null && o.store.state || ((s = this.options.editor.getExtension(G)) == null ? void 0 : s.store.state) !== void 0) ? !1 : this.editor.commands.liftListItem("blockContainer");
1694
+ var n, s;
1695
+ 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");
1685
1696
  },
1686
1697
  "Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
1687
1698
  "Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
@@ -1690,7 +1701,7 @@ const de = () => {
1690
1701
  "Shift-Mod-z": () => this.options.editor.redo()
1691
1702
  };
1692
1703
  }
1693
- }), qo = X.create({
1704
+ }), Qo = X.create({
1694
1705
  name: "insertion",
1695
1706
  inclusive: !1,
1696
1707
  excludes: "deletion modification insertion",
@@ -1700,8 +1711,8 @@ const de = () => {
1700
1711
  // note: validate is supported in prosemirror but not in tiptap, so this doesn't actually work (considered not critical)
1701
1712
  };
1702
1713
  },
1703
- extendMarkSchema(n) {
1704
- return n.name !== "insertion" ? {} : {
1714
+ extendMarkSchema(o) {
1715
+ return o.name !== "insertion" ? {} : {
1705
1716
  blocknoteIgnore: !0,
1706
1717
  inclusive: !1,
1707
1718
  toDOM(e, t) {
@@ -1728,7 +1739,7 @@ const de = () => {
1728
1739
  ]
1729
1740
  };
1730
1741
  }
1731
- }), Qo = X.create({
1742
+ }), Xo = X.create({
1732
1743
  name: "deletion",
1733
1744
  inclusive: !1,
1734
1745
  excludes: "insertion modification deletion",
@@ -1738,8 +1749,8 @@ const de = () => {
1738
1749
  // note: validate is supported in prosemirror but not in tiptap
1739
1750
  };
1740
1751
  },
1741
- extendMarkSchema(n) {
1742
- return n.name !== "deletion" ? {} : {
1752
+ extendMarkSchema(o) {
1753
+ return o.name !== "deletion" ? {} : {
1743
1754
  blocknoteIgnore: !0,
1744
1755
  inclusive: !1,
1745
1756
  // attrs: {
@@ -1769,7 +1780,7 @@ const de = () => {
1769
1780
  ]
1770
1781
  };
1771
1782
  }
1772
- }), Xo = X.create({
1783
+ }), Zo = X.create({
1773
1784
  name: "modification",
1774
1785
  inclusive: !1,
1775
1786
  excludes: "deletion insertion",
@@ -1782,8 +1793,8 @@ const de = () => {
1782
1793
  newValue: { default: null }
1783
1794
  };
1784
1795
  },
1785
- extendMarkSchema(n) {
1786
- return n.name !== "modification" ? {} : {
1796
+ extendMarkSchema(o) {
1797
+ return o.name !== "modification" ? {} : {
1787
1798
  blocknoteIgnore: !0,
1788
1799
  inclusive: !1,
1789
1800
  // attrs: {
@@ -1832,7 +1843,7 @@ const de = () => {
1832
1843
  ]
1833
1844
  };
1834
1845
  }
1835
- }), Zo = x.create({
1846
+ }), en = E.create({
1836
1847
  name: "textAlignment",
1837
1848
  addGlobalAttributes() {
1838
1849
  return [
@@ -1845,34 +1856,34 @@ const de = () => {
1845
1856
  attributes: {
1846
1857
  textAlignment: {
1847
1858
  default: "left",
1848
- parseHTML: (n) => n.getAttribute("data-text-alignment"),
1849
- renderHTML: (n) => n.textAlignment === "left" ? {} : {
1850
- "data-text-alignment": n.textAlignment
1859
+ parseHTML: (o) => o.getAttribute("data-text-alignment"),
1860
+ renderHTML: (o) => o.textAlignment === "left" ? {} : {
1861
+ "data-text-alignment": o.textAlignment
1851
1862
  }
1852
1863
  }
1853
1864
  }
1854
1865
  }
1855
1866
  ];
1856
1867
  }
1857
- }), en = x.create({
1868
+ }), tn = E.create({
1858
1869
  name: "blockTextColor",
1859
1870
  addGlobalAttributes() {
1860
1871
  return [
1861
1872
  {
1862
1873
  types: ["table", "tableCell", "tableHeader"],
1863
1874
  attributes: {
1864
- textColor: Ze()
1875
+ textColor: et()
1865
1876
  }
1866
1877
  }
1867
1878
  ];
1868
1879
  }
1869
- }), tn = {
1880
+ }), on = {
1870
1881
  blockColor: "data-block-color",
1871
1882
  blockStyle: "data-block-style",
1872
1883
  id: "data-id",
1873
1884
  depth: "data-depth",
1874
1885
  depthChange: "data-depth-change"
1875
- }, on = D.create({
1886
+ }, nn = D.create({
1876
1887
  name: "blockContainer",
1877
1888
  group: "blockGroupChild bnBlock",
1878
1889
  // A block always contains content, and optionally a blockGroup which contains nested blocks
@@ -1885,12 +1896,12 @@ const de = () => {
1885
1896
  return [
1886
1897
  {
1887
1898
  tag: "div[data-node-type=" + this.name + "]",
1888
- getAttrs: (n) => {
1889
- if (typeof n == "string")
1899
+ getAttrs: (o) => {
1900
+ if (typeof o == "string")
1890
1901
  return !1;
1891
1902
  const e = {};
1892
- for (const [t, o] of Object.entries(tn))
1893
- n.getAttribute(o) && (e[t] = n.getAttribute(o));
1903
+ for (const [t, n] of Object.entries(on))
1904
+ o.getAttribute(n) && (e[t] = o.getAttribute(n));
1894
1905
  return e;
1895
1906
  }
1896
1907
  },
@@ -1901,25 +1912,25 @@ const de = () => {
1901
1912
  }
1902
1913
  ];
1903
1914
  },
1904
- renderHTML({ HTMLAttributes: n }) {
1915
+ renderHTML({ HTMLAttributes: o }) {
1905
1916
  var s;
1906
1917
  const e = document.createElement("div");
1907
1918
  e.className = "bn-block-outer", e.setAttribute("data-node-type", "blockOuter");
1908
- for (const [i, r] of Object.entries(n))
1909
- i !== "class" && e.setAttribute(i, r);
1919
+ for (const [r, i] of Object.entries(o))
1920
+ r !== "class" && e.setAttribute(r, i);
1910
1921
  const t = {
1911
1922
  ...((s = this.options.domAttributes) == null ? void 0 : s.block) || {},
1912
- ...n
1913
- }, o = document.createElement("div");
1914
- o.className = Q("bn-block", t.class), o.setAttribute("data-node-type", this.name);
1915
- for (const [i, r] of Object.entries(t))
1916
- i !== "class" && o.setAttribute(i, r);
1917
- return e.appendChild(o), {
1923
+ ...o
1924
+ }, n = document.createElement("div");
1925
+ n.className = Q("bn-block", t.class), n.setAttribute("data-node-type", this.name);
1926
+ for (const [r, i] of Object.entries(t))
1927
+ r !== "class" && n.setAttribute(r, i);
1928
+ return e.appendChild(n), {
1918
1929
  dom: e,
1919
- contentDOM: o
1930
+ contentDOM: n
1920
1931
  };
1921
1932
  }
1922
- }), nn = D.create({
1933
+ }), sn = D.create({
1923
1934
  name: "blockGroup",
1924
1935
  group: "childContainer",
1925
1936
  content: "blockGroupChild+",
@@ -1928,128 +1939,138 @@ const de = () => {
1928
1939
  return [
1929
1940
  {
1930
1941
  tag: "div",
1931
- getAttrs: (n) => typeof n == "string" ? !1 : n.getAttribute("data-node-type") === "blockGroup" ? null : !1
1942
+ getAttrs: (o) => typeof o == "string" ? !1 : o.getAttribute("data-node-type") === "blockGroup" ? null : !1
1932
1943
  }
1933
1944
  ];
1934
1945
  },
1935
- renderHTML({ HTMLAttributes: n }) {
1936
- var o;
1946
+ renderHTML({ HTMLAttributes: o }) {
1947
+ var n;
1937
1948
  const e = {
1938
- ...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
1939
- ...n
1949
+ ...((n = this.options.domAttributes) == null ? void 0 : n.blockGroup) || {},
1950
+ ...o
1940
1951
  }, t = document.createElement("div");
1941
1952
  t.className = Q(
1942
1953
  "bn-block-group",
1943
1954
  e.class
1944
1955
  ), t.setAttribute("data-node-type", "blockGroup");
1945
- for (const [s, i] of Object.entries(e))
1946
- s !== "class" && t.setAttribute(s, i);
1956
+ for (const [s, r] of Object.entries(e))
1957
+ s !== "class" && t.setAttribute(s, r);
1947
1958
  return {
1948
1959
  dom: t,
1949
1960
  contentDOM: t
1950
1961
  };
1951
1962
  }
1952
- }), sn = D.create({
1963
+ }), rn = D.create({
1953
1964
  name: "doc",
1954
1965
  topNode: !0,
1955
1966
  content: "blockGroup",
1956
1967
  marks: "insertion modification deletion"
1957
- });
1968
+ }), an = Nt(
1969
+ ({ options: o }) => ({
1970
+ key: "collaboration",
1971
+ blockNoteExtensions: [
1972
+ it(o),
1973
+ at(o),
1974
+ ct(o),
1975
+ lt(),
1976
+ dt(o)
1977
+ ]
1978
+ })
1979
+ );
1958
1980
  let fe = !1;
1959
- function rn(n, e) {
1981
+ function cn(o, e) {
1960
1982
  const t = [
1961
1983
  I.ClipboardTextSerializer,
1962
1984
  I.Commands,
1963
1985
  I.Editable,
1964
1986
  I.FocusEvents,
1965
1987
  I.Tabindex,
1966
- Ot,
1988
+ Ft,
1967
1989
  me.configure({
1968
1990
  // everything from bnBlock group (nodes that represent a BlockNote block should have an id)
1969
1991
  types: ["blockContainer", "columnList", "column"],
1970
1992
  setIdAttribute: e.setIdAttribute
1971
1993
  }),
1972
- Wo,
1994
+ Ko,
1973
1995
  Ht,
1974
1996
  // marks:
1975
- qo,
1976
1997
  Qo,
1977
1998
  Xo,
1978
- Ft.extend({
1999
+ Zo,
2000
+ $t.extend({
1979
2001
  inclusive: !1
1980
2002
  }).configure({
1981
2003
  defaultProtocol: Bt,
1982
2004
  // only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
1983
2005
  protocols: fe ? [] : St
1984
2006
  }),
1985
- ...Object.values(n.schema.styleSpecs).map((o) => o.implementation.mark.configure({
1986
- editor: n
2007
+ ...Object.values(o.schema.styleSpecs).map((n) => n.implementation.mark.configure({
2008
+ editor: o
1987
2009
  })),
2010
+ tn,
2011
+ Wo,
1988
2012
  en,
1989
- jo,
1990
- Zo,
1991
2013
  // make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
1992
- x.create({
2014
+ E.create({
1993
2015
  name: "OverrideEscape",
1994
2016
  addKeyboardShortcuts: () => ({
1995
2017
  Escape: () => {
1996
- var o;
1997
- return (o = n.getExtension(ge)) != null && o.shown() ? !1 : (n.blur(), !0);
2018
+ var n;
2019
+ return (n = o.getExtension(ge)) != null && n.shown() ? !1 : (o.blur(), !0);
1998
2020
  }
1999
2021
  })
2000
2022
  }),
2001
2023
  // nodes
2002
- sn,
2003
- on.configure({
2004
- editor: n,
2024
+ rn,
2025
+ nn.configure({
2026
+ editor: o,
2005
2027
  domAttributes: e.domAttributes
2006
2028
  }),
2007
2029
  Yo.configure({
2008
- editor: n,
2030
+ editor: o,
2009
2031
  tabBehavior: e.tabBehavior
2010
2032
  }),
2011
- nn.configure({
2033
+ sn.configure({
2012
2034
  domAttributes: e.domAttributes
2013
2035
  }),
2014
- ...Object.values(n.schema.inlineContentSpecs).filter((o) => o.config !== "link" && o.config !== "text").map((o) => o.implementation.node.configure({
2015
- editor: n
2036
+ ...Object.values(o.schema.inlineContentSpecs).filter((n) => n.config !== "link" && n.config !== "text").map((n) => n.implementation.node.configure({
2037
+ editor: o
2016
2038
  })),
2017
- ...Object.values(n.schema.blockSpecs).flatMap((o) => [
2039
+ ...Object.values(o.schema.blockSpecs).flatMap((n) => [
2018
2040
  // the node extension implementations
2019
- ..."node" in o.implementation ? [
2020
- o.implementation.node.configure({
2021
- editor: n,
2041
+ ..."node" in n.implementation ? [
2042
+ n.implementation.node.configure({
2043
+ editor: o,
2022
2044
  domAttributes: e.domAttributes
2023
2045
  })
2024
2046
  ] : []
2025
2047
  ]),
2026
- Ro(n),
2027
- zo(
2028
- n,
2029
- e.pasteHandler || ((o) => o.defaultPasteHandler())
2048
+ jo(o),
2049
+ Go(
2050
+ o,
2051
+ e.pasteHandler || ((n) => n.defaultPasteHandler())
2030
2052
  ),
2031
- Mo(n)
2053
+ wo(o)
2032
2054
  ];
2033
2055
  return fe = !0, t;
2034
2056
  }
2035
- function an(n, e) {
2036
- var o;
2057
+ function ln(o, e) {
2037
2058
  const t = [
2038
- rt(),
2039
- it(e),
2059
+ ye(),
2060
+ ut(e),
2040
2061
  G(e),
2041
2062
  R(e),
2042
- at(e),
2043
- ct(),
2044
- lt(e),
2045
- $t(e),
2046
- dt(e),
2063
+ pt(e),
2064
+ ft(),
2065
+ ht(e),
2066
+ Vt(e),
2067
+ mt(e),
2047
2068
  ge(e),
2048
- ...e.trailingBlock !== !1 ? [ut()] : []
2069
+ ...e.trailingBlock !== !1 ? [kt()] : []
2049
2070
  ];
2050
- return e.collaboration ? (t.push(pt(e.collaboration)), (o = e.collaboration.provider) != null && o.awareness && t.push(ft(e.collaboration)), t.push(ht(e.collaboration)), t.push(mt(e.collaboration)), t.push(kt(e.collaboration))) : t.push(gt()), "table" in n.schema.blockSpecs && t.push(bt(e)), e.animations !== !1 && t.push(yt()), t;
2071
+ return e.collaboration ? t.push(an(e.collaboration)) : t.push(gt()), "table" in o.schema.blockSpecs && t.push(bt(e)), e.animations !== !1 && t.push(yt()), t;
2051
2072
  }
2052
- class cn {
2073
+ class dn {
2053
2074
  constructor(e, t) {
2054
2075
  /**
2055
2076
  * A set of extension keys which are disabled by the options
@@ -2073,27 +2094,27 @@ class cn {
2073
2094
  */
2074
2095
  h(this, "extensionPlugins", /* @__PURE__ */ new Map());
2075
2096
  this.editor = e, this.options = t, e.onMount(() => {
2076
- for (const o of this.extensions)
2077
- if (o.mount) {
2078
- const s = new window.AbortController(), i = o.mount({
2097
+ for (const n of this.extensions)
2098
+ if (n.mount) {
2099
+ const s = new window.AbortController(), r = n.mount({
2079
2100
  dom: e.prosemirrorView.dom,
2080
2101
  root: e.prosemirrorView.root,
2081
2102
  signal: s.signal
2082
2103
  });
2083
- i && s.signal.addEventListener("abort", () => {
2084
- i();
2085
- }), this.abortMap.set(o, s);
2104
+ r && s.signal.addEventListener("abort", () => {
2105
+ r();
2106
+ }), this.abortMap.set(n, s);
2086
2107
  }
2087
2108
  }), e.onUnmount(() => {
2088
- for (const [o, s] of this.abortMap.entries())
2089
- this.abortMap.delete(o), s.abort();
2109
+ for (const [n, s] of this.abortMap.entries())
2110
+ this.abortMap.delete(n), s.abort();
2090
2111
  }), this.disabledExtensions = new Set(t.disableExtensions || []);
2091
- for (const o of an(this.editor, this.options))
2092
- this.addExtension(o);
2093
- for (const o of this.options.extensions ?? [])
2094
- this.addExtension(o);
2095
- for (const o of Object.values(this.editor.schema.blockSpecs))
2096
- for (const s of o.extensions ?? [])
2112
+ for (const n of ln(this.editor, this.options))
2113
+ this.addExtension(n);
2114
+ for (const n of this.options.extensions ?? [])
2115
+ this.addExtension(n);
2116
+ for (const n of Object.values(this.editor.schema.blockSpecs))
2117
+ for (const s of n.extensions ?? [])
2097
2118
  this.addExtension(s);
2098
2119
  }
2099
2120
  /**
@@ -2102,26 +2123,26 @@ class cn {
2102
2123
  * This allows users to switch on & off extensions "at runtime".
2103
2124
  */
2104
2125
  registerExtension(e) {
2105
- var i;
2126
+ var r;
2106
2127
  const t = [].concat(e).filter(Boolean);
2107
2128
  if (!t.length) {
2108
2129
  console.warn("No extensions found to register", e);
2109
2130
  return;
2110
2131
  }
2111
- const o = t.map((r) => this.addExtension(r)).filter(Boolean), s = /* @__PURE__ */ new Set();
2112
- for (const r of o)
2113
- r != null && r.tiptapExtensions && console.warn(
2114
- `Extension ${r.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.`,
2115
- r
2116
- ), (i = r == null ? void 0 : r.inputRules) != null && i.length && console.warn(
2117
- `Extension ${r.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.`,
2118
- r
2119
- ), this.getProsemirrorPluginsFromExtension(r).plugins.forEach(
2132
+ const n = t.map((i) => this.addExtension(i)).filter(Boolean), s = /* @__PURE__ */ new Set();
2133
+ for (const i of n)
2134
+ i != null && i.tiptapExtensions && console.warn(
2135
+ `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.`,
2136
+ i
2137
+ ), (r = i == null ? void 0 : i.inputRules) != null && r.length && console.warn(
2138
+ `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.`,
2139
+ i
2140
+ ), this.getProsemirrorPluginsFromExtension(i).plugins.forEach(
2120
2141
  (c) => {
2121
2142
  s.add(c);
2122
2143
  }
2123
2144
  );
2124
- this.updatePlugins((r) => [...r, ...s]);
2145
+ this.updatePlugins((i) => [...i, ...s]);
2125
2146
  }
2126
2147
  /**
2127
2148
  * Register an extension to the editor
@@ -2132,10 +2153,13 @@ class cn {
2132
2153
  let t;
2133
2154
  if (typeof e == "function" ? t = e({ editor: this.editor }) : t = e, !(!t || this.disabledExtensions.has(t.key))) {
2134
2155
  if (typeof e == "function") {
2135
- const o = t[Nt];
2136
- typeof o == "function" && this.extensionFactories.set(o, t);
2156
+ const n = t[Ot];
2157
+ typeof n == "function" && this.extensionFactories.set(n, t);
2137
2158
  }
2138
- return this.extensions.push(t), t;
2159
+ if (this.extensions.push(t), t.blockNoteExtensions)
2160
+ for (const n of t.blockNoteExtensions)
2161
+ this.addExtension(n);
2162
+ return t;
2139
2163
  }
2140
2164
  }
2141
2165
  /**
@@ -2146,16 +2170,16 @@ class cn {
2146
2170
  resolveExtensions(e) {
2147
2171
  const t = [];
2148
2172
  if (typeof e == "function") {
2149
- const o = this.extensionFactories.get(e);
2150
- o && t.push(o);
2173
+ const n = this.extensionFactories.get(e);
2174
+ n && t.push(n);
2151
2175
  } else if (Array.isArray(e))
2152
- for (const o of e)
2153
- t.push(...this.resolveExtensions(o));
2176
+ for (const n of e)
2177
+ t.push(...this.resolveExtensions(n));
2154
2178
  else if (typeof e == "object" && "key" in e)
2155
2179
  t.push(e);
2156
2180
  else if (typeof e == "string") {
2157
- const o = this.extensions.find((s) => s.key === e);
2158
- o && t.push(o);
2181
+ const n = this.extensions.find((s) => s.key === e);
2182
+ n && t.push(n);
2159
2183
  }
2160
2184
  return t;
2161
2185
  }
@@ -2165,28 +2189,28 @@ class cn {
2165
2189
  * @returns void
2166
2190
  */
2167
2191
  unregisterExtension(e) {
2168
- var i;
2192
+ var r;
2169
2193
  const t = this.resolveExtensions(e);
2170
2194
  if (!t.length) {
2171
2195
  console.warn("No extensions found to unregister", e);
2172
2196
  return;
2173
2197
  }
2174
- let o = !1;
2198
+ let n = !1;
2175
2199
  const s = /* @__PURE__ */ new Set();
2176
- for (const r of t) {
2177
- this.extensions = this.extensions.filter((a) => a !== r), this.extensionFactories.forEach((a, l) => {
2178
- a === r && this.extensionFactories.delete(l);
2179
- }), (i = this.abortMap.get(r)) == null || i.abort(), this.abortMap.delete(r);
2180
- const c = this.extensionPlugins.get(r);
2200
+ for (const i of t) {
2201
+ this.extensions = this.extensions.filter((a) => a !== i), this.extensionFactories.forEach((a, l) => {
2202
+ a === i && this.extensionFactories.delete(l);
2203
+ }), (r = this.abortMap.get(i)) == null || r.abort(), this.abortMap.delete(i);
2204
+ const c = this.extensionPlugins.get(i);
2181
2205
  c == null || c.forEach((a) => {
2182
2206
  s.add(a);
2183
- }), this.extensionPlugins.delete(r), r.tiptapExtensions && !o && (o = !0, console.warn(
2184
- `Extension ${r.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.`,
2207
+ }), this.extensionPlugins.delete(i), i.tiptapExtensions && !n && (n = !0, console.warn(
2208
+ `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.`,
2185
2209
  e
2186
2210
  ));
2187
2211
  }
2188
2212
  this.updatePlugins(
2189
- (r) => r.filter((c) => !s.has(c))
2213
+ (i) => i.filter((c) => !s.has(c))
2190
2214
  );
2191
2215
  }
2192
2216
  /**
@@ -2195,44 +2219,44 @@ class cn {
2195
2219
  * @returns void
2196
2220
  */
2197
2221
  updatePlugins(e) {
2198
- const t = this.editor.prosemirrorState, o = t.reconfigure({
2222
+ const t = this.editor.prosemirrorState, n = t.reconfigure({
2199
2223
  plugins: e(t.plugins.slice())
2200
2224
  });
2201
- this.editor.prosemirrorView.updateState(o);
2225
+ this.editor.prosemirrorView.updateState(n);
2202
2226
  }
2203
2227
  /**
2204
2228
  * Get all the extensions that are registered to the editor
2205
2229
  */
2206
2230
  getTiptapExtensions() {
2207
2231
  var s;
2208
- const e = rn(
2232
+ const e = cn(
2209
2233
  this.editor,
2210
2234
  this.options
2211
- ), t = Ct(this.extensions), o = /* @__PURE__ */ new Map();
2212
- for (const i of this.extensions) {
2213
- i.tiptapExtensions && e.push(...i.tiptapExtensions);
2214
- const r = t(i.key), { plugins: c, inputRules: a } = this.getProsemirrorPluginsFromExtension(i);
2235
+ ).filter((r) => !this.disabledExtensions.has(r.name)), t = Ct(this.extensions), n = /* @__PURE__ */ new Map();
2236
+ for (const r of this.extensions) {
2237
+ r.tiptapExtensions && e.push(...r.tiptapExtensions);
2238
+ const i = t(r.key), { plugins: c, inputRules: a } = this.getProsemirrorPluginsFromExtension(r);
2215
2239
  c.length && e.push(
2216
- x.create({
2217
- name: i.key,
2218
- priority: r,
2240
+ E.create({
2241
+ name: r.key,
2242
+ priority: i,
2219
2243
  addProseMirrorPlugins: () => c
2220
2244
  })
2221
- ), a.length && (o.has(r) || o.set(r, []), o.get(r).push(...a));
2245
+ ), a.length && (n.has(i) || n.set(i, []), n.get(i).push(...a));
2222
2246
  }
2223
2247
  e.push(
2224
- x.create({
2248
+ E.create({
2225
2249
  name: "blocknote-input-rules",
2226
2250
  addProseMirrorPlugins() {
2227
- const i = [];
2228
- return Array.from(o.keys()).sort().reverse().forEach((r) => {
2229
- i.push(...o.get(r));
2230
- }), [_t({ rules: i })];
2251
+ const r = [];
2252
+ return Array.from(n.keys()).sort().reverse().forEach((i) => {
2253
+ r.push(...n.get(i));
2254
+ }), [_t({ rules: r })];
2231
2255
  }
2232
2256
  })
2233
2257
  );
2234
- for (const i of ((s = this.options._tiptapOptions) == null ? void 0 : s.extensions) ?? [])
2235
- e.push(i);
2258
+ for (const r of ((s = this.options._tiptapOptions) == null ? void 0 : s.extensions) ?? [])
2259
+ e.push(r);
2236
2260
  return e;
2237
2261
  }
2238
2262
  /**
@@ -2242,9 +2266,9 @@ class cn {
2242
2266
  * - input rules
2243
2267
  */
2244
2268
  getProsemirrorPluginsFromExtension(e) {
2245
- var s, i, r;
2246
- const t = [...e.prosemirrorPlugins ?? []], o = [];
2247
- return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((i = e.inputRules) != null && i.length) ? { plugins: t, inputRules: o } : (this.extensionPlugins.set(e, t), (r = e.inputRules) != null && r.length && o.push(
2269
+ var s, r, i;
2270
+ const t = [...e.prosemirrorPlugins ?? []], n = [];
2271
+ 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), (i = e.inputRules) != null && i.length && n.push(
2248
2272
  ...e.inputRules.map((c) => new Dt(c.find, (a, l, d, u) => {
2249
2273
  const p = c.replace({
2250
2274
  match: l,
@@ -2255,8 +2279,8 @@ class cn {
2255
2279
  const m = this.editor.getTextCursorPosition();
2256
2280
  if (this.editor.schema.blockSchema[m.block.type].content !== "inline")
2257
2281
  return null;
2258
- const f = H(a.tr), k = a.tr.deleteRange(d, u);
2259
- return et(k, f.bnBlock.beforePos, p), k;
2282
+ const f = $(a.tr), k = a.tr.deleteRange(d, u);
2283
+ return tt(k, f.bnBlock.beforePos, p), k;
2260
2284
  }
2261
2285
  return null;
2262
2286
  }))
@@ -2269,7 +2293,7 @@ class cn {
2269
2293
  ])
2270
2294
  )
2271
2295
  )
2272
- ), { plugins: t, inputRules: o });
2296
+ ), { plugins: t, inputRules: n });
2273
2297
  }
2274
2298
  /**
2275
2299
  * Get all extensions
@@ -2281,7 +2305,7 @@ class cn {
2281
2305
  }
2282
2306
  getExtension(e) {
2283
2307
  if (typeof e == "string") {
2284
- const t = this.extensions.find((o) => o.key === e);
2308
+ const t = this.extensions.find((n) => n.key === e);
2285
2309
  return t || void 0;
2286
2310
  } else if (typeof e == "function") {
2287
2311
  const t = this.extensionFactories.get(e);
@@ -2296,58 +2320,76 @@ class cn {
2296
2320
  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;
2297
2321
  }
2298
2322
  }
2299
- function ln(n) {
2300
- const e = B(n);
2301
- if (n.selection.empty || "node" in n.selection)
2323
+ function un(o, e) {
2324
+ let { $from: t, $to: n } = e;
2325
+ if (t.pos > t.start() && t.pos < o.content.size) {
2326
+ const s = o.textBetween(t.pos, t.pos + 1);
2327
+ if (/^[\w\p{P}]$/u.test(s)) {
2328
+ const i = o.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
2329
+ i && (t = o.resolve(t.pos - i[0].length));
2330
+ }
2331
+ }
2332
+ if (n.pos < n.end() && n.pos > 0) {
2333
+ const s = o.textBetween(n.pos - 1, n.pos);
2334
+ if (/^[\w\p{P}]$/u.test(s)) {
2335
+ const i = o.textBetween(n.pos, n.end()).match(/^[\w\p{P}]+/u);
2336
+ i && (n = o.resolve(n.pos + i[0].length));
2337
+ }
2338
+ }
2339
+ return { $from: t, $to: n, from: t.pos, to: n.pos };
2340
+ }
2341
+ function pn(o) {
2342
+ const e = C(o);
2343
+ if (o.selection.empty || "node" in o.selection)
2302
2344
  return;
2303
- const t = n.doc.resolve(
2304
- _(n.doc, n.selection.from).posBeforeNode
2305
- ), o = n.doc.resolve(
2306
- _(n.doc, n.selection.to).posBeforeNode
2345
+ const t = o.doc.resolve(
2346
+ _(o.doc, o.selection.from).posBeforeNode
2347
+ ), n = o.doc.resolve(
2348
+ _(o.doc, o.selection.to).posBeforeNode
2307
2349
  ), s = (l, d) => {
2308
- const u = t.posAtIndex(l, d), p = n.doc.resolve(u).nodeAfter;
2350
+ const u = t.posAtIndex(l, d), p = o.doc.resolve(u).nodeAfter;
2309
2351
  if (!p)
2310
2352
  throw new Error(
2311
2353
  `Error getting selection - node not found at position ${u}`
2312
2354
  );
2313
2355
  return b(p, e);
2314
- }, i = [], r = t.sharedDepth(o.pos), c = t.index(r), a = o.index(r);
2315
- if (t.depth > r) {
2316
- i.push(b(t.nodeAfter, e));
2317
- for (let l = t.depth; l > r; l--)
2356
+ }, r = [], i = t.sharedDepth(n.pos), c = t.index(i), a = n.index(i);
2357
+ if (t.depth > i) {
2358
+ r.push(b(t.nodeAfter, e));
2359
+ for (let l = t.depth; l > i; l--)
2318
2360
  if (t.node(l).type.isInGroup("childContainer")) {
2319
2361
  const u = t.index(l) + 1, p = t.node(l).childCount;
2320
2362
  for (let m = u; m < p; m++)
2321
- i.push(s(m, l));
2363
+ r.push(s(m, l));
2322
2364
  }
2323
2365
  } else
2324
- i.push(s(c, r));
2366
+ r.push(s(c, i));
2325
2367
  for (let l = c + 1; l <= a; l++)
2326
- i.push(s(l, r));
2327
- if (i.length === 0)
2368
+ r.push(s(l, i));
2369
+ if (r.length === 0)
2328
2370
  throw new Error(
2329
- `Error getting selection - selection doesn't span any blocks (${n.selection})`
2371
+ `Error getting selection - selection doesn't span any blocks (${o.selection})`
2330
2372
  );
2331
2373
  return {
2332
- blocks: i
2374
+ blocks: r
2333
2375
  };
2334
2376
  }
2335
- function dn(n, e, t) {
2336
- const o = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, i = B(n), r = ke(i);
2337
- if (o === s)
2377
+ function fn(o, e, t) {
2378
+ const n = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r = C(o), i = ke(r);
2379
+ if (n === s)
2338
2380
  throw new Error(
2339
- `Attempting to set selection with the same anchor and head blocks (id ${o})`
2381
+ `Attempting to set selection with the same anchor and head blocks (id ${n})`
2340
2382
  );
2341
- const c = E(o, n.doc);
2383
+ const c = x(n, o.doc);
2342
2384
  if (!c)
2343
- throw new Error(`Block with ID ${o} not found`);
2344
- const a = E(s, n.doc);
2385
+ throw new Error(`Block with ID ${n} not found`);
2386
+ const a = x(s, o.doc);
2345
2387
  if (!a)
2346
2388
  throw new Error(`Block with ID ${s} not found`);
2347
- const l = z(c), d = z(a), u = r.blockSchema[l.blockNoteType], p = r.blockSchema[d.blockNoteType];
2389
+ const l = z(c), d = z(a), u = i.blockSchema[l.blockNoteType], p = i.blockSchema[d.blockNoteType];
2348
2390
  if (!l.isBlockContainer || u.content === "none")
2349
2391
  throw new Error(
2350
- `Attempting to set selection anchor in block without content (id ${o})`
2392
+ `Attempting to set selection anchor in block without content (id ${n})`
2351
2393
  );
2352
2394
  if (!d.isBlockContainer || p.content === "none")
2353
2395
  throw new Error(
@@ -2364,76 +2406,76 @@ function dn(n, e, t) {
2364
2406
  k.height - 1,
2365
2407
  k.width - 1,
2366
2408
  d.blockContent.node
2367
- ) + 1, y = n.doc.resolve(g).nodeAfter.nodeSize;
2409
+ ) + 1, y = o.doc.resolve(g).nodeAfter.nodeSize;
2368
2410
  f = g + y - 2;
2369
2411
  } else
2370
2412
  f = d.blockContent.afterPos - 1;
2371
- n.setSelection(M.create(n.doc, m, f));
2372
- }
2373
- function un(n) {
2374
- const e = B(n);
2375
- let t = n.selection.$from, o = n.selection.$to;
2376
- for (; o.parentOffset >= o.parent.nodeSize - 2 && o.depth > 0; )
2377
- o = n.doc.resolve(o.pos + 1);
2378
- for (; o.parentOffset === 0 && o.depth > 0; )
2379
- o = n.doc.resolve(o.pos - 1);
2380
- for (; t.parentOffset === 0 && t.depth > 0; )
2381
- t = n.doc.resolve(t.pos - 1);
2382
- for (; t.parentOffset >= t.parent.nodeSize - 2 && t.depth > 0; )
2383
- t = n.doc.resolve(t.pos + 1);
2384
- const s = Re(
2385
- n.doc.slice(t.pos, o.pos, !0),
2386
- e
2413
+ o.setSelection(M.create(o.doc, m, f));
2414
+ }
2415
+ function hn(o, e = !1) {
2416
+ const t = C(o), n = e ? un(o.doc, o.selection) : o.selection;
2417
+ let s = n.$from, r = n.$to;
2418
+ for (; r.parentOffset >= r.parent.nodeSize - 2 && r.depth > 0; )
2419
+ r = o.doc.resolve(r.pos + 1);
2420
+ for (; r.parentOffset === 0 && r.depth > 0; )
2421
+ r = o.doc.resolve(r.pos - 1);
2422
+ for (; s.parentOffset === 0 && s.depth > 0; )
2423
+ s = o.doc.resolve(s.pos - 1);
2424
+ for (; s.parentOffset >= s.parent.nodeSize - 2 && s.depth > 0; )
2425
+ s = o.doc.resolve(s.pos + 1);
2426
+ const i = je(
2427
+ o.doc.slice(s.pos, r.pos, !0),
2428
+ t
2387
2429
  );
2388
2430
  return {
2389
2431
  _meta: {
2390
- startPos: t.pos,
2391
- endPos: o.pos
2432
+ startPos: s.pos,
2433
+ endPos: r.pos
2392
2434
  },
2393
- ...s
2435
+ ...i
2394
2436
  };
2395
2437
  }
2396
- function pn(n) {
2397
- const { bnBlock: e } = H(n), t = B(n.doc), o = n.doc.resolve(e.beforePos), s = o.nodeBefore, i = n.doc.resolve(e.afterPos).nodeAfter;
2398
- let r;
2399
- return o.depth > 1 && (r = o.node(), r.type.isInGroup("bnBlock") || (r = o.node(o.depth - 1))), {
2438
+ function mn(o) {
2439
+ const { bnBlock: e } = $(o), t = C(o.doc), n = o.doc.resolve(e.beforePos), s = n.nodeBefore, r = o.doc.resolve(e.afterPos).nodeAfter;
2440
+ let i;
2441
+ return n.depth > 1 && (i = n.node(), i.type.isInGroup("bnBlock") || (i = n.node(n.depth - 1))), {
2400
2442
  block: b(e.node, t),
2401
2443
  prevBlock: s === null ? void 0 : b(s, t),
2402
- nextBlock: i === null ? void 0 : b(i, t),
2403
- parentBlock: r === void 0 ? void 0 : b(r, t)
2444
+ nextBlock: r === null ? void 0 : b(r, t),
2445
+ parentBlock: i === void 0 ? void 0 : b(i, t)
2404
2446
  };
2405
2447
  }
2406
- function _e(n, e, t = "start") {
2407
- const o = typeof e == "string" ? e : e.id, s = B(n.doc), i = ke(s), r = E(o, n.doc);
2408
- if (!r)
2409
- throw new Error(`Block with ID ${o} not found`);
2410
- const c = z(r), a = i.blockSchema[c.blockNoteType].content;
2448
+ function De(o, e, t = "start") {
2449
+ const n = typeof e == "string" ? e : e.id, s = C(o.doc), r = ke(s), i = x(n, o.doc);
2450
+ if (!i)
2451
+ throw new Error(`Block with ID ${n} not found`);
2452
+ const c = z(i), a = r.blockSchema[c.blockNoteType].content;
2411
2453
  if (c.isBlockContainer) {
2412
2454
  const l = c.blockContent;
2413
2455
  if (a === "none") {
2414
- n.setSelection(L.create(n.doc, l.beforePos));
2456
+ o.setSelection(L.create(o.doc, l.beforePos));
2415
2457
  return;
2416
2458
  }
2417
2459
  if (a === "inline")
2418
- t === "start" ? n.setSelection(
2419
- M.create(n.doc, l.beforePos + 1)
2420
- ) : n.setSelection(
2421
- M.create(n.doc, l.afterPos - 1)
2460
+ t === "start" ? o.setSelection(
2461
+ M.create(o.doc, l.beforePos + 1)
2462
+ ) : o.setSelection(
2463
+ M.create(o.doc, l.afterPos - 1)
2422
2464
  );
2423
2465
  else if (a === "table")
2424
- t === "start" ? n.setSelection(
2425
- M.create(n.doc, l.beforePos + 4)
2426
- ) : n.setSelection(
2427
- M.create(n.doc, l.afterPos - 4)
2466
+ t === "start" ? o.setSelection(
2467
+ M.create(o.doc, l.beforePos + 4)
2468
+ ) : o.setSelection(
2469
+ M.create(o.doc, l.afterPos - 4)
2428
2470
  );
2429
2471
  else
2430
2472
  throw new F(a);
2431
2473
  } else {
2432
2474
  const l = t === "start" ? c.childContainer.node.firstChild : c.childContainer.node.lastChild;
2433
- _e(n, l.attrs.id, t);
2475
+ De(o, l.attrs.id, t);
2434
2476
  }
2435
2477
  }
2436
- class fn {
2478
+ class kn {
2437
2479
  constructor(e) {
2438
2480
  this.editor = e;
2439
2481
  }
@@ -2444,7 +2486,7 @@ class fn {
2444
2486
  * If the selection starts / ends halfway through a block, the returned data will contain the entire block.
2445
2487
  */
2446
2488
  getSelection() {
2447
- return this.editor.transact((e) => ln(e));
2489
+ return this.editor.transact((e) => pn(e));
2448
2490
  }
2449
2491
  /**
2450
2492
  * Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
@@ -2453,8 +2495,8 @@ class fn {
2453
2495
  * If the selection starts / ends halfway through a block, the returned block will be
2454
2496
  * only the part of the block that is included in the selection.
2455
2497
  */
2456
- getSelectionCutBlocks() {
2457
- return this.editor.transact((e) => un(e));
2498
+ getSelectionCutBlocks(e = !1) {
2499
+ return this.editor.transact((t) => hn(t, e));
2458
2500
  }
2459
2501
  /**
2460
2502
  * Sets the selection to a range of blocks.
@@ -2462,14 +2504,14 @@ class fn {
2462
2504
  * @param endBlock The identifier of the block that should be the end of the selection.
2463
2505
  */
2464
2506
  setSelection(e, t) {
2465
- return this.editor.transact((o) => dn(o, e, t));
2507
+ return this.editor.transact((n) => fn(n, e, t));
2466
2508
  }
2467
2509
  /**
2468
2510
  * Gets a snapshot of the current text cursor position.
2469
2511
  * @returns A snapshot of the current text cursor position.
2470
2512
  */
2471
2513
  getTextCursorPosition() {
2472
- return this.editor.transact((e) => pn(e));
2514
+ return this.editor.transact((e) => mn(e));
2473
2515
  }
2474
2516
  /**
2475
2517
  * Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could
@@ -2479,7 +2521,7 @@ class fn {
2479
2521
  */
2480
2522
  setTextCursorPosition(e, t = "start") {
2481
2523
  return this.editor.transact(
2482
- (o) => _e(o, e, t)
2524
+ (n) => De(n, e, t)
2483
2525
  );
2484
2526
  }
2485
2527
  /**
@@ -2488,20 +2530,20 @@ class fn {
2488
2530
  getSelectionBoundingBox() {
2489
2531
  if (!this.editor.prosemirrorView)
2490
2532
  return;
2491
- const { selection: e } = this.editor.prosemirrorState, { ranges: t } = e, o = Math.min(...t.map((i) => i.$from.pos)), s = Math.max(...t.map((i) => i.$to.pos));
2533
+ 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));
2492
2534
  if (Mt(e)) {
2493
- const i = this.editor.prosemirrorView.nodeDOM(o);
2494
- if (i)
2495
- return i.getBoundingClientRect();
2535
+ const r = this.editor.prosemirrorView.nodeDOM(n);
2536
+ if (r)
2537
+ return r.getBoundingClientRect();
2496
2538
  }
2497
2539
  return wt(
2498
2540
  this.editor.prosemirrorView,
2499
- o,
2541
+ n,
2500
2542
  s
2501
2543
  ).toJSON();
2502
2544
  }
2503
2545
  }
2504
- class hn {
2546
+ class gn {
2505
2547
  constructor(e) {
2506
2548
  /**
2507
2549
  * Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
@@ -2547,8 +2589,8 @@ class hn {
2547
2589
  );
2548
2590
  if (this.isInCan)
2549
2591
  return this.canExec(e);
2550
- const t = this.prosemirrorState, o = this.prosemirrorView;
2551
- return e(t, (i) => this.prosemirrorView.dispatch(i), o);
2592
+ const t = this.prosemirrorState, n = this.prosemirrorView;
2593
+ return e(t, (r) => this.prosemirrorView.dispatch(r), n);
2552
2594
  }
2553
2595
  /**
2554
2596
  * Check if a command can be executed. A command should return `false` if it is not valid in the current state.
@@ -2567,8 +2609,8 @@ class hn {
2567
2609
  throw new Error(
2568
2610
  "`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call"
2569
2611
  );
2570
- const t = this.prosemirrorState, o = this.prosemirrorView;
2571
- return e(t, void 0, o);
2612
+ const t = this.prosemirrorState, n = this.prosemirrorView;
2613
+ return e(t, void 0, n);
2572
2614
  }
2573
2615
  /**
2574
2616
  * Execute a function within a "blocknote transaction".
@@ -2594,9 +2636,9 @@ class hn {
2594
2636
  return e(this.activeTransaction);
2595
2637
  try {
2596
2638
  this.activeTransaction = this.editor._tiptapEditor.state.tr;
2597
- const t = e(this.activeTransaction), o = this.activeTransaction;
2598
- return this.activeTransaction = null, o && // Only dispatch if the transaction was actually modified in some way
2599
- (o.docChanged || o.selectionSet || o.scrolledIntoView || o.storedMarksSet || !o.isGeneric) && this.prosemirrorView.dispatch(o), t;
2639
+ const t = e(this.activeTransaction), n = this.activeTransaction;
2640
+ return this.activeTransaction = null, n && // Only dispatch if the transaction was actually modified in some way
2641
+ (n.docChanged || n.selectionSet || n.scrolledIntoView || n.storedMarksSet || !n.isGeneric) && this.prosemirrorView.dispatch(n), t;
2600
2642
  } finally {
2601
2643
  this.activeTransaction = null;
2602
2644
  }
@@ -2677,17 +2719,17 @@ class hn {
2677
2719
  throw new Error("No redo plugin found");
2678
2720
  }
2679
2721
  }
2680
- function mn(n, e, t, o = { updateSelection: !0 }) {
2681
- let { from: s, to: i } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, r = !0, c = !0, a = "";
2722
+ function bn(o, e, t, n = { updateSelection: !0 }) {
2723
+ let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, i = !0, c = !0, a = "";
2682
2724
  if (t.forEach((l) => {
2683
- l.check(), r && l.isText && l.marks.length === 0 ? a += l.text : r = !1, c = c ? l.isBlock : !1;
2684
- }), s === i && c) {
2685
- const { parent: l } = n.doc.resolve(s);
2686
- l.isTextblock && !l.type.spec.code && !l.childCount && (s -= 1, i += 1);
2725
+ l.check(), i && l.isText && l.marks.length === 0 ? a += l.text : i = !1, c = c ? l.isBlock : !1;
2726
+ }), s === r && c) {
2727
+ const { parent: l } = o.doc.resolve(s);
2728
+ l.isTextblock && !l.type.spec.code && !l.childCount && (s -= 1, r += 1);
2687
2729
  }
2688
- return r ? n.insertText(a, s, i) : n.replaceWith(s, i, t), o.updateSelection && Tt(n, n.steps.length - 1, -1), !0;
2730
+ return i ? o.insertText(a, s, r) : o.replaceWith(s, r, t), n.updateSelection && Tt(o, o.steps.length - 1, -1), !0;
2689
2731
  }
2690
- class kn {
2732
+ class yn {
2691
2733
  constructor(e) {
2692
2734
  this.editor = e;
2693
2735
  }
@@ -2697,15 +2739,15 @@ class kn {
2697
2739
  * @param content can be a string, or array of partial inline content elements
2698
2740
  */
2699
2741
  insertInlineContent(e, { updateSelection: t = !1 } = {}) {
2700
- const o = O(e, this.editor.pmSchema);
2742
+ const n = O(e, this.editor.pmSchema);
2701
2743
  this.editor.transact((s) => {
2702
- mn(
2744
+ bn(
2703
2745
  s,
2704
2746
  {
2705
2747
  from: s.selection.from,
2706
2748
  to: s.selection.to
2707
2749
  },
2708
- o,
2750
+ n,
2709
2751
  {
2710
2752
  updateSelection: t
2711
2753
  }
@@ -2717,16 +2759,16 @@ class kn {
2717
2759
  */
2718
2760
  getActiveStyles() {
2719
2761
  return this.editor.transact((e) => {
2720
- const t = {}, o = e.selection.$to.marks();
2721
- for (const s of o) {
2722
- const i = this.editor.schema.styleSchema[s.type.name];
2723
- if (!i) {
2762
+ const t = {}, n = e.selection.$to.marks();
2763
+ for (const s of n) {
2764
+ const r = this.editor.schema.styleSchema[s.type.name];
2765
+ if (!r) {
2724
2766
  // Links are not considered styles in blocknote
2725
2767
  s.type.name !== "link" && // "blocknoteIgnore" tagged marks (such as comments) are also not considered BlockNote "styles"
2726
2768
  !s.type.spec.blocknoteIgnore && console.warn("mark not found in styleschema", s.type.name);
2727
2769
  continue;
2728
2770
  }
2729
- i.propSchema === "boolean" ? t[i.type] = !0 : t[i.type] = s.attrs.stringValue;
2771
+ r.propSchema === "boolean" ? t[r.type] = !0 : t[r.type] = s.attrs.stringValue;
2730
2772
  }
2731
2773
  return t;
2732
2774
  });
@@ -2736,7 +2778,7 @@ class kn {
2736
2778
  * @param styles The styles to add.
2737
2779
  */
2738
2780
  addStyles(e) {
2739
- for (const [t, o] of Object.entries(e)) {
2781
+ for (const [t, n] of Object.entries(e)) {
2740
2782
  const s = this.editor.schema.styleSchema[t];
2741
2783
  if (!s)
2742
2784
  throw new Error(`style ${t} not found in styleSchema`);
@@ -2744,7 +2786,7 @@ class kn {
2744
2786
  this.editor._tiptapEditor.commands.setMark(t);
2745
2787
  else if (s.propSchema === "string")
2746
2788
  this.editor._tiptapEditor.commands.setMark(t, {
2747
- stringValue: o
2789
+ stringValue: n
2748
2790
  });
2749
2791
  else
2750
2792
  throw new F(s.propSchema);
@@ -2763,7 +2805,7 @@ class kn {
2763
2805
  * @param styles The styles to toggle.
2764
2806
  */
2765
2807
  toggleStyles(e) {
2766
- for (const [t, o] of Object.entries(e)) {
2808
+ for (const [t, n] of Object.entries(e)) {
2767
2809
  const s = this.editor.schema.styleSchema[t];
2768
2810
  if (!s)
2769
2811
  throw new Error(`style ${t} not found in styleSchema`);
@@ -2771,7 +2813,7 @@ class kn {
2771
2813
  this.editor._tiptapEditor.commands.toggleMark(t);
2772
2814
  else if (s.propSchema === "string")
2773
2815
  this.editor._tiptapEditor.commands.toggleMark(t, {
2774
- stringValue: o
2816
+ stringValue: n
2775
2817
  });
2776
2818
  else
2777
2819
  throw new F(s.propSchema);
@@ -2797,80 +2839,80 @@ class kn {
2797
2839
  createLink(e, t) {
2798
2840
  if (e === "")
2799
2841
  return;
2800
- const o = this.editor.pmSchema.mark("link", { href: e });
2842
+ const n = this.editor.pmSchema.mark("link", { href: e });
2801
2843
  this.editor.transact((s) => {
2802
- const { from: i, to: r } = s.selection;
2803
- t ? s.insertText(t, i, r).addMark(i, i + t.length, o) : s.setSelection(jt.create(s.doc, r)).addMark(
2804
- i,
2844
+ const { from: r, to: i } = s.selection;
2845
+ t ? s.insertText(t, r, i).addMark(r, r + t.length, n) : s.setSelection(Wt.create(s.doc, i)).addMark(
2805
2846
  r,
2806
- o
2847
+ i,
2848
+ n
2807
2849
  );
2808
2850
  });
2809
2851
  }
2810
2852
  }
2811
- function gn(n, e) {
2853
+ function Sn(o, e) {
2812
2854
  const t = [];
2813
- return n.forEach((o, s, i) => {
2814
- i !== e && t.push(o);
2855
+ return o.forEach((n, s, r) => {
2856
+ r !== e && t.push(n);
2815
2857
  }), Z.from(t);
2816
2858
  }
2817
- function bn(n, e) {
2859
+ function Bn(o, e) {
2818
2860
  const t = [];
2819
- for (let o = 0; o < n.childCount; o++)
2820
- if (n.child(o).type.name === "tableRow")
2861
+ for (let n = 0; n < o.childCount; n++)
2862
+ if (o.child(n).type.name === "tableRow")
2821
2863
  if (t.length > 0 && t[t.length - 1].type.name === "table") {
2822
- const s = t[t.length - 1], i = s.copy(s.content.addToEnd(n.child(o)));
2823
- t[t.length - 1] = i;
2864
+ const s = t[t.length - 1], r = s.copy(s.content.addToEnd(o.child(n)));
2865
+ t[t.length - 1] = r;
2824
2866
  } else {
2825
2867
  const s = e.nodes.table.createChecked(
2826
2868
  void 0,
2827
- n.child(o)
2869
+ o.child(n)
2828
2870
  );
2829
2871
  t.push(s);
2830
2872
  }
2831
2873
  else
2832
- t.push(n.child(o));
2833
- return n = Z.from(t), n;
2834
- }
2835
- function yn(n, e) {
2836
- let t = Z.from(n.content);
2837
- if (t = bn(t, e.state.schema), !Sn(t, e))
2838
- return new ne(t, n.openStart, n.openEnd);
2839
- for (let o = 0; o < t.childCount; o++)
2840
- if (t.child(o).type.spec.group === "blockContent") {
2841
- const s = [t.child(o)];
2842
- if (o + 1 < t.childCount && t.child(o + 1).type.name === "blockGroup") {
2843
- const r = t.child(o + 1).child(0).child(0);
2844
- (r.type.name === "bulletListItem" || r.type.name === "numberedListItem" || r.type.name === "checkListItem") && (s.push(t.child(o + 1)), t = gn(t, o + 1));
2874
+ t.push(o.child(n));
2875
+ return o = Z.from(t), o;
2876
+ }
2877
+ function Cn(o, e) {
2878
+ let t = Z.from(o.content);
2879
+ if (t = Bn(t, e.state.schema), !xn(t, e))
2880
+ return new ne(t, o.openStart, o.openEnd);
2881
+ for (let n = 0; n < t.childCount; n++)
2882
+ if (t.child(n).type.spec.group === "blockContent") {
2883
+ const s = [t.child(n)];
2884
+ if (n + 1 < t.childCount && t.child(n + 1).type.name === "blockGroup") {
2885
+ const i = t.child(n + 1).child(0).child(0);
2886
+ (i.type.name === "bulletListItem" || i.type.name === "numberedListItem" || i.type.name === "checkListItem") && (s.push(t.child(n + 1)), t = Sn(t, n + 1));
2845
2887
  }
2846
- const i = e.state.schema.nodes.blockContainer.createChecked(
2888
+ const r = e.state.schema.nodes.blockContainer.createChecked(
2847
2889
  void 0,
2848
2890
  s
2849
2891
  );
2850
- t = t.replaceChild(o, i);
2892
+ t = t.replaceChild(n, r);
2851
2893
  }
2852
- return new ne(t, n.openStart, n.openEnd);
2894
+ return new ne(t, o.openStart, o.openEnd);
2853
2895
  }
2854
- function Sn(n, e) {
2855
- var i, r;
2856
- const t = n.childCount === 1, o = ((i = n.firstChild) == null ? void 0 : i.type.spec.content) === "inline*", s = ((r = n.firstChild) == null ? void 0 : r.type.spec.content) === "tableRow+";
2896
+ function xn(o, e) {
2897
+ var r, i;
2898
+ const t = o.childCount === 1, n = ((r = o.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((i = o.firstChild) == null ? void 0 : i.type.spec.content) === "tableRow+";
2857
2899
  if (t) {
2858
- if (o)
2900
+ if (n)
2859
2901
  return !1;
2860
2902
  if (s) {
2861
- const c = S(e.state);
2903
+ const c = B(e.state);
2862
2904
  if (c.isBlockContainer)
2863
2905
  return !(c.blockContent.node.type.spec.content === "tableRow+");
2864
2906
  }
2865
2907
  }
2866
2908
  return !0;
2867
2909
  }
2868
- const Bn = {
2910
+ const En = {
2869
2911
  enableInputRules: !0,
2870
2912
  enablePasteRules: !0,
2871
2913
  enableCoreExtensions: !1
2872
2914
  };
2873
- class De extends ye {
2915
+ class Le extends Se {
2874
2916
  constructor(t) {
2875
2917
  var l, d, u, p, m, f, k, g, y, T;
2876
2918
  super();
@@ -2960,23 +3002,23 @@ class De extends ye {
2960
3002
  headers: ((p = t == null ? void 0 : t.tables) == null ? void 0 : p.headers) ?? !1
2961
3003
  }
2962
3004
  };
2963
- const o = {
3005
+ const n = {
2964
3006
  defaultStyles: !0,
2965
- schema: t.schema || Et.create(),
3007
+ schema: t.schema || xt.create(),
2966
3008
  ...t,
2967
3009
  placeholders: {
2968
3010
  ...this.dictionary.placeholders,
2969
3011
  ...t.placeholders
2970
3012
  }
2971
3013
  };
2972
- if (this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, o.uploadFile) {
2973
- const C = o.uploadFile;
3014
+ if (this.schema = n.schema, this.blockImplementations = n.schema.blockSpecs, this.inlineContentImplementations = n.schema.inlineContentSpecs, this.styleImplementations = n.schema.styleSpecs, n.uploadFile) {
3015
+ const S = n.uploadFile;
2974
3016
  this.uploadFile = async (P, w) => {
2975
3017
  this.onUploadStartCallbacks.forEach(
2976
3018
  (v) => v.apply(this, [w])
2977
3019
  );
2978
3020
  try {
2979
- return await C(P, w);
3021
+ return await S(P, w);
2980
3022
  } finally {
2981
3023
  this.onUploadEndCallbacks.forEach(
2982
3024
  (v) => v.apply(this, [w])
@@ -2984,37 +3026,37 @@ class De extends ye {
2984
3026
  }
2985
3027
  };
2986
3028
  }
2987
- this.resolveFileUrl = o.resolveFileUrl, this._eventManager = new po(this), this._extensionManager = new cn(this, o);
2988
- const s = this._extensionManager.getTiptapExtensions(), i = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
2989
- i && o.initialContent && console.warn(
3029
+ this.resolveFileUrl = n.resolveFileUrl, this._eventManager = new fo(this), this._extensionManager = new dn(this, n);
3030
+ const s = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
3031
+ r && n.initialContent && console.warn(
2990
3032
  "When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
2991
3033
  );
2992
- const r = {
2993
- ...Bn,
2994
- ...o._tiptapOptions,
3034
+ const i = {
3035
+ ...En,
3036
+ ...n._tiptapOptions,
2995
3037
  element: null,
2996
- autofocus: o.autofocus ?? !1,
3038
+ autofocus: n.autofocus ?? !1,
2997
3039
  extensions: s,
2998
3040
  editorProps: {
2999
- ...(m = o._tiptapOptions) == null ? void 0 : m.editorProps,
3041
+ ...(m = n._tiptapOptions) == null ? void 0 : m.editorProps,
3000
3042
  attributes: {
3001
3043
  // As of TipTap v2.5.0 the tabIndex is removed when the editor is not
3002
3044
  // editable, so you can't focus it. We want to revert this as we have
3003
3045
  // UI behaviour that relies on it.
3004
3046
  tabIndex: "0",
3005
- ...(k = (f = o._tiptapOptions) == null ? void 0 : f.editorProps) == null ? void 0 : k.attributes,
3006
- ...(g = o.domAttributes) == null ? void 0 : g.editor,
3047
+ ...(k = (f = n._tiptapOptions) == null ? void 0 : f.editorProps) == null ? void 0 : k.attributes,
3048
+ ...(g = n.domAttributes) == null ? void 0 : g.editor,
3007
3049
  class: Q(
3008
3050
  "bn-editor",
3009
- o.defaultStyles ? "bn-default-styles" : "",
3010
- ((T = (y = o.domAttributes) == null ? void 0 : y.editor) == null ? void 0 : T.class) || ""
3051
+ n.defaultStyles ? "bn-default-styles" : "",
3052
+ ((T = (y = n.domAttributes) == null ? void 0 : y.editor) == null ? void 0 : T.class) || ""
3011
3053
  )
3012
3054
  },
3013
- transformPasted: yn
3055
+ transformPasted: Cn
3014
3056
  }
3015
3057
  };
3016
3058
  try {
3017
- const C = o.initialContent || (i ? [
3059
+ const S = n.initialContent || (r ? [
3018
3060
  {
3019
3061
  type: "paragraph",
3020
3062
  id: "initialBlockId"
@@ -3025,12 +3067,12 @@ class De extends ye {
3025
3067
  id: me.options.generateID()
3026
3068
  }
3027
3069
  ]);
3028
- if (!Array.isArray(C) || C.length === 0)
3070
+ if (!Array.isArray(S) || S.length === 0)
3029
3071
  throw new Error(
3030
- "initialContent must be a non-empty array of blocks, received: " + C
3072
+ "initialContent must be a non-empty array of blocks, received: " + S
3031
3073
  );
3032
- const P = Pt(r.extensions), w = C.map(
3033
- (Le) => Y(Le, P, this.schema.styleSchema).toJSON()
3074
+ const P = Pt(i.extensions), w = S.map(
3075
+ (Ne) => q(Ne, P, this.schema.styleSchema).toJSON()
3034
3076
  ), v = vt(
3035
3077
  {
3036
3078
  type: "doc",
@@ -3042,29 +3084,29 @@ class De extends ye {
3042
3084
  ]
3043
3085
  },
3044
3086
  P,
3045
- r.parseOptions
3087
+ i.parseOptions
3046
3088
  );
3047
3089
  this._tiptapEditor = new It({
3048
- ...r,
3090
+ ...i,
3049
3091
  content: v.toJSON()
3050
3092
  }), this.pmSchema = this._tiptapEditor.schema;
3051
- } catch (C) {
3093
+ } catch (S) {
3052
3094
  throw new Error(
3053
3095
  "Error creating document from blocks passed as `initialContent`",
3054
- { cause: C }
3096
+ { cause: S }
3055
3097
  );
3056
3098
  }
3057
3099
  let c;
3058
3100
  const a = this.pmSchema.nodes.doc.createAndFill;
3059
- this.pmSchema.nodes.doc.createAndFill = (...C) => {
3101
+ this.pmSchema.nodes.doc.createAndFill = (...S) => {
3060
3102
  if (c)
3061
3103
  return c;
3062
- const P = a.apply(this.pmSchema.nodes.doc, C), w = JSON.parse(JSON.stringify(P.toJSON()));
3104
+ const P = a.apply(this.pmSchema.nodes.doc, S), w = JSON.parse(JSON.stringify(P.toJSON()));
3063
3105
  return w.content[0].content[0].attrs.id = "initialBlockId", c = He.fromJSON(this.pmSchema, w), c;
3064
- }, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new uo(this), this._exportManager = new Co(this), this._selectionManager = new fn(this), this._stateManager = new hn(this), this._styleManager = new kn(this), this.emit("create");
3106
+ }, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new po(this), this._exportManager = new xo(this), this._selectionManager = new kn(this), this._stateManager = new gn(this), this._styleManager = new yn(this), this.emit("create");
3065
3107
  }
3066
3108
  static create(t) {
3067
- return new De(t ?? {});
3109
+ return new Le(t ?? {});
3068
3110
  }
3069
3111
  /**
3070
3112
  * BlockNote extensions that are added to the editor, keyed by the extension key
@@ -3161,19 +3203,20 @@ class De extends ye {
3161
3203
  * Blur the editor
3162
3204
  */
3163
3205
  blur() {
3164
- this.headless || this.prosemirrorView.dom.blur();
3206
+ var t;
3207
+ this.headless || (t = this.domElement) == null || t.blur();
3165
3208
  }
3166
3209
  // TODO move to extension
3167
3210
  onUploadStart(t) {
3168
3211
  return this.onUploadStartCallbacks.push(t), () => {
3169
- const o = this.onUploadStartCallbacks.indexOf(t);
3170
- o > -1 && this.onUploadStartCallbacks.splice(o, 1);
3212
+ const n = this.onUploadStartCallbacks.indexOf(t);
3213
+ n > -1 && this.onUploadStartCallbacks.splice(n, 1);
3171
3214
  };
3172
3215
  }
3173
3216
  onUploadEnd(t) {
3174
3217
  return this.onUploadEndCallbacks.push(t), () => {
3175
- const o = this.onUploadEndCallbacks.indexOf(t);
3176
- o > -1 && this.onUploadEndCallbacks.splice(o, 1);
3218
+ const n = this.onUploadEndCallbacks.indexOf(t);
3219
+ n > -1 && this.onUploadEndCallbacks.splice(n, 1);
3177
3220
  };
3178
3221
  }
3179
3222
  /**
@@ -3237,8 +3280,8 @@ class De extends ye {
3237
3280
  * @param callback The callback to execute for each block. Returning `false` stops the traversal.
3238
3281
  * @param reverse Whether the blocks should be traversed in reverse order.
3239
3282
  */
3240
- forEachBlock(t, o = !1) {
3241
- this._blockManager.forEachBlock(t, o);
3283
+ forEachBlock(t, n = !1) {
3284
+ this._blockManager.forEachBlock(t, n);
3242
3285
  }
3243
3286
  /**
3244
3287
  * Executes a callback whenever the editor's contents change.
@@ -3258,6 +3301,14 @@ class De extends ye {
3258
3301
  onEditorSelectionChange(t) {
3259
3302
  this._tiptapEditor.on("selectionUpdate", t);
3260
3303
  }
3304
+ /**
3305
+ * Executes a callback before any change is applied to the editor, allowing you to cancel the change.
3306
+ * @param callback The callback to execute.
3307
+ * @returns A function to remove the callback.
3308
+ */
3309
+ onBeforeChange(t) {
3310
+ return this._extensionManager.getExtension(ye).subscribe(t);
3311
+ }
3261
3312
  /**
3262
3313
  * Gets a snapshot of the current text cursor position.
3263
3314
  * @returns A snapshot of the current text cursor position.
@@ -3271,8 +3322,8 @@ class De extends ye {
3271
3322
  * @param targetBlock The identifier of an existing block that the text cursor should be moved to.
3272
3323
  * @param placement Whether the text cursor should be placed at the start or end of the block.
3273
3324
  */
3274
- setTextCursorPosition(t, o = "start") {
3275
- return this._selectionManager.setTextCursorPosition(t, o);
3325
+ setTextCursorPosition(t, n = "start") {
3326
+ return this._selectionManager.setTextCursorPosition(t, n);
3276
3327
  }
3277
3328
  /**
3278
3329
  * Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
@@ -3290,16 +3341,16 @@ class De extends ye {
3290
3341
  * If the selection starts / ends halfway through a block, the returned block will be
3291
3342
  * only the part of the block that is included in the selection.
3292
3343
  */
3293
- getSelectionCutBlocks() {
3294
- return this._selectionManager.getSelectionCutBlocks();
3344
+ getSelectionCutBlocks(t = !1) {
3345
+ return this._selectionManager.getSelectionCutBlocks(t);
3295
3346
  }
3296
3347
  /**
3297
3348
  * Sets the selection to a range of blocks.
3298
3349
  * @param startBlock The identifier of the block that should be the start of the selection.
3299
3350
  * @param endBlock The identifier of the block that should be the end of the selection.
3300
3351
  */
3301
- setSelection(t, o) {
3302
- return this._selectionManager.setSelection(t, o);
3352
+ setSelection(t, n) {
3353
+ return this._selectionManager.setSelection(t, n);
3303
3354
  }
3304
3355
  /**
3305
3356
  * Checks if the editor is currently editable, or if it's locked.
@@ -3323,10 +3374,10 @@ class De extends ye {
3323
3374
  * @param placement Whether the blocks should be inserted just before, just after, or nested inside the
3324
3375
  * `referenceBlock`.
3325
3376
  */
3326
- insertBlocks(t, o, s = "before") {
3377
+ insertBlocks(t, n, s = "before") {
3327
3378
  return this._blockManager.insertBlocks(
3328
3379
  t,
3329
- o,
3380
+ n,
3330
3381
  s
3331
3382
  );
3332
3383
  }
@@ -3337,8 +3388,8 @@ class De extends ye {
3337
3388
  * @param blockToUpdate The block that should be updated.
3338
3389
  * @param update A partial block which defines how the existing block should be changed.
3339
3390
  */
3340
- updateBlock(t, o) {
3341
- return this._blockManager.updateBlock(t, o);
3391
+ updateBlock(t, n) {
3392
+ return this._blockManager.updateBlock(t, n);
3342
3393
  }
3343
3394
  /**
3344
3395
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
@@ -3354,8 +3405,8 @@ class De extends ye {
3354
3405
  * @param blocksToRemove An array of blocks that should be replaced.
3355
3406
  * @param blocksToInsert An array of partial blocks to replace the old ones with.
3356
3407
  */
3357
- replaceBlocks(t, o) {
3358
- return this._blockManager.replaceBlocks(t, o);
3408
+ replaceBlocks(t, n) {
3409
+ return this._blockManager.replaceBlocks(t, n);
3359
3410
  }
3360
3411
  /**
3361
3412
  * Undo the last action.
@@ -3374,8 +3425,8 @@ class De extends ye {
3374
3425
  *
3375
3426
  * @param content can be a string, or array of partial inline content elements
3376
3427
  */
3377
- insertInlineContent(t, { updateSelection: o = !1 } = {}) {
3378
- this._styleManager.insertInlineContent(t, { updateSelection: o });
3428
+ insertInlineContent(t, { updateSelection: n = !1 } = {}) {
3429
+ this._styleManager.insertInlineContent(t, { updateSelection: n });
3379
3430
  }
3380
3431
  /**
3381
3432
  * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
@@ -3421,8 +3472,8 @@ class De extends ye {
3421
3472
  * @param url The link URL.
3422
3473
  * @param text The text to display the link with.
3423
3474
  */
3424
- createLink(t, o) {
3425
- this._styleManager.createLink(t, o);
3475
+ createLink(t, n) {
3476
+ this._styleManager.createLink(t, n);
3426
3477
  }
3427
3478
  /**
3428
3479
  * Checks if the block containing the text cursor can be nested.
@@ -3521,8 +3572,8 @@ class De extends ye {
3521
3572
  * @param callback The callback to execute.
3522
3573
  * @returns A function to remove the callback.
3523
3574
  */
3524
- onChange(t, o) {
3525
- return this._eventManager.onChange(t, o);
3575
+ onChange(t, n) {
3576
+ return this._eventManager.onChange(t, n);
3526
3577
  }
3527
3578
  /**
3528
3579
  * A callback function that runs whenever the text cursor position or selection changes.
@@ -3530,10 +3581,10 @@ class De extends ye {
3530
3581
  * @param callback The callback to execute.
3531
3582
  * @returns A function to remove the callback.
3532
3583
  */
3533
- onSelectionChange(t, o) {
3584
+ onSelectionChange(t, n) {
3534
3585
  return this._eventManager.onSelectionChange(
3535
3586
  t,
3536
- o
3587
+ n
3537
3588
  );
3538
3589
  }
3539
3590
  /**
@@ -3574,8 +3625,8 @@ class De extends ye {
3574
3625
  * @param html The HTML to paste.
3575
3626
  * @param raw Whether to paste the HTML as is, or to convert it to BlockNote HTML.
3576
3627
  */
3577
- pasteHTML(t, o = !1) {
3578
- this._exportManager.pasteHTML(t, o);
3628
+ pasteHTML(t, n = !1) {
3629
+ this._exportManager.pasteHTML(t, n);
3579
3630
  }
3580
3631
  /**
3581
3632
  * Paste text into the editor. Defaults to interpreting text as markdown.
@@ -3592,19 +3643,19 @@ class De extends ye {
3592
3643
  return this._exportManager.pasteMarkdown(t);
3593
3644
  }
3594
3645
  }
3595
- class Yn {
3596
- constructor(e, t, o) {
3597
- this.mappings = t, this.options = o;
3646
+ class Xn {
3647
+ constructor(e, t, n) {
3648
+ this.mappings = t, this.options = n;
3598
3649
  }
3599
3650
  async resolveFile(e) {
3600
- var o;
3601
- if (!((o = this.options) != null && o.resolveFileUrl))
3651
+ var n;
3652
+ if (!((n = this.options) != null && n.resolveFileUrl))
3602
3653
  return (await fetch(e)).blob();
3603
3654
  const t = await this.options.resolveFileUrl(e);
3604
3655
  return t instanceof Blob ? t : (await fetch(t)).blob();
3605
3656
  }
3606
3657
  mapStyles(e) {
3607
- return Object.entries(e).map(([o, s]) => this.mappings.styleMapping[o](s, this));
3658
+ return Object.entries(e).map(([n, s]) => this.mappings.styleMapping[n](s, this));
3608
3659
  }
3609
3660
  mapInlineContent(e) {
3610
3661
  return this.mappings.inlineContentMapping[e.type](
@@ -3615,200 +3666,201 @@ class Yn {
3615
3666
  transformInlineContent(e) {
3616
3667
  return e.map((t) => this.mapInlineContent(t));
3617
3668
  }
3618
- async mapBlock(e, t, o, s) {
3669
+ async mapBlock(e, t, n, s) {
3619
3670
  return this.mappings.blockMapping[e.type](
3620
3671
  e,
3621
3672
  this,
3622
3673
  t,
3623
- o,
3674
+ n,
3624
3675
  s
3625
3676
  );
3626
3677
  }
3627
3678
  }
3628
- function qn(n) {
3679
+ function Zn(o) {
3629
3680
  return {
3630
3681
  createBlockMapping: (e) => e,
3631
3682
  createInlineContentMapping: (e) => e,
3632
3683
  createStyleMapping: (e) => e
3633
3684
  };
3634
3685
  }
3635
- function Qn(n, ...e) {
3636
- const t = [...n];
3637
- for (const o of e)
3638
- for (const s of o) {
3639
- const i = t.findLastIndex(
3640
- (r) => r.group === s.group
3686
+ function es(o, ...e) {
3687
+ const t = [...o];
3688
+ for (const n of e)
3689
+ for (const s of n) {
3690
+ const r = t.findLastIndex(
3691
+ (i) => i.group === s.group
3641
3692
  );
3642
- i === -1 ? t.push(s) : t.splice(i + 1, 0, s);
3693
+ r === -1 ? t.push(s) : t.splice(r + 1, 0, s);
3643
3694
  }
3644
3695
  return t;
3645
3696
  }
3646
3697
  export {
3647
- De as BlockNoteEditor,
3648
- Et as BlockNoteSchema,
3649
- ms as COLORS_DARK_MODE_DEFAULT,
3650
- ks as COLORS_DEFAULT,
3651
- Yr as CustomBlockNoteSchema,
3652
- gs as EMPTY_CELL_HEIGHT,
3653
- bs as EMPTY_CELL_WIDTH,
3654
- ye as EventEmitter,
3655
- Yn as Exporter,
3656
- ys as FILE_AUDIO_ICON_SVG,
3657
- Ss as FILE_IMAGE_ICON_SVG,
3658
- Bs as FILE_VIDEO_ICON_SVG,
3659
- Te as HTMLToBlocks,
3698
+ Le as BlockNoteEditor,
3699
+ xt as BlockNoteSchema,
3700
+ bs as COLORS_DARK_MODE_DEFAULT,
3701
+ ys as COLORS_DEFAULT,
3702
+ Xr as CustomBlockNoteSchema,
3703
+ Ss as EMPTY_CELL_HEIGHT,
3704
+ Bs as EMPTY_CELL_WIDTH,
3705
+ Se as EventEmitter,
3706
+ Xn as Exporter,
3707
+ Cs as FILE_AUDIO_ICON_SVG,
3708
+ xs as FILE_IMAGE_ICON_SVG,
3709
+ Es as FILE_VIDEO_ICON_SVG,
3710
+ Pe as HTMLToBlocks,
3660
3711
  me as UniqueID,
3661
3712
  F as UnreachableCaseError,
3662
- Cs as addDefaultPropsExternalHTML,
3663
- $ as addInlineContentAttributes,
3664
- je as addInlineContentKeyboardShortcuts,
3665
- Es as addNodeAndExtensionsToSpec,
3666
- xs as addStyleAttributes,
3667
- Ms as applyNonSelectableBlockFix,
3668
- es as assertEmpty,
3669
- ws as audioParse,
3670
- Ts as audioRender,
3671
- Ps as audioToExternalHTML,
3672
- vs as blockHasType,
3673
- Y as blockToNode,
3674
- ot as blocksToMarkdown,
3675
- Is as camelToDataKebab,
3676
- As as captureCellAnchor,
3677
- qr as checkPageBreakBlocksInSchema,
3678
- nt as cleanHTMLToMarkdown,
3679
- Qn as combineByGroup,
3680
- Ge as contentNodeToInlineContent,
3681
- ze as contentNodeToTableContent,
3682
- _s as createAudioBlockConfig,
3683
- Ds as createAudioBlockSpec,
3684
- Ls as createBlockConfig,
3685
- Ns as createBlockSpec,
3686
- Os as createBlockSpecFromTiptapNode,
3687
- Fs as createBulletListItemBlockConfig,
3688
- Hs as createBulletListItemBlockSpec,
3689
- $s as createCheckListItemBlockSpec,
3690
- Vs as createCheckListItemConfig,
3691
- Us as createCodeBlockConfig,
3692
- zs as createCodeBlockSpec,
3693
- Gs as createDefaultBlockDOMOutputSpec,
3694
- Rs as createDividerBlockConfig,
3695
- js as createDividerBlockSpec,
3696
- ni as createExtension,
3713
+ Ms as addDefaultPropsExternalHTML,
3714
+ H as addInlineContentAttributes,
3715
+ We as addInlineContentKeyboardShortcuts,
3716
+ ws as addNodeAndExtensionsToSpec,
3717
+ Ts as addStyleAttributes,
3718
+ Ps as applyNonSelectableBlockFix,
3719
+ ns as assertEmpty,
3720
+ vs as audioParse,
3721
+ Is as audioRender,
3722
+ As as audioToExternalHTML,
3723
+ _s as blockHasType,
3724
+ q as blockToNode,
3725
+ nt as blocksToMarkdown,
3726
+ Ds as camelToDataKebab,
3727
+ Ls as captureCellAnchor,
3728
+ Zr as checkPageBreakBlocksInSchema,
3729
+ st as cleanHTMLToMarkdown,
3730
+ es as combineByGroup,
3731
+ Re as contentNodeToInlineContent,
3732
+ Ge as contentNodeToTableContent,
3733
+ Ns as createAudioBlockConfig,
3734
+ Os as createAudioBlockSpec,
3735
+ Fs as createBlockConfig,
3736
+ $s as createBlockSpec,
3737
+ Hs as createBlockSpecFromTiptapNode,
3738
+ Vs as createBulletListItemBlockConfig,
3739
+ Us as createBulletListItemBlockSpec,
3740
+ zs as createCheckListItemBlockSpec,
3741
+ Gs as createCheckListItemConfig,
3742
+ Rs as createCodeBlockConfig,
3743
+ js as createCodeBlockSpec,
3744
+ Ws as createDefaultBlockDOMOutputSpec,
3745
+ Ks as createDividerBlockConfig,
3746
+ Js as createDividerBlockSpec,
3747
+ Nt as createExtension,
3697
3748
  be as createExternalHTMLExporter,
3698
- Ws as createFileBlockConfig,
3699
- Ks as createFileBlockSpec,
3700
- Js as createHeadingBlockConfig,
3701
- Ys as createHeadingBlockSpec,
3702
- qs as createImageBlockConfig,
3703
- Qs as createImageBlockSpec,
3704
- Jn as createInlineContentSpec,
3705
- Ke as createInlineContentSpecFromTipTapNode,
3706
- Qt as createInternalHTMLSerializer,
3707
- Xs as createInternalInlineContentSpec,
3708
- Zs as createInternalStyleSpec,
3709
- er as createNumberedListItemBlockConfig,
3710
- tr as createNumberedListItemBlockSpec,
3711
- Qr as createPageBreakBlockConfig,
3712
- Xr as createPageBreakBlockSpec,
3713
- or as createParagraphBlockConfig,
3714
- nr as createParagraphBlockSpec,
3715
- sr as createQuoteBlockConfig,
3716
- rr as createQuoteBlockSpec,
3717
- si as createStore,
3718
- ir as createStyleSpec,
3719
- ar as createStyleSpecFromTipTapMark,
3720
- cr as createTableBlockSpec,
3721
- lr as createToggleListItemBlockConfig,
3722
- dr as createToggleListItemBlockSpec,
3723
- ur as createToggleWrapper,
3724
- pr as createVideoBlockConfig,
3725
- fr as createVideoBlockSpec,
3726
- hr as defaultBlockSpecs,
3727
- mr as defaultBlockToHTML,
3728
- kr as defaultInlineContentSchema,
3729
- gr as defaultInlineContentSpecs,
3730
- br as defaultProps,
3731
- yr as defaultStyleSchema,
3732
- Sr as defaultStyleSpecs,
3733
- Br as defaultToggledState,
3734
- Ue as docToBlocks,
3735
- Cr as editorHasBlockWithType,
3736
- Er as fileParse,
3737
- xr as filenameFromURL,
3749
+ qs as createFileBlockConfig,
3750
+ Ys as createFileBlockSpec,
3751
+ Qs as createHeadingBlockConfig,
3752
+ Xs as createHeadingBlockSpec,
3753
+ Zs as createImageBlockConfig,
3754
+ er as createImageBlockSpec,
3755
+ Qn as createInlineContentSpec,
3756
+ Je as createInlineContentSpecFromTipTapNode,
3757
+ Xt as createInternalHTMLSerializer,
3758
+ tr as createInternalInlineContentSpec,
3759
+ or as createInternalStyleSpec,
3760
+ nr as createNumberedListItemBlockConfig,
3761
+ sr as createNumberedListItemBlockSpec,
3762
+ ei as createPageBreakBlockConfig,
3763
+ ti as createPageBreakBlockSpec,
3764
+ rr as createParagraphBlockConfig,
3765
+ ir as createParagraphBlockSpec,
3766
+ ar as createQuoteBlockConfig,
3767
+ cr as createQuoteBlockSpec,
3768
+ ii as createStore,
3769
+ lr as createStyleSpec,
3770
+ dr as createStyleSpecFromTipTapMark,
3771
+ ur as createTableBlockSpec,
3772
+ pr as createToggleListItemBlockConfig,
3773
+ fr as createToggleListItemBlockSpec,
3774
+ hr as createToggleWrapper,
3775
+ mr as createVideoBlockConfig,
3776
+ kr as createVideoBlockSpec,
3777
+ gr as defaultBlockSpecs,
3778
+ br as defaultBlockToHTML,
3779
+ yr as defaultInlineContentSchema,
3780
+ Sr as defaultInlineContentSpecs,
3781
+ Br as defaultProps,
3782
+ Cr as defaultStyleSchema,
3783
+ xr as defaultStyleSpecs,
3784
+ Er as defaultToggledState,
3785
+ ze as docToBlocks,
3786
+ Mr as editorHasBlockWithType,
3787
+ un as expandPMRangeToWords,
3788
+ wr as fileParse,
3789
+ Tr as filenameFromURL,
3738
3790
  W as fixColumnList,
3739
- Mr as formatKeyboardShortcut,
3740
- qe as getBackgroundColorAttribute,
3741
- io as getBlock,
3742
- ts as getBlockCache,
3743
- wr as getBlockFromPos,
3791
+ Pr as formatKeyboardShortcut,
3792
+ Qe as getBackgroundColorAttribute,
3793
+ ao as getBlock,
3794
+ ss as getBlockCache,
3795
+ vr as getBlockFromPos,
3744
3796
  z as getBlockInfo,
3745
- q as getBlockInfoFromResolvedPos,
3746
- S as getBlockInfoFromSelection,
3747
- H as getBlockInfoFromTransaction,
3748
- os as getBlockInfoWithManualOffset,
3797
+ Y as getBlockInfoFromResolvedPos,
3798
+ B as getBlockInfoFromSelection,
3799
+ $ as getBlockInfoFromTransaction,
3800
+ rs as getBlockInfoWithManualOffset,
3749
3801
  ke as getBlockNoteSchema,
3750
- ns as getBlockSchema,
3751
- tt as getBlocksChangedByTransaction,
3752
- ss as getColspan,
3753
- Wt as getInlineContentParseRules,
3754
- rs as getInlineContentSchema,
3755
- Tr as getInlineContentSchemaFromSpecs,
3756
- Pr as getLanguageId,
3802
+ is as getBlockSchema,
3803
+ ot as getBlocksChangedByTransaction,
3804
+ as as getColspan,
3805
+ Kt as getInlineContentParseRules,
3806
+ cs as getInlineContentSchema,
3807
+ Ir as getInlineContentSchemaFromSpecs,
3808
+ Ar as getLanguageId,
3757
3809
  _ as getNearestBlockPos,
3758
- co as getNextBlock,
3759
- E as getNodeById,
3760
- Zr as getPageBreakSlashMenuItems,
3761
- lo as getParentBlock,
3762
- vr as getParseRules,
3763
- B as getPmSchema,
3764
- ao as getPrevBlock,
3765
- is as getRowspan,
3766
- Ir as getStyleParseRules,
3767
- as as getStyleSchema,
3768
- Ar as getStyleSchemaFromSpecs,
3769
- _r as getTextAlignmentAttribute,
3770
- Ze as getTextColorAttribute,
3771
- Dr as imageParse,
3772
- Lr as imageRender,
3773
- Nr as imageToExternalHTML,
3810
+ lo as getNextBlock,
3811
+ x as getNodeById,
3812
+ oi as getPageBreakSlashMenuItems,
3813
+ uo as getParentBlock,
3814
+ _r as getParseRules,
3815
+ C as getPmSchema,
3816
+ co as getPrevBlock,
3817
+ ls as getRowspan,
3818
+ Dr as getStyleParseRules,
3819
+ ds as getStyleSchema,
3820
+ Lr as getStyleSchemaFromSpecs,
3821
+ Nr as getTextAlignmentAttribute,
3822
+ et as getTextColorAttribute,
3823
+ Or as imageParse,
3824
+ Fr as imageRender,
3825
+ $r as imageToExternalHTML,
3774
3826
  O as inlineContentToNodes,
3775
- Kt as insertBlocks,
3776
- Or as isAppleOS,
3827
+ Jt as insertBlocks,
3828
+ Hr as isAppleOS,
3777
3829
  j as isEmptyColumn,
3778
- cs as isLinkInlineContent,
3779
- Fr as isNodeBlock,
3780
- ls as isPartialLinkInlineContent,
3781
- ds as isPartialTableCell,
3782
- Hr as isSafari,
3783
- us as isStyledTextInlineContent,
3784
- ps as isTableCell,
3785
- $r as isTableCellSelection,
3830
+ us as isLinkInlineContent,
3831
+ Vr as isNodeBlock,
3832
+ ps as isPartialLinkInlineContent,
3833
+ fs as isPartialTableCell,
3834
+ Ur as isSafari,
3835
+ hs as isStyledTextInlineContent,
3836
+ ms as isTableCell,
3837
+ zr as isTableCellSelection,
3786
3838
  Ye as isVideoUrl,
3787
- fs as mapTableCell,
3788
- qn as mappingFactory,
3789
- Bo as markdownToBlocks,
3790
- Pe as markdownToHTML,
3839
+ ks as mapTableCell,
3840
+ Zn as mappingFactory,
3841
+ Co as markdownToBlocks,
3842
+ ve as markdownToHTML,
3791
3843
  Q as mergeCSSClasses,
3792
- Vr as mergeParagraphs,
3844
+ Gr as mergeParagraphs,
3793
3845
  b as nodeToBlock,
3794
3846
  U as nodeToCustomInlineContent,
3795
- Ur as parseAudioElement,
3796
- zr as parseDefaultProps,
3797
- We as propsToAttributes,
3798
- Re as prosemirrorSliceToSlicedBlocks,
3847
+ Rr as parseAudioElement,
3848
+ jr as parseDefaultProps,
3849
+ Ke as propsToAttributes,
3850
+ je as prosemirrorSliceToSlicedBlocks,
3799
3851
  ie as removeAndInsertBlocks,
3800
- Jt as removeEmptyColumns,
3801
- Ie as selectedFragmentToHTML,
3802
- Gr as stylePropsToAttributes,
3803
- Ve as tableContentToNodes,
3804
- Rr as tablePropSchema,
3805
- jr as trackPosition,
3806
- Je as updateBlock,
3807
- Xe as updateBlockCommand,
3808
- et as updateBlockTr,
3809
- ei as uploadToTmpFilesDotOrg_DEV_ONLY,
3810
- Wr as videoParse,
3811
- ti as withPageBreak,
3812
- Kr as wrapInBlockStructure
3852
+ qt as removeEmptyColumns,
3853
+ Ae as selectedFragmentToHTML,
3854
+ Wr as stylePropsToAttributes,
3855
+ Ue as tableContentToNodes,
3856
+ Kr as tablePropSchema,
3857
+ Jr as trackPosition,
3858
+ qe as updateBlock,
3859
+ Ze as updateBlockCommand,
3860
+ tt as updateBlockTr,
3861
+ ni as uploadToTmpFilesDotOrg_DEV_ONLY,
3862
+ qr as videoParse,
3863
+ si as withPageBreak,
3864
+ Yr as wrapInBlockStructure
3813
3865
  };
3814
3866
  //# sourceMappingURL=blocknote.js.map