@blocknote/core 0.47.0 → 0.47.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/BlockNoteExtension-BWw0r8Gy.cjs.map +1 -1
  2. package/dist/BlockNoteExtension-C2X7LW-V.js.map +1 -1
  3. package/dist/{BlockNoteSchema-DT4bdXj5.cjs → BlockNoteSchema-CCs_V3lo.cjs} +2 -2
  4. package/dist/{BlockNoteSchema-DT4bdXj5.cjs.map → BlockNoteSchema-CCs_V3lo.cjs.map} +1 -1
  5. package/dist/{BlockNoteSchema-1r-ln0Q0.js → BlockNoteSchema-ooiKsd5B.js} +2 -2
  6. package/dist/{BlockNoteSchema-1r-ln0Q0.js.map → BlockNoteSchema-ooiKsd5B.js.map} +1 -1
  7. package/dist/{TrailingNode-DZag-Nvu.js → TrailingNode-GzE59m_7.js} +588 -416
  8. package/dist/TrailingNode-GzE59m_7.js.map +1 -0
  9. package/dist/TrailingNode-n0WdMPUl.cjs +2 -0
  10. package/dist/TrailingNode-n0WdMPUl.cjs.map +1 -0
  11. package/dist/blocknote.cjs +4 -4
  12. package/dist/blocknote.cjs.map +1 -1
  13. package/dist/blocknote.js +1206 -955
  14. package/dist/blocknote.js.map +1 -1
  15. package/dist/blocks.cjs +1 -1
  16. package/dist/blocks.js +2 -2
  17. package/dist/comments.cjs.map +1 -1
  18. package/dist/comments.js.map +1 -1
  19. package/dist/defaultBlocks-Dg9kQWXm.cjs +6 -0
  20. package/dist/defaultBlocks-Dg9kQWXm.cjs.map +1 -0
  21. package/dist/{defaultBlocks-BSOEW3GR.js → defaultBlocks-ZzGbYgQn.js} +627 -543
  22. package/dist/defaultBlocks-ZzGbYgQn.js.map +1 -0
  23. package/dist/extensions.cjs +1 -1
  24. package/dist/extensions.cjs.map +1 -1
  25. package/dist/extensions.js +33 -54
  26. package/dist/extensions.js.map +1 -1
  27. package/dist/locales.cjs +1 -1
  28. package/dist/locales.cjs.map +1 -1
  29. package/dist/locales.js +25 -24
  30. package/dist/locales.js.map +1 -1
  31. package/dist/style.css +1 -1
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/dist/webpack-stats.json +1 -1
  34. package/package.json +1 -10
  35. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +33 -7
  36. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +7 -1
  37. package/src/blocks/Heading/block.ts +48 -1
  38. package/src/blocks/ListItem/ToggleListItem/block.ts +51 -1
  39. package/src/blocks/Paragraph/block.ts +1 -1
  40. package/src/blocks/getDetailsContent.ts +77 -0
  41. package/src/comments/threadstore/TipTapThreadStore.ts +5 -5
  42. package/src/comments/threadstore/tiptap/types.ts +131 -0
  43. package/src/editor/Block.css +6 -0
  44. package/src/editor/BlockNoteEditor.ts +9 -14
  45. package/src/editor/managers/ExtensionManager/symbol.ts +0 -1
  46. package/src/editor/managers/SelectionManager.ts +3 -1
  47. package/src/extensions/Collaboration/YCursorPlugin.ts +3 -1
  48. package/src/extensions/DropCursor/DropCursor.ts +262 -25
  49. package/src/extensions/DropCursor/utils.ts +195 -0
  50. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +191 -0
  51. package/src/extensions/SuggestionMenu/SuggestionMenu.ts +28 -11
  52. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +438 -53
  53. package/src/i18n/locales/fa.ts +4 -21
  54. package/src/i18n/locales/index.ts +1 -1
  55. package/src/i18n/locales/ru.ts +1 -1
  56. package/src/i18n/locales/uz.ts +22 -4
  57. package/src/index.ts +1 -0
  58. package/src/schema/blocks/createSpec.ts +35 -45
  59. package/src/schema/blocks/types.ts +101 -1
  60. package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +5 -0
  61. package/types/src/blocks/getDetailsContent.d.ts +19 -0
  62. package/types/src/comments/threadstore/TipTapThreadStore.d.ts +1 -1
  63. package/types/src/comments/threadstore/tiptap/types.d.ts +73 -0
  64. package/types/src/editor/BlockNoteEditor.d.ts +6 -9
  65. package/types/src/extensions/DropCursor/DropCursor.d.ts +42 -5
  66. package/types/src/extensions/DropCursor/utils.d.ts +48 -0
  67. package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +12 -3
  68. package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +1 -0
  69. package/types/src/index.d.ts +1 -0
  70. package/types/src/schema/blocks/createSpec.d.ts +3 -3
  71. package/types/src/schema/blocks/types.d.ts +31 -1
  72. package/dist/TrailingNode-DZag-Nvu.js.map +0 -1
  73. package/dist/TrailingNode-tesI8f7N.cjs +0 -2
  74. package/dist/TrailingNode-tesI8f7N.cjs.map +0 -1
  75. package/dist/defaultBlocks-BSOEW3GR.js.map +0 -1
  76. package/dist/defaultBlocks-D049Pbme.cjs +0 -6
  77. package/dist/defaultBlocks-D049Pbme.cjs.map +0 -1
@@ -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-BSOEW3GR.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(
@@ -409,7 +409,9 @@ const oe = C(
409
409
  }) => {
410
410
  for (const r of t) {
411
411
  const s = e.get(r);
412
- s && (s.element.setAttribute("data-active", ""), s.hideTimeout && clearTimeout(s.hideTimeout), e.set(r, {
412
+ s && (setTimeout(() => {
413
+ s.element.setAttribute("data-active", "");
414
+ }, 10), s.hideTimeout && clearTimeout(s.hideTimeout), e.set(r, {
413
415
  element: s.element,
414
416
  hideTimeout: setTimeout(() => {
415
417
  s.element.removeAttribute("data-active");
@@ -420,12 +422,12 @@ const oe = C(
420
422
  )), {
421
423
  key: "yCursor",
422
424
  prosemirrorPlugins: [
423
- o ? _e(o, {
424
- selectionBuilder: ze,
425
+ o ? Ge(o, {
426
+ selectionBuilder: Je,
425
427
  cursorBuilder(t, r) {
426
428
  let s = e.get(r);
427
429
  if (!s) {
428
- const i = (n.renderCursor ?? Et)(t);
430
+ const i = (n.renderCursor ?? At)(t);
429
431
  n.showCursorLabels !== "always" && (i.addEventListener("mouseenter", () => {
430
432
  const a = e.get(r);
431
433
  a.element.setAttribute("data-active", ""), a.hideTimeout && (clearTimeout(a.hideTimeout), e.set(r, {
@@ -455,20 +457,20 @@ const oe = C(
455
457
  }
456
458
  };
457
459
  }
458
- ), F = C(
460
+ ), K = E(
459
461
  ({ options: n }) => ({
460
462
  key: "ySync",
461
- prosemirrorPlugins: [Ke(n.fragment)],
463
+ prosemirrorPlugins: [Qe(n.fragment)],
462
464
  runsBefore: ["default"]
463
465
  })
464
- ), $ = C(() => ({
466
+ ), X = E(() => ({
465
467
  key: "yUndo",
466
- prosemirrorPlugins: [je()],
468
+ prosemirrorPlugins: [tt()],
467
469
  dependsOn: ["yCursor", "ySync"],
468
- undoCommand: Xe,
469
- redoCommand: Ye
470
+ undoCommand: et,
471
+ redoCommand: Ze
470
472
  }));
471
- function It(n, e) {
473
+ function Lt(n, e) {
472
474
  const o = n.doc;
473
475
  if (n._item === null) {
474
476
  const t = Array.from(o.share.keys()).find(
@@ -478,14 +480,14 @@ function It(n, e) {
478
480
  throw new Error("type does not exist in other ydoc");
479
481
  return e.get(t, n.constructor);
480
482
  } else {
481
- 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);
482
484
  return r[s].content.type;
483
485
  }
484
486
  }
485
- const go = C(
487
+ const Oo = E(
486
488
  ({ editor: n, options: e }) => {
487
489
  let o;
488
- const t = H({ isForked: !1 });
490
+ const t = j({ isForked: !1 });
489
491
  return {
490
492
  key: "yForkDoc",
491
493
  store: t,
@@ -500,26 +502,26 @@ const go = C(
500
502
  const r = e.fragment;
501
503
  if (!r)
502
504
  throw new Error("No fragment to fork from");
503
- const s = new I.Doc();
504
- I.applyUpdate(s, I.encodeStateAsUpdate(r.doc));
505
- 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);
506
508
  o = {
507
- undoStack: Z.getState(n.prosemirrorState).undoManager.undoStack,
509
+ undoStack: re.getState(n.prosemirrorState).undoManager.undoStack,
508
510
  originalFragment: r,
509
511
  forkedFragment: i
510
512
  }, n.unregisterExtension([
511
- $,
512
- oe,
513
- F
513
+ X,
514
+ ae,
515
+ K
514
516
  ]);
515
517
  const a = {
516
518
  ...e,
517
519
  fragment: i
518
520
  };
519
521
  n.registerExtension([
520
- F(a),
522
+ K(a),
521
523
  // No need to register the cursor plugin again, it's a local fork
522
- $()
524
+ X()
523
525
  ]), t.setState({ isForked: !0 });
524
526
  },
525
527
  /**
@@ -533,34 +535,34 @@ const go = C(
533
535
  n.unregisterExtension(["ySync", "yCursor", "yUndo"]);
534
536
  const { originalFragment: s, forkedFragment: i, undoStack: a } = o;
535
537
  if (n.registerExtension([
536
- F(e),
537
- oe(e),
538
- $()
539
- ]), Z.getState(
538
+ K(e),
539
+ ae(e),
540
+ X()
541
+ ]), re.getState(
540
542
  n.prosemirrorState
541
543
  ).undoManager.undoStack = a, r) {
542
- const c = I.encodeStateAsUpdate(
544
+ const c = P.encodeStateAsUpdate(
543
545
  i.doc,
544
- I.encodeStateVector(s.doc)
546
+ P.encodeStateVector(s.doc)
545
547
  );
546
- I.applyUpdate(s.doc, c, n);
548
+ P.applyUpdate(s.doc, c, n);
547
549
  }
548
550
  o = void 0, t.setState({ isForked: !1 });
549
551
  }
550
552
  };
551
553
  }
552
- ), ve = (n, e) => {
554
+ ), Te = (n, e) => {
553
555
  e(n), n.forEach((o) => {
554
- o instanceof I.XmlElement && ve(o, e);
556
+ o instanceof P.XmlElement && Te(o, e);
555
557
  });
556
- }, Bt = (n, e) => {
558
+ }, Nt = (n, e) => {
557
559
  const o = /* @__PURE__ */ new Map();
558
560
  return n.forEach((t) => {
559
- t instanceof I.XmlElement && ve(t, (r) => {
561
+ t instanceof P.XmlElement && Te(t, (r) => {
560
562
  if (r.nodeName === "blockContainer" && r.hasAttribute("id")) {
561
563
  const s = r.getAttribute("textColor"), i = r.getAttribute("backgroundColor"), a = {
562
- textColor: s === J.textColor.default ? void 0 : s,
563
- 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
564
566
  };
565
567
  (a.textColor || a.backgroundColor) && o.set(r.getAttribute("id"), a);
566
568
  }
@@ -578,14 +580,14 @@ const go = C(
578
580
  });
579
581
  }
580
582
  }), !0);
581
- }, Tt = [Bt], wo = C(
583
+ }, Rt = [Nt], Po = E(
582
584
  ({ options: n }) => {
583
585
  let e = !1;
584
- const o = new pe("schemaMigration");
586
+ const o = new ke("schemaMigration");
585
587
  return {
586
588
  key: "schemaMigration",
587
589
  prosemirrorPlugins: [
588
- new fe({
590
+ new ve({
589
591
  key: o,
590
592
  appendTransaction: (t, r, s) => {
591
593
  if (e || // If any of the transactions are not due to a yjs sync, we don't need to run the migration
@@ -594,7 +596,7 @@ const go = C(
594
596
  !n.fragment.firstChild)
595
597
  return;
596
598
  const i = s.tr;
597
- for (const a of Tt)
599
+ for (const a of Rt)
598
600
  a(n.fragment, i);
599
601
  if (e = !0, !!i.docChanged)
600
602
  return i;
@@ -603,24 +605,171 @@ const go = C(
603
605
  ]
604
606
  };
605
607
  }
606
- ), yo = C(
607
- ({
608
- editor: n,
609
- options: e
610
- }) => ({
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 {
611
759
  key: "dropCursor",
612
- prosemirrorPlugins: [
613
- (e.dropCursor ?? We)({
614
- width: 5,
615
- color: "#ddeeff",
616
- editor: n
617
- })
618
- ]
619
- })
620
- ), bo = C(({ editor: n }) => {
621
- 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) => {
622
771
  var s;
623
- 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)
624
773
  return !1;
625
774
  let r = !1;
626
775
  return t.selection.content().content.descendants((i) => (i.type.spec.code && (r = !0), !r)), !r;
@@ -661,12 +810,12 @@ const go = C(
661
810
  });
662
811
  }
663
812
  };
664
- }), ko = C(() => ({
813
+ }), Lo = E(() => ({
665
814
  key: "history",
666
- prosemirrorPlugins: [Qe()],
667
- undoCommand: Je,
668
- redoCommand: Ge
669
- })), Co = C(({ editor: n }) => {
815
+ prosemirrorPlugins: [it()],
816
+ undoCommand: st,
817
+ redoCommand: rt
818
+ })), No = E(({ editor: n }) => {
670
819
  function e(r) {
671
820
  let s = n.prosemirrorView.nodeDOM(r);
672
821
  for (; s && s.parentElement; ) {
@@ -681,7 +830,7 @@ const go = C(
681
830
  const a = i.doc.resolve(r), c = a.marks().find((u) => u.type.name === s);
682
831
  if (!c)
683
832
  return;
684
- const l = Pe(a, c.type);
833
+ const l = Re(a, c.type);
685
834
  if (l)
686
835
  return {
687
836
  range: l,
@@ -690,7 +839,7 @@ const go = C(
690
839
  return i.doc.textBetween(l.from, l.to);
691
840
  },
692
841
  get position() {
693
- return De(
842
+ return Ve(
694
843
  n.prosemirrorView,
695
844
  l.from,
696
845
  l.to
@@ -719,7 +868,7 @@ const go = C(
719
868
  },
720
869
  editLink(r, s, i = n.transact((a) => a.selection.anchor)) {
721
870
  n.transact((a) => {
722
- const c = R(a), { range: l } = o(i + 1, "link") || {
871
+ const c = _(a), { range: l } = o(i + 1, "link") || {
723
872
  range: {
724
873
  from: a.selection.from,
725
874
  to: a.selection.to
@@ -734,7 +883,7 @@ const go = C(
734
883
  },
735
884
  deleteLink(r = n.transact((s) => s.selection.anchor)) {
736
885
  n.transact((s) => {
737
- const i = R(s), { range: a } = o(r + 1, "link") || {
886
+ const i = _(s), { range: a } = o(r + 1, "link") || {
738
887
  range: {
739
888
  from: s.selection.from,
740
889
  to: s.selection.to
@@ -747,7 +896,7 @@ const go = C(
747
896
  }), n.prosemirrorView.focus();
748
897
  }
749
898
  };
750
- }), vo = [
899
+ }), Ro = [
751
900
  "http",
752
901
  "https",
753
902
  "ftp",
@@ -758,12 +907,12 @@ const go = C(
758
907
  "sms",
759
908
  "cid",
760
909
  "xmpp"
761
- ], So = "https", Pt = new P("node-selection-keyboard"), xo = C(
910
+ ], Vo = "https", _t = new N("node-selection-keyboard"), Ho = E(
762
911
  () => ({
763
912
  key: "nodeSelectionKeyboard",
764
913
  prosemirrorPlugins: [
765
- new T({
766
- key: Pt,
914
+ new L({
915
+ key: _t,
767
916
  props: {
768
917
  handleKeyDown: (n, e) => {
769
918
  if ("node" in n.state.selection) {
@@ -778,7 +927,7 @@ const go = C(
778
927
  n.state.tr.selection.$to.after(),
779
928
  n.state.schema.nodes.paragraph.createChecked()
780
929
  ).setSelection(
781
- new ce(
930
+ new fe(
782
931
  o.doc.resolve(
783
932
  n.state.tr.selection.$to.after() + 1
784
933
  )
@@ -793,7 +942,7 @@ const go = C(
793
942
  })
794
943
  ]
795
944
  })
796
- ), Dt = new P("blocknote-placeholder"), Eo = C(
945
+ ), zt = new N("blocknote-placeholder"), $o = E(
797
946
  ({
798
947
  editor: n,
799
948
  options: e
@@ -802,10 +951,10 @@ const go = C(
802
951
  return {
803
952
  key: "placeholder",
804
953
  prosemirrorPlugins: [
805
- new T({
806
- key: Dt,
954
+ new L({
955
+ key: zt,
807
956
  view: (t) => {
808
- const r = `placeholder-selector-${Ze()}`;
957
+ const r = `placeholder-selector-${at()}`;
809
958
  t.dom.classList.add(r);
810
959
  const s = document.createElement("style"), i = n._tiptapEditor.options.injectNonce;
811
960
  i && s.setAttribute("nonce", i), t.root instanceof window.ShadowRoot ? t.root.append(s) : t.root.head.appendChild(s);
@@ -817,16 +966,16 @@ const go = C(
817
966
  ...h
818
967
  } = o || {};
819
968
  for (const [p, d] of Object.entries(h)) {
820
- const f = `[data-content-type="${p}"]`;
969
+ const g = `[data-content-type="${p}"]`;
821
970
  a.insertRule(
822
- `${c(f)} { content: ${JSON.stringify(
971
+ `${c(g)} { content: ${JSON.stringify(
823
972
  d
824
973
  )}; }`
825
974
  );
826
975
  }
827
- 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]";
828
977
  a.insertRule(
829
- `${c(g)} { content: ${JSON.stringify(
978
+ `${c(f)} { content: ${JSON.stringify(
830
979
  u
831
980
  )}; }`
832
981
  ), a.insertRule(
@@ -853,7 +1002,7 @@ const go = C(
853
1002
  return;
854
1003
  const i = [];
855
1004
  t.doc.content.size === 6 && i.push(
856
- A.node(2, 4, {
1005
+ H.node(2, 4, {
857
1006
  "data-is-only-empty-block": "true"
858
1007
  })
859
1008
  );
@@ -861,19 +1010,19 @@ const go = C(
861
1010
  if (c.content.size === 0) {
862
1011
  const l = a.before();
863
1012
  i.push(
864
- A.node(l, l + c.nodeSize, {
1013
+ H.node(l, l + c.nodeSize, {
865
1014
  "data-is-empty-and-focused": "true"
866
1015
  })
867
1016
  );
868
1017
  }
869
- return V.create(r, i);
1018
+ return Y.create(r, i);
870
1019
  }
871
1020
  }
872
1021
  })
873
1022
  ]
874
1023
  };
875
1024
  }
876
- ), ne = new P("previous-blocks"), Ot = {
1025
+ ), ce = new N("previous-blocks"), Yt = {
877
1026
  // Numbered List Items
878
1027
  index: "index",
879
1028
  // Headings
@@ -882,20 +1031,20 @@ const go = C(
882
1031
  type: "type",
883
1032
  depth: "depth",
884
1033
  "depth-change": "depth-change"
885
- }, Io = C(() => {
1034
+ }, Fo = E(() => {
886
1035
  let n;
887
1036
  return {
888
1037
  key: "previousBlockType",
889
1038
  prosemirrorPlugins: [
890
- new T({
891
- key: ne,
1039
+ new L({
1040
+ key: ce,
892
1041
  view(e) {
893
1042
  return {
894
1043
  update: async (o, t) => {
895
1044
  var r;
896
1045
  ((r = this.key) == null ? void 0 : r.getState(o.state).updatedBlocks.size) > 0 && (n = setTimeout(() => {
897
1046
  o.dispatch(
898
- o.state.tr.setMeta(ne, { clearUpdate: !0 })
1047
+ o.state.tr.setMeta(ce, { clearUpdate: !0 })
899
1048
  );
900
1049
  }, 0));
901
1050
  },
@@ -918,22 +1067,22 @@ const go = C(
918
1067
  apply(e, o, t, r) {
919
1068
  if (o.currentTransactionOldBlockAttrs = {}, o.updatedBlocks.clear(), !e.docChanged || t.doc.eq(r.doc))
920
1069
  return o;
921
- const s = {}, i = j(
1070
+ const s = {}, i = Q(
922
1071
  t.doc,
923
1072
  (l) => l.attrs.id
924
1073
  ), a = new Map(
925
1074
  i.map((l) => [l.node.attrs.id, l])
926
- ), c = j(
1075
+ ), c = Q(
927
1076
  r.doc,
928
1077
  (l) => l.attrs.id
929
1078
  );
930
1079
  for (const l of c) {
931
- const u = a.get(l.node.attrs.id), h = u == null ? void 0 : u.node.firstChild, g = l.node.firstChild;
932
- 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) {
933
1082
  const m = {
934
- index: g.attrs.index,
935
- level: g.attrs.level,
936
- type: g.type.name,
1083
+ index: f.attrs.index,
1084
+ level: f.attrs.level,
1085
+ type: f.type.name,
937
1086
  depth: r.doc.resolve(l.pos).depth
938
1087
  }, p = {
939
1088
  index: h.attrs.index,
@@ -958,26 +1107,26 @@ const go = C(
958
1107
  return;
959
1108
  const i = o.currentTransactionOldBlockAttrs[r.attrs.id], a = {};
960
1109
  for (const [l, u] of Object.entries(i))
961
- a["data-prev-" + Ot[l]] = u || "none";
962
- 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, {
963
1112
  ...a
964
1113
  });
965
1114
  t.push(c);
966
- }), V.create(e.doc, t);
1115
+ }), Y.create(e.doc, t);
967
1116
  }
968
1117
  }
969
1118
  })
970
1119
  ]
971
1120
  };
972
1121
  });
973
- function Se(n, e) {
1122
+ function De(n, e) {
974
1123
  var o, t;
975
1124
  for (; n && n.parentElement && n.parentElement !== e.dom && ((o = n.getAttribute) == null ? void 0 : o.call(n, "data-node-type")) !== "blockContainer"; )
976
1125
  n = n.parentElement;
977
1126
  if (((t = n.getAttribute) == null ? void 0 : t.call(n, "data-node-type")) === "blockContainer")
978
1127
  return { node: n, id: n.getAttribute("data-id") };
979
1128
  }
980
- function At() {
1129
+ function jt() {
981
1130
  const n = (e) => {
982
1131
  let o = e.children.length;
983
1132
  for (let t = 0; t < o; t++) {
@@ -993,7 +1142,7 @@ function At() {
993
1142
  };
994
1143
  return n;
995
1144
  }
996
- function Mt() {
1145
+ function Kt() {
997
1146
  const n = (e) => {
998
1147
  var o;
999
1148
  if (e.children && "length" in e.children && e.children.length)
@@ -1002,15 +1151,15 @@ function Mt() {
1002
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(
1003
1152
  0,
1004
1153
  0,
1005
- lt(document.createTextNode(" "))
1154
+ gt(document.createTextNode(" "))
1006
1155
  )) : n(r);
1007
1156
  }
1008
1157
  };
1009
1158
  return n;
1010
1159
  }
1011
- function Nt() {
1160
+ function Xt() {
1012
1161
  return (n) => {
1013
- ct(n, "element", (e, o, t) => {
1162
+ wt(n, "element", (e, o, t) => {
1014
1163
  var r, s, i, a;
1015
1164
  if (t && e.tagName === "video") {
1016
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"]) || "";
@@ -1022,29 +1171,29 @@ function Nt() {
1022
1171
  });
1023
1172
  };
1024
1173
  }
1025
- function xe(n) {
1026
- 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, {
1027
1176
  handlers: { text: (o) => o.value }
1028
1177
  }).processSync(n).value;
1029
1178
  }
1030
- function Bo(n, e, o, t) {
1031
- const s = Ce(e, o).exportBlocks(n, t);
1032
- return xe(s);
1179
+ function Uo(n, e, o, t) {
1180
+ const s = Be(e, o).exportBlocks(n, t);
1181
+ return Oe(s);
1033
1182
  }
1034
- function Rt(n) {
1183
+ function Wt(n) {
1035
1184
  const e = [];
1036
1185
  return n.descendants((o) => {
1037
1186
  var r, s;
1038
- const t = R(o);
1187
+ const t = _(o);
1039
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) => {
1040
- e.push(L(i, t));
1041
- }), !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;
1042
1191
  }), e;
1043
1192
  }
1044
- class B extends N {
1193
+ class A extends U {
1045
1194
  constructor(o, t) {
1046
1195
  super(o, t);
1047
- b(this, "nodes");
1196
+ k(this, "nodes");
1048
1197
  const r = o.node();
1049
1198
  this.nodes = [], o.doc.nodesBetween(o.pos, t.pos, (s, i, a) => {
1050
1199
  if (a !== null && a.eq(r))
@@ -1052,13 +1201,13 @@ class B extends N {
1052
1201
  });
1053
1202
  }
1054
1203
  static create(o, t, r = t) {
1055
- return new B(o.resolve(t), o.resolve(r));
1204
+ return new A(o.resolve(t), o.resolve(r));
1056
1205
  }
1057
1206
  content() {
1058
- return new ot(we.from(this.nodes), 0, 0);
1207
+ return new dt(Se.from(this.nodes), 0, 0);
1059
1208
  }
1060
1209
  eq(o) {
1061
- 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)
1062
1211
  return !1;
1063
1212
  for (let t = 0; t < this.nodes.length; t++)
1064
1213
  if (!this.nodes[t].eq(o.nodes[t]))
@@ -1067,7 +1216,7 @@ class B extends N {
1067
1216
  }
1068
1217
  map(o, t) {
1069
1218
  const r = t.mapResult(this.from), s = t.mapResult(this.to);
1070
- 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(
1071
1220
  o.resolve(r.pos),
1072
1221
  o.resolve(s.pos)
1073
1222
  );
@@ -1076,9 +1225,9 @@ class B extends N {
1076
1225
  return { type: "multiple-node", anchor: this.anchor, head: this.head };
1077
1226
  }
1078
1227
  }
1079
- N.jsonID("multiple-node", B);
1080
- let E;
1081
- function Lt(n, e) {
1228
+ U.jsonID("multiple-node", A);
1229
+ let D;
1230
+ function qt(n, e) {
1082
1231
  let o, t;
1083
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);
1084
1233
  if (r && s) {
@@ -1088,9 +1237,9 @@ function Lt(n, e) {
1088
1237
  o = n.from, t = n.to;
1089
1238
  return { from: o, to: t };
1090
1239
  }
1091
- function re(n, e, o = e) {
1240
+ function de(n, e, o = e) {
1092
1241
  e === o && (o += n.state.doc.resolve(e + 1).node().nodeSize);
1093
- 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(
1094
1243
  r,
1095
1244
  // Expects from position to be just before the first selected block.
1096
1245
  n.domAtPos(e + 1).node.parentElement
@@ -1101,44 +1250,44 @@ function re(n, e, o = e) {
1101
1250
  );
1102
1251
  for (let h = r.childElementCount - 1; h >= 0; h--)
1103
1252
  (h > a || h < i) && t.removeChild(t.children[h]);
1104
- Ee(n.root), E = t;
1105
- const c = E.getElementsByTagName("iframe");
1253
+ Pe(n.root), D = t;
1254
+ const c = D.getElementsByTagName("iframe");
1106
1255
  for (let h = 0; h < c.length; h++) {
1107
- const g = c[h], m = g.parentElement;
1108
- m && m.removeChild(g);
1256
+ const f = c[h], m = f.parentElement;
1257
+ m && m.removeChild(f);
1109
1258
  }
1110
1259
  const u = n.dom.className.split(" ").filter(
1111
1260
  (h) => h !== "ProseMirror" && h !== "bn-root" && h !== "bn-editor"
1112
1261
  ).join(" ");
1113
- 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);
1114
1263
  }
1115
- function Ee(n) {
1116
- 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);
1117
1266
  }
1118
- function Vt(n, e, o) {
1267
+ function Gt(n, e, o) {
1119
1268
  if (!n.dataTransfer || o.headless)
1120
1269
  return;
1121
- const t = o.prosemirrorView, r = me(e.id, t.state.doc);
1270
+ const t = o.prosemirrorView, r = ye(e.id, t.state.doc);
1122
1271
  if (!r)
1123
1272
  throw new Error(`Block with ID ${e.id} not found`);
1124
1273
  const s = r.posBeforeNode;
1125
1274
  if (s != null) {
1126
- 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;
1127
1276
  u && h ? (t.dispatch(
1128
- t.state.tr.setSelection(B.create(a, c, l))
1129
- ), re(t, c, l)) : (t.dispatch(
1130
- t.state.tr.setSelection(le.create(t.state.doc, s))
1131
- ), re(t, s));
1132
- 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);
1133
- 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);
1134
1283
  }
1135
1284
  }
1136
- const se = 250;
1137
- function U(n, e, o = !0) {
1285
+ const ue = 250;
1286
+ function W(n, e, o = !0) {
1138
1287
  const t = n.root.elementsFromPoint(e.left, e.top);
1139
1288
  for (const r of t)
1140
1289
  if (n.dom.contains(r))
1141
- return o && r.closest("[data-node-type=columnList]") ? U(
1290
+ return o && r.closest("[data-node-type=columnList]") ? W(
1142
1291
  n,
1143
1292
  {
1144
1293
  // TODO can we do better than this?
@@ -1147,9 +1296,9 @@ function U(n, e, o = !0) {
1147
1296
  top: e.top
1148
1297
  },
1149
1298
  !1
1150
- ) : Se(r, n);
1299
+ ) : De(r, n);
1151
1300
  }
1152
- function Ht(n, e) {
1301
+ function Jt(n, e) {
1153
1302
  if (!e.dom.firstChild)
1154
1303
  return;
1155
1304
  const o = e.dom.firstChild.getBoundingClientRect(), t = {
@@ -1159,11 +1308,11 @@ function Ht(n, e) {
1159
1308
  o.right - 10
1160
1309
  ),
1161
1310
  top: n.y
1162
- }, r = U(e, t);
1311
+ }, r = W(e, t);
1163
1312
  if (!r)
1164
1313
  return;
1165
1314
  const s = r.node.getBoundingClientRect();
1166
- return U(
1315
+ return W(
1167
1316
  e,
1168
1317
  {
1169
1318
  left: s.right - 10,
@@ -1172,18 +1321,18 @@ function Ht(n, e) {
1172
1321
  !1
1173
1322
  );
1174
1323
  }
1175
- class Ft {
1324
+ class Qt {
1176
1325
  constructor(e, o, t) {
1177
- b(this, "state");
1178
- b(this, "emitUpdate");
1179
- b(this, "mousePos");
1180
- b(this, "hoveredBlock");
1181
- b(this, "menuFrozen", !1);
1182
- b(this, "isDragOrigin", !1);
1183
- 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) => {
1184
1333
  this.state = e, this.emitUpdate(this.state);
1185
1334
  });
1186
- b(this, "updateStateFromMousePos", () => {
1335
+ k(this, "updateStateFromMousePos", () => {
1187
1336
  var t, r, s, i, a;
1188
1337
  if (this.menuFrozen || !this.mousePos)
1189
1338
  return;
@@ -1191,11 +1340,11 @@ class Ft {
1191
1340
  clientX: this.mousePos.x,
1192
1341
  clientY: this.mousePos.y
1193
1342
  });
1194
- 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) {
1195
1344
  (t = this.state) != null && t.show && (this.state.show = !1, this.updateState(this.state));
1196
1345
  return;
1197
1346
  }
1198
- const o = Ht(this.mousePos, this.pmView);
1347
+ const o = Jt(this.mousePos, this.pmView);
1199
1348
  if (!o || !this.editor.isEditable) {
1200
1349
  (r = this.state) != null && r.show && (this.state.show = !1, this.updateState(this.state));
1201
1350
  return;
@@ -1240,25 +1389,25 @@ class Ft {
1240
1389
  * could then drag between editors in different windows, but you can only
1241
1390
  * access `dataTransfer` contents on `dragstart` and `drop` events.
1242
1391
  */
1243
- b(this, "onDragStart", (e) => {
1392
+ k(this, "onDragStart", (e) => {
1244
1393
  var i;
1245
1394
  const o = (i = e.dataTransfer) == null ? void 0 : i.getData("blocknote/html");
1246
1395
  if (!o || this.pmView.dragging)
1247
1396
  return;
1248
1397
  const t = document.createElement("div");
1249
1398
  t.innerHTML = o;
1250
- const s = et.fromSchema(this.pmView.state.schema).parse(t, {
1399
+ const s = lt.fromSchema(this.pmView.state.schema).parse(t, {
1251
1400
  topNode: this.pmView.state.schema.nodes.blockGroup.create()
1252
1401
  });
1253
1402
  this.pmView.dragging = {
1254
- slice: new tt(s.content, 0, 0),
1403
+ slice: new ct(s.content, 0, 0),
1255
1404
  move: !0
1256
1405
  };
1257
1406
  });
1258
1407
  /**
1259
1408
  * Finds the closest editor visually to the given coordinates
1260
1409
  */
1261
- b(this, "findClosestEditorElement", (e) => {
1410
+ k(this, "findClosestEditorElement", (e) => {
1262
1411
  const o = Array.from(this.pmView.root.querySelectorAll(".bn-editor"));
1263
1412
  if (o.length === 0)
1264
1413
  return null;
@@ -1286,7 +1435,7 @@ class Ft {
1286
1435
  *
1287
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
1288
1437
  */
1289
- b(this, "onDragOver", (e) => {
1438
+ k(this, "onDragOver", (e) => {
1290
1439
  var r;
1291
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)))
1292
1441
  return;
@@ -1300,7 +1449,7 @@ class Ft {
1300
1449
  /**
1301
1450
  * Closes the drop-cursor for the current editor
1302
1451
  */
1303
- b(this, "closeDropCursor", () => {
1452
+ k(this, "closeDropCursor", () => {
1304
1453
  const e = new Event("dragleave", { bubbles: !1 });
1305
1454
  e.synthetic = !0, this.pmView.dom.dispatchEvent(e);
1306
1455
  });
@@ -1312,12 +1461,12 @@ class Ft {
1312
1461
  * - Whether the current editor instance is the drag origin
1313
1462
  * - Whether the drop event is within the bounds of the current editor instance
1314
1463
  */
1315
- b(this, "getDragEventContext", (e) => {
1464
+ k(this, "getDragEventContext", (e) => {
1316
1465
  var l, u;
1317
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)))
1318
1467
  return;
1319
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);
1320
- if (!i || i.distance > se)
1469
+ if (!i || i.distance > ue)
1321
1470
  return;
1322
1471
  const a = i.element === this.pmView.dom, c = a && i.distance === 0;
1323
1472
  if (!(!a && !s))
@@ -1340,7 +1489,7 @@ class Ft {
1340
1489
  * - If we are the drag origin but not the drop point:
1341
1490
  * - Delete the dragged content from our editor after a delay
1342
1491
  */
1343
- b(this, "onDrop", (e) => {
1492
+ k(this, "onDrop", (e) => {
1344
1493
  var a;
1345
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)))
1346
1495
  return;
@@ -1355,7 +1504,7 @@ class Ft {
1355
1504
  return;
1356
1505
  this.pmView.dispatch(
1357
1506
  this.pmView.state.tr.setSelection(
1358
- qe.create(
1507
+ ot.create(
1359
1508
  this.pmView.state.tr.doc,
1360
1509
  this.pmView.state.tr.selection.anchor
1361
1510
  )
@@ -1370,14 +1519,14 @@ class Ft {
1370
1519
  return;
1371
1520
  }
1372
1521
  });
1373
- b(this, "onDragEnd", (e) => {
1522
+ k(this, "onDragEnd", (e) => {
1374
1523
  e.synthetic || (this.pmView.dragging = null);
1375
1524
  });
1376
- b(this, "onKeyDown", (e) => {
1525
+ k(this, "onKeyDown", (e) => {
1377
1526
  var o;
1378
1527
  (o = this.state) != null && o.show && this.editor.isFocused() && (this.state.show = !1, this.emitUpdate(this.state));
1379
1528
  });
1380
- b(this, "onMouseMove", (e) => {
1529
+ k(this, "onMouseMove", (e) => {
1381
1530
  var s;
1382
1531
  if (this.menuFrozen)
1383
1532
  return;
@@ -1470,18 +1619,18 @@ class Ft {
1470
1619
  );
1471
1620
  }
1472
1621
  }
1473
- const $t = new pe("SideMenuPlugin"), To = C(({ editor: n }) => {
1622
+ const Zt = new ke("SideMenuPlugin"), _o = E(({ editor: n }) => {
1474
1623
  let e;
1475
- const o = H(
1624
+ const o = j(
1476
1625
  void 0
1477
1626
  );
1478
1627
  return {
1479
1628
  key: "sideMenu",
1480
1629
  store: o,
1481
1630
  prosemirrorPlugins: [
1482
- new fe({
1483
- key: $t,
1484
- view: (t) => (e = new Ft(n, t, (r) => {
1631
+ new ve({
1632
+ key: Zt,
1633
+ view: (t) => (e = new Qt(n, t, (r) => {
1485
1634
  o.setState({ ...r });
1486
1635
  }), e)
1487
1636
  })
@@ -1490,13 +1639,13 @@ const $t = new pe("SideMenuPlugin"), To = C(({ editor: n }) => {
1490
1639
  * Handles drag & drop events for blocks.
1491
1640
  */
1492
1641
  blockDragStart(t, r) {
1493
- e && (e.isDragOrigin = !0), Vt(t, r, n);
1642
+ e && (e.isDragOrigin = !0), Gt(t, r, n);
1494
1643
  },
1495
1644
  /**
1496
1645
  * Handles drag & drop events for blocks.
1497
1646
  */
1498
1647
  blockDragEnd() {
1499
- Ee(n.prosemirrorView.root), e && (e.isDragOrigin = !1), n.blur();
1648
+ Pe(n.prosemirrorView.root), e && (e.isDragOrigin = !1), n.blur();
1500
1649
  },
1501
1650
  /**
1502
1651
  * Freezes the side menu. When frozen, the side menu will stay
@@ -1516,17 +1665,38 @@ const $t = new pe("SideMenuPlugin"), To = C(({ editor: n }) => {
1516
1665
  }
1517
1666
  };
1518
1667
  });
1519
- let S;
1520
- function ie(n) {
1521
- 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));
1522
1692
  }
1523
- function Ut(n) {
1524
- 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);
1525
1695
  }
1526
- function M(n) {
1696
+ function F(n) {
1527
1697
  return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
1528
1698
  }
1529
- function _t(n) {
1699
+ function oo(n) {
1530
1700
  let e = n;
1531
1701
  for (; e && e.nodeName !== "TD" && e.nodeName !== "TH" && !e.classList.contains("tableWrapper"); ) {
1532
1702
  if (e.classList.contains("ProseMirror"))
@@ -1546,32 +1716,32 @@ function _t(n) {
1546
1716
  tbodyNode: e.querySelector("tbody")
1547
1717
  };
1548
1718
  }
1549
- function zt(n, e) {
1719
+ function no(n, e) {
1550
1720
  const o = e.querySelectorAll(n);
1551
1721
  for (let t = 0; t < o.length; t++)
1552
1722
  o[t].style.visibility = "hidden";
1553
1723
  }
1554
- class Kt {
1724
+ class ro {
1555
1725
  constructor(e, o, t) {
1556
- b(this, "state");
1557
- b(this, "emitUpdate");
1558
- b(this, "tableId");
1559
- b(this, "tablePos");
1560
- b(this, "tableElement");
1561
- b(this, "menuFrozen", !1);
1562
- b(this, "mouseState", "up");
1563
- b(this, "prevWasEditable", null);
1564
- 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", () => {
1565
1735
  this.mouseState = "down";
1566
1736
  });
1567
- b(this, "mouseUpHandler", (e) => {
1737
+ k(this, "mouseUpHandler", (e) => {
1568
1738
  this.mouseState = "up", this.mouseMoveHandler(e);
1569
1739
  });
1570
- b(this, "mouseMoveHandler", (e) => {
1571
- var l, u, h, g, m, p, d, f;
1740
+ k(this, "mouseMoveHandler", (e) => {
1741
+ var l, u, h, f, m, p, d, g;
1572
1742
  if (this.menuFrozen || this.mouseState === "selecting" || !(e.target instanceof Element) || !this.pmView.dom.contains(e.target))
1573
1743
  return;
1574
- const o = _t(e.target);
1744
+ const o = oo(e.target);
1575
1745
  if ((o == null ? void 0 : o.type) === "cell" && this.mouseState === "down" && !((l = this.state) != null && l.draggingState)) {
1576
1746
  this.mouseState = "selecting", (u = this.state) != null && u.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1577
1747
  return;
@@ -1582,30 +1752,30 @@ class Kt {
1582
1752
  }
1583
1753
  if (!o.tbodyNode)
1584
1754
  return;
1585
- const t = o.tbodyNode.getBoundingClientRect(), r = Se(o.domNode, this.pmView);
1755
+ const t = o.tbodyNode.getBoundingClientRect(), r = De(o.domNode, this.pmView);
1586
1756
  if (!r)
1587
1757
  return;
1588
1758
  this.tableElement = r.node;
1589
1759
  let s;
1590
1760
  const i = this.editor.transact(
1591
- (w) => me(r.id, w.doc)
1761
+ (b) => ye(r.id, b.doc)
1592
1762
  );
1593
1763
  if (!i)
1594
1764
  throw new Error(`Block with ID ${r.id} not found`);
1595
- const a = L(
1765
+ const a = z(
1596
1766
  i.node,
1597
1767
  this.editor.pmSchema,
1598
1768
  this.editor.schema.blockSchema,
1599
1769
  this.editor.schema.inlineContentSchema,
1600
1770
  this.editor.schema.styleSchema
1601
1771
  );
1602
- 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)
1603
1773
  return;
1604
1774
  this.tableId = r.id;
1605
- 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");
1606
1776
  if ((o == null ? void 0 : o.type) === "wrapper") {
1607
- const w = e.clientY >= t.bottom - 1 && // -1 to account for fractions of pixels in "bottom"
1608
- 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 = (
1609
1779
  // always hide handles when the actively hovered table changed
1610
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
1611
1781
  // we're hovering just above or to the right of a table
@@ -1614,39 +1784,39 @@ class Kt {
1614
1784
  this.state = {
1615
1785
  ...this.state,
1616
1786
  show: !0,
1617
- showAddOrRemoveRowsButton: w,
1787
+ showAddOrRemoveRowsButton: b,
1618
1788
  showAddOrRemoveColumnsButton: y,
1619
1789
  referencePosTable: t,
1620
1790
  block: s,
1621
1791
  widgetContainer: c,
1622
- colIndex: v || (p = this.state) == null ? void 0 : p.colIndex,
1623
- rowIndex: v || (d = this.state) == null ? void 0 : d.rowIndex,
1624
- 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
1625
1795
  };
1626
1796
  } else {
1627
- const w = M(o.domNode), y = M(o.domNode.parentElement), v = o.domNode.getBoundingClientRect();
1628
- 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)
1629
1799
  return;
1630
1800
  this.state = {
1631
1801
  show: !0,
1632
- showAddOrRemoveColumnsButton: w === s.content.rows[0].cells.length - 1,
1802
+ showAddOrRemoveColumnsButton: b === s.content.rows[0].cells.length - 1,
1633
1803
  showAddOrRemoveRowsButton: y === s.content.rows.length - 1,
1634
1804
  referencePosTable: t,
1635
1805
  block: s,
1636
1806
  draggingState: void 0,
1637
- referencePosCell: v,
1638
- colIndex: w,
1807
+ referencePosCell: w,
1808
+ colIndex: b,
1639
1809
  rowIndex: y,
1640
1810
  widgetContainer: c
1641
1811
  };
1642
1812
  }
1643
1813
  return this.emitUpdate(), !1;
1644
1814
  });
1645
- b(this, "dragOverHandler", (e) => {
1646
- var g;
1647
- 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)
1648
1818
  return;
1649
- e.preventDefault(), e.dataTransfer.dropEffect = "move", zt(
1819
+ e.preventDefault(), e.dataTransfer.dropEffect = "move", no(
1650
1820
  ".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",
1651
1821
  this.pmView.root
1652
1822
  );
@@ -1666,12 +1836,12 @@ class Kt {
1666
1836
  return;
1667
1837
  const r = t[0];
1668
1838
  let s = !1;
1669
- 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;
1670
1840
  (this.state.rowIndex !== i || this.state.colIndex !== a) && (this.state.rowIndex = i, this.state.colIndex = a, this.state.referencePosCell = r.getBoundingClientRect(), s = !0);
1671
1841
  const h = this.state.draggingState.draggedCellOrientation === "row" ? o.top : o.left;
1672
- 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));
1673
1843
  });
1674
- b(this, "dropHandler", (e) => {
1844
+ k(this, "dropHandler", (e) => {
1675
1845
  if (this.mouseState = "up", this.state === void 0 || this.state.draggingState === void 0)
1676
1846
  return !1;
1677
1847
  if (this.state.rowIndex === void 0 || this.state.colIndex === void 0)
@@ -1681,13 +1851,13 @@ class Kt {
1681
1851
  e.preventDefault();
1682
1852
  const { draggingState: o, colIndex: t, rowIndex: r } = this.state, s = this.state.block.content.columnWidths;
1683
1853
  if (o.draggedCellOrientation === "row") {
1684
- if (!de(
1854
+ if (!ge(
1685
1855
  this.state.block,
1686
1856
  o.originalIndex,
1687
1857
  r
1688
1858
  ))
1689
1859
  return !1;
1690
- const i = Re(
1860
+ const i = _e(
1691
1861
  this.state.block,
1692
1862
  o.originalIndex,
1693
1863
  r
@@ -1700,13 +1870,13 @@ class Kt {
1700
1870
  }
1701
1871
  });
1702
1872
  } else {
1703
- if (!ue(
1873
+ if (!we(
1704
1874
  this.state.block,
1705
1875
  o.originalIndex,
1706
1876
  t
1707
1877
  ))
1708
1878
  return !1;
1709
- const i = Le(
1879
+ const i = ze(
1710
1880
  this.state.block,
1711
1881
  o.originalIndex,
1712
1882
  t
@@ -1745,7 +1915,7 @@ class Kt {
1745
1915
  this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate();
1746
1916
  return;
1747
1917
  }
1748
- const { height: e, width: o } = Ve(
1918
+ const { height: e, width: o } = Ye(
1749
1919
  this.state.block
1750
1920
  );
1751
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));
@@ -1770,16 +1940,16 @@ class Kt {
1770
1940
  );
1771
1941
  }
1772
1942
  }
1773
- const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1943
+ const V = new N("TableHandlesPlugin"), Yo = E(({ editor: n }) => {
1774
1944
  let e;
1775
- const o = H(void 0);
1945
+ const o = j(void 0);
1776
1946
  return {
1777
1947
  key: "tableHandles",
1778
1948
  store: o,
1779
1949
  prosemirrorPlugins: [
1780
- new T({
1781
- key: O,
1782
- view: (t) => (e = new Kt(n, t, (r) => {
1950
+ new L({
1951
+ key: V,
1952
+ view: (t) => (e = new ro(n, t, (r) => {
1783
1953
  o.setState(
1784
1954
  r.block ? {
1785
1955
  ...r,
@@ -1797,42 +1967,42 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1797
1967
  if (r === void 0)
1798
1968
  return;
1799
1969
  const s = [], { block: i, draggingState: a } = e.state, { originalIndex: c, draggedCellOrientation: l } = a;
1800
- if (r === c || !i || l === "row" && !de(i, c, r) || l === "col" && !ue(i, c, r))
1801
- 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);
1802
1972
  const u = t.doc.resolve(e.tablePos + 1);
1803
- return e.state.draggingState.draggedCellOrientation === "row" ? G(
1973
+ return e.state.draggingState.draggedCellOrientation === "row" ? te(
1804
1974
  e.state.block,
1805
1975
  r
1806
- ).forEach(({ row: g, col: m }) => {
1976
+ ).forEach(({ row: f, col: m }) => {
1807
1977
  const p = t.doc.resolve(
1808
- u.posAtIndex(g) + 1
1978
+ u.posAtIndex(f) + 1
1809
1979
  ), d = t.doc.resolve(
1810
1980
  p.posAtIndex(m) + 1
1811
- ), 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);
1812
1982
  s.push(
1813
1983
  // The widget is a small bar which spans the width of the cell.
1814
- A.widget(w, () => {
1984
+ H.widget(b, () => {
1815
1985
  const y = document.createElement("div");
1816
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;
1817
1987
  })
1818
1988
  );
1819
- }) : W(
1989
+ }) : ee(
1820
1990
  e.state.block,
1821
1991
  r
1822
- ).forEach(({ row: g, col: m }) => {
1992
+ ).forEach(({ row: f, col: m }) => {
1823
1993
  const p = t.doc.resolve(
1824
- u.posAtIndex(g) + 1
1994
+ u.posAtIndex(f) + 1
1825
1995
  ), d = t.doc.resolve(
1826
1996
  p.posAtIndex(m) + 1
1827
- ), 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);
1828
1998
  s.push(
1829
1999
  // The widget is a small bar which spans the height of the cell.
1830
- A.widget(w, () => {
2000
+ H.widget(b, () => {
1831
2001
  const y = document.createElement("div");
1832
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;
1833
2003
  })
1834
2004
  );
1835
- }), V.create(t.doc, s);
2005
+ }), Y.create(t.doc, s);
1836
2006
  }
1837
2007
  }
1838
2008
  })
@@ -1851,13 +2021,13 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1851
2021
  originalIndex: e.state.colIndex,
1852
2022
  mousePos: t.clientX
1853
2023
  }, e.emitUpdate(), n.transact(
1854
- (r) => r.setMeta(O, {
2024
+ (r) => r.setMeta(V, {
1855
2025
  draggedCellOrientation: e.state.draggingState.draggedCellOrientation,
1856
2026
  originalIndex: e.state.colIndex,
1857
2027
  newIndex: e.state.colIndex,
1858
2028
  tablePos: e.tablePos
1859
2029
  })
1860
- ), !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");
1861
2031
  },
1862
2032
  /**
1863
2033
  * Callback that should be set on the `dragStart` event for whichever element
@@ -1873,13 +2043,13 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1873
2043
  originalIndex: e.state.rowIndex,
1874
2044
  mousePos: t.clientY
1875
2045
  }, e.emitUpdate(), n.transact(
1876
- (r) => r.setMeta(O, {
2046
+ (r) => r.setMeta(V, {
1877
2047
  draggedCellOrientation: e.state.draggingState.draggedCellOrientation,
1878
2048
  originalIndex: e.state.rowIndex,
1879
2049
  newIndex: e.state.rowIndex,
1880
2050
  tablePos: e.tablePos
1881
2051
  })
1882
- ), !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");
1883
2053
  },
1884
2054
  /**
1885
2055
  * Callback that should be set on the `dragEnd` event for both the element
@@ -1890,7 +2060,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1890
2060
  throw new Error(
1891
2061
  "Attempted to drag table row, but no table block was hovered prior."
1892
2062
  );
1893
- 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);
1894
2064
  },
1895
2065
  /**
1896
2066
  * Freezes the drag handles. When frozen, they will stay attached to the same
@@ -1907,13 +2077,13 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1907
2077
  e.menuFrozen = !1;
1908
2078
  },
1909
2079
  getCellsAtRowHandle(t, r) {
1910
- return G(t, r);
2080
+ return te(t, r);
1911
2081
  },
1912
2082
  /**
1913
2083
  * Get all the cells in a column of the table block.
1914
2084
  */
1915
2085
  getCellsAtColumnHandle(t, r) {
1916
- return W(t, r);
2086
+ return ee(t, r);
1917
2087
  },
1918
2088
  /**
1919
2089
  * Sets the selection to the given cell or a range of cells.
@@ -1934,7 +2104,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1934
2104
  l.posAtIndex(s.col)
1935
2105
  ), h = t.tr;
1936
2106
  return h.setSelection(
1937
- new yt(c, u)
2107
+ new It(c, u)
1938
2108
  ), t.apply(h);
1939
2109
  },
1940
2110
  /**
@@ -1946,7 +2116,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1946
2116
  s,
1947
2117
  r.orientation === "row" ? { row: t, col: 0 } : { row: 0, col: t }
1948
2118
  );
1949
- 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);
1950
2120
  });
1951
2121
  },
1952
2122
  /**
@@ -1958,13 +2128,13 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1958
2128
  row: t,
1959
2129
  col: 0
1960
2130
  });
1961
- return ht(a, i);
2131
+ return kt(a, i);
1962
2132
  }) : n.exec((s, i) => {
1963
2133
  const a = this.setCellSelection(s, {
1964
2134
  row: 0,
1965
2135
  col: t
1966
2136
  });
1967
- return mt(a, i);
2137
+ return vt(a, i);
1968
2138
  });
1969
2139
  },
1970
2140
  /**
@@ -1977,7 +2147,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1977
2147
  t.relativeStartCell,
1978
2148
  t.relativeEndCell
1979
2149
  ) : r;
1980
- return ut(i, s);
2150
+ return yt(i, s);
1981
2151
  });
1982
2152
  },
1983
2153
  /**
@@ -1987,7 +2157,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1987
2157
  splitCell(t) {
1988
2158
  return n.exec((r, s) => {
1989
2159
  const i = t ? this.setCellSelection(r, t) : r;
1990
- return dt(i, s);
2160
+ return bt(i, s);
1991
2161
  });
1992
2162
  },
1993
2163
  /**
@@ -1998,10 +2168,10 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1998
2168
  return n.transact((t) => {
1999
2169
  const r = t.selection;
2000
2170
  let s = r.$from, i = r.$to;
2001
- if (Q(r)) {
2171
+ if (ne(r)) {
2002
2172
  const { ranges: d } = r;
2003
- d.forEach((f) => {
2004
- 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);
2005
2175
  });
2006
2176
  } else if (s = t.doc.resolve(
2007
2177
  r.$from.pos - r.$from.parentOffset - 1
@@ -2011,10 +2181,10 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
2011
2181
  return;
2012
2182
  const a = t.doc.resolve(
2013
2183
  s.pos - s.parentOffset - 1
2014
- ), 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 = [];
2015
2185
  for (let d = h; d <= m; d++)
2016
- for (let f = u; f <= g; f++)
2017
- p.push({ row: d, col: f });
2186
+ for (let g = u; g <= f; g++)
2187
+ p.push({ row: d, col: g });
2018
2188
  return {
2019
2189
  from: {
2020
2190
  row: h,
@@ -2022,7 +2192,7 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
2022
2192
  },
2023
2193
  to: {
2024
2194
  row: m,
2025
- col: g
2195
+ col: f
2026
2196
  },
2027
2197
  cells: p
2028
2198
  };
@@ -2035,29 +2205,29 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
2035
2205
  */
2036
2206
  getMergeDirection(t) {
2037
2207
  return n.transact((r) => {
2038
- const s = Q(r.selection) ? r.selection : void 0;
2208
+ const s = ne(r.selection) ? r.selection : void 0;
2039
2209
  if (!s || !t || // Only offer the merge button if there is more than one cell selected.
2040
2210
  s.ranges.length <= 1)
2041
2211
  return;
2042
2212
  const i = this.getCellSelection();
2043
2213
  if (i)
2044
- return $e(i.from, i.to, t) ? "vertical" : "horizontal";
2214
+ return Xe(i.from, i.to, t) ? "vertical" : "horizontal";
2045
2215
  });
2046
2216
  },
2047
2217
  cropEmptyRowsOrColumns(t, r) {
2048
- return Fe(t, r);
2218
+ return Ke(t, r);
2049
2219
  },
2050
2220
  addRowsOrColumns(t, r, s) {
2051
- return He(t, r, s);
2221
+ return je(t, r, s);
2052
2222
  }
2053
2223
  };
2054
- }), ae = new P("trailingNode"), Do = C(() => ({
2224
+ }), me = new N("trailingNode"), jo = E(() => ({
2055
2225
  key: "trailingNode",
2056
2226
  prosemirrorPlugins: [
2057
- new T({
2058
- key: ae,
2227
+ new L({
2228
+ key: me,
2059
2229
  appendTransaction: (n, e, o) => {
2060
- 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;
2061
2231
  if (i)
2062
2232
  return r.insert(
2063
2233
  a,
@@ -2085,32 +2255,34 @@ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
2085
2255
  ]
2086
2256
  }));
2087
2257
  export {
2088
- fo as B,
2089
- yo as D,
2090
- go as F,
2091
- ko as H,
2092
- Co as L,
2093
- xo as N,
2094
- Eo as P,
2095
- wo as S,
2096
- Kt as T,
2097
- vo as V,
2098
- oe as Y,
2099
- F as a,
2100
- $ as b,
2101
- bo as c,
2102
- So as d,
2103
- Io as e,
2104
- Ft as f,
2105
- To as g,
2106
- Po as h,
2107
- Do as i,
2108
- xt as j,
2109
- Ce as k,
2110
- Bo as l,
2111
- xe as m,
2112
- Rt as n,
2113
- $t as s,
2114
- 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
2115
2287
  };
2116
- //# sourceMappingURL=TrailingNode-DZag-Nvu.js.map
2288
+ //# sourceMappingURL=TrailingNode-GzE59m_7.js.map