@blocknote/core 0.46.1 → 0.46.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/{BlockNoteSchema-DsMVJZv4.js → BlockNoteSchema-BkXw8HJ6.js} +2 -2
  2. package/dist/{BlockNoteSchema-DsMVJZv4.js.map → BlockNoteSchema-BkXw8HJ6.js.map} +1 -1
  3. package/dist/{BlockNoteSchema-qt4Czo0-.cjs → BlockNoteSchema-DmFDeA0n.cjs} +2 -2
  4. package/dist/{BlockNoteSchema-qt4Czo0-.cjs.map → BlockNoteSchema-DmFDeA0n.cjs.map} +1 -1
  5. package/dist/{TrailingNode-C-Kyrtf1.js → TrailingNode-CxM966vN.js} +50 -42
  6. package/dist/TrailingNode-CxM966vN.js.map +1 -0
  7. package/dist/TrailingNode-D-CZ76FS.cjs +2 -0
  8. package/dist/TrailingNode-D-CZ76FS.cjs.map +1 -0
  9. package/dist/blocknote.cjs +4 -4
  10. package/dist/blocknote.cjs.map +1 -1
  11. package/dist/blocknote.js +681 -621
  12. package/dist/blocknote.js.map +1 -1
  13. package/dist/blocks.cjs +1 -1
  14. package/dist/blocks.js +2 -2
  15. package/dist/{defaultBlocks-CXOCngjC.js → defaultBlocks-DE5GNdJH.js} +31 -27
  16. package/dist/defaultBlocks-DE5GNdJH.js.map +1 -0
  17. package/dist/{defaultBlocks-IsUGVZIq.cjs → defaultBlocks-DosClM5E.cjs} +2 -2
  18. package/dist/defaultBlocks-DosClM5E.cjs.map +1 -0
  19. package/dist/extensions.cjs +1 -1
  20. package/dist/extensions.js +3 -3
  21. package/dist/style.css +1 -1
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/dist/webpack-stats.json +1 -1
  24. package/package.json +1 -1
  25. package/src/api/exporters/html/internalHTMLSerializer.ts +146 -2
  26. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +3 -0
  27. package/src/blocks/Code/block.ts +12 -8
  28. package/src/editor/Block.css +5 -1
  29. package/src/editor/editor.css +1 -0
  30. package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +1 -0
  31. package/src/extensions/TableHandles/TableHandles.ts +6 -2
  32. package/src/schema/blocks/createSpec.ts +4 -2
  33. package/src/schema/blocks/types.ts +9 -0
  34. package/types/src/schema/blocks/types.d.ts +9 -3
  35. package/dist/TrailingNode-C-Kyrtf1.js.map +0 -1
  36. package/dist/TrailingNode-W7GJVng5.cjs +0 -2
  37. package/dist/TrailingNode-W7GJVng5.cjs.map +0 -1
  38. package/dist/defaultBlocks-CXOCngjC.js.map +0 -1
  39. package/dist/defaultBlocks-IsUGVZIq.cjs.map +0 -1
package/dist/blocknote.js CHANGED
@@ -3,33 +3,33 @@ var Fe = (o, e, t) => e in o ? Oe(o, e, { enumerable: !0, configurable: !0, writ
3
3
  var h = (o, e, t) => Fe(o, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { Slice as N, Fragment as A, DOMSerializer as he, DOMParser as $e, Node as He } from "prosemirror-model";
5
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-CXOCngjC.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-CXOCngjC.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-C-Kyrtf1.js";
11
- import { s as Ct, B as xt } from "./BlockNoteSchema-DsMVJZv4.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-DsMVJZv4.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";
6
+ import { n as U, i as O, g as C, b as J, a as b, t as Ue, U as F, q as _, r as $, d as ze, s as Ge, u as Re, v as Y, w as B, x as me, y as je, z as ke, A as z } from "./blockToNode-BNoNIXU7.js";
7
+ import { B as ds, G as us, C as ps, D as fs, N as hs, E as ms, O as ks, F as gs, H as bs, I as ys, L as Ss, J as Bs, M as Cs, K as xs } from "./blockToNode-BNoNIXU7.js";
8
+ import { ak as H, al as We, am as qe, an as Ke, aj as x, a as Je, ao as Ye, ap as Qe, a5 as Xe, a8 as G, aq as Ze, ar as et, a6 as tt, as as Q, a9 as ge, at as ot } from "./defaultBlocks-DE5GNdJH.js";
9
+ import { aw as ws, av as Ms, E as Ts, F as Ps, r as vs, N as Is, a4 as As, ad as _s, aG as Ds, ax as Ls, b as Ns, d as Os, e as Fs, a0 as $s, aM as Hs, au as Vs, c as Us, f as zs, ag as Gs, ah as Rs, aB as js, x as Ws, y as qs, A as Ks, z as Js, g as Ys, h as Qs, T as Xs, j as Zs, k as er, l as tr, n as or, o as nr, q as sr, s as rr, w as ar, aC as ir, aH as cr, B as lr, C as dr, H as ur, I as pr, J as fr, K as hr, aE as mr, aI as kr, M as gr, D as br, G as yr, S as Sr, O as Br, Q as Cr, W as xr, U as Er, _ as wr, Z as Mr, a2 as Tr, Y as Pr, X as vr, R as Ir, $ as Ar, m as _r, aN as Dr, aK as Lr, az as Nr, af as Or, i as Fr, ay as $r, aD as Hr, ae as Vr, a7 as Ur, t as zr, u as Gr, v as Rr, aJ as jr, ai as Wr, aL as qr, a1 as Kr, V as Jr, p as Yr, a3 as Qr, aF as Xr, L as Zr, aO as ea, P as ta, aA as oa } from "./defaultBlocks-DE5GNdJH.js";
10
+ import { j as nt, k as be, l as st, m as rt, n as at, c as R, F as it, Y as ct, a as lt, b as dt, S as ut, B as ye, D as pt, L as ft, N as ht, P as mt, g as kt, i as gt, H as bt, h as yt, e as St, V as Bt, d as Ct } from "./TrailingNode-CxM966vN.js";
11
+ import { s as xt, B as Et } from "./BlockNoteSchema-BkXw8HJ6.js";
12
+ import { C as sa, b as ra, c as aa, a as ia, g as ca, u as la, w as da } from "./BlockNoteSchema-BkXw8HJ6.js";
13
+ import { Node as D, Extension as E, mergeAttributes as wt, Mark as X, extensions as I, isNodeSelection as Mt, posToDOMRect as Tt, selectionToInsertionEnd as Pt, getSchema as vt, createDocument as It, Editor as At } from "@tiptap/core";
14
14
  import { E as Se } from "./EventEmitter-CjSwpTbz.js";
15
15
  import { Fragment as Z, Slice as ne } from "@tiptap/pm/model";
16
- import { e as At } from "./en-njEqD7AG.js";
17
- import { inputRules as _t, InputRule as Dt } from "@handlewithcare/prosemirror-inputrules";
18
- import { keymap as Lt } from "@tiptap/pm/keymap";
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/extensions/gap-cursor";
22
- import { Link as $t } from "@tiptap/extension-link";
23
- import { Text as Ht } from "@tiptap/extension-text";
24
- import { NodeSelection as L, TextSelection as M, Plugin as ee } from "prosemirror-state";
16
+ import { e as _t } from "./en-njEqD7AG.js";
17
+ import { inputRules as Dt, InputRule as Lt } from "@handlewithcare/prosemirror-inputrules";
18
+ import { keymap as Nt } from "@tiptap/pm/keymap";
19
+ import { c as Ot, o as Ft } from "./BlockNoteExtension-C2X7LW-V.js";
20
+ import { a as pa } from "./BlockNoteExtension-C2X7LW-V.js";
21
+ import { Gapcursor as $t } from "@tiptap/extensions/gap-cursor";
22
+ import { Link as Ht } from "@tiptap/extension-link";
23
+ import { Text as Vt } from "@tiptap/extension-text";
24
+ import { NodeSelection as L, TextSelection as w, Plugin as ee } from "prosemirror-state";
25
25
  import { CellSelection as te, TableMap as se } from "prosemirror-tables";
26
- import { S as Vt } from "./ShowSelection-B0ch3unP.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";
26
+ import { S as Ut } from "./ShowSelection-B0ch3unP.js";
27
+ import zt from "remark-gfm";
28
+ import Gt from "remark-parse";
29
+ import Rt, { defaultHandlers as re } from "remark-rehype";
30
+ import jt from "rehype-stringify";
31
+ import { unified as Wt } from "unified";
32
+ import { TextSelection as qt } from "@tiptap/pm/state";
33
33
  function Kt(o, e) {
34
34
  const t = [
35
35
  {
@@ -50,7 +50,7 @@ function Kt(o, e) {
50
50
  }
51
51
  }), t;
52
52
  }
53
- function Qn(o, e) {
53
+ function ss(o, e) {
54
54
  var n;
55
55
  const t = D.create({
56
56
  name: o.type,
@@ -61,7 +61,7 @@ function Qn(o, e) {
61
61
  atom: o.content === "none",
62
62
  content: o.content === "styled" ? "inline*" : "",
63
63
  addAttributes() {
64
- return Ke(o.propSchema);
64
+ return qe(o.propSchema);
65
65
  },
66
66
  addKeyboardShortcuts() {
67
67
  return We(o);
@@ -73,7 +73,7 @@ function Qn(o, e) {
73
73
  );
74
74
  },
75
75
  renderHTML({ node: s }) {
76
- const r = this.options.editor, i = e.render.call(
76
+ const r = this.options.editor, a = e.render.call(
77
77
  { renderType: "dom", props: void 0 },
78
78
  U(
79
79
  s,
@@ -86,7 +86,7 @@ function Qn(o, e) {
86
86
  r
87
87
  );
88
88
  return H(
89
- i,
89
+ a,
90
90
  o.type,
91
91
  s.attrs,
92
92
  o.propSchema
@@ -94,7 +94,7 @@ function Qn(o, e) {
94
94
  },
95
95
  addNodeView() {
96
96
  return (s) => {
97
- const { node: r, getPos: i } = s, c = this.options.editor, a = e.render.call(
97
+ const { node: r, getPos: a } = s, c = this.options.editor, i = e.render.call(
98
98
  { renderType: "nodeView", props: s },
99
99
  U(
100
100
  r,
@@ -103,7 +103,7 @@ function Qn(o, e) {
103
103
  ),
104
104
  // TODO: fix cast
105
105
  (l) => {
106
- const d = O([l], c.pmSchema), u = i();
106
+ const d = O([l], c.pmSchema), u = a();
107
107
  u && c.transact(
108
108
  (p) => p.replaceWith(u, u + r.nodeSize, d)
109
109
  );
@@ -111,7 +111,7 @@ function Qn(o, e) {
111
111
  c
112
112
  );
113
113
  return H(
114
- a,
114
+ i,
115
115
  o.type,
116
116
  r.attrs,
117
117
  o.propSchema
@@ -119,17 +119,17 @@ function Qn(o, e) {
119
119
  };
120
120
  }
121
121
  });
122
- return Je(
122
+ return Ke(
123
123
  t,
124
124
  o.propSchema,
125
125
  {
126
126
  ...e,
127
127
  toExternalHTML: e.toExternalHTML,
128
- render(s, r, i) {
128
+ render(s, r, a) {
129
129
  const c = e.render(
130
130
  s,
131
131
  r,
132
- i
132
+ a
133
133
  );
134
134
  return H(
135
135
  c,
@@ -142,15 +142,15 @@ function Qn(o, e) {
142
142
  );
143
143
  }
144
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)
145
+ const s = typeof t == "string" ? t : t.id, r = C(o), a = e.map(
146
+ (d) => J(d, r)
147
147
  ), c = x(s, o.doc);
148
148
  if (!c)
149
149
  throw new Error(`Block with ID ${s} not found`);
150
- let a = c.posBeforeNode;
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(
150
+ let i = c.posBeforeNode;
151
+ return n === "after" && (i += c.node.nodeSize), o.step(
152
+ new Ve(i, i, new N(A.from(a), 0, 0))
153
+ ), a.map(
154
154
  (d) => b(d, r)
155
155
  );
156
156
  }
@@ -165,7 +165,7 @@ function j(o) {
165
165
  throw new Error("Invalid blockContainer: does not have child node.");
166
166
  return o.childCount === 1 && e.childCount === 1 && t.type.name === "paragraph" && t.content.content.length === 0;
167
167
  }
168
- function qt(o, e) {
168
+ function Yt(o, e) {
169
169
  const t = o.doc.resolve(e), n = t.nodeAfter;
170
170
  if (!n || n.type.name !== "columnList")
171
171
  throw new Error(
@@ -179,7 +179,7 @@ function qt(o, e) {
179
179
  }
180
180
  }
181
181
  function W(o, e) {
182
- qt(o, e);
182
+ Yt(o, e);
183
183
  const n = o.doc.resolve(e).nodeAfter;
184
184
  if (!n || n.type.name !== "columnList")
185
185
  throw new Error(
@@ -189,10 +189,10 @@ function W(o, e) {
189
189
  return;
190
190
  if (n.childCount < 2)
191
191
  throw new Error("Invalid columnList: contains fewer than two children.");
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)
192
+ const s = e + 1, a = o.doc.resolve(s).nodeAfter, c = e + n.nodeSize - 1, l = o.doc.resolve(c).nodeBefore;
193
+ if (!a || !l)
194
194
  throw new Error("Invalid columnList: does not contain children.");
195
- const d = j(i), u = j(l);
195
+ const d = j(a), u = j(l);
196
196
  if (d && u) {
197
197
  o.delete(e, e + n.nodeSize);
198
198
  return;
@@ -222,7 +222,7 @@ function W(o, e) {
222
222
  e + n.nodeSize,
223
223
  // Replaces with content of first `column`.
224
224
  s + 1,
225
- s + i.nodeSize - 1,
225
+ s + a.nodeSize - 1,
226
226
  // Doesn't append anything.
227
227
  N.empty,
228
228
  0,
@@ -232,21 +232,21 @@ function W(o, e) {
232
232
  return;
233
233
  }
234
234
  }
235
- function ie(o, e, t) {
235
+ function ae(o, e, t) {
236
236
  const n = C(o), s = t.map(
237
- (u) => q(u, n)
237
+ (u) => J(u, n)
238
238
  ), r = new Set(
239
239
  e.map(
240
240
  (u) => typeof u == "string" ? u : u.id
241
241
  )
242
- ), i = [], c = /* @__PURE__ */ new Set(), a = typeof e[0] == "string" ? e[0] : e[0].id;
242
+ ), a = [], c = /* @__PURE__ */ new Set(), i = typeof e[0] == "string" ? e[0] : e[0].id;
243
243
  let l = 0;
244
244
  if (o.doc.descendants((u, p) => {
245
245
  if (r.size === 0)
246
246
  return !1;
247
247
  if (!u.type.isInGroup("bnBlock") || !r.has(u.attrs.id))
248
248
  return !0;
249
- if (i.push(b(u, n)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === a) {
249
+ if (a.push(b(u, n)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === i) {
250
250
  const g = o.doc.nodeSize;
251
251
  o.insert(p, s);
252
252
  const y = o.doc.nodeSize;
@@ -265,9 +265,9 @@ function ie(o, e, t) {
265
265
  }
266
266
  return c.forEach((u) => W(o, u)), { insertedBlocks: s.map(
267
267
  (u) => b(u, n)
268
- ), removedBlocks: i };
268
+ ), removedBlocks: a };
269
269
  }
270
- function Yt(o, e, t, n, s) {
270
+ function Qt(o, e, t, n, s) {
271
271
  let r;
272
272
  if (e)
273
273
  if (typeof e == "string")
@@ -280,12 +280,12 @@ function Yt(o, e, t, n, s) {
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 r)
284
- if (a.type.name !== "text" && o.schema.inlineContentSchema[a.type.name]) {
285
- const l = o.schema.inlineContentSpecs[a.type.name].implementation;
283
+ for (const i of r)
284
+ if (i.type.name !== "text" && o.schema.inlineContentSchema[i.type.name]) {
285
+ const l = o.schema.inlineContentSpecs[i.type.name].implementation;
286
286
  if (l) {
287
287
  const d = U(
288
- a,
288
+ i,
289
289
  o.schema.inlineContentSchema,
290
290
  o.schema.styleSchema
291
291
  ), u = l.render.call(
@@ -301,7 +301,7 @@ function Yt(o, e, t, n, s) {
301
301
  if (u) {
302
302
  if (c.appendChild(u.dom), u.contentDOM) {
303
303
  const p = t.serializeFragment(
304
- a.content,
304
+ i.content,
305
305
  s
306
306
  );
307
307
  u.contentDOM.dataset.editable = "", u.contentDOM.appendChild(p);
@@ -309,11 +309,11 @@ function Yt(o, e, t, n, s) {
309
309
  continue;
310
310
  }
311
311
  }
312
- } else if (a.type.name === "text") {
312
+ } else if (i.type.name === "text") {
313
313
  let l = document.createTextNode(
314
- a.textContent
314
+ i.textContent
315
315
  );
316
- for (const d of a.marks.toReversed())
316
+ for (const d of i.marks.toReversed())
317
317
  if (d.type.name in o.schema.styleSpecs) {
318
318
  const u = o.schema.styleSpecs[d.type.name].implementation.render(d.attrs.stringValue, o);
319
319
  u.contentDOM.appendChild(l), l = u.dom;
@@ -324,30 +324,30 @@ function Yt(o, e, t, n, s) {
324
324
  c.appendChild(l);
325
325
  } else {
326
326
  const l = t.serializeFragment(
327
- A.from([a]),
327
+ A.from([i]),
328
328
  s
329
329
  );
330
330
  c.appendChild(l);
331
331
  }
332
332
  return c;
333
333
  }
334
- function Qt(o, e, t, n) {
334
+ function Xt(o, e, t, n) {
335
335
  var u, p, m, f, k;
336
336
  const s = o.pmSchema.nodes.blockContainer, r = e.props || {};
337
337
  for (const [g, y] of Object.entries(
338
338
  o.schema.blockSchema[e.type].propSchema
339
339
  ))
340
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(
341
+ const a = e.children || [], i = o.blockImplementations[e.type].implementation.render.call(
342
342
  {
343
343
  renderType: "dom",
344
344
  props: void 0
345
345
  },
346
- { ...e, props: r, children: i },
346
+ { ...e, props: r, children: a },
347
347
  o
348
348
  );
349
- if (a.contentDOM && e.content) {
350
- const g = Yt(
349
+ if (i.contentDOM && e.content) {
350
+ const g = Qt(
351
351
  o,
352
352
  e.content,
353
353
  // TODO
@@ -355,7 +355,7 @@ function Qt(o, e, t, n) {
355
355
  e.type,
356
356
  n
357
357
  );
358
- a.contentDOM.appendChild(g);
358
+ i.contentDOM.appendChild(g);
359
359
  }
360
360
  if (o.pmSchema.nodes[e.type].isInGroup("bnBlock")) {
361
361
  if (e.children && e.children.length > 0) {
@@ -365,9 +365,9 @@ function Qt(o, e, t, n) {
365
365
  t,
366
366
  n
367
367
  );
368
- (u = a.contentDOM) == null || u.append(g);
368
+ (u = i.contentDOM) == null || u.append(g);
369
369
  }
370
- return a.dom;
370
+ return i.dom;
371
371
  }
372
372
  const d = (m = (p = s.spec) == null ? void 0 : p.toDOM) == null ? void 0 : m.call(
373
373
  p,
@@ -376,29 +376,89 @@ function Qt(o, e, t, n) {
376
376
  ...r
377
377
  })
378
378
  );
379
- return (f = d.contentDOM) == null || f.appendChild(a.dom), e.children && e.children.length > 0 && ((k = d.contentDOM) == null || k.appendChild(
379
+ return (f = d.contentDOM) == null || f.appendChild(i.dom), e.children && e.children.length > 0 && ((k = d.contentDOM) == null || k.appendChild(
380
380
  Ce(o, e.children, t, n)
381
381
  )), d.dom;
382
382
  }
383
383
  function Be(o, e, t, n) {
384
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);
385
+ for (const a of e) {
386
+ const c = Xt(o, a, t, n);
387
387
  r.appendChild(c);
388
388
  }
389
389
  return r;
390
390
  }
391
391
  const Ce = (o, e, t, n) => {
392
392
  var c;
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);
393
+ const s = o.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), a = Be(o, e, t, n);
394
+ return (c = r.contentDOM) == null || c.appendChild(a), r.dom;
395
+ }, Zt = (o) => (o.querySelectorAll(
396
+ '[data-content-type="numberedListItem"]'
397
+ ).forEach((t) => {
398
+ var s, r;
399
+ const n = (r = (s = t.closest(".bn-block-outer")) == null ? void 0 : s.previousElementSibling) == null ? void 0 : r.querySelector(
400
+ '[data-content-type="numberedListItem"]'
401
+ );
402
+ if (!n)
403
+ t.setAttribute(
404
+ "data-index",
405
+ t.getAttribute("data-start") || "1"
406
+ );
407
+ else {
408
+ const a = n.getAttribute("data-index");
409
+ t.setAttribute(
410
+ "data-index",
411
+ (parseInt(a || "0") + 1).toString()
412
+ );
413
+ }
414
+ }), o), eo = (o) => (o.querySelectorAll(
415
+ '[data-content-type="checkListItem"] input'
416
+ ).forEach((t) => {
417
+ t.disabled = !0;
418
+ }), o), to = (o) => (o.querySelectorAll(
419
+ '.bn-toggle-wrapper[data-show-children="false"]'
420
+ ).forEach((t) => {
421
+ t.setAttribute("data-show-children", "true");
422
+ }), o), oo = (o) => (o.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
423
+ t.setAttribute(
424
+ "style",
425
+ `--default-cell-min-width: ${Je}px;`
426
+ ), t.setAttribute("data-show-children", "true");
427
+ }), o), no = (o) => (o.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
428
+ var r;
429
+ const n = document.createElement("div");
430
+ n.className = "tableWrapper";
431
+ const s = document.createElement("div");
432
+ s.className = "tableWrapper-inner", n.appendChild(s), (r = t.parentElement) == null || r.appendChild(n), n.appendChild(t);
433
+ }), o), so = (o) => (o.querySelectorAll(
434
+ ".bn-inline-content:empty"
435
+ ).forEach((t) => {
436
+ const n = document.createElement("span");
437
+ n.className = "ProseMirror-trailingBreak", n.setAttribute("style", "display: inline-block;"), t.appendChild(n);
438
+ }), o), ro = (o, e) => {
439
+ const t = he.fromSchema(o), n = [
440
+ Zt,
441
+ eo,
442
+ to,
443
+ oo,
444
+ no,
445
+ so
446
+ ];
397
447
  return {
398
- serializeBlocks: (n, s) => Ce(e, n, t, s).outerHTML
448
+ serializeBlocks: (s, r) => {
449
+ let a = Ce(
450
+ e,
451
+ s,
452
+ t,
453
+ r
454
+ );
455
+ for (const c of n)
456
+ a = c(a);
457
+ return a.outerHTML;
458
+ }
399
459
  };
400
460
  };
401
- function Zt(o) {
461
+ function ao(o) {
402
462
  return o.transact((e) => {
403
463
  const t = _(e.doc, e.selection.anchor);
404
464
  if (e.selection instanceof te)
@@ -425,7 +485,7 @@ function Zt(o) {
425
485
  }
426
486
  });
427
487
  }
428
- function eo(o, e) {
488
+ function io(o, e) {
429
489
  var s, r;
430
490
  const t = (s = x(e.anchorBlockId, o.doc)) == null ? void 0 : s.posBeforeNode;
431
491
  if (t === void 0)
@@ -442,62 +502,62 @@ function eo(o, e) {
442
502
  else if (e.type === "node")
443
503
  n = L.create(o.doc, t + 1);
444
504
  else {
445
- const i = (r = x(e.headBlockId, o.doc)) == null ? void 0 : r.posBeforeNode;
446
- if (i === void 0)
505
+ const a = (r = x(e.headBlockId, o.doc)) == null ? void 0 : r.posBeforeNode;
506
+ if (a === void 0)
447
507
  throw new Error(
448
508
  `Could not find block with ID ${e.headBlockId} to update selection`
449
509
  );
450
- n = M.create(
510
+ n = w.create(
451
511
  o.doc,
452
512
  t + e.anchorOffset,
453
- i + e.headOffset
513
+ a + e.headOffset
454
514
  );
455
515
  }
456
516
  o.setSelection(n);
457
517
  }
458
- function K(o) {
459
- return o.map((e) => e.type === "columnList" ? e.children.map((t) => K(t.children)).flat() : {
518
+ function q(o) {
519
+ return o.map((e) => e.type === "columnList" ? e.children.map((t) => q(t.children)).flat() : {
460
520
  ...e,
461
- children: K(e.children)
521
+ children: q(e.children)
462
522
  }).flat();
463
523
  }
464
524
  function xe(o, e, t) {
465
525
  o.transact((n) => {
466
- var i;
467
- const s = ((i = o.getSelection()) == null ? void 0 : i.blocks) || [
526
+ var a;
527
+ const s = ((a = o.getSelection()) == null ? void 0 : a.blocks) || [
468
528
  o.getTextCursorPosition().block
469
- ], r = Zt(o);
470
- o.removeBlocks(s), o.insertBlocks(K(s), e, t), eo(n, r);
529
+ ], r = ao(o);
530
+ o.removeBlocks(s), o.insertBlocks(q(s), e, t), io(n, r);
471
531
  });
472
532
  }
473
533
  function Ee(o) {
474
534
  return !o || o.type !== "columnList";
475
535
  }
476
- function Me(o, e, t) {
536
+ function we(o, e, t) {
477
537
  let n, s;
478
538
  if (e ? e.children.length > 0 ? (n = e.children[e.children.length - 1], s = "after") : (n = e, s = "before") : t && (n = t, s = "before"), !n || !s)
479
539
  return;
480
540
  const r = o.getParentBlock(n);
481
- return Ee(r) ? { referenceBlock: n, placement: s } : Me(
541
+ return Ee(r) ? { referenceBlock: n, placement: s } : we(
482
542
  o,
483
543
  s === "after" ? n : o.getPrevBlock(n),
484
544
  r
485
545
  );
486
546
  }
487
- function we(o, e, t) {
547
+ function Me(o, e, t) {
488
548
  let n, s;
489
549
  if (e ? e.children.length > 0 ? (n = e.children[0], s = "before") : (n = e, s = "after") : t && (n = t, s = "after"), !n || !s)
490
550
  return;
491
551
  const r = o.getParentBlock(n);
492
- return Ee(r) ? { referenceBlock: n, placement: s } : we(
552
+ return Ee(r) ? { referenceBlock: n, placement: s } : Me(
493
553
  o,
494
554
  s === "before" ? n : o.getNextBlock(n),
495
555
  r
496
556
  );
497
557
  }
498
- function to(o) {
558
+ function co(o) {
499
559
  o.transact(() => {
500
- const e = o.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || o.getTextCursorPosition().block, n = Me(
560
+ const e = o.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || o.getTextCursorPosition().block, n = we(
501
561
  o,
502
562
  o.getPrevBlock(t),
503
563
  o.getParentBlock(t)
@@ -509,9 +569,9 @@ function to(o) {
509
569
  );
510
570
  });
511
571
  }
512
- function oo(o) {
572
+ function lo(o) {
513
573
  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(
574
+ const e = o.getSelection(), t = (e == null ? void 0 : e.blocks[(e == null ? void 0 : e.blocks.length) - 1]) || o.getTextCursorPosition().block, n = Me(
515
575
  o,
516
576
  o.getNextBlock(t),
517
577
  o.getParentBlock(t)
@@ -523,7 +583,7 @@ function oo(o) {
523
583
  );
524
584
  });
525
585
  }
526
- function no(o, e, t) {
586
+ function uo(o, e, t) {
527
587
  const { $from: n, $to: s } = o.selection, r = n.blockRange(
528
588
  s,
529
589
  (f) => f.childCount > 0 && (f.type.name === "blockGroup" || f.type.name === "column")
@@ -531,13 +591,13 @@ function no(o, e, t) {
531
591
  );
532
592
  if (!r)
533
593
  return !1;
534
- const i = r.startIndex;
535
- if (i === 0)
594
+ const a = r.startIndex;
595
+ if (a === 0)
536
596
  return !1;
537
- const a = r.parent.child(i - 1);
538
- if (a.type !== e)
597
+ const i = r.parent.child(a - 1);
598
+ if (i.type !== e)
539
599
  return !1;
540
- const l = a.lastChild && a.lastChild.type === t, d = A.from(l ? e.create() : null), u = new N(
600
+ const l = i.lastChild && i.lastChild.type === t, d = A.from(l ? e.create() : null), u = new N(
541
601
  A.from(
542
602
  e.create(null, A.from(t.create(null, d)))
543
603
  // change necessary to create "groupType" instead of parent.type
@@ -558,59 +618,59 @@ function no(o, e, t) {
558
618
  ).scrollIntoView(), !0;
559
619
  }
560
620
  function Te(o) {
561
- return o.transact((e) => no(
621
+ return o.transact((e) => uo(
562
622
  e,
563
623
  o.pmSchema.nodes.blockContainer,
564
624
  o.pmSchema.nodes.blockGroup
565
625
  ));
566
626
  }
567
- function so(o) {
627
+ function po(o) {
568
628
  o._tiptapEditor.commands.liftListItem("blockContainer");
569
629
  }
570
- function ro(o) {
630
+ function fo(o) {
571
631
  return o.transact((e) => {
572
632
  const { bnBlock: t } = $(e);
573
633
  return e.doc.resolve(t.beforePos).nodeBefore !== null;
574
634
  });
575
635
  }
576
- function io(o) {
636
+ function ho(o) {
577
637
  return o.transact((e) => {
578
638
  const { bnBlock: t } = $(e);
579
639
  return e.doc.resolve(t.beforePos).depth > 1;
580
640
  });
581
641
  }
582
- function ao(o, e) {
642
+ function mo(o, e) {
583
643
  const t = typeof e == "string" ? e : e.id, n = C(o), s = x(t, o);
584
644
  if (s)
585
645
  return b(s.node, n);
586
646
  }
587
- function co(o, e) {
647
+ function ko(o, e) {
588
648
  const t = typeof e == "string" ? e : e.id, n = x(t, o), s = C(o);
589
649
  if (!n)
590
650
  return;
591
- const i = o.resolve(n.posBeforeNode).nodeBefore;
592
- if (i)
593
- return b(i, s);
651
+ const a = o.resolve(n.posBeforeNode).nodeBefore;
652
+ if (a)
653
+ return b(a, s);
594
654
  }
595
- function lo(o, e) {
655
+ function go(o, e) {
596
656
  const t = typeof e == "string" ? e : e.id, n = x(t, o), s = C(o);
597
657
  if (!n)
598
658
  return;
599
- const i = o.resolve(
659
+ const a = o.resolve(
600
660
  n.posBeforeNode + n.node.nodeSize
601
661
  ).nodeAfter;
602
- if (i)
603
- return b(i, s);
662
+ if (a)
663
+ return b(a, s);
604
664
  }
605
- function uo(o, e) {
665
+ function bo(o, e) {
606
666
  const t = typeof e == "string" ? e : e.id, n = C(o), s = x(t, o);
607
667
  if (!s)
608
668
  return;
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
- if (a)
611
- return b(a, n);
669
+ const r = o.resolve(s.posBeforeNode), a = r.node(), c = r.node(-1), i = c.type.name !== "doc" ? a.type.name === "blockGroup" ? c : a : void 0;
670
+ if (i)
671
+ return b(i, n);
612
672
  }
613
- class po {
673
+ class yo {
614
674
  constructor(e) {
615
675
  this.editor = e;
616
676
  }
@@ -629,7 +689,7 @@ class po {
629
689
  * matching block was found.
630
690
  */
631
691
  getBlock(e) {
632
- return this.editor.transact((t) => ao(t.doc, e));
692
+ return this.editor.transact((t) => mo(t.doc, e));
633
693
  }
634
694
  /**
635
695
  * Gets a snapshot of the previous sibling of an existing block from the
@@ -641,7 +701,7 @@ class po {
641
701
  * in the document.
642
702
  */
643
703
  getPrevBlock(e) {
644
- return this.editor.transact((t) => co(t.doc, e));
704
+ return this.editor.transact((t) => ko(t.doc, e));
645
705
  }
646
706
  /**
647
707
  * Gets a snapshot of the next sibling of an existing block from the editor.
@@ -652,7 +712,7 @@ class po {
652
712
  * the document.
653
713
  */
654
714
  getNextBlock(e) {
655
- return this.editor.transact((t) => lo(t.doc, e));
715
+ return this.editor.transact((t) => go(t.doc, e));
656
716
  }
657
717
  /**
658
718
  * Gets a snapshot of the parent of an existing block from the editor.
@@ -663,7 +723,7 @@ class po {
663
723
  */
664
724
  getParentBlock(e) {
665
725
  return this.editor.transact(
666
- (t) => uo(t.doc, e)
726
+ (t) => bo(t.doc, e)
667
727
  );
668
728
  }
669
729
  /**
@@ -675,10 +735,10 @@ class po {
675
735
  const n = this.document.slice();
676
736
  t && n.reverse();
677
737
  function s(r) {
678
- for (const i of r) {
679
- if (e(i) === !1)
738
+ for (const a of r) {
739
+ if (e(a) === !1)
680
740
  return !1;
681
- const c = t ? i.children.slice().reverse() : i.children;
741
+ const c = t ? a.children.slice().reverse() : a.children;
682
742
  if (!s(c))
683
743
  return !1;
684
744
  }
@@ -707,7 +767,7 @@ class po {
707
767
  * @param update A partial block which defines how the existing block should be changed.
708
768
  */
709
769
  updateBlock(e, t) {
710
- return this.editor.transact((n) => qe(n, e, t));
770
+ return this.editor.transact((n) => Ye(n, e, t));
711
771
  }
712
772
  /**
713
773
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
@@ -715,7 +775,7 @@ class po {
715
775
  */
716
776
  removeBlocks(e) {
717
777
  return this.editor.transact(
718
- (t) => ie(t, e, []).removedBlocks
778
+ (t) => ae(t, e, []).removedBlocks
719
779
  );
720
780
  }
721
781
  /**
@@ -727,14 +787,14 @@ class po {
727
787
  */
728
788
  replaceBlocks(e, t) {
729
789
  return this.editor.transact(
730
- (n) => ie(n, e, t)
790
+ (n) => ae(n, e, t)
731
791
  );
732
792
  }
733
793
  /**
734
794
  * Checks if the block containing the text cursor can be nested.
735
795
  */
736
796
  canNestBlock() {
737
- return ro(this.editor);
797
+ return fo(this.editor);
738
798
  }
739
799
  /**
740
800
  * Nests the block containing the text cursor into the block above it.
@@ -746,13 +806,13 @@ class po {
746
806
  * Checks if the block containing the text cursor is nested.
747
807
  */
748
808
  canUnnestBlock() {
749
- return io(this.editor);
809
+ return ho(this.editor);
750
810
  }
751
811
  /**
752
812
  * Lifts the block containing the text cursor out of its parent.
753
813
  */
754
814
  unnestBlock() {
755
- so(this.editor);
815
+ po(this.editor);
756
816
  }
757
817
  /**
758
818
  * Moves the selected blocks up. If the previous block has children, moves
@@ -760,7 +820,7 @@ class po {
760
820
  * current blocks share a common parent, moves them out of & before it.
761
821
  */
762
822
  moveBlocksUp() {
763
- return to(this.editor);
823
+ return co(this.editor);
764
824
  }
765
825
  /**
766
826
  * Moves the selected blocks down. If the next block has children, moves
@@ -768,10 +828,10 @@ class po {
768
828
  * current blocks share a common parent, moves them out of & after it.
769
829
  */
770
830
  moveBlocksDown() {
771
- return oo(this.editor);
831
+ return lo(this.editor);
772
832
  }
773
833
  }
774
- class fo extends Se {
834
+ class So extends Se {
775
835
  constructor(e) {
776
836
  super(), this.editor = e, e.on("create", () => {
777
837
  e._tiptapEditor.on(
@@ -796,9 +856,9 @@ class fo extends Se {
796
856
  transaction: s,
797
857
  appendedTransactions: r
798
858
  }) => {
799
- !t && ae(s) || e(this.editor, {
859
+ !t && ie(s) || e(this.editor, {
800
860
  getChanges() {
801
- return ot(
861
+ return nt(
802
862
  s,
803
863
  r
804
864
  );
@@ -814,7 +874,7 @@ class fo extends Se {
814
874
  */
815
875
  onSelectionChange(e, t = !1) {
816
876
  const n = (s) => {
817
- !t && ae(s.transaction) || e(this.editor);
877
+ !t && ie(s.transaction) || e(this.editor);
818
878
  };
819
879
  return this.on("onSelectionChange", n), () => {
820
880
  this.off("onSelectionChange", n);
@@ -837,60 +897,60 @@ class fo extends Se {
837
897
  };
838
898
  }
839
899
  }
840
- function ae(o) {
900
+ function ie(o) {
841
901
  return !!o.getMeta("y-sync$");
842
902
  }
843
- function ho(o) {
903
+ function Bo(o) {
844
904
  return Array.prototype.indexOf.call(o.parentElement.childNodes, o);
845
905
  }
846
- function mo(o) {
906
+ function Co(o) {
847
907
  return o.nodeType === 3 && !/\S/.test(o.nodeValue || "");
848
908
  }
849
- function ko(o) {
909
+ function xo(o) {
850
910
  o.querySelectorAll("li > ul, li > ol").forEach((e) => {
851
- const t = ho(e), n = e.parentElement, s = Array.from(n.childNodes).slice(
911
+ const t = Bo(e), n = e.parentElement, s = Array.from(n.childNodes).slice(
852
912
  t + 1
853
913
  );
854
914
  e.remove(), s.forEach((r) => {
855
915
  r.remove();
856
916
  }), n.insertAdjacentElement("afterend", e), s.reverse().forEach((r) => {
857
- if (mo(r))
917
+ if (Co(r))
858
918
  return;
859
- const i = document.createElement("li");
860
- i.append(r), e.insertAdjacentElement("afterend", i);
919
+ const a = document.createElement("li");
920
+ a.append(r), e.insertAdjacentElement("afterend", a);
861
921
  }), n.childNodes.length === 0 && n.remove();
862
922
  });
863
923
  }
864
- function go(o) {
924
+ function Eo(o) {
865
925
  o.querySelectorAll("li + ul, li + ol").forEach((e) => {
866
- var r, i;
926
+ var r, a;
867
927
  const t = e.previousElementSibling, n = document.createElement("div");
868
928
  t.insertAdjacentElement("afterend", n), n.append(t);
869
929
  const s = document.createElement("div");
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"; )
930
+ for (s.setAttribute("data-node-type", "blockGroup"), n.append(s); ((r = n.nextElementSibling) == null ? void 0 : r.nodeName) === "UL" || ((a = n.nextElementSibling) == null ? void 0 : a.nodeName) === "OL"; )
871
931
  s.append(n.nextElementSibling);
872
932
  });
873
933
  }
874
934
  let ce = null;
875
- function bo() {
935
+ function wo() {
876
936
  return ce || (ce = document.implementation.createHTMLDocument("title"));
877
937
  }
878
- function yo(o) {
938
+ function Mo(o) {
879
939
  if (typeof o == "string") {
880
- const e = bo().createElement("div");
940
+ const e = wo().createElement("div");
881
941
  e.innerHTML = o, o = e;
882
942
  }
883
- return ko(o), go(o), o;
943
+ return xo(o), Eo(o), o;
884
944
  }
885
945
  function Pe(o, e) {
886
- const t = yo(o), s = $e.fromSchema(e).parse(t, {
946
+ const t = Mo(o), s = $e.fromSchema(e).parse(t, {
887
947
  topNode: e.nodes.blockGroup.create()
888
948
  }), r = [];
889
- for (let i = 0; i < s.childCount; i++)
890
- r.push(b(s.child(i), e));
949
+ for (let a = 0; a < s.childCount; a++)
950
+ r.push(b(s.child(a), e));
891
951
  return r;
892
952
  }
893
- function So(o, e) {
953
+ function To(o, e) {
894
954
  const t = e.value ? e.value : "", n = {};
895
955
  e.lang && (n["data-language"] = e.lang);
896
956
  let s = {
@@ -906,7 +966,7 @@ function So(o, e) {
906
966
  children: [s]
907
967
  }, o.patch(e, s), s;
908
968
  }
909
- function Bo(o, e) {
969
+ function Po(o, e) {
910
970
  var r;
911
971
  const t = String((e == null ? void 0 : e.url) || ""), n = e != null && e.title ? String(e.title) : void 0;
912
972
  let s = {
@@ -923,14 +983,14 @@ function Bo(o, e) {
923
983
  return (r = o.patch) == null || r.call(o, e, s), s = o.applyData ? o.applyData(e, s) : s, s;
924
984
  }
925
985
  function ve(o) {
926
- return jt().use(zt).use(Ut).use(Gt, {
986
+ return Wt().use(Gt).use(zt).use(Rt, {
927
987
  handlers: {
928
988
  ...re,
929
989
  image: (t, n) => {
930
990
  const s = String((n == null ? void 0 : n.url) || "");
931
- return Ye(s) ? Bo(t, n) : re.image(t, n);
991
+ return Qe(s) ? Po(t, n) : re.image(t, n);
932
992
  },
933
- code: So,
993
+ code: To,
934
994
  blockquote: (t, n) => {
935
995
  const s = {
936
996
  type: "element",
@@ -942,13 +1002,13 @@ function ve(o) {
942
1002
  return t.patch(n, s), t.applyData(n, s);
943
1003
  }
944
1004
  }
945
- }).use(Rt).processSync(o).value;
1005
+ }).use(jt).processSync(o).value;
946
1006
  }
947
- function Co(o, e) {
1007
+ function vo(o, e) {
948
1008
  const t = ve(o);
949
1009
  return Pe(t, e);
950
1010
  }
951
- class xo {
1011
+ class Io {
952
1012
  constructor(e) {
953
1013
  this.editor = e;
954
1014
  }
@@ -975,7 +1035,7 @@ class xo {
975
1035
  * @returns The blocks, serialized as an HTML string.
976
1036
  */
977
1037
  blocksToFullHTML(e = this.editor.document) {
978
- return Xt(
1038
+ return ro(
979
1039
  this.editor.pmSchema,
980
1040
  this.editor
981
1041
  ).serializeBlocks(e, {});
@@ -997,7 +1057,7 @@ class xo {
997
1057
  * @returns The blocks, serialized as a Markdown string.
998
1058
  */
999
1059
  blocksToMarkdownLossy(e = this.editor.document) {
1000
- return nt(e, this.editor.pmSchema, this.editor, {});
1060
+ return st(e, this.editor.pmSchema, this.editor, {});
1001
1061
  }
1002
1062
  /**
1003
1063
  * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
@@ -1007,7 +1067,7 @@ class xo {
1007
1067
  * @returns The blocks parsed from the Markdown string.
1008
1068
  */
1009
1069
  tryParseMarkdownToBlocks(e) {
1010
- return Co(e, this.editor.pmSchema);
1070
+ return vo(e, this.editor.pmSchema);
1011
1071
  }
1012
1072
  /**
1013
1073
  * Paste HTML into the editor. Defaults to converting HTML to BlockNote HTML.
@@ -1048,12 +1108,12 @@ const oe = [
1048
1108
  "text/plain",
1049
1109
  "Files"
1050
1110
  ];
1051
- function Eo(o, e) {
1111
+ function Ao(o, e) {
1052
1112
  if (!o.startsWith(".") || !e.startsWith("."))
1053
1113
  throw new Error("The strings provided are not valid file extensions.");
1054
1114
  return o === e;
1055
1115
  }
1056
- function Mo(o, e) {
1116
+ function _o(o, e) {
1057
1117
  const t = o.split("/"), n = e.split("/");
1058
1118
  if (t.length !== 2)
1059
1119
  throw new Error(`The string ${o} is not a valid MIME type.`);
@@ -1081,9 +1141,9 @@ async function Ie(o, e) {
1081
1141
  if (t === null)
1082
1142
  return;
1083
1143
  let n = null;
1084
- for (const i of oe)
1085
- if (t.types.includes(i)) {
1086
- n = i;
1144
+ for (const a of oe)
1145
+ if (t.types.includes(a)) {
1146
+ n = a;
1087
1147
  break;
1088
1148
  }
1089
1149
  if (n !== "Files")
@@ -1091,12 +1151,12 @@ async function Ie(o, e) {
1091
1151
  const s = t.items;
1092
1152
  if (s) {
1093
1153
  o.preventDefault();
1094
- for (let i = 0; i < s.length; i++) {
1154
+ for (let a = 0; a < s.length; a++) {
1095
1155
  let c = "file";
1096
1156
  for (const l of Object.values(e.schema.blockSpecs))
1097
1157
  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(
1158
+ const u = d.startsWith("."), p = s[a].getAsFile();
1159
+ if (p && (!u && p.type && _o(s[a].type, d) || u && Ao(
1100
1160
  "." + p.name.split(".").pop(),
1101
1161
  d
1102
1162
  ))) {
@@ -1104,12 +1164,12 @@ async function Ie(o, e) {
1104
1164
  break;
1105
1165
  }
1106
1166
  }
1107
- const a = s[i].getAsFile();
1108
- if (a) {
1167
+ const i = s[a].getAsFile();
1168
+ if (i) {
1109
1169
  const l = {
1110
1170
  type: c,
1111
1171
  props: {
1112
- name: a.name
1172
+ name: i.name
1113
1173
  }
1114
1174
  };
1115
1175
  let d;
@@ -1137,7 +1197,7 @@ async function Ie(o, e) {
1137
1197
  });
1138
1198
  } else
1139
1199
  return;
1140
- const u = await e.uploadFile(a, d), p = typeof u == "string" ? {
1200
+ const u = await e.uploadFile(i, d), p = typeof u == "string" ? {
1141
1201
  props: {
1142
1202
  url: u
1143
1203
  }
@@ -1147,7 +1207,7 @@ async function Ie(o, e) {
1147
1207
  }
1148
1208
  }
1149
1209
  }
1150
- const wo = (o) => E.create({
1210
+ const Do = (o) => E.create({
1151
1211
  name: "dropFile",
1152
1212
  addProseMirrorPlugins() {
1153
1213
  return [
@@ -1170,8 +1230,8 @@ const wo = (o) => E.create({
1170
1230
  })
1171
1231
  ];
1172
1232
  }
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) {
1233
+ }), Lo = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, No = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, Oo = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Fo = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, $o = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Ho = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, Vo = /\n{2} {0,3}-{2,48}\n{2}/, Uo = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, zo = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, Go = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Ro = /^\s*\|(.+\|)+\s*$/m, jo = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Wo = /^\s*\|(.+\|)+\s*$/m, qo = (o) => Lo.test(o) || No.test(o) || Oo.test(o) || Fo.test(o) || $o.test(o) || Ho.test(o) || Vo.test(o) || Uo.test(o) || zo.test(o) || Go.test(o) || Ro.test(o) || jo.test(o) || Wo.test(o);
1234
+ async function Ko(o, e) {
1175
1235
  const { schema: t } = e.state;
1176
1236
  if (!o.clipboardData)
1177
1237
  return !1;
@@ -1180,16 +1240,16 @@ async function Uo(o, e) {
1180
1240
  return !1;
1181
1241
  if (!t.nodes.codeBlock)
1182
1242
  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(
1243
+ const s = o.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0, a = r == null ? void 0 : r.mode;
1244
+ return a ? (e.pasteHTML(
1245
+ `<pre><code class="language-${a}">${n.replace(
1186
1246
  /\r\n?/g,
1187
1247
  `
1188
1248
  `
1189
1249
  )}</code></pre>`
1190
1250
  ), !0) : !1;
1191
1251
  }
1192
- function zo({
1252
+ function Jo({
1193
1253
  event: o,
1194
1254
  editor: e,
1195
1255
  prioritizeMarkdownOverHTML: t,
@@ -1197,37 +1257,37 @@ function zo({
1197
1257
  }) {
1198
1258
  var c;
1199
1259
  if (e.transact(
1200
- (a) => a.selection.$from.parent.type.spec.code && a.selection.$to.parent.type.spec.code
1260
+ (i) => i.selection.$from.parent.type.spec.code && i.selection.$to.parent.type.spec.code
1201
1261
  )) {
1202
- const a = (c = o.clipboardData) == null ? void 0 : c.getData("text/plain");
1203
- if (a)
1204
- return e.pasteText(a), !0;
1262
+ const i = (c = o.clipboardData) == null ? void 0 : c.getData("text/plain");
1263
+ if (i)
1264
+ return e.pasteText(i), !0;
1205
1265
  }
1206
1266
  let r;
1207
- for (const a of oe)
1208
- if (o.clipboardData.types.includes(a)) {
1209
- r = a;
1267
+ for (const i of oe)
1268
+ if (o.clipboardData.types.includes(i)) {
1269
+ r = i;
1210
1270
  break;
1211
1271
  }
1212
1272
  if (!r)
1213
1273
  return !0;
1214
1274
  if (r === "vscode-editor-data")
1215
- return Uo(o, e.prosemirrorView), !0;
1275
+ return Ko(o, e.prosemirrorView), !0;
1216
1276
  if (r === "Files")
1217
1277
  return Ie(o, e), !0;
1218
- const i = o.clipboardData.getData(r);
1278
+ const a = o.clipboardData.getData(r);
1219
1279
  if (r === "blocknote/html")
1220
- return e.pasteHTML(i, !0), !0;
1280
+ return e.pasteHTML(a, !0), !0;
1221
1281
  if (r === "text/markdown")
1222
- return e.pasteMarkdown(i), !0;
1282
+ return e.pasteMarkdown(a), !0;
1223
1283
  if (t) {
1224
- const a = o.clipboardData.getData("text/plain");
1225
- if (Vo(a))
1226
- return e.pasteMarkdown(a), !0;
1284
+ const i = o.clipboardData.getData("text/plain");
1285
+ if (qo(i))
1286
+ return e.pasteMarkdown(i), !0;
1227
1287
  }
1228
- return r === "text/html" ? (e.pasteHTML(i), !0) : n ? (e.pasteMarkdown(i), !0) : (e.pasteText(i), !0);
1288
+ return r === "text/html" ? (e.pasteHTML(a), !0) : n ? (e.pasteMarkdown(a), !0) : (e.pasteText(a), !0);
1229
1289
  }
1230
- const Go = (o, e) => E.create({
1290
+ const Yo = (o, e) => E.create({
1231
1291
  name: "pasteFromClipboard",
1232
1292
  addProseMirrorPlugins() {
1233
1293
  return [
@@ -1242,7 +1302,7 @@ const Go = (o, e) => E.create({
1242
1302
  defaultPasteHandler: ({
1243
1303
  prioritizeMarkdownOverHTML: s = !0,
1244
1304
  plainTextAsMarkdown: r = !0
1245
- } = {}) => zo({
1305
+ } = {}) => Jo({
1246
1306
  event: n,
1247
1307
  editor: o,
1248
1308
  prioritizeMarkdownOverHTML: s,
@@ -1256,64 +1316,64 @@ const Go = (o, e) => E.create({
1256
1316
  ];
1257
1317
  }
1258
1318
  });
1259
- function Ro(o, e, t) {
1319
+ function Qo(o, e, t) {
1260
1320
  var c;
1261
1321
  let n = !1;
1262
1322
  const s = o.state.selection instanceof te;
1263
1323
  if (!s) {
1264
- const a = o.state.doc.slice(
1324
+ const i = o.state.doc.slice(
1265
1325
  o.state.selection.from,
1266
1326
  o.state.selection.to,
1267
1327
  !1
1268
1328
  ).content, l = [];
1269
- for (let d = 0; d < a.childCount; d++)
1270
- l.push(a.child(d));
1329
+ for (let d = 0; d < i.childCount; d++)
1330
+ l.push(i.child(d));
1271
1331
  n = l.find(
1272
1332
  (d) => d.type.isInGroup("bnBlock") || d.type.name === "blockGroup" || d.type.spec.group === "blockContent"
1273
- ) === void 0, n && (e = a);
1333
+ ) === void 0, n && (e = i);
1274
1334
  }
1275
1335
  let r;
1276
- const i = be(
1336
+ const a = be(
1277
1337
  o.state.schema,
1278
1338
  t
1279
1339
  );
1280
1340
  if (s) {
1281
1341
  ((c = e.firstChild) == null ? void 0 : c.type.name) === "table" && (e = e.firstChild.content);
1282
- const a = Ge(
1342
+ const i = Ge(
1283
1343
  e,
1284
1344
  t.schema.inlineContentSchema,
1285
1345
  t.schema.styleSchema
1286
1346
  );
1287
- r = `<table>${i.exportInlineContent(
1288
- a,
1347
+ r = `<table>${a.exportInlineContent(
1348
+ i,
1289
1349
  {}
1290
1350
  )}</table>`;
1291
1351
  } else if (n) {
1292
- const a = Re(
1352
+ const i = Re(
1293
1353
  e,
1294
1354
  t.schema.inlineContentSchema,
1295
1355
  t.schema.styleSchema
1296
1356
  );
1297
- r = i.exportInlineContent(a, {});
1357
+ r = a.exportInlineContent(i, {});
1298
1358
  } else {
1299
- const a = rt(e);
1300
- r = i.exportBlocks(a, {});
1359
+ const i = at(e);
1360
+ r = a.exportBlocks(i, {});
1301
1361
  }
1302
1362
  return r;
1303
1363
  }
1304
1364
  function Ae(o, e) {
1305
1365
  "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))
1366
+ (a) => a.setSelection(
1367
+ new L(a.doc.resolve(o.state.selection.from - 1))
1308
1368
  )
1309
1369
  );
1310
1370
  const t = o.serializeForClipboard(
1311
1371
  o.state.selection.content()
1312
- ).dom.innerHTML, n = o.state.selection.content().content, s = Ro(
1372
+ ).dom.innerHTML, n = o.state.selection.content().content, s = Qo(
1313
1373
  o,
1314
1374
  n,
1315
1375
  e
1316
- ), r = st(s);
1376
+ ), r = rt(s);
1317
1377
  return { clipboardHTML: t, externalHTML: s, markdown: r };
1318
1378
  }
1319
1379
  const de = () => {
@@ -1334,7 +1394,7 @@ const de = () => {
1334
1394
  o
1335
1395
  );
1336
1396
  t.clipboardData.setData("blocknote/html", n), t.clipboardData.setData("text/html", s), t.clipboardData.setData("text/plain", r);
1337
- }, jo = (o) => E.create({
1397
+ }, Xo = (o) => E.create({
1338
1398
  name: "copyToClipboard",
1339
1399
  addProseMirrorPlugins() {
1340
1400
  return [
@@ -1354,9 +1414,9 @@ const de = () => {
1354
1414
  if (!("node" in e.state.selection) || e.state.selection.node.type.spec.group !== "blockContent")
1355
1415
  return;
1356
1416
  o.transact(
1357
- (i) => i.setSelection(
1417
+ (a) => a.setSelection(
1358
1418
  new L(
1359
- i.doc.resolve(e.state.selection.from - 1)
1419
+ a.doc.resolve(e.state.selection.from - 1)
1360
1420
  )
1361
1421
  )
1362
1422
  ), t.preventDefault(), t.dataTransfer.clearData();
@@ -1368,19 +1428,19 @@ const de = () => {
1368
1428
  })
1369
1429
  ];
1370
1430
  }
1371
- }), Wo = E.create({
1431
+ }), Zo = E.create({
1372
1432
  name: "blockBackgroundColor",
1373
1433
  addGlobalAttributes() {
1374
1434
  return [
1375
1435
  {
1376
1436
  types: ["tableCell", "tableHeader"],
1377
1437
  attributes: {
1378
- backgroundColor: Qe()
1438
+ backgroundColor: Xe()
1379
1439
  }
1380
1440
  }
1381
1441
  ];
1382
1442
  }
1383
- }), Ko = D.create({
1443
+ }), en = D.create({
1384
1444
  name: "hardBreak",
1385
1445
  inline: !0,
1386
1446
  group: "inline",
@@ -1391,13 +1451,13 @@ const de = () => {
1391
1451
  return [{ tag: "br" }];
1392
1452
  },
1393
1453
  renderHTML({ HTMLAttributes: o }) {
1394
- return ["br", Et(this.options.HTMLAttributes, o)];
1454
+ return ["br", wt(this.options.HTMLAttributes, o)];
1395
1455
  },
1396
1456
  renderText() {
1397
1457
  return `
1398
1458
  `;
1399
1459
  }
1400
- }), J = (o, e) => {
1460
+ }), K = (o, e) => {
1401
1461
  const t = o.resolve(e), n = t.index();
1402
1462
  if (n === 0)
1403
1463
  return;
@@ -1411,7 +1471,7 @@ const de = () => {
1411
1471
  e = Y(o.resolve(n));
1412
1472
  }
1413
1473
  return e;
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) => {
1474
+ }, tn = (o, e) => o.isBlockContainer && o.blockContent.node.type.spec.content === "inline*" && o.blockContent.node.childCount > 0 && e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*", on = (o, e, t, n) => {
1415
1475
  if (!n.isBlockContainer)
1416
1476
  throw new Error(
1417
1477
  `Attempted to merge block at position ${n.bnBlock.beforePos} into previous block at position ${t.bnBlock.beforePos}, but next block is not a block container`
@@ -1421,10 +1481,10 @@ const de = () => {
1421
1481
  n.childContainer.beforePos + 1
1422
1482
  ), r = o.doc.resolve(
1423
1483
  n.childContainer.afterPos - 1
1424
- ), i = s.blockRange(r);
1484
+ ), a = s.blockRange(r);
1425
1485
  if (e) {
1426
1486
  const c = o.doc.resolve(n.bnBlock.beforePos);
1427
- o.tr.lift(i, c.depth);
1487
+ o.tr.lift(a, c.depth);
1428
1488
  }
1429
1489
  }
1430
1490
  if (e) {
@@ -1444,18 +1504,18 @@ const de = () => {
1444
1504
  state: e,
1445
1505
  dispatch: t
1446
1506
  }) => {
1447
- const n = e.doc.resolve(o), s = Y(n), r = J(
1507
+ const n = e.doc.resolve(o), s = Y(n), r = K(
1448
1508
  e.doc,
1449
1509
  s.bnBlock.beforePos
1450
1510
  );
1451
1511
  if (!r)
1452
1512
  return !1;
1453
- const i = _e(
1513
+ const a = _e(
1454
1514
  e.doc,
1455
1515
  r
1456
1516
  );
1457
- return Jo(i, s) ? qo(e, t, i, s) : !1;
1458
- }, Yo = E.create({
1517
+ return tn(a, s) ? on(e, t, a, s) : !1;
1518
+ }, nn = E.create({
1459
1519
  priority: 50,
1460
1520
  // TODO: The shortcuts need a refactor. Do we want to use a command priority
1461
1521
  // design as there is now, or clump the logic into a single function?
@@ -1467,12 +1527,12 @@ const de = () => {
1467
1527
  () => s.undoInputRule(),
1468
1528
  // Reverts block content type to a paragraph if the selection is at the start of the block.
1469
1529
  () => s.command(({ state: r }) => {
1470
- const i = B(r);
1471
- if (!i.isBlockContainer)
1530
+ const a = B(r);
1531
+ if (!a.isBlockContainer)
1472
1532
  return !1;
1473
- const c = r.selection.from === i.blockContent.beforePos + 1, a = i.blockContent.node.type.name === "paragraph";
1474
- return c && !a ? s.command(
1475
- Ze(i.bnBlock.beforePos, {
1533
+ const c = r.selection.from === a.blockContent.beforePos + 1, i = a.blockContent.node.type.name === "paragraph";
1534
+ return c && !i ? s.command(
1535
+ et(a.bnBlock.beforePos, {
1476
1536
  type: "paragraph",
1477
1537
  props: {}
1478
1538
  })
@@ -1480,76 +1540,76 @@ const de = () => {
1480
1540
  }),
1481
1541
  // Removes a level of nesting if the block is indented if the selection is at the start of the block.
1482
1542
  () => s.command(({ state: r }) => {
1483
- const i = B(r);
1484
- if (!i.isBlockContainer)
1543
+ const a = B(r);
1544
+ if (!a.isBlockContainer)
1485
1545
  return !1;
1486
- const { blockContent: c } = i;
1546
+ const { blockContent: c } = a;
1487
1547
  return r.selection.from === c.beforePos + 1 ? s.liftListItem("blockContainer") : !1;
1488
1548
  }),
1489
1549
  // Merges block with the previous one if it isn't indented, and the selection is at the start of the
1490
1550
  // block. The target block for merging must contain inline content.
1491
1551
  () => s.command(({ state: r }) => {
1492
- const i = B(r);
1493
- if (!i.isBlockContainer)
1552
+ const a = B(r);
1553
+ if (!a.isBlockContainer)
1494
1554
  return !1;
1495
- const { bnBlock: c, blockContent: a } = i, l = r.selection.from === a.beforePos + 1, d = r.selection.empty, u = c.beforePos;
1555
+ const { bnBlock: c, blockContent: i } = a, l = r.selection.from === i.beforePos + 1, d = r.selection.empty, u = c.beforePos;
1496
1556
  return l && d ? n().command(pe(u)).scrollIntoView().run() : !1;
1497
1557
  }),
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))
1558
+ () => s.command(({ state: r, tr: a, dispatch: c }) => {
1559
+ const i = B(r);
1560
+ if (!i.isBlockContainer || !(a.selection.from === i.blockContent.beforePos + 1))
1501
1561
  return !1;
1502
- const d = i.doc.resolve(a.bnBlock.beforePos);
1562
+ const d = a.doc.resolve(i.bnBlock.beforePos);
1503
1563
  if (d.nodeBefore || d.node().type.name !== "column")
1504
1564
  return !1;
1505
- const m = i.doc.resolve(a.bnBlock.beforePos), f = i.doc.resolve(m.before()), k = f.before();
1565
+ const m = a.doc.resolve(i.bnBlock.beforePos), f = a.doc.resolve(m.before()), k = f.before();
1506
1566
  if (c) {
1507
- const g = i.doc.slice(
1508
- a.bnBlock.beforePos,
1509
- a.bnBlock.afterPos
1567
+ const g = a.doc.slice(
1568
+ i.bnBlock.beforePos,
1569
+ i.bnBlock.afterPos
1510
1570
  ).content;
1511
- i.delete(
1512
- a.bnBlock.beforePos,
1513
- a.bnBlock.afterPos
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));
1571
+ a.delete(
1572
+ i.bnBlock.beforePos,
1573
+ i.bnBlock.afterPos
1574
+ ), f.index() === 0 ? (W(a, k), a.insert(k, g), a.setSelection(
1575
+ w.near(a.doc.resolve(k))
1576
+ )) : (a.insert(f.pos - 1, g), a.setSelection(
1577
+ w.near(a.doc.resolve(f.pos - 1))
1578
+ ), W(a, k));
1519
1579
  }
1520
1580
  return !0;
1521
1581
  }),
1522
1582
  // Deletes the current block if it's an empty block with inline content,
1523
1583
  // and moves the selection to the previous block.
1524
1584
  () => s.command(({ state: r }) => {
1525
- const i = B(r);
1526
- if (!i.isBlockContainer)
1585
+ const a = B(r);
1586
+ if (!a.isBlockContainer)
1527
1587
  return !1;
1528
- if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
1529
- const a = J(
1588
+ if (a.blockContent.node.childCount === 0 && a.blockContent.node.type.spec.content === "inline*") {
1589
+ const i = K(
1530
1590
  r.doc,
1531
- i.bnBlock.beforePos
1591
+ a.bnBlock.beforePos
1532
1592
  );
1533
- if (!a || !a.isBlockContainer)
1593
+ if (!i || !i.isBlockContainer)
1534
1594
  return !1;
1535
1595
  let l = n();
1536
- if (a.blockContent.node.type.spec.content === "tableRow+") {
1537
- const f = i.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
1596
+ if (i.blockContent.node.type.spec.content === "tableRow+") {
1597
+ const f = a.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
1538
1598
  l = l.setTextSelection(
1539
1599
  f
1540
1600
  );
1541
- } else if (a.blockContent.node.type.spec.content === "") {
1542
- const d = a.blockContent.afterPos - a.blockContent.node.nodeSize;
1601
+ } else if (i.blockContent.node.type.spec.content === "") {
1602
+ const d = i.blockContent.afterPos - i.blockContent.node.nodeSize;
1543
1603
  l = l.setNodeSelection(
1544
1604
  d
1545
1605
  );
1546
1606
  } else {
1547
- const d = a.blockContent.afterPos - a.blockContent.node.nodeSize;
1607
+ const d = i.blockContent.afterPos - i.blockContent.node.nodeSize;
1548
1608
  l = l.setTextSelection(d);
1549
1609
  }
1550
1610
  return l.deleteRange({
1551
- from: i.bnBlock.beforePos,
1552
- to: i.bnBlock.afterPos
1611
+ from: a.bnBlock.beforePos,
1612
+ to: a.bnBlock.afterPos
1553
1613
  }).scrollIntoView().run();
1554
1614
  }
1555
1615
  return !1;
@@ -1558,14 +1618,14 @@ const de = () => {
1558
1618
  // when the selection is empty and at the start of the block. Moves the
1559
1619
  // current block into the deleted block's place.
1560
1620
  () => s.command(({ state: r }) => {
1561
- const i = B(r);
1562
- if (!i.isBlockContainer)
1621
+ const a = B(r);
1622
+ if (!a.isBlockContainer)
1563
1623
  throw new Error("todo");
1564
- const c = r.selection.from === i.blockContent.beforePos + 1, a = r.selection.empty, l = J(
1624
+ const c = r.selection.from === a.blockContent.beforePos + 1, i = r.selection.empty, l = K(
1565
1625
  r.doc,
1566
- i.bnBlock.beforePos
1626
+ a.bnBlock.beforePos
1567
1627
  );
1568
- if (l && c && a) {
1628
+ if (l && c && i) {
1569
1629
  const d = _e(
1570
1630
  r.doc,
1571
1631
  l
@@ -1575,8 +1635,8 @@ const de = () => {
1575
1635
  if (d.blockContent.node.type.spec.content === "" || d.blockContent.node.type.spec.content === "inline*" && d.blockContent.node.childCount === 0)
1576
1636
  return n().cut(
1577
1637
  {
1578
- from: i.bnBlock.beforePos,
1579
- to: i.bnBlock.afterPos
1638
+ from: a.bnBlock.beforePos,
1639
+ to: a.bnBlock.afterPos
1580
1640
  },
1581
1641
  d.bnBlock.afterPos
1582
1642
  ).deleteRange({
@@ -1597,12 +1657,12 @@ const de = () => {
1597
1657
  if (!r.isBlockContainer)
1598
1658
  return !1;
1599
1659
  const {
1600
- bnBlock: i,
1660
+ bnBlock: a,
1601
1661
  blockContent: c,
1602
- childContainer: a
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;
1604
- if (!d && u && p && !(a !== void 0)) {
1605
- let f = l, k = i.afterPos + 1, g = s.doc.resolve(k).depth;
1662
+ childContainer: i
1663
+ } = r, { depth: l } = s.doc.resolve(a.beforePos), d = a.afterPos === s.doc.nodeSize - 3, u = s.selection.from === c.afterPos - 1, p = s.selection.empty;
1664
+ if (!d && u && p && !(i !== void 0)) {
1665
+ let f = l, k = a.afterPos + 1, g = s.doc.resolve(k).depth;
1606
1666
  for (; g < f; )
1607
1667
  f = g, k += 2, g = s.doc.resolve(k).depth;
1608
1668
  return n.command(pe(k - 1));
@@ -1612,25 +1672,25 @@ const de = () => {
1612
1672
  ]), t = (n = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
1613
1673
  // Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
1614
1674
  // of the block.
1615
- () => s.command(({ state: i }) => {
1616
- const c = B(i);
1675
+ () => s.command(({ state: a }) => {
1676
+ const c = B(a);
1617
1677
  if (!c.isBlockContainer)
1618
1678
  return !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;
1679
+ const { bnBlock: i, blockContent: l } = c, { depth: d } = a.doc.resolve(i.beforePos), u = a.selection.$anchor.parentOffset === 0, p = a.selection.anchor === a.selection.head, m = l.node.childCount === 0, f = d > 1;
1620
1680
  return u && p && m && f ? s.liftListItem("blockContainer") : !1;
1621
1681
  }),
1622
1682
  // Creates a hard break if block is configured to do so.
1623
- () => s.command(({ state: i }) => {
1683
+ () => s.command(({ state: a }) => {
1624
1684
  var l;
1625
- const c = B(i), a = ((l = this.options.editor.schema.blockSchema[c.blockNoteType].meta) == null ? void 0 : l.hardBreakShortcut) ?? "shift+enter";
1626
- if (a === "none")
1685
+ const c = B(a), i = ((l = this.options.editor.schema.blockSchema[c.blockNoteType].meta) == null ? void 0 : l.hardBreakShortcut) ?? "shift+enter";
1686
+ if (i === "none")
1627
1687
  return !1;
1628
1688
  if (
1629
1689
  // If shortcut is not configured, or is configured as "shift+enter",
1630
1690
  // create a hard break for shift+enter, but not for enter.
1631
- a === "shift+enter" && n || // If shortcut is configured as "enter", create a hard break for
1691
+ i === "shift+enter" && n || // If shortcut is configured as "enter", create a hard break for
1632
1692
  // both enter and shift+enter.
1633
- a === "enter"
1693
+ i === "enter"
1634
1694
  ) {
1635
1695
  const d = r.storedMarks || r.selection.$head.marks().filter(
1636
1696
  (u) => this.editor.extensionManager.splittableMarks.includes(
@@ -1646,17 +1706,17 @@ const de = () => {
1646
1706
  }),
1647
1707
  // Creates a new block and moves the selection to it if the current one is empty, while the selection is also
1648
1708
  // empty & at the start of the block.
1649
- () => s.command(({ state: i, dispatch: c }) => {
1650
- const a = B(i);
1651
- if (!a.isBlockContainer)
1709
+ () => s.command(({ state: a, dispatch: c }) => {
1710
+ const i = B(a);
1711
+ if (!i.isBlockContainer)
1652
1712
  return !1;
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;
1713
+ const { bnBlock: l, blockContent: d } = i, u = a.selection.$anchor.parentOffset === 0, p = a.selection.anchor === a.selection.head, m = d.node.childCount === 0;
1654
1714
  if (u && p && m) {
1655
1715
  const f = l.afterPos, k = f + 2;
1656
1716
  if (c) {
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))
1717
+ const g = a.schema.nodes.blockContainer.createAndFill();
1718
+ a.tr.insert(f, g).scrollIntoView(), a.tr.setSelection(
1719
+ new w(a.doc.resolve(k))
1660
1720
  );
1661
1721
  }
1662
1722
  return !0;
@@ -1665,14 +1725,14 @@ const de = () => {
1665
1725
  }),
1666
1726
  // Splits the current block, moving content inside that's after the cursor to a new text block below. Also
1667
1727
  // deletes the selection beforehand, if it's not empty.
1668
- () => s.command(({ state: i, chain: c }) => {
1669
- const a = B(i);
1670
- if (!a.isBlockContainer)
1728
+ () => s.command(({ state: a, chain: c }) => {
1729
+ const i = B(a);
1730
+ if (!i.isBlockContainer)
1671
1731
  return !1;
1672
- const { blockContent: l } = a, d = i.selection.$anchor.parentOffset === 0;
1732
+ const { blockContent: l } = i, d = a.selection.$anchor.parentOffset === 0;
1673
1733
  return l.node.childCount === 0 ? !1 : (c().deleteSelection().command(
1674
- Xe(
1675
- i.selection.from,
1734
+ Ze(
1735
+ a.selection.from,
1676
1736
  d,
1677
1737
  d
1678
1738
  )
@@ -1701,7 +1761,7 @@ const de = () => {
1701
1761
  "Shift-Mod-z": () => this.options.editor.redo()
1702
1762
  };
1703
1763
  }
1704
- }), Qo = X.create({
1764
+ }), sn = X.create({
1705
1765
  name: "insertion",
1706
1766
  inclusive: !1,
1707
1767
  excludes: "deletion modification insertion",
@@ -1739,7 +1799,7 @@ const de = () => {
1739
1799
  ]
1740
1800
  };
1741
1801
  }
1742
- }), Xo = X.create({
1802
+ }), rn = X.create({
1743
1803
  name: "deletion",
1744
1804
  inclusive: !1,
1745
1805
  excludes: "insertion modification deletion",
@@ -1780,7 +1840,7 @@ const de = () => {
1780
1840
  ]
1781
1841
  };
1782
1842
  }
1783
- }), Zo = X.create({
1843
+ }), an = X.create({
1784
1844
  name: "modification",
1785
1845
  inclusive: !1,
1786
1846
  excludes: "deletion insertion",
@@ -1843,7 +1903,7 @@ const de = () => {
1843
1903
  ]
1844
1904
  };
1845
1905
  }
1846
- }), en = E.create({
1906
+ }), cn = E.create({
1847
1907
  name: "textAlignment",
1848
1908
  addGlobalAttributes() {
1849
1909
  return [
@@ -1865,25 +1925,25 @@ const de = () => {
1865
1925
  }
1866
1926
  ];
1867
1927
  }
1868
- }), tn = E.create({
1928
+ }), ln = E.create({
1869
1929
  name: "blockTextColor",
1870
1930
  addGlobalAttributes() {
1871
1931
  return [
1872
1932
  {
1873
1933
  types: ["table", "tableCell", "tableHeader"],
1874
1934
  attributes: {
1875
- textColor: et()
1935
+ textColor: tt()
1876
1936
  }
1877
1937
  }
1878
1938
  ];
1879
1939
  }
1880
- }), on = {
1940
+ }), dn = {
1881
1941
  blockColor: "data-block-color",
1882
1942
  blockStyle: "data-block-style",
1883
1943
  id: "data-id",
1884
1944
  depth: "data-depth",
1885
1945
  depthChange: "data-depth-change"
1886
- }, nn = D.create({
1946
+ }, un = D.create({
1887
1947
  name: "blockContainer",
1888
1948
  group: "blockGroupChild bnBlock",
1889
1949
  // A block always contains content, and optionally a blockGroup which contains nested blocks
@@ -1900,7 +1960,7 @@ const de = () => {
1900
1960
  if (typeof o == "string")
1901
1961
  return !1;
1902
1962
  const e = {};
1903
- for (const [t, n] of Object.entries(on))
1963
+ for (const [t, n] of Object.entries(dn))
1904
1964
  o.getAttribute(n) && (e[t] = o.getAttribute(n));
1905
1965
  return e;
1906
1966
  }
@@ -1916,21 +1976,21 @@ const de = () => {
1916
1976
  var s;
1917
1977
  const e = document.createElement("div");
1918
1978
  e.className = "bn-block-outer", e.setAttribute("data-node-type", "blockOuter");
1919
- for (const [r, i] of Object.entries(o))
1920
- r !== "class" && e.setAttribute(r, i);
1979
+ for (const [r, a] of Object.entries(o))
1980
+ r !== "class" && e.setAttribute(r, a);
1921
1981
  const t = {
1922
1982
  ...((s = this.options.domAttributes) == null ? void 0 : s.block) || {},
1923
1983
  ...o
1924
1984
  }, n = document.createElement("div");
1925
1985
  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);
1986
+ for (const [r, a] of Object.entries(t))
1987
+ r !== "class" && n.setAttribute(r, a);
1928
1988
  return e.appendChild(n), {
1929
1989
  dom: e,
1930
1990
  contentDOM: n
1931
1991
  };
1932
1992
  }
1933
- }), sn = D.create({
1993
+ }), pn = D.create({
1934
1994
  name: "blockGroup",
1935
1995
  group: "childContainer",
1936
1996
  content: "blockGroupChild+",
@@ -1960,56 +2020,56 @@ const de = () => {
1960
2020
  contentDOM: t
1961
2021
  };
1962
2022
  }
1963
- }), rn = D.create({
2023
+ }), fn = D.create({
1964
2024
  name: "doc",
1965
2025
  topNode: !0,
1966
2026
  content: "blockGroup",
1967
2027
  marks: "insertion modification deletion"
1968
- }), an = Nt(
2028
+ }), hn = Ot(
1969
2029
  ({ options: o }) => ({
1970
2030
  key: "collaboration",
1971
2031
  blockNoteExtensions: [
1972
2032
  it(o),
1973
- at(o),
1974
2033
  ct(o),
1975
- lt(),
1976
- dt(o)
2034
+ lt(o),
2035
+ dt(),
2036
+ ut(o)
1977
2037
  ]
1978
2038
  })
1979
2039
  );
1980
2040
  let fe = !1;
1981
- function cn(o, e) {
2041
+ function mn(o, e) {
1982
2042
  const t = [
1983
2043
  I.ClipboardTextSerializer,
1984
2044
  I.Commands,
1985
2045
  I.Editable,
1986
2046
  I.FocusEvents,
1987
2047
  I.Tabindex,
1988
- Ft,
2048
+ $t,
1989
2049
  me.configure({
1990
2050
  // everything from bnBlock group (nodes that represent a BlockNote block should have an id)
1991
2051
  types: ["blockContainer", "columnList", "column"],
1992
2052
  setIdAttribute: e.setIdAttribute
1993
2053
  }),
1994
- Ko,
1995
- Ht,
2054
+ en,
2055
+ Vt,
1996
2056
  // marks:
1997
- Qo,
1998
- Xo,
1999
- Zo,
2000
- $t.extend({
2057
+ sn,
2058
+ rn,
2059
+ an,
2060
+ Ht.extend({
2001
2061
  inclusive: !1
2002
2062
  }).configure({
2003
- defaultProtocol: Bt,
2063
+ defaultProtocol: Ct,
2004
2064
  // only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
2005
- protocols: fe ? [] : St
2065
+ protocols: fe ? [] : Bt
2006
2066
  }),
2007
2067
  ...Object.values(o.schema.styleSpecs).map((n) => n.implementation.mark.configure({
2008
2068
  editor: o
2009
2069
  })),
2010
- tn,
2011
- Wo,
2012
- en,
2070
+ ln,
2071
+ Zo,
2072
+ cn,
2013
2073
  // make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
2014
2074
  E.create({
2015
2075
  name: "OverrideEscape",
@@ -2021,16 +2081,16 @@ function cn(o, e) {
2021
2081
  })
2022
2082
  }),
2023
2083
  // nodes
2024
- rn,
2025
- nn.configure({
2084
+ fn,
2085
+ un.configure({
2026
2086
  editor: o,
2027
2087
  domAttributes: e.domAttributes
2028
2088
  }),
2029
- Yo.configure({
2089
+ nn.configure({
2030
2090
  editor: o,
2031
2091
  tabBehavior: e.tabBehavior
2032
2092
  }),
2033
- sn.configure({
2093
+ pn.configure({
2034
2094
  domAttributes: e.domAttributes
2035
2095
  }),
2036
2096
  ...Object.values(o.schema.inlineContentSpecs).filter((n) => n.config !== "link" && n.config !== "text").map((n) => n.implementation.node.configure({
@@ -2045,32 +2105,32 @@ function cn(o, e) {
2045
2105
  })
2046
2106
  ] : []
2047
2107
  ]),
2048
- jo(o),
2049
- Go(
2108
+ Xo(o),
2109
+ Yo(
2050
2110
  o,
2051
2111
  e.pasteHandler || ((n) => n.defaultPasteHandler())
2052
2112
  ),
2053
- wo(o)
2113
+ Do(o)
2054
2114
  ];
2055
2115
  return fe = !0, t;
2056
2116
  }
2057
- function ln(o, e) {
2117
+ function kn(o, e) {
2058
2118
  const t = [
2059
2119
  ye(),
2060
- ut(e),
2120
+ pt(e),
2061
2121
  G(e),
2062
2122
  R(e),
2063
- pt(e),
2064
- ft(),
2065
- ht(e),
2066
- Vt(e),
2123
+ ft(e),
2124
+ ht(),
2067
2125
  mt(e),
2126
+ Ut(e),
2127
+ kt(e),
2068
2128
  ge(e),
2069
- ...e.trailingBlock !== !1 ? [kt()] : []
2129
+ ...e.trailingBlock !== !1 ? [gt()] : []
2070
2130
  ];
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;
2131
+ return e.collaboration ? t.push(hn(e.collaboration)) : t.push(bt()), "table" in o.schema.blockSpecs && t.push(yt(e)), e.animations !== !1 && t.push(St()), t;
2072
2132
  }
2073
- class dn {
2133
+ class gn {
2074
2134
  constructor(e, t) {
2075
2135
  /**
2076
2136
  * A set of extension keys which are disabled by the options
@@ -2109,7 +2169,7 @@ class dn {
2109
2169
  for (const [n, s] of this.abortMap.entries())
2110
2170
  this.abortMap.delete(n), s.abort();
2111
2171
  }), this.disabledExtensions = new Set(t.disableExtensions || []);
2112
- for (const n of ln(this.editor, this.options))
2172
+ for (const n of kn(this.editor, this.options))
2113
2173
  this.addExtension(n);
2114
2174
  for (const n of this.options.extensions ?? [])
2115
2175
  this.addExtension(n);
@@ -2129,20 +2189,20 @@ class dn {
2129
2189
  console.warn("No extensions found to register", e);
2130
2190
  return;
2131
2191
  }
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(
2192
+ const n = t.map((a) => this.addExtension(a)).filter(Boolean), s = /* @__PURE__ */ new Set();
2193
+ for (const a of n)
2194
+ a != null && a.tiptapExtensions && console.warn(
2195
+ `Extension ${a.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,
2196
+ a
2197
+ ), (r = a == null ? void 0 : a.inputRules) != null && r.length && console.warn(
2198
+ `Extension ${a.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,
2199
+ a
2200
+ ), this.getProsemirrorPluginsFromExtension(a).plugins.forEach(
2141
2201
  (c) => {
2142
2202
  s.add(c);
2143
2203
  }
2144
2204
  );
2145
- this.updatePlugins((i) => [...i, ...s]);
2205
+ this.updatePlugins((a) => [...a, ...s]);
2146
2206
  }
2147
2207
  /**
2148
2208
  * Register an extension to the editor
@@ -2153,7 +2213,7 @@ class dn {
2153
2213
  let t;
2154
2214
  if (typeof e == "function" ? t = e({ editor: this.editor }) : t = e, !(!t || this.disabledExtensions.has(t.key))) {
2155
2215
  if (typeof e == "function") {
2156
- const n = t[Ot];
2216
+ const n = t[Ft];
2157
2217
  typeof n == "function" && this.extensionFactories.set(n, t);
2158
2218
  }
2159
2219
  if (this.extensions.push(t), t.blockNoteExtensions)
@@ -2197,20 +2257,20 @@ class dn {
2197
2257
  }
2198
2258
  let n = !1;
2199
2259
  const s = /* @__PURE__ */ new Set();
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);
2205
- c == null || c.forEach((a) => {
2206
- s.add(a);
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.`,
2260
+ for (const a of t) {
2261
+ this.extensions = this.extensions.filter((i) => i !== a), this.extensionFactories.forEach((i, l) => {
2262
+ i === a && this.extensionFactories.delete(l);
2263
+ }), (r = this.abortMap.get(a)) == null || r.abort(), this.abortMap.delete(a);
2264
+ const c = this.extensionPlugins.get(a);
2265
+ c == null || c.forEach((i) => {
2266
+ s.add(i);
2267
+ }), this.extensionPlugins.delete(a), a.tiptapExtensions && !n && (n = !0, console.warn(
2268
+ `Extension ${a.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,
2209
2269
  e
2210
2270
  ));
2211
2271
  }
2212
2272
  this.updatePlugins(
2213
- (i) => i.filter((c) => !s.has(c))
2273
+ (a) => a.filter((c) => !s.has(c))
2214
2274
  );
2215
2275
  }
2216
2276
  /**
@@ -2229,29 +2289,29 @@ class dn {
2229
2289
  */
2230
2290
  getTiptapExtensions() {
2231
2291
  var s;
2232
- const e = cn(
2292
+ const e = mn(
2233
2293
  this.editor,
2234
2294
  this.options
2235
- ).filter((r) => !this.disabledExtensions.has(r.name)), t = Ct(this.extensions), n = /* @__PURE__ */ new Map();
2295
+ ).filter((r) => !this.disabledExtensions.has(r.name)), t = xt(this.extensions), n = /* @__PURE__ */ new Map();
2236
2296
  for (const r of this.extensions) {
2237
2297
  r.tiptapExtensions && e.push(...r.tiptapExtensions);
2238
- const i = t(r.key), { plugins: c, inputRules: a } = this.getProsemirrorPluginsFromExtension(r);
2298
+ const a = t(r.key), { plugins: c, inputRules: i } = this.getProsemirrorPluginsFromExtension(r);
2239
2299
  c.length && e.push(
2240
2300
  E.create({
2241
2301
  name: r.key,
2242
- priority: i,
2302
+ priority: a,
2243
2303
  addProseMirrorPlugins: () => c
2244
2304
  })
2245
- ), a.length && (n.has(i) || n.set(i, []), n.get(i).push(...a));
2305
+ ), i.length && (n.has(a) || n.set(a, []), n.get(a).push(...i));
2246
2306
  }
2247
2307
  e.push(
2248
2308
  E.create({
2249
2309
  name: "blocknote-input-rules",
2250
2310
  addProseMirrorPlugins() {
2251
2311
  const r = [];
2252
- return Array.from(n.keys()).sort().reverse().forEach((i) => {
2253
- r.push(...n.get(i));
2254
- }), [_t({ rules: r })];
2312
+ return Array.from(n.keys()).sort().reverse().forEach((a) => {
2313
+ r.push(...n.get(a));
2314
+ }), [Dt({ rules: r })];
2255
2315
  }
2256
2316
  })
2257
2317
  );
@@ -2266,10 +2326,10 @@ class dn {
2266
2326
  * - input rules
2267
2327
  */
2268
2328
  getProsemirrorPluginsFromExtension(e) {
2269
- var s, r, i;
2329
+ var s, r, a;
2270
2330
  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(
2272
- ...e.inputRules.map((c) => new Dt(c.find, (a, l, d, u) => {
2331
+ return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules: n } : (this.extensionPlugins.set(e, t), (a = e.inputRules) != null && a.length && n.push(
2332
+ ...e.inputRules.map((c) => new Lt(c.find, (i, l, d, u) => {
2273
2333
  const p = c.replace({
2274
2334
  match: l,
2275
2335
  range: { from: d, to: u },
@@ -2279,17 +2339,17 @@ class dn {
2279
2339
  const m = this.editor.getTextCursorPosition();
2280
2340
  if (this.editor.schema.blockSchema[m.block.type].content !== "inline")
2281
2341
  return null;
2282
- const f = $(a.tr), k = a.tr.deleteRange(d, u);
2283
- return tt(k, f.bnBlock.beforePos, p), k;
2342
+ const f = $(i.tr), k = i.tr.deleteRange(d, u);
2343
+ return ot(k, f.bnBlock.beforePos, p), k;
2284
2344
  }
2285
2345
  return null;
2286
2346
  }))
2287
2347
  ), Object.keys(e.keyboardShortcuts || {}).length && t.push(
2288
- Lt(
2348
+ Nt(
2289
2349
  Object.fromEntries(
2290
- Object.entries(e.keyboardShortcuts).map(([c, a]) => [
2350
+ Object.entries(e.keyboardShortcuts).map(([c, i]) => [
2291
2351
  c,
2292
- () => a({ editor: this.editor })
2352
+ () => i({ editor: this.editor })
2293
2353
  ])
2294
2354
  )
2295
2355
  )
@@ -2320,25 +2380,25 @@ class dn {
2320
2380
  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;
2321
2381
  }
2322
2382
  }
2323
- function un(o, e) {
2383
+ function bn(o, e) {
2324
2384
  let { $from: t, $to: n } = e;
2325
2385
  if (t.pos > t.start() && t.pos < o.content.size) {
2326
2386
  const s = o.textBetween(t.pos, t.pos + 1);
2327
2387
  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));
2388
+ const a = o.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
2389
+ a && (t = o.resolve(t.pos - a[0].length));
2330
2390
  }
2331
2391
  }
2332
2392
  if (n.pos < n.end() && n.pos > 0) {
2333
2393
  const s = o.textBetween(n.pos - 1, n.pos);
2334
2394
  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));
2395
+ const a = o.textBetween(n.pos, n.end()).match(/^[\w\p{P}]+/u);
2396
+ a && (n = o.resolve(n.pos + a[0].length));
2337
2397
  }
2338
2398
  }
2339
2399
  return { $from: t, $to: n, from: t.pos, to: n.pos };
2340
2400
  }
2341
- function pn(o) {
2401
+ function yn(o) {
2342
2402
  const e = C(o);
2343
2403
  if (o.selection.empty || "node" in o.selection)
2344
2404
  return;
@@ -2353,19 +2413,19 @@ function pn(o) {
2353
2413
  `Error getting selection - node not found at position ${u}`
2354
2414
  );
2355
2415
  return b(p, e);
2356
- }, r = [], i = t.sharedDepth(n.pos), c = t.index(i), a = n.index(i);
2357
- if (t.depth > i) {
2416
+ }, r = [], a = t.sharedDepth(n.pos), c = t.index(a), i = n.index(a);
2417
+ if (t.depth > a) {
2358
2418
  r.push(b(t.nodeAfter, e));
2359
- for (let l = t.depth; l > i; l--)
2419
+ for (let l = t.depth; l > a; l--)
2360
2420
  if (t.node(l).type.isInGroup("childContainer")) {
2361
2421
  const u = t.index(l) + 1, p = t.node(l).childCount;
2362
2422
  for (let m = u; m < p; m++)
2363
2423
  r.push(s(m, l));
2364
2424
  }
2365
2425
  } else
2366
- r.push(s(c, i));
2367
- for (let l = c + 1; l <= a; l++)
2368
- r.push(s(l, i));
2426
+ r.push(s(c, a));
2427
+ for (let l = c + 1; l <= i; l++)
2428
+ r.push(s(l, a));
2369
2429
  if (r.length === 0)
2370
2430
  throw new Error(
2371
2431
  `Error getting selection - selection doesn't span any blocks (${o.selection})`
@@ -2374,8 +2434,8 @@ function pn(o) {
2374
2434
  blocks: r
2375
2435
  };
2376
2436
  }
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);
2437
+ function Sn(o, e, t) {
2438
+ const n = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r = C(o), a = ke(r);
2379
2439
  if (n === s)
2380
2440
  throw new Error(
2381
2441
  `Attempting to set selection with the same anchor and head blocks (id ${n})`
@@ -2383,10 +2443,10 @@ function fn(o, e, t) {
2383
2443
  const c = x(n, o.doc);
2384
2444
  if (!c)
2385
2445
  throw new Error(`Block with ID ${n} not found`);
2386
- const a = x(s, o.doc);
2387
- if (!a)
2446
+ const i = x(s, o.doc);
2447
+ if (!i)
2388
2448
  throw new Error(`Block with ID ${s} not found`);
2389
- const l = z(c), d = z(a), u = i.blockSchema[l.blockNoteType], p = i.blockSchema[d.blockNoteType];
2449
+ const l = z(c), d = z(i), u = a.blockSchema[l.blockNoteType], p = a.blockSchema[d.blockNoteType];
2390
2450
  if (!l.isBlockContainer || u.content === "none")
2391
2451
  throw new Error(
2392
2452
  `Attempting to set selection anchor in block without content (id ${n})`
@@ -2410,10 +2470,10 @@ function fn(o, e, t) {
2410
2470
  f = g + y - 2;
2411
2471
  } else
2412
2472
  f = d.blockContent.afterPos - 1;
2413
- o.setSelection(M.create(o.doc, m, f));
2473
+ o.setSelection(w.create(o.doc, m, f));
2414
2474
  }
2415
- function hn(o, e = !1) {
2416
- const t = C(o), n = e ? un(o.doc, o.selection) : o.selection;
2475
+ function Bn(o, e = !1) {
2476
+ const t = C(o), n = e ? bn(o.doc, o.selection) : o.selection;
2417
2477
  let s = n.$from, r = n.$to;
2418
2478
  for (; r.parentOffset >= r.parent.nodeSize - 2 && r.depth > 0; )
2419
2479
  r = o.doc.resolve(r.pos + 1);
@@ -2423,7 +2483,7 @@ function hn(o, e = !1) {
2423
2483
  s = o.doc.resolve(s.pos - 1);
2424
2484
  for (; s.parentOffset >= s.parent.nodeSize - 2 && s.depth > 0; )
2425
2485
  s = o.doc.resolve(s.pos + 1);
2426
- const i = je(
2486
+ const a = je(
2427
2487
  o.doc.slice(s.pos, r.pos, !0),
2428
2488
  t
2429
2489
  );
@@ -2432,50 +2492,50 @@ function hn(o, e = !1) {
2432
2492
  startPos: s.pos,
2433
2493
  endPos: r.pos
2434
2494
  },
2435
- ...i
2495
+ ...a
2436
2496
  };
2437
2497
  }
2438
- function mn(o) {
2498
+ function Cn(o) {
2439
2499
  const { bnBlock: e } = $(o), t = C(o.doc), n = o.doc.resolve(e.beforePos), s = n.nodeBefore, r = o.doc.resolve(e.afterPos).nodeAfter;
2440
- let i;
2441
- return n.depth > 1 && (i = n.node(), i.type.isInGroup("bnBlock") || (i = n.node(n.depth - 1))), {
2500
+ let a;
2501
+ return n.depth > 1 && (a = n.node(), a.type.isInGroup("bnBlock") || (a = n.node(n.depth - 1))), {
2442
2502
  block: b(e.node, t),
2443
2503
  prevBlock: s === null ? void 0 : b(s, t),
2444
2504
  nextBlock: r === null ? void 0 : b(r, t),
2445
- parentBlock: i === void 0 ? void 0 : b(i, t)
2505
+ parentBlock: a === void 0 ? void 0 : b(a, t)
2446
2506
  };
2447
2507
  }
2448
2508
  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)
2509
+ const n = typeof e == "string" ? e : e.id, s = C(o.doc), r = ke(s), a = x(n, o.doc);
2510
+ if (!a)
2451
2511
  throw new Error(`Block with ID ${n} not found`);
2452
- const c = z(i), a = r.blockSchema[c.blockNoteType].content;
2512
+ const c = z(a), i = r.blockSchema[c.blockNoteType].content;
2453
2513
  if (c.isBlockContainer) {
2454
2514
  const l = c.blockContent;
2455
- if (a === "none") {
2515
+ if (i === "none") {
2456
2516
  o.setSelection(L.create(o.doc, l.beforePos));
2457
2517
  return;
2458
2518
  }
2459
- if (a === "inline")
2519
+ if (i === "inline")
2460
2520
  t === "start" ? o.setSelection(
2461
- M.create(o.doc, l.beforePos + 1)
2521
+ w.create(o.doc, l.beforePos + 1)
2462
2522
  ) : o.setSelection(
2463
- M.create(o.doc, l.afterPos - 1)
2523
+ w.create(o.doc, l.afterPos - 1)
2464
2524
  );
2465
- else if (a === "table")
2525
+ else if (i === "table")
2466
2526
  t === "start" ? o.setSelection(
2467
- M.create(o.doc, l.beforePos + 4)
2527
+ w.create(o.doc, l.beforePos + 4)
2468
2528
  ) : o.setSelection(
2469
- M.create(o.doc, l.afterPos - 4)
2529
+ w.create(o.doc, l.afterPos - 4)
2470
2530
  );
2471
2531
  else
2472
- throw new F(a);
2532
+ throw new F(i);
2473
2533
  } else {
2474
2534
  const l = t === "start" ? c.childContainer.node.firstChild : c.childContainer.node.lastChild;
2475
2535
  De(o, l.attrs.id, t);
2476
2536
  }
2477
2537
  }
2478
- class kn {
2538
+ class xn {
2479
2539
  constructor(e) {
2480
2540
  this.editor = e;
2481
2541
  }
@@ -2486,7 +2546,7 @@ class kn {
2486
2546
  * If the selection starts / ends halfway through a block, the returned data will contain the entire block.
2487
2547
  */
2488
2548
  getSelection() {
2489
- return this.editor.transact((e) => pn(e));
2549
+ return this.editor.transact((e) => yn(e));
2490
2550
  }
2491
2551
  /**
2492
2552
  * Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
@@ -2496,7 +2556,7 @@ class kn {
2496
2556
  * only the part of the block that is included in the selection.
2497
2557
  */
2498
2558
  getSelectionCutBlocks(e = !1) {
2499
- return this.editor.transact((t) => hn(t, e));
2559
+ return this.editor.transact((t) => Bn(t, e));
2500
2560
  }
2501
2561
  /**
2502
2562
  * Sets the selection to a range of blocks.
@@ -2504,14 +2564,14 @@ class kn {
2504
2564
  * @param endBlock The identifier of the block that should be the end of the selection.
2505
2565
  */
2506
2566
  setSelection(e, t) {
2507
- return this.editor.transact((n) => fn(n, e, t));
2567
+ return this.editor.transact((n) => Sn(n, e, t));
2508
2568
  }
2509
2569
  /**
2510
2570
  * Gets a snapshot of the current text cursor position.
2511
2571
  * @returns A snapshot of the current text cursor position.
2512
2572
  */
2513
2573
  getTextCursorPosition() {
2514
- return this.editor.transact((e) => mn(e));
2574
+ return this.editor.transact((e) => Cn(e));
2515
2575
  }
2516
2576
  /**
2517
2577
  * Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could
@@ -2536,14 +2596,14 @@ class kn {
2536
2596
  if (r)
2537
2597
  return r.getBoundingClientRect();
2538
2598
  }
2539
- return wt(
2599
+ return Tt(
2540
2600
  this.editor.prosemirrorView,
2541
2601
  n,
2542
2602
  s
2543
2603
  ).toJSON();
2544
2604
  }
2545
2605
  }
2546
- class gn {
2606
+ class En {
2547
2607
  constructor(e) {
2548
2608
  /**
2549
2609
  * Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
@@ -2719,17 +2779,17 @@ class gn {
2719
2779
  throw new Error("No redo plugin found");
2720
2780
  }
2721
2781
  }
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 = "";
2782
+ function wn(o, e, t, n = { updateSelection: !0 }) {
2783
+ let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, a = !0, c = !0, i = "";
2724
2784
  if (t.forEach((l) => {
2725
- l.check(), i && l.isText && l.marks.length === 0 ? a += l.text : i = !1, c = c ? l.isBlock : !1;
2785
+ l.check(), a && l.isText && l.marks.length === 0 ? i += l.text : a = !1, c = c ? l.isBlock : !1;
2726
2786
  }), s === r && c) {
2727
2787
  const { parent: l } = o.doc.resolve(s);
2728
2788
  l.isTextblock && !l.type.spec.code && !l.childCount && (s -= 1, r += 1);
2729
2789
  }
2730
- return i ? o.insertText(a, s, r) : o.replaceWith(s, r, t), n.updateSelection && Tt(o, o.steps.length - 1, -1), !0;
2790
+ return a ? o.insertText(i, s, r) : o.replaceWith(s, r, t), n.updateSelection && Pt(o, o.steps.length - 1, -1), !0;
2731
2791
  }
2732
- class yn {
2792
+ class Mn {
2733
2793
  constructor(e) {
2734
2794
  this.editor = e;
2735
2795
  }
@@ -2741,7 +2801,7 @@ class yn {
2741
2801
  insertInlineContent(e, { updateSelection: t = !1 } = {}) {
2742
2802
  const n = O(e, this.editor.pmSchema);
2743
2803
  this.editor.transact((s) => {
2744
- bn(
2804
+ wn(
2745
2805
  s,
2746
2806
  {
2747
2807
  from: s.selection.from,
@@ -2841,22 +2901,22 @@ class yn {
2841
2901
  return;
2842
2902
  const n = this.editor.pmSchema.mark("link", { href: e });
2843
2903
  this.editor.transact((s) => {
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(
2904
+ const { from: r, to: a } = s.selection;
2905
+ t ? s.insertText(t, r, a).addMark(r, r + t.length, n) : s.setSelection(qt.create(s.doc, a)).addMark(
2846
2906
  r,
2847
- i,
2907
+ a,
2848
2908
  n
2849
2909
  );
2850
2910
  });
2851
2911
  }
2852
2912
  }
2853
- function Sn(o, e) {
2913
+ function Tn(o, e) {
2854
2914
  const t = [];
2855
2915
  return o.forEach((n, s, r) => {
2856
2916
  r !== e && t.push(n);
2857
2917
  }), Z.from(t);
2858
2918
  }
2859
- function Bn(o, e) {
2919
+ function Pn(o, e) {
2860
2920
  const t = [];
2861
2921
  for (let n = 0; n < o.childCount; n++)
2862
2922
  if (o.child(n).type.name === "tableRow")
@@ -2874,16 +2934,16 @@ function Bn(o, e) {
2874
2934
  t.push(o.child(n));
2875
2935
  return o = Z.from(t), o;
2876
2936
  }
2877
- function Cn(o, e) {
2937
+ function vn(o, e) {
2878
2938
  let t = Z.from(o.content);
2879
- if (t = Bn(t, e.state.schema), !xn(t, e))
2939
+ if (t = Pn(t, e.state.schema), !In(t, e))
2880
2940
  return new ne(t, o.openStart, o.openEnd);
2881
2941
  for (let n = 0; n < t.childCount; n++)
2882
2942
  if (t.child(n).type.spec.group === "blockContent") {
2883
2943
  const s = [t.child(n)];
2884
2944
  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));
2945
+ const a = t.child(n + 1).child(0).child(0);
2946
+ (a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (s.push(t.child(n + 1)), t = Tn(t, n + 1));
2887
2947
  }
2888
2948
  const r = e.state.schema.nodes.blockContainer.createChecked(
2889
2949
  void 0,
@@ -2893,9 +2953,9 @@ function Cn(o, e) {
2893
2953
  }
2894
2954
  return new ne(t, o.openStart, o.openEnd);
2895
2955
  }
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+";
2956
+ function In(o, e) {
2957
+ var r, a;
2958
+ const t = o.childCount === 1, n = ((r = o.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((a = o.firstChild) == null ? void 0 : a.type.spec.content) === "tableRow+";
2899
2959
  if (t) {
2900
2960
  if (n)
2901
2961
  return !1;
@@ -2907,7 +2967,7 @@ function xn(o, e) {
2907
2967
  }
2908
2968
  return !0;
2909
2969
  }
2910
- const En = {
2970
+ const An = {
2911
2971
  enableInputRules: !0,
2912
2972
  enablePasteRules: !0,
2913
2973
  enableCoreExtensions: !1
@@ -2994,7 +3054,7 @@ class Le extends Se {
2994
3054
  h(this, "unmount", () => {
2995
3055
  this._tiptapEditor.unmount();
2996
3056
  });
2997
- this.options = t, this.dictionary = t.dictionary || At, this.settings = {
3057
+ this.options = t, this.dictionary = t.dictionary || _t, this.settings = {
2998
3058
  tables: {
2999
3059
  splitCells: ((l = t == null ? void 0 : t.tables) == null ? void 0 : l.splitCells) ?? !1,
3000
3060
  cellBackgroundColor: ((d = t == null ? void 0 : t.tables) == null ? void 0 : d.cellBackgroundColor) ?? !1,
@@ -3004,7 +3064,7 @@ class Le extends Se {
3004
3064
  };
3005
3065
  const n = {
3006
3066
  defaultStyles: !0,
3007
- schema: t.schema || xt.create(),
3067
+ schema: t.schema || Et.create(),
3008
3068
  ...t,
3009
3069
  placeholders: {
3010
3070
  ...this.dictionary.placeholders,
@@ -3013,26 +3073,26 @@ class Le extends Se {
3013
3073
  };
3014
3074
  if (this.schema = n.schema, this.blockImplementations = n.schema.blockSpecs, this.inlineContentImplementations = n.schema.inlineContentSpecs, this.styleImplementations = n.schema.styleSpecs, n.uploadFile) {
3015
3075
  const S = n.uploadFile;
3016
- this.uploadFile = async (P, w) => {
3076
+ this.uploadFile = async (P, M) => {
3017
3077
  this.onUploadStartCallbacks.forEach(
3018
- (v) => v.apply(this, [w])
3078
+ (v) => v.apply(this, [M])
3019
3079
  );
3020
3080
  try {
3021
- return await S(P, w);
3081
+ return await S(P, M);
3022
3082
  } finally {
3023
3083
  this.onUploadEndCallbacks.forEach(
3024
- (v) => v.apply(this, [w])
3084
+ (v) => v.apply(this, [M])
3025
3085
  );
3026
3086
  }
3027
3087
  };
3028
3088
  }
3029
- this.resolveFileUrl = n.resolveFileUrl, this._eventManager = new fo(this), this._extensionManager = new dn(this, n);
3089
+ this.resolveFileUrl = n.resolveFileUrl, this._eventManager = new So(this), this._extensionManager = new gn(this, n);
3030
3090
  const s = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
3031
3091
  r && n.initialContent && console.warn(
3032
3092
  "When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
3033
3093
  );
3034
- const i = {
3035
- ...En,
3094
+ const a = {
3095
+ ...An,
3036
3096
  ...n._tiptapOptions,
3037
3097
  element: null,
3038
3098
  autofocus: n.autofocus ?? !1,
@@ -3052,7 +3112,7 @@ class Le extends Se {
3052
3112
  ((T = (y = n.domAttributes) == null ? void 0 : y.editor) == null ? void 0 : T.class) || ""
3053
3113
  )
3054
3114
  },
3055
- transformPasted: Cn
3115
+ transformPasted: vn
3056
3116
  }
3057
3117
  };
3058
3118
  try {
@@ -3071,23 +3131,23 @@ class Le extends Se {
3071
3131
  throw new Error(
3072
3132
  "initialContent must be a non-empty array of blocks, received: " + S
3073
3133
  );
3074
- const P = Pt(i.extensions), w = S.map(
3075
- (Ne) => q(Ne, P, this.schema.styleSchema).toJSON()
3076
- ), v = vt(
3134
+ const P = vt(a.extensions), M = S.map(
3135
+ (Ne) => J(Ne, P, this.schema.styleSchema).toJSON()
3136
+ ), v = It(
3077
3137
  {
3078
3138
  type: "doc",
3079
3139
  content: [
3080
3140
  {
3081
3141
  type: "blockGroup",
3082
- content: w
3142
+ content: M
3083
3143
  }
3084
3144
  ]
3085
3145
  },
3086
3146
  P,
3087
- i.parseOptions
3147
+ a.parseOptions
3088
3148
  );
3089
- this._tiptapEditor = new It({
3090
- ...i,
3149
+ this._tiptapEditor = new At({
3150
+ ...a,
3091
3151
  content: v.toJSON()
3092
3152
  }), this.pmSchema = this._tiptapEditor.schema;
3093
3153
  } catch (S) {
@@ -3097,13 +3157,13 @@ class Le extends Se {
3097
3157
  );
3098
3158
  }
3099
3159
  let c;
3100
- const a = this.pmSchema.nodes.doc.createAndFill;
3160
+ const i = this.pmSchema.nodes.doc.createAndFill;
3101
3161
  this.pmSchema.nodes.doc.createAndFill = (...S) => {
3102
3162
  if (c)
3103
3163
  return c;
3104
- const P = a.apply(this.pmSchema.nodes.doc, S), w = JSON.parse(JSON.stringify(P.toJSON()));
3105
- return w.content[0].content[0].attrs.id = "initialBlockId", c = He.fromJSON(this.pmSchema, w), c;
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");
3164
+ const P = i.apply(this.pmSchema.nodes.doc, S), M = JSON.parse(JSON.stringify(P.toJSON()));
3165
+ return M.content[0].content[0].attrs.id = "initialBlockId", c = He.fromJSON(this.pmSchema, M), c;
3166
+ }, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new yo(this), this._exportManager = new Io(this), this._selectionManager = new xn(this), this._stateManager = new En(this), this._styleManager = new Mn(this), this.emit("create");
3107
3167
  }
3108
3168
  static create(t) {
3109
3169
  return new Le(t ?? {});
@@ -3643,7 +3703,7 @@ class Le extends Se {
3643
3703
  return this._exportManager.pasteMarkdown(t);
3644
3704
  }
3645
3705
  }
3646
- class Xn {
3706
+ class rs {
3647
3707
  constructor(e, t, n) {
3648
3708
  this.mappings = t, this.options = n;
3649
3709
  }
@@ -3676,19 +3736,19 @@ class Xn {
3676
3736
  );
3677
3737
  }
3678
3738
  }
3679
- function Zn(o) {
3739
+ function as(o) {
3680
3740
  return {
3681
3741
  createBlockMapping: (e) => e,
3682
3742
  createInlineContentMapping: (e) => e,
3683
3743
  createStyleMapping: (e) => e
3684
3744
  };
3685
3745
  }
3686
- function es(o, ...e) {
3746
+ function is(o, ...e) {
3687
3747
  const t = [...o];
3688
3748
  for (const n of e)
3689
3749
  for (const s of n) {
3690
3750
  const r = t.findLastIndex(
3691
- (i) => i.group === s.group
3751
+ (a) => a.group === s.group
3692
3752
  );
3693
3753
  r === -1 ? t.push(s) : t.splice(r + 1, 0, s);
3694
3754
  }
@@ -3696,171 +3756,171 @@ function es(o, ...e) {
3696
3756
  }
3697
3757
  export {
3698
3758
  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,
3759
+ Et as BlockNoteSchema,
3760
+ ws as COLORS_DARK_MODE_DEFAULT,
3761
+ Ms as COLORS_DEFAULT,
3762
+ sa as CustomBlockNoteSchema,
3763
+ Ts as EMPTY_CELL_HEIGHT,
3764
+ Je as EMPTY_CELL_WIDTH,
3705
3765
  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,
3766
+ rs as Exporter,
3767
+ Ps as FILE_AUDIO_ICON_SVG,
3768
+ vs as FILE_IMAGE_ICON_SVG,
3769
+ Is as FILE_VIDEO_ICON_SVG,
3710
3770
  Pe as HTMLToBlocks,
3711
3771
  me as UniqueID,
3712
3772
  F as UnreachableCaseError,
3713
- Ms as addDefaultPropsExternalHTML,
3773
+ As as addDefaultPropsExternalHTML,
3714
3774
  H as addInlineContentAttributes,
3715
3775
  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,
3776
+ _s as addNodeAndExtensionsToSpec,
3777
+ Ds as addStyleAttributes,
3778
+ Ls as applyNonSelectableBlockFix,
3779
+ ds as assertEmpty,
3780
+ Ns as audioParse,
3781
+ Os as audioRender,
3782
+ Fs as audioToExternalHTML,
3783
+ $s as blockHasType,
3784
+ J as blockToNode,
3785
+ st as blocksToMarkdown,
3786
+ Hs as camelToDataKebab,
3787
+ Vs as captureCellAnchor,
3788
+ ra as checkPageBreakBlocksInSchema,
3789
+ rt as cleanHTMLToMarkdown,
3790
+ is as combineByGroup,
3731
3791
  Re as contentNodeToInlineContent,
3732
3792
  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,
3793
+ Us as createAudioBlockConfig,
3794
+ zs as createAudioBlockSpec,
3795
+ Gs as createBlockConfig,
3796
+ Rs as createBlockSpec,
3797
+ js as createBlockSpecFromTiptapNode,
3798
+ Ws as createBulletListItemBlockConfig,
3799
+ qs as createBulletListItemBlockSpec,
3800
+ Ks as createCheckListItemBlockSpec,
3801
+ Js as createCheckListItemConfig,
3802
+ Ys as createCodeBlockConfig,
3803
+ Qs as createCodeBlockSpec,
3804
+ Xs as createDefaultBlockDOMOutputSpec,
3805
+ Zs as createDividerBlockConfig,
3806
+ er as createDividerBlockSpec,
3807
+ Ot as createExtension,
3748
3808
  be as createExternalHTMLExporter,
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,
3809
+ tr as createFileBlockConfig,
3810
+ or as createFileBlockSpec,
3811
+ nr as createHeadingBlockConfig,
3812
+ sr as createHeadingBlockSpec,
3813
+ rr as createImageBlockConfig,
3814
+ ar as createImageBlockSpec,
3815
+ ss as createInlineContentSpec,
3816
+ Ke as createInlineContentSpecFromTipTapNode,
3817
+ ro as createInternalHTMLSerializer,
3818
+ ir as createInternalInlineContentSpec,
3819
+ cr as createInternalStyleSpec,
3820
+ lr as createNumberedListItemBlockConfig,
3821
+ dr as createNumberedListItemBlockSpec,
3822
+ aa as createPageBreakBlockConfig,
3823
+ ia as createPageBreakBlockSpec,
3824
+ ur as createParagraphBlockConfig,
3825
+ pr as createParagraphBlockSpec,
3826
+ fr as createQuoteBlockConfig,
3827
+ hr as createQuoteBlockSpec,
3828
+ pa as createStore,
3829
+ mr as createStyleSpec,
3830
+ kr as createStyleSpecFromTipTapMark,
3831
+ gr as createTableBlockSpec,
3832
+ br as createToggleListItemBlockConfig,
3833
+ yr as createToggleListItemBlockSpec,
3834
+ Sr as createToggleWrapper,
3835
+ Br as createVideoBlockConfig,
3836
+ Cr as createVideoBlockSpec,
3837
+ xr as defaultBlockSpecs,
3838
+ Er as defaultBlockToHTML,
3839
+ wr as defaultInlineContentSchema,
3840
+ Mr as defaultInlineContentSpecs,
3841
+ Tr as defaultProps,
3842
+ Pr as defaultStyleSchema,
3843
+ vr as defaultStyleSpecs,
3844
+ Ir as defaultToggledState,
3785
3845
  ze as docToBlocks,
3786
- Mr as editorHasBlockWithType,
3787
- un as expandPMRangeToWords,
3788
- wr as fileParse,
3789
- Tr as filenameFromURL,
3846
+ Ar as editorHasBlockWithType,
3847
+ bn as expandPMRangeToWords,
3848
+ _r as fileParse,
3849
+ Dr as filenameFromURL,
3790
3850
  W as fixColumnList,
3791
- Pr as formatKeyboardShortcut,
3792
- Qe as getBackgroundColorAttribute,
3793
- ao as getBlock,
3794
- ss as getBlockCache,
3795
- vr as getBlockFromPos,
3851
+ Lr as formatKeyboardShortcut,
3852
+ Xe as getBackgroundColorAttribute,
3853
+ mo as getBlock,
3854
+ us as getBlockCache,
3855
+ Nr as getBlockFromPos,
3796
3856
  z as getBlockInfo,
3797
3857
  Y as getBlockInfoFromResolvedPos,
3798
3858
  B as getBlockInfoFromSelection,
3799
3859
  $ as getBlockInfoFromTransaction,
3800
- rs as getBlockInfoWithManualOffset,
3860
+ ps as getBlockInfoWithManualOffset,
3801
3861
  ke as getBlockNoteSchema,
3802
- is as getBlockSchema,
3803
- ot as getBlocksChangedByTransaction,
3804
- as as getColspan,
3862
+ fs as getBlockSchema,
3863
+ nt as getBlocksChangedByTransaction,
3864
+ hs as getColspan,
3805
3865
  Kt as getInlineContentParseRules,
3806
- cs as getInlineContentSchema,
3807
- Ir as getInlineContentSchemaFromSpecs,
3808
- Ar as getLanguageId,
3866
+ ms as getInlineContentSchema,
3867
+ Or as getInlineContentSchemaFromSpecs,
3868
+ Fr as getLanguageId,
3809
3869
  _ as getNearestBlockPos,
3810
- lo as getNextBlock,
3870
+ go as getNextBlock,
3811
3871
  x as getNodeById,
3812
- oi as getPageBreakSlashMenuItems,
3813
- uo as getParentBlock,
3814
- _r as getParseRules,
3872
+ ca as getPageBreakSlashMenuItems,
3873
+ bo as getParentBlock,
3874
+ $r as getParseRules,
3815
3875
  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,
3876
+ ko as getPrevBlock,
3877
+ ks as getRowspan,
3878
+ Hr as getStyleParseRules,
3879
+ gs as getStyleSchema,
3880
+ Vr as getStyleSchemaFromSpecs,
3881
+ Ur as getTextAlignmentAttribute,
3882
+ tt as getTextColorAttribute,
3883
+ zr as imageParse,
3884
+ Gr as imageRender,
3885
+ Rr as imageToExternalHTML,
3826
3886
  O as inlineContentToNodes,
3827
3887
  Jt as insertBlocks,
3828
- Hr as isAppleOS,
3888
+ jr as isAppleOS,
3829
3889
  j as isEmptyColumn,
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,
3838
- Ye as isVideoUrl,
3839
- ks as mapTableCell,
3840
- Zn as mappingFactory,
3841
- Co as markdownToBlocks,
3890
+ bs as isLinkInlineContent,
3891
+ Wr as isNodeBlock,
3892
+ ys as isPartialLinkInlineContent,
3893
+ Ss as isPartialTableCell,
3894
+ qr as isSafari,
3895
+ Bs as isStyledTextInlineContent,
3896
+ Cs as isTableCell,
3897
+ Kr as isTableCellSelection,
3898
+ Qe as isVideoUrl,
3899
+ xs as mapTableCell,
3900
+ as as mappingFactory,
3901
+ vo as markdownToBlocks,
3842
3902
  ve as markdownToHTML,
3843
3903
  Q as mergeCSSClasses,
3844
- Gr as mergeParagraphs,
3904
+ Jr as mergeParagraphs,
3845
3905
  b as nodeToBlock,
3846
3906
  U as nodeToCustomInlineContent,
3847
- Rr as parseAudioElement,
3848
- jr as parseDefaultProps,
3849
- Ke as propsToAttributes,
3907
+ Yr as parseAudioElement,
3908
+ Qr as parseDefaultProps,
3909
+ qe as propsToAttributes,
3850
3910
  je as prosemirrorSliceToSlicedBlocks,
3851
- ie as removeAndInsertBlocks,
3852
- qt as removeEmptyColumns,
3911
+ ae as removeAndInsertBlocks,
3912
+ Yt as removeEmptyColumns,
3853
3913
  Ae as selectedFragmentToHTML,
3854
- Wr as stylePropsToAttributes,
3914
+ Xr as stylePropsToAttributes,
3855
3915
  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
3916
+ Zr as tablePropSchema,
3917
+ ea as trackPosition,
3918
+ Ye as updateBlock,
3919
+ et as updateBlockCommand,
3920
+ ot as updateBlockTr,
3921
+ la as uploadToTmpFilesDotOrg_DEV_ONLY,
3922
+ ta as videoParse,
3923
+ da as withPageBreak,
3924
+ oa as wrapInBlockStructure
3865
3925
  };
3866
3926
  //# sourceMappingURL=blocknote.js.map