@blocknote/core 0.47.0 → 0.47.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 (77) hide show
  1. package/dist/BlockNoteExtension-BWw0r8Gy.cjs.map +1 -1
  2. package/dist/BlockNoteExtension-C2X7LW-V.js.map +1 -1
  3. package/dist/{BlockNoteSchema-DT4bdXj5.cjs → BlockNoteSchema-CCs_V3lo.cjs} +2 -2
  4. package/dist/{BlockNoteSchema-DT4bdXj5.cjs.map → BlockNoteSchema-CCs_V3lo.cjs.map} +1 -1
  5. package/dist/{BlockNoteSchema-1r-ln0Q0.js → BlockNoteSchema-ooiKsd5B.js} +2 -2
  6. package/dist/{BlockNoteSchema-1r-ln0Q0.js.map → BlockNoteSchema-ooiKsd5B.js.map} +1 -1
  7. package/dist/{TrailingNode-DZag-Nvu.js → TrailingNode-GzE59m_7.js} +588 -416
  8. package/dist/TrailingNode-GzE59m_7.js.map +1 -0
  9. package/dist/TrailingNode-n0WdMPUl.cjs +2 -0
  10. package/dist/TrailingNode-n0WdMPUl.cjs.map +1 -0
  11. package/dist/blocknote.cjs +4 -4
  12. package/dist/blocknote.cjs.map +1 -1
  13. package/dist/blocknote.js +1206 -955
  14. package/dist/blocknote.js.map +1 -1
  15. package/dist/blocks.cjs +1 -1
  16. package/dist/blocks.js +2 -2
  17. package/dist/comments.cjs.map +1 -1
  18. package/dist/comments.js.map +1 -1
  19. package/dist/defaultBlocks-Dg9kQWXm.cjs +6 -0
  20. package/dist/defaultBlocks-Dg9kQWXm.cjs.map +1 -0
  21. package/dist/{defaultBlocks-BSOEW3GR.js → defaultBlocks-ZzGbYgQn.js} +627 -543
  22. package/dist/defaultBlocks-ZzGbYgQn.js.map +1 -0
  23. package/dist/extensions.cjs +1 -1
  24. package/dist/extensions.cjs.map +1 -1
  25. package/dist/extensions.js +33 -54
  26. package/dist/extensions.js.map +1 -1
  27. package/dist/locales.cjs +1 -1
  28. package/dist/locales.cjs.map +1 -1
  29. package/dist/locales.js +25 -24
  30. package/dist/locales.js.map +1 -1
  31. package/dist/style.css +1 -1
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/dist/webpack-stats.json +1 -1
  34. package/package.json +1 -10
  35. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +33 -7
  36. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
  37. package/src/blocks/Heading/block.ts +48 -1
  38. package/src/blocks/ListItem/ToggleListItem/block.ts +51 -1
  39. package/src/blocks/Paragraph/block.ts +1 -1
  40. package/src/blocks/getDetailsContent.ts +77 -0
  41. package/src/comments/threadstore/TipTapThreadStore.ts +5 -5
  42. package/src/comments/threadstore/tiptap/types.ts +131 -0
  43. package/src/editor/Block.css +6 -0
  44. package/src/editor/BlockNoteEditor.ts +9 -14
  45. package/src/editor/managers/ExtensionManager/symbol.ts +0 -1
  46. package/src/editor/managers/SelectionManager.ts +3 -1
  47. package/src/extensions/Collaboration/YCursorPlugin.ts +3 -1
  48. package/src/extensions/DropCursor/DropCursor.ts +262 -25
  49. package/src/extensions/DropCursor/utils.ts +195 -0
  50. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +191 -0
  51. package/src/extensions/SuggestionMenu/SuggestionMenu.ts +28 -11
  52. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +438 -53
  53. package/src/i18n/locales/fa.ts +4 -21
  54. package/src/i18n/locales/index.ts +1 -1
  55. package/src/i18n/locales/ru.ts +1 -1
  56. package/src/i18n/locales/uz.ts +22 -4
  57. package/src/index.ts +1 -0
  58. package/src/schema/blocks/createSpec.ts +35 -45
  59. package/src/schema/blocks/types.ts +101 -1
  60. package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +5 -0
  61. package/types/src/blocks/getDetailsContent.d.ts +19 -0
  62. package/types/src/comments/threadstore/TipTapThreadStore.d.ts +1 -1
  63. package/types/src/comments/threadstore/tiptap/types.d.ts +73 -0
  64. package/types/src/editor/BlockNoteEditor.d.ts +6 -9
  65. package/types/src/extensions/DropCursor/DropCursor.d.ts +42 -5
  66. package/types/src/extensions/DropCursor/utils.d.ts +48 -0
  67. package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +12 -3
  68. package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +1 -0
  69. package/types/src/index.d.ts +1 -0
  70. package/types/src/schema/blocks/createSpec.d.ts +3 -3
  71. package/types/src/schema/blocks/types.d.ts +31 -1
  72. package/dist/TrailingNode-DZag-Nvu.js.map +0 -1
  73. package/dist/TrailingNode-tesI8f7N.cjs +0 -2
  74. package/dist/TrailingNode-tesI8f7N.cjs.map +0 -1
  75. package/dist/defaultBlocks-BSOEW3GR.js.map +0 -1
  76. package/dist/defaultBlocks-D049Pbme.cjs +0 -6
  77. package/dist/defaultBlocks-D049Pbme.cjs.map +0 -1
package/dist/blocknote.js CHANGED
@@ -1,36 +1,37 @@
1
1
  var Fe = Object.defineProperty;
2
- var $e = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var h = (n, e, t) => $e(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { Slice as N, Fragment as A, DOMSerializer as he, DOMParser as He, Node as Ve } from "prosemirror-model";
5
- import { ReplaceStep as Ue, ReplaceAroundStep as z } from "prosemirror-transform";
6
- import { n as G, i as O, g as C, b as Q, a as S, t as ze, U as F, q as _, r as $, d as Ge, s as Re, u as je, v as X, w as B, x as me, y as We, z as ke, A as R } from "./blockToNode-BNoNIXU7.js";
7
- import { B as fs, G as hs, C as ms, D as ks, N as bs, E as gs, O as ys, F as Ss, H as Bs, I as Cs, L as Es, J as xs, M as Ms, K as ws } from "./blockToNode-BNoNIXU7.js";
8
- import { ak as V, al as qe, am as Ke, an as Je, aj as E, a as Ye, ao as Qe, ap as Xe, a5 as Ze, a8 as j, aq as et, ar as tt, a6 as ot, as as Z, a9 as be, at as nt } from "./defaultBlocks-BSOEW3GR.js";
9
- import { aw as Ps, av as vs, E as Is, F as As, r as _s, N as Ds, a4 as Ls, ad as Ns, aG as Os, ax as Fs, b as $s, d as Hs, e as Vs, a0 as Us, aM as zs, au as Gs, c as Rs, f as js, ag as Ws, ah as qs, aB as Ks, x as Js, y as Ys, A as Qs, z as Xs, g as Zs, h as er, T as tr, j as or, k as nr, l as sr, n as rr, o as ar, q as ir, s as cr, w as lr, aC as dr, aH as ur, B as pr, C as fr, H as hr, I as mr, J as kr, K as br, aE as gr, aI as yr, M as Sr, D as Br, G as Cr, S as Er, O as xr, Q as Mr, W as wr, U as Tr, _ as Pr, Z as vr, a2 as Ir, Y as Ar, X as _r, R as Dr, $ as Lr, m as Nr, aN as Or, aK as Fr, az as $r, af as Hr, i as Vr, ay as Ur, aD as zr, ae as Gr, a7 as Rr, t as jr, u as Wr, v as qr, aJ as Kr, ai as Jr, aL as Yr, a1 as Qr, V as Xr, p as Zr, a3 as ea, aF as ta, L as oa, aO as na, P as sa, aA as ra } from "./defaultBlocks-BSOEW3GR.js";
10
- import { j as st, k as ge, l as rt, m as at, n as it, c as W, F as ct, Y as lt, a as dt, b as ut, S as pt, B as ye, D as ft, L as ht, N as mt, P as kt, g as bt, i as gt, H as yt, h as St, e as Bt, V as Ct, d as Et } from "./TrailingNode-DZag-Nvu.js";
11
- import { s as xt, B as Mt } from "./BlockNoteSchema-1r-ln0Q0.js";
12
- import { C as ia, b as ca, c as la, a as da, g as ua, u as pa, w as fa } from "./BlockNoteSchema-1r-ln0Q0.js";
13
- import { Node as D, Extension as x, mergeAttributes as wt, Mark as ee, extensions as I, isNodeSelection as Tt, posToDOMRect as Pt, selectionToInsertionEnd as vt, findParentNodeClosestToPos as It, getSchema as At, createDocument as _t, Editor as Dt } from "@tiptap/core";
14
- import { E as Se } from "./EventEmitter-CjSwpTbz.js";
15
- import { Fragment as H, Slice as U } from "@tiptap/pm/model";
16
- import { e as Lt } from "./en-njEqD7AG.js";
17
- import { inputRules as Nt, InputRule as Ot } from "@handlewithcare/prosemirror-inputrules";
2
+ var Ve = (n, e, t) => e in n ? Fe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var k = (n, e, t) => Ve(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Slice as F, Fragment as w, DOMSerializer as me, DOMParser as Ue, Node as ze } from "prosemirror-model";
5
+ import { ReplaceStep as Re, ReplaceAroundStep as W } from "prosemirror-transform";
6
+ import { n as q, i as V, g as E, b as Z, a as C, t as Ge, U, q as D, r as z, d as je, s as We, u as qe, v, w as B, x as ke, y as Ke, z as be, A as K } from "./blockToNode-BNoNIXU7.js";
7
+ import { B as ms, G as ks, C as bs, D as gs, N as Bs, E as ys, O as Cs, F as Ss, H as xs, I as Es, L as Ps, J as Ts, M as Ms, K as ws } from "./blockToNode-BNoNIXU7.js";
8
+ import { ak as G, al as Je, am as Ye, an as Qe, aj as P, a as Xe, ao as Ze, ap as et, a5 as tt, a8 as J, aq as ot, ar as nt, a6 as st, as as ee, a9 as ge, at as rt } from "./defaultBlocks-ZzGbYgQn.js";
9
+ import { aw as Is, av as As, E as Ns, F as _s, r as Ls, N as Ds, a4 as Os, ad as $s, aG as Hs, ax as Fs, b as Vs, d as Us, e as zs, a0 as Rs, aM as Gs, au as js, c as Ws, f as qs, ag as Ks, ah as Js, aB as Ys, x as Qs, y as Xs, A as Zs, z as er, g as tr, h as or, T as nr, j as sr, k as rr, l as ir, n as ar, o as cr, q as lr, s as dr, w as ur, aC as pr, aH as fr, B as hr, C as mr, H as kr, I as br, J as gr, K as Br, aE as yr, aI as Cr, M as Sr, D as xr, G as Er, S as Pr, O as Tr, Q as Mr, W as wr, U as vr, _ as Ir, Z as Ar, a2 as Nr, Y as _r, X as Lr, R as Dr, $ as Or, m as $r, aN as Hr, ac as Fr, aK as Vr, az as Ur, ab as zr, af as Rr, i as Gr, ay as jr, aD as Wr, ae as qr, a7 as Kr, t as Jr, u as Yr, v as Qr, aa as Xr, aJ as Zr, ai as ei, aL as ti, a1 as oi, V as ni, p as si, a3 as ri, aF as ii, L as ai, aO as ci, P as li, aA as di } from "./defaultBlocks-ZzGbYgQn.js";
10
+ import { l as it, m as Be, n as at, o as ct, p as lt, d as Y, F as dt, Y as ut, a as pt, b as ft, S as ht, B as ye, c as mt, L as kt, N as bt, P as gt, h as Bt, k as yt, H as Ct, j as St, f as xt, V as Et, e as Pt } from "./TrailingNode-GzE59m_7.js";
11
+ import { D as pi, g as fi, T as hi, i as mi, s as ki, t as bi } from "./TrailingNode-GzE59m_7.js";
12
+ import { s as Tt, B as Mt } from "./BlockNoteSchema-ooiKsd5B.js";
13
+ import { C as Bi, b as yi, c as Ci, a as Si, g as xi, u as Ei, w as Pi } from "./BlockNoteSchema-ooiKsd5B.js";
14
+ import { Node as O, Extension as T, mergeAttributes as wt, Mark as te, extensions as N, isNodeSelection as vt, posToDOMRect as It, selectionToInsertionEnd as At, findParentNodeClosestToPos as Nt, getSchema as _t, createDocument as Lt, Editor as Dt } from "@tiptap/core";
15
+ import { E as Ce } from "./EventEmitter-CjSwpTbz.js";
16
+ import { Fragment as R, Slice as j } from "@tiptap/pm/model";
17
+ import { e as Ot } from "./en-njEqD7AG.js";
18
+ import { inputRules as $t, InputRule as Ht } from "@handlewithcare/prosemirror-inputrules";
18
19
  import { keymap as Ft } from "@tiptap/pm/keymap";
19
- import { c as $t, o as Ht } from "./BlockNoteExtension-C2X7LW-V.js";
20
- import { a as ma } from "./BlockNoteExtension-C2X7LW-V.js";
21
- import { Gapcursor as Vt } from "@tiptap/extensions/gap-cursor";
22
- import { Link as Ut } from "@tiptap/extension-link";
23
- import { Text as zt } from "@tiptap/extension-text";
24
- import { NodeSelection as L, TextSelection as M, Plugin as te } from "prosemirror-state";
25
- import { CellSelection as oe, TableMap as se } from "prosemirror-tables";
26
- import { S as Gt } from "./ShowSelection-B0ch3unP.js";
27
- import Rt from "remark-gfm";
28
- import jt from "remark-parse";
29
- import Wt, { defaultHandlers as re } from "remark-rehype";
30
- import qt from "rehype-stringify";
31
- import { unified as Kt } from "unified";
32
- import { TextSelection as Jt } from "@tiptap/pm/state";
33
- function Yt(n, e) {
20
+ import { c as Vt, o as Ut } from "./BlockNoteExtension-C2X7LW-V.js";
21
+ import { a as Mi } from "./BlockNoteExtension-C2X7LW-V.js";
22
+ import { Gapcursor as zt } from "@tiptap/extensions/gap-cursor";
23
+ import { Link as Rt } from "@tiptap/extension-link";
24
+ import { Text as Gt } from "@tiptap/extension-text";
25
+ import { NodeSelection as $, TextSelection as S, Plugin as oe } from "prosemirror-state";
26
+ import { CellSelection as ne, TableMap as re } from "prosemirror-tables";
27
+ import { S as jt } from "./ShowSelection-B0ch3unP.js";
28
+ import Wt from "remark-gfm";
29
+ import qt from "remark-parse";
30
+ import Kt, { defaultHandlers as ie } from "remark-rehype";
31
+ import Jt from "rehype-stringify";
32
+ import { unified as Yt } from "unified";
33
+ import { TextSelection as Qt } from "@tiptap/pm/state";
34
+ function Xt(n, e) {
34
35
  const t = [
35
36
  {
36
37
  tag: `[data-inline-content-type="${n.type}"]`,
@@ -50,9 +51,9 @@ function Yt(n, e) {
50
51
  }
51
52
  }), t;
52
53
  }
53
- function is(n, e) {
54
+ function ls(n, e) {
54
55
  var o;
55
- const t = D.create({
56
+ const t = O.create({
56
57
  name: n.type,
57
58
  inline: !0,
58
59
  group: "inline",
@@ -61,21 +62,21 @@ function is(n, e) {
61
62
  atom: n.content === "none",
62
63
  content: n.content === "styled" ? "inline*" : "",
63
64
  addAttributes() {
64
- return Ke(n.propSchema);
65
+ return Ye(n.propSchema);
65
66
  },
66
67
  addKeyboardShortcuts() {
67
- return qe(n);
68
+ return Je(n);
68
69
  },
69
70
  parseHTML() {
70
- return Yt(
71
+ return Xt(
71
72
  n,
72
73
  e.parse
73
74
  );
74
75
  },
75
76
  renderHTML({ node: s }) {
76
- const r = this.options.editor, a = e.render.call(
77
+ const r = this.options.editor, i = e.render.call(
77
78
  { renderType: "dom", props: void 0 },
78
- G(
79
+ q(
79
80
  s,
80
81
  r.schema.inlineContentSchema,
81
82
  r.schema.styleSchema
@@ -85,8 +86,8 @@ function is(n, e) {
85
86
  },
86
87
  r
87
88
  );
88
- return V(
89
- a,
89
+ return G(
90
+ i,
90
91
  n.type,
91
92
  s.attrs,
92
93
  n.propSchema
@@ -94,24 +95,24 @@ function is(n, e) {
94
95
  },
95
96
  addNodeView() {
96
97
  return (s) => {
97
- const { node: r, getPos: a } = s, c = this.options.editor, i = e.render.call(
98
+ const { node: r, getPos: i } = s, l = this.options.editor, a = e.render.call(
98
99
  { renderType: "nodeView", props: s },
99
- G(
100
+ q(
100
101
  r,
101
- c.schema.inlineContentSchema,
102
- c.schema.styleSchema
102
+ l.schema.inlineContentSchema,
103
+ l.schema.styleSchema
103
104
  ),
104
105
  // TODO: fix cast
105
- (l) => {
106
- const d = O([l], c.pmSchema), u = a();
107
- u && c.transact(
106
+ (c) => {
107
+ const d = V([c], l.pmSchema), u = i();
108
+ u && l.transact(
108
109
  (p) => p.replaceWith(u, u + r.nodeSize, d)
109
110
  );
110
111
  },
111
- c
112
+ l
112
113
  );
113
- return V(
114
- i,
114
+ return G(
115
+ a,
115
116
  n.type,
116
117
  r.attrs,
117
118
  n.propSchema
@@ -119,20 +120,20 @@ function is(n, e) {
119
120
  };
120
121
  }
121
122
  });
122
- return Je(
123
+ return Qe(
123
124
  t,
124
125
  n.propSchema,
125
126
  {
126
127
  ...e,
127
128
  toExternalHTML: e.toExternalHTML,
128
- render(s, r, a) {
129
- const c = e.render(
129
+ render(s, r, i) {
130
+ const l = e.render(
130
131
  s,
131
132
  r,
132
- a
133
+ i
133
134
  );
134
- return V(
135
- c,
135
+ return G(
136
+ l,
136
137
  n.type,
137
138
  s.props,
138
139
  n.propSchema
@@ -141,20 +142,20 @@ function is(n, e) {
141
142
  }
142
143
  );
143
144
  }
144
- function Qt(n, e, t, o = "before") {
145
- const s = typeof t == "string" ? t : t.id, r = C(n), a = e.map(
146
- (d) => Q(d, r)
147
- ), c = E(s, n.doc);
148
- if (!c)
145
+ function Zt(n, e, t, o = "before") {
146
+ const s = typeof t == "string" ? t : t.id, r = E(n), i = e.map(
147
+ (d) => Z(d, r)
148
+ ), l = P(s, n.doc);
149
+ if (!l)
149
150
  throw new Error(`Block with ID ${s} not found`);
150
- let i = c.posBeforeNode;
151
- return o === "after" && (i += c.node.nodeSize), n.step(
152
- new Ue(i, i, new N(A.from(a), 0, 0))
153
- ), a.map(
154
- (d) => S(d, r)
151
+ let a = l.posBeforeNode;
152
+ return o === "after" && (a += l.node.nodeSize), n.step(
153
+ new Re(a, a, new F(w.from(i), 0, 0))
154
+ ), i.map(
155
+ (d) => C(d, r)
155
156
  );
156
157
  }
157
- function q(n) {
158
+ function Q(n) {
158
159
  if (!n || n.type.name !== "column")
159
160
  throw new Error("Invalid columnPos: does not point to column node.");
160
161
  const e = n.firstChild;
@@ -165,21 +166,21 @@ function q(n) {
165
166
  throw new Error("Invalid blockContainer: does not have child node.");
166
167
  return n.childCount === 1 && e.childCount === 1 && t.type.name === "paragraph" && t.content.content.length === 0;
167
168
  }
168
- function Xt(n, e) {
169
+ function eo(n, e) {
169
170
  const t = n.doc.resolve(e), o = t.nodeAfter;
170
171
  if (!o || o.type.name !== "columnList")
171
172
  throw new Error(
172
173
  "Invalid columnListPos: does not point to columnList node."
173
174
  );
174
175
  for (let s = o.childCount - 1; s >= 0; s--) {
175
- const r = n.doc.resolve(t.pos + 1).posAtIndex(s), c = n.doc.resolve(r).nodeAfter;
176
- if (!c || c.type.name !== "column")
176
+ const r = n.doc.resolve(t.pos + 1).posAtIndex(s), l = n.doc.resolve(r).nodeAfter;
177
+ if (!l || l.type.name !== "column")
177
178
  throw new Error("Invalid columnPos: does not point to column node.");
178
- q(c) && n.delete(r, r + c.nodeSize);
179
+ Q(l) && n.delete(r, r + l.nodeSize);
179
180
  }
180
181
  }
181
- function K(n, e) {
182
- Xt(n, e);
182
+ function H(n, e) {
183
+ eo(n, e);
183
184
  const o = n.doc.resolve(e).nodeAfter;
184
185
  if (!o || o.type.name !== "columnList")
185
186
  throw new Error(
@@ -189,25 +190,25 @@ function K(n, e) {
189
190
  return;
190
191
  if (o.childCount < 2)
191
192
  throw new Error("Invalid columnList: contains fewer than two children.");
192
- const s = e + 1, a = n.doc.resolve(s).nodeAfter, c = e + o.nodeSize - 1, l = n.doc.resolve(c).nodeBefore;
193
- if (!a || !l)
193
+ const s = e + 1, i = n.doc.resolve(s).nodeAfter, l = e + o.nodeSize - 1, c = n.doc.resolve(l).nodeBefore;
194
+ if (!i || !c)
194
195
  throw new Error("Invalid columnList: does not contain children.");
195
- const d = q(a), u = q(l);
196
+ const d = Q(i), u = Q(c);
196
197
  if (d && u) {
197
198
  n.delete(e, e + o.nodeSize);
198
199
  return;
199
200
  }
200
201
  if (d) {
201
202
  n.step(
202
- new z(
203
+ new W(
203
204
  // Replaces `columnList`.
204
205
  e,
205
206
  e + o.nodeSize,
206
207
  // Replaces with content of last `column`.
207
- c - l.nodeSize + 1,
208
- c - 1,
208
+ l - c.nodeSize + 1,
209
+ l - 1,
209
210
  // Doesn't append anything.
210
- N.empty,
211
+ F.empty,
211
212
  0,
212
213
  !1
213
214
  )
@@ -216,15 +217,15 @@ function K(n, e) {
216
217
  }
217
218
  if (u) {
218
219
  n.step(
219
- new z(
220
+ new W(
220
221
  // Replaces `columnList`.
221
222
  e,
222
223
  e + o.nodeSize,
223
224
  // Replaces with content of first `column`.
224
225
  s + 1,
225
- s + a.nodeSize - 1,
226
+ s + i.nodeSize - 1,
226
227
  // Doesn't append anything.
227
- N.empty,
228
+ F.empty,
228
229
  0,
229
230
  !1
230
231
  )
@@ -233,29 +234,29 @@ function K(n, e) {
233
234
  }
234
235
  }
235
236
  function ae(n, e, t) {
236
- const o = C(n), s = t.map(
237
- (u) => Q(u, o)
237
+ const o = E(n), s = t.map(
238
+ (u) => Z(u, o)
238
239
  ), r = new Set(
239
240
  e.map(
240
241
  (u) => typeof u == "string" ? u : u.id
241
242
  )
242
- ), a = [], c = /* @__PURE__ */ new Set(), i = typeof e[0] == "string" ? e[0] : e[0].id;
243
- let l = 0;
243
+ ), i = [], l = /* @__PURE__ */ new Set(), a = typeof e[0] == "string" ? e[0] : e[0].id;
244
+ let c = 0;
244
245
  if (n.doc.descendants((u, p) => {
245
246
  if (r.size === 0)
246
247
  return !1;
247
248
  if (!u.type.isInGroup("bnBlock") || !r.has(u.attrs.id))
248
249
  return !0;
249
- if (a.push(S(u, o)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === i) {
250
+ if (i.push(C(u, o)), r.delete(u.attrs.id), t.length > 0 && u.attrs.id === a) {
250
251
  const b = n.doc.nodeSize;
251
252
  n.insert(p, s);
252
253
  const g = n.doc.nodeSize;
253
- l += b - g;
254
+ c += b - g;
254
255
  }
255
- const m = n.doc.nodeSize, f = n.doc.resolve(p - l);
256
- f.node().type.name === "column" ? c.add(f.before(-1)) : f.node().type.name === "columnList" && c.add(f.before()), f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ? n.delete(f.before(), f.after()) : n.delete(p - l, p - l + u.nodeSize);
257
- const k = n.doc.nodeSize;
258
- return l += m - k, !1;
256
+ const h = n.doc.nodeSize, f = n.doc.resolve(p - c);
257
+ f.node().type.name === "column" ? l.add(f.before(-1)) : f.node().type.name === "columnList" && l.add(f.before()), f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ? n.delete(f.before(), f.after()) : n.delete(p - c, p - c + u.nodeSize);
258
+ const m = n.doc.nodeSize;
259
+ return c += h - m, !1;
259
260
  }), r.size > 0) {
260
261
  const u = [...r].join(`
261
262
  `);
@@ -263,32 +264,32 @@ function ae(n, e, t) {
263
264
  "Blocks with the following IDs could not be found in the editor: " + u
264
265
  );
265
266
  }
266
- return c.forEach((u) => K(n, u)), { insertedBlocks: s.map(
267
- (u) => S(u, o)
268
- ), removedBlocks: a };
267
+ return l.forEach((u) => H(n, u)), { insertedBlocks: s.map(
268
+ (u) => C(u, o)
269
+ ), removedBlocks: i };
269
270
  }
270
- function Zt(n, e, t, o, s) {
271
+ function to(n, e, t, o, s) {
271
272
  let r;
272
273
  if (e)
273
274
  if (typeof e == "string")
274
- r = O([e], n.pmSchema, o);
275
+ r = V([e], n.pmSchema, o);
275
276
  else if (Array.isArray(e))
276
- r = O(e, n.pmSchema, o);
277
+ r = V(e, n.pmSchema, o);
277
278
  else if (e.type === "tableContent")
278
- r = ze(e, n.pmSchema);
279
+ r = Ge(e, n.pmSchema);
279
280
  else
280
- throw new F(e.type);
281
+ throw new U(e.type);
281
282
  else throw new Error("blockContent is required");
282
- const c = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
283
- for (const i of r)
284
- if (i.type.name !== "text" && n.schema.inlineContentSchema[i.type.name]) {
285
- const l = n.schema.inlineContentSpecs[i.type.name].implementation;
286
- if (l) {
287
- const d = G(
288
- i,
283
+ const l = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
284
+ for (const a of r)
285
+ if (a.type.name !== "text" && n.schema.inlineContentSchema[a.type.name]) {
286
+ const c = n.schema.inlineContentSpecs[a.type.name].implementation;
287
+ if (c) {
288
+ const d = q(
289
+ a,
289
290
  n.schema.inlineContentSchema,
290
291
  n.schema.styleSchema
291
- ), u = l.render.call(
292
+ ), u = c.render.call(
292
293
  {
293
294
  renderType: "dom",
294
295
  props: void 0
@@ -299,9 +300,9 @@ function Zt(n, e, t, o, s) {
299
300
  n
300
301
  );
301
302
  if (u) {
302
- if (c.appendChild(u.dom), u.contentDOM) {
303
+ if (l.appendChild(u.dom), u.contentDOM) {
303
304
  const p = t.serializeFragment(
304
- i.content,
305
+ a.content,
305
306
  s
306
307
  );
307
308
  u.contentDOM.dataset.editable = "", u.contentDOM.appendChild(p);
@@ -309,45 +310,45 @@ function Zt(n, e, t, o, s) {
309
310
  continue;
310
311
  }
311
312
  }
312
- } else if (i.type.name === "text") {
313
- let l = document.createTextNode(
314
- i.textContent
313
+ } else if (a.type.name === "text") {
314
+ let c = document.createTextNode(
315
+ a.textContent
315
316
  );
316
- for (const d of i.marks.toReversed())
317
+ for (const d of a.marks.toReversed())
317
318
  if (d.type.name in n.schema.styleSpecs) {
318
319
  const u = n.schema.styleSpecs[d.type.name].implementation.render(d.attrs.stringValue, n);
319
- u.contentDOM.appendChild(l), l = u.dom;
320
+ u.contentDOM.appendChild(c), c = u.dom;
320
321
  } else {
321
- const u = d.type.spec.toDOM(d, !0), p = he.renderSpec(document, u);
322
- p.contentDOM.appendChild(l), l = p.dom;
322
+ const u = d.type.spec.toDOM(d, !0), p = me.renderSpec(document, u);
323
+ p.contentDOM.appendChild(c), c = p.dom;
323
324
  }
324
- c.appendChild(l);
325
+ l.appendChild(c);
325
326
  } else {
326
- const l = t.serializeFragment(
327
- A.from([i]),
327
+ const c = t.serializeFragment(
328
+ w.from([a]),
328
329
  s
329
330
  );
330
- c.appendChild(l);
331
+ l.appendChild(c);
331
332
  }
332
- return c;
333
+ return l;
333
334
  }
334
- function eo(n, e, t, o) {
335
- var u, p, m, f, k;
335
+ function oo(n, e, t, o) {
336
+ var u, p, h, f, m;
336
337
  const s = n.pmSchema.nodes.blockContainer, r = e.props || {};
337
338
  for (const [b, g] of Object.entries(
338
339
  n.schema.blockSchema[e.type].propSchema
339
340
  ))
340
341
  !(b in r) && g.default !== void 0 && (r[b] = g.default);
341
- const a = e.children || [], i = n.blockImplementations[e.type].implementation.render.call(
342
+ const i = e.children || [], a = n.blockImplementations[e.type].implementation.render.call(
342
343
  {
343
344
  renderType: "dom",
344
345
  props: void 0
345
346
  },
346
- { ...e, props: r, children: a },
347
+ { ...e, props: r, children: i },
347
348
  n
348
349
  );
349
- if (i.contentDOM && e.content) {
350
- const b = Zt(
350
+ if (a.contentDOM && e.content) {
351
+ const b = to(
351
352
  n,
352
353
  e.content,
353
354
  // TODO
@@ -355,44 +356,44 @@ function eo(n, e, t, o) {
355
356
  e.type,
356
357
  o
357
358
  );
358
- i.contentDOM.appendChild(b);
359
+ a.contentDOM.appendChild(b);
359
360
  }
360
361
  if (n.pmSchema.nodes[e.type].isInGroup("bnBlock")) {
361
362
  if (e.children && e.children.length > 0) {
362
- const b = Be(
363
+ const b = Se(
363
364
  n,
364
365
  e.children,
365
366
  t,
366
367
  o
367
368
  );
368
- (u = i.contentDOM) == null || u.append(b);
369
+ (u = a.contentDOM) == null || u.append(b);
369
370
  }
370
- return i.dom;
371
+ return a.dom;
371
372
  }
372
- const d = (m = (p = s.spec) == null ? void 0 : p.toDOM) == null ? void 0 : m.call(
373
+ const d = (h = (p = s.spec) == null ? void 0 : p.toDOM) == null ? void 0 : h.call(
373
374
  p,
374
375
  s.create({
375
376
  id: e.id,
376
377
  ...r
377
378
  })
378
379
  );
379
- return (f = d.contentDOM) == null || f.appendChild(i.dom), e.children && e.children.length > 0 && ((k = d.contentDOM) == null || k.appendChild(
380
- Ce(n, e.children, t, o)
380
+ return (f = d.contentDOM) == null || f.appendChild(a.dom), e.children && e.children.length > 0 && ((m = d.contentDOM) == null || m.appendChild(
381
+ xe(n, e.children, t, o)
381
382
  )), d.dom;
382
383
  }
383
- function Be(n, e, t, o) {
384
+ function Se(n, e, t, o) {
384
385
  const r = ((o == null ? void 0 : o.document) ?? document).createDocumentFragment();
385
- for (const a of e) {
386
- const c = eo(n, a, t, o);
387
- r.appendChild(c);
386
+ for (const i of e) {
387
+ const l = oo(n, i, t, o);
388
+ r.appendChild(l);
388
389
  }
389
390
  return r;
390
391
  }
391
- const Ce = (n, e, t, o) => {
392
- var c;
393
- const s = n.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), a = Be(n, e, t, o);
394
- return (c = r.contentDOM) == null || c.appendChild(a), r.dom;
395
- }, to = (n) => (n.querySelectorAll(
392
+ const xe = (n, e, t, o) => {
393
+ var l;
394
+ const s = n.pmSchema.nodes.blockGroup, r = s.spec.toDOM(s.create({})), i = Se(n, e, t, o);
395
+ return (l = r.contentDOM) == null || l.appendChild(i), r.dom;
396
+ }, no = (n) => (n.querySelectorAll(
396
397
  '[data-content-type="numberedListItem"]'
397
398
  ).forEach((t) => {
398
399
  var s, r;
@@ -405,76 +406,76 @@ const Ce = (n, e, t, o) => {
405
406
  t.getAttribute("data-start") || "1"
406
407
  );
407
408
  else {
408
- const a = o.getAttribute("data-index");
409
+ const i = o.getAttribute("data-index");
409
410
  t.setAttribute(
410
411
  "data-index",
411
- (parseInt(a || "0") + 1).toString()
412
+ (parseInt(i || "0") + 1).toString()
412
413
  );
413
414
  }
414
- }), n), oo = (n) => (n.querySelectorAll(
415
+ }), n), so = (n) => (n.querySelectorAll(
415
416
  '[data-content-type="checkListItem"] input'
416
417
  ).forEach((t) => {
417
418
  t.disabled = !0;
418
- }), n), no = (n) => (n.querySelectorAll(
419
+ }), n), ro = (n) => (n.querySelectorAll(
419
420
  '.bn-toggle-wrapper[data-show-children="false"]'
420
421
  ).forEach((t) => {
421
422
  t.setAttribute("data-show-children", "true");
422
- }), n), so = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
423
+ }), n), io = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
423
424
  t.setAttribute(
424
425
  "style",
425
- `--default-cell-min-width: ${Ye}px;`
426
+ `--default-cell-min-width: ${Xe}px;`
426
427
  ), t.setAttribute("data-show-children", "true");
427
- }), n), ro = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
428
+ }), n), ao = (n) => (n.querySelectorAll('[data-content-type="table"] table').forEach((t) => {
428
429
  var r;
429
430
  const o = document.createElement("div");
430
431
  o.className = "tableWrapper";
431
432
  const s = document.createElement("div");
432
433
  s.className = "tableWrapper-inner", o.appendChild(s), (r = t.parentElement) == null || r.appendChild(o), o.appendChild(t);
433
- }), n), ao = (n) => (n.querySelectorAll(
434
+ }), n), co = (n) => (n.querySelectorAll(
434
435
  ".bn-inline-content:empty"
435
436
  ).forEach((t) => {
436
437
  const o = document.createElement("span");
437
438
  o.className = "ProseMirror-trailingBreak", o.setAttribute("style", "display: inline-block;"), t.appendChild(o);
438
- }), n), io = (n, e) => {
439
- const t = he.fromSchema(n), o = [
440
- to,
441
- oo,
439
+ }), n), lo = (n, e) => {
440
+ const t = me.fromSchema(n), o = [
442
441
  no,
443
442
  so,
444
443
  ro,
445
- ao
444
+ io,
445
+ ao,
446
+ co
446
447
  ];
447
448
  return {
448
449
  serializeBlocks: (s, r) => {
449
- let a = Ce(
450
+ let i = xe(
450
451
  e,
451
452
  s,
452
453
  t,
453
454
  r
454
455
  );
455
- for (const c of o)
456
- a = c(a);
457
- return a.outerHTML;
456
+ for (const l of o)
457
+ i = l(i);
458
+ return i.outerHTML;
458
459
  }
459
460
  };
460
461
  };
461
- function co(n) {
462
+ function uo(n) {
462
463
  return n.transact((e) => {
463
- const t = _(e.doc, e.selection.anchor);
464
- if (e.selection instanceof oe)
464
+ const t = D(e.doc, e.selection.anchor);
465
+ if (e.selection instanceof ne)
465
466
  return {
466
467
  type: "cell",
467
468
  anchorBlockId: t.node.attrs.id,
468
469
  anchorCellOffset: e.selection.$anchorCell.pos - t.posBeforeNode,
469
470
  headCellOffset: e.selection.$headCell.pos - t.posBeforeNode
470
471
  };
471
- if (e.selection instanceof L)
472
+ if (e.selection instanceof $)
472
473
  return {
473
474
  type: "node",
474
475
  anchorBlockId: t.node.attrs.id
475
476
  };
476
477
  {
477
- const o = _(e.doc, e.selection.head);
478
+ const o = D(e.doc, e.selection.head);
478
479
  return {
479
480
  type: "text",
480
481
  anchorBlockId: t.node.attrs.id,
@@ -485,79 +486,79 @@ function co(n) {
485
486
  }
486
487
  });
487
488
  }
488
- function lo(n, e) {
489
+ function po(n, e) {
489
490
  var s, r;
490
- const t = (s = E(e.anchorBlockId, n.doc)) == null ? void 0 : s.posBeforeNode;
491
+ const t = (s = P(e.anchorBlockId, n.doc)) == null ? void 0 : s.posBeforeNode;
491
492
  if (t === void 0)
492
493
  throw new Error(
493
494
  `Could not find block with ID ${e.anchorBlockId} to update selection`
494
495
  );
495
496
  let o;
496
497
  if (e.type === "cell")
497
- o = oe.create(
498
+ o = ne.create(
498
499
  n.doc,
499
500
  t + e.anchorCellOffset,
500
501
  t + e.headCellOffset
501
502
  );
502
503
  else if (e.type === "node")
503
- o = L.create(n.doc, t + 1);
504
+ o = $.create(n.doc, t + 1);
504
505
  else {
505
- const a = (r = E(e.headBlockId, n.doc)) == null ? void 0 : r.posBeforeNode;
506
- if (a === void 0)
506
+ const i = (r = P(e.headBlockId, n.doc)) == null ? void 0 : r.posBeforeNode;
507
+ if (i === void 0)
507
508
  throw new Error(
508
509
  `Could not find block with ID ${e.headBlockId} to update selection`
509
510
  );
510
- o = M.create(
511
+ o = S.create(
511
512
  n.doc,
512
513
  t + e.anchorOffset,
513
- a + e.headOffset
514
+ i + e.headOffset
514
515
  );
515
516
  }
516
517
  n.setSelection(o);
517
518
  }
518
- function J(n) {
519
- return n.map((e) => e.type === "columnList" ? e.children.map((t) => J(t.children)).flat() : {
519
+ function X(n) {
520
+ return n.map((e) => e.type === "columnList" ? e.children.map((t) => X(t.children)).flat() : {
520
521
  ...e,
521
- children: J(e.children)
522
+ children: X(e.children)
522
523
  }).flat();
523
524
  }
524
525
  function Ee(n, e, t) {
525
526
  n.transact((o) => {
526
- var a;
527
- const s = ((a = n.getSelection()) == null ? void 0 : a.blocks) || [
527
+ var i;
528
+ const s = ((i = n.getSelection()) == null ? void 0 : i.blocks) || [
528
529
  n.getTextCursorPosition().block
529
- ], r = co(n);
530
- n.removeBlocks(s), n.insertBlocks(J(s), e, t), lo(o, r);
530
+ ], r = uo(n);
531
+ n.removeBlocks(s), n.insertBlocks(X(s), e, t), po(o, r);
531
532
  });
532
533
  }
533
- function xe(n) {
534
+ function Pe(n) {
534
535
  return !n || n.type !== "columnList";
535
536
  }
536
- function Me(n, e, t) {
537
+ function Te(n, e, t) {
537
538
  let o, s;
538
539
  if (e ? e.children.length > 0 ? (o = e.children[e.children.length - 1], s = "after") : (o = e, s = "before") : t && (o = t, s = "before"), !o || !s)
539
540
  return;
540
541
  const r = n.getParentBlock(o);
541
- return xe(r) ? { referenceBlock: o, placement: s } : Me(
542
+ return Pe(r) ? { referenceBlock: o, placement: s } : Te(
542
543
  n,
543
544
  s === "after" ? o : n.getPrevBlock(o),
544
545
  r
545
546
  );
546
547
  }
547
- function we(n, e, t) {
548
+ function Me(n, e, t) {
548
549
  let o, s;
549
550
  if (e ? e.children.length > 0 ? (o = e.children[0], s = "before") : (o = e, s = "after") : t && (o = t, s = "after"), !o || !s)
550
551
  return;
551
552
  const r = n.getParentBlock(o);
552
- return xe(r) ? { referenceBlock: o, placement: s } : we(
553
+ return Pe(r) ? { referenceBlock: o, placement: s } : Me(
553
554
  n,
554
555
  s === "before" ? o : n.getNextBlock(o),
555
556
  r
556
557
  );
557
558
  }
558
- function uo(n) {
559
+ function fo(n) {
559
560
  n.transact(() => {
560
- const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || n.getTextCursorPosition().block, o = Me(
561
+ const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[0]) || n.getTextCursorPosition().block, o = Te(
561
562
  n,
562
563
  n.getPrevBlock(t),
563
564
  n.getParentBlock(t)
@@ -569,9 +570,9 @@ function uo(n) {
569
570
  );
570
571
  });
571
572
  }
572
- function po(n) {
573
+ function ho(n) {
573
574
  n.transact(() => {
574
- const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[(e == null ? void 0 : e.blocks.length) - 1]) || n.getTextCursorPosition().block, o = we(
575
+ const e = n.getSelection(), t = (e == null ? void 0 : e.blocks[(e == null ? void 0 : e.blocks.length) - 1]) || n.getTextCursorPosition().block, o = Me(
575
576
  n,
576
577
  n.getNextBlock(t),
577
578
  n.getParentBlock(t)
@@ -583,7 +584,7 @@ function po(n) {
583
584
  );
584
585
  });
585
586
  }
586
- function fo(n, e, t) {
587
+ function mo(n, e, t) {
587
588
  const { $from: o, $to: s } = n.selection, r = o.blockRange(
588
589
  s,
589
590
  (f) => f.childCount > 0 && (f.type.name === "blockGroup" || f.type.name === "column")
@@ -591,86 +592,86 @@ function fo(n, e, t) {
591
592
  );
592
593
  if (!r)
593
594
  return !1;
594
- const a = r.startIndex;
595
- if (a === 0)
595
+ const i = r.startIndex;
596
+ if (i === 0)
596
597
  return !1;
597
- const i = r.parent.child(a - 1);
598
- if (i.type !== e)
598
+ const a = r.parent.child(i - 1);
599
+ if (a.type !== e)
599
600
  return !1;
600
- const l = i.lastChild && i.lastChild.type === t, d = A.from(l ? e.create() : null), u = new N(
601
- A.from(
602
- e.create(null, A.from(t.create(null, d)))
601
+ const c = a.lastChild && a.lastChild.type === t, d = w.from(c ? e.create() : null), u = new F(
602
+ w.from(
603
+ e.create(null, w.from(t.create(null, d)))
603
604
  // change necessary to create "groupType" instead of parent.type
604
605
  ),
605
- l ? 3 : 1,
606
+ c ? 3 : 1,
606
607
  0
607
- ), p = r.start, m = r.end;
608
+ ), p = r.start, h = r.end;
608
609
  return n.step(
609
- new z(
610
- p - (l ? 3 : 1),
611
- m,
610
+ new W(
611
+ p - (c ? 3 : 1),
612
+ h,
612
613
  p,
613
- m,
614
+ h,
614
615
  u,
615
616
  1,
616
617
  !0
617
618
  )
618
619
  ).scrollIntoView(), !0;
619
620
  }
620
- function Te(n) {
621
- return n.transact((e) => fo(
621
+ function we(n) {
622
+ return n.transact((e) => mo(
622
623
  e,
623
624
  n.pmSchema.nodes.blockContainer,
624
625
  n.pmSchema.nodes.blockGroup
625
626
  ));
626
627
  }
627
- function ho(n) {
628
+ function ko(n) {
628
629
  n._tiptapEditor.commands.liftListItem("blockContainer");
629
630
  }
630
- function mo(n) {
631
+ function bo(n) {
631
632
  return n.transact((e) => {
632
- const { bnBlock: t } = $(e);
633
+ const { bnBlock: t } = z(e);
633
634
  return e.doc.resolve(t.beforePos).nodeBefore !== null;
634
635
  });
635
636
  }
636
- function ko(n) {
637
+ function go(n) {
637
638
  return n.transact((e) => {
638
- const { bnBlock: t } = $(e);
639
+ const { bnBlock: t } = z(e);
639
640
  return e.doc.resolve(t.beforePos).depth > 1;
640
641
  });
641
642
  }
642
- function bo(n, e) {
643
- const t = typeof e == "string" ? e : e.id, o = C(n), s = E(t, n);
643
+ function Bo(n, e) {
644
+ const t = typeof e == "string" ? e : e.id, o = E(n), s = P(t, n);
644
645
  if (s)
645
- return S(s.node, o);
646
+ return C(s.node, o);
646
647
  }
647
- function go(n, e) {
648
- const t = typeof e == "string" ? e : e.id, o = E(t, n), s = C(n);
648
+ function yo(n, e) {
649
+ const t = typeof e == "string" ? e : e.id, o = P(t, n), s = E(n);
649
650
  if (!o)
650
651
  return;
651
- const a = n.resolve(o.posBeforeNode).nodeBefore;
652
- if (a)
653
- return S(a, s);
652
+ const i = n.resolve(o.posBeforeNode).nodeBefore;
653
+ if (i)
654
+ return C(i, s);
654
655
  }
655
- function yo(n, e) {
656
- const t = typeof e == "string" ? e : e.id, o = E(t, n), s = C(n);
656
+ function Co(n, e) {
657
+ const t = typeof e == "string" ? e : e.id, o = P(t, n), s = E(n);
657
658
  if (!o)
658
659
  return;
659
- const a = n.resolve(
660
+ const i = n.resolve(
660
661
  o.posBeforeNode + o.node.nodeSize
661
662
  ).nodeAfter;
662
- if (a)
663
- return S(a, s);
663
+ if (i)
664
+ return C(i, s);
664
665
  }
665
666
  function So(n, e) {
666
- const t = typeof e == "string" ? e : e.id, o = C(n), s = E(t, n);
667
+ const t = typeof e == "string" ? e : e.id, o = E(n), s = P(t, n);
667
668
  if (!s)
668
669
  return;
669
- const r = n.resolve(s.posBeforeNode), a = r.node(), c = r.node(-1), i = c.type.name !== "doc" ? a.type.name === "blockGroup" ? c : a : void 0;
670
- if (i)
671
- return S(i, o);
670
+ const r = n.resolve(s.posBeforeNode), i = r.node(), l = r.node(-1), a = l.type.name !== "doc" ? i.type.name === "blockGroup" ? l : i : void 0;
671
+ if (a)
672
+ return C(a, o);
672
673
  }
673
- class Bo {
674
+ class xo {
674
675
  constructor(e) {
675
676
  this.editor = e;
676
677
  }
@@ -679,7 +680,7 @@ class Bo {
679
680
  * @returns A snapshot of all top-level (non-nested) blocks in the editor.
680
681
  */
681
682
  get document() {
682
- return this.editor.transact((e) => Ge(e.doc, this.editor.pmSchema));
683
+ return this.editor.transact((e) => je(e.doc, this.editor.pmSchema));
683
684
  }
684
685
  /**
685
686
  * Gets a snapshot of an existing block from the editor.
@@ -689,7 +690,7 @@ class Bo {
689
690
  * matching block was found.
690
691
  */
691
692
  getBlock(e) {
692
- return this.editor.transact((t) => bo(t.doc, e));
693
+ return this.editor.transact((t) => Bo(t.doc, e));
693
694
  }
694
695
  /**
695
696
  * Gets a snapshot of the previous sibling of an existing block from the
@@ -701,7 +702,7 @@ class Bo {
701
702
  * in the document.
702
703
  */
703
704
  getPrevBlock(e) {
704
- return this.editor.transact((t) => go(t.doc, e));
705
+ return this.editor.transact((t) => yo(t.doc, e));
705
706
  }
706
707
  /**
707
708
  * Gets a snapshot of the next sibling of an existing block from the editor.
@@ -712,7 +713,7 @@ class Bo {
712
713
  * the document.
713
714
  */
714
715
  getNextBlock(e) {
715
- return this.editor.transact((t) => yo(t.doc, e));
716
+ return this.editor.transact((t) => Co(t.doc, e));
716
717
  }
717
718
  /**
718
719
  * Gets a snapshot of the parent of an existing block from the editor.
@@ -735,11 +736,11 @@ class Bo {
735
736
  const o = this.document.slice();
736
737
  t && o.reverse();
737
738
  function s(r) {
738
- for (const a of r) {
739
- if (e(a) === !1)
739
+ for (const i of r) {
740
+ if (e(i) === !1)
740
741
  return !1;
741
- const c = t ? a.children.slice().reverse() : a.children;
742
- if (!s(c))
742
+ const l = t ? i.children.slice().reverse() : i.children;
743
+ if (!s(l))
743
744
  return !1;
744
745
  }
745
746
  return !0;
@@ -756,7 +757,7 @@ class Bo {
756
757
  */
757
758
  insertBlocks(e, t, o = "before") {
758
759
  return this.editor.transact(
759
- (s) => Qt(s, e, t, o)
760
+ (s) => Zt(s, e, t, o)
760
761
  );
761
762
  }
762
763
  /**
@@ -767,7 +768,7 @@ class Bo {
767
768
  * @param update A partial block which defines how the existing block should be changed.
768
769
  */
769
770
  updateBlock(e, t) {
770
- return this.editor.transact((o) => Qe(o, e, t));
771
+ return this.editor.transact((o) => Ze(o, e, t));
771
772
  }
772
773
  /**
773
774
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
@@ -794,25 +795,25 @@ class Bo {
794
795
  * Checks if the block containing the text cursor can be nested.
795
796
  */
796
797
  canNestBlock() {
797
- return mo(this.editor);
798
+ return bo(this.editor);
798
799
  }
799
800
  /**
800
801
  * Nests the block containing the text cursor into the block above it.
801
802
  */
802
803
  nestBlock() {
803
- Te(this.editor);
804
+ we(this.editor);
804
805
  }
805
806
  /**
806
807
  * Checks if the block containing the text cursor is nested.
807
808
  */
808
809
  canUnnestBlock() {
809
- return ko(this.editor);
810
+ return go(this.editor);
810
811
  }
811
812
  /**
812
813
  * Lifts the block containing the text cursor out of its parent.
813
814
  */
814
815
  unnestBlock() {
815
- ho(this.editor);
816
+ ko(this.editor);
816
817
  }
817
818
  /**
818
819
  * Moves the selected blocks up. If the previous block has children, moves
@@ -820,7 +821,7 @@ class Bo {
820
821
  * current blocks share a common parent, moves them out of & before it.
821
822
  */
822
823
  moveBlocksUp() {
823
- return uo(this.editor);
824
+ return fo(this.editor);
824
825
  }
825
826
  /**
826
827
  * Moves the selected blocks down. If the next block has children, moves
@@ -828,10 +829,10 @@ class Bo {
828
829
  * current blocks share a common parent, moves them out of & after it.
829
830
  */
830
831
  moveBlocksDown() {
831
- return po(this.editor);
832
+ return ho(this.editor);
832
833
  }
833
834
  }
834
- class Co extends Se {
835
+ class Eo extends Ce {
835
836
  constructor(e) {
836
837
  super(), this.editor = e, e.on("create", () => {
837
838
  e._tiptapEditor.on(
@@ -856,9 +857,9 @@ class Co extends Se {
856
857
  transaction: s,
857
858
  appendedTransactions: r
858
859
  }) => {
859
- !t && ie(s) || e(this.editor, {
860
+ !t && ce(s) || e(this.editor, {
860
861
  getChanges() {
861
- return st(
862
+ return it(
862
863
  s,
863
864
  r
864
865
  );
@@ -874,7 +875,7 @@ class Co extends Se {
874
875
  */
875
876
  onSelectionChange(e, t = !1) {
876
877
  const o = (s) => {
877
- !t && ie(s.transaction) || e(this.editor);
878
+ !t && ce(s.transaction) || e(this.editor);
878
879
  };
879
880
  return this.on("onSelectionChange", o), () => {
880
881
  this.off("onSelectionChange", o);
@@ -897,60 +898,60 @@ class Co extends Se {
897
898
  };
898
899
  }
899
900
  }
900
- function ie(n) {
901
+ function ce(n) {
901
902
  return !!n.getMeta("y-sync$");
902
903
  }
903
- function Eo(n) {
904
+ function Po(n) {
904
905
  return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
905
906
  }
906
- function xo(n) {
907
+ function To(n) {
907
908
  return n.nodeType === 3 && !/\S/.test(n.nodeValue || "");
908
909
  }
909
910
  function Mo(n) {
910
911
  n.querySelectorAll("li > ul, li > ol").forEach((e) => {
911
- const t = Eo(e), o = e.parentElement, s = Array.from(o.childNodes).slice(
912
+ const t = Po(e), o = e.parentElement, s = Array.from(o.childNodes).slice(
912
913
  t + 1
913
914
  );
914
915
  e.remove(), s.forEach((r) => {
915
916
  r.remove();
916
917
  }), o.insertAdjacentElement("afterend", e), s.reverse().forEach((r) => {
917
- if (xo(r))
918
+ if (To(r))
918
919
  return;
919
- const a = document.createElement("li");
920
- a.append(r), e.insertAdjacentElement("afterend", a);
920
+ const i = document.createElement("li");
921
+ i.append(r), e.insertAdjacentElement("afterend", i);
921
922
  }), o.childNodes.length === 0 && o.remove();
922
923
  });
923
924
  }
924
925
  function wo(n) {
925
926
  n.querySelectorAll("li + ul, li + ol").forEach((e) => {
926
- var r, a;
927
+ var r, i;
927
928
  const t = e.previousElementSibling, o = document.createElement("div");
928
929
  t.insertAdjacentElement("afterend", o), o.append(t);
929
930
  const s = document.createElement("div");
930
- for (s.setAttribute("data-node-type", "blockGroup"), o.append(s); ((r = o.nextElementSibling) == null ? void 0 : r.nodeName) === "UL" || ((a = o.nextElementSibling) == null ? void 0 : a.nodeName) === "OL"; )
931
+ for (s.setAttribute("data-node-type", "blockGroup"), o.append(s); ((r = o.nextElementSibling) == null ? void 0 : r.nodeName) === "UL" || ((i = o.nextElementSibling) == null ? void 0 : i.nodeName) === "OL"; )
931
932
  s.append(o.nextElementSibling);
932
933
  });
933
934
  }
934
- let ce = null;
935
- function To() {
936
- return ce || (ce = document.implementation.createHTMLDocument("title"));
935
+ let le = null;
936
+ function vo() {
937
+ return le || (le = document.implementation.createHTMLDocument("title"));
937
938
  }
938
- function Po(n) {
939
+ function Io(n) {
939
940
  if (typeof n == "string") {
940
- const e = To().createElement("div");
941
+ const e = vo().createElement("div");
941
942
  e.innerHTML = n, n = e;
942
943
  }
943
944
  return Mo(n), wo(n), n;
944
945
  }
945
- function Pe(n, e) {
946
- const t = Po(n), s = He.fromSchema(e).parse(t, {
946
+ function ve(n, e) {
947
+ const t = Io(n), s = Ue.fromSchema(e).parse(t, {
947
948
  topNode: e.nodes.blockGroup.create()
948
949
  }), r = [];
949
- for (let a = 0; a < s.childCount; a++)
950
- r.push(S(s.child(a), e));
950
+ for (let i = 0; i < s.childCount; i++)
951
+ r.push(C(s.child(i), e));
951
952
  return r;
952
953
  }
953
- function vo(n, e) {
954
+ function Ao(n, e) {
954
955
  const t = e.value ? e.value : "", o = {};
955
956
  e.lang && (o["data-language"] = e.lang);
956
957
  let s = {
@@ -966,7 +967,7 @@ function vo(n, e) {
966
967
  children: [s]
967
968
  }, n.patch(e, s), s;
968
969
  }
969
- function Io(n, e) {
970
+ function No(n, e) {
970
971
  var r;
971
972
  const t = String((e == null ? void 0 : e.url) || ""), o = e != null && e.title ? String(e.title) : void 0;
972
973
  let s = {
@@ -982,15 +983,15 @@ function Io(n, e) {
982
983
  };
983
984
  return (r = n.patch) == null || r.call(n, e, s), s = n.applyData ? n.applyData(e, s) : s, s;
984
985
  }
985
- function ve(n) {
986
- return Kt().use(jt).use(Rt).use(Wt, {
986
+ function Ie(n) {
987
+ return Yt().use(qt).use(Wt).use(Kt, {
987
988
  handlers: {
988
- ...re,
989
+ ...ie,
989
990
  image: (t, o) => {
990
991
  const s = String((o == null ? void 0 : o.url) || "");
991
- return Xe(s) ? Io(t, o) : re.image(t, o);
992
+ return et(s) ? No(t, o) : ie.image(t, o);
992
993
  },
993
- code: vo,
994
+ code: Ao,
994
995
  blockquote: (t, o) => {
995
996
  const s = {
996
997
  type: "element",
@@ -1002,13 +1003,13 @@ function ve(n) {
1002
1003
  return t.patch(o, s), t.applyData(o, s);
1003
1004
  }
1004
1005
  }
1005
- }).use(qt).processSync(n).value;
1006
+ }).use(Jt).processSync(n).value;
1006
1007
  }
1007
- function Ao(n, e) {
1008
- const t = ve(n);
1009
- return Pe(t, e);
1008
+ function _o(n, e) {
1009
+ const t = Ie(n);
1010
+ return ve(t, e);
1010
1011
  }
1011
- class _o {
1012
+ class Lo {
1012
1013
  constructor(e) {
1013
1014
  this.editor = e;
1014
1015
  }
@@ -1020,7 +1021,7 @@ class _o {
1020
1021
  * @returns The blocks, serialized as an HTML string.
1021
1022
  */
1022
1023
  blocksToHTMLLossy(e = this.editor.document) {
1023
- return ge(
1024
+ return Be(
1024
1025
  this.editor.pmSchema,
1025
1026
  this.editor
1026
1027
  ).exportBlocks(e, {});
@@ -1035,7 +1036,7 @@ class _o {
1035
1036
  * @returns The blocks, serialized as an HTML string.
1036
1037
  */
1037
1038
  blocksToFullHTML(e = this.editor.document) {
1038
- return io(
1039
+ return lo(
1039
1040
  this.editor.pmSchema,
1040
1041
  this.editor
1041
1042
  ).serializeBlocks(e, {});
@@ -1048,7 +1049,7 @@ class _o {
1048
1049
  * @returns The blocks parsed from the HTML string.
1049
1050
  */
1050
1051
  tryParseHTMLToBlocks(e) {
1051
- return Pe(e, this.editor.pmSchema);
1052
+ return ve(e, this.editor.pmSchema);
1052
1053
  }
1053
1054
  /**
1054
1055
  * Serializes blocks into a Markdown string. The output is simplified as Markdown does not support all features of
@@ -1057,7 +1058,7 @@ class _o {
1057
1058
  * @returns The blocks, serialized as a Markdown string.
1058
1059
  */
1059
1060
  blocksToMarkdownLossy(e = this.editor.document) {
1060
- return rt(e, this.editor.pmSchema, this.editor, {});
1061
+ return at(e, this.editor.pmSchema, this.editor, {});
1061
1062
  }
1062
1063
  /**
1063
1064
  * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
@@ -1067,7 +1068,7 @@ class _o {
1067
1068
  * @returns The blocks parsed from the Markdown string.
1068
1069
  */
1069
1070
  tryParseMarkdownToBlocks(e) {
1070
- return Ao(e, this.editor.pmSchema);
1071
+ return _o(e, this.editor.pmSchema);
1071
1072
  }
1072
1073
  /**
1073
1074
  * Paste HTML into the editor. Defaults to converting HTML to BlockNote HTML.
@@ -1096,11 +1097,11 @@ class _o {
1096
1097
  * @param markdown The markdown to paste.
1097
1098
  */
1098
1099
  pasteMarkdown(e) {
1099
- const t = ve(e);
1100
+ const t = Ie(e);
1100
1101
  return this.pasteHTML(t);
1101
1102
  }
1102
1103
  }
1103
- const ne = [
1104
+ const se = [
1104
1105
  "vscode-editor-data",
1105
1106
  "blocknote/html",
1106
1107
  "text/markdown",
@@ -1113,7 +1114,7 @@ function Do(n, e) {
1113
1114
  throw new Error("The strings provided are not valid file extensions.");
1114
1115
  return n === e;
1115
1116
  }
1116
- function Lo(n, e) {
1117
+ function Oo(n, e) {
1117
1118
  const t = n.split("/"), o = e.split("/");
1118
1119
  if (t.length !== 2)
1119
1120
  throw new Error(`The string ${n} is not a valid MIME type.`);
@@ -1121,7 +1122,7 @@ function Lo(n, e) {
1121
1122
  throw new Error(`The string ${e} is not a valid MIME type.`);
1122
1123
  return t[1] === "*" || o[1] === "*" ? t[0] === o[0] : (t[0] === "*" || o[0] === "*" || t[0] === o[0]) && t[1] === o[1];
1123
1124
  }
1124
- function le(n, e, t, o = "after") {
1125
+ function de(n, e, t, o = "after") {
1125
1126
  let s;
1126
1127
  return Array.isArray(e.content) && e.content.length === 0 ? s = n.updateBlock(e, t).id : s = n.insertBlocks(
1127
1128
  [t],
@@ -1129,7 +1130,7 @@ function le(n, e, t, o = "after") {
1129
1130
  o
1130
1131
  )[0].id, s;
1131
1132
  }
1132
- async function Ie(n, e) {
1133
+ async function Ae(n, e) {
1133
1134
  var r;
1134
1135
  if (!e.uploadFile) {
1135
1136
  console.warn(
@@ -1141,9 +1142,9 @@ async function Ie(n, e) {
1141
1142
  if (t === null)
1142
1143
  return;
1143
1144
  let o = null;
1144
- for (const a of ne)
1145
- if (t.types.includes(a)) {
1146
- o = a;
1145
+ for (const i of se)
1146
+ if (t.types.includes(i)) {
1147
+ o = i;
1147
1148
  break;
1148
1149
  }
1149
1150
  if (o !== "Files")
@@ -1151,53 +1152,53 @@ async function Ie(n, e) {
1151
1152
  const s = t.items;
1152
1153
  if (s) {
1153
1154
  n.preventDefault();
1154
- for (let a = 0; a < s.length; a++) {
1155
- let c = "file";
1156
- for (const l of Object.values(e.schema.blockSpecs))
1157
- for (const d of ((r = l.implementation.meta) == null ? void 0 : r.fileBlockAccept) || []) {
1158
- const u = d.startsWith("."), p = s[a].getAsFile();
1159
- if (p && (!u && p.type && Lo(s[a].type, d) || u && Do(
1155
+ for (let i = 0; i < s.length; i++) {
1156
+ let l = "file";
1157
+ for (const c of Object.values(e.schema.blockSpecs))
1158
+ for (const d of ((r = c.implementation.meta) == null ? void 0 : r.fileBlockAccept) || []) {
1159
+ const u = d.startsWith("."), p = s[i].getAsFile();
1160
+ if (p && (!u && p.type && Oo(s[i].type, d) || u && Do(
1160
1161
  "." + p.name.split(".").pop(),
1161
1162
  d
1162
1163
  ))) {
1163
- c = l.config.type;
1164
+ l = c.config.type;
1164
1165
  break;
1165
1166
  }
1166
1167
  }
1167
- const i = s[a].getAsFile();
1168
- if (i) {
1169
- const l = {
1170
- type: c,
1168
+ const a = s[i].getAsFile();
1169
+ if (a) {
1170
+ const c = {
1171
+ type: l,
1171
1172
  props: {
1172
- name: i.name
1173
+ name: a.name
1173
1174
  }
1174
1175
  };
1175
1176
  let d;
1176
1177
  if (n.type === "paste") {
1177
- const m = e.getTextCursorPosition().block;
1178
- d = le(e, m, l);
1178
+ const h = e.getTextCursorPosition().block;
1179
+ d = de(e, h, c);
1179
1180
  } else if (n.type === "drop") {
1180
- const m = {
1181
+ const h = {
1181
1182
  left: n.clientX,
1182
1183
  top: n.clientY
1183
- }, f = e.prosemirrorView.posAtCoords(m);
1184
+ }, f = e.prosemirrorView.posAtCoords(h);
1184
1185
  if (!f)
1185
1186
  return;
1186
- d = e.transact((k) => {
1187
+ d = e.transact((m) => {
1187
1188
  var y;
1188
- const b = _(k.doc, f.pos), g = (y = e.domElement) == null ? void 0 : y.querySelector(
1189
+ const b = D(m.doc, f.pos), g = (y = e.domElement) == null ? void 0 : y.querySelector(
1189
1190
  `[data-id="${b.node.attrs.id}"]`
1190
- ), w = g == null ? void 0 : g.getBoundingClientRect();
1191
- return le(
1191
+ ), x = g == null ? void 0 : g.getBoundingClientRect();
1192
+ return de(
1192
1193
  e,
1193
1194
  e.getBlock(b.node.attrs.id),
1194
- l,
1195
- w && (w.top + w.bottom) / 2 > m.top ? "before" : "after"
1195
+ c,
1196
+ x && (x.top + x.bottom) / 2 > h.top ? "before" : "after"
1196
1197
  );
1197
1198
  });
1198
1199
  } else
1199
1200
  return;
1200
- const u = await e.uploadFile(i, d), p = typeof u == "string" ? {
1201
+ const u = await e.uploadFile(a, d), p = typeof u == "string" ? {
1201
1202
  props: {
1202
1203
  url: u
1203
1204
  }
@@ -1207,31 +1208,31 @@ async function Ie(n, e) {
1207
1208
  }
1208
1209
  }
1209
1210
  }
1210
- const No = (n) => x.create({
1211
+ const $o = (n) => T.create({
1211
1212
  name: "dropFile",
1212
1213
  addProseMirrorPlugins() {
1213
1214
  return [
1214
- new te({
1215
+ new oe({
1215
1216
  props: {
1216
1217
  handleDOMEvents: {
1217
1218
  drop(e, t) {
1218
1219
  if (!n.isEditable)
1219
1220
  return;
1220
1221
  let o = null;
1221
- for (const s of ne)
1222
+ for (const s of se)
1222
1223
  if (t.dataTransfer.types.includes(s)) {
1223
1224
  o = s;
1224
1225
  break;
1225
1226
  }
1226
- return o === null ? !0 : o === "Files" ? (Ie(t, n), !0) : !1;
1227
+ return o === null ? !0 : o === "Files" ? (Ae(t, n), !0) : !1;
1227
1228
  }
1228
1229
  }
1229
1230
  }
1230
1231
  })
1231
1232
  ];
1232
1233
  }
1233
- }), Oo = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, Fo = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, $o = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Ho = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, Vo = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Uo = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, zo = /\n{2} {0,3}-{2,48}\n{2}/, Go = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, Ro = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, jo = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Wo = /^\s*\|(.+\|)+\s*$/m, qo = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Ko = /^\s*\|(.+\|)+\s*$/m, Jo = (n) => Oo.test(n) || Fo.test(n) || $o.test(n) || Ho.test(n) || Vo.test(n) || Uo.test(n) || zo.test(n) || Go.test(n) || Ro.test(n) || jo.test(n) || Wo.test(n) || qo.test(n) || Ko.test(n);
1234
- async function Yo(n, e) {
1234
+ }), Ho = /(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/, Fo = /(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/, Vo = /\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/, Uo = /(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/, zo = /(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/, Ro = /(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/, Go = /\n{2} {0,3}-{2,48}\n{2}/, jo = /(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/, Wo = /(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/, qo = /(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/, Ko = /^\s*\|(.+\|)+\s*$/m, Jo = /^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m, Yo = /^\s*\|(.+\|)+\s*$/m, Qo = (n) => Ho.test(n) || Fo.test(n) || Vo.test(n) || Uo.test(n) || zo.test(n) || Ro.test(n) || Go.test(n) || jo.test(n) || Wo.test(n) || qo.test(n) || Ko.test(n) || Jo.test(n) || Yo.test(n);
1235
+ async function Xo(n, e) {
1235
1236
  const { schema: t } = e.state;
1236
1237
  if (!n.clipboardData)
1237
1238
  return !1;
@@ -1240,58 +1241,58 @@ async function Yo(n, e) {
1240
1241
  return !1;
1241
1242
  if (!t.nodes.codeBlock)
1242
1243
  return e.pasteText(o), !0;
1243
- const s = n.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0, a = r == null ? void 0 : r.mode;
1244
- return a ? (e.pasteHTML(
1245
- `<pre><code class="language-${a}">${o.replace(
1244
+ const s = n.clipboardData.getData("vscode-editor-data"), r = s ? JSON.parse(s) : void 0, i = r == null ? void 0 : r.mode;
1245
+ return i ? (e.pasteHTML(
1246
+ `<pre><code class="language-${i}">${o.replace(
1246
1247
  /\r\n?/g,
1247
1248
  `
1248
1249
  `
1249
1250
  )}</code></pre>`
1250
1251
  ), !0) : !1;
1251
1252
  }
1252
- function Qo({
1253
+ function Zo({
1253
1254
  event: n,
1254
1255
  editor: e,
1255
1256
  prioritizeMarkdownOverHTML: t,
1256
1257
  plainTextAsMarkdown: o
1257
1258
  }) {
1258
- var c;
1259
+ var l;
1259
1260
  if (e.transact(
1260
- (i) => i.selection.$from.parent.type.spec.code && i.selection.$to.parent.type.spec.code
1261
+ (a) => a.selection.$from.parent.type.spec.code && a.selection.$to.parent.type.spec.code
1261
1262
  )) {
1262
- const i = (c = n.clipboardData) == null ? void 0 : c.getData("text/plain");
1263
- if (i)
1264
- return e.pasteText(i), !0;
1263
+ const a = (l = n.clipboardData) == null ? void 0 : l.getData("text/plain");
1264
+ if (a)
1265
+ return e.pasteText(a), !0;
1265
1266
  }
1266
1267
  let r;
1267
- for (const i of ne)
1268
- if (n.clipboardData.types.includes(i)) {
1269
- r = i;
1268
+ for (const a of se)
1269
+ if (n.clipboardData.types.includes(a)) {
1270
+ r = a;
1270
1271
  break;
1271
1272
  }
1272
1273
  if (!r)
1273
1274
  return !0;
1274
1275
  if (r === "vscode-editor-data")
1275
- return Yo(n, e.prosemirrorView), !0;
1276
+ return Xo(n, e.prosemirrorView), !0;
1276
1277
  if (r === "Files")
1277
- return Ie(n, e), !0;
1278
- const a = n.clipboardData.getData(r);
1278
+ return Ae(n, e), !0;
1279
+ const i = n.clipboardData.getData(r);
1279
1280
  if (r === "blocknote/html")
1280
- return e.pasteHTML(a, !0), !0;
1281
+ return e.pasteHTML(i, !0), !0;
1281
1282
  if (r === "text/markdown")
1282
- return e.pasteMarkdown(a), !0;
1283
+ return e.pasteMarkdown(i), !0;
1283
1284
  if (t) {
1284
- const i = n.clipboardData.getData("text/plain");
1285
- if (Jo(i))
1286
- return e.pasteMarkdown(i), !0;
1285
+ const a = n.clipboardData.getData("text/plain");
1286
+ if (Qo(a))
1287
+ return e.pasteMarkdown(a), !0;
1287
1288
  }
1288
- return r === "text/html" ? (e.pasteHTML(a), !0) : o ? (e.pasteMarkdown(a), !0) : (e.pasteText(a), !0);
1289
+ return r === "text/html" ? (e.pasteHTML(i), !0) : o ? (e.pasteMarkdown(i), !0) : (e.pasteText(i), !0);
1289
1290
  }
1290
- const Xo = (n, e) => x.create({
1291
+ const en = (n, e) => T.create({
1291
1292
  name: "pasteFromClipboard",
1292
1293
  addProseMirrorPlugins() {
1293
1294
  return [
1294
- new te({
1295
+ new oe({
1295
1296
  props: {
1296
1297
  handleDOMEvents: {
1297
1298
  paste(t, o) {
@@ -1302,7 +1303,7 @@ const Xo = (n, e) => x.create({
1302
1303
  defaultPasteHandler: ({
1303
1304
  prioritizeMarkdownOverHTML: s = !0,
1304
1305
  plainTextAsMarkdown: r = !0
1305
- } = {}) => Qo({
1306
+ } = {}) => Zo({
1306
1307
  event: o,
1307
1308
  editor: n,
1308
1309
  prioritizeMarkdownOverHTML: s,
@@ -1316,67 +1317,67 @@ const Xo = (n, e) => x.create({
1316
1317
  ];
1317
1318
  }
1318
1319
  });
1319
- function Zo(n, e, t) {
1320
- var c;
1320
+ function tn(n, e, t) {
1321
+ var l;
1321
1322
  let o = !1;
1322
- const s = n.state.selection instanceof oe;
1323
+ const s = n.state.selection instanceof ne;
1323
1324
  if (!s) {
1324
- const i = n.state.doc.slice(
1325
+ const a = n.state.doc.slice(
1325
1326
  n.state.selection.from,
1326
1327
  n.state.selection.to,
1327
1328
  !1
1328
- ).content, l = [];
1329
- for (let d = 0; d < i.childCount; d++)
1330
- l.push(i.child(d));
1331
- o = l.find(
1329
+ ).content, c = [];
1330
+ for (let d = 0; d < a.childCount; d++)
1331
+ c.push(a.child(d));
1332
+ o = c.find(
1332
1333
  (d) => d.type.isInGroup("bnBlock") || d.type.name === "blockGroup" || d.type.spec.group === "blockContent"
1333
- ) === void 0, o && (e = i);
1334
+ ) === void 0, o && (e = a);
1334
1335
  }
1335
1336
  let r;
1336
- const a = ge(
1337
+ const i = Be(
1337
1338
  n.state.schema,
1338
1339
  t
1339
1340
  );
1340
1341
  if (s) {
1341
- ((c = e.firstChild) == null ? void 0 : c.type.name) === "table" && (e = e.firstChild.content);
1342
- const i = Re(
1342
+ ((l = e.firstChild) == null ? void 0 : l.type.name) === "table" && (e = e.firstChild.content);
1343
+ const a = We(
1343
1344
  e,
1344
1345
  t.schema.inlineContentSchema,
1345
1346
  t.schema.styleSchema
1346
1347
  );
1347
- r = `<table>${a.exportInlineContent(
1348
- i,
1348
+ r = `<table>${i.exportInlineContent(
1349
+ a,
1349
1350
  {}
1350
1351
  )}</table>`;
1351
1352
  } else if (o) {
1352
- const i = je(
1353
+ const a = qe(
1353
1354
  e,
1354
1355
  t.schema.inlineContentSchema,
1355
1356
  t.schema.styleSchema
1356
1357
  );
1357
- r = a.exportInlineContent(i, {});
1358
+ r = i.exportInlineContent(a, {});
1358
1359
  } else {
1359
- const i = it(e);
1360
- r = a.exportBlocks(i, {});
1360
+ const a = lt(e);
1361
+ r = i.exportBlocks(a, {});
1361
1362
  }
1362
1363
  return r;
1363
1364
  }
1364
- function Ae(n, e) {
1365
+ function Ne(n, e) {
1365
1366
  "node" in n.state.selection && n.state.selection.node.type.spec.group === "blockContent" && e.transact(
1366
- (a) => a.setSelection(
1367
- new L(a.doc.resolve(n.state.selection.from - 1))
1367
+ (i) => i.setSelection(
1368
+ new $(i.doc.resolve(n.state.selection.from - 1))
1368
1369
  )
1369
1370
  );
1370
1371
  const t = n.serializeForClipboard(
1371
1372
  n.state.selection.content()
1372
- ).dom.innerHTML, o = n.state.selection.content().content, s = Zo(
1373
+ ).dom.innerHTML, o = n.state.selection.content().content, s = tn(
1373
1374
  n,
1374
1375
  o,
1375
1376
  e
1376
- ), r = at(s);
1377
+ ), r = ct(s);
1377
1378
  return { clipboardHTML: t, externalHTML: s, markdown: r };
1378
1379
  }
1379
- const de = () => {
1380
+ const ue = () => {
1380
1381
  const n = window.getSelection();
1381
1382
  if (!n || n.isCollapsed)
1382
1383
  return !0;
@@ -1387,25 +1388,25 @@ const de = () => {
1387
1388
  e = e.parentElement;
1388
1389
  }
1389
1390
  return !1;
1390
- }, ue = (n, e, t) => {
1391
+ }, pe = (n, e, t) => {
1391
1392
  t.preventDefault(), t.clipboardData.clearData();
1392
- const { clipboardHTML: o, externalHTML: s, markdown: r } = Ae(
1393
+ const { clipboardHTML: o, externalHTML: s, markdown: r } = Ne(
1393
1394
  e,
1394
1395
  n
1395
1396
  );
1396
1397
  t.clipboardData.setData("blocknote/html", o), t.clipboardData.setData("text/html", s), t.clipboardData.setData("text/plain", r);
1397
- }, en = (n) => x.create({
1398
+ }, on = (n) => T.create({
1398
1399
  name: "copyToClipboard",
1399
1400
  addProseMirrorPlugins() {
1400
1401
  return [
1401
- new te({
1402
+ new oe({
1402
1403
  props: {
1403
1404
  handleDOMEvents: {
1404
1405
  copy(e, t) {
1405
- return de() || ue(n, e, t), !0;
1406
+ return ue() || pe(n, e, t), !0;
1406
1407
  },
1407
1408
  cut(e, t) {
1408
- return de() || (ue(n, e, t), e.editable && e.dispatch(e.state.tr.deleteSelection())), !0;
1409
+ return ue() || (pe(n, e, t), e.editable && e.dispatch(e.state.tr.deleteSelection())), !0;
1409
1410
  },
1410
1411
  // This is for the use-case in which only a block without content
1411
1412
  // is selected, e.g. an image block, and dragged (not using the
@@ -1414,13 +1415,13 @@ const de = () => {
1414
1415
  if (!("node" in e.state.selection) || e.state.selection.node.type.spec.group !== "blockContent")
1415
1416
  return;
1416
1417
  n.transact(
1417
- (a) => a.setSelection(
1418
- new L(
1419
- a.doc.resolve(e.state.selection.from - 1)
1418
+ (i) => i.setSelection(
1419
+ new $(
1420
+ i.doc.resolve(e.state.selection.from - 1)
1420
1421
  )
1421
1422
  )
1422
1423
  ), t.preventDefault(), t.dataTransfer.clearData();
1423
- const { clipboardHTML: o, externalHTML: s, markdown: r } = Ae(e, n);
1424
+ const { clipboardHTML: o, externalHTML: s, markdown: r } = Ne(e, n);
1424
1425
  return t.dataTransfer.setData("blocknote/html", o), t.dataTransfer.setData("text/html", s), t.dataTransfer.setData("text/plain", r), !0;
1425
1426
  }
1426
1427
  }
@@ -1428,19 +1429,19 @@ const de = () => {
1428
1429
  })
1429
1430
  ];
1430
1431
  }
1431
- }), tn = x.create({
1432
+ }), nn = T.create({
1432
1433
  name: "blockBackgroundColor",
1433
1434
  addGlobalAttributes() {
1434
1435
  return [
1435
1436
  {
1436
1437
  types: ["tableCell", "tableHeader"],
1437
1438
  attributes: {
1438
- backgroundColor: Ze()
1439
+ backgroundColor: tt()
1439
1440
  }
1440
1441
  }
1441
1442
  ];
1442
1443
  }
1443
- }), on = D.create({
1444
+ }), sn = O.create({
1444
1445
  name: "hardBreak",
1445
1446
  inline: !0,
1446
1447
  group: "inline",
@@ -1457,21 +1458,35 @@ const de = () => {
1457
1458
  return `
1458
1459
  `;
1459
1460
  }
1460
- }), Y = (n, e) => {
1461
+ }), _e = (n, e) => {
1462
+ var l;
1463
+ const t = n.resolve(e), o = t.depth - 1, s = t.before(o), r = n.resolve(s).nodeAfter;
1464
+ return r ? (l = r.type.spec.group) != null && l.includes("bnBlock") ? v(
1465
+ n.resolve(s)
1466
+ ) : _e(n, s) : void 0;
1467
+ }, L = (n, e) => {
1461
1468
  const t = n.resolve(e), o = t.index();
1462
1469
  if (o === 0)
1463
1470
  return;
1464
1471
  const s = t.posAtIndex(o - 1);
1465
- return X(
1472
+ return v(
1466
1473
  n.resolve(s)
1467
1474
  );
1468
- }, _e = (n, e) => {
1475
+ }, _ = (n, e) => {
1476
+ const t = n.resolve(e), o = t.index();
1477
+ if (o === t.node().childCount - 1)
1478
+ return;
1479
+ const s = t.posAtIndex(o + 1);
1480
+ return v(
1481
+ n.resolve(s)
1482
+ );
1483
+ }, Le = (n, e) => {
1469
1484
  for (; e.childContainer; ) {
1470
1485
  const t = e.childContainer.node, o = n.resolve(e.childContainer.beforePos + 1).posAtIndex(t.childCount - 1);
1471
- e = X(n.resolve(o));
1486
+ e = v(n.resolve(o));
1472
1487
  }
1473
1488
  return e;
1474
- }, nn = (n, e) => n.isBlockContainer && n.blockContent.node.type.spec.content === "inline*" && n.blockContent.node.childCount > 0 && e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*", sn = (n, e, t, o) => {
1489
+ }, rn = (n, e) => n.isBlockContainer && n.blockContent.node.type.spec.content === "inline*" && n.blockContent.node.childCount > 0 && e.isBlockContainer && e.blockContent.node.type.spec.content === "inline*", an = (n, e, t, o) => {
1475
1490
  if (!o.isBlockContainer)
1476
1491
  throw new Error(
1477
1492
  `Attempted to merge block at position ${o.bnBlock.beforePos} into previous block at position ${t.bnBlock.beforePos}, but next block is not a block container`
@@ -1481,10 +1496,10 @@ const de = () => {
1481
1496
  o.childContainer.beforePos + 1
1482
1497
  ), r = n.doc.resolve(
1483
1498
  o.childContainer.afterPos - 1
1484
- ), a = s.blockRange(r);
1499
+ ), i = s.blockRange(r);
1485
1500
  if (e) {
1486
- const c = n.doc.resolve(o.bnBlock.beforePos);
1487
- n.tr.lift(a, c.depth);
1501
+ const l = n.doc.resolve(o.bnBlock.beforePos);
1502
+ n.tr.lift(i, l.depth);
1488
1503
  }
1489
1504
  }
1490
1505
  if (e) {
@@ -1500,22 +1515,22 @@ const de = () => {
1500
1515
  );
1501
1516
  }
1502
1517
  return !0;
1503
- }, pe = (n) => ({
1518
+ }, fe = (n) => ({
1504
1519
  state: e,
1505
1520
  dispatch: t
1506
1521
  }) => {
1507
- const o = e.doc.resolve(n), s = X(o), r = Y(
1522
+ const o = e.doc.resolve(n), s = v(o), r = L(
1508
1523
  e.doc,
1509
1524
  s.bnBlock.beforePos
1510
1525
  );
1511
1526
  if (!r)
1512
1527
  return !1;
1513
- const a = _e(
1528
+ const i = Le(
1514
1529
  e.doc,
1515
1530
  r
1516
1531
  );
1517
- return nn(a, s) ? sn(e, t, a, s) : !1;
1518
- }, rn = x.create({
1532
+ return rn(i, s) ? an(e, t, i, s) : !1;
1533
+ }, cn = T.create({
1519
1534
  priority: 50,
1520
1535
  // TODO: The shortcuts need a refactor. Do we want to use a command priority
1521
1536
  // design as there is now, or clump the logic into a single function?
@@ -1527,12 +1542,12 @@ const de = () => {
1527
1542
  () => s.undoInputRule(),
1528
1543
  // Reverts block content type to a paragraph if the selection is at the start of the block.
1529
1544
  () => s.command(({ state: r }) => {
1530
- const a = B(r);
1531
- if (!a.isBlockContainer)
1545
+ const i = B(r);
1546
+ if (!i.isBlockContainer)
1532
1547
  return !1;
1533
- const c = r.selection.from === a.blockContent.beforePos + 1, i = a.blockContent.node.type.name === "paragraph";
1534
- return c && !i ? s.command(
1535
- tt(a.bnBlock.beforePos, {
1548
+ const l = r.selection.from === i.blockContent.beforePos + 1, a = i.blockContent.node.type.name === "paragraph";
1549
+ return l && !a ? s.command(
1550
+ nt(i.bnBlock.beforePos, {
1536
1551
  type: "paragraph",
1537
1552
  props: {}
1538
1553
  })
@@ -1540,80 +1555,104 @@ const de = () => {
1540
1555
  }),
1541
1556
  // Removes a level of nesting if the block is indented if the selection is at the start of the block.
1542
1557
  () => s.command(({ state: r }) => {
1543
- const a = B(r);
1544
- if (!a.isBlockContainer)
1558
+ const i = B(r);
1559
+ if (!i.isBlockContainer)
1545
1560
  return !1;
1546
- const { blockContent: c } = a;
1547
- return r.selection.from === c.beforePos + 1 ? s.liftListItem("blockContainer") : !1;
1561
+ const { blockContent: l } = i;
1562
+ return r.selection.from === l.beforePos + 1 ? s.liftListItem("blockContainer") : !1;
1548
1563
  }),
1549
1564
  // Merges block with the previous one if it isn't indented, and the selection is at the start of the
1550
1565
  // block. The target block for merging must contain inline content.
1551
1566
  () => s.command(({ state: r }) => {
1567
+ const i = B(r);
1568
+ if (!i.isBlockContainer)
1569
+ return !1;
1570
+ const { bnBlock: l, blockContent: a } = i, c = L(
1571
+ r.doc,
1572
+ i.bnBlock.beforePos
1573
+ );
1574
+ if (!c || !c.isBlockContainer || c.blockContent.node.type.spec.content !== "inline*")
1575
+ return !1;
1576
+ const d = r.selection.from === a.beforePos + 1, u = r.selection.empty, p = l.beforePos;
1577
+ return d && u ? o().command(fe(p)).scrollIntoView().run() : !1;
1578
+ }),
1579
+ // If the previous block is a columnList, moves the current block to
1580
+ // the end of the last column in it.
1581
+ () => s.command(({ state: r, tr: i, dispatch: l }) => {
1552
1582
  const a = B(r);
1553
1583
  if (!a.isBlockContainer)
1554
1584
  return !1;
1555
- const { bnBlock: c, blockContent: i } = a, l = r.selection.from === i.beforePos + 1, d = r.selection.empty, u = c.beforePos;
1556
- return l && d ? o().command(pe(u)).scrollIntoView().run() : !1;
1585
+ const c = L(
1586
+ r.doc,
1587
+ a.bnBlock.beforePos
1588
+ );
1589
+ if (!c || c.isBlockContainer)
1590
+ return !1;
1591
+ if (l) {
1592
+ const d = c.bnBlock.afterPos - 1, u = i.doc.resolve(d - 1);
1593
+ return i.delete(
1594
+ a.bnBlock.beforePos,
1595
+ a.bnBlock.afterPos
1596
+ ), i.insert(u.pos, a.bnBlock.node), i.setSelection(
1597
+ S.near(i.doc.resolve(u.pos + 1))
1598
+ ), !0;
1599
+ }
1600
+ return !1;
1557
1601
  }),
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))
1602
+ // If the block is the first in a column, moves it to the end of the
1603
+ // previous column. If there is no previous column, moves it above the
1604
+ // columnList.
1605
+ () => s.command(({ state: r, tr: i, dispatch: l }) => {
1606
+ const a = B(r);
1607
+ if (!a.isBlockContainer || !(i.selection.from === a.blockContent.beforePos + 1))
1561
1608
  return !1;
1562
- const d = a.doc.resolve(i.bnBlock.beforePos);
1609
+ const d = i.doc.resolve(a.bnBlock.beforePos);
1563
1610
  if (d.nodeBefore || d.node().type.name !== "column")
1564
1611
  return !1;
1565
- const m = a.doc.resolve(i.bnBlock.beforePos), f = a.doc.resolve(m.before()), k = f.before();
1566
- if (c) {
1567
- const b = a.doc.slice(
1568
- i.bnBlock.beforePos,
1569
- i.bnBlock.afterPos
1570
- ).content;
1571
- a.delete(
1572
- i.bnBlock.beforePos,
1573
- i.bnBlock.afterPos
1574
- ), f.index() === 0 ? (K(a, k), a.insert(k, b), a.setSelection(
1575
- M.near(a.doc.resolve(k))
1576
- )) : (a.insert(f.pos - 1, b), a.setSelection(
1577
- M.near(a.doc.resolve(f.pos - 1))
1578
- ), K(a, k));
1579
- }
1580
- return !0;
1612
+ const h = i.doc.resolve(a.bnBlock.beforePos), f = i.doc.resolve(h.before()), m = f.before();
1613
+ return l && (i.delete(
1614
+ a.bnBlock.beforePos,
1615
+ a.bnBlock.afterPos
1616
+ ), H(i, m), f.pos === m + 1 ? (i.insert(m, a.bnBlock.node), i.setSelection(
1617
+ S.near(i.doc.resolve(m))
1618
+ )) : (i.insert(f.pos - 1, a.bnBlock.node), i.setSelection(
1619
+ S.near(i.doc.resolve(f.pos))
1620
+ ))), !0;
1581
1621
  }),
1582
1622
  // Deletes the current block if it's an empty block with inline content,
1583
1623
  // and moves the selection to the previous block.
1584
1624
  () => s.command(({ state: r }) => {
1585
- var i;
1586
- const a = B(r);
1587
- if (!a.isBlockContainer)
1625
+ var a;
1626
+ const i = B(r);
1627
+ if (!i.isBlockContainer)
1588
1628
  return !1;
1589
- if (a.blockContent.node.childCount === 0 && a.blockContent.node.type.spec.content === "inline*") {
1590
- const l = Y(
1629
+ if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
1630
+ const c = L(
1591
1631
  r.doc,
1592
- a.bnBlock.beforePos
1632
+ i.bnBlock.beforePos
1593
1633
  );
1594
- if (!l || !l.isBlockContainer)
1634
+ if (!c || !c.isBlockContainer)
1595
1635
  return !1;
1596
1636
  let d = o();
1597
- if (a.childContainer && d.insertContentAt(
1598
- a.bnBlock.afterPos,
1599
- (i = a.childContainer) == null ? void 0 : i.node.content
1600
- ), l.blockContent.node.type.spec.content === "tableRow+") {
1601
- const k = a.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
1637
+ if (i.childContainer && d.insertContentAt(
1638
+ i.bnBlock.afterPos,
1639
+ (a = i.childContainer) == null ? void 0 : a.node.content
1640
+ ), c.blockContent.node.type.spec.content === "tableRow+") {
1641
+ const m = i.bnBlock.beforePos - 1 - 1 - 1 - 1 - 1;
1602
1642
  d = d.setTextSelection(
1603
- k
1643
+ m
1604
1644
  );
1605
- } else if (l.blockContent.node.type.spec.content === "") {
1606
- const u = l.blockContent.afterPos - l.blockContent.node.nodeSize;
1645
+ } else if (c.blockContent.node.type.spec.content === "")
1607
1646
  d = d.setNodeSelection(
1608
- u
1647
+ c.blockContent.beforePos
1609
1648
  );
1610
- } else {
1611
- const u = l.blockContent.afterPos - 1;
1649
+ else {
1650
+ const u = c.blockContent.afterPos - 1;
1612
1651
  d = d.setTextSelection(u);
1613
1652
  }
1614
1653
  return d.deleteRange({
1615
- from: a.bnBlock.beforePos,
1616
- to: a.bnBlock.afterPos
1654
+ from: i.bnBlock.beforePos,
1655
+ to: i.bnBlock.afterPos
1617
1656
  }).scrollIntoView().run();
1618
1657
  }
1619
1658
  return !1;
@@ -1622,25 +1661,25 @@ const de = () => {
1622
1661
  // when the selection is empty and at the start of the block. Moves the
1623
1662
  // current block into the deleted block's place.
1624
1663
  () => s.command(({ state: r }) => {
1625
- const a = B(r);
1626
- if (!a.isBlockContainer)
1627
- throw new Error("todo");
1628
- const c = r.selection.from === a.blockContent.beforePos + 1, i = r.selection.empty, l = Y(
1664
+ const i = B(r);
1665
+ if (!i.isBlockContainer)
1666
+ return !1;
1667
+ const l = r.selection.from === i.blockContent.beforePos + 1, a = r.selection.empty, c = L(
1629
1668
  r.doc,
1630
- a.bnBlock.beforePos
1669
+ i.bnBlock.beforePos
1631
1670
  );
1632
- if (l && c && i) {
1633
- const d = _e(
1671
+ if (c && l && a) {
1672
+ const d = Le(
1634
1673
  r.doc,
1635
- l
1674
+ c
1636
1675
  );
1637
1676
  if (!d.isBlockContainer)
1638
- throw new Error("todo");
1677
+ return !1;
1639
1678
  if (d.blockContent.node.type.spec.content === "" || d.blockContent.node.type.spec.content === "inline*" && d.blockContent.node.childCount === 0)
1640
1679
  return o().cut(
1641
1680
  {
1642
- from: a.bnBlock.beforePos,
1643
- to: a.bnBlock.afterPos
1681
+ from: i.bnBlock.beforePos,
1682
+ to: i.bnBlock.afterPos
1644
1683
  },
1645
1684
  d.bnBlock.afterPos
1646
1685
  ).deleteRange({
@@ -1650,51 +1689,231 @@ const de = () => {
1650
1689
  }
1651
1690
  return !1;
1652
1691
  })
1653
- ]), e = () => this.editor.commands.first(({ commands: o }) => [
1692
+ ]), e = () => this.editor.commands.first(({ chain: o, commands: s }) => [
1654
1693
  // Deletes the selection if it's not empty.
1655
- () => o.deleteSelection(),
1694
+ () => s.deleteSelection(),
1695
+ // Deletes the first child block and un-nests its children, if the
1696
+ // selection is empty and at the end of the current block. If both the
1697
+ // parent and child blocks have inline content, the child block's
1698
+ // content is appended to the parent's. The child block's own children
1699
+ // are unindented before it's deleted.
1700
+ () => s.command(({ state: r }) => {
1701
+ var p;
1702
+ const i = B(r);
1703
+ if (!i.isBlockContainer || !i.childContainer)
1704
+ return !1;
1705
+ const { blockContent: l, childContainer: a } = i, c = r.selection.from === l.afterPos - 1, d = r.selection.empty, u = v(
1706
+ r.doc.resolve(a.beforePos + 1)
1707
+ );
1708
+ if (!u.isBlockContainer)
1709
+ return !1;
1710
+ if (c && d) {
1711
+ const h = u.blockContent.node, f = h.type.spec.content === "inline*", m = l.node.type.spec.content === "inline*";
1712
+ return o().insertContentAt(
1713
+ u.bnBlock.afterPos,
1714
+ ((p = u.childContainer) == null ? void 0 : p.node.content) || w.empty
1715
+ ).deleteRange(
1716
+ // Deletes whole child container if there's only one child.
1717
+ a.node.childCount === 1 ? {
1718
+ from: a.beforePos,
1719
+ to: a.afterPos
1720
+ } : {
1721
+ from: u.bnBlock.beforePos,
1722
+ to: u.bnBlock.afterPos
1723
+ }
1724
+ ).insertContentAt(
1725
+ r.selection.from,
1726
+ f && m ? h.content : null
1727
+ ).setTextSelection(r.selection.from).scrollIntoView().run();
1728
+ }
1729
+ return !1;
1730
+ }),
1656
1731
  // Merges block with the next one (at the same nesting level or lower),
1657
1732
  // if one exists, the block has no children, and the selection is at the
1658
1733
  // end of the block.
1659
- () => o.command(({ state: s }) => {
1660
- const r = B(s);
1661
- if (!r.isBlockContainer)
1734
+ () => s.command(({ state: r }) => {
1735
+ const i = B(r);
1736
+ if (!i.isBlockContainer)
1662
1737
  return !1;
1663
- const {
1664
- bnBlock: a,
1665
- blockContent: c,
1666
- childContainer: i
1667
- } = r, { depth: l } = s.doc.resolve(a.beforePos), d = a.afterPos === s.doc.nodeSize - 3, u = s.selection.from === c.afterPos - 1, p = s.selection.empty;
1668
- if (!d && u && p && !(i !== void 0)) {
1669
- let f = l, k = a.afterPos + 1, b = s.doc.resolve(k).depth;
1670
- for (; b < f; )
1671
- f = b, k += 2, b = s.doc.resolve(k).depth;
1672
- return o.command(pe(k - 1));
1738
+ const { bnBlock: l, blockContent: a } = i, c = _(
1739
+ r.doc,
1740
+ i.bnBlock.beforePos
1741
+ );
1742
+ if (!c || !c.isBlockContainer)
1743
+ return !1;
1744
+ const d = r.selection.from === a.afterPos - 1, u = r.selection.empty, p = l.afterPos;
1745
+ return d && u ? o().command(fe(p)).scrollIntoView().run() : !1;
1746
+ }),
1747
+ // If the previous block is a columnList, moves the current block to
1748
+ // the end of the last column in it.
1749
+ () => s.command(({ state: r, tr: i, dispatch: l }) => {
1750
+ const a = B(r);
1751
+ if (!a.isBlockContainer)
1752
+ return !1;
1753
+ const c = _(
1754
+ r.doc,
1755
+ a.bnBlock.beforePos
1756
+ );
1757
+ if (!c || c.isBlockContainer)
1758
+ return !1;
1759
+ if (l) {
1760
+ const d = c.bnBlock.beforePos + 1, u = i.doc.resolve(d + 1);
1761
+ return i.delete(
1762
+ u.pos,
1763
+ u.pos + u.nodeAfter.nodeSize
1764
+ ), H(i, c.bnBlock.beforePos), i.insert(a.bnBlock.afterPos, u.nodeAfter), i.setSelection(
1765
+ S.near(i.doc.resolve(u.pos))
1766
+ ), !0;
1767
+ }
1768
+ return !1;
1769
+ }),
1770
+ // If the block is the last in a column, moves it to the start of the
1771
+ // next column. If there is no next column, moves it below the
1772
+ // columnList.
1773
+ () => s.command(({ state: r, tr: i, dispatch: l }) => {
1774
+ const a = B(r);
1775
+ if (!a.isBlockContainer || !(i.selection.from === a.blockContent.afterPos - 1))
1776
+ return !1;
1777
+ const d = i.doc.resolve(a.bnBlock.afterPos);
1778
+ if (d.nodeAfter || d.node().type.name !== "column")
1779
+ return !1;
1780
+ const h = i.doc.resolve(a.bnBlock.afterPos), f = i.doc.resolve(h.after()), m = f.after();
1781
+ if (l) {
1782
+ const b = f.pos === m - 1 ? m : f.pos + 1, g = v(
1783
+ i.doc.resolve(b)
1784
+ );
1785
+ i.delete(
1786
+ g.bnBlock.beforePos,
1787
+ g.bnBlock.afterPos
1788
+ ), H(
1789
+ i,
1790
+ m - f.node().nodeSize
1791
+ ), i.insert(h.pos, g.bnBlock.node), i.setSelection(
1792
+ S.near(i.doc.resolve(b))
1793
+ );
1794
+ }
1795
+ return !0;
1796
+ }),
1797
+ // Deletes the next block at either the same or lower nesting level, if
1798
+ // the selection is empty and at the end of the block. If both the
1799
+ // current and next blocks have inline content, the next block's
1800
+ // content is appended to the current block's. The next block's own
1801
+ // children are unindented before it's deleted.
1802
+ () => s.command(({ state: r }) => {
1803
+ var d;
1804
+ const i = B(r);
1805
+ if (!i.isBlockContainer)
1806
+ return !1;
1807
+ const { blockContent: l } = i, a = r.selection.from === l.afterPos - 1, c = r.selection.empty;
1808
+ if (a && c) {
1809
+ const u = (b, g) => {
1810
+ const x = _(b, g);
1811
+ if (x)
1812
+ return x;
1813
+ const y = _e(b, g);
1814
+ if (y)
1815
+ return u(
1816
+ b,
1817
+ y.bnBlock.beforePos
1818
+ );
1819
+ }, p = u(
1820
+ r.doc,
1821
+ i.bnBlock.beforePos
1822
+ );
1823
+ if (!p || !p.isBlockContainer)
1824
+ return !1;
1825
+ const h = p.blockContent.node, f = h.type.spec.content === "inline*", m = l.node.type.spec.content === "inline*";
1826
+ return o().insertContentAt(
1827
+ p.bnBlock.afterPos,
1828
+ ((d = p.childContainer) == null ? void 0 : d.node.content) || w.empty
1829
+ ).deleteRange({
1830
+ from: p.bnBlock.beforePos,
1831
+ to: p.bnBlock.afterPos
1832
+ }).insertContentAt(
1833
+ r.selection.from,
1834
+ f && m ? h.content : null
1835
+ ).setTextSelection(r.selection.from).scrollIntoView().run();
1836
+ }
1837
+ return !1;
1838
+ }),
1839
+ // Deletes the current block if it's an empty block with inline content,
1840
+ // and moves the selection to the next block.
1841
+ () => s.command(({ state: r }) => {
1842
+ const i = B(r);
1843
+ if (!i.isBlockContainer)
1844
+ return !1;
1845
+ if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
1846
+ const a = _(
1847
+ r.doc,
1848
+ i.bnBlock.beforePos
1849
+ );
1850
+ if (!a || !a.isBlockContainer)
1851
+ return !1;
1852
+ let c = o();
1853
+ if (a.blockContent.node.type.spec.content === "tableRow+") {
1854
+ const f = i.bnBlock.afterPos + 1 + 1 + 1 + 1 + 1;
1855
+ c = c.setTextSelection(
1856
+ f
1857
+ );
1858
+ } else a.blockContent.node.type.spec.content === "" ? c = c.setNodeSelection(
1859
+ a.blockContent.beforePos
1860
+ ) : c = c.setTextSelection(
1861
+ a.blockContent.beforePos + 1
1862
+ );
1863
+ return c.deleteRange({
1864
+ from: i.bnBlock.beforePos,
1865
+ to: i.bnBlock.afterPos
1866
+ }).scrollIntoView().run();
1867
+ }
1868
+ return !1;
1869
+ }),
1870
+ // Deletes next block if it contains no content and isn't a table,
1871
+ // when the selection is empty and at the end of the block. Moves the
1872
+ // current block into the deleted block's place.
1873
+ () => s.command(({ state: r }) => {
1874
+ const i = B(r);
1875
+ if (!i.isBlockContainer)
1876
+ return !1;
1877
+ const l = r.selection.from === i.blockContent.afterPos - 1, a = r.selection.empty, c = _(
1878
+ r.doc,
1879
+ i.bnBlock.beforePos
1880
+ );
1881
+ if (!c || !c.isBlockContainer)
1882
+ return !1;
1883
+ if (c && l && a && (c.blockContent.node.type.spec.content === "" || c.blockContent.node.type.spec.content === "inline*" && c.blockContent.node.childCount === 0)) {
1884
+ const u = c.bnBlock.node.lastChild.content;
1885
+ return o().deleteRange({
1886
+ from: c.bnBlock.beforePos,
1887
+ to: c.bnBlock.afterPos
1888
+ }).insertContentAt(
1889
+ i.bnBlock.afterPos,
1890
+ c.bnBlock.node.childCount === 2 ? u : null
1891
+ ).run();
1673
1892
  }
1674
1893
  return !1;
1675
1894
  })
1676
1895
  ]), t = (o = !1) => this.editor.commands.first(({ commands: s, tr: r }) => [
1677
1896
  // Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
1678
1897
  // of the block.
1679
- () => s.command(({ state: a }) => {
1680
- const c = B(a);
1681
- if (!c.isBlockContainer)
1898
+ () => s.command(({ state: i }) => {
1899
+ const l = B(i);
1900
+ if (!l.isBlockContainer)
1682
1901
  return !1;
1683
- 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;
1684
- return u && p && m && f ? s.liftListItem("blockContainer") : !1;
1902
+ const { bnBlock: a, blockContent: c } = l, { depth: d } = i.doc.resolve(a.beforePos), u = i.selection.$anchor.parentOffset === 0, p = i.selection.anchor === i.selection.head, h = c.node.childCount === 0, f = d > 1;
1903
+ return u && p && h && f ? s.liftListItem("blockContainer") : !1;
1685
1904
  }),
1686
1905
  // Creates a hard break if block is configured to do so.
1687
- () => s.command(({ state: a }) => {
1688
- var l;
1689
- const c = B(a), i = ((l = this.options.editor.schema.blockSchema[c.blockNoteType].meta) == null ? void 0 : l.hardBreakShortcut) ?? "shift+enter";
1690
- if (i === "none")
1906
+ () => s.command(({ state: i }) => {
1907
+ var c;
1908
+ const l = B(i), a = ((c = this.options.editor.schema.blockSchema[l.blockNoteType].meta) == null ? void 0 : c.hardBreakShortcut) ?? "shift+enter";
1909
+ if (a === "none")
1691
1910
  return !1;
1692
1911
  if (
1693
1912
  // If shortcut is not configured, or is configured as "shift+enter",
1694
1913
  // create a hard break for shift+enter, but not for enter.
1695
- i === "shift+enter" && o || // If shortcut is configured as "enter", create a hard break for
1914
+ a === "shift+enter" && o || // If shortcut is configured as "enter", create a hard break for
1696
1915
  // both enter and shift+enter.
1697
- i === "enter"
1916
+ a === "enter"
1698
1917
  ) {
1699
1918
  const d = r.storedMarks || r.selection.$head.marks().filter(
1700
1919
  (u) => this.editor.extensionManager.splittableMarks.includes(
@@ -1710,27 +1929,27 @@ const de = () => {
1710
1929
  }),
1711
1930
  // Creates a new block and moves the selection to it if the current one is empty, while the selection is also
1712
1931
  // empty & at the start of the block.
1713
- () => s.command(({ state: a, dispatch: c, tr: i }) => {
1714
- var k;
1715
- const l = B(a);
1716
- if (!l.isBlockContainer)
1932
+ () => s.command(({ state: i, dispatch: l, tr: a }) => {
1933
+ var m;
1934
+ const c = B(i);
1935
+ if (!c.isBlockContainer)
1717
1936
  return !1;
1718
- const { bnBlock: d, blockContent: u } = l, p = a.selection.$anchor.parentOffset === 0, m = a.selection.anchor === a.selection.head, f = u.node.childCount === 0;
1719
- if (p && m && f) {
1937
+ const { bnBlock: d, blockContent: u } = c, p = i.selection.$anchor.parentOffset === 0, h = i.selection.anchor === i.selection.head, f = u.node.childCount === 0;
1938
+ if (p && h && f) {
1720
1939
  const b = d.afterPos, g = b + 2;
1721
- if (c) {
1722
- const w = a.schema.nodes.blockContainer.createAndFill(
1940
+ if (l) {
1941
+ const x = i.schema.nodes.blockContainer.createAndFill(
1723
1942
  void 0,
1724
1943
  [
1725
- a.schema.nodes.paragraph.createAndFill() || void 0,
1726
- (k = l.childContainer) == null ? void 0 : k.node
1944
+ i.schema.nodes.paragraph.createAndFill() || void 0,
1945
+ (m = c.childContainer) == null ? void 0 : m.node
1727
1946
  ].filter((y) => y !== void 0)
1728
1947
  );
1729
- i.insert(b, w).setSelection(
1730
- new M(i.doc.resolve(g))
1731
- ).scrollIntoView(), l.childContainer && i.delete(
1732
- l.childContainer.beforePos,
1733
- l.childContainer.afterPos
1948
+ a.insert(b, x).setSelection(
1949
+ new S(a.doc.resolve(g))
1950
+ ).scrollIntoView(), c.childContainer && a.delete(
1951
+ c.childContainer.beforePos,
1952
+ c.childContainer.afterPos
1734
1953
  );
1735
1954
  }
1736
1955
  return !0;
@@ -1739,14 +1958,14 @@ const de = () => {
1739
1958
  }),
1740
1959
  // Splits the current block, moving content inside that's after the cursor to a new text block below. Also
1741
1960
  // deletes the selection beforehand, if it's not empty.
1742
- () => s.command(({ state: a, chain: c }) => {
1743
- const i = B(a);
1744
- if (!i.isBlockContainer)
1961
+ () => s.command(({ state: i, chain: l }) => {
1962
+ const a = B(i);
1963
+ if (!a.isBlockContainer)
1745
1964
  return !1;
1746
- const { blockContent: l } = i, d = a.selection.$anchor.parentOffset === 0;
1747
- return l.node.childCount === 0 ? !1 : (c().deleteSelection().command(
1748
- et(
1749
- a.selection.from,
1965
+ const { blockContent: c } = a, d = i.selection.$anchor.parentOffset === 0;
1966
+ return c.node.childCount === 0 ? !1 : (l().deleteSelection().command(
1967
+ ot(
1968
+ i.selection.from,
1750
1969
  d,
1751
1970
  d
1752
1971
  )
@@ -1762,11 +1981,11 @@ const de = () => {
1762
1981
  // editor since the browser will try to use tab for keyboard navigation.
1763
1982
  Tab: () => {
1764
1983
  var o, s;
1765
- return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(W)) != null && o.store.state || ((s = this.options.editor.getExtension(j)) == null ? void 0 : s.store.state) !== void 0) ? !1 : Te(this.options.editor);
1984
+ return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(Y)) != null && o.store.state || ((s = this.options.editor.getExtension(J)) == null ? void 0 : s.store.state) !== void 0) ? !1 : we(this.options.editor);
1766
1985
  },
1767
1986
  "Shift-Tab": () => {
1768
1987
  var o, s;
1769
- return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(W)) != null && o.store.state || ((s = this.options.editor.getExtension(j)) == null ? void 0 : s.store.state) !== void 0) ? !1 : this.editor.commands.liftListItem("blockContainer");
1988
+ return this.options.tabBehavior !== "prefer-indent" && ((o = this.options.editor.getExtension(Y)) != null && o.store.state || ((s = this.options.editor.getExtension(J)) == null ? void 0 : s.store.state) !== void 0) ? !1 : this.editor.commands.liftListItem("blockContainer");
1770
1989
  },
1771
1990
  "Shift-Mod-ArrowUp": () => (this.options.editor.moveBlocksUp(), !0),
1772
1991
  "Shift-Mod-ArrowDown": () => (this.options.editor.moveBlocksDown(), !0),
@@ -1775,7 +1994,7 @@ const de = () => {
1775
1994
  "Shift-Mod-z": () => this.options.editor.redo()
1776
1995
  };
1777
1996
  }
1778
- }), an = ee.create({
1997
+ }), ln = te.create({
1779
1998
  name: "insertion",
1780
1999
  inclusive: !1,
1781
2000
  excludes: "deletion modification insertion",
@@ -1813,7 +2032,7 @@ const de = () => {
1813
2032
  ]
1814
2033
  };
1815
2034
  }
1816
- }), cn = ee.create({
2035
+ }), dn = te.create({
1817
2036
  name: "deletion",
1818
2037
  inclusive: !1,
1819
2038
  excludes: "insertion modification deletion",
@@ -1854,7 +2073,7 @@ const de = () => {
1854
2073
  ]
1855
2074
  };
1856
2075
  }
1857
- }), ln = ee.create({
2076
+ }), un = te.create({
1858
2077
  name: "modification",
1859
2078
  inclusive: !1,
1860
2079
  excludes: "deletion insertion",
@@ -1917,7 +2136,7 @@ const de = () => {
1917
2136
  ]
1918
2137
  };
1919
2138
  }
1920
- }), dn = x.create({
2139
+ }), pn = T.create({
1921
2140
  name: "textAlignment",
1922
2141
  addGlobalAttributes() {
1923
2142
  return [
@@ -1939,25 +2158,25 @@ const de = () => {
1939
2158
  }
1940
2159
  ];
1941
2160
  }
1942
- }), un = x.create({
2161
+ }), fn = T.create({
1943
2162
  name: "blockTextColor",
1944
2163
  addGlobalAttributes() {
1945
2164
  return [
1946
2165
  {
1947
2166
  types: ["table", "tableCell", "tableHeader"],
1948
2167
  attributes: {
1949
- textColor: ot()
2168
+ textColor: st()
1950
2169
  }
1951
2170
  }
1952
2171
  ];
1953
2172
  }
1954
- }), pn = {
2173
+ }), hn = {
1955
2174
  blockColor: "data-block-color",
1956
2175
  blockStyle: "data-block-style",
1957
2176
  id: "data-id",
1958
2177
  depth: "data-depth",
1959
2178
  depthChange: "data-depth-change"
1960
- }, fn = D.create({
2179
+ }, mn = O.create({
1961
2180
  name: "blockContainer",
1962
2181
  group: "blockGroupChild bnBlock",
1963
2182
  // A block always contains content, and optionally a blockGroup which contains nested blocks
@@ -1974,7 +2193,7 @@ const de = () => {
1974
2193
  if (typeof n == "string")
1975
2194
  return !1;
1976
2195
  const e = {};
1977
- for (const [t, o] of Object.entries(pn))
2196
+ for (const [t, o] of Object.entries(hn))
1978
2197
  n.getAttribute(o) && (e[t] = n.getAttribute(o));
1979
2198
  return e;
1980
2199
  }
@@ -1990,21 +2209,21 @@ const de = () => {
1990
2209
  var s;
1991
2210
  const e = document.createElement("div");
1992
2211
  e.className = "bn-block-outer", e.setAttribute("data-node-type", "blockOuter");
1993
- for (const [r, a] of Object.entries(n))
1994
- r !== "class" && e.setAttribute(r, a);
2212
+ for (const [r, i] of Object.entries(n))
2213
+ r !== "class" && e.setAttribute(r, i);
1995
2214
  const t = {
1996
2215
  ...((s = this.options.domAttributes) == null ? void 0 : s.block) || {},
1997
2216
  ...n
1998
2217
  }, o = document.createElement("div");
1999
- o.className = Z("bn-block", t.class), o.setAttribute("data-node-type", this.name);
2000
- for (const [r, a] of Object.entries(t))
2001
- r !== "class" && o.setAttribute(r, a);
2218
+ o.className = ee("bn-block", t.class), o.setAttribute("data-node-type", this.name);
2219
+ for (const [r, i] of Object.entries(t))
2220
+ r !== "class" && o.setAttribute(r, i);
2002
2221
  return e.appendChild(o), {
2003
2222
  dom: e,
2004
2223
  contentDOM: o
2005
2224
  };
2006
2225
  }
2007
- }), hn = D.create({
2226
+ }), kn = O.create({
2008
2227
  name: "blockGroup",
2009
2228
  group: "childContainer",
2010
2229
  content: "blockGroupChild+",
@@ -2023,7 +2242,7 @@ const de = () => {
2023
2242
  ...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
2024
2243
  ...n
2025
2244
  }, t = document.createElement("div");
2026
- t.className = Z(
2245
+ t.className = ee(
2027
2246
  "bn-block-group",
2028
2247
  e.class
2029
2248
  ), t.setAttribute("data-node-type", "blockGroup");
@@ -2034,77 +2253,77 @@ const de = () => {
2034
2253
  contentDOM: t
2035
2254
  };
2036
2255
  }
2037
- }), mn = D.create({
2256
+ }), bn = O.create({
2038
2257
  name: "doc",
2039
2258
  topNode: !0,
2040
2259
  content: "blockGroup",
2041
2260
  marks: "insertion modification deletion"
2042
- }), kn = $t(
2261
+ }), gn = Vt(
2043
2262
  ({ options: n }) => ({
2044
2263
  key: "collaboration",
2045
2264
  blockNoteExtensions: [
2046
- ct(n),
2047
- lt(n),
2048
2265
  dt(n),
2049
- ut(),
2050
- pt(n)
2266
+ ut(n),
2267
+ pt(n),
2268
+ ft(),
2269
+ ht(n)
2051
2270
  ]
2052
2271
  })
2053
2272
  );
2054
- let fe = !1;
2055
- function bn(n, e) {
2273
+ let he = !1;
2274
+ function Bn(n, e) {
2056
2275
  const t = [
2057
- I.ClipboardTextSerializer,
2058
- I.Commands,
2059
- I.Editable,
2060
- I.FocusEvents,
2061
- I.Tabindex,
2062
- Vt,
2063
- me.configure({
2276
+ N.ClipboardTextSerializer,
2277
+ N.Commands,
2278
+ N.Editable,
2279
+ N.FocusEvents,
2280
+ N.Tabindex,
2281
+ zt,
2282
+ ke.configure({
2064
2283
  // everything from bnBlock group (nodes that represent a BlockNote block should have an id)
2065
2284
  types: ["blockContainer", "columnList", "column"],
2066
2285
  setIdAttribute: e.setIdAttribute
2067
2286
  }),
2068
- on,
2069
- zt,
2287
+ sn,
2288
+ Gt,
2070
2289
  // marks:
2071
- an,
2072
- cn,
2073
2290
  ln,
2074
- Ut.extend({
2291
+ dn,
2292
+ un,
2293
+ Rt.extend({
2075
2294
  inclusive: !1
2076
2295
  }).configure({
2077
- defaultProtocol: Et,
2296
+ defaultProtocol: Pt,
2078
2297
  // only call this once if we have multiple editors installed. Or fix https://github.com/ueberdosis/tiptap/issues/5450
2079
- protocols: fe ? [] : Ct
2298
+ protocols: he ? [] : Et
2080
2299
  }),
2081
2300
  ...Object.values(n.schema.styleSpecs).map((o) => o.implementation.mark.configure({
2082
2301
  editor: n
2083
2302
  })),
2084
- un,
2085
- tn,
2086
- dn,
2303
+ fn,
2304
+ nn,
2305
+ pn,
2087
2306
  // make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)
2088
- x.create({
2307
+ T.create({
2089
2308
  name: "OverrideEscape",
2090
2309
  addKeyboardShortcuts: () => ({
2091
2310
  Escape: () => {
2092
2311
  var o;
2093
- return (o = n.getExtension(be)) != null && o.shown() ? !1 : (n.blur(), !0);
2312
+ return (o = n.getExtension(ge)) != null && o.shown() ? !1 : (n.blur(), !0);
2094
2313
  }
2095
2314
  })
2096
2315
  }),
2097
2316
  // nodes
2098
- mn,
2099
- fn.configure({
2317
+ bn,
2318
+ mn.configure({
2100
2319
  editor: n,
2101
2320
  domAttributes: e.domAttributes
2102
2321
  }),
2103
- rn.configure({
2322
+ cn.configure({
2104
2323
  editor: n,
2105
2324
  tabBehavior: e.tabBehavior
2106
2325
  }),
2107
- hn.configure({
2326
+ kn.configure({
2108
2327
  domAttributes: e.domAttributes
2109
2328
  }),
2110
2329
  ...Object.values(n.schema.inlineContentSpecs).filter((o) => o.config !== "link" && o.config !== "text").map((o) => o.implementation.node.configure({
@@ -2119,54 +2338,54 @@ function bn(n, e) {
2119
2338
  })
2120
2339
  ] : []
2121
2340
  ]),
2122
- en(n),
2123
- Xo(
2341
+ on(n),
2342
+ en(
2124
2343
  n,
2125
2344
  e.pasteHandler || ((o) => o.defaultPasteHandler())
2126
2345
  ),
2127
- No(n)
2346
+ $o(n)
2128
2347
  ];
2129
- return fe = !0, t;
2348
+ return he = !0, t;
2130
2349
  }
2131
- function gn(n, e) {
2350
+ function yn(n, e) {
2132
2351
  const t = [
2133
2352
  ye(),
2134
- ft(e),
2135
- j(e),
2136
- W(e),
2137
- ht(e),
2138
- mt(),
2353
+ mt(e),
2354
+ J(e),
2355
+ Y(e),
2139
2356
  kt(e),
2140
- Gt(e),
2141
- bt(e),
2142
- be(e),
2143
- ...e.trailingBlock !== !1 ? [gt()] : []
2357
+ bt(),
2358
+ gt(e),
2359
+ jt(e),
2360
+ Bt(e),
2361
+ ge(e),
2362
+ ...e.trailingBlock !== !1 ? [yt()] : []
2144
2363
  ];
2145
- return e.collaboration ? t.push(kn(e.collaboration)) : t.push(yt()), "table" in n.schema.blockSpecs && t.push(St(e)), e.animations !== !1 && t.push(Bt()), t;
2364
+ return e.collaboration ? t.push(gn(e.collaboration)) : t.push(Ct()), "table" in n.schema.blockSpecs && t.push(St(e)), e.animations !== !1 && t.push(xt()), t;
2146
2365
  }
2147
- class yn {
2366
+ class Cn {
2148
2367
  constructor(e, t) {
2149
2368
  /**
2150
2369
  * A set of extension keys which are disabled by the options
2151
2370
  */
2152
- h(this, "disabledExtensions", /* @__PURE__ */ new Set());
2371
+ k(this, "disabledExtensions", /* @__PURE__ */ new Set());
2153
2372
  /**
2154
2373
  * A list of all the extensions that are registered to the editor
2155
2374
  */
2156
- h(this, "extensions", []);
2375
+ k(this, "extensions", []);
2157
2376
  /**
2158
2377
  * A map of all the abort controllers for each extension that has an init method defined
2159
2378
  */
2160
- h(this, "abortMap", /* @__PURE__ */ new Map());
2379
+ k(this, "abortMap", /* @__PURE__ */ new Map());
2161
2380
  /**
2162
2381
  * A map of all the extension factories that are registered to the editor
2163
2382
  */
2164
- h(this, "extensionFactories", /* @__PURE__ */ new Map());
2383
+ k(this, "extensionFactories", /* @__PURE__ */ new Map());
2165
2384
  /**
2166
2385
  * Because a single blocknote extension can both have it's own prosemirror plugins & additional generated ones (e.g. keymap & input rules plugins)
2167
2386
  * We need to keep track of all the plugins for each extension, so that we can remove them when the extension is unregistered
2168
2387
  */
2169
- h(this, "extensionPlugins", /* @__PURE__ */ new Map());
2388
+ k(this, "extensionPlugins", /* @__PURE__ */ new Map());
2170
2389
  this.editor = e, this.options = t, e.onMount(() => {
2171
2390
  for (const o of this.extensions)
2172
2391
  if (o.mount) {
@@ -2183,7 +2402,7 @@ class yn {
2183
2402
  for (const [o, s] of this.abortMap.entries())
2184
2403
  this.abortMap.delete(o), s.abort();
2185
2404
  }), this.disabledExtensions = new Set(t.disableExtensions || []);
2186
- for (const o of gn(this.editor, this.options))
2405
+ for (const o of yn(this.editor, this.options))
2187
2406
  this.addExtension(o);
2188
2407
  for (const o of this.options.extensions ?? [])
2189
2408
  this.addExtension(o);
@@ -2203,20 +2422,20 @@ class yn {
2203
2422
  console.warn("No extensions found to register", e);
2204
2423
  return;
2205
2424
  }
2206
- const o = t.map((a) => this.addExtension(a)).filter(Boolean), s = /* @__PURE__ */ new Set();
2207
- for (const a of o)
2208
- a != null && a.tiptapExtensions && console.warn(
2209
- `Extension ${a.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,
2210
- a
2211
- ), (r = a == null ? void 0 : a.inputRules) != null && r.length && console.warn(
2212
- `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.`,
2213
- a
2214
- ), this.getProsemirrorPluginsFromExtension(a).plugins.forEach(
2215
- (c) => {
2216
- s.add(c);
2425
+ const o = t.map((i) => this.addExtension(i)).filter(Boolean), s = /* @__PURE__ */ new Set();
2426
+ for (const i of o)
2427
+ i != null && i.tiptapExtensions && console.warn(
2428
+ `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.`,
2429
+ i
2430
+ ), (r = i == null ? void 0 : i.inputRules) != null && r.length && console.warn(
2431
+ `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.`,
2432
+ i
2433
+ ), this.getProsemirrorPluginsFromExtension(i).plugins.forEach(
2434
+ (l) => {
2435
+ s.add(l);
2217
2436
  }
2218
2437
  );
2219
- this.updatePlugins((a) => [...a, ...s]);
2438
+ this.updatePlugins((i) => [...i, ...s]);
2220
2439
  }
2221
2440
  /**
2222
2441
  * Register an extension to the editor
@@ -2227,7 +2446,7 @@ class yn {
2227
2446
  let t;
2228
2447
  if (typeof e == "function" ? t = e({ editor: this.editor }) : t = e, !(!t || this.disabledExtensions.has(t.key))) {
2229
2448
  if (typeof e == "function") {
2230
- const o = t[Ht];
2449
+ const o = t[Ut];
2231
2450
  typeof o == "function" && this.extensionFactories.set(o, t);
2232
2451
  }
2233
2452
  if (this.extensions.push(t), t.blockNoteExtensions)
@@ -2271,20 +2490,20 @@ class yn {
2271
2490
  }
2272
2491
  let o = !1;
2273
2492
  const s = /* @__PURE__ */ new Set();
2274
- for (const a of t) {
2275
- this.extensions = this.extensions.filter((i) => i !== a), this.extensionFactories.forEach((i, l) => {
2276
- i === a && this.extensionFactories.delete(l);
2277
- }), (r = this.abortMap.get(a)) == null || r.abort(), this.abortMap.delete(a);
2278
- const c = this.extensionPlugins.get(a);
2279
- c == null || c.forEach((i) => {
2280
- s.add(i);
2281
- }), this.extensionPlugins.delete(a), a.tiptapExtensions && !o && (o = !0, console.warn(
2282
- `Extension ${a.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,
2493
+ for (const i of t) {
2494
+ this.extensions = this.extensions.filter((a) => a !== i), this.extensionFactories.forEach((a, c) => {
2495
+ a === i && this.extensionFactories.delete(c);
2496
+ }), (r = this.abortMap.get(i)) == null || r.abort(), this.abortMap.delete(i);
2497
+ const l = this.extensionPlugins.get(i);
2498
+ l == null || l.forEach((a) => {
2499
+ s.add(a);
2500
+ }), this.extensionPlugins.delete(i), i.tiptapExtensions && !o && (o = !0, console.warn(
2501
+ `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.`,
2283
2502
  e
2284
2503
  ));
2285
2504
  }
2286
2505
  this.updatePlugins(
2287
- (a) => a.filter((c) => !s.has(c))
2506
+ (i) => i.filter((l) => !s.has(l))
2288
2507
  );
2289
2508
  }
2290
2509
  /**
@@ -2303,29 +2522,29 @@ class yn {
2303
2522
  */
2304
2523
  getTiptapExtensions() {
2305
2524
  var s;
2306
- const e = bn(
2525
+ const e = Bn(
2307
2526
  this.editor,
2308
2527
  this.options
2309
- ).filter((r) => !this.disabledExtensions.has(r.name)), t = xt(this.extensions), o = /* @__PURE__ */ new Map();
2528
+ ).filter((r) => !this.disabledExtensions.has(r.name)), t = Tt(this.extensions), o = /* @__PURE__ */ new Map();
2310
2529
  for (const r of this.extensions) {
2311
2530
  r.tiptapExtensions && e.push(...r.tiptapExtensions);
2312
- const a = t(r.key), { plugins: c, inputRules: i } = this.getProsemirrorPluginsFromExtension(r);
2313
- c.length && e.push(
2314
- x.create({
2531
+ const i = t(r.key), { plugins: l, inputRules: a } = this.getProsemirrorPluginsFromExtension(r);
2532
+ l.length && e.push(
2533
+ T.create({
2315
2534
  name: r.key,
2316
- priority: a,
2317
- addProseMirrorPlugins: () => c
2535
+ priority: i,
2536
+ addProseMirrorPlugins: () => l
2318
2537
  })
2319
- ), i.length && (o.has(a) || o.set(a, []), o.get(a).push(...i));
2538
+ ), a.length && (o.has(i) || o.set(i, []), o.get(i).push(...a));
2320
2539
  }
2321
2540
  e.push(
2322
- x.create({
2541
+ T.create({
2323
2542
  name: "blocknote-input-rules",
2324
2543
  addProseMirrorPlugins() {
2325
2544
  const r = [];
2326
- return Array.from(o.keys()).sort().reverse().forEach((a) => {
2327
- r.push(...o.get(a));
2328
- }), [Nt({ rules: r })];
2545
+ return Array.from(o.keys()).sort().reverse().forEach((i) => {
2546
+ r.push(...o.get(i));
2547
+ }), [$t({ rules: r })];
2329
2548
  }
2330
2549
  })
2331
2550
  );
@@ -2340,30 +2559,30 @@ class yn {
2340
2559
  * - input rules
2341
2560
  */
2342
2561
  getProsemirrorPluginsFromExtension(e) {
2343
- var s, r, a;
2562
+ var s, r, i;
2344
2563
  const t = [...e.prosemirrorPlugins ?? []], o = [];
2345
- return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules: o } : (this.extensionPlugins.set(e, t), (a = e.inputRules) != null && a.length && o.push(
2346
- ...e.inputRules.map((c) => new Ot(c.find, (i, l, d, u) => {
2347
- const p = c.replace({
2348
- match: l,
2564
+ return !((s = e.prosemirrorPlugins) != null && s.length) && !Object.keys(e.keyboardShortcuts || {}).length && !((r = e.inputRules) != null && r.length) ? { plugins: t, inputRules: o } : (this.extensionPlugins.set(e, t), (i = e.inputRules) != null && i.length && o.push(
2565
+ ...e.inputRules.map((l) => new Ht(l.find, (a, c, d, u) => {
2566
+ const p = l.replace({
2567
+ match: c,
2349
2568
  range: { from: d, to: u },
2350
2569
  editor: this.editor
2351
2570
  });
2352
2571
  if (p) {
2353
- const m = this.editor.getTextCursorPosition();
2354
- if (this.editor.schema.blockSchema[m.block.type].content !== "inline")
2572
+ const h = this.editor.getTextCursorPosition();
2573
+ if (this.editor.schema.blockSchema[h.block.type].content !== "inline")
2355
2574
  return null;
2356
- const f = $(i.tr), k = i.tr.deleteRange(d, u);
2357
- return nt(k, f.bnBlock.beforePos, p), k;
2575
+ const f = z(a.tr), m = a.tr.deleteRange(d, u);
2576
+ return rt(m, f.bnBlock.beforePos, p), m;
2358
2577
  }
2359
2578
  return null;
2360
2579
  }))
2361
2580
  ), Object.keys(e.keyboardShortcuts || {}).length && t.push(
2362
2581
  Ft(
2363
2582
  Object.fromEntries(
2364
- Object.entries(e.keyboardShortcuts).map(([c, i]) => [
2365
- c,
2366
- () => i({ editor: this.editor })
2583
+ Object.entries(e.keyboardShortcuts).map(([l, a]) => [
2584
+ l,
2585
+ () => a({ editor: this.editor })
2367
2586
  ])
2368
2587
  )
2369
2588
  )
@@ -2399,47 +2618,47 @@ function Sn(n, e) {
2399
2618
  if (t.pos > t.start() && t.pos < n.content.size) {
2400
2619
  const s = n.textBetween(t.pos, t.pos + 1);
2401
2620
  if (/^[\w\p{P}]$/u.test(s)) {
2402
- const a = n.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
2403
- a && (t = n.resolve(t.pos - a[0].length));
2621
+ const i = n.textBetween(t.start(), t.pos).match(/[\w\p{P}]+$/u);
2622
+ i && (t = n.resolve(t.pos - i[0].length));
2404
2623
  }
2405
2624
  }
2406
2625
  if (o.pos < o.end() && o.pos > 0) {
2407
2626
  const s = n.textBetween(o.pos - 1, o.pos);
2408
2627
  if (/^[\w\p{P}]$/u.test(s)) {
2409
- const a = n.textBetween(o.pos, o.end()).match(/^[\w\p{P}]+/u);
2410
- a && (o = n.resolve(o.pos + a[0].length));
2628
+ const i = n.textBetween(o.pos, o.end()).match(/^[\w\p{P}]+/u);
2629
+ i && (o = n.resolve(o.pos + i[0].length));
2411
2630
  }
2412
2631
  }
2413
2632
  return { $from: t, $to: o, from: t.pos, to: o.pos };
2414
2633
  }
2415
- function Bn(n) {
2416
- const e = C(n);
2634
+ function xn(n) {
2635
+ const e = E(n);
2417
2636
  if (n.selection.empty || "node" in n.selection)
2418
2637
  return;
2419
2638
  const t = n.doc.resolve(
2420
- _(n.doc, n.selection.from).posBeforeNode
2639
+ D(n.doc, n.selection.from).posBeforeNode
2421
2640
  ), o = n.doc.resolve(
2422
- _(n.doc, n.selection.to).posBeforeNode
2423
- ), s = (l, d) => {
2424
- const u = t.posAtIndex(l, d), p = n.doc.resolve(u).nodeAfter;
2641
+ D(n.doc, n.selection.to).posBeforeNode
2642
+ ), s = (c, d) => {
2643
+ const u = t.posAtIndex(c, d), p = n.doc.resolve(u).nodeAfter;
2425
2644
  if (!p)
2426
2645
  throw new Error(
2427
2646
  `Error getting selection - node not found at position ${u}`
2428
2647
  );
2429
- return S(p, e);
2430
- }, r = [], a = t.sharedDepth(o.pos), c = t.index(a), i = o.index(a);
2431
- if (t.depth > a) {
2432
- r.push(S(t.nodeAfter, e));
2433
- for (let l = t.depth; l > a; l--)
2434
- if (t.node(l).type.isInGroup("childContainer")) {
2435
- const u = t.index(l) + 1, p = t.node(l).childCount;
2436
- for (let m = u; m < p; m++)
2437
- r.push(s(m, l));
2648
+ return C(p, e);
2649
+ }, r = [], i = t.sharedDepth(o.pos), l = t.index(i), a = o.index(i);
2650
+ if (t.depth > i) {
2651
+ r.push(C(t.nodeAfter, e));
2652
+ for (let c = t.depth; c > i; c--)
2653
+ if (t.node(c).type.isInGroup("childContainer")) {
2654
+ const u = t.index(c) + 1, p = t.node(c).childCount;
2655
+ for (let h = u; h < p; h++)
2656
+ r.push(s(h, c));
2438
2657
  }
2439
2658
  } else
2440
- r.push(s(c, a));
2441
- for (let l = c + 1; l <= i; l++)
2442
- r.push(s(l, a));
2659
+ r.push(s(l, i));
2660
+ for (let c = l + 1; c <= a; c++)
2661
+ r.push(s(c, i));
2443
2662
  if (r.length === 0)
2444
2663
  throw new Error(
2445
2664
  `Error getting selection - selection doesn't span any blocks (${n.selection})`
@@ -2448,20 +2667,20 @@ function Bn(n) {
2448
2667
  blocks: r
2449
2668
  };
2450
2669
  }
2451
- function Cn(n, e, t) {
2452
- const o = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r = C(n), a = ke(r);
2670
+ function En(n, e, t) {
2671
+ const o = typeof e == "string" ? e : e.id, s = typeof t == "string" ? t : t.id, r = E(n), i = be(r);
2453
2672
  if (o === s)
2454
2673
  throw new Error(
2455
2674
  `Attempting to set selection with the same anchor and head blocks (id ${o})`
2456
2675
  );
2457
- const c = E(o, n.doc);
2458
- if (!c)
2676
+ const l = P(o, n.doc);
2677
+ if (!l)
2459
2678
  throw new Error(`Block with ID ${o} not found`);
2460
- const i = E(s, n.doc);
2461
- if (!i)
2679
+ const a = P(s, n.doc);
2680
+ if (!a)
2462
2681
  throw new Error(`Block with ID ${s} not found`);
2463
- const l = R(c), d = R(i), u = a.blockSchema[l.blockNoteType], p = a.blockSchema[d.blockNoteType];
2464
- if (!l.isBlockContainer || u.content === "none")
2682
+ const c = K(l), d = K(a), u = i.blockSchema[c.blockNoteType], p = i.blockSchema[d.blockNoteType];
2683
+ if (!c.isBlockContainer || u.content === "none")
2465
2684
  throw new Error(
2466
2685
  `Attempting to set selection anchor in block without content (id ${o})`
2467
2686
  );
@@ -2469,25 +2688,25 @@ function Cn(n, e, t) {
2469
2688
  throw new Error(
2470
2689
  `Attempting to set selection anchor in block without content (id ${s})`
2471
2690
  );
2472
- let m, f;
2691
+ let h, f;
2473
2692
  if (u.content === "table") {
2474
- const k = se.get(l.blockContent.node);
2475
- m = l.blockContent.beforePos + k.positionAt(0, 0, l.blockContent.node) + 1 + 2;
2693
+ const m = re.get(c.blockContent.node);
2694
+ h = c.blockContent.beforePos + m.positionAt(0, 0, c.blockContent.node) + 1 + 2;
2476
2695
  } else
2477
- m = l.blockContent.beforePos + 1;
2696
+ h = c.blockContent.beforePos + 1;
2478
2697
  if (p.content === "table") {
2479
- const k = se.get(d.blockContent.node), b = d.blockContent.beforePos + k.positionAt(
2480
- k.height - 1,
2481
- k.width - 1,
2698
+ const m = re.get(d.blockContent.node), b = d.blockContent.beforePos + m.positionAt(
2699
+ m.height - 1,
2700
+ m.width - 1,
2482
2701
  d.blockContent.node
2483
2702
  ) + 1, g = n.doc.resolve(b).nodeAfter.nodeSize;
2484
2703
  f = b + g - 2;
2485
2704
  } else
2486
2705
  f = d.blockContent.afterPos - 1;
2487
- n.setSelection(M.create(n.doc, m, f));
2706
+ n.setSelection(S.create(n.doc, h, f));
2488
2707
  }
2489
- function En(n, e = !1) {
2490
- const t = C(n), o = e ? Sn(n.doc, n.selection) : n.selection;
2708
+ function Pn(n, e = !1) {
2709
+ const t = E(n), o = e ? Sn(n.doc, n.selection) : n.selection;
2491
2710
  let s = o.$from, r = o.$to;
2492
2711
  for (; r.parentOffset >= r.parent.nodeSize - 2 && r.depth > 0; )
2493
2712
  r = n.doc.resolve(r.pos + 1);
@@ -2497,7 +2716,7 @@ function En(n, e = !1) {
2497
2716
  s = n.doc.resolve(s.pos - 1);
2498
2717
  for (; s.parentOffset >= s.parent.nodeSize - 2 && s.depth > 0; )
2499
2718
  s = n.doc.resolve(s.pos + 1);
2500
- const a = We(
2719
+ const i = Ke(
2501
2720
  n.doc.slice(s.pos, r.pos, !0),
2502
2721
  t
2503
2722
  );
@@ -2506,47 +2725,47 @@ function En(n, e = !1) {
2506
2725
  startPos: s.pos,
2507
2726
  endPos: r.pos
2508
2727
  },
2509
- ...a
2728
+ ...i
2510
2729
  };
2511
2730
  }
2512
- function xn(n) {
2513
- const { bnBlock: e } = $(n), t = C(n.doc), o = n.doc.resolve(e.beforePos), s = o.nodeBefore, r = n.doc.resolve(e.afterPos).nodeAfter;
2514
- let a;
2515
- return o.depth > 1 && (a = o.node(), a.type.isInGroup("bnBlock") || (a = o.node(o.depth - 1))), {
2516
- block: S(e.node, t),
2517
- prevBlock: s === null ? void 0 : S(s, t),
2518
- nextBlock: r === null ? void 0 : S(r, t),
2519
- parentBlock: a === void 0 ? void 0 : S(a, t)
2731
+ function Tn(n) {
2732
+ const { bnBlock: e } = z(n), t = E(n.doc), o = n.doc.resolve(e.beforePos), s = o.nodeBefore, r = n.doc.resolve(e.afterPos).nodeAfter;
2733
+ let i;
2734
+ return o.depth > 1 && (i = o.node(), i.type.isInGroup("bnBlock") || (i = o.node(o.depth - 1))), {
2735
+ block: C(e.node, t),
2736
+ prevBlock: s === null ? void 0 : C(s, t),
2737
+ nextBlock: r === null ? void 0 : C(r, t),
2738
+ parentBlock: i === void 0 ? void 0 : C(i, t)
2520
2739
  };
2521
2740
  }
2522
2741
  function De(n, e, t = "start") {
2523
- const o = typeof e == "string" ? e : e.id, s = C(n.doc), r = ke(s), a = E(o, n.doc);
2524
- if (!a)
2742
+ const o = typeof e == "string" ? e : e.id, s = E(n.doc), r = be(s), i = P(o, n.doc);
2743
+ if (!i)
2525
2744
  throw new Error(`Block with ID ${o} not found`);
2526
- const c = R(a), i = r.blockSchema[c.blockNoteType].content;
2527
- if (c.isBlockContainer) {
2528
- const l = c.blockContent;
2529
- if (i === "none") {
2530
- n.setSelection(L.create(n.doc, l.beforePos));
2745
+ const l = K(i), a = r.blockSchema[l.blockNoteType].content;
2746
+ if (l.isBlockContainer) {
2747
+ const c = l.blockContent;
2748
+ if (a === "none") {
2749
+ n.setSelection($.create(n.doc, c.beforePos));
2531
2750
  return;
2532
2751
  }
2533
- if (i === "inline")
2752
+ if (a === "inline")
2534
2753
  t === "start" ? n.setSelection(
2535
- M.create(n.doc, l.beforePos + 1)
2754
+ S.create(n.doc, c.beforePos + 1)
2536
2755
  ) : n.setSelection(
2537
- M.create(n.doc, l.afterPos - 1)
2756
+ S.create(n.doc, c.afterPos - 1)
2538
2757
  );
2539
- else if (i === "table")
2758
+ else if (a === "table")
2540
2759
  t === "start" ? n.setSelection(
2541
- M.create(n.doc, l.beforePos + 4)
2760
+ S.create(n.doc, c.beforePos + 4)
2542
2761
  ) : n.setSelection(
2543
- M.create(n.doc, l.afterPos - 4)
2762
+ S.create(n.doc, c.afterPos - 4)
2544
2763
  );
2545
2764
  else
2546
- throw new F(i);
2765
+ throw new U(a);
2547
2766
  } else {
2548
- const l = t === "start" ? c.childContainer.node.firstChild : c.childContainer.node.lastChild;
2549
- De(n, l.attrs.id, t);
2767
+ const c = t === "start" ? l.childContainer.node.firstChild : l.childContainer.node.lastChild;
2768
+ De(n, c.attrs.id, t);
2550
2769
  }
2551
2770
  }
2552
2771
  class Mn {
@@ -2560,7 +2779,7 @@ class Mn {
2560
2779
  * If the selection starts / ends halfway through a block, the returned data will contain the entire block.
2561
2780
  */
2562
2781
  getSelection() {
2563
- return this.editor.transact((e) => Bn(e));
2782
+ return this.editor.transact((e) => xn(e));
2564
2783
  }
2565
2784
  /**
2566
2785
  * Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
@@ -2570,7 +2789,9 @@ class Mn {
2570
2789
  * only the part of the block that is included in the selection.
2571
2790
  */
2572
2791
  getSelectionCutBlocks(e = !1) {
2573
- return this.editor.transact((t) => En(t, e));
2792
+ return this.editor.transact(
2793
+ (t) => Pn(t, e)
2794
+ );
2574
2795
  }
2575
2796
  /**
2576
2797
  * Sets the selection to a range of blocks.
@@ -2578,14 +2799,14 @@ class Mn {
2578
2799
  * @param endBlock The identifier of the block that should be the end of the selection.
2579
2800
  */
2580
2801
  setSelection(e, t) {
2581
- return this.editor.transact((o) => Cn(o, e, t));
2802
+ return this.editor.transact((o) => En(o, e, t));
2582
2803
  }
2583
2804
  /**
2584
2805
  * Gets a snapshot of the current text cursor position.
2585
2806
  * @returns A snapshot of the current text cursor position.
2586
2807
  */
2587
2808
  getTextCursorPosition() {
2588
- return this.editor.transact((e) => xn(e));
2809
+ return this.editor.transact((e) => Tn(e));
2589
2810
  }
2590
2811
  /**
2591
2812
  * Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could
@@ -2605,12 +2826,12 @@ class Mn {
2605
2826
  if (!this.editor.prosemirrorView)
2606
2827
  return;
2607
2828
  const { selection: e } = this.editor.prosemirrorState, { ranges: t } = e, o = Math.min(...t.map((r) => r.$from.pos)), s = Math.max(...t.map((r) => r.$to.pos));
2608
- if (Tt(e)) {
2829
+ if (vt(e)) {
2609
2830
  const r = this.editor.prosemirrorView.nodeDOM(o);
2610
2831
  if (r)
2611
2832
  return r.getBoundingClientRect();
2612
2833
  }
2613
- return Pt(
2834
+ return It(
2614
2835
  this.editor.prosemirrorView,
2615
2836
  o,
2616
2837
  s
@@ -2622,9 +2843,9 @@ class wn {
2622
2843
  /**
2623
2844
  * Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
2624
2845
  */
2625
- h(this, "activeTransaction", null);
2846
+ k(this, "activeTransaction", null);
2626
2847
  // Flag to indicate if we're in a `can` call
2627
- h(this, "isInCan", !1);
2848
+ k(this, "isInCan", !1);
2628
2849
  this.editor = e;
2629
2850
  }
2630
2851
  /**
@@ -2793,17 +3014,17 @@ class wn {
2793
3014
  throw new Error("No redo plugin found");
2794
3015
  }
2795
3016
  }
2796
- function Tn(n, e, t, o = { updateSelection: !0 }) {
2797
- let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, a = !0, c = !0, i = "";
2798
- if (t.forEach((l) => {
2799
- l.check(), a && l.isText && l.marks.length === 0 ? i += l.text : a = !1, c = c ? l.isBlock : !1;
2800
- }), s === r && c) {
2801
- const { parent: l } = n.doc.resolve(s);
2802
- l.isTextblock && !l.type.spec.code && !l.childCount && (s -= 1, r += 1);
2803
- }
2804
- return a ? n.insertText(i, s, r) : n.replaceWith(s, r, t), o.updateSelection && vt(n, n.steps.length - 1, -1), !0;
3017
+ function vn(n, e, t, o = { updateSelection: !0 }) {
3018
+ let { from: s, to: r } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, i = !0, l = !0, a = "";
3019
+ if (t.forEach((c) => {
3020
+ c.check(), i && c.isText && c.marks.length === 0 ? a += c.text : i = !1, l = l ? c.isBlock : !1;
3021
+ }), s === r && l) {
3022
+ const { parent: c } = n.doc.resolve(s);
3023
+ c.isTextblock && !c.type.spec.code && !c.childCount && (s -= 1, r += 1);
3024
+ }
3025
+ return i ? n.insertText(a, s, r) : n.replaceWith(s, r, t), o.updateSelection && At(n, n.steps.length - 1, -1), !0;
2805
3026
  }
2806
- class Pn {
3027
+ class In {
2807
3028
  constructor(e) {
2808
3029
  this.editor = e;
2809
3030
  }
@@ -2813,9 +3034,9 @@ class Pn {
2813
3034
  * @param content can be a string, or array of partial inline content elements
2814
3035
  */
2815
3036
  insertInlineContent(e, { updateSelection: t = !1 } = {}) {
2816
- const o = O(e, this.editor.pmSchema);
3037
+ const o = V(e, this.editor.pmSchema);
2817
3038
  this.editor.transact((s) => {
2818
- Tn(
3039
+ vn(
2819
3040
  s,
2820
3041
  {
2821
3042
  from: s.selection.from,
@@ -2863,7 +3084,7 @@ class Pn {
2863
3084
  stringValue: o
2864
3085
  });
2865
3086
  else
2866
- throw new F(s.propSchema);
3087
+ throw new U(s.propSchema);
2867
3088
  }
2868
3089
  }
2869
3090
  /**
@@ -2890,7 +3111,7 @@ class Pn {
2890
3111
  stringValue: o
2891
3112
  });
2892
3113
  else
2893
- throw new F(s.propSchema);
3114
+ throw new U(s.propSchema);
2894
3115
  }
2895
3116
  }
2896
3117
  /**
@@ -2915,35 +3136,35 @@ class Pn {
2915
3136
  return;
2916
3137
  const o = this.editor.pmSchema.mark("link", { href: e });
2917
3138
  this.editor.transact((s) => {
2918
- const { from: r, to: a } = s.selection;
2919
- t ? s.insertText(t, r, a).addMark(r, r + t.length, o) : s.setSelection(Jt.create(s.doc, a)).addMark(
3139
+ const { from: r, to: i } = s.selection;
3140
+ t ? s.insertText(t, r, i).addMark(r, r + t.length, o) : s.setSelection(Qt.create(s.doc, i)).addMark(
2920
3141
  r,
2921
- a,
3142
+ i,
2922
3143
  o
2923
3144
  );
2924
3145
  });
2925
3146
  }
2926
3147
  }
2927
- function vn(n) {
2928
- return It(n.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
3148
+ function An(n) {
3149
+ return Nt(n.state.selection.$from, (e) => e.type.name === "tableCell" || e.type.name === "tableHeader") !== void 0;
2929
3150
  }
2930
- function Le(n, e) {
3151
+ function Oe(n, e) {
2931
3152
  var s;
2932
3153
  const t = e.nodes.hardBreak;
2933
- let o = H.empty;
3154
+ let o = R.empty;
2934
3155
  return n.forEach((r) => {
2935
3156
  r.isTextblock && r.childCount > 0 ? (o = o.append(r.content), o = o.addToEnd(t.create())) : r.isText ? o = o.addToEnd(r) : r.isBlock && r.childCount > 0 && (o = o.append(
2936
- Le(r.content, e)
3157
+ Oe(r.content, e)
2937
3158
  ), o = o.addToEnd(t.create()));
2938
3159
  }), ((s = o.lastChild) == null ? void 0 : s.type) === t && (o = o.cut(0, o.size - 1)), o;
2939
3160
  }
2940
- function In(n, e) {
3161
+ function Nn(n, e) {
2941
3162
  const t = [];
2942
3163
  return n.forEach((o, s, r) => {
2943
3164
  r !== e && t.push(o);
2944
- }), H.from(t);
3165
+ }), R.from(t);
2945
3166
  }
2946
- function An(n, e) {
3167
+ function _n(n, e) {
2947
3168
  const t = [];
2948
3169
  for (let o = 0; o < n.childCount; o++)
2949
3170
  if (n.child(o).type.name === "tableRow")
@@ -2959,30 +3180,30 @@ function An(n, e) {
2959
3180
  }
2960
3181
  else
2961
3182
  t.push(n.child(o));
2962
- return n = H.from(t), n;
3183
+ return n = R.from(t), n;
2963
3184
  }
2964
- function _n(n, e) {
2965
- let t = H.from(n.content);
2966
- if (t = An(t, e.state.schema), vn(e)) {
3185
+ function Ln(n, e) {
3186
+ let t = R.from(n.content);
3187
+ if (t = _n(t, e.state.schema), An(e)) {
2967
3188
  let o = !1;
2968
3189
  if (t.descendants((s) => {
2969
3190
  s.type.isInGroup("tableContent") && (o = !0);
2970
3191
  }), !o && // is the content valid for a table paragraph?
2971
3192
  !e.state.schema.nodes.tableParagraph.validContent(t))
2972
- return new U(
2973
- Le(t, e.state.schema),
3193
+ return new j(
3194
+ Oe(t, e.state.schema),
2974
3195
  0,
2975
3196
  0
2976
3197
  );
2977
3198
  }
2978
3199
  if (!Dn(t, e))
2979
- return new U(t, n.openStart, n.openEnd);
3200
+ return new j(t, n.openStart, n.openEnd);
2980
3201
  for (let o = 0; o < t.childCount; o++)
2981
3202
  if (t.child(o).type.spec.group === "blockContent") {
2982
3203
  const s = [t.child(o)];
2983
3204
  if (o + 1 < t.childCount && t.child(o + 1).type.name === "blockGroup") {
2984
- const a = t.child(o + 1).child(0).child(0);
2985
- (a.type.name === "bulletListItem" || a.type.name === "numberedListItem" || a.type.name === "checkListItem") && (s.push(t.child(o + 1)), t = In(t, o + 1));
3205
+ const i = t.child(o + 1).child(0).child(0);
3206
+ (i.type.name === "bulletListItem" || i.type.name === "numberedListItem" || i.type.name === "checkListItem") && (s.push(t.child(o + 1)), t = Nn(t, o + 1));
2986
3207
  }
2987
3208
  const r = e.state.schema.nodes.blockContainer.createChecked(
2988
3209
  void 0,
@@ -2990,58 +3211,58 @@ function _n(n, e) {
2990
3211
  );
2991
3212
  t = t.replaceChild(o, r);
2992
3213
  }
2993
- return new U(t, n.openStart, n.openEnd);
3214
+ return new j(t, n.openStart, n.openEnd);
2994
3215
  }
2995
3216
  function Dn(n, e) {
2996
- var r, a;
2997
- const t = n.childCount === 1, o = ((r = n.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((a = n.firstChild) == null ? void 0 : a.type.spec.content) === "tableRow+";
3217
+ var r, i;
3218
+ const t = n.childCount === 1, o = ((r = n.firstChild) == null ? void 0 : r.type.spec.content) === "inline*", s = ((i = n.firstChild) == null ? void 0 : i.type.spec.content) === "tableRow+";
2998
3219
  if (t) {
2999
3220
  if (o)
3000
3221
  return !1;
3001
3222
  if (s) {
3002
- const c = B(e.state);
3003
- if (c.isBlockContainer)
3004
- return !(c.blockContent.node.type.spec.content === "tableRow+");
3223
+ const l = B(e.state);
3224
+ if (l.isBlockContainer)
3225
+ return !(l.blockContent.node.type.spec.content === "tableRow+");
3005
3226
  }
3006
3227
  }
3007
3228
  return !0;
3008
3229
  }
3009
- const Ln = {
3230
+ const On = {
3010
3231
  enableInputRules: !0,
3011
3232
  enablePasteRules: !0,
3012
3233
  enableCoreExtensions: !1
3013
3234
  };
3014
- class Ne extends Se {
3235
+ class $e extends Ce {
3015
3236
  constructor(t) {
3016
- var l, d, u, p, m, f, k, b, g, w;
3237
+ var c, d, u, p, h, f, m, b, g, x;
3017
3238
  super();
3018
3239
  /**
3019
3240
  * The underlying prosemirror schema
3020
3241
  */
3021
- h(this, "pmSchema");
3022
- h(this, "_tiptapEditor");
3242
+ k(this, "pmSchema");
3243
+ k(this, "_tiptapEditor");
3023
3244
  /**
3024
3245
  * Used by React to store a reference to an `ElementRenderer` helper utility to make sure we can render React elements
3025
3246
  * in the correct context (used by `ReactRenderUtil`)
3026
3247
  */
3027
- h(this, "elementRenderer", null);
3248
+ k(this, "elementRenderer", null);
3028
3249
  /**
3029
3250
  * Cache of all blocks. This makes sure we don't have to "recompute" blocks if underlying Prosemirror Nodes haven't changed.
3030
3251
  * This is especially useful when we want to keep track of the same block across multiple operations,
3031
3252
  * with this cache, blocks stay the same object reference (referential equality with ===).
3032
3253
  */
3033
- h(this, "blockCache", /* @__PURE__ */ new WeakMap());
3254
+ k(this, "blockCache", /* @__PURE__ */ new WeakMap());
3034
3255
  /**
3035
3256
  * The dictionary contains translations for the editor.
3036
3257
  */
3037
- h(this, "dictionary");
3258
+ k(this, "dictionary");
3038
3259
  /**
3039
3260
  * The schema of the editor. The schema defines which Blocks, InlineContent, and Styles are available in the editor.
3040
3261
  */
3041
- h(this, "schema");
3042
- h(this, "blockImplementations");
3043
- h(this, "inlineContentImplementations");
3044
- h(this, "styleImplementations");
3262
+ k(this, "schema");
3263
+ k(this, "blockImplementations");
3264
+ k(this, "inlineContentImplementations");
3265
+ k(this, "styleImplementations");
3045
3266
  /**
3046
3267
  * The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).
3047
3268
  * This method should set when creating the editor as this is application-specific.
@@ -3051,51 +3272,51 @@ class Ne extends Se {
3051
3272
  * @param file The file that should be uploaded.
3052
3273
  * @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)
3053
3274
  */
3054
- h(this, "uploadFile");
3055
- h(this, "onUploadStartCallbacks", []);
3056
- h(this, "onUploadEndCallbacks", []);
3057
- h(this, "resolveFileUrl");
3275
+ k(this, "uploadFile");
3276
+ k(this, "onUploadStartCallbacks", []);
3277
+ k(this, "onUploadEndCallbacks", []);
3278
+ k(this, "resolveFileUrl");
3058
3279
  /**
3059
3280
  * Editor settings
3060
3281
  */
3061
- h(this, "settings");
3282
+ k(this, "settings");
3062
3283
  // Manager instances
3063
- h(this, "_blockManager");
3064
- h(this, "_eventManager");
3065
- h(this, "_exportManager");
3066
- h(this, "_extensionManager");
3067
- h(this, "_selectionManager");
3068
- h(this, "_stateManager");
3069
- h(this, "_styleManager");
3284
+ k(this, "_blockManager");
3285
+ k(this, "_eventManager");
3286
+ k(this, "_exportManager");
3287
+ k(this, "_extensionManager");
3288
+ k(this, "_selectionManager");
3289
+ k(this, "_stateManager");
3290
+ k(this, "_styleManager");
3070
3291
  /**
3071
3292
  * Remove extension(s) from the editor
3072
3293
  */
3073
- h(this, "unregisterExtension", (...t) => this._extensionManager.unregisterExtension(...t));
3294
+ k(this, "unregisterExtension", (...t) => this._extensionManager.unregisterExtension(...t));
3074
3295
  /**
3075
3296
  * Register extension(s) to the editor
3076
3297
  */
3077
- h(this, "registerExtension", (...t) => this._extensionManager.registerExtension(...t));
3298
+ k(this, "registerExtension", (...t) => this._extensionManager.registerExtension(...t));
3078
3299
  /**
3079
3300
  * Get an extension from the editor
3080
3301
  */
3081
- h(this, "getExtension", (...t) => this._extensionManager.getExtension(...t));
3302
+ k(this, "getExtension", (...t) => this._extensionManager.getExtension(...t));
3082
3303
  /**
3083
3304
  * Mount the editor to a DOM element.
3084
3305
  *
3085
3306
  * @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
3086
3307
  */
3087
- h(this, "mount", (t) => {
3308
+ k(this, "mount", (t) => {
3088
3309
  this._tiptapEditor.mount({ mount: t });
3089
3310
  });
3090
3311
  /**
3091
3312
  * Unmount the editor from the DOM element it is bound to
3092
3313
  */
3093
- h(this, "unmount", () => {
3314
+ k(this, "unmount", () => {
3094
3315
  this._tiptapEditor.unmount();
3095
3316
  });
3096
- this.options = t, this.dictionary = t.dictionary || Lt, this.settings = {
3317
+ this.options = t, this.dictionary = t.dictionary || Ot, this.settings = {
3097
3318
  tables: {
3098
- splitCells: ((l = t == null ? void 0 : t.tables) == null ? void 0 : l.splitCells) ?? !1,
3319
+ splitCells: ((c = t == null ? void 0 : t.tables) == null ? void 0 : c.splitCells) ?? !1,
3099
3320
  cellBackgroundColor: ((d = t == null ? void 0 : t.tables) == null ? void 0 : d.cellBackgroundColor) ?? !1,
3100
3321
  cellTextColor: ((u = t == null ? void 0 : t.tables) == null ? void 0 : u.cellTextColor) ?? !1,
3101
3322
  headers: ((p = t == null ? void 0 : t.tables) == null ? void 0 : p.headers) ?? !1
@@ -3112,46 +3333,46 @@ class Ne extends Se {
3112
3333
  };
3113
3334
  if (this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, o.uploadFile) {
3114
3335
  const y = o.uploadFile;
3115
- this.uploadFile = async (P, T) => {
3336
+ this.uploadFile = async (I, M) => {
3116
3337
  this.onUploadStartCallbacks.forEach(
3117
- (v) => v.apply(this, [T])
3338
+ (A) => A.apply(this, [M])
3118
3339
  );
3119
3340
  try {
3120
- return await y(P, T);
3341
+ return await y(I, M);
3121
3342
  } finally {
3122
3343
  this.onUploadEndCallbacks.forEach(
3123
- (v) => v.apply(this, [T])
3344
+ (A) => A.apply(this, [M])
3124
3345
  );
3125
3346
  }
3126
3347
  };
3127
3348
  }
3128
- this.resolveFileUrl = o.resolveFileUrl, this._eventManager = new Co(this), this._extensionManager = new yn(this, o);
3349
+ this.resolveFileUrl = o.resolveFileUrl, this._eventManager = new Eo(this), this._extensionManager = new Cn(this, o);
3129
3350
  const s = this._extensionManager.getTiptapExtensions(), r = this._extensionManager.hasExtension("ySync") || this._extensionManager.hasExtension("liveblocksExtension");
3130
3351
  r && o.initialContent && console.warn(
3131
3352
  "When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider"
3132
3353
  );
3133
- const a = {
3134
- ...Ln,
3354
+ const i = {
3355
+ ...On,
3135
3356
  ...o._tiptapOptions,
3136
3357
  element: null,
3137
3358
  autofocus: o.autofocus ?? !1,
3138
3359
  extensions: s,
3139
3360
  editorProps: {
3140
- ...(m = o._tiptapOptions) == null ? void 0 : m.editorProps,
3361
+ ...(h = o._tiptapOptions) == null ? void 0 : h.editorProps,
3141
3362
  attributes: {
3142
3363
  // As of TipTap v2.5.0 the tabIndex is removed when the editor is not
3143
3364
  // editable, so you can't focus it. We want to revert this as we have
3144
3365
  // UI behaviour that relies on it.
3145
3366
  tabIndex: "0",
3146
- ...(k = (f = o._tiptapOptions) == null ? void 0 : f.editorProps) == null ? void 0 : k.attributes,
3367
+ ...(m = (f = o._tiptapOptions) == null ? void 0 : f.editorProps) == null ? void 0 : m.attributes,
3147
3368
  ...(b = o.domAttributes) == null ? void 0 : b.editor,
3148
- class: Z(
3369
+ class: ee(
3149
3370
  "bn-editor",
3150
3371
  o.defaultStyles ? "bn-default-styles" : "",
3151
- ((w = (g = o.domAttributes) == null ? void 0 : g.editor) == null ? void 0 : w.class) || ""
3372
+ ((x = (g = o.domAttributes) == null ? void 0 : g.editor) == null ? void 0 : x.class) || ""
3152
3373
  )
3153
3374
  },
3154
- transformPasted: _n
3375
+ transformPasted: Ln
3155
3376
  }
3156
3377
  };
3157
3378
  try {
@@ -3163,31 +3384,31 @@ class Ne extends Se {
3163
3384
  ] : [
3164
3385
  {
3165
3386
  type: "paragraph",
3166
- id: me.options.generateID()
3387
+ id: ke.options.generateID()
3167
3388
  }
3168
3389
  ]);
3169
3390
  if (!Array.isArray(y) || y.length === 0)
3170
3391
  throw new Error(
3171
3392
  "initialContent must be a non-empty array of blocks, received: " + y
3172
3393
  );
3173
- const P = At(a.extensions), T = y.map(
3174
- (Oe) => Q(Oe, P, this.schema.styleSchema).toJSON()
3175
- ), v = _t(
3394
+ const I = _t(i.extensions), M = y.map(
3395
+ (He) => Z(He, I, this.schema.styleSchema).toJSON()
3396
+ ), A = Lt(
3176
3397
  {
3177
3398
  type: "doc",
3178
3399
  content: [
3179
3400
  {
3180
3401
  type: "blockGroup",
3181
- content: T
3402
+ content: M
3182
3403
  }
3183
3404
  ]
3184
3405
  },
3185
- P,
3186
- a.parseOptions
3406
+ I,
3407
+ i.parseOptions
3187
3408
  );
3188
3409
  this._tiptapEditor = new Dt({
3189
- ...a,
3190
- content: v.toJSON()
3410
+ ...i,
3411
+ content: A.toJSON()
3191
3412
  }), this.pmSchema = this._tiptapEditor.schema;
3192
3413
  } catch (y) {
3193
3414
  throw new Error(
@@ -3195,17 +3416,17 @@ class Ne extends Se {
3195
3416
  { cause: y }
3196
3417
  );
3197
3418
  }
3198
- let c;
3199
- const i = this.pmSchema.nodes.doc.createAndFill;
3419
+ let l;
3420
+ const a = this.pmSchema.nodes.doc.createAndFill;
3200
3421
  this.pmSchema.nodes.doc.createAndFill = (...y) => {
3201
- if (c)
3202
- return c;
3203
- const P = i.apply(this.pmSchema.nodes.doc, y), T = JSON.parse(JSON.stringify(P.toJSON()));
3204
- return T.content[0].content[0].attrs.id = "initialBlockId", c = Ve.fromJSON(this.pmSchema, T), c;
3205
- }, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new Bo(this), this._exportManager = new _o(this), this._selectionManager = new Mn(this), this._stateManager = new wn(this), this._styleManager = new Pn(this), this.emit("create");
3422
+ if (l)
3423
+ return l;
3424
+ const I = a.apply(this.pmSchema.nodes.doc, y), M = JSON.parse(JSON.stringify(I.toJSON()));
3425
+ return M.content[0].content[0].attrs.id = "initialBlockId", l = ze.fromJSON(this.pmSchema, M), l;
3426
+ }, this.pmSchema.cached.blockNoteEditor = this, this._blockManager = new xo(this), this._exportManager = new Lo(this), this._selectionManager = new Mn(this), this._stateManager = new wn(this), this._styleManager = new In(this), this.emit("create");
3206
3427
  }
3207
3428
  static create(t) {
3208
- return new Ne(t ?? {});
3429
+ return new $e(t ?? {});
3209
3430
  }
3210
3431
  /**
3211
3432
  * BlockNote extensions that are added to the editor, keyed by the extension key
@@ -3742,7 +3963,7 @@ class Ne extends Se {
3742
3963
  return this._exportManager.pasteMarkdown(t);
3743
3964
  }
3744
3965
  }
3745
- class cs {
3966
+ class ds {
3746
3967
  constructor(e, t, o) {
3747
3968
  this.mappings = t, this.options = o;
3748
3969
  }
@@ -3775,191 +3996,221 @@ class cs {
3775
3996
  );
3776
3997
  }
3777
3998
  }
3778
- function ls(n) {
3999
+ function us(n) {
3779
4000
  return {
3780
4001
  createBlockMapping: (e) => e,
3781
4002
  createInlineContentMapping: (e) => e,
3782
4003
  createStyleMapping: (e) => e
3783
4004
  };
3784
4005
  }
3785
- function ds(n, ...e) {
4006
+ function ps(n, ...e) {
3786
4007
  const t = [...n];
3787
4008
  for (const o of e)
3788
4009
  for (const s of o) {
3789
4010
  const r = t.findLastIndex(
3790
- (a) => a.group === s.group
4011
+ (i) => i.group === s.group
3791
4012
  );
3792
4013
  r === -1 ? t.push(s) : t.splice(r + 1, 0, s);
3793
4014
  }
3794
4015
  return t;
3795
4016
  }
3796
4017
  export {
3797
- Ne as BlockNoteEditor,
4018
+ ye as BlockChangeExtension,
4019
+ $e as BlockNoteEditor,
3798
4020
  Mt as BlockNoteSchema,
3799
- Ps as COLORS_DARK_MODE_DEFAULT,
3800
- vs as COLORS_DEFAULT,
3801
- ia as CustomBlockNoteSchema,
3802
- Is as EMPTY_CELL_HEIGHT,
3803
- Ye as EMPTY_CELL_WIDTH,
3804
- Se as EventEmitter,
3805
- cs as Exporter,
3806
- As as FILE_AUDIO_ICON_SVG,
3807
- _s as FILE_IMAGE_ICON_SVG,
4021
+ Is as COLORS_DARK_MODE_DEFAULT,
4022
+ As as COLORS_DEFAULT,
4023
+ Bi as CustomBlockNoteSchema,
4024
+ Pt as DEFAULT_LINK_PROTOCOL,
4025
+ pi as DRAG_EXCLUSION_CLASSNAME,
4026
+ mt as DropCursorExtension,
4027
+ Ns as EMPTY_CELL_HEIGHT,
4028
+ Xe as EMPTY_CELL_WIDTH,
4029
+ Ce as EventEmitter,
4030
+ ds as Exporter,
4031
+ _s as FILE_AUDIO_ICON_SVG,
4032
+ Ls as FILE_IMAGE_ICON_SVG,
3808
4033
  Ds as FILE_VIDEO_ICON_SVG,
3809
- Pe as HTMLToBlocks,
3810
- me as UniqueID,
3811
- F as UnreachableCaseError,
3812
- Ls as addDefaultPropsExternalHTML,
3813
- V as addInlineContentAttributes,
3814
- qe as addInlineContentKeyboardShortcuts,
3815
- Ns as addNodeAndExtensionsToSpec,
3816
- Os as addStyleAttributes,
4034
+ J as FilePanelExtension,
4035
+ dt as ForkYDocExtension,
4036
+ Y as FormattingToolbarExtension,
4037
+ ve as HTMLToBlocks,
4038
+ Ct as HistoryExtension,
4039
+ kt as LinkToolbarExtension,
4040
+ bt as NodeSelectionKeyboardExtension,
4041
+ gt as PlaceholderExtension,
4042
+ xt as PreviousBlockTypeExtension,
4043
+ ht as SchemaMigration,
4044
+ jt as ShowSelectionExtension,
4045
+ Bt as SideMenuExtension,
4046
+ fi as SideMenuView,
4047
+ ge as SuggestionMenu,
4048
+ St as TableHandlesExtension,
4049
+ hi as TableHandlesView,
4050
+ yt as TrailingNodeExtension,
4051
+ ke as UniqueID,
4052
+ U as UnreachableCaseError,
4053
+ Et as VALID_LINK_PROTOCOLS,
4054
+ ut as YCursorExtension,
4055
+ pt as YSyncExtension,
4056
+ ft as YUndoExtension,
4057
+ Os as addDefaultPropsExternalHTML,
4058
+ G as addInlineContentAttributes,
4059
+ Je as addInlineContentKeyboardShortcuts,
4060
+ $s as addNodeAndExtensionsToSpec,
4061
+ Hs as addStyleAttributes,
3817
4062
  Fs as applyNonSelectableBlockFix,
3818
- fs as assertEmpty,
3819
- $s as audioParse,
3820
- Hs as audioRender,
3821
- Vs as audioToExternalHTML,
3822
- Us as blockHasType,
3823
- Q as blockToNode,
3824
- rt as blocksToMarkdown,
3825
- zs as camelToDataKebab,
3826
- Gs as captureCellAnchor,
3827
- ca as checkPageBreakBlocksInSchema,
3828
- at as cleanHTMLToMarkdown,
3829
- ds as combineByGroup,
3830
- je as contentNodeToInlineContent,
3831
- Re as contentNodeToTableContent,
3832
- Rs as createAudioBlockConfig,
3833
- js as createAudioBlockSpec,
3834
- Ws as createBlockConfig,
3835
- qs as createBlockSpec,
3836
- Ks as createBlockSpecFromTiptapNode,
3837
- Js as createBulletListItemBlockConfig,
3838
- Ys as createBulletListItemBlockSpec,
3839
- Qs as createCheckListItemBlockSpec,
3840
- Xs as createCheckListItemConfig,
3841
- Zs as createCodeBlockConfig,
3842
- er as createCodeBlockSpec,
3843
- tr as createDefaultBlockDOMOutputSpec,
3844
- or as createDividerBlockConfig,
3845
- nr as createDividerBlockSpec,
3846
- $t as createExtension,
3847
- ge as createExternalHTMLExporter,
3848
- sr as createFileBlockConfig,
3849
- rr as createFileBlockSpec,
3850
- ar as createHeadingBlockConfig,
3851
- ir as createHeadingBlockSpec,
3852
- cr as createImageBlockConfig,
3853
- lr as createImageBlockSpec,
3854
- is as createInlineContentSpec,
3855
- Je as createInlineContentSpecFromTipTapNode,
3856
- io as createInternalHTMLSerializer,
3857
- dr as createInternalInlineContentSpec,
3858
- ur as createInternalStyleSpec,
3859
- pr as createNumberedListItemBlockConfig,
3860
- fr as createNumberedListItemBlockSpec,
3861
- la as createPageBreakBlockConfig,
3862
- da as createPageBreakBlockSpec,
3863
- hr as createParagraphBlockConfig,
3864
- mr as createParagraphBlockSpec,
3865
- kr as createQuoteBlockConfig,
3866
- br as createQuoteBlockSpec,
3867
- ma as createStore,
3868
- gr as createStyleSpec,
3869
- yr as createStyleSpecFromTipTapMark,
4063
+ ms as assertEmpty,
4064
+ Vs as audioParse,
4065
+ Us as audioRender,
4066
+ zs as audioToExternalHTML,
4067
+ Rs as blockHasType,
4068
+ Z as blockToNode,
4069
+ at as blocksToMarkdown,
4070
+ Gs as camelToDataKebab,
4071
+ js as captureCellAnchor,
4072
+ yi as checkPageBreakBlocksInSchema,
4073
+ ct as cleanHTMLToMarkdown,
4074
+ ps as combineByGroup,
4075
+ qe as contentNodeToInlineContent,
4076
+ We as contentNodeToTableContent,
4077
+ Ws as createAudioBlockConfig,
4078
+ qs as createAudioBlockSpec,
4079
+ Ks as createBlockConfig,
4080
+ Js as createBlockSpec,
4081
+ Ys as createBlockSpecFromTiptapNode,
4082
+ Qs as createBulletListItemBlockConfig,
4083
+ Xs as createBulletListItemBlockSpec,
4084
+ Zs as createCheckListItemBlockSpec,
4085
+ er as createCheckListItemConfig,
4086
+ tr as createCodeBlockConfig,
4087
+ or as createCodeBlockSpec,
4088
+ nr as createDefaultBlockDOMOutputSpec,
4089
+ sr as createDividerBlockConfig,
4090
+ rr as createDividerBlockSpec,
4091
+ Vt as createExtension,
4092
+ Be as createExternalHTMLExporter,
4093
+ ir as createFileBlockConfig,
4094
+ ar as createFileBlockSpec,
4095
+ cr as createHeadingBlockConfig,
4096
+ lr as createHeadingBlockSpec,
4097
+ dr as createImageBlockConfig,
4098
+ ur as createImageBlockSpec,
4099
+ ls as createInlineContentSpec,
4100
+ Qe as createInlineContentSpecFromTipTapNode,
4101
+ lo as createInternalHTMLSerializer,
4102
+ pr as createInternalInlineContentSpec,
4103
+ fr as createInternalStyleSpec,
4104
+ hr as createNumberedListItemBlockConfig,
4105
+ mr as createNumberedListItemBlockSpec,
4106
+ Ci as createPageBreakBlockConfig,
4107
+ Si as createPageBreakBlockSpec,
4108
+ kr as createParagraphBlockConfig,
4109
+ br as createParagraphBlockSpec,
4110
+ gr as createQuoteBlockConfig,
4111
+ Br as createQuoteBlockSpec,
4112
+ Mi as createStore,
4113
+ yr as createStyleSpec,
4114
+ Cr as createStyleSpecFromTipTapMark,
3870
4115
  Sr as createTableBlockSpec,
3871
- Br as createToggleListItemBlockConfig,
3872
- Cr as createToggleListItemBlockSpec,
3873
- Er as createToggleWrapper,
3874
- xr as createVideoBlockConfig,
4116
+ xr as createToggleListItemBlockConfig,
4117
+ Er as createToggleListItemBlockSpec,
4118
+ Pr as createToggleWrapper,
4119
+ Tr as createVideoBlockConfig,
3875
4120
  Mr as createVideoBlockSpec,
3876
4121
  wr as defaultBlockSpecs,
3877
- Tr as defaultBlockToHTML,
3878
- Pr as defaultInlineContentSchema,
3879
- vr as defaultInlineContentSpecs,
3880
- Ir as defaultProps,
3881
- Ar as defaultStyleSchema,
3882
- _r as defaultStyleSpecs,
4122
+ vr as defaultBlockToHTML,
4123
+ Ir as defaultInlineContentSchema,
4124
+ Ar as defaultInlineContentSpecs,
4125
+ Nr as defaultProps,
4126
+ _r as defaultStyleSchema,
4127
+ Lr as defaultStyleSpecs,
3883
4128
  Dr as defaultToggledState,
3884
- Ge as docToBlocks,
3885
- Lr as editorHasBlockWithType,
4129
+ je as docToBlocks,
4130
+ Or as editorHasBlockWithType,
3886
4131
  Sn as expandPMRangeToWords,
3887
- Nr as fileParse,
3888
- Or as filenameFromURL,
3889
- K as fixColumnList,
3890
- Fr as formatKeyboardShortcut,
3891
- Ze as getBackgroundColorAttribute,
3892
- bo as getBlock,
3893
- hs as getBlockCache,
3894
- $r as getBlockFromPos,
3895
- R as getBlockInfo,
3896
- X as getBlockInfoFromResolvedPos,
4132
+ $r as fileParse,
4133
+ Hr as filenameFromURL,
4134
+ Fr as filterSuggestionItems,
4135
+ H as fixColumnList,
4136
+ Vr as formatKeyboardShortcut,
4137
+ tt as getBackgroundColorAttribute,
4138
+ Bo as getBlock,
4139
+ ks as getBlockCache,
4140
+ Ur as getBlockFromPos,
4141
+ K as getBlockInfo,
4142
+ v as getBlockInfoFromResolvedPos,
3897
4143
  B as getBlockInfoFromSelection,
3898
- $ as getBlockInfoFromTransaction,
3899
- ms as getBlockInfoWithManualOffset,
3900
- ke as getBlockNoteSchema,
3901
- ks as getBlockSchema,
3902
- st as getBlocksChangedByTransaction,
3903
- bs as getColspan,
3904
- Yt as getInlineContentParseRules,
3905
- gs as getInlineContentSchema,
3906
- Hr as getInlineContentSchemaFromSpecs,
3907
- Vr as getLanguageId,
3908
- _ as getNearestBlockPos,
3909
- yo as getNextBlock,
3910
- E as getNodeById,
3911
- ua as getPageBreakSlashMenuItems,
4144
+ z as getBlockInfoFromTransaction,
4145
+ bs as getBlockInfoWithManualOffset,
4146
+ be as getBlockNoteSchema,
4147
+ gs as getBlockSchema,
4148
+ it as getBlocksChangedByTransaction,
4149
+ Bs as getColspan,
4150
+ mi as getDefaultEmojiPickerItems,
4151
+ zr as getDefaultSlashMenuItems,
4152
+ Xt as getInlineContentParseRules,
4153
+ ys as getInlineContentSchema,
4154
+ Rr as getInlineContentSchemaFromSpecs,
4155
+ Gr as getLanguageId,
4156
+ D as getNearestBlockPos,
4157
+ Co as getNextBlock,
4158
+ P as getNodeById,
4159
+ xi as getPageBreakSlashMenuItems,
3912
4160
  So as getParentBlock,
3913
- Ur as getParseRules,
3914
- C as getPmSchema,
3915
- go as getPrevBlock,
3916
- ys as getRowspan,
3917
- zr as getStyleParseRules,
4161
+ jr as getParseRules,
4162
+ E as getPmSchema,
4163
+ yo as getPrevBlock,
4164
+ Cs as getRowspan,
4165
+ Wr as getStyleParseRules,
3918
4166
  Ss as getStyleSchema,
3919
- Gr as getStyleSchemaFromSpecs,
3920
- Rr as getTextAlignmentAttribute,
3921
- ot as getTextColorAttribute,
3922
- jr as imageParse,
3923
- Wr as imageRender,
3924
- qr as imageToExternalHTML,
3925
- O as inlineContentToNodes,
3926
- Qt as insertBlocks,
3927
- Kr as isAppleOS,
3928
- q as isEmptyColumn,
3929
- Bs as isLinkInlineContent,
3930
- Jr as isNodeBlock,
3931
- Cs as isPartialLinkInlineContent,
3932
- Es as isPartialTableCell,
3933
- Yr as isSafari,
3934
- xs as isStyledTextInlineContent,
4167
+ qr as getStyleSchemaFromSpecs,
4168
+ Kr as getTextAlignmentAttribute,
4169
+ st as getTextColorAttribute,
4170
+ Jr as imageParse,
4171
+ Yr as imageRender,
4172
+ Qr as imageToExternalHTML,
4173
+ V as inlineContentToNodes,
4174
+ Zt as insertBlocks,
4175
+ Xr as insertOrUpdateBlockForSlashMenu,
4176
+ Zr as isAppleOS,
4177
+ Q as isEmptyColumn,
4178
+ xs as isLinkInlineContent,
4179
+ ei as isNodeBlock,
4180
+ Es as isPartialLinkInlineContent,
4181
+ Ps as isPartialTableCell,
4182
+ ti as isSafari,
4183
+ Ts as isStyledTextInlineContent,
3935
4184
  Ms as isTableCell,
3936
- Qr as isTableCellSelection,
3937
- Xe as isVideoUrl,
4185
+ oi as isTableCellSelection,
4186
+ et as isVideoUrl,
3938
4187
  ws as mapTableCell,
3939
- ls as mappingFactory,
3940
- Ao as markdownToBlocks,
3941
- ve as markdownToHTML,
3942
- Z as mergeCSSClasses,
3943
- Xr as mergeParagraphs,
3944
- S as nodeToBlock,
3945
- G as nodeToCustomInlineContent,
3946
- Zr as parseAudioElement,
3947
- ea as parseDefaultProps,
3948
- Ke as propsToAttributes,
3949
- We as prosemirrorSliceToSlicedBlocks,
4188
+ us as mappingFactory,
4189
+ _o as markdownToBlocks,
4190
+ Ie as markdownToHTML,
4191
+ ee as mergeCSSClasses,
4192
+ ni as mergeParagraphs,
4193
+ C as nodeToBlock,
4194
+ q as nodeToCustomInlineContent,
4195
+ si as parseAudioElement,
4196
+ ri as parseDefaultProps,
4197
+ Ye as propsToAttributes,
4198
+ Ke as prosemirrorSliceToSlicedBlocks,
3950
4199
  ae as removeAndInsertBlocks,
3951
- Xt as removeEmptyColumns,
3952
- Ae as selectedFragmentToHTML,
3953
- ta as stylePropsToAttributes,
3954
- ze as tableContentToNodes,
3955
- oa as tablePropSchema,
3956
- na as trackPosition,
3957
- Qe as updateBlock,
3958
- tt as updateBlockCommand,
3959
- nt as updateBlockTr,
3960
- pa as uploadToTmpFilesDotOrg_DEV_ONLY,
3961
- sa as videoParse,
3962
- fa as withPageBreak,
3963
- ra as wrapInBlockStructure
4200
+ eo as removeEmptyColumns,
4201
+ Ne as selectedFragmentToHTML,
4202
+ ki as sideMenuPluginKey,
4203
+ ii as stylePropsToAttributes,
4204
+ Ge as tableContentToNodes,
4205
+ bi as tableHandlesPluginKey,
4206
+ ai as tablePropSchema,
4207
+ ci as trackPosition,
4208
+ Ze as updateBlock,
4209
+ nt as updateBlockCommand,
4210
+ rt as updateBlockTr,
4211
+ Ei as uploadToTmpFilesDotOrg_DEV_ONLY,
4212
+ li as videoParse,
4213
+ Pi as withPageBreak,
4214
+ di as wrapInBlockStructure
3964
4215
  };
3965
4216
  //# sourceMappingURL=blocknote.js.map