@blocknote/core 0.47.1 → 0.47.3

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 (74) 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-CwhtPpVC.cjs → BlockNoteSchema-CCs_V3lo.cjs} +2 -2
  4. package/dist/{BlockNoteSchema-CwhtPpVC.cjs.map → BlockNoteSchema-CCs_V3lo.cjs.map} +1 -1
  5. package/dist/{BlockNoteSchema-dmbNkHA-.js → BlockNoteSchema-ooiKsd5B.js} +2 -2
  6. package/dist/{BlockNoteSchema-dmbNkHA-.js.map → BlockNoteSchema-ooiKsd5B.js.map} +1 -1
  7. package/dist/{TrailingNode-F9hX_UlQ.js → TrailingNode-GzE59m_7.js} +585 -415
  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 +938 -862
  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-Caw1U1oV.js → defaultBlocks-ZzGbYgQn.js} +611 -530
  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 +4 -1
  36. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
  37. package/src/api/parsers/html/parseHTML.ts +2 -0
  38. package/src/api/parsers/html/util/normalizeWhitespace.ts +87 -0
  39. package/src/blocks/Heading/block.ts +48 -1
  40. package/src/blocks/ListItem/ToggleListItem/block.ts +51 -1
  41. package/src/blocks/Paragraph/block.ts +1 -1
  42. package/src/blocks/getDetailsContent.ts +77 -0
  43. package/src/comments/threadstore/TipTapThreadStore.ts +5 -5
  44. package/src/comments/threadstore/tiptap/types.ts +131 -0
  45. package/src/editor/Block.css +6 -0
  46. package/src/editor/BlockNoteEditor.ts +9 -14
  47. package/src/editor/managers/ExtensionManager/symbol.ts +0 -1
  48. package/src/editor/managers/SelectionManager.ts +3 -1
  49. package/src/extensions/DropCursor/DropCursor.ts +262 -25
  50. package/src/extensions/DropCursor/utils.ts +195 -0
  51. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +15 -10
  52. package/src/i18n/locales/fa.ts +4 -21
  53. package/src/i18n/locales/index.ts +1 -1
  54. package/src/i18n/locales/ru.ts +1 -1
  55. package/src/i18n/locales/uz.ts +22 -4
  56. package/src/index.ts +1 -0
  57. package/src/schema/blocks/createSpec.ts +33 -45
  58. package/src/schema/blocks/types.ts +101 -1
  59. package/types/src/api/parsers/html/util/normalizeWhitespace.d.ts +6 -0
  60. package/types/src/blocks/getDetailsContent.d.ts +19 -0
  61. package/types/src/comments/threadstore/TipTapThreadStore.d.ts +1 -1
  62. package/types/src/comments/threadstore/tiptap/types.d.ts +73 -0
  63. package/types/src/editor/BlockNoteEditor.d.ts +6 -9
  64. package/types/src/extensions/DropCursor/DropCursor.d.ts +42 -5
  65. package/types/src/extensions/DropCursor/utils.d.ts +48 -0
  66. package/types/src/index.d.ts +1 -0
  67. package/types/src/schema/blocks/createSpec.d.ts +3 -3
  68. package/types/src/schema/blocks/types.d.ts +31 -1
  69. package/dist/TrailingNode-DHOdUVUO.cjs +0 -2
  70. package/dist/TrailingNode-DHOdUVUO.cjs.map +0 -1
  71. package/dist/TrailingNode-F9hX_UlQ.js.map +0 -1
  72. package/dist/defaultBlocks-CSB5GiAu.cjs +0 -6
  73. package/dist/defaultBlocks-CSB5GiAu.cjs.map +0 -1
  74. package/dist/defaultBlocks-Caw1U1oV.js.map +0 -1
@@ -1,54 +1,54 @@
1
- var Ie = Object.defineProperty;
2
- var Be = (n, e, o) => e in n ? Ie(n, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[e] = o;
3
- var b = (n, e, o) => Be(n, typeof e != "symbol" ? e + "" : e, o);
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 De, findChildren as j } from "@tiptap/core";
6
- import Oe 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-Caw1U1oV.js";
9
- import { c as C, a as H } from "./BlockNoteExtension-C2X7LW-V.js";
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
- import * as I from "yjs";
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
- import { Decoration as A, DecorationSet as V } from "prosemirror-view";
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) {
1
+ var Ae = Object.defineProperty;
2
+ var Le = (n, e, o) => e in n ? Ae(n, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[e] = o;
3
+ var k = (n, e, o) => Le(n, typeof e != "symbol" ? e + "" : e, o);
4
+ import { Plugin as L, PluginKey as N, NodeSelection as pe, TextSelection as fe, Selection as U } from "prosemirror-state";
5
+ import { combineTransactionSteps as Ne, getMarkRange as Re, posToDOMRect as Ve, findChildren as Q } from "@tiptap/core";
6
+ import He from "fast-deep-equal";
7
+ import { i as Z, t as $e, U as Fe, n as Ue, g as _, a as z, c as ge, m as _e, e as we, f as ze, h as Ye, j as je, k as Ke, l as Xe, o as ee, p as te } from "./blockToNode-BNoNIXU7.js";
8
+ import { ai as be, a2 as oe, aj as ye, _ as We, $ as qe, a1 as ne } from "./defaultBlocks-ZzGbYgQn.js";
9
+ import { c as E, a as j } from "./BlockNoteExtension-C2X7LW-V.js";
10
+ import { yCursorPlugin as Ge, defaultSelectionBuilder as Je, ySyncPlugin as Qe, redoCommand as Ze, undoCommand as et, yUndoPlugin as tt, yUndoPluginKey as re } from "y-prosemirror";
11
+ import * as P from "yjs";
12
+ import { PluginKey as ke, Plugin as ve, TextSelection as ot } from "@tiptap/pm/state";
13
+ import { dropPoint as nt } from "prosemirror-transform";
14
+ import { redo as rt, undo as st, history as it } from "@tiptap/pm/history";
15
+ import { Decoration as H, DecorationSet as Y } from "prosemirror-view";
16
+ import { v4 as at } from "uuid";
17
+ import { DOMParser as lt, Slice as ct } from "@tiptap/pm/model";
18
+ import { DOMSerializer as Ce, Fragment as Se, Slice as dt } from "prosemirror-model";
19
+ import ut from "rehype-parse";
20
+ import ht from "rehype-remark";
21
+ import mt from "remark-gfm";
22
+ import pt from "remark-stringify";
23
+ import { unified as ft } from "unified";
24
+ import { fromDom as gt } from "hast-util-from-dom";
25
+ import { visit as wt } from "unist-util-visit";
26
+ import { splitCell as bt, mergeCells as yt, deleteRow as kt, deleteColumn as vt, addRowBefore as Ct, addRowAfter as St, addColumnBefore as xt, addColumnAfter as Et, CellSelection as It } from "prosemirror-tables";
27
+ function xe(n) {
28
28
  const e = Array.from(n.classList).filter(
29
29
  (o) => !o.startsWith("bn-")
30
30
  ) || [];
31
31
  e.length > 0 ? n.className = e.join(" ") : n.removeAttribute("class");
32
32
  }
33
- function be(n, e, o, t) {
33
+ function Ee(n, e, o, t) {
34
34
  var a;
35
35
  let r;
36
36
  if (e)
37
37
  if (typeof e == "string")
38
- r = q([e], n.pmSchema);
38
+ r = Z([e], n.pmSchema);
39
39
  else if (Array.isArray(e))
40
- r = q(e, n.pmSchema);
40
+ r = Z(e, n.pmSchema);
41
41
  else if (e.type === "tableContent")
42
- r = Ae(e, n.pmSchema);
42
+ r = $e(e, n.pmSchema);
43
43
  else
44
- throw new Me(e.type);
44
+ throw new Fe(e.type);
45
45
  else throw new Error("blockContent is required");
46
46
  const i = ((t == null ? void 0 : t.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 u = Ne(
51
+ const u = Ue(
52
52
  c,
53
53
  n.schema.inlineContentSchema,
54
54
  n.schema.styleSchema
@@ -67,11 +67,11 @@ function be(n, e, o, t) {
67
67
  );
68
68
  if (h) {
69
69
  if (i.appendChild(h.dom), h.contentDOM) {
70
- const g = o.serializeFragment(
70
+ const f = o.serializeFragment(
71
71
  c.content,
72
72
  t
73
73
  );
74
- h.contentDOM.dataset.editable = "", h.contentDOM.appendChild(g);
74
+ h.contentDOM.dataset.editable = "", h.contentDOM.appendChild(f);
75
75
  }
76
76
  continue;
77
77
  }
@@ -85,33 +85,33 @@ function be(n, e, o, t) {
85
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 = u.type.spec.toDOM(u, !0), g = ge.renderSpec(document, h);
89
- g.contentDOM.appendChild(l), l = g.dom;
88
+ const h = u.type.spec.toDOM(u, !0), f = Ce.renderSpec(document, h);
89
+ f.contentDOM.appendChild(l), l = f.dom;
90
90
  }
91
91
  i.appendChild(l);
92
92
  } else {
93
93
  const l = o.serializeFragment(
94
- we.from([c]),
94
+ Se.from([c]),
95
95
  t
96
96
  );
97
97
  i.appendChild(l);
98
98
  }
99
- return i.childNodes.length === 1 && ((a = i.firstChild) == null ? void 0 : a.nodeType) === 1 && ye(i.firstChild), i;
99
+ return i.childNodes.length === 1 && ((a = i.firstChild) == null ? void 0 : a.nodeType) === 1 && xe(i.firstChild), i;
100
100
  }
101
- function bt(n, e, o, t, r, s, i, a) {
102
- var w, y, v, D, _, z, K, Y, X;
101
+ function Bt(n, e, o, t, r, s, i, a) {
102
+ var b, y, w, v, x, I, O, M, T;
103
103
  const c = (a == null ? void 0 : a.document) ?? document, l = e.pmSchema.nodes.blockContainer, u = o.props || {};
104
- for (const [k, x] of Object.entries(
104
+ for (const [C, S] of Object.entries(
105
105
  e.schema.blockSchema[o.type].propSchema
106
106
  ))
107
- !(k in u) && x.default !== void 0 && (u[k] = x.default);
108
- const h = (y = (w = l.spec) == null ? void 0 : w.toDOM) == null ? void 0 : y.call(
109
- w,
107
+ !(C in u) && S.default !== void 0 && (u[C] = S.default);
108
+ const h = (y = (b = l.spec) == null ? void 0 : b.toDOM) == null ? void 0 : y.call(
109
+ b,
110
110
  l.create({
111
111
  id: o.id,
112
112
  ...u
113
113
  })
114
- ), g = Array.from(h.dom.attributes), m = e.blockImplementations[o.type].implementation, p = ((v = m.toExternalHTML) == null ? void 0 : v.call(
114
+ ), f = Array.from(h.dom.attributes), m = e.blockImplementations[o.type].implementation, p = ((w = m.toExternalHTML) == null ? void 0 : w.call(
115
115
  {},
116
116
  { ...o, props: u },
117
117
  e,
@@ -124,15 +124,15 @@ function bt(n, e, o, t, r, s, i, a) {
124
124
  e
125
125
  ), d = c.createDocumentFragment();
126
126
  if (p.dom.classList.contains("bn-block-content")) {
127
- const k = [
128
- ...g,
127
+ const C = [
128
+ ...f,
129
129
  ...Array.from(p.dom.attributes)
130
130
  ].filter(
131
- (x) => x.name.startsWith("data") && x.name !== "data-content-type" && x.name !== "data-file-block" && x.name !== "data-node-view-wrapper" && x.name !== "data-node-type" && x.name !== "data-id" && x.name !== "data-editable"
131
+ (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"
132
132
  );
133
- for (const x of k)
134
- p.dom.firstChild.setAttribute(x.name, x.value);
135
- ye(p.dom.firstChild), i > 0 && p.dom.firstChild.setAttribute(
133
+ for (const S of C)
134
+ p.dom.firstChild.setAttribute(S.name, S.value);
135
+ xe(p.dom.firstChild), i > 0 && p.dom.firstChild.setAttribute(
136
136
  "data-nesting-level",
137
137
  i.toString()
138
138
  ), d.append(...Array.from(p.dom.childNodes));
@@ -142,28 +142,28 @@ function bt(n, e, o, t, r, s, i, a) {
142
142
  i.toString()
143
143
  );
144
144
  if (p.contentDOM && o.content) {
145
- const k = be(
145
+ const C = Ee(
146
146
  e,
147
147
  o.content,
148
148
  // TODO
149
149
  t,
150
150
  a
151
151
  );
152
- p.contentDOM.appendChild(k);
152
+ p.contentDOM.appendChild(C);
153
153
  }
154
- let f;
155
- if (r.has(o.type) ? f = "OL" : s.has(o.type) && (f = "UL"), f) {
156
- if (((D = n.lastChild) == null ? void 0 : D.nodeName) !== f) {
157
- const k = c.createElement(f);
158
- f === "OL" && "start" in u && u.start && (u == null ? void 0 : u.start) !== 1 && k.setAttribute("start", u.start + ""), n.append(k);
154
+ let g;
155
+ if (r.has(o.type) ? g = "OL" : s.has(o.type) && (g = "UL"), g) {
156
+ if (((v = n.lastChild) == null ? void 0 : v.nodeName) !== g) {
157
+ const C = c.createElement(g);
158
+ g === "OL" && "start" in u && u.start && (u == null ? void 0 : u.start) !== 1 && C.setAttribute("start", u.start + ""), n.append(C);
159
159
  }
160
160
  n.lastChild.appendChild(d);
161
161
  } else
162
162
  n.append(d);
163
163
  if (o.children && o.children.length > 0) {
164
- const k = c.createDocumentFragment();
165
- if (ke(
166
- k,
164
+ const C = c.createDocumentFragment();
165
+ if (Ie(
166
+ C,
167
167
  e,
168
168
  o.children,
169
169
  t,
@@ -171,15 +171,15 @@ function bt(n, e, o, t, r, s, i, a) {
171
171
  s,
172
172
  i + 1,
173
173
  a
174
- ), ((_ = n.lastChild) == null ? void 0 : _.nodeName) === "UL" || ((z = n.lastChild) == null ? void 0 : z.nodeName) === "OL")
175
- for (; ((K = k.firstChild) == null ? void 0 : K.nodeName) === "UL" || ((Y = k.firstChild) == null ? void 0 : Y.nodeName) === "OL"; )
176
- n.lastChild.lastChild.appendChild(k.firstChild);
177
- e.pmSchema.nodes[o.type].isInGroup("blockContent") ? n.append(k) : (X = p.contentDOM) == null || X.append(k);
174
+ ), ((x = n.lastChild) == null ? void 0 : x.nodeName) === "UL" || ((I = n.lastChild) == null ? void 0 : I.nodeName) === "OL")
175
+ for (; ((O = C.firstChild) == null ? void 0 : O.nodeName) === "UL" || ((M = C.firstChild) == null ? void 0 : M.nodeName) === "OL"; )
176
+ n.lastChild.lastChild.appendChild(C.firstChild);
177
+ "childrenDOM" in p && p.childrenDOM ? p.childrenDOM.append(C) : e.pmSchema.nodes[o.type].isInGroup("blockContent") ? n.append(C) : (T = p.contentDOM) == null || T.append(C);
178
178
  }
179
179
  }
180
- const ke = (n, e, o, t, r, s, i = 0, a) => {
180
+ const Ie = (n, e, o, t, r, s, i = 0, a) => {
181
181
  for (const c of o)
182
- bt(
182
+ Bt(
183
183
  n,
184
184
  e,
185
185
  c,
@@ -189,9 +189,9 @@ const ke = (n, e, o, t, r, s, i = 0, a) => {
189
189
  i,
190
190
  a
191
191
  );
192
- }, kt = (n, e, o, t, r, s) => {
192
+ }, Tt = (n, e, o, t, r, s) => {
193
193
  const a = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
194
- return ke(
194
+ return Ie(
195
195
  a,
196
196
  n,
197
197
  e,
@@ -201,11 +201,11 @@ const ke = (n, e, o, t, r, s, i = 0, a) => {
201
201
  0,
202
202
  s
203
203
  ), a;
204
- }, Ce = (n, e) => {
205
- const o = ge.fromSchema(n);
204
+ }, Be = (n, e) => {
205
+ const o = Ce.fromSchema(n);
206
206
  return {
207
207
  exportBlocks: (t, r) => {
208
- const s = kt(
208
+ const s = Tt(
209
209
  e,
210
210
  t,
211
211
  o,
@@ -216,7 +216,7 @@ const ke = (n, e, o, t, r, s, i = 0, a) => {
216
216
  return i.append(s), i.innerHTML;
217
217
  },
218
218
  exportInlineContent: (t, r) => {
219
- const s = be(
219
+ const s = Ee(
220
220
  e,
221
221
  t,
222
222
  o,
@@ -226,33 +226,33 @@ const ke = (n, e, o, t, r, s, i = 0, a) => {
226
226
  }
227
227
  };
228
228
  };
229
- function Ct(n, e) {
229
+ function Dt(n, e) {
230
230
  if (e === 0)
231
231
  return;
232
232
  const o = n.resolve(e);
233
233
  for (let t = o.depth; t > 0; t--) {
234
234
  const r = o.node(t);
235
- if (he(r))
235
+ if (be(r))
236
236
  return r.attrs.id;
237
237
  }
238
238
  }
239
- function vt(n) {
239
+ function Ot(n) {
240
240
  return n.getMeta("paste") ? { type: "paste" } : n.getMeta("uiEvent") === "drop" ? { type: "drop" } : n.getMeta("history$") ? {
241
241
  type: n.getMeta("history$").redo ? "redo" : "undo"
242
242
  } : n.getMeta("y-sync$") ? n.getMeta("y-sync$").isUndoRedoOperation ? { type: "undo-redo" } : { type: "yjs-remote" } : { type: "local" };
243
243
  }
244
- function ee(n) {
245
- const e = "__root__", o = {}, t = {}, r = R(n);
244
+ function se(n) {
245
+ const e = "__root__", o = {}, t = {}, r = _(n);
246
246
  return n.descendants((s, i) => {
247
- if (!he(s))
247
+ if (!be(s))
248
248
  return !0;
249
- const a = Ct(n, i), c = a ?? e;
249
+ const a = Dt(n, i), c = a ?? e;
250
250
  t[c] || (t[c] = []);
251
- const l = L(s, r);
251
+ const l = z(s, r);
252
252
  return o[s.attrs.id] = { block: l, parentId: a }, t[c].push(s.attrs.id), !0;
253
253
  }), { byId: o, childrenByParent: t };
254
254
  }
255
- function St(n, e) {
255
+ function Pt(n, e) {
256
256
  const o = /* @__PURE__ */ new Set();
257
257
  if (!n || !e)
258
258
  return o;
@@ -264,17 +264,17 @@ function St(n, e) {
264
264
  const i = {};
265
265
  for (let d = 0; d < s.length; d++)
266
266
  i[s[d]] = d;
267
- const a = r.map((d) => i[d]), c = a.length, l = [], u = [], h = new Array(c).fill(-1), g = (d, f) => {
268
- let w = 0, y = d.length;
269
- for (; w < y; ) {
270
- const v = w + y >>> 1;
271
- d[v] < f ? w = v + 1 : y = v;
267
+ const a = r.map((d) => i[d]), c = a.length, l = [], u = [], h = new Array(c).fill(-1), f = (d, g) => {
268
+ let b = 0, y = d.length;
269
+ for (; b < y; ) {
270
+ const w = b + y >>> 1;
271
+ d[w] < g ? b = w + 1 : y = w;
272
272
  }
273
- return w;
273
+ return b;
274
274
  };
275
275
  for (let d = 0; d < c; d++) {
276
- const f = a[d], w = g(l, f);
277
- w > 0 && (h[d] = u[w - 1]), w === l.length ? (l.push(f), u.push(d)) : (l[w] = f, u[w] = d);
276
+ const g = a[d], b = f(l, g);
277
+ b > 0 && (h[d] = u[b - 1]), b === l.length ? (l.push(g), u.push(d)) : (l[b] = g, u[b] = d);
278
278
  }
279
279
  const m = /* @__PURE__ */ new Set();
280
280
  let p = u[u.length - 1] ?? -1;
@@ -284,13 +284,13 @@ function St(n, e) {
284
284
  m.has(d) || o.add(r[d]);
285
285
  return o;
286
286
  }
287
- function xt(n, e = []) {
288
- const o = vt(n), t = Te(n.before, [
287
+ function Mt(n, e = []) {
288
+ const o = Ot(n), t = Ne(n.before, [
289
289
  n,
290
290
  ...e
291
- ]), r = ee(
291
+ ]), r = se(
292
292
  t.before
293
- ), s = ee(
293
+ ), s = se(
294
294
  t.doc
295
295
  ), i = [], a = /* @__PURE__ */ new Set();
296
296
  Object.keys(s.byId).filter((m) => !(m in r.byId)).forEach((m) => {
@@ -308,16 +308,16 @@ function xt(n, e = []) {
308
308
  prevBlock: void 0
309
309
  }), a.add(m);
310
310
  }), Object.keys(s.byId).filter((m) => m in r.byId).forEach((m) => {
311
- var w, y;
311
+ var b, y;
312
312
  const p = r.byId[m], d = s.byId[m];
313
313
  p.parentId !== d.parentId ? (i.push({
314
314
  type: "move",
315
315
  block: d.block,
316
316
  prevBlock: p.block,
317
317
  source: o,
318
- prevParent: p.parentId ? (w = r.byId[p.parentId]) == null ? void 0 : w.block : void 0,
318
+ prevParent: p.parentId ? (b = r.byId[p.parentId]) == null ? void 0 : b.block : void 0,
319
319
  currentParent: d.parentId ? (y = s.byId[d.parentId]) == null ? void 0 : y.block : void 0
320
- }), a.add(m)) : Oe(
320
+ }), a.add(m)) : He(
321
321
  { ...p.block, children: void 0 },
322
322
  { ...d.block, children: void 0 }
323
323
  ) || (i.push({
@@ -330,38 +330,38 @@ function xt(n, e = []) {
330
330
  const c = r.childrenByParent, l = s.childrenByParent, u = "__root__", h = /* @__PURE__ */ new Set([
331
331
  ...Object.keys(c),
332
332
  ...Object.keys(l)
333
- ]), g = /* @__PURE__ */ new Set();
333
+ ]), f = /* @__PURE__ */ new Set();
334
334
  return h.forEach((m) => {
335
- const p = St(
335
+ const p = Pt(
336
336
  c[m],
337
337
  l[m]
338
338
  );
339
339
  p.size !== 0 && p.forEach((d) => {
340
- var v, D;
341
- const f = r.byId[d], w = s.byId[d];
342
- !f || !w || f.parentId !== w.parentId || a.has(d) || (f.parentId ?? u) !== m || g.has(d) || (g.add(d), i.push({
340
+ var w, v;
341
+ const g = r.byId[d], b = s.byId[d];
342
+ !g || !b || g.parentId !== b.parentId || a.has(d) || (g.parentId ?? u) !== m || f.has(d) || (f.add(d), i.push({
343
343
  type: "move",
344
- block: w.block,
345
- prevBlock: f.block,
344
+ block: b.block,
345
+ prevBlock: g.block,
346
346
  source: o,
347
- prevParent: f.parentId ? (v = r.byId[f.parentId]) == null ? void 0 : v.block : void 0,
348
- currentParent: w.parentId ? (D = s.byId[w.parentId]) == null ? void 0 : D.block : void 0
347
+ prevParent: g.parentId ? (w = r.byId[g.parentId]) == null ? void 0 : w.block : void 0,
348
+ currentParent: b.parentId ? (v = s.byId[b.parentId]) == null ? void 0 : v.block : void 0
349
349
  }), a.add(d));
350
350
  });
351
351
  }), i;
352
352
  }
353
- const fo = C(() => {
353
+ const Do = E(() => {
354
354
  const n = [];
355
355
  return {
356
356
  key: "blockChange",
357
357
  prosemirrorPlugins: [
358
- new T({
359
- key: new P("blockChange"),
358
+ new L({
359
+ key: new N("blockChange"),
360
360
  filterTransaction: (e) => {
361
361
  let o;
362
362
  return n.reduce((t, r) => t === !1 ? t : r({
363
363
  getChanges() {
364
- return o || (o = xt(e), o);
364
+ return o || (o = Mt(e), o);
365
365
  },
366
366
  tr: e
367
367
  }) !== !1, !0);
@@ -381,25 +381,25 @@ const fo = C(() => {
381
381
  }
382
382
  };
383
383
  });
384
- function te(n) {
384
+ function ie(n) {
385
385
  const e = n.charAt(0) === "#" ? n.substring(1, 7) : n, o = parseInt(e.substring(0, 2), 16), t = parseInt(e.substring(2, 4), 16), r = parseInt(e.substring(4, 6), 16), i = [o / 255, t / 255, r / 255].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
386
386
  return 0.2126 * i[0] + 0.7152 * i[1] + 0.0722 * i[2] <= 0.179;
387
387
  }
388
- function Et(n) {
388
+ function At(n) {
389
389
  const e = document.createElement("span");
390
390
  e.classList.add("bn-collaboration-cursor__base");
391
391
  const o = document.createElement("span");
392
392
  o.setAttribute("contentedEditable", "false"), o.classList.add("bn-collaboration-cursor__caret"), o.setAttribute(
393
393
  "style",
394
- `background-color: ${n.color}; color: ${te(n.color) ? "white" : "black"}`
394
+ `background-color: ${n.color}; color: ${ie(n.color) ? "white" : "black"}`
395
395
  );
396
396
  const t = document.createElement("span");
397
397
  return t.classList.add("bn-collaboration-cursor__label"), t.setAttribute(
398
398
  "style",
399
- `background-color: ${n.color}; color: ${te(n.color) ? "white" : "black"}`
399
+ `background-color: ${n.color}; color: ${ie(n.color) ? "white" : "black"}`
400
400
  ), t.insertBefore(document.createTextNode(n.name), null), o.insertBefore(t, null), e.insertBefore(document.createTextNode("⁠"), null), e.insertBefore(o, null), e.insertBefore(document.createTextNode("⁠"), null), e;
401
401
  }
402
- const oe = C(
402
+ const ae = E(
403
403
  ({ options: n }) => {
404
404
  const e = /* @__PURE__ */ new Map(), o = n.provider && "awareness" in n.provider && typeof n.provider.awareness == "object" ? n.provider.awareness : void 0;
405
405
  return o && ("setLocalStateField" in o && typeof o.setLocalStateField == "function" && o.setLocalStateField("user", n.user), "on" in o && typeof o.on == "function" && n.showCursorLabels !== "always" && o.on(
@@ -422,12 +422,12 @@ const oe = C(
422
422
  )), {
423
423
  key: "yCursor",
424
424
  prosemirrorPlugins: [
425
- o ? _e(o, {
426
- selectionBuilder: ze,
425
+ o ? Ge(o, {
426
+ selectionBuilder: Je,
427
427
  cursorBuilder(t, r) {
428
428
  let s = e.get(r);
429
429
  if (!s) {
430
- const i = (n.renderCursor ?? Et)(t);
430
+ const i = (n.renderCursor ?? At)(t);
431
431
  n.showCursorLabels !== "always" && (i.addEventListener("mouseenter", () => {
432
432
  const a = e.get(r);
433
433
  a.element.setAttribute("data-active", ""), a.hideTimeout && (clearTimeout(a.hideTimeout), e.set(r, {
@@ -457,20 +457,20 @@ const oe = C(
457
457
  }
458
458
  };
459
459
  }
460
- ), F = C(
460
+ ), K = E(
461
461
  ({ options: n }) => ({
462
462
  key: "ySync",
463
- prosemirrorPlugins: [Ke(n.fragment)],
463
+ prosemirrorPlugins: [Qe(n.fragment)],
464
464
  runsBefore: ["default"]
465
465
  })
466
- ), $ = C(() => ({
466
+ ), X = E(() => ({
467
467
  key: "yUndo",
468
- prosemirrorPlugins: [je()],
468
+ prosemirrorPlugins: [tt()],
469
469
  dependsOn: ["yCursor", "ySync"],
470
- undoCommand: Xe,
471
- redoCommand: Ye
470
+ undoCommand: et,
471
+ redoCommand: Ze
472
472
  }));
473
- function It(n, e) {
473
+ function Lt(n, e) {
474
474
  const o = n.doc;
475
475
  if (n._item === null) {
476
476
  const t = Array.from(o.share.keys()).find(
@@ -480,14 +480,14 @@ function It(n, e) {
480
480
  throw new Error("type does not exist in other ydoc");
481
481
  return e.get(t, n.constructor);
482
482
  } else {
483
- const t = n._item, r = e.store.clients.get(t.id.client) ?? [], s = I.findIndexSS(r, t.id.clock);
483
+ const t = n._item, r = e.store.clients.get(t.id.client) ?? [], s = P.findIndexSS(r, t.id.clock);
484
484
  return r[s].content.type;
485
485
  }
486
486
  }
487
- const go = C(
487
+ const Oo = E(
488
488
  ({ editor: n, options: e }) => {
489
489
  let o;
490
- const t = H({ isForked: !1 });
490
+ const t = j({ isForked: !1 });
491
491
  return {
492
492
  key: "yForkDoc",
493
493
  store: t,
@@ -502,26 +502,26 @@ const go = C(
502
502
  const r = e.fragment;
503
503
  if (!r)
504
504
  throw new Error("No fragment to fork from");
505
- const s = new I.Doc();
506
- I.applyUpdate(s, I.encodeStateAsUpdate(r.doc));
507
- const i = It(r, s);
505
+ const s = new P.Doc();
506
+ P.applyUpdate(s, P.encodeStateAsUpdate(r.doc));
507
+ const i = Lt(r, s);
508
508
  o = {
509
- undoStack: Z.getState(n.prosemirrorState).undoManager.undoStack,
509
+ undoStack: re.getState(n.prosemirrorState).undoManager.undoStack,
510
510
  originalFragment: r,
511
511
  forkedFragment: i
512
512
  }, n.unregisterExtension([
513
- $,
514
- oe,
515
- F
513
+ X,
514
+ ae,
515
+ K
516
516
  ]);
517
517
  const a = {
518
518
  ...e,
519
519
  fragment: i
520
520
  };
521
521
  n.registerExtension([
522
- F(a),
522
+ K(a),
523
523
  // No need to register the cursor plugin again, it's a local fork
524
- $()
524
+ X()
525
525
  ]), t.setState({ isForked: !0 });
526
526
  },
527
527
  /**
@@ -535,34 +535,34 @@ const go = C(
535
535
  n.unregisterExtension(["ySync", "yCursor", "yUndo"]);
536
536
  const { originalFragment: s, forkedFragment: i, undoStack: a } = o;
537
537
  if (n.registerExtension([
538
- F(e),
539
- oe(e),
540
- $()
541
- ]), Z.getState(
538
+ K(e),
539
+ ae(e),
540
+ X()
541
+ ]), re.getState(
542
542
  n.prosemirrorState
543
543
  ).undoManager.undoStack = a, r) {
544
- const c = I.encodeStateAsUpdate(
544
+ const c = P.encodeStateAsUpdate(
545
545
  i.doc,
546
- I.encodeStateVector(s.doc)
546
+ P.encodeStateVector(s.doc)
547
547
  );
548
- I.applyUpdate(s.doc, c, n);
548
+ P.applyUpdate(s.doc, c, n);
549
549
  }
550
550
  o = void 0, t.setState({ isForked: !1 });
551
551
  }
552
552
  };
553
553
  }
554
- ), ve = (n, e) => {
554
+ ), Te = (n, e) => {
555
555
  e(n), n.forEach((o) => {
556
- o instanceof I.XmlElement && ve(o, e);
556
+ o instanceof P.XmlElement && Te(o, e);
557
557
  });
558
- }, Bt = (n, e) => {
558
+ }, Nt = (n, e) => {
559
559
  const o = /* @__PURE__ */ new Map();
560
560
  return n.forEach((t) => {
561
- t instanceof I.XmlElement && ve(t, (r) => {
561
+ t instanceof P.XmlElement && Te(t, (r) => {
562
562
  if (r.nodeName === "blockContainer" && r.hasAttribute("id")) {
563
563
  const s = r.getAttribute("textColor"), i = r.getAttribute("backgroundColor"), a = {
564
- textColor: s === J.textColor.default ? void 0 : s,
565
- backgroundColor: i === J.backgroundColor.default ? void 0 : i
564
+ textColor: s === oe.textColor.default ? void 0 : s,
565
+ backgroundColor: i === oe.backgroundColor.default ? void 0 : i
566
566
  };
567
567
  (a.textColor || a.backgroundColor) && o.set(r.getAttribute("id"), a);
568
568
  }
@@ -580,14 +580,14 @@ const go = C(
580
580
  });
581
581
  }
582
582
  }), !0);
583
- }, Tt = [Bt], wo = C(
583
+ }, Rt = [Nt], Po = E(
584
584
  ({ options: n }) => {
585
585
  let e = !1;
586
- const o = new pe("schemaMigration");
586
+ const o = new ke("schemaMigration");
587
587
  return {
588
588
  key: "schemaMigration",
589
589
  prosemirrorPlugins: [
590
- new fe({
590
+ new ve({
591
591
  key: o,
592
592
  appendTransaction: (t, r, s) => {
593
593
  if (e || // If any of the transactions are not due to a yjs sync, we don't need to run the migration
@@ -596,7 +596,7 @@ const go = C(
596
596
  !n.fragment.firstChild)
597
597
  return;
598
598
  const i = s.tr;
599
- for (const a of Tt)
599
+ for (const a of Rt)
600
600
  a(n.fragment, i);
601
601
  if (e = !0, !!i.docChanged)
602
602
  return i;
@@ -605,24 +605,171 @@ const go = C(
605
605
  ]
606
606
  };
607
607
  }
608
- ), yo = C(
609
- ({
610
- editor: n,
611
- options: e
612
- }) => ({
608
+ );
609
+ function le(n, e) {
610
+ return !n || !e ? !1 : !!n.closest(`.${e}`);
611
+ }
612
+ function Vt(n, e, o, t, r) {
613
+ const s = n.state.doc.resolve(e.pos);
614
+ if (!!s.parent.inlineContent || e.orientation === "inline")
615
+ return null;
616
+ const a = s.nodeBefore, c = s.nodeAfter;
617
+ if (!a && !c)
618
+ return null;
619
+ const l = e.orientation === "block-vertical-left" || e.orientation === "block-vertical-right", u = l ? e.pos : e.pos - (a ? a.nodeSize : 0), h = n.nodeDOM(u);
620
+ if (!h)
621
+ return null;
622
+ const f = h.getBoundingClientRect();
623
+ if (l) {
624
+ const d = o / 2 * t, g = e.orientation === "block-vertical-left" ? f.left : f.right;
625
+ return {
626
+ left: g - d,
627
+ right: g + d,
628
+ top: f.top,
629
+ bottom: f.bottom
630
+ };
631
+ }
632
+ let m = a ? f.bottom : f.top;
633
+ a && c && (m = (m + n.nodeDOM(e.pos).getBoundingClientRect().top) / 2);
634
+ const p = o / 2 * r;
635
+ return {
636
+ left: f.left,
637
+ right: f.right,
638
+ top: m - p,
639
+ bottom: m + p
640
+ };
641
+ }
642
+ function Ht(n, e, o, t) {
643
+ const r = n.coordsAtPos(e.pos), s = o / 2 * t;
644
+ return {
645
+ left: r.left - s,
646
+ right: r.left + s,
647
+ top: r.top,
648
+ bottom: r.bottom
649
+ };
650
+ }
651
+ function $t(n, e) {
652
+ n.classList.toggle(
653
+ "prosemirror-dropcursor-inline",
654
+ e === "inline"
655
+ ), n.classList.toggle(
656
+ "prosemirror-dropcursor-block-horizontal",
657
+ e === "block-horizontal"
658
+ ), n.classList.toggle(
659
+ "prosemirror-dropcursor-block-vertical-left",
660
+ e === "block-vertical-left"
661
+ ), n.classList.toggle(
662
+ "prosemirror-dropcursor-block-vertical-right",
663
+ e === "block-vertical-right"
664
+ ), n.classList.toggle(
665
+ "prosemirror-dropcursor-block",
666
+ e === "block-horizontal"
667
+ ), n.classList.toggle(
668
+ "prosemirror-dropcursor-vertical",
669
+ e === "block-vertical-left" || e === "block-vertical-right"
670
+ );
671
+ }
672
+ function Ft(n) {
673
+ if (!n || n === document.body && getComputedStyle(n).position === "static")
674
+ return {
675
+ parentLeft: -window.pageXOffset,
676
+ parentTop: -window.pageYOffset
677
+ };
678
+ const e = n.getBoundingClientRect(), o = e.width / n.offsetWidth, t = e.height / n.offsetHeight;
679
+ return {
680
+ parentLeft: e.left - n.scrollLeft * o,
681
+ parentTop: e.top - n.scrollTop * t
682
+ };
683
+ }
684
+ const Ut = "bn-drag-exclude", Mo = E(({ editor: n, options: e }) => {
685
+ var d, g, b, y;
686
+ let o = null, t = null, r = -1, s = null;
687
+ const i = {
688
+ width: ((d = e.dropCursor) == null ? void 0 : d.width) ?? 5,
689
+ color: ((g = e.dropCursor) == null ? void 0 : g.color) ?? "#ddeeff",
690
+ exclude: ((b = e.dropCursor) == null ? void 0 : b.exclude) ?? Ut,
691
+ hooks: (y = e.dropCursor) == null ? void 0 : y.hooks
692
+ }, a = (w) => {
693
+ (w == null ? void 0 : w.pos) === (o == null ? void 0 : o.pos) && (w == null ? void 0 : w.orientation) === (o == null ? void 0 : o.orientation) || (o = w, w == null ? (t && t.parentNode && t.parentNode.removeChild(t), t = null) : c());
694
+ }, c = () => {
695
+ if (!o)
696
+ return;
697
+ const w = n.prosemirrorView, v = w.dom, x = v.getBoundingClientRect(), I = x.width / v.offsetWidth, O = x.height / v.offsetHeight, T = Vt(
698
+ w,
699
+ o,
700
+ i.width,
701
+ I,
702
+ O
703
+ ) ?? Ht(w, o, i.width, I), C = w.dom.offsetParent;
704
+ t || (t = C.appendChild(document.createElement("div")), t.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", i.color && (t.style.backgroundColor = i.color)), $t(t, o.orientation);
705
+ const { parentLeft: S, parentTop: q } = Ft(C);
706
+ t.style.left = (T.left - S) / I + "px", t.style.top = (T.top - q) / O + "px", t.style.width = (T.right - T.left) / I + "px", t.style.height = (T.bottom - T.top) / O + "px";
707
+ }, l = (w) => {
708
+ clearTimeout(r), r = window.setTimeout(() => a(null), w);
709
+ }, u = (w) => {
710
+ const v = w;
711
+ s = v.target instanceof Element ? v.target : null;
712
+ }, h = (w) => {
713
+ var C;
714
+ const v = w;
715
+ if (s && le(s, i.exclude) || v.target instanceof Element && le(v.target, i.exclude))
716
+ return;
717
+ const x = n.prosemirrorView;
718
+ if (!x.editable)
719
+ return;
720
+ const I = x.posAtCoords({
721
+ left: v.clientX,
722
+ top: v.clientY
723
+ }), O = I && I.inside >= 0 && x.state.doc.nodeAt(I.inside), M = O && O.type.spec.disableDropCursor, T = typeof M == "function" ? M(x, I, v) : M;
724
+ if (I && !T) {
725
+ let S = I.pos;
726
+ if (x.dragging && x.dragging.slice) {
727
+ const R = nt(x.state.doc, S, x.dragging.slice);
728
+ R != null && (S = R);
729
+ }
730
+ const Me = !x.state.doc.resolve(S).parent.inlineContent, G = {
731
+ pos: S,
732
+ orientation: Me ? "block-horizontal" : "inline"
733
+ };
734
+ let J = G;
735
+ if ((C = i.hooks) != null && C.computeDropPosition) {
736
+ const R = i.hooks.computeDropPosition({
737
+ editor: n,
738
+ event: v,
739
+ view: x,
740
+ defaultPosition: G
741
+ });
742
+ if (R === null) {
743
+ a(null);
744
+ return;
745
+ }
746
+ J = R;
747
+ }
748
+ a(J), l(5e3);
749
+ }
750
+ }, f = (w) => {
751
+ const v = w;
752
+ (!(v.relatedTarget instanceof Node) || !n.prosemirrorView.dom.contains(v.relatedTarget)) && a(null);
753
+ }, m = () => {
754
+ l(20);
755
+ }, p = () => {
756
+ l(20), s = null;
757
+ };
758
+ return {
613
759
  key: "dropCursor",
614
- prosemirrorPlugins: [
615
- (e.dropCursor ?? We)({
616
- width: 5,
617
- color: "#ddeeff",
618
- editor: n
619
- })
620
- ]
621
- })
622
- ), bo = C(({ editor: n }) => {
623
- const e = H(!1), o = () => n.transact((t) => {
760
+ mount({ signal: w, dom: v, root: x }) {
761
+ x.addEventListener("dragstart", u, {
762
+ capture: !0,
763
+ signal: w
764
+ }), v.addEventListener("dragover", h, { signal: w }), v.addEventListener("dragleave", f, { signal: w }), v.addEventListener("drop", m, { signal: w }), v.addEventListener("dragend", p, { signal: w }), w.addEventListener("abort", () => {
765
+ clearTimeout(r), a(null);
766
+ });
767
+ }
768
+ };
769
+ }), Ao = E(({ editor: n }) => {
770
+ const e = j(!1), o = () => n.transact((t) => {
624
771
  var s;
625
- if (t.selection.empty || t.selection instanceof le && (t.selection.node.type.spec.content === "inline*" || ((s = t.selection.node.firstChild) == null ? void 0 : s.type.spec.content) === "inline*") || t.selection instanceof ce && t.doc.textBetween(t.selection.from, t.selection.to).length === 0)
772
+ if (t.selection.empty || t.selection instanceof pe && (t.selection.node.type.spec.content === "inline*" || ((s = t.selection.node.firstChild) == null ? void 0 : s.type.spec.content) === "inline*") || t.selection instanceof fe && t.doc.textBetween(t.selection.from, t.selection.to).length === 0)
626
773
  return !1;
627
774
  let r = !1;
628
775
  return t.selection.content().content.descendants((i) => (i.type.spec.code && (r = !0), !r)), !r;
@@ -663,12 +810,12 @@ const go = C(
663
810
  });
664
811
  }
665
812
  };
666
- }), ko = C(() => ({
813
+ }), Lo = E(() => ({
667
814
  key: "history",
668
- prosemirrorPlugins: [Qe()],
669
- undoCommand: Je,
670
- redoCommand: Ge
671
- })), Co = C(({ editor: n }) => {
815
+ prosemirrorPlugins: [it()],
816
+ undoCommand: st,
817
+ redoCommand: rt
818
+ })), No = E(({ editor: n }) => {
672
819
  function e(r) {
673
820
  let s = n.prosemirrorView.nodeDOM(r);
674
821
  for (; s && s.parentElement; ) {
@@ -683,7 +830,7 @@ const go = C(
683
830
  const a = i.doc.resolve(r), c = a.marks().find((u) => u.type.name === s);
684
831
  if (!c)
685
832
  return;
686
- const l = Pe(a, c.type);
833
+ const l = Re(a, c.type);
687
834
  if (l)
688
835
  return {
689
836
  range: l,
@@ -692,7 +839,7 @@ const go = C(
692
839
  return i.doc.textBetween(l.from, l.to);
693
840
  },
694
841
  get position() {
695
- return De(
842
+ return Ve(
696
843
  n.prosemirrorView,
697
844
  l.from,
698
845
  l.to
@@ -721,7 +868,7 @@ const go = C(
721
868
  },
722
869
  editLink(r, s, i = n.transact((a) => a.selection.anchor)) {
723
870
  n.transact((a) => {
724
- const c = R(a), { range: l } = o(i + 1, "link") || {
871
+ const c = _(a), { range: l } = o(i + 1, "link") || {
725
872
  range: {
726
873
  from: a.selection.from,
727
874
  to: a.selection.to
@@ -736,7 +883,7 @@ const go = C(
736
883
  },
737
884
  deleteLink(r = n.transact((s) => s.selection.anchor)) {
738
885
  n.transact((s) => {
739
- const i = R(s), { range: a } = o(r + 1, "link") || {
886
+ const i = _(s), { range: a } = o(r + 1, "link") || {
740
887
  range: {
741
888
  from: s.selection.from,
742
889
  to: s.selection.to
@@ -749,7 +896,7 @@ const go = C(
749
896
  }), n.prosemirrorView.focus();
750
897
  }
751
898
  };
752
- }), vo = [
899
+ }), Ro = [
753
900
  "http",
754
901
  "https",
755
902
  "ftp",
@@ -760,12 +907,12 @@ const go = C(
760
907
  "sms",
761
908
  "cid",
762
909
  "xmpp"
763
- ], So = "https", Pt = new P("node-selection-keyboard"), xo = C(
910
+ ], Vo = "https", _t = new N("node-selection-keyboard"), Ho = E(
764
911
  () => ({
765
912
  key: "nodeSelectionKeyboard",
766
913
  prosemirrorPlugins: [
767
- new T({
768
- key: Pt,
914
+ new L({
915
+ key: _t,
769
916
  props: {
770
917
  handleKeyDown: (n, e) => {
771
918
  if ("node" in n.state.selection) {
@@ -780,7 +927,7 @@ const go = C(
780
927
  n.state.tr.selection.$to.after(),
781
928
  n.state.schema.nodes.paragraph.createChecked()
782
929
  ).setSelection(
783
- new ce(
930
+ new fe(
784
931
  o.doc.resolve(
785
932
  n.state.tr.selection.$to.after() + 1
786
933
  )
@@ -795,7 +942,7 @@ const go = C(
795
942
  })
796
943
  ]
797
944
  })
798
- ), Dt = new P("blocknote-placeholder"), Eo = C(
945
+ ), zt = new N("blocknote-placeholder"), $o = E(
799
946
  ({
800
947
  editor: n,
801
948
  options: e
@@ -804,10 +951,10 @@ const go = C(
804
951
  return {
805
952
  key: "placeholder",
806
953
  prosemirrorPlugins: [
807
- new T({
808
- key: Dt,
954
+ new L({
955
+ key: zt,
809
956
  view: (t) => {
810
- const r = `placeholder-selector-${Ze()}`;
957
+ const r = `placeholder-selector-${at()}`;
811
958
  t.dom.classList.add(r);
812
959
  const s = document.createElement("style"), i = n._tiptapEditor.options.injectNonce;
813
960
  i && s.setAttribute("nonce", i), t.root instanceof window.ShadowRoot ? t.root.append(s) : t.root.head.appendChild(s);
@@ -819,16 +966,16 @@ const go = C(
819
966
  ...h
820
967
  } = o || {};
821
968
  for (const [p, d] of Object.entries(h)) {
822
- const f = `[data-content-type="${p}"]`;
969
+ const g = `[data-content-type="${p}"]`;
823
970
  a.insertRule(
824
- `${c(f)} { content: ${JSON.stringify(
971
+ `${c(g)} { content: ${JSON.stringify(
825
972
  d
826
973
  )}; }`
827
974
  );
828
975
  }
829
- const g = "[data-is-only-empty-block]", m = "[data-is-empty-and-focused]";
976
+ const f = "[data-is-only-empty-block]", m = "[data-is-empty-and-focused]";
830
977
  a.insertRule(
831
- `${c(g)} { content: ${JSON.stringify(
978
+ `${c(f)} { content: ${JSON.stringify(
832
979
  u
833
980
  )}; }`
834
981
  ), a.insertRule(
@@ -855,7 +1002,7 @@ const go = C(
855
1002
  return;
856
1003
  const i = [];
857
1004
  t.doc.content.size === 6 && i.push(
858
- A.node(2, 4, {
1005
+ H.node(2, 4, {
859
1006
  "data-is-only-empty-block": "true"
860
1007
  })
861
1008
  );
@@ -863,19 +1010,19 @@ const go = C(
863
1010
  if (c.content.size === 0) {
864
1011
  const l = a.before();
865
1012
  i.push(
866
- A.node(l, l + c.nodeSize, {
1013
+ H.node(l, l + c.nodeSize, {
867
1014
  "data-is-empty-and-focused": "true"
868
1015
  })
869
1016
  );
870
1017
  }
871
- return V.create(r, i);
1018
+ return Y.create(r, i);
872
1019
  }
873
1020
  }
874
1021
  })
875
1022
  ]
876
1023
  };
877
1024
  }
878
- ), ne = new P("previous-blocks"), Ot = {
1025
+ ), ce = new N("previous-blocks"), Yt = {
879
1026
  // Numbered List Items
880
1027
  index: "index",
881
1028
  // Headings
@@ -884,20 +1031,20 @@ const go = C(
884
1031
  type: "type",
885
1032
  depth: "depth",
886
1033
  "depth-change": "depth-change"
887
- }, Io = C(() => {
1034
+ }, Fo = E(() => {
888
1035
  let n;
889
1036
  return {
890
1037
  key: "previousBlockType",
891
1038
  prosemirrorPlugins: [
892
- new T({
893
- key: ne,
1039
+ new L({
1040
+ key: ce,
894
1041
  view(e) {
895
1042
  return {
896
1043
  update: async (o, t) => {
897
1044
  var r;
898
1045
  ((r = this.key) == null ? void 0 : r.getState(o.state).updatedBlocks.size) > 0 && (n = setTimeout(() => {
899
1046
  o.dispatch(
900
- o.state.tr.setMeta(ne, { clearUpdate: !0 })
1047
+ o.state.tr.setMeta(ce, { clearUpdate: !0 })
901
1048
  );
902
1049
  }, 0));
903
1050
  },
@@ -920,22 +1067,22 @@ const go = C(
920
1067
  apply(e, o, t, r) {
921
1068
  if (o.currentTransactionOldBlockAttrs = {}, o.updatedBlocks.clear(), !e.docChanged || t.doc.eq(r.doc))
922
1069
  return o;
923
- const s = {}, i = j(
1070
+ const s = {}, i = Q(
924
1071
  t.doc,
925
1072
  (l) => l.attrs.id
926
1073
  ), a = new Map(
927
1074
  i.map((l) => [l.node.attrs.id, l])
928
- ), c = j(
1075
+ ), c = Q(
929
1076
  r.doc,
930
1077
  (l) => l.attrs.id
931
1078
  );
932
1079
  for (const l of c) {
933
- const u = a.get(l.node.attrs.id), h = u == null ? void 0 : u.node.firstChild, g = l.node.firstChild;
934
- if (u && h && g) {
1080
+ const u = a.get(l.node.attrs.id), h = u == null ? void 0 : u.node.firstChild, f = l.node.firstChild;
1081
+ if (u && h && f) {
935
1082
  const m = {
936
- index: g.attrs.index,
937
- level: g.attrs.level,
938
- type: g.type.name,
1083
+ index: f.attrs.index,
1084
+ level: f.attrs.level,
1085
+ type: f.type.name,
939
1086
  depth: r.doc.resolve(l.pos).depth
940
1087
  }, p = {
941
1088
  index: h.attrs.index,
@@ -960,26 +1107,26 @@ const go = C(
960
1107
  return;
961
1108
  const i = o.currentTransactionOldBlockAttrs[r.attrs.id], a = {};
962
1109
  for (const [l, u] of Object.entries(i))
963
- a["data-prev-" + Ot[l]] = u || "none";
964
- const c = A.node(s, s + r.nodeSize, {
1110
+ a["data-prev-" + Yt[l]] = u || "none";
1111
+ const c = H.node(s, s + r.nodeSize, {
965
1112
  ...a
966
1113
  });
967
1114
  t.push(c);
968
- }), V.create(e.doc, t);
1115
+ }), Y.create(e.doc, t);
969
1116
  }
970
1117
  }
971
1118
  })
972
1119
  ]
973
1120
  };
974
1121
  });
975
- function Se(n, e) {
1122
+ function De(n, e) {
976
1123
  var o, t;
977
1124
  for (; n && n.parentElement && n.parentElement !== e.dom && ((o = n.getAttribute) == null ? void 0 : o.call(n, "data-node-type")) !== "blockContainer"; )
978
1125
  n = n.parentElement;
979
1126
  if (((t = n.getAttribute) == null ? void 0 : t.call(n, "data-node-type")) === "blockContainer")
980
1127
  return { node: n, id: n.getAttribute("data-id") };
981
1128
  }
982
- function At() {
1129
+ function jt() {
983
1130
  const n = (e) => {
984
1131
  let o = e.children.length;
985
1132
  for (let t = 0; t < o; t++) {
@@ -995,7 +1142,7 @@ function At() {
995
1142
  };
996
1143
  return n;
997
1144
  }
998
- function Mt() {
1145
+ function Kt() {
999
1146
  const n = (e) => {
1000
1147
  var o;
1001
1148
  if (e.children && "length" in e.children && e.children.length)
@@ -1004,15 +1151,15 @@ function Mt() {
1004
1151
  r.type === "element" && r.tagName === "input" && ((o = r.properties) == null ? void 0 : o.type) === "checkbox" && (s == null ? void 0 : s.type) === "element" && s.tagName === "p" ? (s.tagName = "span", s.children.splice(
1005
1152
  0,
1006
1153
  0,
1007
- lt(document.createTextNode(" "))
1154
+ gt(document.createTextNode(" "))
1008
1155
  )) : n(r);
1009
1156
  }
1010
1157
  };
1011
1158
  return n;
1012
1159
  }
1013
- function Nt() {
1160
+ function Xt() {
1014
1161
  return (n) => {
1015
- ct(n, "element", (e, o, t) => {
1162
+ wt(n, "element", (e, o, t) => {
1016
1163
  var r, s, i, a;
1017
1164
  if (t && e.tagName === "video") {
1018
1165
  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"]) || "";
@@ -1024,29 +1171,29 @@ function Nt() {
1024
1171
  });
1025
1172
  };
1026
1173
  }
1027
- function xe(n) {
1028
- return at().use(nt, { fragment: !0 }).use(Nt).use(At).use(Mt).use(rt).use(st).use(it, {
1174
+ function Oe(n) {
1175
+ return ft().use(ut, { fragment: !0 }).use(Xt).use(jt).use(Kt).use(ht).use(mt).use(pt, {
1029
1176
  handlers: { text: (o) => o.value }
1030
1177
  }).processSync(n).value;
1031
1178
  }
1032
- function Bo(n, e, o, t) {
1033
- const s = Ce(e, o).exportBlocks(n, t);
1034
- return xe(s);
1179
+ function Uo(n, e, o, t) {
1180
+ const s = Be(e, o).exportBlocks(n, t);
1181
+ return Oe(s);
1035
1182
  }
1036
- function Rt(n) {
1183
+ function Wt(n) {
1037
1184
  const e = [];
1038
1185
  return n.descendants((o) => {
1039
1186
  var r, s;
1040
- const t = R(o);
1187
+ const t = _(o);
1041
1188
  return o.type.name === "blockContainer" && ((r = o.firstChild) == null ? void 0 : r.type.name) === "blockGroup" ? !0 : o.type.name === "columnList" && o.childCount === 1 ? ((s = o.firstChild) == null || s.forEach((i) => {
1042
- e.push(L(i, t));
1043
- }), !1) : o.type.isInGroup("bnBlock") ? (e.push(L(o, t)), !1) : !0;
1189
+ e.push(z(i, t));
1190
+ }), !1) : o.type.isInGroup("bnBlock") ? (e.push(z(o, t)), !1) : !0;
1044
1191
  }), e;
1045
1192
  }
1046
- class B extends N {
1193
+ class A extends U {
1047
1194
  constructor(o, t) {
1048
1195
  super(o, t);
1049
- b(this, "nodes");
1196
+ k(this, "nodes");
1050
1197
  const r = o.node();
1051
1198
  this.nodes = [], o.doc.nodesBetween(o.pos, t.pos, (s, i, a) => {
1052
1199
  if (a !== null && a.eq(r))
@@ -1054,13 +1201,13 @@ class B extends N {
1054
1201
  });
1055
1202
  }
1056
1203
  static create(o, t, r = t) {
1057
- return new B(o.resolve(t), o.resolve(r));
1204
+ return new A(o.resolve(t), o.resolve(r));
1058
1205
  }
1059
1206
  content() {
1060
- return new ot(we.from(this.nodes), 0, 0);
1207
+ return new dt(Se.from(this.nodes), 0, 0);
1061
1208
  }
1062
1209
  eq(o) {
1063
- if (!(o instanceof B) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
1210
+ if (!(o instanceof A) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
1064
1211
  return !1;
1065
1212
  for (let t = 0; t < this.nodes.length; t++)
1066
1213
  if (!this.nodes[t].eq(o.nodes[t]))
@@ -1069,7 +1216,7 @@ class B extends N {
1069
1216
  }
1070
1217
  map(o, t) {
1071
1218
  const r = t.mapResult(this.from), s = t.mapResult(this.to);
1072
- return s.deleted ? N.near(o.resolve(r.pos)) : r.deleted ? N.near(o.resolve(s.pos)) : new B(
1219
+ return s.deleted ? U.near(o.resolve(r.pos)) : r.deleted ? U.near(o.resolve(s.pos)) : new A(
1073
1220
  o.resolve(r.pos),
1074
1221
  o.resolve(s.pos)
1075
1222
  );
@@ -1078,9 +1225,9 @@ class B extends N {
1078
1225
  return { type: "multiple-node", anchor: this.anchor, head: this.head };
1079
1226
  }
1080
1227
  }
1081
- N.jsonID("multiple-node", B);
1082
- let E;
1083
- function Lt(n, e) {
1228
+ U.jsonID("multiple-node", A);
1229
+ let D;
1230
+ function qt(n, e) {
1084
1231
  let o, t;
1085
1232
  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);
1086
1233
  if (r && s) {
@@ -1090,9 +1237,9 @@ function Lt(n, e) {
1090
1237
  o = n.from, t = n.to;
1091
1238
  return { from: o, to: t };
1092
1239
  }
1093
- function re(n, e, o = e) {
1240
+ function de(n, e, o = e) {
1094
1241
  e === o && (o += n.state.doc.resolve(e + 1).node().nodeSize);
1095
- const t = n.domAtPos(e).node.cloneNode(!0), r = n.domAtPos(e).node, s = (h, g) => Array.prototype.indexOf.call(h.children, g), i = s(
1242
+ const t = n.domAtPos(e).node.cloneNode(!0), r = n.domAtPos(e).node, s = (h, f) => Array.prototype.indexOf.call(h.children, f), i = s(
1096
1243
  r,
1097
1244
  // Expects from position to be just before the first selected block.
1098
1245
  n.domAtPos(e + 1).node.parentElement
@@ -1103,44 +1250,44 @@ function re(n, e, o = e) {
1103
1250
  );
1104
1251
  for (let h = r.childElementCount - 1; h >= 0; h--)
1105
1252
  (h > a || h < i) && t.removeChild(t.children[h]);
1106
- Ee(n.root), E = t;
1107
- const c = E.getElementsByTagName("iframe");
1253
+ Pe(n.root), D = t;
1254
+ const c = D.getElementsByTagName("iframe");
1108
1255
  for (let h = 0; h < c.length; h++) {
1109
- const g = c[h], m = g.parentElement;
1110
- m && m.removeChild(g);
1256
+ const f = c[h], m = f.parentElement;
1257
+ m && m.removeChild(f);
1111
1258
  }
1112
1259
  const u = n.dom.className.split(" ").filter(
1113
1260
  (h) => h !== "ProseMirror" && h !== "bn-root" && h !== "bn-editor"
1114
1261
  ).join(" ");
1115
- E.className = E.className + " bn-drag-preview " + u, n.root instanceof ShadowRoot ? n.root.appendChild(E) : n.root.body.appendChild(E);
1262
+ D.className = D.className + " bn-drag-preview " + u, n.root instanceof ShadowRoot ? n.root.appendChild(D) : n.root.body.appendChild(D);
1116
1263
  }
1117
- function Ee(n) {
1118
- E !== void 0 && (n instanceof ShadowRoot ? n.removeChild(E) : n.body.removeChild(E), E = void 0);
1264
+ function Pe(n) {
1265
+ D !== void 0 && (n instanceof ShadowRoot ? n.removeChild(D) : n.body.removeChild(D), D = void 0);
1119
1266
  }
1120
- function Vt(n, e, o) {
1267
+ function Gt(n, e, o) {
1121
1268
  if (!n.dataTransfer || o.headless)
1122
1269
  return;
1123
- const t = o.prosemirrorView, r = me(e.id, t.state.doc);
1270
+ const t = o.prosemirrorView, r = ye(e.id, t.state.doc);
1124
1271
  if (!r)
1125
1272
  throw new Error(`Block with ID ${e.id} not found`);
1126
1273
  const s = r.posBeforeNode;
1127
1274
  if (s != null) {
1128
- const i = t.state.selection, a = t.state.doc, { from: c, to: l } = Lt(i, a), u = c <= s && s < l, h = i.$anchor.node() !== i.$head.node() || i instanceof B;
1275
+ const i = t.state.selection, a = t.state.doc, { from: c, to: l } = qt(i, a), u = c <= s && s < l, h = i.$anchor.node() !== i.$head.node() || i instanceof A;
1129
1276
  u && h ? (t.dispatch(
1130
- t.state.tr.setSelection(B.create(a, c, l))
1131
- ), re(t, c, l)) : (t.dispatch(
1132
- t.state.tr.setSelection(le.create(t.state.doc, s))
1133
- ), re(t, s));
1134
- const g = t.state.selection.content(), m = o.pmSchema, p = t.serializeForClipboard(g).dom.innerHTML, d = Ce(m, o), f = Rt(g.content), w = d.exportBlocks(f, {}), y = xe(w);
1135
- 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(E, 0, 0);
1277
+ t.state.tr.setSelection(A.create(a, c, l))
1278
+ ), de(t, c, l)) : (t.dispatch(
1279
+ t.state.tr.setSelection(pe.create(t.state.doc, s))
1280
+ ), de(t, s));
1281
+ const f = t.state.selection.content(), m = o.pmSchema, p = t.serializeForClipboard(f).dom.innerHTML, d = Be(m, o), g = Wt(f.content), b = d.exportBlocks(g, {}), y = Oe(b);
1282
+ n.dataTransfer.clearData(), n.dataTransfer.setData("blocknote/html", p), n.dataTransfer.setData("text/html", b), n.dataTransfer.setData("text/plain", y), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(D, 0, 0);
1136
1283
  }
1137
1284
  }
1138
- const se = 250;
1139
- function U(n, e, o = !0) {
1285
+ const ue = 250;
1286
+ function W(n, e, o = !0) {
1140
1287
  const t = n.root.elementsFromPoint(e.left, e.top);
1141
1288
  for (const r of t)
1142
1289
  if (n.dom.contains(r))
1143
- return o && r.closest("[data-node-type=columnList]") ? U(
1290
+ return o && r.closest("[data-node-type=columnList]") ? W(
1144
1291
  n,
1145
1292
  {
1146
1293
  // TODO can we do better than this?
@@ -1149,9 +1296,9 @@ function U(n, e, o = !0) {
1149
1296
  top: e.top
1150
1297
  },
1151
1298
  !1
1152
- ) : Se(r, n);
1299
+ ) : De(r, n);
1153
1300
  }
1154
- function Ht(n, e) {
1301
+ function Jt(n, e) {
1155
1302
  if (!e.dom.firstChild)
1156
1303
  return;
1157
1304
  const o = e.dom.firstChild.getBoundingClientRect(), t = {
@@ -1161,11 +1308,11 @@ function Ht(n, e) {
1161
1308
  o.right - 10
1162
1309
  ),
1163
1310
  top: n.y
1164
- }, r = U(e, t);
1311
+ }, r = W(e, t);
1165
1312
  if (!r)
1166
1313
  return;
1167
1314
  const s = r.node.getBoundingClientRect();
1168
- return U(
1315
+ return W(
1169
1316
  e,
1170
1317
  {
1171
1318
  left: s.right - 10,
@@ -1174,18 +1321,18 @@ function Ht(n, e) {
1174
1321
  !1
1175
1322
  );
1176
1323
  }
1177
- class Ft {
1324
+ class Qt {
1178
1325
  constructor(e, o, t) {
1179
- b(this, "state");
1180
- b(this, "emitUpdate");
1181
- b(this, "mousePos");
1182
- b(this, "hoveredBlock");
1183
- b(this, "menuFrozen", !1);
1184
- b(this, "isDragOrigin", !1);
1185
- b(this, "updateState", (e) => {
1326
+ k(this, "state");
1327
+ k(this, "emitUpdate");
1328
+ k(this, "mousePos");
1329
+ k(this, "hoveredBlock");
1330
+ k(this, "menuFrozen", !1);
1331
+ k(this, "isDragOrigin", !1);
1332
+ k(this, "updateState", (e) => {
1186
1333
  this.state = e, this.emitUpdate(this.state);
1187
1334
  });
1188
- b(this, "updateStateFromMousePos", () => {
1335
+ k(this, "updateStateFromMousePos", () => {
1189
1336
  var t, r, s, i, a;
1190
1337
  if (this.menuFrozen || !this.mousePos)
1191
1338
  return;
@@ -1193,11 +1340,11 @@ class Ft {
1193
1340
  clientX: this.mousePos.x,
1194
1341
  clientY: this.mousePos.y
1195
1342
  });
1196
- if ((e == null ? void 0 : e.element) !== this.pmView.dom || e.distance > se) {
1343
+ if ((e == null ? void 0 : e.element) !== this.pmView.dom || e.distance > ue) {
1197
1344
  (t = this.state) != null && t.show && (this.state.show = !1, this.updateState(this.state));
1198
1345
  return;
1199
1346
  }
1200
- const o = Ht(this.mousePos, this.pmView);
1347
+ const o = Jt(this.mousePos, this.pmView);
1201
1348
  if (!o || !this.editor.isEditable) {
1202
1349
  (r = this.state) != null && r.show && (this.state.show = !1, this.updateState(this.state));
1203
1350
  return;
@@ -1242,25 +1389,25 @@ class Ft {
1242
1389
  * could then drag between editors in different windows, but you can only
1243
1390
  * access `dataTransfer` contents on `dragstart` and `drop` events.
1244
1391
  */
1245
- b(this, "onDragStart", (e) => {
1392
+ k(this, "onDragStart", (e) => {
1246
1393
  var i;
1247
1394
  const o = (i = e.dataTransfer) == null ? void 0 : i.getData("blocknote/html");
1248
1395
  if (!o || this.pmView.dragging)
1249
1396
  return;
1250
1397
  const t = document.createElement("div");
1251
1398
  t.innerHTML = o;
1252
- const s = et.fromSchema(this.pmView.state.schema).parse(t, {
1399
+ const s = lt.fromSchema(this.pmView.state.schema).parse(t, {
1253
1400
  topNode: this.pmView.state.schema.nodes.blockGroup.create()
1254
1401
  });
1255
1402
  this.pmView.dragging = {
1256
- slice: new tt(s.content, 0, 0),
1403
+ slice: new ct(s.content, 0, 0),
1257
1404
  move: !0
1258
1405
  };
1259
1406
  });
1260
1407
  /**
1261
1408
  * Finds the closest editor visually to the given coordinates
1262
1409
  */
1263
- b(this, "findClosestEditorElement", (e) => {
1410
+ k(this, "findClosestEditorElement", (e) => {
1264
1411
  const o = Array.from(this.pmView.root.querySelectorAll(".bn-editor"));
1265
1412
  if (o.length === 0)
1266
1413
  return null;
@@ -1288,7 +1435,7 @@ class Ft {
1288
1435
  *
1289
1436
  * The synthetic event is a necessary evil because we do not control prosemirror-dropcursor to be able to show the drop-cursor within the range we want
1290
1437
  */
1291
- b(this, "onDragOver", (e) => {
1438
+ k(this, "onDragOver", (e) => {
1292
1439
  var r;
1293
1440
  if (e.synthetic || !(this.pmView.dragging !== null || this.isDragOrigin || ((r = e.dataTransfer) == null ? void 0 : r.types.includes("blocknote/html")) || e.target instanceof Node && this.pmView.dom.contains(e.target)))
1294
1441
  return;
@@ -1302,7 +1449,7 @@ class Ft {
1302
1449
  /**
1303
1450
  * Closes the drop-cursor for the current editor
1304
1451
  */
1305
- b(this, "closeDropCursor", () => {
1452
+ k(this, "closeDropCursor", () => {
1306
1453
  const e = new Event("dragleave", { bubbles: !1 });
1307
1454
  e.synthetic = !0, this.pmView.dom.dispatchEvent(e);
1308
1455
  });
@@ -1314,12 +1461,12 @@ class Ft {
1314
1461
  * - Whether the current editor instance is the drag origin
1315
1462
  * - Whether the drop event is within the bounds of the current editor instance
1316
1463
  */
1317
- b(this, "getDragEventContext", (e) => {
1464
+ k(this, "getDragEventContext", (e) => {
1318
1465
  var l, u;
1319
1466
  if (!(this.pmView.dragging !== null || this.isDragOrigin || ((l = e.dataTransfer) == null ? void 0 : l.types.includes("blocknote/html")) || e.target instanceof Node && this.pmView.dom.contains(e.target)))
1320
1467
  return;
1321
1468
  const t = !((u = e.dataTransfer) != null && u.types.includes("blocknote/html")) && !!this.pmView.dragging, r = !!this.isDragOrigin, s = t || r, i = this.findClosestEditorElement(e);
1322
- if (!i || i.distance > se)
1469
+ if (!i || i.distance > ue)
1323
1470
  return;
1324
1471
  const a = i.element === this.pmView.dom, c = a && i.distance === 0;
1325
1472
  if (!(!a && !s))
@@ -1342,7 +1489,7 @@ class Ft {
1342
1489
  * - If we are the drag origin but not the drop point:
1343
1490
  * - Delete the dragged content from our editor after a delay
1344
1491
  */
1345
- b(this, "onDrop", (e) => {
1492
+ k(this, "onDrop", (e) => {
1346
1493
  var a;
1347
1494
  if (e.synthetic || !(this.pmView.dragging !== null || this.isDragOrigin || ((a = e.dataTransfer) == null ? void 0 : a.types.includes("blocknote/html")) || e.target instanceof Node && this.pmView.dom.contains(e.target)))
1348
1495
  return;
@@ -1357,7 +1504,7 @@ class Ft {
1357
1504
  return;
1358
1505
  this.pmView.dispatch(
1359
1506
  this.pmView.state.tr.setSelection(
1360
- qe.create(
1507
+ ot.create(
1361
1508
  this.pmView.state.tr.doc,
1362
1509
  this.pmView.state.tr.selection.anchor
1363
1510
  )
@@ -1372,14 +1519,14 @@ class Ft {
1372
1519
  return;
1373
1520
  }
1374
1521
  });
1375
- b(this, "onDragEnd", (e) => {
1522
+ k(this, "onDragEnd", (e) => {
1376
1523
  e.synthetic || (this.pmView.dragging = null);
1377
1524
  });
1378
- b(this, "onKeyDown", (e) => {
1525
+ k(this, "onKeyDown", (e) => {
1379
1526
  var o;
1380
1527
  (o = this.state) != null && o.show && this.editor.isFocused() && (this.state.show = !1, this.emitUpdate(this.state));
1381
1528
  });
1382
- b(this, "onMouseMove", (e) => {
1529
+ k(this, "onMouseMove", (e) => {
1383
1530
  var s;
1384
1531
  if (this.menuFrozen)
1385
1532
  return;
@@ -1472,18 +1619,18 @@ class Ft {
1472
1619
  );
1473
1620
  }
1474
1621
  }
1475
- const $t = new pe("SideMenuPlugin"), To = C(({ editor: n }) => {
1622
+ const Zt = new ke("SideMenuPlugin"), _o = E(({ editor: n }) => {
1476
1623
  let e;
1477
- const o = H(
1624
+ const o = j(
1478
1625
  void 0
1479
1626
  );
1480
1627
  return {
1481
1628
  key: "sideMenu",
1482
1629
  store: o,
1483
1630
  prosemirrorPlugins: [
1484
- new fe({
1485
- key: $t,
1486
- view: (t) => (e = new Ft(n, t, (r) => {
1631
+ new ve({
1632
+ key: Zt,
1633
+ view: (t) => (e = new Qt(n, t, (r) => {
1487
1634
  o.setState({ ...r });
1488
1635
  }), e)
1489
1636
  })
@@ -1492,13 +1639,13 @@ const $t = new pe("SideMenuPlugin"), To = C(({ editor: n }) => {
1492
1639
  * Handles drag & drop events for blocks.
1493
1640
  */
1494
1641
  blockDragStart(t, r) {
1495
- e && (e.isDragOrigin = !0), Vt(t, r, n);
1642
+ e && (e.isDragOrigin = !0), Gt(t, r, n);
1496
1643
  },
1497
1644
  /**
1498
1645
  * Handles drag & drop events for blocks.
1499
1646
  */
1500
1647
  blockDragEnd() {
1501
- Ee(n.prosemirrorView.root), e && (e.isDragOrigin = !1), n.blur();
1648
+ Pe(n.prosemirrorView.root), e && (e.isDragOrigin = !1), n.blur();
1502
1649
  },
1503
1650
  /**
1504
1651
  * Freezes the side menu. When frozen, the side menu will stay
@@ -1518,17 +1665,38 @@ const $t = new pe("SideMenuPlugin"), To = C(({ editor: n }) => {
1518
1665
  }
1519
1666
  };
1520
1667
  });
1521
- let S;
1522
- function ie(n) {
1523
- S || (S = document.createElement("div"), S.innerHTML = "_", S.style.opacity = "0", S.style.height = "1px", S.style.width = "1px", n instanceof Document ? n.body.appendChild(S) : n.appendChild(S));
1668
+ let $;
1669
+ async function eo() {
1670
+ return $ || ($ = (async () => {
1671
+ const [n, e] = await Promise.all([
1672
+ import("emoji-mart"),
1673
+ // use a dynamic import to encourage bundle-splitting
1674
+ // and a smaller initial client bundle size
1675
+ import("@emoji-mart/data")
1676
+ ]), o = "default" in n ? n.default : n, t = "default" in e ? e.default : e;
1677
+ return await o.init({ data: t }), { emojiMart: o, emojiData: t };
1678
+ })(), $);
1679
+ }
1680
+ async function zo(n, e) {
1681
+ if (!("text" in n.schema.inlineContentSchema) || n.schema.inlineContentSchema.text !== We.text)
1682
+ return [];
1683
+ const { emojiData: o, emojiMart: t } = await eo();
1684
+ return (e.trim() === "" ? Object.values(o.emojis) : await t.SearchIndex.search(e)).map((s) => ({
1685
+ id: s.skins[0].native,
1686
+ onItemClick: () => n.insertInlineContent(s.skins[0].native + " ")
1687
+ }));
1688
+ }
1689
+ let B;
1690
+ function he(n) {
1691
+ B || (B = document.createElement("div"), B.innerHTML = "_", B.style.opacity = "0", B.style.height = "1px", B.style.width = "1px", n instanceof Document ? n.body.appendChild(B) : n.appendChild(B));
1524
1692
  }
1525
- function Ut(n) {
1526
- S && (n instanceof Document ? n.body.removeChild(S) : n.removeChild(S), S = void 0);
1693
+ function to(n) {
1694
+ B && (n instanceof Document ? n.body.removeChild(B) : n.removeChild(B), B = void 0);
1527
1695
  }
1528
- function M(n) {
1696
+ function F(n) {
1529
1697
  return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
1530
1698
  }
1531
- function _t(n) {
1699
+ function oo(n) {
1532
1700
  let e = n;
1533
1701
  for (; e && e.nodeName !== "TD" && e.nodeName !== "TH" && !e.classList.contains("tableWrapper"); ) {
1534
1702
  if (e.classList.contains("ProseMirror"))
@@ -1548,32 +1716,32 @@ function _t(n) {
1548
1716
  tbodyNode: e.querySelector("tbody")
1549
1717
  };
1550
1718
  }
1551
- function zt(n, e) {
1719
+ function no(n, e) {
1552
1720
  const o = e.querySelectorAll(n);
1553
1721
  for (let t = 0; t < o.length; t++)
1554
1722
  o[t].style.visibility = "hidden";
1555
1723
  }
1556
- class Kt {
1724
+ class ro {
1557
1725
  constructor(e, o, t) {
1558
- b(this, "state");
1559
- b(this, "emitUpdate");
1560
- b(this, "tableId");
1561
- b(this, "tablePos");
1562
- b(this, "tableElement");
1563
- b(this, "menuFrozen", !1);
1564
- b(this, "mouseState", "up");
1565
- b(this, "prevWasEditable", null);
1566
- b(this, "viewMousedownHandler", () => {
1726
+ k(this, "state");
1727
+ k(this, "emitUpdate");
1728
+ k(this, "tableId");
1729
+ k(this, "tablePos");
1730
+ k(this, "tableElement");
1731
+ k(this, "menuFrozen", !1);
1732
+ k(this, "mouseState", "up");
1733
+ k(this, "prevWasEditable", null);
1734
+ k(this, "viewMousedownHandler", () => {
1567
1735
  this.mouseState = "down";
1568
1736
  });
1569
- b(this, "mouseUpHandler", (e) => {
1737
+ k(this, "mouseUpHandler", (e) => {
1570
1738
  this.mouseState = "up", this.mouseMoveHandler(e);
1571
1739
  });
1572
- b(this, "mouseMoveHandler", (e) => {
1573
- var l, u, h, g, m, p, d, f;
1740
+ k(this, "mouseMoveHandler", (e) => {
1741
+ var l, u, h, f, m, p, d, g;
1574
1742
  if (this.menuFrozen || this.mouseState === "selecting" || !(e.target instanceof Element) || !this.pmView.dom.contains(e.target))
1575
1743
  return;
1576
- const o = _t(e.target);
1744
+ const o = oo(e.target);
1577
1745
  if ((o == null ? void 0 : o.type) === "cell" && this.mouseState === "down" && !((l = this.state) != null && l.draggingState)) {
1578
1746
  this.mouseState = "selecting", (u = this.state) != null && u.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1579
1747
  return;
@@ -1584,30 +1752,30 @@ class Kt {
1584
1752
  }
1585
1753
  if (!o.tbodyNode)
1586
1754
  return;
1587
- const t = o.tbodyNode.getBoundingClientRect(), r = Se(o.domNode, this.pmView);
1755
+ const t = o.tbodyNode.getBoundingClientRect(), r = De(o.domNode, this.pmView);
1588
1756
  if (!r)
1589
1757
  return;
1590
1758
  this.tableElement = r.node;
1591
1759
  let s;
1592
1760
  const i = this.editor.transact(
1593
- (w) => me(r.id, w.doc)
1761
+ (b) => ye(r.id, b.doc)
1594
1762
  );
1595
1763
  if (!i)
1596
1764
  throw new Error(`Block with ID ${r.id} not found`);
1597
- const a = L(
1765
+ const a = z(
1598
1766
  i.node,
1599
1767
  this.editor.pmSchema,
1600
1768
  this.editor.schema.blockSchema,
1601
1769
  this.editor.schema.inlineContentSchema,
1602
1770
  this.editor.schema.styleSchema
1603
1771
  );
1604
- if (Ue(this.editor, "table") && (this.tablePos = i.posBeforeNode + 1, s = a), !s)
1772
+ if (qe(this.editor, "table") && (this.tablePos = i.posBeforeNode + 1, s = a), !s)
1605
1773
  return;
1606
1774
  this.tableId = r.id;
1607
- const c = (g = o.domNode.closest(".tableWrapper")) == null ? void 0 : g.querySelector(".table-widgets-container");
1775
+ const c = (f = o.domNode.closest(".tableWrapper")) == null ? void 0 : f.querySelector(".table-widgets-container");
1608
1776
  if ((o == null ? void 0 : o.type) === "wrapper") {
1609
- const w = e.clientY >= t.bottom - 1 && // -1 to account for fractions of pixels in "bottom"
1610
- e.clientY < t.bottom + 20, y = e.clientX >= t.right - 1 && e.clientX < t.right + 20, v = (
1777
+ const b = e.clientY >= t.bottom - 1 && // -1 to account for fractions of pixels in "bottom"
1778
+ e.clientY < t.bottom + 20, y = e.clientX >= t.right - 1 && e.clientX < t.right + 20, w = (
1611
1779
  // always hide handles when the actively hovered table changed
1612
1780
  ((m = this.state) == null ? void 0 : m.block.id) !== s.id || // make sure we don't hide existing handles (keep col / row index) when
1613
1781
  // we're hovering just above or to the right of a table
@@ -1616,39 +1784,39 @@ class Kt {
1616
1784
  this.state = {
1617
1785
  ...this.state,
1618
1786
  show: !0,
1619
- showAddOrRemoveRowsButton: w,
1787
+ showAddOrRemoveRowsButton: b,
1620
1788
  showAddOrRemoveColumnsButton: y,
1621
1789
  referencePosTable: t,
1622
1790
  block: s,
1623
1791
  widgetContainer: c,
1624
- colIndex: v || (p = this.state) == null ? void 0 : p.colIndex,
1625
- rowIndex: v || (d = this.state) == null ? void 0 : d.rowIndex,
1626
- referencePosCell: v || (f = this.state) == null ? void 0 : f.referencePosCell
1792
+ colIndex: w || (p = this.state) == null ? void 0 : p.colIndex,
1793
+ rowIndex: w || (d = this.state) == null ? void 0 : d.rowIndex,
1794
+ referencePosCell: w || (g = this.state) == null ? void 0 : g.referencePosCell
1627
1795
  };
1628
1796
  } else {
1629
- const w = M(o.domNode), y = M(o.domNode.parentElement), v = o.domNode.getBoundingClientRect();
1630
- if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex === y && this.state.colIndex === w)
1797
+ const b = F(o.domNode), y = F(o.domNode.parentElement), w = o.domNode.getBoundingClientRect();
1798
+ if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex === y && this.state.colIndex === b)
1631
1799
  return;
1632
1800
  this.state = {
1633
1801
  show: !0,
1634
- showAddOrRemoveColumnsButton: w === s.content.rows[0].cells.length - 1,
1802
+ showAddOrRemoveColumnsButton: b === s.content.rows[0].cells.length - 1,
1635
1803
  showAddOrRemoveRowsButton: y === s.content.rows.length - 1,
1636
1804
  referencePosTable: t,
1637
1805
  block: s,
1638
1806
  draggingState: void 0,
1639
- referencePosCell: v,
1640
- colIndex: w,
1807
+ referencePosCell: w,
1808
+ colIndex: b,
1641
1809
  rowIndex: y,
1642
1810
  widgetContainer: c
1643
1811
  };
1644
1812
  }
1645
1813
  return this.emitUpdate(), !1;
1646
1814
  });
1647
- b(this, "dragOverHandler", (e) => {
1648
- var g;
1649
- if (((g = this.state) == null ? void 0 : g.draggingState) === void 0)
1815
+ k(this, "dragOverHandler", (e) => {
1816
+ var f;
1817
+ if (((f = this.state) == null ? void 0 : f.draggingState) === void 0)
1650
1818
  return;
1651
- e.preventDefault(), e.dataTransfer.dropEffect = "move", zt(
1819
+ e.preventDefault(), e.dataTransfer.dropEffect = "move", no(
1652
1820
  ".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",
1653
1821
  this.pmView.root
1654
1822
  );
@@ -1668,12 +1836,12 @@ class Kt {
1668
1836
  return;
1669
1837
  const r = t[0];
1670
1838
  let s = !1;
1671
- 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;
1839
+ const i = F(r.parentElement), a = F(r), c = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, u = (this.state.draggingState.draggedCellOrientation === "row" ? i : a) !== c;
1672
1840
  (this.state.rowIndex !== i || this.state.colIndex !== a) && (this.state.rowIndex = i, this.state.colIndex = a, this.state.referencePosCell = r.getBoundingClientRect(), s = !0);
1673
1841
  const h = this.state.draggingState.draggedCellOrientation === "row" ? o.top : o.left;
1674
- this.state.draggingState.mousePos !== h && (this.state.draggingState.mousePos = h, s = !0), s && this.emitUpdate(), u && this.editor.transact((m) => m.setMeta(O, !0));
1842
+ this.state.draggingState.mousePos !== h && (this.state.draggingState.mousePos = h, s = !0), s && this.emitUpdate(), u && this.editor.transact((m) => m.setMeta(V, !0));
1675
1843
  });
1676
- b(this, "dropHandler", (e) => {
1844
+ k(this, "dropHandler", (e) => {
1677
1845
  if (this.mouseState = "up", this.state === void 0 || this.state.draggingState === void 0)
1678
1846
  return !1;
1679
1847
  if (this.state.rowIndex === void 0 || this.state.colIndex === void 0)
@@ -1683,13 +1851,13 @@ class Kt {
1683
1851
  e.preventDefault();
1684
1852
  const { draggingState: o, colIndex: t, rowIndex: r } = this.state, s = this.state.block.content.columnWidths;
1685
1853
  if (o.draggedCellOrientation === "row") {
1686
- if (!de(
1854
+ if (!ge(
1687
1855
  this.state.block,
1688
1856
  o.originalIndex,
1689
1857
  r
1690
1858
  ))
1691
1859
  return !1;
1692
- const i = Re(
1860
+ const i = _e(
1693
1861
  this.state.block,
1694
1862
  o.originalIndex,
1695
1863
  r
@@ -1702,13 +1870,13 @@ class Kt {
1702
1870
  }
1703
1871
  });
1704
1872
  } else {
1705
- if (!ue(
1873
+ if (!we(
1706
1874
  this.state.block,
1707
1875
  o.originalIndex,
1708
1876
  t
1709
1877
  ))
1710
1878
  return !1;
1711
- const i = Le(
1879
+ const i = ze(
1712
1880
  this.state.block,
1713
1881
  o.originalIndex,
1714
1882
  t
@@ -1747,7 +1915,7 @@ class Kt {
1747
1915
  this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate();
1748
1916
  return;
1749
1917
  }
1750
- const { height: e, width: o } = Ve(
1918
+ const { height: e, width: o } = Ye(
1751
1919
  this.state.block
1752
1920
  );
1753
1921
  this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= e && (this.state.rowIndex = e - 1), this.state.colIndex >= o && (this.state.colIndex = o - 1));
@@ -1772,16 +1940,16 @@ class Kt {
1772
1940
  );
1773
1941
  }
1774
1942
  }
1775
- const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1943
+ const V = new N("TableHandlesPlugin"), Yo = E(({ editor: n }) => {
1776
1944
  let e;
1777
- const o = H(void 0);
1945
+ const o = j(void 0);
1778
1946
  return {
1779
1947
  key: "tableHandles",
1780
1948
  store: o,
1781
1949
  prosemirrorPlugins: [
1782
- new T({
1783
- key: O,
1784
- view: (t) => (e = new Kt(n, t, (r) => {
1950
+ new L({
1951
+ key: V,
1952
+ view: (t) => (e = new ro(n, t, (r) => {
1785
1953
  o.setState(
1786
1954
  r.block ? {
1787
1955
  ...r,
@@ -1799,42 +1967,42 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1799
1967
  if (r === void 0)
1800
1968
  return;
1801
1969
  const s = [], { block: i, draggingState: a } = e.state, { originalIndex: c, draggedCellOrientation: l } = a;
1802
- if (r === c || !i || l === "row" && !de(i, c, r) || l === "col" && !ue(i, c, r))
1803
- return V.create(t.doc, s);
1970
+ if (r === c || !i || l === "row" && !ge(i, c, r) || l === "col" && !we(i, c, r))
1971
+ return Y.create(t.doc, s);
1804
1972
  const u = t.doc.resolve(e.tablePos + 1);
1805
- return e.state.draggingState.draggedCellOrientation === "row" ? G(
1973
+ return e.state.draggingState.draggedCellOrientation === "row" ? te(
1806
1974
  e.state.block,
1807
1975
  r
1808
- ).forEach(({ row: g, col: m }) => {
1976
+ ).forEach(({ row: f, col: m }) => {
1809
1977
  const p = t.doc.resolve(
1810
- u.posAtIndex(g) + 1
1978
+ u.posAtIndex(f) + 1
1811
1979
  ), d = t.doc.resolve(
1812
1980
  p.posAtIndex(m) + 1
1813
- ), f = d.node(), w = d.pos + (r > c ? f.nodeSize - 2 : 0);
1981
+ ), g = d.node(), b = d.pos + (r > c ? g.nodeSize - 2 : 0);
1814
1982
  s.push(
1815
1983
  // The widget is a small bar which spans the width of the cell.
1816
- A.widget(w, () => {
1984
+ H.widget(b, () => {
1817
1985
  const y = document.createElement("div");
1818
1986
  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;
1819
1987
  })
1820
1988
  );
1821
- }) : W(
1989
+ }) : ee(
1822
1990
  e.state.block,
1823
1991
  r
1824
- ).forEach(({ row: g, col: m }) => {
1992
+ ).forEach(({ row: f, col: m }) => {
1825
1993
  const p = t.doc.resolve(
1826
- u.posAtIndex(g) + 1
1994
+ u.posAtIndex(f) + 1
1827
1995
  ), d = t.doc.resolve(
1828
1996
  p.posAtIndex(m) + 1
1829
- ), f = d.node(), w = d.pos + (r > c ? f.nodeSize - 2 : 0);
1997
+ ), g = d.node(), b = d.pos + (r > c ? g.nodeSize - 2 : 0);
1830
1998
  s.push(
1831
1999
  // The widget is a small bar which spans the height of the cell.
1832
- A.widget(w, () => {
2000
+ H.widget(b, () => {
1833
2001
  const y = document.createElement("div");
1834
2002
  return y.className = "bn-table-drop-cursor", y.style.top = "0", y.style.bottom = "0", r > c ? y.style.right = "-2px" : y.style.left = "-3px", y.style.width = "4px", y;
1835
2003
  })
1836
2004
  );
1837
- }), V.create(t.doc, s);
2005
+ }), Y.create(t.doc, s);
1838
2006
  }
1839
2007
  }
1840
2008
  })
@@ -1853,13 +2021,13 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1853
2021
  originalIndex: e.state.colIndex,
1854
2022
  mousePos: t.clientX
1855
2023
  }, e.emitUpdate(), n.transact(
1856
- (r) => r.setMeta(O, {
2024
+ (r) => r.setMeta(V, {
1857
2025
  draggedCellOrientation: e.state.draggingState.draggedCellOrientation,
1858
2026
  originalIndex: e.state.colIndex,
1859
2027
  newIndex: e.state.colIndex,
1860
2028
  tablePos: e.tablePos
1861
2029
  })
1862
- ), !n.headless && (ie(n.prosemirrorView.root), t.dataTransfer.setDragImage(S, 0, 0), t.dataTransfer.effectAllowed = "move");
2030
+ ), !n.headless && (he(n.prosemirrorView.root), t.dataTransfer.setDragImage(B, 0, 0), t.dataTransfer.effectAllowed = "move");
1863
2031
  },
1864
2032
  /**
1865
2033
  * Callback that should be set on the `dragStart` event for whichever element
@@ -1875,13 +2043,13 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1875
2043
  originalIndex: e.state.rowIndex,
1876
2044
  mousePos: t.clientY
1877
2045
  }, e.emitUpdate(), n.transact(
1878
- (r) => r.setMeta(O, {
2046
+ (r) => r.setMeta(V, {
1879
2047
  draggedCellOrientation: e.state.draggingState.draggedCellOrientation,
1880
2048
  originalIndex: e.state.rowIndex,
1881
2049
  newIndex: e.state.rowIndex,
1882
2050
  tablePos: e.tablePos
1883
2051
  })
1884
- ), !n.headless && (ie(n.prosemirrorView.root), t.dataTransfer.setDragImage(S, 0, 0), t.dataTransfer.effectAllowed = "copyMove");
2052
+ ), !n.headless && (he(n.prosemirrorView.root), t.dataTransfer.setDragImage(B, 0, 0), t.dataTransfer.effectAllowed = "copyMove");
1885
2053
  },
1886
2054
  /**
1887
2055
  * Callback that should be set on the `dragEnd` event for both the element
@@ -1892,7 +2060,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1892
2060
  throw new Error(
1893
2061
  "Attempted to drag table row, but no table block was hovered prior."
1894
2062
  );
1895
- e.state.draggingState = void 0, e.emitUpdate(), n.transact((t) => t.setMeta(O, null)), !n.headless && Ut(n.prosemirrorView.root);
2063
+ e.state.draggingState = void 0, e.emitUpdate(), n.transact((t) => t.setMeta(V, null)), !n.headless && to(n.prosemirrorView.root);
1896
2064
  },
1897
2065
  /**
1898
2066
  * Freezes the drag handles. When frozen, they will stay attached to the same
@@ -1909,13 +2077,13 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1909
2077
  e.menuFrozen = !1;
1910
2078
  },
1911
2079
  getCellsAtRowHandle(t, r) {
1912
- return G(t, r);
2080
+ return te(t, r);
1913
2081
  },
1914
2082
  /**
1915
2083
  * Get all the cells in a column of the table block.
1916
2084
  */
1917
2085
  getCellsAtColumnHandle(t, r) {
1918
- return W(t, r);
2086
+ return ee(t, r);
1919
2087
  },
1920
2088
  /**
1921
2089
  * Sets the selection to the given cell or a range of cells.
@@ -1936,7 +2104,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1936
2104
  l.posAtIndex(s.col)
1937
2105
  ), h = t.tr;
1938
2106
  return h.setSelection(
1939
- new yt(c, u)
2107
+ new It(c, u)
1940
2108
  ), t.apply(h);
1941
2109
  },
1942
2110
  /**
@@ -1948,7 +2116,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1948
2116
  s,
1949
2117
  r.orientation === "row" ? { row: t, col: 0 } : { row: 0, col: t }
1950
2118
  );
1951
- return r.orientation === "row" ? r.side === "above" ? pt(a, i) : ft(a, i) : r.side === "left" ? gt(a, i) : wt(a, i);
2119
+ return r.orientation === "row" ? r.side === "above" ? Ct(a, i) : St(a, i) : r.side === "left" ? xt(a, i) : Et(a, i);
1952
2120
  });
1953
2121
  },
1954
2122
  /**
@@ -1960,13 +2128,13 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1960
2128
  row: t,
1961
2129
  col: 0
1962
2130
  });
1963
- return ht(a, i);
2131
+ return kt(a, i);
1964
2132
  }) : n.exec((s, i) => {
1965
2133
  const a = this.setCellSelection(s, {
1966
2134
  row: 0,
1967
2135
  col: t
1968
2136
  });
1969
- return mt(a, i);
2137
+ return vt(a, i);
1970
2138
  });
1971
2139
  },
1972
2140
  /**
@@ -1979,7 +2147,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1979
2147
  t.relativeStartCell,
1980
2148
  t.relativeEndCell
1981
2149
  ) : r;
1982
- return ut(i, s);
2150
+ return yt(i, s);
1983
2151
  });
1984
2152
  },
1985
2153
  /**
@@ -1989,7 +2157,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1989
2157
  splitCell(t) {
1990
2158
  return n.exec((r, s) => {
1991
2159
  const i = t ? this.setCellSelection(r, t) : r;
1992
- return dt(i, s);
2160
+ return bt(i, s);
1993
2161
  });
1994
2162
  },
1995
2163
  /**
@@ -2000,10 +2168,10 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
2000
2168
  return n.transact((t) => {
2001
2169
  const r = t.selection;
2002
2170
  let s = r.$from, i = r.$to;
2003
- if (Q(r)) {
2171
+ if (ne(r)) {
2004
2172
  const { ranges: d } = r;
2005
- d.forEach((f) => {
2006
- s = f.$from.min(s ?? f.$from), i = f.$to.max(i ?? f.$to);
2173
+ d.forEach((g) => {
2174
+ s = g.$from.min(s ?? g.$from), i = g.$to.max(i ?? g.$to);
2007
2175
  });
2008
2176
  } else if (s = t.doc.resolve(
2009
2177
  r.$from.pos - r.$from.parentOffset - 1
@@ -2013,10 +2181,10 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
2013
2181
  return;
2014
2182
  const a = t.doc.resolve(
2015
2183
  s.pos - s.parentOffset - 1
2016
- ), c = t.doc.resolve(i.pos - i.parentOffset - 1), l = t.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 = [];
2184
+ ), c = t.doc.resolve(i.pos - i.parentOffset - 1), l = t.doc.resolve(a.pos - a.parentOffset - 1), u = s.index(a.depth), h = a.index(l.depth), f = i.index(c.depth), m = c.index(l.depth), p = [];
2017
2185
  for (let d = h; d <= m; d++)
2018
- for (let f = u; f <= g; f++)
2019
- p.push({ row: d, col: f });
2186
+ for (let g = u; g <= f; g++)
2187
+ p.push({ row: d, col: g });
2020
2188
  return {
2021
2189
  from: {
2022
2190
  row: h,
@@ -2024,7 +2192,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
2024
2192
  },
2025
2193
  to: {
2026
2194
  row: m,
2027
- col: g
2195
+ col: f
2028
2196
  },
2029
2197
  cells: p
2030
2198
  };
@@ -2037,29 +2205,29 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
2037
2205
  */
2038
2206
  getMergeDirection(t) {
2039
2207
  return n.transact((r) => {
2040
- const s = Q(r.selection) ? r.selection : void 0;
2208
+ const s = ne(r.selection) ? r.selection : void 0;
2041
2209
  if (!s || !t || // Only offer the merge button if there is more than one cell selected.
2042
2210
  s.ranges.length <= 1)
2043
2211
  return;
2044
2212
  const i = this.getCellSelection();
2045
2213
  if (i)
2046
- return $e(i.from, i.to, t) ? "vertical" : "horizontal";
2214
+ return Xe(i.from, i.to, t) ? "vertical" : "horizontal";
2047
2215
  });
2048
2216
  },
2049
2217
  cropEmptyRowsOrColumns(t, r) {
2050
- return Fe(t, r);
2218
+ return Ke(t, r);
2051
2219
  },
2052
2220
  addRowsOrColumns(t, r, s) {
2053
- return He(t, r, s);
2221
+ return je(t, r, s);
2054
2222
  }
2055
2223
  };
2056
- }), ae = new P("trailingNode"), Do = C(() => ({
2224
+ }), me = new N("trailingNode"), jo = E(() => ({
2057
2225
  key: "trailingNode",
2058
2226
  prosemirrorPlugins: [
2059
- new T({
2060
- key: ae,
2227
+ new L({
2228
+ key: me,
2061
2229
  appendTransaction: (n, e, o) => {
2062
- const { doc: t, tr: r, schema: s } = o, i = ae.getState(o), a = t.content.size - 2, c = s.nodes.blockContainer, l = s.nodes.paragraph;
2230
+ const { doc: t, tr: r, schema: s } = o, i = me.getState(o), a = t.content.size - 2, c = s.nodes.blockContainer, l = s.nodes.paragraph;
2063
2231
  if (i)
2064
2232
  return r.insert(
2065
2233
  a,
@@ -2087,32 +2255,34 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
2087
2255
  ]
2088
2256
  }));
2089
2257
  export {
2090
- fo as B,
2091
- yo as D,
2092
- go as F,
2093
- ko as H,
2094
- Co as L,
2095
- xo as N,
2096
- Eo as P,
2097
- wo as S,
2098
- Kt as T,
2099
- vo as V,
2100
- oe as Y,
2101
- F as a,
2102
- $ as b,
2103
- bo as c,
2104
- So as d,
2105
- Io as e,
2106
- Ft as f,
2107
- To as g,
2108
- Po as h,
2109
- Do as i,
2110
- xt as j,
2111
- Ce as k,
2112
- Bo as l,
2113
- xe as m,
2114
- Rt as n,
2115
- $t as s,
2116
- O as t
2258
+ Do as B,
2259
+ Ut as D,
2260
+ Oo as F,
2261
+ Lo as H,
2262
+ No as L,
2263
+ Ho as N,
2264
+ $o as P,
2265
+ Po as S,
2266
+ ro as T,
2267
+ Ro as V,
2268
+ ae as Y,
2269
+ K as a,
2270
+ X as b,
2271
+ Mo as c,
2272
+ Ao as d,
2273
+ Vo as e,
2274
+ Fo as f,
2275
+ Qt as g,
2276
+ _o as h,
2277
+ zo as i,
2278
+ Yo as j,
2279
+ jo as k,
2280
+ Mt as l,
2281
+ Be as m,
2282
+ Uo as n,
2283
+ Oe as o,
2284
+ Wt as p,
2285
+ Zt as s,
2286
+ V as t
2117
2287
  };
2118
- //# sourceMappingURL=TrailingNode-F9hX_UlQ.js.map
2288
+ //# sourceMappingURL=TrailingNode-GzE59m_7.js.map