@blocknote/core 0.45.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{BlockNoteSchema-BOW16JHv.js → BlockNoteSchema-DsMVJZv4.js} +2 -2
  2. package/dist/{BlockNoteSchema-BOW16JHv.js.map → BlockNoteSchema-DsMVJZv4.js.map} +1 -1
  3. package/dist/{BlockNoteSchema-CzZbr4Ed.cjs → BlockNoteSchema-qt4Czo0-.cjs} +2 -2
  4. package/dist/{BlockNoteSchema-CzZbr4Ed.cjs.map → BlockNoteSchema-qt4Czo0-.cjs.map} +1 -1
  5. package/dist/ShowSelection-B0ch3unP.js +51 -0
  6. package/dist/ShowSelection-B0ch3unP.js.map +1 -0
  7. package/dist/ShowSelection-BxnbRvy4.cjs +2 -0
  8. package/dist/ShowSelection-BxnbRvy4.cjs.map +1 -0
  9. package/dist/{TrailingNode-8cXFaQUm.js → TrailingNode-C-Kyrtf1.js} +378 -369
  10. package/dist/TrailingNode-C-Kyrtf1.js.map +1 -0
  11. package/dist/TrailingNode-W7GJVng5.cjs +2 -0
  12. package/dist/TrailingNode-W7GJVng5.cjs.map +1 -0
  13. package/dist/blocknote.cjs +1 -1
  14. package/dist/blocknote.cjs.map +1 -1
  15. package/dist/blocknote.js +7 -7
  16. package/dist/blocknote.js.map +1 -1
  17. package/dist/blocks.cjs +1 -1
  18. package/dist/blocks.js +2 -2
  19. package/dist/comments.cjs +1 -1
  20. package/dist/comments.cjs.map +1 -1
  21. package/dist/comments.js +3 -3
  22. package/dist/comments.js.map +1 -1
  23. package/dist/{defaultBlocks-DvCGYzqu.js → defaultBlocks-CXOCngjC.js} +118 -119
  24. package/dist/defaultBlocks-CXOCngjC.js.map +1 -0
  25. package/dist/defaultBlocks-IsUGVZIq.cjs +6 -0
  26. package/dist/defaultBlocks-IsUGVZIq.cjs.map +1 -0
  27. package/dist/extensions.cjs +1 -1
  28. package/dist/extensions.js +4 -4
  29. package/dist/style.css +1 -1
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/dist/webpack-stats.json +1 -1
  32. package/package.json +5 -5
  33. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +17 -0
  34. package/src/blocks/ListItem/BulletListItem/block.ts +1 -1
  35. package/src/blocks/ListItem/CheckListItem/block.ts +6 -4
  36. package/src/blocks/ListItem/NumberedListItem/block.ts +1 -1
  37. package/src/comments/extension.ts +6 -2
  38. package/src/editor/Block.css +1 -1
  39. package/src/editor/managers/ExtensionManager/extensions.ts +1 -1
  40. package/src/extensions/LinkToolbar/LinkToolbar.ts +1 -1
  41. package/src/extensions/ShowSelection/ShowSelection.ts +14 -4
  42. package/types/src/extensions/ShowSelection/ShowSelection.d.ts +10 -4
  43. package/dist/ShowSelection-BW37oJ6h.cjs +0 -2
  44. package/dist/ShowSelection-BW37oJ6h.cjs.map +0 -1
  45. package/dist/ShowSelection-Dz-NEase.js +0 -43
  46. package/dist/ShowSelection-Dz-NEase.js.map +0 -1
  47. package/dist/TrailingNode-8cXFaQUm.js.map +0 -1
  48. package/dist/TrailingNode-DPu6X9ym.cjs +0 -2
  49. package/dist/TrailingNode-DPu6X9ym.cjs.map +0 -1
  50. package/dist/defaultBlocks-D1cc0lV9.cjs +0 -6
  51. package/dist/defaultBlocks-D1cc0lV9.cjs.map +0 -1
  52. package/dist/defaultBlocks-DvCGYzqu.js.map +0 -1
@@ -1,77 +1,77 @@
1
- var Ee = Object.defineProperty;
2
- var Ie = (n, e, t) => e in n ? Ee(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var b = (n, e, t) => Ie(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { Plugin as T, PluginKey as P, NodeSelection as ae, TextSelection as le, Selection as L } from "prosemirror-state";
5
- import { combineTransactionSteps as Be, getMarkRange as Te, posToDOMRect as Pe, findChildren as X } from "@tiptap/core";
6
- import Oe from "fast-deep-equal";
7
- import { i as j, t as De, U as Ae, n as Me, g as N, a as R, c as ce, m as Le, e as de, f as Ne, h as Re, j as Ve, k as He, l as Fe, o as q, p as W } from "./blockToNode-BNoNIXU7.js";
8
- import { ai as ue, a2 as G, aj as he, $ as $e, a1 as J } from "./defaultBlocks-DvCGYzqu.js";
1
+ var Ie = Object.defineProperty;
2
+ var Be = (n, e, t) => e in n ? Ie(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var b = (n, e, t) => Be(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { Plugin as T, PluginKey as P, NodeSelection as le, TextSelection as ce, Selection as N } from "prosemirror-state";
5
+ import { combineTransactionSteps as Te, getMarkRange as Pe, posToDOMRect as Oe, findChildren as j } from "@tiptap/core";
6
+ import De from "fast-deep-equal";
7
+ import { i as q, t as Ae, U as Me, n as Ne, g as R, a as L, c as de, m as Re, e as ue, f as Le, h as Ve, j as He, k as Fe, l as $e, o as W, p as G } from "./blockToNode-BNoNIXU7.js";
8
+ import { ai as he, a2 as J, aj as me, $ as Ue, a1 as Q } from "./defaultBlocks-CXOCngjC.js";
9
9
  import { c as k, a as H } from "./BlockNoteExtension-C2X7LW-V.js";
10
- import { yCursorPlugin as Ue, defaultSelectionBuilder as _e, ySyncPlugin as ze, redoCommand as Ke, undoCommand as Ye, yUndoPlugin as Xe, yUndoPluginKey as Q } from "y-prosemirror";
10
+ import { yCursorPlugin as _e, defaultSelectionBuilder as ze, ySyncPlugin as Ke, redoCommand as Ye, undoCommand as Xe, yUndoPlugin as je, yUndoPluginKey as Z } from "y-prosemirror";
11
11
  import * as I from "yjs";
12
- import { PluginKey as me, Plugin as pe, TextSelection as je } from "@tiptap/pm/state";
13
- import { dropCursor as qe } from "prosemirror-dropcursor";
14
- import { redo as We, undo as Ge, history as Je } from "@tiptap/pm/history";
12
+ import { PluginKey as pe, Plugin as fe, TextSelection as qe } from "@tiptap/pm/state";
13
+ import { dropCursor as We } from "prosemirror-dropcursor";
14
+ import { redo as Ge, undo as Je, history as Qe } from "@tiptap/pm/history";
15
15
  import { Decoration as A, DecorationSet as V } from "prosemirror-view";
16
- import { v4 as Qe } from "uuid";
17
- import { DOMParser as Ze, Slice as et } from "@tiptap/pm/model";
18
- import { DOMSerializer as fe, Fragment as ge, Slice as tt } from "prosemirror-model";
19
- import ot from "rehype-parse";
20
- import nt from "rehype-remark";
21
- import rt from "remark-gfm";
22
- import st from "remark-stringify";
23
- import { unified as it } from "unified";
24
- import { fromDom as at } from "hast-util-from-dom";
25
- import { visit as lt } from "unist-util-visit";
26
- import { splitCell as ct, mergeCells as dt, deleteRow as ut, deleteColumn as ht, addRowBefore as mt, addRowAfter as pt, addColumnBefore as ft, addColumnAfter as gt, CellSelection as wt } from "prosemirror-tables";
27
- function we(n) {
16
+ import { v4 as Ze } from "uuid";
17
+ import { DOMParser as et, Slice as tt } from "@tiptap/pm/model";
18
+ import { DOMSerializer as ge, Fragment as we, Slice as ot } from "prosemirror-model";
19
+ import nt from "rehype-parse";
20
+ import rt from "rehype-remark";
21
+ import st from "remark-gfm";
22
+ import it from "remark-stringify";
23
+ import { unified as at } from "unified";
24
+ import { fromDom as lt } from "hast-util-from-dom";
25
+ import { visit as ct } from "unist-util-visit";
26
+ import { splitCell as dt, mergeCells as ut, deleteRow as ht, deleteColumn as mt, addRowBefore as pt, addRowAfter as ft, addColumnBefore as gt, addColumnAfter as wt, CellSelection as yt } from "prosemirror-tables";
27
+ function ye(n) {
28
28
  const e = Array.from(n.classList).filter(
29
29
  (t) => !t.startsWith("bn-")
30
30
  ) || [];
31
31
  e.length > 0 ? n.className = e.join(" ") : n.removeAttribute("class");
32
32
  }
33
- function ye(n, e, t, o) {
33
+ function be(n, e, t, o) {
34
34
  var a;
35
35
  let r;
36
36
  if (e)
37
37
  if (typeof e == "string")
38
- r = j([e], n.pmSchema);
38
+ r = q([e], n.pmSchema);
39
39
  else if (Array.isArray(e))
40
- r = j(e, n.pmSchema);
40
+ r = q(e, n.pmSchema);
41
41
  else if (e.type === "tableContent")
42
- r = De(e, n.pmSchema);
42
+ r = Ae(e, n.pmSchema);
43
43
  else
44
- throw new Ae(e.type);
44
+ throw new Me(e.type);
45
45
  else throw new Error("blockContent is required");
46
46
  const i = ((o == null ? void 0 : o.document) ?? document).createDocumentFragment();
47
47
  for (const c of r)
48
48
  if (c.type.name !== "text" && n.schema.inlineContentSchema[c.type.name]) {
49
49
  const l = n.schema.inlineContentSpecs[c.type.name].implementation;
50
50
  if (l) {
51
- const m = Me(
51
+ const u = Ne(
52
52
  c,
53
53
  n.schema.inlineContentSchema,
54
54
  n.schema.styleSchema
55
55
  ), h = l.toExternalHTML ? l.toExternalHTML(
56
- m,
56
+ u,
57
57
  n
58
58
  ) : l.render.call(
59
59
  {
60
60
  renderType: "dom",
61
61
  props: void 0
62
62
  },
63
- m,
63
+ u,
64
64
  () => {
65
65
  },
66
66
  n
67
67
  );
68
68
  if (h) {
69
69
  if (i.appendChild(h.dom), h.contentDOM) {
70
- const f = t.serializeFragment(
70
+ const g = t.serializeFragment(
71
71
  c.content,
72
72
  o
73
73
  );
74
- h.contentDOM.dataset.editable = "", h.contentDOM.appendChild(f);
74
+ h.contentDOM.dataset.editable = "", h.contentDOM.appendChild(g);
75
75
  }
76
76
  continue;
77
77
  }
@@ -80,120 +80,129 @@ function ye(n, e, t, o) {
80
80
  let l = document.createTextNode(
81
81
  c.textContent
82
82
  );
83
- for (const m of c.marks.toReversed())
84
- if (m.type.name in n.schema.styleSpecs) {
85
- const h = (n.schema.styleSpecs[m.type.name].implementation.toExternalHTML ?? n.schema.styleSpecs[m.type.name].implementation.render)(m.attrs.stringValue, n);
83
+ for (const u of c.marks.toReversed())
84
+ if (u.type.name in n.schema.styleSpecs) {
85
+ const h = (n.schema.styleSpecs[u.type.name].implementation.toExternalHTML ?? n.schema.styleSpecs[u.type.name].implementation.render)(u.attrs.stringValue, n);
86
86
  h.contentDOM.appendChild(l), l = h.dom;
87
87
  } else {
88
- const h = m.type.spec.toDOM(m, !0), f = fe.renderSpec(document, h);
89
- f.contentDOM.appendChild(l), l = f.dom;
88
+ const h = u.type.spec.toDOM(u, !0), g = ge.renderSpec(document, h);
89
+ g.contentDOM.appendChild(l), l = g.dom;
90
90
  }
91
91
  i.appendChild(l);
92
92
  } else {
93
93
  const l = t.serializeFragment(
94
- ge.from([c]),
94
+ we.from([c]),
95
95
  o
96
96
  );
97
97
  i.appendChild(l);
98
98
  }
99
- return i.childNodes.length === 1 && ((a = i.firstChild) == null ? void 0 : a.nodeType) === 1 && we(i.firstChild), i;
99
+ return i.childNodes.length === 1 && ((a = i.firstChild) == null ? void 0 : a.nodeType) === 1 && ye(i.firstChild), i;
100
100
  }
101
- function yt(n, e, t, o, r, s, i) {
102
- var p, w, y, E, O, _, z, K, Y;
103
- const a = (i == null ? void 0 : i.document) ?? document, c = e.pmSchema.nodes.blockContainer, l = t.props || {};
101
+ function bt(n, e, t, o, r, s, i, a) {
102
+ var w, y, E, O, _, z, K, Y, X;
103
+ const c = (a == null ? void 0 : a.document) ?? document, l = e.pmSchema.nodes.blockContainer, u = t.props || {};
104
104
  for (const [v, S] of Object.entries(
105
105
  e.schema.blockSchema[t.type].propSchema
106
106
  ))
107
- !(v in l) && S.default !== void 0 && (l[v] = S.default);
108
- const m = (w = (p = c.spec) == null ? void 0 : p.toDOM) == null ? void 0 : w.call(
109
- p,
110
- c.create({
107
+ !(v in u) && S.default !== void 0 && (u[v] = S.default);
108
+ const h = (y = (w = l.spec) == null ? void 0 : w.toDOM) == null ? void 0 : y.call(
109
+ w,
110
+ l.create({
111
111
  id: t.id,
112
- ...l
112
+ ...u
113
113
  })
114
- ), h = Array.from(m.dom.attributes), f = e.blockImplementations[t.type].implementation, u = ((y = f.toExternalHTML) == null ? void 0 : y.call(
114
+ ), g = Array.from(h.dom.attributes), m = e.blockImplementations[t.type].implementation, p = ((E = m.toExternalHTML) == null ? void 0 : E.call(
115
115
  {},
116
- { ...t, props: l },
116
+ { ...t, props: u },
117
117
  e
118
- )) || f.render.call(
118
+ )) || m.render.call(
119
119
  {},
120
- { ...t, props: l },
120
+ { ...t, props: u },
121
121
  e
122
- ), g = a.createDocumentFragment();
123
- if (u.dom.classList.contains("bn-block-content")) {
122
+ ), d = c.createDocumentFragment();
123
+ if (p.dom.classList.contains("bn-block-content")) {
124
124
  const v = [
125
- ...h,
126
- ...Array.from(u.dom.attributes)
125
+ ...g,
126
+ ...Array.from(p.dom.attributes)
127
127
  ].filter(
128
128
  (S) => S.name.startsWith("data") && S.name !== "data-content-type" && S.name !== "data-file-block" && S.name !== "data-node-view-wrapper" && S.name !== "data-node-type" && S.name !== "data-id" && S.name !== "data-editable"
129
129
  );
130
130
  for (const S of v)
131
- u.dom.firstChild.setAttribute(S.name, S.value);
132
- we(u.dom.firstChild), g.append(...Array.from(u.dom.childNodes));
131
+ p.dom.firstChild.setAttribute(S.name, S.value);
132
+ ye(p.dom.firstChild), i > 0 && p.dom.firstChild.setAttribute(
133
+ "data-nesting-level",
134
+ i.toString()
135
+ ), d.append(...Array.from(p.dom.childNodes));
133
136
  } else
134
- g.append(u.dom);
135
- if (u.contentDOM && t.content) {
136
- const v = ye(
137
+ d.append(p.dom), i > 0 && p.dom.setAttribute(
138
+ "data-nesting-level",
139
+ i.toString()
140
+ );
141
+ if (p.contentDOM && t.content) {
142
+ const v = be(
137
143
  e,
138
144
  t.content,
139
145
  // TODO
140
146
  o,
141
- i
147
+ a
142
148
  );
143
- u.contentDOM.appendChild(v);
149
+ p.contentDOM.appendChild(v);
144
150
  }
145
- let d;
146
- if (r.has(t.type) ? d = "OL" : s.has(t.type) && (d = "UL"), d) {
147
- if (((E = n.lastChild) == null ? void 0 : E.nodeName) !== d) {
148
- const v = a.createElement(d);
149
- d === "OL" && "start" in l && l.start && (l == null ? void 0 : l.start) !== 1 && v.setAttribute("start", l.start + ""), n.append(v);
151
+ let f;
152
+ if (r.has(t.type) ? f = "OL" : s.has(t.type) && (f = "UL"), f) {
153
+ if (((O = n.lastChild) == null ? void 0 : O.nodeName) !== f) {
154
+ const v = c.createElement(f);
155
+ f === "OL" && "start" in u && u.start && (u == null ? void 0 : u.start) !== 1 && v.setAttribute("start", u.start + ""), n.append(v);
150
156
  }
151
- n.lastChild.appendChild(g);
157
+ n.lastChild.appendChild(d);
152
158
  } else
153
- n.append(g);
159
+ n.append(d);
154
160
  if (t.children && t.children.length > 0) {
155
- const v = a.createDocumentFragment();
156
- if (be(
161
+ const v = c.createDocumentFragment();
162
+ if (ve(
157
163
  v,
158
164
  e,
159
165
  t.children,
160
166
  o,
161
167
  r,
162
168
  s,
163
- i
164
- ), ((O = n.lastChild) == null ? void 0 : O.nodeName) === "UL" || ((_ = n.lastChild) == null ? void 0 : _.nodeName) === "OL")
165
- for (; ((z = v.firstChild) == null ? void 0 : z.nodeName) === "UL" || ((K = v.firstChild) == null ? void 0 : K.nodeName) === "OL"; )
169
+ i + 1,
170
+ a
171
+ ), ((_ = n.lastChild) == null ? void 0 : _.nodeName) === "UL" || ((z = n.lastChild) == null ? void 0 : z.nodeName) === "OL")
172
+ for (; ((K = v.firstChild) == null ? void 0 : K.nodeName) === "UL" || ((Y = v.firstChild) == null ? void 0 : Y.nodeName) === "OL"; )
166
173
  n.lastChild.lastChild.appendChild(v.firstChild);
167
- e.pmSchema.nodes[t.type].isInGroup("blockContent") ? n.append(v) : (Y = u.contentDOM) == null || Y.append(v);
174
+ e.pmSchema.nodes[t.type].isInGroup("blockContent") ? n.append(v) : (X = p.contentDOM) == null || X.append(v);
168
175
  }
169
176
  }
170
- const be = (n, e, t, o, r, s, i) => {
171
- for (const a of t)
172
- yt(
177
+ const ve = (n, e, t, o, r, s, i = 0, a) => {
178
+ for (const c of t)
179
+ bt(
173
180
  n,
174
181
  e,
175
- a,
182
+ c,
176
183
  o,
177
184
  r,
178
185
  s,
179
- i
186
+ i,
187
+ a
180
188
  );
181
- }, bt = (n, e, t, o, r, s) => {
189
+ }, vt = (n, e, t, o, r, s) => {
182
190
  const a = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
183
- return be(
191
+ return ve(
184
192
  a,
185
193
  n,
186
194
  e,
187
195
  t,
188
196
  o,
189
197
  r,
198
+ 0,
190
199
  s
191
200
  ), a;
192
- }, ve = (n, e) => {
193
- const t = fe.fromSchema(n);
201
+ }, ke = (n, e) => {
202
+ const t = ge.fromSchema(n);
194
203
  return {
195
204
  exportBlocks: (o, r) => {
196
- const s = bt(
205
+ const s = vt(
197
206
  e,
198
207
  o,
199
208
  t,
@@ -204,7 +213,7 @@ const be = (n, e, t, o, r, s, i) => {
204
213
  return i.append(s), i.innerHTML;
205
214
  },
206
215
  exportInlineContent: (o, r) => {
207
- const s = ye(
216
+ const s = be(
208
217
  e,
209
218
  o,
210
219
  t,
@@ -214,33 +223,33 @@ const be = (n, e, t, o, r, s, i) => {
214
223
  }
215
224
  };
216
225
  };
217
- function vt(n, e) {
226
+ function kt(n, e) {
218
227
  if (e === 0)
219
228
  return;
220
229
  const t = n.resolve(e);
221
230
  for (let o = t.depth; o > 0; o--) {
222
231
  const r = t.node(o);
223
- if (ue(r))
232
+ if (he(r))
224
233
  return r.attrs.id;
225
234
  }
226
235
  }
227
- function kt(n) {
236
+ function Ct(n) {
228
237
  return n.getMeta("paste") ? { type: "paste" } : n.getMeta("uiEvent") === "drop" ? { type: "drop" } : n.getMeta("history$") ? {
229
238
  type: n.getMeta("history$").redo ? "redo" : "undo"
230
239
  } : n.getMeta("y-sync$") ? n.getMeta("y-sync$").isUndoRedoOperation ? { type: "undo-redo" } : { type: "yjs-remote" } : { type: "local" };
231
240
  }
232
- function Z(n) {
233
- const e = "__root__", t = {}, o = {}, r = N(n);
241
+ function ee(n) {
242
+ const e = "__root__", t = {}, o = {}, r = R(n);
234
243
  return n.descendants((s, i) => {
235
- if (!ue(s))
244
+ if (!he(s))
236
245
  return !0;
237
- const a = vt(n, i), c = a ?? e;
246
+ const a = kt(n, i), c = a ?? e;
238
247
  o[c] || (o[c] = []);
239
- const l = R(s, r);
248
+ const l = L(s, r);
240
249
  return t[s.attrs.id] = { block: l, parentId: a }, o[c].push(s.attrs.id), !0;
241
250
  }), { byId: t, childrenByParent: o };
242
251
  }
243
- function Ct(n, e) {
252
+ function St(n, e) {
244
253
  const t = /* @__PURE__ */ new Set();
245
254
  if (!n || !e)
246
255
  return t;
@@ -252,93 +261,93 @@ function Ct(n, e) {
252
261
  const i = {};
253
262
  for (let d = 0; d < s.length; d++)
254
263
  i[s[d]] = d;
255
- const a = r.map((d) => i[d]), c = a.length, l = [], m = [], h = new Array(c).fill(-1), f = (d, p) => {
264
+ const a = r.map((d) => i[d]), c = a.length, l = [], u = [], h = new Array(c).fill(-1), g = (d, f) => {
256
265
  let w = 0, y = d.length;
257
266
  for (; w < y; ) {
258
267
  const E = w + y >>> 1;
259
- d[E] < p ? w = E + 1 : y = E;
268
+ d[E] < f ? w = E + 1 : y = E;
260
269
  }
261
270
  return w;
262
271
  };
263
272
  for (let d = 0; d < c; d++) {
264
- const p = a[d], w = f(l, p);
265
- w > 0 && (h[d] = m[w - 1]), w === l.length ? (l.push(p), m.push(d)) : (l[w] = p, m[w] = d);
273
+ const f = a[d], w = g(l, f);
274
+ w > 0 && (h[d] = u[w - 1]), w === l.length ? (l.push(f), u.push(d)) : (l[w] = f, u[w] = d);
266
275
  }
267
- const u = /* @__PURE__ */ new Set();
268
- let g = m[m.length - 1] ?? -1;
269
- for (; g !== -1; )
270
- u.add(g), g = h[g];
276
+ const m = /* @__PURE__ */ new Set();
277
+ let p = u[u.length - 1] ?? -1;
278
+ for (; p !== -1; )
279
+ m.add(p), p = h[p];
271
280
  for (let d = 0; d < r.length; d++)
272
- u.has(d) || t.add(r[d]);
281
+ m.has(d) || t.add(r[d]);
273
282
  return t;
274
283
  }
275
- function St(n, e = []) {
276
- const t = kt(n), o = Be(n.before, [
284
+ function xt(n, e = []) {
285
+ const t = Ct(n), o = Te(n.before, [
277
286
  n,
278
287
  ...e
279
- ]), r = Z(
288
+ ]), r = ee(
280
289
  o.before
281
- ), s = Z(
290
+ ), s = ee(
282
291
  o.doc
283
292
  ), i = [], a = /* @__PURE__ */ new Set();
284
- Object.keys(s.byId).filter((u) => !(u in r.byId)).forEach((u) => {
293
+ Object.keys(s.byId).filter((m) => !(m in r.byId)).forEach((m) => {
285
294
  i.push({
286
295
  type: "insert",
287
- block: s.byId[u].block,
296
+ block: s.byId[m].block,
288
297
  source: t,
289
298
  prevBlock: void 0
290
- }), a.add(u);
291
- }), Object.keys(r.byId).filter((u) => !(u in s.byId)).forEach((u) => {
299
+ }), a.add(m);
300
+ }), Object.keys(r.byId).filter((m) => !(m in s.byId)).forEach((m) => {
292
301
  i.push({
293
302
  type: "delete",
294
- block: r.byId[u].block,
303
+ block: r.byId[m].block,
295
304
  source: t,
296
305
  prevBlock: void 0
297
- }), a.add(u);
298
- }), Object.keys(s.byId).filter((u) => u in r.byId).forEach((u) => {
306
+ }), a.add(m);
307
+ }), Object.keys(s.byId).filter((m) => m in r.byId).forEach((m) => {
299
308
  var w, y;
300
- const g = r.byId[u], d = s.byId[u];
301
- g.parentId !== d.parentId ? (i.push({
309
+ const p = r.byId[m], d = s.byId[m];
310
+ p.parentId !== d.parentId ? (i.push({
302
311
  type: "move",
303
312
  block: d.block,
304
- prevBlock: g.block,
313
+ prevBlock: p.block,
305
314
  source: t,
306
- prevParent: g.parentId ? (w = r.byId[g.parentId]) == null ? void 0 : w.block : void 0,
315
+ prevParent: p.parentId ? (w = r.byId[p.parentId]) == null ? void 0 : w.block : void 0,
307
316
  currentParent: d.parentId ? (y = s.byId[d.parentId]) == null ? void 0 : y.block : void 0
308
- }), a.add(u)) : Oe(
309
- { ...g.block, children: void 0 },
317
+ }), a.add(m)) : De(
318
+ { ...p.block, children: void 0 },
310
319
  { ...d.block, children: void 0 }
311
320
  ) || (i.push({
312
321
  type: "update",
313
322
  block: d.block,
314
- prevBlock: g.block,
323
+ prevBlock: p.block,
315
324
  source: t
316
- }), a.add(u));
325
+ }), a.add(m));
317
326
  });
318
- const c = r.childrenByParent, l = s.childrenByParent, m = "__root__", h = /* @__PURE__ */ new Set([
327
+ const c = r.childrenByParent, l = s.childrenByParent, u = "__root__", h = /* @__PURE__ */ new Set([
319
328
  ...Object.keys(c),
320
329
  ...Object.keys(l)
321
- ]), f = /* @__PURE__ */ new Set();
322
- return h.forEach((u) => {
323
- const g = Ct(
324
- c[u],
325
- l[u]
330
+ ]), g = /* @__PURE__ */ new Set();
331
+ return h.forEach((m) => {
332
+ const p = St(
333
+ c[m],
334
+ l[m]
326
335
  );
327
- g.size !== 0 && g.forEach((d) => {
336
+ p.size !== 0 && p.forEach((d) => {
328
337
  var E, O;
329
- const p = r.byId[d], w = s.byId[d];
330
- !p || !w || p.parentId !== w.parentId || a.has(d) || (p.parentId ?? m) !== u || f.has(d) || (f.add(d), i.push({
338
+ const f = r.byId[d], w = s.byId[d];
339
+ !f || !w || f.parentId !== w.parentId || a.has(d) || (f.parentId ?? u) !== m || g.has(d) || (g.add(d), i.push({
331
340
  type: "move",
332
341
  block: w.block,
333
- prevBlock: p.block,
342
+ prevBlock: f.block,
334
343
  source: t,
335
- prevParent: p.parentId ? (E = r.byId[p.parentId]) == null ? void 0 : E.block : void 0,
344
+ prevParent: f.parentId ? (E = r.byId[f.parentId]) == null ? void 0 : E.block : void 0,
336
345
  currentParent: w.parentId ? (O = s.byId[w.parentId]) == null ? void 0 : O.block : void 0
337
346
  }), a.add(d));
338
347
  });
339
348
  }), i;
340
349
  }
341
- const po = k(() => {
350
+ const fo = k(() => {
342
351
  const n = [];
343
352
  return {
344
353
  key: "blockChange",
@@ -349,7 +358,7 @@ const po = k(() => {
349
358
  let t;
350
359
  return n.reduce((o, r) => o === !1 ? o : r({
351
360
  getChanges() {
352
- return t || (t = St(e), t);
361
+ return t || (t = xt(e), t);
353
362
  },
354
363
  tr: e
355
364
  }) !== !1, !0);
@@ -369,25 +378,25 @@ const po = k(() => {
369
378
  }
370
379
  };
371
380
  });
372
- function ee(n) {
381
+ function te(n) {
373
382
  const e = n.charAt(0) === "#" ? n.substring(1, 7) : n, t = parseInt(e.substring(0, 2), 16), o = parseInt(e.substring(2, 4), 16), r = parseInt(e.substring(4, 6), 16), i = [t / 255, o / 255, r / 255].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
374
383
  return 0.2126 * i[0] + 0.7152 * i[1] + 0.0722 * i[2] <= 0.179;
375
384
  }
376
- function xt(n) {
385
+ function Et(n) {
377
386
  const e = document.createElement("span");
378
387
  e.classList.add("bn-collaboration-cursor__base");
379
388
  const t = document.createElement("span");
380
389
  t.setAttribute("contentedEditable", "false"), t.classList.add("bn-collaboration-cursor__caret"), t.setAttribute(
381
390
  "style",
382
- `background-color: ${n.color}; color: ${ee(n.color) ? "white" : "black"}`
391
+ `background-color: ${n.color}; color: ${te(n.color) ? "white" : "black"}`
383
392
  );
384
393
  const o = document.createElement("span");
385
394
  return o.classList.add("bn-collaboration-cursor__label"), o.setAttribute(
386
395
  "style",
387
- `background-color: ${n.color}; color: ${ee(n.color) ? "white" : "black"}`
396
+ `background-color: ${n.color}; color: ${te(n.color) ? "white" : "black"}`
388
397
  ), o.insertBefore(document.createTextNode(n.name), null), t.insertBefore(o, null), e.insertBefore(document.createTextNode("⁠"), null), e.insertBefore(t, null), e.insertBefore(document.createTextNode("⁠"), null), e;
389
398
  }
390
- const te = k(
399
+ const oe = k(
391
400
  ({ options: n }) => {
392
401
  const e = /* @__PURE__ */ new Map(), t = n.provider && "awareness" in n.provider && typeof n.provider.awareness == "object" ? n.provider.awareness : void 0;
393
402
  return t && ("setLocalStateField" in t && typeof t.setLocalStateField == "function" && t.setLocalStateField("user", n.user), "on" in t && typeof t.on == "function" && n.showCursorLabels !== "always" && t.on(
@@ -408,12 +417,12 @@ const te = k(
408
417
  )), {
409
418
  key: "yCursor",
410
419
  prosemirrorPlugins: [
411
- t ? Ue(t, {
412
- selectionBuilder: _e,
420
+ t ? _e(t, {
421
+ selectionBuilder: ze,
413
422
  cursorBuilder(o, r) {
414
423
  let s = e.get(r);
415
424
  if (!s) {
416
- const i = (n.renderCursor ?? xt)(o);
425
+ const i = (n.renderCursor ?? Et)(o);
417
426
  n.showCursorLabels !== "always" && (i.addEventListener("mouseenter", () => {
418
427
  const a = e.get(r);
419
428
  a.element.setAttribute("data-active", ""), a.hideTimeout && (clearTimeout(a.hideTimeout), e.set(r, {
@@ -446,17 +455,17 @@ const te = k(
446
455
  ), F = k(
447
456
  ({ options: n }) => ({
448
457
  key: "ySync",
449
- prosemirrorPlugins: [ze(n.fragment)],
458
+ prosemirrorPlugins: [Ke(n.fragment)],
450
459
  runsBefore: ["default"]
451
460
  })
452
461
  ), $ = k(() => ({
453
462
  key: "yUndo",
454
- prosemirrorPlugins: [Xe()],
463
+ prosemirrorPlugins: [je()],
455
464
  dependsOn: ["yCursor", "ySync"],
456
- undoCommand: Ye,
457
- redoCommand: Ke
465
+ undoCommand: Xe,
466
+ redoCommand: Ye
458
467
  }));
459
- function Et(n, e) {
468
+ function It(n, e) {
460
469
  const t = n.doc;
461
470
  if (n._item === null) {
462
471
  const o = Array.from(t.share.keys()).find(
@@ -470,7 +479,7 @@ function Et(n, e) {
470
479
  return r[s].content.type;
471
480
  }
472
481
  }
473
- const fo = k(
482
+ const go = k(
474
483
  ({ editor: n, options: e }) => {
475
484
  let t;
476
485
  const o = H({ isForked: !1 });
@@ -490,14 +499,14 @@ const fo = k(
490
499
  throw new Error("No fragment to fork from");
491
500
  const s = new I.Doc();
492
501
  I.applyUpdate(s, I.encodeStateAsUpdate(r.doc));
493
- const i = Et(r, s);
502
+ const i = It(r, s);
494
503
  t = {
495
- undoStack: Q.getState(n.prosemirrorState).undoManager.undoStack,
504
+ undoStack: Z.getState(n.prosemirrorState).undoManager.undoStack,
496
505
  originalFragment: r,
497
506
  forkedFragment: i
498
507
  }, n.unregisterExtension([
499
508
  $,
500
- te,
509
+ oe,
501
510
  F
502
511
  ]);
503
512
  const a = {
@@ -522,9 +531,9 @@ const fo = k(
522
531
  const { originalFragment: s, forkedFragment: i, undoStack: a } = t;
523
532
  if (n.registerExtension([
524
533
  F(e),
525
- te(e),
534
+ oe(e),
526
535
  $()
527
- ]), Q.getState(
536
+ ]), Z.getState(
528
537
  n.prosemirrorState
529
538
  ).undoManager.undoStack = a, r) {
530
539
  const c = I.encodeStateAsUpdate(
@@ -537,18 +546,18 @@ const fo = k(
537
546
  }
538
547
  };
539
548
  }
540
- ), ke = (n, e) => {
549
+ ), Ce = (n, e) => {
541
550
  e(n), n.forEach((t) => {
542
- t instanceof I.XmlElement && ke(t, e);
551
+ t instanceof I.XmlElement && Ce(t, e);
543
552
  });
544
- }, It = (n, e) => {
553
+ }, Bt = (n, e) => {
545
554
  const t = /* @__PURE__ */ new Map();
546
555
  return n.forEach((o) => {
547
- o instanceof I.XmlElement && ke(o, (r) => {
556
+ o instanceof I.XmlElement && Ce(o, (r) => {
548
557
  if (r.nodeName === "blockContainer" && r.hasAttribute("id")) {
549
558
  const s = r.getAttribute("textColor"), i = r.getAttribute("backgroundColor"), a = {
550
- textColor: s === G.textColor.default ? void 0 : s,
551
- backgroundColor: i === G.backgroundColor.default ? void 0 : i
559
+ textColor: s === J.textColor.default ? void 0 : s,
560
+ backgroundColor: i === J.backgroundColor.default ? void 0 : i
552
561
  };
553
562
  (a.textColor || a.backgroundColor) && t.set(r.getAttribute("id"), a);
554
563
  }
@@ -566,14 +575,14 @@ const fo = k(
566
575
  });
567
576
  }
568
577
  }), !0);
569
- }, Bt = [It], go = k(
578
+ }, Tt = [Bt], wo = k(
570
579
  ({ options: n }) => {
571
580
  let e = !1;
572
- const t = new me("schemaMigration");
581
+ const t = new pe("schemaMigration");
573
582
  return {
574
583
  key: "schemaMigration",
575
584
  prosemirrorPlugins: [
576
- new pe({
585
+ new fe({
577
586
  key: t,
578
587
  appendTransaction: (o, r, s) => {
579
588
  if (e || // If any of the transactions are not due to a yjs sync, we don't need to run the migration
@@ -582,7 +591,7 @@ const fo = k(
582
591
  !n.fragment.firstChild)
583
592
  return;
584
593
  const i = s.tr;
585
- for (const a of Bt)
594
+ for (const a of Tt)
586
595
  a(n.fragment, i);
587
596
  if (e = !0, !!i.docChanged)
588
597
  return i;
@@ -591,24 +600,24 @@ const fo = k(
591
600
  ]
592
601
  };
593
602
  }
594
- ), wo = k(
603
+ ), yo = k(
595
604
  ({
596
605
  editor: n,
597
606
  options: e
598
607
  }) => ({
599
608
  key: "dropCursor",
600
609
  prosemirrorPlugins: [
601
- (e.dropCursor ?? qe)({
610
+ (e.dropCursor ?? We)({
602
611
  width: 5,
603
612
  color: "#ddeeff",
604
613
  editor: n
605
614
  })
606
615
  ]
607
616
  })
608
- ), yo = k(({ editor: n }) => {
617
+ ), bo = k(({ editor: n }) => {
609
618
  const e = H(!1), t = () => n.transact((o) => {
610
619
  var s;
611
- if (o.selection.empty || o.selection instanceof ae && (o.selection.node.type.spec.content === "inline*" || ((s = o.selection.node.firstChild) == null ? void 0 : s.type.spec.content) === "inline*") || o.selection instanceof le && o.doc.textBetween(o.selection.from, o.selection.to).length === 0)
620
+ if (o.selection.empty || o.selection instanceof le && (o.selection.node.type.spec.content === "inline*" || ((s = o.selection.node.firstChild) == null ? void 0 : s.type.spec.content) === "inline*") || o.selection instanceof ce && o.doc.textBetween(o.selection.from, o.selection.to).length === 0)
612
621
  return !1;
613
622
  let r = !1;
614
623
  return o.selection.content().content.descendants((i) => (i.type.spec.code && (r = !0), !r)), !r;
@@ -649,12 +658,12 @@ const fo = k(
649
658
  });
650
659
  }
651
660
  };
652
- }), bo = k(() => ({
661
+ }), vo = k(() => ({
653
662
  key: "history",
654
- prosemirrorPlugins: [Je()],
655
- undoCommand: Ge,
656
- redoCommand: We
657
- })), vo = k(({ editor: n }) => {
663
+ prosemirrorPlugins: [Qe()],
664
+ undoCommand: Je,
665
+ redoCommand: Ge
666
+ })), ko = k(({ editor: n }) => {
658
667
  function e(r) {
659
668
  let s = n.prosemirrorView.nodeDOM(r);
660
669
  for (; s && s.parentElement; ) {
@@ -666,10 +675,10 @@ const fo = k(
666
675
  }
667
676
  function t(r, s) {
668
677
  return n.transact((i) => {
669
- const a = i.doc.resolve(r), c = a.marks().find((m) => m.type.name === s);
678
+ const a = i.doc.resolve(r), c = a.marks().find((u) => u.type.name === s);
670
679
  if (!c)
671
680
  return;
672
- const l = Te(a, c.type);
681
+ const l = Pe(a, c.type);
673
682
  if (l)
674
683
  return {
675
684
  range: l,
@@ -678,7 +687,7 @@ const fo = k(
678
687
  return i.doc.textBetween(l.from, l.to);
679
688
  },
680
689
  get position() {
681
- return Pe(
690
+ return Oe(
682
691
  n.prosemirrorView,
683
692
  l.from,
684
693
  l.to
@@ -707,7 +716,7 @@ const fo = k(
707
716
  },
708
717
  editLink(r, s, i = n.transact((a) => a.selection.anchor)) {
709
718
  n.transact((a) => {
710
- const c = N(a), { range: l } = t(i + 1, "link") || {
719
+ const c = R(a), { range: l } = t(i + 1, "link") || {
711
720
  range: {
712
721
  from: a.selection.from,
713
722
  to: a.selection.to
@@ -722,7 +731,7 @@ const fo = k(
722
731
  },
723
732
  deleteLink(r = n.transact((s) => s.selection.anchor)) {
724
733
  n.transact((s) => {
725
- const i = N(s), { range: a } = t(r + 1, "link") || {
734
+ const i = R(s), { range: a } = t(r + 1, "link") || {
726
735
  range: {
727
736
  from: s.selection.from,
728
737
  to: s.selection.to
@@ -735,7 +744,7 @@ const fo = k(
735
744
  }), n.prosemirrorView.focus();
736
745
  }
737
746
  };
738
- }), ko = [
747
+ }), Co = [
739
748
  "http",
740
749
  "https",
741
750
  "ftp",
@@ -746,12 +755,12 @@ const fo = k(
746
755
  "sms",
747
756
  "cid",
748
757
  "xmpp"
749
- ], Co = "https", Tt = new P("node-selection-keyboard"), So = k(
758
+ ], So = "https", Pt = new P("node-selection-keyboard"), xo = k(
750
759
  () => ({
751
760
  key: "nodeSelectionKeyboard",
752
761
  prosemirrorPlugins: [
753
762
  new T({
754
- key: Tt,
763
+ key: Pt,
755
764
  props: {
756
765
  handleKeyDown: (n, e) => {
757
766
  if ("node" in n.state.selection) {
@@ -766,7 +775,7 @@ const fo = k(
766
775
  n.state.tr.selection.$to.after(),
767
776
  n.state.schema.nodes.paragraph.createChecked()
768
777
  ).setSelection(
769
- new le(
778
+ new ce(
770
779
  t.doc.resolve(
771
780
  n.state.tr.selection.$to.after() + 1
772
781
  )
@@ -781,7 +790,7 @@ const fo = k(
781
790
  })
782
791
  ]
783
792
  })
784
- ), Pt = new P("blocknote-placeholder"), xo = k(
793
+ ), Ot = new P("blocknote-placeholder"), Eo = k(
785
794
  ({
786
795
  editor: n,
787
796
  options: e
@@ -791,9 +800,9 @@ const fo = k(
791
800
  key: "placeholder",
792
801
  prosemirrorPlugins: [
793
802
  new T({
794
- key: Pt,
803
+ key: Ot,
795
804
  view: (o) => {
796
- const r = `placeholder-selector-${Qe()}`;
805
+ const r = `placeholder-selector-${Ze()}`;
797
806
  o.dom.classList.add(r);
798
807
  const s = document.createElement("style"), i = n._tiptapEditor.options.injectNonce;
799
808
  i && s.setAttribute("nonce", i), o.root instanceof window.ShadowRoot ? o.root.append(s) : o.root.head.appendChild(s);
@@ -801,24 +810,24 @@ const fo = k(
801
810
  try {
802
811
  const {
803
812
  default: l,
804
- emptyDocument: m,
813
+ emptyDocument: u,
805
814
  ...h
806
815
  } = t || {};
807
- for (const [g, d] of Object.entries(h)) {
808
- const p = `[data-content-type="${g}"]`;
816
+ for (const [p, d] of Object.entries(h)) {
817
+ const f = `[data-content-type="${p}"]`;
809
818
  a.insertRule(
810
- `${c(p)} { content: ${JSON.stringify(
819
+ `${c(f)} { content: ${JSON.stringify(
811
820
  d
812
821
  )}; }`
813
822
  );
814
823
  }
815
- const f = "[data-is-only-empty-block]", u = "[data-is-empty-and-focused]";
824
+ const g = "[data-is-only-empty-block]", m = "[data-is-empty-and-focused]";
816
825
  a.insertRule(
817
- `${c(f)} { content: ${JSON.stringify(
818
- m
826
+ `${c(g)} { content: ${JSON.stringify(
827
+ u
819
828
  )}; }`
820
829
  ), a.insertRule(
821
- `${c(u)} { content: ${JSON.stringify(
830
+ `${c(m)} { content: ${JSON.stringify(
822
831
  l
823
832
  )}; }`
824
833
  );
@@ -861,7 +870,7 @@ const fo = k(
861
870
  ]
862
871
  };
863
872
  }
864
- ), oe = new P("previous-blocks"), Ot = {
873
+ ), ne = new P("previous-blocks"), Dt = {
865
874
  // Numbered List Items
866
875
  index: "index",
867
876
  // Headings
@@ -870,20 +879,20 @@ const fo = k(
870
879
  type: "type",
871
880
  depth: "depth",
872
881
  "depth-change": "depth-change"
873
- }, Eo = k(() => {
882
+ }, Io = k(() => {
874
883
  let n;
875
884
  return {
876
885
  key: "previousBlockType",
877
886
  prosemirrorPlugins: [
878
887
  new T({
879
- key: oe,
888
+ key: ne,
880
889
  view(e) {
881
890
  return {
882
891
  update: async (t, o) => {
883
892
  var r;
884
893
  ((r = this.key) == null ? void 0 : r.getState(t.state).updatedBlocks.size) > 0 && (n = setTimeout(() => {
885
894
  t.dispatch(
886
- t.state.tr.setMeta(oe, { clearUpdate: !0 })
895
+ t.state.tr.setMeta(ne, { clearUpdate: !0 })
887
896
  );
888
897
  }, 0));
889
898
  },
@@ -906,30 +915,30 @@ const fo = k(
906
915
  apply(e, t, o, r) {
907
916
  if (t.currentTransactionOldBlockAttrs = {}, t.updatedBlocks.clear(), !e.docChanged || o.doc.eq(r.doc))
908
917
  return t;
909
- const s = {}, i = X(
918
+ const s = {}, i = j(
910
919
  o.doc,
911
920
  (l) => l.attrs.id
912
921
  ), a = new Map(
913
922
  i.map((l) => [l.node.attrs.id, l])
914
- ), c = X(
923
+ ), c = j(
915
924
  r.doc,
916
925
  (l) => l.attrs.id
917
926
  );
918
927
  for (const l of c) {
919
- const m = a.get(l.node.attrs.id), h = m == null ? void 0 : m.node.firstChild, f = l.node.firstChild;
920
- if (m && h && f) {
921
- const u = {
922
- index: f.attrs.index,
923
- level: f.attrs.level,
924
- type: f.type.name,
928
+ const u = a.get(l.node.attrs.id), h = u == null ? void 0 : u.node.firstChild, g = l.node.firstChild;
929
+ if (u && h && g) {
930
+ const m = {
931
+ index: g.attrs.index,
932
+ level: g.attrs.level,
933
+ type: g.type.name,
925
934
  depth: r.doc.resolve(l.pos).depth
926
- }, g = {
935
+ }, p = {
927
936
  index: h.attrs.index,
928
937
  level: h.attrs.level,
929
938
  type: h.type.name,
930
- depth: o.doc.resolve(m.pos).depth
939
+ depth: o.doc.resolve(u.pos).depth
931
940
  };
932
- s[l.node.attrs.id] = g, t.currentTransactionOldBlockAttrs[l.node.attrs.id] = g, JSON.stringify(g) !== JSON.stringify(u) && (g["depth-change"] = g.depth - u.depth, t.updatedBlocks.add(l.node.attrs.id));
941
+ s[l.node.attrs.id] = p, t.currentTransactionOldBlockAttrs[l.node.attrs.id] = p, JSON.stringify(p) !== JSON.stringify(m) && (p["depth-change"] = p.depth - m.depth, t.updatedBlocks.add(l.node.attrs.id));
933
942
  }
934
943
  }
935
944
  return t.prevTransactionOldBlockAttrs = s, t;
@@ -945,8 +954,8 @@ const fo = k(
945
954
  if (!r.attrs.id || !t.updatedBlocks.has(r.attrs.id))
946
955
  return;
947
956
  const i = t.currentTransactionOldBlockAttrs[r.attrs.id], a = {};
948
- for (const [l, m] of Object.entries(i))
949
- a["data-prev-" + Ot[l]] = m || "none";
957
+ for (const [l, u] of Object.entries(i))
958
+ a["data-prev-" + Dt[l]] = u || "none";
950
959
  const c = A.node(s, s + r.nodeSize, {
951
960
  ...a
952
961
  });
@@ -958,14 +967,14 @@ const fo = k(
958
967
  ]
959
968
  };
960
969
  });
961
- function Ce(n, e) {
970
+ function Se(n, e) {
962
971
  var t, o;
963
972
  for (; n && n.parentElement && n.parentElement !== e.dom && ((t = n.getAttribute) == null ? void 0 : t.call(n, "data-node-type")) !== "blockContainer"; )
964
973
  n = n.parentElement;
965
974
  if (((o = n.getAttribute) == null ? void 0 : o.call(n, "data-node-type")) === "blockContainer")
966
975
  return { node: n, id: n.getAttribute("data-id") };
967
976
  }
968
- function Dt() {
977
+ function At() {
969
978
  const n = (e) => {
970
979
  let t = e.children.length;
971
980
  for (let o = 0; o < t; o++) {
@@ -981,7 +990,7 @@ function Dt() {
981
990
  };
982
991
  return n;
983
992
  }
984
- function At() {
993
+ function Mt() {
985
994
  const n = (e) => {
986
995
  var t;
987
996
  if (e.children && "length" in e.children && e.children.length)
@@ -990,15 +999,15 @@ function At() {
990
999
  r.type === "element" && r.tagName === "input" && ((t = r.properties) == null ? void 0 : t.type) === "checkbox" && (s == null ? void 0 : s.type) === "element" && s.tagName === "p" ? (s.tagName = "span", s.children.splice(
991
1000
  0,
992
1001
  0,
993
- at(document.createTextNode(" "))
1002
+ lt(document.createTextNode(" "))
994
1003
  )) : n(r);
995
1004
  }
996
1005
  };
997
1006
  return n;
998
1007
  }
999
- function Mt() {
1008
+ function Nt() {
1000
1009
  return (n) => {
1001
- lt(n, "element", (e, t, o) => {
1010
+ ct(n, "element", (e, t, o) => {
1002
1011
  var r, s, i, a;
1003
1012
  if (o && e.tagName === "video") {
1004
1013
  const c = ((r = e.properties) == null ? void 0 : r.src) || ((s = e.properties) == null ? void 0 : s["data-url"]) || "", l = ((i = e.properties) == null ? void 0 : i.title) || ((a = e.properties) == null ? void 0 : a["data-name"]) || "";
@@ -1010,26 +1019,26 @@ function Mt() {
1010
1019
  });
1011
1020
  };
1012
1021
  }
1013
- function Se(n) {
1014
- return it().use(ot, { fragment: !0 }).use(Mt).use(Dt).use(At).use(nt).use(rt).use(st, {
1022
+ function xe(n) {
1023
+ return at().use(nt, { fragment: !0 }).use(Nt).use(At).use(Mt).use(rt).use(st).use(it, {
1015
1024
  handlers: { text: (t) => t.value }
1016
1025
  }).processSync(n).value;
1017
1026
  }
1018
- function Io(n, e, t, o) {
1019
- const s = ve(e, t).exportBlocks(n, o);
1020
- return Se(s);
1027
+ function Bo(n, e, t, o) {
1028
+ const s = ke(e, t).exportBlocks(n, o);
1029
+ return xe(s);
1021
1030
  }
1022
- function Lt(n) {
1031
+ function Rt(n) {
1023
1032
  const e = [];
1024
1033
  return n.descendants((t) => {
1025
1034
  var r, s;
1026
- const o = N(t);
1035
+ const o = R(t);
1027
1036
  return t.type.name === "blockContainer" && ((r = t.firstChild) == null ? void 0 : r.type.name) === "blockGroup" ? !0 : t.type.name === "columnList" && t.childCount === 1 ? ((s = t.firstChild) == null || s.forEach((i) => {
1028
- e.push(R(i, o));
1029
- }), !1) : t.type.isInGroup("bnBlock") ? (e.push(R(t, o)), !1) : !0;
1037
+ e.push(L(i, o));
1038
+ }), !1) : t.type.isInGroup("bnBlock") ? (e.push(L(t, o)), !1) : !0;
1030
1039
  }), e;
1031
1040
  }
1032
- class B extends L {
1041
+ class B extends N {
1033
1042
  constructor(t, o) {
1034
1043
  super(t, o);
1035
1044
  b(this, "nodes");
@@ -1043,7 +1052,7 @@ class B extends L {
1043
1052
  return new B(t.resolve(o), t.resolve(r));
1044
1053
  }
1045
1054
  content() {
1046
- return new tt(ge.from(this.nodes), 0, 0);
1055
+ return new ot(we.from(this.nodes), 0, 0);
1047
1056
  }
1048
1057
  eq(t) {
1049
1058
  if (!(t instanceof B) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to)
@@ -1055,7 +1064,7 @@ class B extends L {
1055
1064
  }
1056
1065
  map(t, o) {
1057
1066
  const r = o.mapResult(this.from), s = o.mapResult(this.to);
1058
- return s.deleted ? L.near(t.resolve(r.pos)) : r.deleted ? L.near(t.resolve(s.pos)) : new B(
1067
+ return s.deleted ? N.near(t.resolve(r.pos)) : r.deleted ? N.near(t.resolve(s.pos)) : new B(
1059
1068
  t.resolve(r.pos),
1060
1069
  t.resolve(s.pos)
1061
1070
  );
@@ -1064,9 +1073,9 @@ class B extends L {
1064
1073
  return { type: "multiple-node", anchor: this.anchor, head: this.head };
1065
1074
  }
1066
1075
  }
1067
- L.jsonID("multiple-node", B);
1076
+ N.jsonID("multiple-node", B);
1068
1077
  let x;
1069
- function Nt(n, e) {
1078
+ function Lt(n, e) {
1070
1079
  let t, o;
1071
1080
  const r = e.resolve(n.from).node().type.spec.group === "blockContent", s = e.resolve(n.to).node().type.spec.group === "blockContent", i = Math.min(n.$anchor.depth, n.$head.depth);
1072
1081
  if (r && s) {
@@ -1076,9 +1085,9 @@ function Nt(n, e) {
1076
1085
  t = n.from, o = n.to;
1077
1086
  return { from: t, to: o };
1078
1087
  }
1079
- function ne(n, e, t = e) {
1088
+ function re(n, e, t = e) {
1080
1089
  e === t && (t += n.state.doc.resolve(e + 1).node().nodeSize);
1081
- const o = n.domAtPos(e).node.cloneNode(!0), r = n.domAtPos(e).node, s = (h, f) => Array.prototype.indexOf.call(h.children, f), i = s(
1090
+ const o = n.domAtPos(e).node.cloneNode(!0), r = n.domAtPos(e).node, s = (h, g) => Array.prototype.indexOf.call(h.children, g), i = s(
1082
1091
  r,
1083
1092
  // Expects from position to be just before the first selected block.
1084
1093
  n.domAtPos(e + 1).node.parentElement
@@ -1089,39 +1098,39 @@ function ne(n, e, t = e) {
1089
1098
  );
1090
1099
  for (let h = r.childElementCount - 1; h >= 0; h--)
1091
1100
  (h > a || h < i) && o.removeChild(o.children[h]);
1092
- xe(n.root), x = o;
1101
+ Ee(n.root), x = o;
1093
1102
  const c = x.getElementsByTagName("iframe");
1094
1103
  for (let h = 0; h < c.length; h++) {
1095
- const f = c[h], u = f.parentElement;
1096
- u && u.removeChild(f);
1104
+ const g = c[h], m = g.parentElement;
1105
+ m && m.removeChild(g);
1097
1106
  }
1098
- const m = n.dom.className.split(" ").filter(
1107
+ const u = n.dom.className.split(" ").filter(
1099
1108
  (h) => h !== "ProseMirror" && h !== "bn-root" && h !== "bn-editor"
1100
1109
  ).join(" ");
1101
- x.className = x.className + " bn-drag-preview " + m, n.root instanceof ShadowRoot ? n.root.appendChild(x) : n.root.body.appendChild(x);
1110
+ x.className = x.className + " bn-drag-preview " + u, n.root instanceof ShadowRoot ? n.root.appendChild(x) : n.root.body.appendChild(x);
1102
1111
  }
1103
- function xe(n) {
1112
+ function Ee(n) {
1104
1113
  x !== void 0 && (n instanceof ShadowRoot ? n.removeChild(x) : n.body.removeChild(x), x = void 0);
1105
1114
  }
1106
- function Rt(n, e, t) {
1115
+ function Vt(n, e, t) {
1107
1116
  if (!n.dataTransfer || t.headless)
1108
1117
  return;
1109
- const o = t.prosemirrorView, r = he(e.id, o.state.doc);
1118
+ const o = t.prosemirrorView, r = me(e.id, o.state.doc);
1110
1119
  if (!r)
1111
1120
  throw new Error(`Block with ID ${e.id} not found`);
1112
1121
  const s = r.posBeforeNode;
1113
1122
  if (s != null) {
1114
- const i = o.state.selection, a = o.state.doc, { from: c, to: l } = Nt(i, a), m = c <= s && s < l, h = i.$anchor.node() !== i.$head.node() || i instanceof B;
1115
- m && h ? (o.dispatch(
1123
+ const i = o.state.selection, a = o.state.doc, { from: c, to: l } = Lt(i, a), u = c <= s && s < l, h = i.$anchor.node() !== i.$head.node() || i instanceof B;
1124
+ u && h ? (o.dispatch(
1116
1125
  o.state.tr.setSelection(B.create(a, c, l))
1117
- ), ne(o, c, l)) : (o.dispatch(
1118
- o.state.tr.setSelection(ae.create(o.state.doc, s))
1119
- ), ne(o, s));
1120
- const f = o.state.selection.content(), u = t.pmSchema, g = o.serializeForClipboard(f).dom.innerHTML, d = ve(u, t), p = Lt(f.content), w = d.exportBlocks(p, {}), y = Se(w);
1121
- n.dataTransfer.clearData(), n.dataTransfer.setData("blocknote/html", g), n.dataTransfer.setData("text/html", w), n.dataTransfer.setData("text/plain", y), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(x, 0, 0);
1126
+ ), re(o, c, l)) : (o.dispatch(
1127
+ o.state.tr.setSelection(le.create(o.state.doc, s))
1128
+ ), re(o, s));
1129
+ const g = o.state.selection.content(), m = t.pmSchema, p = o.serializeForClipboard(g).dom.innerHTML, d = ke(m, t), f = Rt(g.content), w = d.exportBlocks(f, {}), y = xe(w);
1130
+ n.dataTransfer.clearData(), n.dataTransfer.setData("blocknote/html", p), n.dataTransfer.setData("text/html", w), n.dataTransfer.setData("text/plain", y), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(x, 0, 0);
1122
1131
  }
1123
1132
  }
1124
- const re = 250;
1133
+ const se = 250;
1125
1134
  function U(n, e, t = !0) {
1126
1135
  const o = n.root.elementsFromPoint(e.left, e.top);
1127
1136
  for (const r of o)
@@ -1135,9 +1144,9 @@ function U(n, e, t = !0) {
1135
1144
  top: e.top
1136
1145
  },
1137
1146
  !1
1138
- ) : Ce(r, n);
1147
+ ) : Se(r, n);
1139
1148
  }
1140
- function Vt(n, e) {
1149
+ function Ht(n, e) {
1141
1150
  if (!e.dom.firstChild)
1142
1151
  return;
1143
1152
  const t = e.dom.firstChild.getBoundingClientRect(), o = {
@@ -1160,7 +1169,7 @@ function Vt(n, e) {
1160
1169
  !1
1161
1170
  );
1162
1171
  }
1163
- class Ht {
1172
+ class Ft {
1164
1173
  constructor(e, t, o) {
1165
1174
  b(this, "state");
1166
1175
  b(this, "emitUpdate");
@@ -1179,11 +1188,11 @@ class Ht {
1179
1188
  clientX: this.mousePos.x,
1180
1189
  clientY: this.mousePos.y
1181
1190
  });
1182
- if ((e == null ? void 0 : e.element) !== this.pmView.dom || e.distance > re) {
1191
+ if ((e == null ? void 0 : e.element) !== this.pmView.dom || e.distance > se) {
1183
1192
  (o = this.state) != null && o.show && (this.state.show = !1, this.updateState(this.state));
1184
1193
  return;
1185
1194
  }
1186
- const t = Vt(this.mousePos, this.pmView);
1195
+ const t = Ht(this.mousePos, this.pmView);
1187
1196
  if (!t || !this.editor.isEditable) {
1188
1197
  (r = this.state) != null && r.show && (this.state.show = !1, this.updateState(this.state));
1189
1198
  return;
@@ -1235,11 +1244,11 @@ class Ht {
1235
1244
  return;
1236
1245
  const o = document.createElement("div");
1237
1246
  o.innerHTML = t;
1238
- const s = Ze.fromSchema(this.pmView.state.schema).parse(o, {
1247
+ const s = et.fromSchema(this.pmView.state.schema).parse(o, {
1239
1248
  topNode: this.pmView.state.schema.nodes.blockGroup.create()
1240
1249
  });
1241
1250
  this.pmView.dragging = {
1242
- slice: new et(s.content, 0, 0),
1251
+ slice: new tt(s.content, 0, 0),
1243
1252
  move: !0
1244
1253
  };
1245
1254
  });
@@ -1302,7 +1311,7 @@ class Ht {
1302
1311
  b(this, "getDragEventContext", (e) => {
1303
1312
  var c;
1304
1313
  const t = !((c = e.dataTransfer) != null && c.types.includes("blocknote/html")) && !!this.pmView.dragging, o = !!this.isDragOrigin, r = t || o, s = this.findClosestEditorElement(e);
1305
- if (!s || s.distance > re)
1314
+ if (!s || s.distance > se)
1306
1315
  return;
1307
1316
  const i = s.element === this.pmView.dom, a = i && s.distance === 0;
1308
1317
  if (!(!i && !r))
@@ -1339,7 +1348,7 @@ class Ht {
1339
1348
  return;
1340
1349
  this.pmView.dispatch(
1341
1350
  this.pmView.state.tr.setSelection(
1342
- je.create(
1351
+ qe.create(
1343
1352
  this.pmView.state.tr.doc,
1344
1353
  this.pmView.state.tr.selection.anchor
1345
1354
  )
@@ -1454,7 +1463,7 @@ class Ht {
1454
1463
  );
1455
1464
  }
1456
1465
  }
1457
- const Ft = new me("SideMenuPlugin"), Bo = k(({ editor: n }) => {
1466
+ const $t = new pe("SideMenuPlugin"), To = k(({ editor: n }) => {
1458
1467
  let e;
1459
1468
  const t = H(
1460
1469
  void 0
@@ -1463,9 +1472,9 @@ const Ft = new me("SideMenuPlugin"), Bo = k(({ editor: n }) => {
1463
1472
  key: "sideMenu",
1464
1473
  store: t,
1465
1474
  prosemirrorPlugins: [
1466
- new pe({
1467
- key: Ft,
1468
- view: (o) => (e = new Ht(n, o, (r) => {
1475
+ new fe({
1476
+ key: $t,
1477
+ view: (o) => (e = new Ft(n, o, (r) => {
1469
1478
  t.setState({ ...r });
1470
1479
  }), e)
1471
1480
  })
@@ -1474,13 +1483,13 @@ const Ft = new me("SideMenuPlugin"), Bo = k(({ editor: n }) => {
1474
1483
  * Handles drag & drop events for blocks.
1475
1484
  */
1476
1485
  blockDragStart(o, r) {
1477
- e && (e.isDragOrigin = !0), Rt(o, r, n);
1486
+ e && (e.isDragOrigin = !0), Vt(o, r, n);
1478
1487
  },
1479
1488
  /**
1480
1489
  * Handles drag & drop events for blocks.
1481
1490
  */
1482
1491
  blockDragEnd() {
1483
- xe(n.prosemirrorView.root), e && (e.isDragOrigin = !1), n.blur();
1492
+ Ee(n.prosemirrorView.root), e && (e.isDragOrigin = !1), n.blur();
1484
1493
  },
1485
1494
  /**
1486
1495
  * Freezes the side menu. When frozen, the side menu will stay
@@ -1501,16 +1510,16 @@ const Ft = new me("SideMenuPlugin"), Bo = k(({ editor: n }) => {
1501
1510
  };
1502
1511
  });
1503
1512
  let C;
1504
- function se(n) {
1513
+ function ie(n) {
1505
1514
  C || (C = document.createElement("div"), C.innerHTML = "_", C.style.opacity = "0", C.style.height = "1px", C.style.width = "1px", n instanceof Document ? n.body.appendChild(C) : n.appendChild(C));
1506
1515
  }
1507
- function $t(n) {
1516
+ function Ut(n) {
1508
1517
  C && (n instanceof Document ? n.body.removeChild(C) : n.removeChild(C), C = void 0);
1509
1518
  }
1510
1519
  function M(n) {
1511
1520
  return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
1512
1521
  }
1513
- function Ut(n) {
1522
+ function _t(n) {
1514
1523
  let e = n;
1515
1524
  for (; e && e.nodeName !== "TD" && e.nodeName !== "TH" && !e.classList.contains("tableWrapper"); ) {
1516
1525
  if (e.classList.contains("ProseMirror"))
@@ -1530,12 +1539,12 @@ function Ut(n) {
1530
1539
  tbodyNode: e.querySelector("tbody")
1531
1540
  };
1532
1541
  }
1533
- function _t(n, e) {
1542
+ function zt(n, e) {
1534
1543
  const t = e.querySelectorAll(n);
1535
1544
  for (let o = 0; o < t.length; o++)
1536
1545
  t[o].style.visibility = "hidden";
1537
1546
  }
1538
- class zt {
1547
+ class Kt {
1539
1548
  constructor(e, t, o) {
1540
1549
  b(this, "state");
1541
1550
  b(this, "emitUpdate");
@@ -1552,12 +1561,12 @@ class zt {
1552
1561
  this.mouseState = "up", this.mouseMoveHandler(e);
1553
1562
  });
1554
1563
  b(this, "mouseMoveHandler", (e) => {
1555
- var l, m, h, f, u, g, d;
1564
+ var l, u, h, g, m, p, d;
1556
1565
  if (this.menuFrozen || this.mouseState === "selecting" || !(e.target instanceof Element) || !this.pmView.dom.contains(e.target))
1557
1566
  return;
1558
- const t = Ut(e.target);
1567
+ const t = _t(e.target);
1559
1568
  if ((t == null ? void 0 : t.type) === "cell" && this.mouseState === "down" && !((l = this.state) != null && l.draggingState)) {
1560
- this.mouseState = "selecting", (m = this.state) != null && m.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1569
+ this.mouseState = "selecting", (u = this.state) != null && u.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1561
1570
  return;
1562
1571
  }
1563
1572
  if (!t || !this.editor.isEditable) {
@@ -1566,55 +1575,55 @@ class zt {
1566
1575
  }
1567
1576
  if (!t.tbodyNode)
1568
1577
  return;
1569
- const o = t.tbodyNode.getBoundingClientRect(), r = Ce(t.domNode, this.pmView);
1578
+ const o = t.tbodyNode.getBoundingClientRect(), r = Se(t.domNode, this.pmView);
1570
1579
  if (!r)
1571
1580
  return;
1572
1581
  this.tableElement = r.node;
1573
1582
  let s;
1574
1583
  const i = this.editor.transact(
1575
- (p) => he(r.id, p.doc)
1584
+ (f) => me(r.id, f.doc)
1576
1585
  );
1577
1586
  if (!i)
1578
1587
  throw new Error(`Block with ID ${r.id} not found`);
1579
- const a = R(
1588
+ const a = L(
1580
1589
  i.node,
1581
1590
  this.editor.pmSchema,
1582
1591
  this.editor.schema.blockSchema,
1583
1592
  this.editor.schema.inlineContentSchema,
1584
1593
  this.editor.schema.styleSchema
1585
1594
  );
1586
- if ($e(this.editor, "table") && (this.tablePos = i.posBeforeNode + 1, s = a), !s)
1595
+ if (Ue(this.editor, "table") && (this.tablePos = i.posBeforeNode + 1, s = a), !s)
1587
1596
  return;
1588
1597
  this.tableId = r.id;
1589
- const c = (f = t.domNode.closest(".tableWrapper")) == null ? void 0 : f.querySelector(".table-widgets-container");
1598
+ const c = (g = t.domNode.closest(".tableWrapper")) == null ? void 0 : g.querySelector(".table-widgets-container");
1590
1599
  if ((t == null ? void 0 : t.type) === "wrapper") {
1591
- const p = e.clientY >= o.bottom - 1 && // -1 to account for fractions of pixels in "bottom"
1600
+ const f = e.clientY >= o.bottom - 1 && // -1 to account for fractions of pixels in "bottom"
1592
1601
  e.clientY < o.bottom + 20, w = e.clientX >= o.right - 1 && e.clientX < o.right + 20, y = e.clientX > o.right || e.clientY > o.bottom;
1593
1602
  this.state = {
1594
1603
  ...this.state,
1595
1604
  show: !0,
1596
- showAddOrRemoveRowsButton: p,
1605
+ showAddOrRemoveRowsButton: f,
1597
1606
  showAddOrRemoveColumnsButton: w,
1598
1607
  referencePosTable: o,
1599
1608
  block: s,
1600
1609
  widgetContainer: c,
1601
- colIndex: y || (u = this.state) == null ? void 0 : u.colIndex,
1602
- rowIndex: y || (g = this.state) == null ? void 0 : g.rowIndex,
1610
+ colIndex: y || (m = this.state) == null ? void 0 : m.colIndex,
1611
+ rowIndex: y || (p = this.state) == null ? void 0 : p.rowIndex,
1603
1612
  referencePosCell: y || (d = this.state) == null ? void 0 : d.referencePosCell
1604
1613
  };
1605
1614
  } else {
1606
- const p = M(t.domNode), w = M(t.domNode.parentElement), y = t.domNode.getBoundingClientRect();
1607
- if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex === w && this.state.colIndex === p)
1615
+ const f = M(t.domNode), w = M(t.domNode.parentElement), y = t.domNode.getBoundingClientRect();
1616
+ if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex === w && this.state.colIndex === f)
1608
1617
  return;
1609
1618
  this.state = {
1610
1619
  show: !0,
1611
- showAddOrRemoveColumnsButton: p === s.content.rows[0].cells.length - 1,
1620
+ showAddOrRemoveColumnsButton: f === s.content.rows[0].cells.length - 1,
1612
1621
  showAddOrRemoveRowsButton: w === s.content.rows.length - 1,
1613
1622
  referencePosTable: o,
1614
1623
  block: s,
1615
1624
  draggingState: void 0,
1616
1625
  referencePosCell: y,
1617
- colIndex: p,
1626
+ colIndex: f,
1618
1627
  rowIndex: w,
1619
1628
  widgetContainer: c
1620
1629
  };
@@ -1622,10 +1631,10 @@ class zt {
1622
1631
  return this.emitUpdate(), !1;
1623
1632
  });
1624
1633
  b(this, "dragOverHandler", (e) => {
1625
- var f;
1626
- if (((f = this.state) == null ? void 0 : f.draggingState) === void 0)
1634
+ var g;
1635
+ if (((g = this.state) == null ? void 0 : g.draggingState) === void 0)
1627
1636
  return;
1628
- e.preventDefault(), e.dataTransfer.dropEffect = "move", _t(
1637
+ e.preventDefault(), e.dataTransfer.dropEffect = "move", zt(
1629
1638
  ".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",
1630
1639
  this.pmView.root
1631
1640
  );
@@ -1639,16 +1648,16 @@ class zt {
1639
1648
  this.state.referencePosTable.bottom - 1
1640
1649
  )
1641
1650
  }, o = this.pmView.root.elementsFromPoint(t.left, t.top).filter(
1642
- (u) => u.tagName === "TD" || u.tagName === "TH"
1651
+ (m) => m.tagName === "TD" || m.tagName === "TH"
1643
1652
  );
1644
1653
  if (o.length === 0)
1645
1654
  return;
1646
1655
  const r = o[0];
1647
1656
  let s = !1;
1648
- const i = M(r.parentElement), a = M(r), c = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, m = (this.state.draggingState.draggedCellOrientation === "row" ? i : a) !== c;
1657
+ const i = M(r.parentElement), a = M(r), c = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, u = (this.state.draggingState.draggedCellOrientation === "row" ? i : a) !== c;
1649
1658
  (this.state.rowIndex !== i || this.state.colIndex !== a) && (this.state.rowIndex = i, this.state.colIndex = a, this.state.referencePosCell = r.getBoundingClientRect(), s = !0);
1650
1659
  const h = this.state.draggingState.draggedCellOrientation === "row" ? t.top : t.left;
1651
- this.state.draggingState.mousePos !== h && (this.state.draggingState.mousePos = h, s = !0), s && this.emitUpdate(), m && this.editor.transact((u) => u.setMeta(D, !0));
1660
+ this.state.draggingState.mousePos !== h && (this.state.draggingState.mousePos = h, s = !0), s && this.emitUpdate(), u && this.editor.transact((m) => m.setMeta(D, !0));
1652
1661
  });
1653
1662
  b(this, "dropHandler", (e) => {
1654
1663
  if (this.mouseState = "up", this.state === void 0 || this.state.draggingState === void 0)
@@ -1660,13 +1669,13 @@ class zt {
1660
1669
  e.preventDefault();
1661
1670
  const { draggingState: t, colIndex: o, rowIndex: r } = this.state, s = this.state.block.content.columnWidths;
1662
1671
  if (t.draggedCellOrientation === "row") {
1663
- if (!ce(
1672
+ if (!de(
1664
1673
  this.state.block,
1665
1674
  t.originalIndex,
1666
1675
  r
1667
1676
  ))
1668
1677
  return !1;
1669
- const i = Le(
1678
+ const i = Re(
1670
1679
  this.state.block,
1671
1680
  t.originalIndex,
1672
1681
  r
@@ -1679,13 +1688,13 @@ class zt {
1679
1688
  }
1680
1689
  });
1681
1690
  } else {
1682
- if (!de(
1691
+ if (!ue(
1683
1692
  this.state.block,
1684
1693
  t.originalIndex,
1685
1694
  o
1686
1695
  ))
1687
1696
  return !1;
1688
- const i = Ne(
1697
+ const i = Le(
1689
1698
  this.state.block,
1690
1699
  t.originalIndex,
1691
1700
  o
@@ -1724,7 +1733,7 @@ class zt {
1724
1733
  this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate();
1725
1734
  return;
1726
1735
  }
1727
- const { height: e, width: t } = Re(
1736
+ const { height: e, width: t } = Ve(
1728
1737
  this.state.block
1729
1738
  );
1730
1739
  this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= e && (this.state.rowIndex = e - 1), this.state.colIndex >= t && (this.state.colIndex = t - 1));
@@ -1749,7 +1758,7 @@ class zt {
1749
1758
  );
1750
1759
  }
1751
1760
  }
1752
- const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1761
+ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1753
1762
  let e;
1754
1763
  const t = H(void 0);
1755
1764
  return {
@@ -1758,7 +1767,7 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1758
1767
  prosemirrorPlugins: [
1759
1768
  new T({
1760
1769
  key: D,
1761
- view: (o) => (e = new zt(n, o, (r) => {
1770
+ view: (o) => (e = new Kt(n, o, (r) => {
1762
1771
  t.setState(
1763
1772
  r.block ? {
1764
1773
  ...r,
@@ -1776,18 +1785,18 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1776
1785
  if (r === void 0)
1777
1786
  return;
1778
1787
  const s = [], { block: i, draggingState: a } = e.state, { originalIndex: c, draggedCellOrientation: l } = a;
1779
- if (r === c || !i || l === "row" && !ce(i, c, r) || l === "col" && !de(i, c, r))
1788
+ if (r === c || !i || l === "row" && !de(i, c, r) || l === "col" && !ue(i, c, r))
1780
1789
  return V.create(o.doc, s);
1781
- const m = o.doc.resolve(e.tablePos + 1);
1782
- return e.state.draggingState.draggedCellOrientation === "row" ? W(
1790
+ const u = o.doc.resolve(e.tablePos + 1);
1791
+ return e.state.draggingState.draggedCellOrientation === "row" ? G(
1783
1792
  e.state.block,
1784
1793
  r
1785
- ).forEach(({ row: f, col: u }) => {
1786
- const g = o.doc.resolve(
1787
- m.posAtIndex(f) + 1
1794
+ ).forEach(({ row: g, col: m }) => {
1795
+ const p = o.doc.resolve(
1796
+ u.posAtIndex(g) + 1
1788
1797
  ), d = o.doc.resolve(
1789
- g.posAtIndex(u) + 1
1790
- ), p = d.node(), w = d.pos + (r > c ? p.nodeSize - 2 : 0);
1798
+ p.posAtIndex(m) + 1
1799
+ ), f = d.node(), w = d.pos + (r > c ? f.nodeSize - 2 : 0);
1791
1800
  s.push(
1792
1801
  // The widget is a small bar which spans the width of the cell.
1793
1802
  A.widget(w, () => {
@@ -1795,15 +1804,15 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1795
1804
  return y.className = "bn-table-drop-cursor", y.style.left = "0", y.style.right = "0", r > c ? y.style.bottom = "-2px" : y.style.top = "-3px", y.style.height = "4px", y;
1796
1805
  })
1797
1806
  );
1798
- }) : q(
1807
+ }) : W(
1799
1808
  e.state.block,
1800
1809
  r
1801
- ).forEach(({ row: f, col: u }) => {
1802
- const g = o.doc.resolve(
1803
- m.posAtIndex(f) + 1
1810
+ ).forEach(({ row: g, col: m }) => {
1811
+ const p = o.doc.resolve(
1812
+ u.posAtIndex(g) + 1
1804
1813
  ), d = o.doc.resolve(
1805
- g.posAtIndex(u) + 1
1806
- ), p = d.node(), w = d.pos + (r > c ? p.nodeSize - 2 : 0);
1814
+ p.posAtIndex(m) + 1
1815
+ ), f = d.node(), w = d.pos + (r > c ? f.nodeSize - 2 : 0);
1807
1816
  s.push(
1808
1817
  // The widget is a small bar which spans the height of the cell.
1809
1818
  A.widget(w, () => {
@@ -1836,7 +1845,7 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1836
1845
  newIndex: e.state.colIndex,
1837
1846
  tablePos: e.tablePos
1838
1847
  })
1839
- ), !n.headless && (se(n.prosemirrorView.root), o.dataTransfer.setDragImage(C, 0, 0), o.dataTransfer.effectAllowed = "move");
1848
+ ), !n.headless && (ie(n.prosemirrorView.root), o.dataTransfer.setDragImage(C, 0, 0), o.dataTransfer.effectAllowed = "move");
1840
1849
  },
1841
1850
  /**
1842
1851
  * Callback that should be set on the `dragStart` event for whichever element
@@ -1858,7 +1867,7 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1858
1867
  newIndex: e.state.rowIndex,
1859
1868
  tablePos: e.tablePos
1860
1869
  })
1861
- ), !n.headless && (se(n.prosemirrorView.root), o.dataTransfer.setDragImage(C, 0, 0), o.dataTransfer.effectAllowed = "copyMove");
1870
+ ), !n.headless && (ie(n.prosemirrorView.root), o.dataTransfer.setDragImage(C, 0, 0), o.dataTransfer.effectAllowed = "copyMove");
1862
1871
  },
1863
1872
  /**
1864
1873
  * Callback that should be set on the `dragEnd` event for both the element
@@ -1869,7 +1878,7 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1869
1878
  throw new Error(
1870
1879
  "Attempted to drag table row, but no table block was hovered prior."
1871
1880
  );
1872
- e.state.draggingState = void 0, e.emitUpdate(), n.transact((o) => o.setMeta(D, null)), !n.headless && $t(n.prosemirrorView.root);
1881
+ e.state.draggingState = void 0, e.emitUpdate(), n.transact((o) => o.setMeta(D, null)), !n.headless && Ut(n.prosemirrorView.root);
1873
1882
  },
1874
1883
  /**
1875
1884
  * Freezes the drag handles. When frozen, they will stay attached to the same
@@ -1886,13 +1895,13 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1886
1895
  e.menuFrozen = !1;
1887
1896
  },
1888
1897
  getCellsAtRowHandle(o, r) {
1889
- return W(o, r);
1898
+ return G(o, r);
1890
1899
  },
1891
1900
  /**
1892
1901
  * Get all the cells in a column of the table block.
1893
1902
  */
1894
1903
  getCellsAtColumnHandle(o, r) {
1895
- return q(o, r);
1904
+ return W(o, r);
1896
1905
  },
1897
1906
  /**
1898
1907
  * Sets the selection to the given cell or a range of cells.
@@ -1908,12 +1917,12 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1908
1917
  a.posAtIndex(r.col)
1909
1918
  ), l = o.doc.resolve(
1910
1919
  i.posAtIndex(s.row) + 1
1911
- ), m = o.doc.resolve(
1920
+ ), u = o.doc.resolve(
1912
1921
  // No need for +1, since CellSelection expects the position before the cell
1913
1922
  l.posAtIndex(s.col)
1914
1923
  ), h = o.tr;
1915
1924
  return h.setSelection(
1916
- new wt(c, m)
1925
+ new yt(c, u)
1917
1926
  ), o.apply(h);
1918
1927
  },
1919
1928
  /**
@@ -1925,7 +1934,7 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1925
1934
  s,
1926
1935
  r.orientation === "row" ? { row: o, col: 0 } : { row: 0, col: o }
1927
1936
  );
1928
- return r.orientation === "row" ? r.side === "above" ? mt(a, i) : pt(a, i) : r.side === "left" ? ft(a, i) : gt(a, i);
1937
+ return r.orientation === "row" ? r.side === "above" ? pt(a, i) : ft(a, i) : r.side === "left" ? gt(a, i) : wt(a, i);
1929
1938
  });
1930
1939
  },
1931
1940
  /**
@@ -1937,13 +1946,13 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1937
1946
  row: o,
1938
1947
  col: 0
1939
1948
  });
1940
- return ut(a, i);
1949
+ return ht(a, i);
1941
1950
  }) : n.exec((s, i) => {
1942
1951
  const a = this.setCellSelection(s, {
1943
1952
  row: 0,
1944
1953
  col: o
1945
1954
  });
1946
- return ht(a, i);
1955
+ return mt(a, i);
1947
1956
  });
1948
1957
  },
1949
1958
  /**
@@ -1956,7 +1965,7 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1956
1965
  o.relativeStartCell,
1957
1966
  o.relativeEndCell
1958
1967
  ) : r;
1959
- return dt(i, s);
1968
+ return ut(i, s);
1960
1969
  });
1961
1970
  },
1962
1971
  /**
@@ -1966,7 +1975,7 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1966
1975
  splitCell(o) {
1967
1976
  return n.exec((r, s) => {
1968
1977
  const i = o ? this.setCellSelection(r, o) : r;
1969
- return ct(i, s);
1978
+ return dt(i, s);
1970
1979
  });
1971
1980
  },
1972
1981
  /**
@@ -1977,10 +1986,10 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1977
1986
  return n.transact((o) => {
1978
1987
  const r = o.selection;
1979
1988
  let s = r.$from, i = r.$to;
1980
- if (J(r)) {
1989
+ if (Q(r)) {
1981
1990
  const { ranges: d } = r;
1982
- d.forEach((p) => {
1983
- s = p.$from.min(s ?? p.$from), i = p.$to.max(i ?? p.$to);
1991
+ d.forEach((f) => {
1992
+ s = f.$from.min(s ?? f.$from), i = f.$to.max(i ?? f.$to);
1984
1993
  });
1985
1994
  } else if (s = o.doc.resolve(
1986
1995
  r.$from.pos - r.$from.parentOffset - 1
@@ -1990,20 +1999,20 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
1990
1999
  return;
1991
2000
  const a = o.doc.resolve(
1992
2001
  s.pos - s.parentOffset - 1
1993
- ), c = o.doc.resolve(i.pos - i.parentOffset - 1), l = o.doc.resolve(a.pos - a.parentOffset - 1), m = s.index(a.depth), h = a.index(l.depth), f = i.index(c.depth), u = c.index(l.depth), g = [];
1994
- for (let d = h; d <= u; d++)
1995
- for (let p = m; p <= f; p++)
1996
- g.push({ row: d, col: p });
2002
+ ), c = o.doc.resolve(i.pos - i.parentOffset - 1), l = o.doc.resolve(a.pos - a.parentOffset - 1), u = s.index(a.depth), h = a.index(l.depth), g = i.index(c.depth), m = c.index(l.depth), p = [];
2003
+ for (let d = h; d <= m; d++)
2004
+ for (let f = u; f <= g; f++)
2005
+ p.push({ row: d, col: f });
1997
2006
  return {
1998
2007
  from: {
1999
2008
  row: h,
2000
- col: m
2009
+ col: u
2001
2010
  },
2002
2011
  to: {
2003
- row: u,
2004
- col: f
2012
+ row: m,
2013
+ col: g
2005
2014
  },
2006
- cells: g
2015
+ cells: p
2007
2016
  };
2008
2017
  });
2009
2018
  },
@@ -2014,29 +2023,29 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
2014
2023
  */
2015
2024
  getMergeDirection(o) {
2016
2025
  return n.transact((r) => {
2017
- const s = J(r.selection) ? r.selection : void 0;
2026
+ const s = Q(r.selection) ? r.selection : void 0;
2018
2027
  if (!s || !o || // Only offer the merge button if there is more than one cell selected.
2019
2028
  s.ranges.length <= 1)
2020
2029
  return;
2021
2030
  const i = this.getCellSelection();
2022
2031
  if (i)
2023
- return Fe(i.from, i.to, o) ? "vertical" : "horizontal";
2032
+ return $e(i.from, i.to, o) ? "vertical" : "horizontal";
2024
2033
  });
2025
2034
  },
2026
2035
  cropEmptyRowsOrColumns(o, r) {
2027
- return He(o, r);
2036
+ return Fe(o, r);
2028
2037
  },
2029
2038
  addRowsOrColumns(o, r, s) {
2030
- return Ve(o, r, s);
2039
+ return He(o, r, s);
2031
2040
  }
2032
2041
  };
2033
- }), ie = new P("trailingNode"), Po = k(() => ({
2042
+ }), ae = new P("trailingNode"), Oo = k(() => ({
2034
2043
  key: "trailingNode",
2035
2044
  prosemirrorPlugins: [
2036
2045
  new T({
2037
- key: ie,
2046
+ key: ae,
2038
2047
  appendTransaction: (n, e, t) => {
2039
- const { doc: o, tr: r, schema: s } = t, i = ie.getState(t), a = o.content.size - 2, c = s.nodes.blockContainer, l = s.nodes.paragraph;
2048
+ const { doc: o, tr: r, schema: s } = t, i = ae.getState(t), a = o.content.size - 2, c = s.nodes.blockContainer, l = s.nodes.paragraph;
2040
2049
  if (i)
2041
2050
  return r.insert(
2042
2051
  a,
@@ -2064,32 +2073,32 @@ const D = new P("TableHandlesPlugin"), To = k(({ editor: n }) => {
2064
2073
  ]
2065
2074
  }));
2066
2075
  export {
2067
- po as B,
2068
- wo as D,
2069
- fo as F,
2070
- bo as H,
2071
- vo as L,
2072
- So as N,
2073
- xo as P,
2074
- go as S,
2075
- zt as T,
2076
- ko as V,
2077
- te as Y,
2076
+ fo as B,
2077
+ yo as D,
2078
+ go as F,
2079
+ vo as H,
2080
+ ko as L,
2081
+ xo as N,
2082
+ Eo as P,
2083
+ wo as S,
2084
+ Kt as T,
2085
+ Co as V,
2086
+ oe as Y,
2078
2087
  F as a,
2079
2088
  $ as b,
2080
- yo as c,
2081
- Co as d,
2082
- Eo as e,
2083
- Ht as f,
2084
- Bo as g,
2085
- To as h,
2086
- Po as i,
2087
- St as j,
2088
- ve as k,
2089
- Io as l,
2090
- Se as m,
2091
- Lt as n,
2092
- Ft as s,
2089
+ bo as c,
2090
+ So as d,
2091
+ Io as e,
2092
+ Ft as f,
2093
+ To as g,
2094
+ Po as h,
2095
+ Oo as i,
2096
+ xt as j,
2097
+ ke as k,
2098
+ Bo as l,
2099
+ xe as m,
2100
+ Rt as n,
2101
+ $t as s,
2093
2102
  D as t
2094
2103
  };
2095
- //# sourceMappingURL=TrailingNode-8cXFaQUm.js.map
2104
+ //# sourceMappingURL=TrailingNode-C-Kyrtf1.js.map