@blocknote/core 0.46.2 → 0.47.1

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 (54) hide show
  1. package/dist/{BlockNoteSchema-DmFDeA0n.cjs → BlockNoteSchema-CwhtPpVC.cjs} +2 -2
  2. package/dist/{BlockNoteSchema-DmFDeA0n.cjs.map → BlockNoteSchema-CwhtPpVC.cjs.map} +1 -1
  3. package/dist/{BlockNoteSchema-BkXw8HJ6.js → BlockNoteSchema-dmbNkHA-.js} +2 -2
  4. package/dist/{BlockNoteSchema-BkXw8HJ6.js.map → BlockNoteSchema-dmbNkHA-.js.map} +1 -1
  5. package/dist/TrailingNode-DHOdUVUO.cjs +2 -0
  6. package/dist/TrailingNode-DHOdUVUO.cjs.map +1 -0
  7. package/dist/{TrailingNode-CxM966vN.js → TrailingNode-F9hX_UlQ.js} +451 -445
  8. package/dist/TrailingNode-F9hX_UlQ.js.map +1 -0
  9. package/dist/blocknote.cjs +4 -4
  10. package/dist/blocknote.cjs.map +1 -1
  11. package/dist/blocknote.js +1624 -1370
  12. package/dist/blocknote.js.map +1 -1
  13. package/dist/blocks.cjs +1 -1
  14. package/dist/blocks.js +2 -2
  15. package/dist/{defaultBlocks-DosClM5E.cjs → defaultBlocks-CSB5GiAu.cjs} +4 -4
  16. package/dist/defaultBlocks-CSB5GiAu.cjs.map +1 -0
  17. package/dist/{defaultBlocks-DE5GNdJH.js → defaultBlocks-Caw1U1oV.js} +49 -46
  18. package/dist/defaultBlocks-Caw1U1oV.js.map +1 -0
  19. package/dist/extensions.cjs +1 -1
  20. package/dist/extensions.js +3 -3
  21. package/dist/locales.cjs +1 -1
  22. package/dist/locales.cjs.map +1 -1
  23. package/dist/locales.js +813 -28
  24. package/dist/locales.js.map +1 -1
  25. package/dist/style.css +1 -1
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/webpack-stats.json +1 -1
  28. package/package.json +1 -1
  29. package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +30 -7
  30. package/src/blocks/ListItem/CheckListItem/block.test.ts +61 -0
  31. package/src/blocks/ListItem/CheckListItem/block.ts +4 -0
  32. package/src/editor/Block.css +2 -2
  33. package/src/editor/transformPasted.ts +69 -0
  34. package/src/extensions/Collaboration/YCursorPlugin.ts +3 -1
  35. package/src/extensions/SideMenu/SideMenu.ts +44 -0
  36. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +191 -0
  37. package/src/extensions/SuggestionMenu/SuggestionMenu.ts +28 -11
  38. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +470 -64
  39. package/src/i18n/locales/fa.ts +390 -0
  40. package/src/i18n/locales/index.ts +2 -0
  41. package/src/i18n/locales/uz.ts +421 -0
  42. package/src/schema/blocks/createSpec.ts +2 -0
  43. package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +5 -0
  44. package/types/src/blocks/ListItem/CheckListItem/block.test.d.ts +1 -0
  45. package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +12 -3
  46. package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +1 -0
  47. package/types/src/i18n/locales/fa.d.ts +320 -0
  48. package/types/src/i18n/locales/index.d.ts +2 -0
  49. package/types/src/i18n/locales/uz.d.ts +2 -0
  50. package/dist/TrailingNode-CxM966vN.js.map +0 -1
  51. package/dist/TrailingNode-D-CZ76FS.cjs +0 -2
  52. package/dist/TrailingNode-D-CZ76FS.cjs.map +0 -1
  53. package/dist/defaultBlocks-DE5GNdJH.js.map +0 -1
  54. package/dist/defaultBlocks-DosClM5E.cjs.map +0 -1
@@ -1,12 +1,12 @@
1
1
  var Ie = Object.defineProperty;
2
- var Be = (n, e, t) => e in n ? Ie(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var b = (n, e, t) => Be(n, typeof e != "symbol" ? e + "" : e, t);
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
4
  import { Plugin as T, PluginKey as P, NodeSelection as le, TextSelection as ce, Selection as N } from "prosemirror-state";
5
- import { combineTransactionSteps as Te, getMarkRange as Pe, posToDOMRect as Oe, findChildren as j } from "@tiptap/core";
6
- import De from "fast-deep-equal";
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
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-DE5GNdJH.js";
9
- import { c as k, a as H } from "./BlockNoteExtension-C2X7LW-V.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
10
  import { yCursorPlugin as _e, defaultSelectionBuilder as ze, ySyncPlugin as Ke, redoCommand as Ye, undoCommand as Xe, yUndoPlugin as je, yUndoPluginKey as Z } from "y-prosemirror";
11
11
  import * as I from "yjs";
12
12
  import { PluginKey as pe, Plugin as fe, TextSelection as qe } from "@tiptap/pm/state";
@@ -26,11 +26,11 @@ import { visit as ct } from "unist-util-visit";
26
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
27
  function ye(n) {
28
28
  const e = Array.from(n.classList).filter(
29
- (t) => !t.startsWith("bn-")
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, t, o) {
33
+ function be(n, e, o, t) {
34
34
  var a;
35
35
  let r;
36
36
  if (e)
@@ -43,7 +43,7 @@ function be(n, e, t, o) {
43
43
  else
44
44
  throw new Me(e.type);
45
45
  else throw new Error("blockContent is required");
46
- const i = ((o == null ? void 0 : o.document) ?? document).createDocumentFragment();
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;
@@ -67,9 +67,9 @@ function be(n, e, t, o) {
67
67
  );
68
68
  if (h) {
69
69
  if (i.appendChild(h.dom), h.contentDOM) {
70
- const g = t.serializeFragment(
70
+ const g = o.serializeFragment(
71
71
  c.content,
72
- o
72
+ t
73
73
  );
74
74
  h.contentDOM.dataset.editable = "", h.contentDOM.appendChild(g);
75
75
  }
@@ -90,47 +90,47 @@ function be(n, e, t, o) {
90
90
  }
91
91
  i.appendChild(l);
92
92
  } else {
93
- const l = t.serializeFragment(
93
+ const l = o.serializeFragment(
94
94
  we.from([c]),
95
- o
95
+ t
96
96
  );
97
97
  i.appendChild(l);
98
98
  }
99
99
  return i.childNodes.length === 1 && ((a = i.firstChild) == null ? void 0 : a.nodeType) === 1 && ye(i.firstChild), i;
100
100
  }
101
- function bt(n, e, t, o, r, s, i, a) {
102
- var w, y, C, O, _, z, K, Y, X;
103
- const c = (a == null ? void 0 : a.document) ?? document, l = e.pmSchema.nodes.blockContainer, u = t.props || {};
104
- for (const [v, x] of Object.entries(
105
- e.schema.blockSchema[t.type].propSchema
101
+ function bt(n, e, o, t, r, s, i, a) {
102
+ var w, y, v, D, _, z, K, Y, X;
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(
105
+ e.schema.blockSchema[o.type].propSchema
106
106
  ))
107
- !(v in u) && x.default !== void 0 && (u[v] = x.default);
107
+ !(k in u) && x.default !== void 0 && (u[k] = x.default);
108
108
  const h = (y = (w = l.spec) == null ? void 0 : w.toDOM) == null ? void 0 : y.call(
109
109
  w,
110
110
  l.create({
111
- id: t.id,
111
+ id: o.id,
112
112
  ...u
113
113
  })
114
- ), g = Array.from(h.dom.attributes), m = e.blockImplementations[t.type].implementation, p = ((C = m.toExternalHTML) == null ? void 0 : C.call(
114
+ ), g = Array.from(h.dom.attributes), m = e.blockImplementations[o.type].implementation, p = ((v = m.toExternalHTML) == null ? void 0 : v.call(
115
115
  {},
116
- { ...t, props: u },
116
+ { ...o, props: u },
117
117
  e,
118
118
  {
119
119
  nestingLevel: i
120
120
  }
121
121
  )) || m.render.call(
122
122
  {},
123
- { ...t, props: u },
123
+ { ...o, props: u },
124
124
  e
125
125
  ), d = c.createDocumentFragment();
126
126
  if (p.dom.classList.contains("bn-block-content")) {
127
- const v = [
127
+ const k = [
128
128
  ...g,
129
129
  ...Array.from(p.dom.attributes)
130
130
  ].filter(
131
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"
132
132
  );
133
- for (const x of v)
133
+ for (const x of k)
134
134
  p.dom.firstChild.setAttribute(x.name, x.value);
135
135
  ye(p.dom.firstChild), i > 0 && p.dom.firstChild.setAttribute(
136
136
  "data-nesting-level",
@@ -141,134 +141,134 @@ function bt(n, e, t, o, r, s, i, a) {
141
141
  "data-nesting-level",
142
142
  i.toString()
143
143
  );
144
- if (p.contentDOM && t.content) {
145
- const v = be(
144
+ if (p.contentDOM && o.content) {
145
+ const k = be(
146
146
  e,
147
- t.content,
147
+ o.content,
148
148
  // TODO
149
- o,
149
+ t,
150
150
  a
151
151
  );
152
- p.contentDOM.appendChild(v);
152
+ p.contentDOM.appendChild(k);
153
153
  }
154
154
  let f;
155
- if (r.has(t.type) ? f = "OL" : s.has(t.type) && (f = "UL"), f) {
156
- if (((O = n.lastChild) == null ? void 0 : O.nodeName) !== f) {
157
- const v = c.createElement(f);
158
- f === "OL" && "start" in u && u.start && (u == null ? void 0 : u.start) !== 1 && v.setAttribute("start", u.start + ""), n.append(v);
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);
159
159
  }
160
160
  n.lastChild.appendChild(d);
161
161
  } else
162
162
  n.append(d);
163
- if (t.children && t.children.length > 0) {
164
- const v = c.createDocumentFragment();
165
- if (ve(
166
- v,
163
+ if (o.children && o.children.length > 0) {
164
+ const k = c.createDocumentFragment();
165
+ if (ke(
166
+ k,
167
167
  e,
168
- t.children,
169
- o,
168
+ o.children,
169
+ t,
170
170
  r,
171
171
  s,
172
172
  i + 1,
173
173
  a
174
174
  ), ((_ = n.lastChild) == null ? void 0 : _.nodeName) === "UL" || ((z = n.lastChild) == null ? void 0 : z.nodeName) === "OL")
175
- for (; ((K = v.firstChild) == null ? void 0 : K.nodeName) === "UL" || ((Y = v.firstChild) == null ? void 0 : Y.nodeName) === "OL"; )
176
- n.lastChild.lastChild.appendChild(v.firstChild);
177
- e.pmSchema.nodes[t.type].isInGroup("blockContent") ? n.append(v) : (X = p.contentDOM) == null || X.append(v);
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);
178
178
  }
179
179
  }
180
- const ve = (n, e, t, o, r, s, i = 0, a) => {
181
- for (const c of t)
180
+ const ke = (n, e, o, t, r, s, i = 0, a) => {
181
+ for (const c of o)
182
182
  bt(
183
183
  n,
184
184
  e,
185
185
  c,
186
- o,
186
+ t,
187
187
  r,
188
188
  s,
189
189
  i,
190
190
  a
191
191
  );
192
- }, vt = (n, e, t, o, r, s) => {
192
+ }, kt = (n, e, o, t, r, s) => {
193
193
  const a = ((s == null ? void 0 : s.document) ?? document).createDocumentFragment();
194
- return ve(
194
+ return ke(
195
195
  a,
196
196
  n,
197
197
  e,
198
- t,
199
198
  o,
199
+ t,
200
200
  r,
201
201
  0,
202
202
  s
203
203
  ), a;
204
- }, ke = (n, e) => {
205
- const t = ge.fromSchema(n);
204
+ }, Ce = (n, e) => {
205
+ const o = ge.fromSchema(n);
206
206
  return {
207
- exportBlocks: (o, r) => {
208
- const s = vt(
207
+ exportBlocks: (t, r) => {
208
+ const s = kt(
209
209
  e,
210
- o,
211
210
  t,
211
+ o,
212
212
  /* @__PURE__ */ new Set(["numberedListItem"]),
213
213
  /* @__PURE__ */ new Set(["bulletListItem", "checkListItem", "toggleListItem"]),
214
214
  r
215
215
  ), i = document.createElement("div");
216
216
  return i.append(s), i.innerHTML;
217
217
  },
218
- exportInlineContent: (o, r) => {
218
+ exportInlineContent: (t, r) => {
219
219
  const s = be(
220
220
  e,
221
- o,
222
221
  t,
222
+ o,
223
223
  r
224
224
  ), i = document.createElement("div");
225
225
  return i.append(s.cloneNode(!0)), i.innerHTML;
226
226
  }
227
227
  };
228
228
  };
229
- function kt(n, e) {
229
+ function Ct(n, e) {
230
230
  if (e === 0)
231
231
  return;
232
- const t = n.resolve(e);
233
- for (let o = t.depth; o > 0; o--) {
234
- const r = t.node(o);
232
+ const o = n.resolve(e);
233
+ for (let t = o.depth; t > 0; t--) {
234
+ const r = o.node(t);
235
235
  if (he(r))
236
236
  return r.attrs.id;
237
237
  }
238
238
  }
239
- function Ct(n) {
239
+ function vt(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
244
  function ee(n) {
245
- const e = "__root__", t = {}, o = {}, r = R(n);
245
+ const e = "__root__", o = {}, t = {}, r = R(n);
246
246
  return n.descendants((s, i) => {
247
247
  if (!he(s))
248
248
  return !0;
249
- const a = kt(n, i), c = a ?? e;
250
- o[c] || (o[c] = []);
249
+ const a = Ct(n, i), c = a ?? e;
250
+ t[c] || (t[c] = []);
251
251
  const l = L(s, r);
252
- return t[s.attrs.id] = { block: l, parentId: a }, o[c].push(s.attrs.id), !0;
253
- }), { byId: t, childrenByParent: o };
252
+ return o[s.attrs.id] = { block: l, parentId: a }, t[c].push(s.attrs.id), !0;
253
+ }), { byId: o, childrenByParent: t };
254
254
  }
255
255
  function St(n, e) {
256
- const t = /* @__PURE__ */ new Set();
256
+ const o = /* @__PURE__ */ new Set();
257
257
  if (!n || !e)
258
- return t;
259
- const o = new Set(n), r = e.filter((d) => o.has(d)), s = n.filter(
258
+ return o;
259
+ const t = new Set(n), r = e.filter((d) => t.has(d)), s = n.filter(
260
260
  (d) => r.includes(d)
261
261
  );
262
262
  if (s.length <= 1 || r.length <= 1)
263
- return t;
263
+ return o;
264
264
  const i = {};
265
265
  for (let d = 0; d < s.length; d++)
266
266
  i[s[d]] = d;
267
267
  const a = r.map((d) => i[d]), c = a.length, l = [], u = [], h = new Array(c).fill(-1), g = (d, f) => {
268
268
  let w = 0, y = d.length;
269
269
  for (; w < y; ) {
270
- const C = w + y >>> 1;
271
- d[C] < f ? w = C + 1 : y = C;
270
+ const v = w + y >>> 1;
271
+ d[v] < f ? w = v + 1 : y = v;
272
272
  }
273
273
  return w;
274
274
  };
@@ -281,30 +281,30 @@ function St(n, e) {
281
281
  for (; p !== -1; )
282
282
  m.add(p), p = h[p];
283
283
  for (let d = 0; d < r.length; d++)
284
- m.has(d) || t.add(r[d]);
285
- return t;
284
+ m.has(d) || o.add(r[d]);
285
+ return o;
286
286
  }
287
287
  function xt(n, e = []) {
288
- const t = Ct(n), o = Te(n.before, [
288
+ const o = vt(n), t = Te(n.before, [
289
289
  n,
290
290
  ...e
291
291
  ]), r = ee(
292
- o.before
292
+ t.before
293
293
  ), s = ee(
294
- o.doc
294
+ t.doc
295
295
  ), i = [], a = /* @__PURE__ */ new Set();
296
296
  Object.keys(s.byId).filter((m) => !(m in r.byId)).forEach((m) => {
297
297
  i.push({
298
298
  type: "insert",
299
299
  block: s.byId[m].block,
300
- source: t,
300
+ source: o,
301
301
  prevBlock: void 0
302
302
  }), a.add(m);
303
303
  }), Object.keys(r.byId).filter((m) => !(m in s.byId)).forEach((m) => {
304
304
  i.push({
305
305
  type: "delete",
306
306
  block: r.byId[m].block,
307
- source: t,
307
+ source: o,
308
308
  prevBlock: void 0
309
309
  }), a.add(m);
310
310
  }), Object.keys(s.byId).filter((m) => m in r.byId).forEach((m) => {
@@ -314,17 +314,17 @@ function xt(n, e = []) {
314
314
  type: "move",
315
315
  block: d.block,
316
316
  prevBlock: p.block,
317
- source: t,
317
+ source: o,
318
318
  prevParent: p.parentId ? (w = r.byId[p.parentId]) == null ? void 0 : w.block : void 0,
319
319
  currentParent: d.parentId ? (y = s.byId[d.parentId]) == null ? void 0 : y.block : void 0
320
- }), a.add(m)) : De(
320
+ }), a.add(m)) : Oe(
321
321
  { ...p.block, children: void 0 },
322
322
  { ...d.block, children: void 0 }
323
323
  ) || (i.push({
324
324
  type: "update",
325
325
  block: d.block,
326
326
  prevBlock: p.block,
327
- source: t
327
+ source: o
328
328
  }), a.add(m));
329
329
  });
330
330
  const c = r.childrenByParent, l = s.childrenByParent, u = "__root__", h = /* @__PURE__ */ new Set([
@@ -337,20 +337,20 @@ function xt(n, e = []) {
337
337
  l[m]
338
338
  );
339
339
  p.size !== 0 && p.forEach((d) => {
340
- var C, O;
340
+ var v, D;
341
341
  const f = r.byId[d], w = s.byId[d];
342
342
  !f || !w || f.parentId !== w.parentId || a.has(d) || (f.parentId ?? u) !== m || g.has(d) || (g.add(d), i.push({
343
343
  type: "move",
344
344
  block: w.block,
345
345
  prevBlock: f.block,
346
- source: t,
347
- prevParent: f.parentId ? (C = r.byId[f.parentId]) == null ? void 0 : C.block : void 0,
348
- currentParent: w.parentId ? (O = s.byId[w.parentId]) == null ? void 0 : O.block : void 0
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
349
349
  }), a.add(d));
350
350
  });
351
351
  }), i;
352
352
  }
353
- const fo = k(() => {
353
+ const fo = C(() => {
354
354
  const n = [];
355
355
  return {
356
356
  key: "blockChange",
@@ -358,10 +358,10 @@ const fo = k(() => {
358
358
  new T({
359
359
  key: new P("blockChange"),
360
360
  filterTransaction: (e) => {
361
- let t;
362
- return n.reduce((o, r) => o === !1 ? o : r({
361
+ let o;
362
+ return n.reduce((t, r) => t === !1 ? t : r({
363
363
  getChanges() {
364
- return t || (t = xt(e), t);
364
+ return o || (o = xt(e), o);
365
365
  },
366
366
  tr: e
367
367
  }) !== !1, !0);
@@ -382,34 +382,36 @@ const fo = k(() => {
382
382
  };
383
383
  });
384
384
  function te(n) {
385
- const e = n.charAt(0) === "#" ? n.substring(1, 7) : n, t = parseInt(e.substring(0, 2), 16), o = parseInt(e.substring(2, 4), 16), r = parseInt(e.substring(4, 6), 16), i = [t / 255, o / 255, r / 255].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
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
388
  function Et(n) {
389
389
  const e = document.createElement("span");
390
390
  e.classList.add("bn-collaboration-cursor__base");
391
- const t = document.createElement("span");
392
- t.setAttribute("contentedEditable", "false"), t.classList.add("bn-collaboration-cursor__caret"), t.setAttribute(
391
+ const o = document.createElement("span");
392
+ o.setAttribute("contentedEditable", "false"), o.classList.add("bn-collaboration-cursor__caret"), o.setAttribute(
393
393
  "style",
394
394
  `background-color: ${n.color}; color: ${te(n.color) ? "white" : "black"}`
395
395
  );
396
- const o = document.createElement("span");
397
- return o.classList.add("bn-collaboration-cursor__label"), o.setAttribute(
396
+ const t = document.createElement("span");
397
+ return t.classList.add("bn-collaboration-cursor__label"), t.setAttribute(
398
398
  "style",
399
399
  `background-color: ${n.color}; color: ${te(n.color) ? "white" : "black"}`
400
- ), o.insertBefore(document.createTextNode(n.name), null), t.insertBefore(o, null), e.insertBefore(document.createTextNode("⁠"), null), e.insertBefore(t, null), e.insertBefore(document.createTextNode("⁠"), null), e;
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 = k(
402
+ const oe = C(
403
403
  ({ options: n }) => {
404
- const e = /* @__PURE__ */ new Map(), t = n.provider && "awareness" in n.provider && typeof n.provider.awareness == "object" ? n.provider.awareness : void 0;
405
- return t && ("setLocalStateField" in t && typeof t.setLocalStateField == "function" && t.setLocalStateField("user", n.user), "on" in t && typeof t.on == "function" && n.showCursorLabels !== "always" && t.on(
404
+ const e = /* @__PURE__ */ new Map(), o = n.provider && "awareness" in n.provider && typeof n.provider.awareness == "object" ? n.provider.awareness : void 0;
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(
406
406
  "change",
407
407
  ({
408
- updated: o
408
+ updated: t
409
409
  }) => {
410
- for (const r of o) {
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 = k(
420
422
  )), {
421
423
  key: "yCursor",
422
424
  prosemirrorPlugins: [
423
- t ? _e(t, {
425
+ o ? _e(o, {
424
426
  selectionBuilder: ze,
425
- cursorBuilder(o, r) {
427
+ cursorBuilder(t, r) {
426
428
  let s = e.get(r);
427
429
  if (!s) {
428
- const i = (n.renderCursor ?? Et)(o);
430
+ const i = (n.renderCursor ?? Et)(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, {
@@ -450,18 +452,18 @@ const oe = k(
450
452
  }) : void 0
451
453
  ].filter(Boolean),
452
454
  dependsOn: ["ySync"],
453
- updateUser(o) {
454
- t == null || t.setLocalStateField("user", o);
455
+ updateUser(t) {
456
+ o == null || o.setLocalStateField("user", t);
455
457
  }
456
458
  };
457
459
  }
458
- ), F = k(
460
+ ), F = C(
459
461
  ({ options: n }) => ({
460
462
  key: "ySync",
461
463
  prosemirrorPlugins: [Ke(n.fragment)],
462
464
  runsBefore: ["default"]
463
465
  })
464
- ), $ = k(() => ({
466
+ ), $ = C(() => ({
465
467
  key: "yUndo",
466
468
  prosemirrorPlugins: [je()],
467
469
  dependsOn: ["yCursor", "ySync"],
@@ -469,33 +471,33 @@ const oe = k(
469
471
  redoCommand: Ye
470
472
  }));
471
473
  function It(n, e) {
472
- const t = n.doc;
474
+ const o = n.doc;
473
475
  if (n._item === null) {
474
- const o = Array.from(t.share.keys()).find(
475
- (r) => t.share.get(r) === n
476
+ const t = Array.from(o.share.keys()).find(
477
+ (r) => o.share.get(r) === n
476
478
  );
477
- if (o == null)
479
+ if (t == null)
478
480
  throw new Error("type does not exist in other ydoc");
479
- return e.get(o, n.constructor);
481
+ return e.get(t, n.constructor);
480
482
  } else {
481
- const o = n._item, r = e.store.clients.get(o.id.client) ?? [], s = I.findIndexSS(r, o.id.clock);
483
+ const t = n._item, r = e.store.clients.get(t.id.client) ?? [], s = I.findIndexSS(r, t.id.clock);
482
484
  return r[s].content.type;
483
485
  }
484
486
  }
485
- const go = k(
487
+ const go = C(
486
488
  ({ editor: n, options: e }) => {
487
- let t;
488
- const o = H({ isForked: !1 });
489
+ let o;
490
+ const t = H({ isForked: !1 });
489
491
  return {
490
492
  key: "yForkDoc",
491
- store: o,
493
+ store: t,
492
494
  /**
493
495
  * Fork the Y.js document from syncing to the remote,
494
496
  * allowing modifications to the document without affecting the remote.
495
497
  * These changes can later be rolled back or applied to the remote.
496
498
  */
497
499
  fork() {
498
- if (t)
500
+ if (o)
499
501
  return;
500
502
  const r = e.fragment;
501
503
  if (!r)
@@ -503,7 +505,7 @@ const go = k(
503
505
  const s = new I.Doc();
504
506
  I.applyUpdate(s, I.encodeStateAsUpdate(r.doc));
505
507
  const i = It(r, s);
506
- t = {
508
+ o = {
507
509
  undoStack: Z.getState(n.prosemirrorState).undoManager.undoStack,
508
510
  originalFragment: r,
509
511
  forkedFragment: i
@@ -520,7 +522,7 @@ const go = k(
520
522
  F(a),
521
523
  // No need to register the cursor plugin again, it's a local fork
522
524
  $()
523
- ]), o.setState({ isForked: !0 });
525
+ ]), t.setState({ isForked: !0 });
524
526
  },
525
527
  /**
526
528
  * Resume syncing the Y.js document to the remote
@@ -528,10 +530,10 @@ const go = k(
528
530
  * Otherwise, the original document will be restored and the changes will be discarded.
529
531
  */
530
532
  merge({ keepChanges: r }) {
531
- if (!t)
533
+ if (!o)
532
534
  return;
533
535
  n.unregisterExtension(["ySync", "yCursor", "yUndo"]);
534
- const { originalFragment: s, forkedFragment: i, undoStack: a } = t;
536
+ const { originalFragment: s, forkedFragment: i, undoStack: a } = o;
535
537
  if (n.registerExtension([
536
538
  F(e),
537
539
  oe(e),
@@ -545,28 +547,28 @@ const go = k(
545
547
  );
546
548
  I.applyUpdate(s.doc, c, n);
547
549
  }
548
- t = void 0, o.setState({ isForked: !1 });
550
+ o = void 0, t.setState({ isForked: !1 });
549
551
  }
550
552
  };
551
553
  }
552
- ), Ce = (n, e) => {
553
- e(n), n.forEach((t) => {
554
- t instanceof I.XmlElement && Ce(t, e);
554
+ ), ve = (n, e) => {
555
+ e(n), n.forEach((o) => {
556
+ o instanceof I.XmlElement && ve(o, e);
555
557
  });
556
558
  }, Bt = (n, e) => {
557
- const t = /* @__PURE__ */ new Map();
558
- return n.forEach((o) => {
559
- o instanceof I.XmlElement && Ce(o, (r) => {
559
+ const o = /* @__PURE__ */ new Map();
560
+ return n.forEach((t) => {
561
+ t instanceof I.XmlElement && ve(t, (r) => {
560
562
  if (r.nodeName === "blockContainer" && r.hasAttribute("id")) {
561
563
  const s = r.getAttribute("textColor"), i = r.getAttribute("backgroundColor"), a = {
562
564
  textColor: s === J.textColor.default ? void 0 : s,
563
565
  backgroundColor: i === J.backgroundColor.default ? void 0 : i
564
566
  };
565
- (a.textColor || a.backgroundColor) && t.set(r.getAttribute("id"), a);
567
+ (a.textColor || a.backgroundColor) && o.set(r.getAttribute("id"), a);
566
568
  }
567
569
  });
568
- }), t.size === 0 ? !1 : (e.doc.descendants((o, r) => {
569
- if (o.type.name === "blockContainer" && t.has(o.attrs.id)) {
570
+ }), o.size === 0 ? !1 : (e.doc.descendants((t, r) => {
571
+ if (t.type.name === "blockContainer" && o.has(t.attrs.id)) {
570
572
  const s = e.doc.nodeAt(r + 1);
571
573
  if (!s)
572
574
  throw new Error("No element found");
@@ -574,23 +576,23 @@ const go = k(
574
576
  // preserve existing attributes
575
577
  ...s.attrs,
576
578
  // add the textColor and backgroundColor attributes
577
- ...t.get(o.attrs.id)
579
+ ...o.get(t.attrs.id)
578
580
  });
579
581
  }
580
582
  }), !0);
581
- }, Tt = [Bt], wo = k(
583
+ }, Tt = [Bt], wo = C(
582
584
  ({ options: n }) => {
583
585
  let e = !1;
584
- const t = new pe("schemaMigration");
586
+ const o = new pe("schemaMigration");
585
587
  return {
586
588
  key: "schemaMigration",
587
589
  prosemirrorPlugins: [
588
590
  new fe({
589
- key: t,
590
- appendTransaction: (o, r, s) => {
591
+ key: o,
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
592
- !o.some((a) => a.getMeta("y-sync$")) || // If none of the transactions result in a document change, we don't need to run the migration
593
- o.every((a) => !a.docChanged) || // If the fragment is still empty, we can't run the migration (since it has not yet been applied to the Y.Doc)
594
+ !t.some((a) => a.getMeta("y-sync$")) || // If none of the transactions result in a document change, we don't need to run the migration
595
+ t.every((a) => !a.docChanged) || // If the fragment is still empty, we can't run the migration (since it has not yet been applied to the Y.Doc)
594
596
  !n.fragment.firstChild)
595
597
  return;
596
598
  const i = s.tr;
@@ -603,7 +605,7 @@ const go = k(
603
605
  ]
604
606
  };
605
607
  }
606
- ), yo = k(
608
+ ), yo = C(
607
609
  ({
608
610
  editor: n,
609
611
  options: e
@@ -617,25 +619,25 @@ const go = k(
617
619
  })
618
620
  ]
619
621
  })
620
- ), bo = k(({ editor: n }) => {
621
- const e = H(!1), t = () => n.transact((o) => {
622
+ ), bo = C(({ editor: n }) => {
623
+ const e = H(!1), o = () => n.transact((t) => {
622
624
  var s;
623
- if (o.selection.empty || o.selection instanceof le && (o.selection.node.type.spec.content === "inline*" || ((s = o.selection.node.firstChild) == null ? void 0 : s.type.spec.content) === "inline*") || o.selection instanceof ce && o.doc.textBetween(o.selection.from, o.selection.to).length === 0)
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)
624
626
  return !1;
625
627
  let r = !1;
626
- return o.selection.content().content.descendants((i) => (i.type.spec.code && (r = !0), !r)), !r;
628
+ return t.selection.content().content.descendants((i) => (i.type.spec.code && (r = !0), !r)), !r;
627
629
  });
628
630
  return {
629
631
  key: "formattingToolbar",
630
632
  store: e,
631
- mount({ dom: o, signal: r }) {
633
+ mount({ dom: t, signal: r }) {
632
634
  let s = !1;
633
635
  const i = n.onChange(() => {
634
- s || e.setState(t());
636
+ s || e.setState(o());
635
637
  }), a = n.onSelectionChange(() => {
636
- s || e.setState(t());
638
+ s || e.setState(o());
637
639
  });
638
- o.addEventListener(
640
+ t.addEventListener(
639
641
  "pointerdown",
640
642
  () => {
641
643
  s = !0, e.setState(!1);
@@ -644,10 +646,10 @@ const go = k(
644
646
  ), n.prosemirrorView.root.addEventListener(
645
647
  "pointerup",
646
648
  () => {
647
- s = !1, n.isFocused() && e.setState(t());
649
+ s = !1, n.isFocused() && e.setState(o());
648
650
  },
649
651
  { signal: r, capture: !0 }
650
- ), o.addEventListener(
652
+ ), t.addEventListener(
651
653
  "pointercancel",
652
654
  () => {
653
655
  s = !1;
@@ -661,12 +663,12 @@ const go = k(
661
663
  });
662
664
  }
663
665
  };
664
- }), vo = k(() => ({
666
+ }), ko = C(() => ({
665
667
  key: "history",
666
668
  prosemirrorPlugins: [Qe()],
667
669
  undoCommand: Je,
668
670
  redoCommand: Ge
669
- })), ko = k(({ editor: n }) => {
671
+ })), Co = C(({ editor: n }) => {
670
672
  function e(r) {
671
673
  let s = n.prosemirrorView.nodeDOM(r);
672
674
  for (; s && s.parentElement; ) {
@@ -676,7 +678,7 @@ const go = k(
676
678
  }
677
679
  return null;
678
680
  }
679
- function t(r, s) {
681
+ function o(r, s) {
680
682
  return n.transact((i) => {
681
683
  const a = i.doc.resolve(r), c = a.marks().find((u) => u.type.name === s);
682
684
  if (!c)
@@ -690,7 +692,7 @@ const go = k(
690
692
  return i.doc.textBetween(l.from, l.to);
691
693
  },
692
694
  get position() {
693
- return Oe(
695
+ return De(
694
696
  n.prosemirrorView,
695
697
  l.from,
696
698
  l.to
@@ -699,27 +701,27 @@ const go = k(
699
701
  };
700
702
  });
701
703
  }
702
- function o() {
704
+ function t() {
703
705
  return n.transact((r) => {
704
706
  const s = r.selection;
705
707
  if (s.empty)
706
- return t(s.anchor, "link");
708
+ return o(s.anchor, "link");
707
709
  });
708
710
  }
709
711
  return {
710
712
  key: "linkToolbar",
711
- getLinkAtSelection: o,
713
+ getLinkAtSelection: t,
712
714
  getLinkElementAtPos: e,
713
- getMarkAtPos: t,
715
+ getMarkAtPos: o,
714
716
  getLinkAtElement(r) {
715
717
  return n.transact(() => {
716
718
  const s = n.prosemirrorView.posAtDOM(r, 0) + 1;
717
- return t(s, "link");
719
+ return o(s, "link");
718
720
  });
719
721
  },
720
722
  editLink(r, s, i = n.transact((a) => a.selection.anchor)) {
721
723
  n.transact((a) => {
722
- const c = R(a), { range: l } = t(i + 1, "link") || {
724
+ const c = R(a), { range: l } = o(i + 1, "link") || {
723
725
  range: {
724
726
  from: a.selection.from,
725
727
  to: a.selection.to
@@ -734,7 +736,7 @@ const go = k(
734
736
  },
735
737
  deleteLink(r = n.transact((s) => s.selection.anchor)) {
736
738
  n.transact((s) => {
737
- const i = R(s), { range: a } = t(r + 1, "link") || {
739
+ const i = R(s), { range: a } = o(r + 1, "link") || {
738
740
  range: {
739
741
  from: s.selection.from,
740
742
  to: s.selection.to
@@ -747,7 +749,7 @@ const go = k(
747
749
  }), n.prosemirrorView.focus();
748
750
  }
749
751
  };
750
- }), Co = [
752
+ }), vo = [
751
753
  "http",
752
754
  "https",
753
755
  "ftp",
@@ -758,7 +760,7 @@ const go = k(
758
760
  "sms",
759
761
  "cid",
760
762
  "xmpp"
761
- ], So = "https", Pt = new P("node-selection-keyboard"), xo = k(
763
+ ], So = "https", Pt = new P("node-selection-keyboard"), xo = C(
762
764
  () => ({
763
765
  key: "nodeSelectionKeyboard",
764
766
  prosemirrorPlugins: [
@@ -772,14 +774,14 @@ const go = k(
772
774
  if (e.key.length === 1)
773
775
  return e.preventDefault(), !0;
774
776
  if (e.key === "Enter" && !e.isComposing && !e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey) {
775
- const t = n.state.tr;
777
+ const o = n.state.tr;
776
778
  return n.dispatch(
777
- t.insert(
779
+ o.insert(
778
780
  n.state.tr.selection.$to.after(),
779
781
  n.state.schema.nodes.paragraph.createChecked()
780
782
  ).setSelection(
781
783
  new ce(
782
- t.doc.resolve(
784
+ o.doc.resolve(
783
785
  n.state.tr.selection.$to.after() + 1
784
786
  )
785
787
  )
@@ -793,29 +795,29 @@ const go = k(
793
795
  })
794
796
  ]
795
797
  })
796
- ), Ot = new P("blocknote-placeholder"), Eo = k(
798
+ ), Dt = new P("blocknote-placeholder"), Eo = C(
797
799
  ({
798
800
  editor: n,
799
801
  options: e
800
802
  }) => {
801
- const t = e.placeholders;
803
+ const o = e.placeholders;
802
804
  return {
803
805
  key: "placeholder",
804
806
  prosemirrorPlugins: [
805
807
  new T({
806
- key: Ot,
807
- view: (o) => {
808
+ key: Dt,
809
+ view: (t) => {
808
810
  const r = `placeholder-selector-${Ze()}`;
809
- o.dom.classList.add(r);
811
+ t.dom.classList.add(r);
810
812
  const s = document.createElement("style"), i = n._tiptapEditor.options.injectNonce;
811
- i && s.setAttribute("nonce", i), o.root instanceof window.ShadowRoot ? o.root.append(s) : o.root.head.appendChild(s);
813
+ i && s.setAttribute("nonce", i), t.root instanceof window.ShadowRoot ? t.root.append(s) : t.root.head.appendChild(s);
812
814
  const a = s.sheet, c = (l = "") => `.${r} .bn-block-content${l} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`;
813
815
  try {
814
816
  const {
815
817
  default: l,
816
818
  emptyDocument: u,
817
819
  ...h
818
- } = t || {};
820
+ } = o || {};
819
821
  for (const [p, d] of Object.entries(h)) {
820
822
  const f = `[data-content-type="${p}"]`;
821
823
  a.insertRule(
@@ -842,17 +844,17 @@ const go = k(
842
844
  }
843
845
  return {
844
846
  destroy: () => {
845
- o.root instanceof window.ShadowRoot ? o.root.removeChild(s) : o.root.head.removeChild(s);
847
+ t.root instanceof window.ShadowRoot ? t.root.removeChild(s) : t.root.head.removeChild(s);
846
848
  }
847
849
  };
848
850
  },
849
851
  props: {
850
- decorations: (o) => {
851
- const { doc: r, selection: s } = o;
852
+ decorations: (t) => {
853
+ const { doc: r, selection: s } = t;
852
854
  if (!n.isEditable || !s.empty || s.$from.parent.type.spec.code)
853
855
  return;
854
856
  const i = [];
855
- o.doc.content.size === 6 && i.push(
857
+ t.doc.content.size === 6 && i.push(
856
858
  A.node(2, 4, {
857
859
  "data-is-only-empty-block": "true"
858
860
  })
@@ -873,7 +875,7 @@ const go = k(
873
875
  ]
874
876
  };
875
877
  }
876
- ), ne = new P("previous-blocks"), Dt = {
878
+ ), ne = new P("previous-blocks"), Ot = {
877
879
  // Numbered List Items
878
880
  index: "index",
879
881
  // Headings
@@ -882,7 +884,7 @@ const go = k(
882
884
  type: "type",
883
885
  depth: "depth",
884
886
  "depth-change": "depth-change"
885
- }, Io = k(() => {
887
+ }, Io = C(() => {
886
888
  let n;
887
889
  return {
888
890
  key: "previousBlockType",
@@ -891,11 +893,11 @@ const go = k(
891
893
  key: ne,
892
894
  view(e) {
893
895
  return {
894
- update: async (t, o) => {
896
+ update: async (o, t) => {
895
897
  var r;
896
- ((r = this.key) == null ? void 0 : r.getState(t.state).updatedBlocks.size) > 0 && (n = setTimeout(() => {
897
- t.dispatch(
898
- t.state.tr.setMeta(ne, { clearUpdate: !0 })
898
+ ((r = this.key) == null ? void 0 : r.getState(o.state).updatedBlocks.size) > 0 && (n = setTimeout(() => {
899
+ o.dispatch(
900
+ o.state.tr.setMeta(ne, { clearUpdate: !0 })
899
901
  );
900
902
  }, 0));
901
903
  },
@@ -915,11 +917,11 @@ const go = k(
915
917
  updatedBlocks: /* @__PURE__ */ new Set()
916
918
  };
917
919
  },
918
- apply(e, t, o, r) {
919
- if (t.currentTransactionOldBlockAttrs = {}, t.updatedBlocks.clear(), !e.docChanged || o.doc.eq(r.doc))
920
- return t;
920
+ apply(e, o, t, r) {
921
+ if (o.currentTransactionOldBlockAttrs = {}, o.updatedBlocks.clear(), !e.docChanged || t.doc.eq(r.doc))
922
+ return o;
921
923
  const s = {}, i = j(
922
- o.doc,
924
+ t.doc,
923
925
  (l) => l.attrs.id
924
926
  ), a = new Map(
925
927
  i.map((l) => [l.node.attrs.id, l])
@@ -939,31 +941,31 @@ const go = k(
939
941
  index: h.attrs.index,
940
942
  level: h.attrs.level,
941
943
  type: h.type.name,
942
- depth: o.doc.resolve(u.pos).depth
944
+ depth: t.doc.resolve(u.pos).depth
943
945
  };
944
- s[l.node.attrs.id] = p, t.currentTransactionOldBlockAttrs[l.node.attrs.id] = p, JSON.stringify(p) !== JSON.stringify(m) && (p["depth-change"] = p.depth - m.depth, t.updatedBlocks.add(l.node.attrs.id));
946
+ s[l.node.attrs.id] = p, o.currentTransactionOldBlockAttrs[l.node.attrs.id] = p, JSON.stringify(p) !== JSON.stringify(m) && (p["depth-change"] = p.depth - m.depth, o.updatedBlocks.add(l.node.attrs.id));
945
947
  }
946
948
  }
947
- return t.prevTransactionOldBlockAttrs = s, t;
949
+ return o.prevTransactionOldBlockAttrs = s, o;
948
950
  }
949
951
  },
950
952
  props: {
951
953
  decorations(e) {
952
- const t = this.getState(e);
953
- if (t.updatedBlocks.size === 0)
954
+ const o = this.getState(e);
955
+ if (o.updatedBlocks.size === 0)
954
956
  return;
955
- const o = [];
957
+ const t = [];
956
958
  return e.doc.descendants((r, s) => {
957
- if (!r.attrs.id || !t.updatedBlocks.has(r.attrs.id))
959
+ if (!r.attrs.id || !o.updatedBlocks.has(r.attrs.id))
958
960
  return;
959
- const i = t.currentTransactionOldBlockAttrs[r.attrs.id], a = {};
961
+ const i = o.currentTransactionOldBlockAttrs[r.attrs.id], a = {};
960
962
  for (const [l, u] of Object.entries(i))
961
- a["data-prev-" + Dt[l]] = u || "none";
963
+ a["data-prev-" + Ot[l]] = u || "none";
962
964
  const c = A.node(s, s + r.nodeSize, {
963
965
  ...a
964
966
  });
965
- o.push(c);
966
- }), V.create(e.doc, o);
967
+ t.push(c);
968
+ }), V.create(e.doc, t);
967
969
  }
968
970
  }
969
971
  })
@@ -971,35 +973,35 @@ const go = k(
971
973
  };
972
974
  });
973
975
  function Se(n, e) {
974
- var t, o;
975
- for (; n && n.parentElement && n.parentElement !== e.dom && ((t = n.getAttribute) == null ? void 0 : t.call(n, "data-node-type")) !== "blockContainer"; )
976
+ var o, t;
977
+ for (; n && n.parentElement && n.parentElement !== e.dom && ((o = n.getAttribute) == null ? void 0 : o.call(n, "data-node-type")) !== "blockContainer"; )
976
978
  n = n.parentElement;
977
- if (((o = n.getAttribute) == null ? void 0 : o.call(n, "data-node-type")) === "blockContainer")
979
+ if (((t = n.getAttribute) == null ? void 0 : t.call(n, "data-node-type")) === "blockContainer")
978
980
  return { node: n, id: n.getAttribute("data-id") };
979
981
  }
980
982
  function At() {
981
983
  const n = (e) => {
982
- let t = e.children.length;
983
- for (let o = 0; o < t; o++) {
984
- const r = e.children[o];
984
+ let o = e.children.length;
985
+ for (let t = 0; t < o; t++) {
986
+ const r = e.children[t];
985
987
  if (r.type === "element" && (n(r), r.tagName === "u"))
986
988
  if (r.children.length > 0) {
987
- e.children.splice(o, 1, ...r.children);
989
+ e.children.splice(t, 1, ...r.children);
988
990
  const s = r.children.length - 1;
989
- t += s, o += s;
991
+ o += s, t += s;
990
992
  } else
991
- e.children.splice(o, 1), t--, o--;
993
+ e.children.splice(t, 1), o--, t--;
992
994
  }
993
995
  };
994
996
  return n;
995
997
  }
996
998
  function Mt() {
997
999
  const n = (e) => {
998
- var t;
1000
+ var o;
999
1001
  if (e.children && "length" in e.children && e.children.length)
1000
- for (let o = e.children.length - 1; o >= 0; o--) {
1001
- const r = e.children[o], s = o + 1 < e.children.length ? e.children[o + 1] : void 0;
1002
- r.type === "element" && r.tagName === "input" && ((t = r.properties) == null ? void 0 : t.type) === "checkbox" && (s == null ? void 0 : s.type) === "element" && s.tagName === "p" ? (s.tagName = "span", s.children.splice(
1002
+ for (let t = e.children.length - 1; t >= 0; t--) {
1003
+ const r = e.children[t], s = t + 1 < e.children.length ? e.children[t + 1] : void 0;
1004
+ 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
1005
  0,
1004
1006
  0,
1005
1007
  lt(document.createTextNode(" "))
@@ -1010,11 +1012,11 @@ function Mt() {
1010
1012
  }
1011
1013
  function Nt() {
1012
1014
  return (n) => {
1013
- ct(n, "element", (e, t, o) => {
1015
+ ct(n, "element", (e, o, t) => {
1014
1016
  var r, s, i, a;
1015
- if (o && e.tagName === "video") {
1017
+ if (t && e.tagName === "video") {
1016
1018
  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"]) || "";
1017
- o.children[t] = {
1019
+ t.children[o] = {
1018
1020
  type: "text",
1019
1021
  value: `![${l}](${c})`
1020
1022
  };
@@ -1024,52 +1026,52 @@ function Nt() {
1024
1026
  }
1025
1027
  function xe(n) {
1026
1028
  return at().use(nt, { fragment: !0 }).use(Nt).use(At).use(Mt).use(rt).use(st).use(it, {
1027
- handlers: { text: (t) => t.value }
1029
+ handlers: { text: (o) => o.value }
1028
1030
  }).processSync(n).value;
1029
1031
  }
1030
- function Bo(n, e, t, o) {
1031
- const s = ke(e, t).exportBlocks(n, o);
1032
+ function Bo(n, e, o, t) {
1033
+ const s = Ce(e, o).exportBlocks(n, t);
1032
1034
  return xe(s);
1033
1035
  }
1034
1036
  function Rt(n) {
1035
1037
  const e = [];
1036
- return n.descendants((t) => {
1038
+ return n.descendants((o) => {
1037
1039
  var r, s;
1038
- const o = R(t);
1039
- return t.type.name === "blockContainer" && ((r = t.firstChild) == null ? void 0 : r.type.name) === "blockGroup" ? !0 : t.type.name === "columnList" && t.childCount === 1 ? ((s = t.firstChild) == null || s.forEach((i) => {
1040
- e.push(L(i, o));
1041
- }), !1) : t.type.isInGroup("bnBlock") ? (e.push(L(t, o)), !1) : !0;
1040
+ const t = R(o);
1041
+ 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;
1042
1044
  }), e;
1043
1045
  }
1044
1046
  class B extends N {
1045
- constructor(t, o) {
1046
- super(t, o);
1047
+ constructor(o, t) {
1048
+ super(o, t);
1047
1049
  b(this, "nodes");
1048
- const r = t.node();
1049
- this.nodes = [], t.doc.nodesBetween(t.pos, o.pos, (s, i, a) => {
1050
+ const r = o.node();
1051
+ this.nodes = [], o.doc.nodesBetween(o.pos, t.pos, (s, i, a) => {
1050
1052
  if (a !== null && a.eq(r))
1051
1053
  return this.nodes.push(s), !1;
1052
1054
  });
1053
1055
  }
1054
- static create(t, o, r = o) {
1055
- return new B(t.resolve(o), t.resolve(r));
1056
+ static create(o, t, r = t) {
1057
+ return new B(o.resolve(t), o.resolve(r));
1056
1058
  }
1057
1059
  content() {
1058
1060
  return new ot(we.from(this.nodes), 0, 0);
1059
1061
  }
1060
- eq(t) {
1061
- if (!(t instanceof B) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to)
1062
+ eq(o) {
1063
+ if (!(o instanceof B) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
1062
1064
  return !1;
1063
- for (let o = 0; o < this.nodes.length; o++)
1064
- if (!this.nodes[o].eq(t.nodes[o]))
1065
+ for (let t = 0; t < this.nodes.length; t++)
1066
+ if (!this.nodes[t].eq(o.nodes[t]))
1065
1067
  return !1;
1066
1068
  return !0;
1067
1069
  }
1068
- map(t, o) {
1069
- const r = o.mapResult(this.from), s = o.mapResult(this.to);
1070
- return s.deleted ? N.near(t.resolve(r.pos)) : r.deleted ? N.near(t.resolve(s.pos)) : new B(
1071
- t.resolve(r.pos),
1072
- t.resolve(s.pos)
1070
+ map(o, t) {
1071
+ 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(
1073
+ o.resolve(r.pos),
1074
+ o.resolve(s.pos)
1073
1075
  );
1074
1076
  }
1075
1077
  toJSON() {
@@ -1079,29 +1081,29 @@ class B extends N {
1079
1081
  N.jsonID("multiple-node", B);
1080
1082
  let E;
1081
1083
  function Lt(n, e) {
1082
- let t, o;
1084
+ let o, t;
1083
1085
  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
1086
  if (r && s) {
1085
1087
  const a = n.$from.start(i - 1), c = n.$to.end(i - 1);
1086
- t = e.resolve(a - 1).pos, o = e.resolve(c + 1).pos;
1088
+ o = e.resolve(a - 1).pos, t = e.resolve(c + 1).pos;
1087
1089
  } else
1088
- t = n.from, o = n.to;
1089
- return { from: t, to: o };
1090
+ o = n.from, t = n.to;
1091
+ return { from: o, to: t };
1090
1092
  }
1091
- function re(n, e, t = e) {
1092
- e === t && (t += n.state.doc.resolve(e + 1).node().nodeSize);
1093
- const o = n.domAtPos(e).node.cloneNode(!0), r = n.domAtPos(e).node, s = (h, g) => Array.prototype.indexOf.call(h.children, g), i = s(
1093
+ function re(n, e, o = e) {
1094
+ 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(
1094
1096
  r,
1095
1097
  // Expects from position to be just before the first selected block.
1096
1098
  n.domAtPos(e + 1).node.parentElement
1097
1099
  ), a = s(
1098
1100
  r,
1099
1101
  // Expects to position to be just after the last selected block.
1100
- n.domAtPos(t - 1).node.parentElement
1102
+ n.domAtPos(o - 1).node.parentElement
1101
1103
  );
1102
1104
  for (let h = r.childElementCount - 1; h >= 0; h--)
1103
- (h > a || h < i) && o.removeChild(o.children[h]);
1104
- Ee(n.root), E = o;
1105
+ (h > a || h < i) && t.removeChild(t.children[h]);
1106
+ Ee(n.root), E = t;
1105
1107
  const c = E.getElementsByTagName("iframe");
1106
1108
  for (let h = 0; h < c.length; h++) {
1107
1109
  const g = c[h], m = g.parentElement;
@@ -1115,30 +1117,30 @@ function re(n, e, t = e) {
1115
1117
  function Ee(n) {
1116
1118
  E !== void 0 && (n instanceof ShadowRoot ? n.removeChild(E) : n.body.removeChild(E), E = void 0);
1117
1119
  }
1118
- function Vt(n, e, t) {
1119
- if (!n.dataTransfer || t.headless)
1120
+ function Vt(n, e, o) {
1121
+ if (!n.dataTransfer || o.headless)
1120
1122
  return;
1121
- const o = t.prosemirrorView, r = me(e.id, o.state.doc);
1123
+ const t = o.prosemirrorView, r = me(e.id, t.state.doc);
1122
1124
  if (!r)
1123
1125
  throw new Error(`Block with ID ${e.id} not found`);
1124
1126
  const s = r.posBeforeNode;
1125
1127
  if (s != null) {
1126
- const i = o.state.selection, a = o.state.doc, { from: c, to: l } = Lt(i, a), u = c <= s && s < l, h = i.$anchor.node() !== i.$head.node() || i instanceof B;
1127
- u && h ? (o.dispatch(
1128
- o.state.tr.setSelection(B.create(a, c, l))
1129
- ), re(o, c, l)) : (o.dispatch(
1130
- o.state.tr.setSelection(le.create(o.state.doc, s))
1131
- ), re(o, s));
1132
- const g = o.state.selection.content(), m = t.pmSchema, p = o.serializeForClipboard(g).dom.innerHTML, d = ke(m, t), f = Rt(g.content), w = d.exportBlocks(f, {}), y = xe(w);
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;
1129
+ 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);
1133
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);
1134
1136
  }
1135
1137
  }
1136
1138
  const se = 250;
1137
- function U(n, e, t = !0) {
1138
- const o = n.root.elementsFromPoint(e.left, e.top);
1139
- for (const r of o)
1139
+ function U(n, e, o = !0) {
1140
+ const t = n.root.elementsFromPoint(e.left, e.top);
1141
+ for (const r of t)
1140
1142
  if (n.dom.contains(r))
1141
- return t && r.closest("[data-node-type=columnList]") ? U(
1143
+ return o && r.closest("[data-node-type=columnList]") ? U(
1142
1144
  n,
1143
1145
  {
1144
1146
  // TODO can we do better than this?
@@ -1152,14 +1154,14 @@ function U(n, e, t = !0) {
1152
1154
  function Ht(n, e) {
1153
1155
  if (!e.dom.firstChild)
1154
1156
  return;
1155
- const t = e.dom.firstChild.getBoundingClientRect(), o = {
1157
+ const o = e.dom.firstChild.getBoundingClientRect(), t = {
1156
1158
  // Clamps the x position to the editor's bounding box.
1157
1159
  left: Math.min(
1158
- Math.max(t.left + 10, n.x),
1159
- t.right - 10
1160
+ Math.max(o.left + 10, n.x),
1161
+ o.right - 10
1160
1162
  ),
1161
1163
  top: n.y
1162
- }, r = U(e, o);
1164
+ }, r = U(e, t);
1163
1165
  if (!r)
1164
1166
  return;
1165
1167
  const s = r.node.getBoundingClientRect();
@@ -1173,7 +1175,7 @@ function Ht(n, e) {
1173
1175
  );
1174
1176
  }
1175
1177
  class Ft {
1176
- constructor(e, t, o) {
1178
+ constructor(e, o, t) {
1177
1179
  b(this, "state");
1178
1180
  b(this, "emitUpdate");
1179
1181
  b(this, "mousePos");
@@ -1184,7 +1186,7 @@ class Ft {
1184
1186
  this.state = e, this.emitUpdate(this.state);
1185
1187
  });
1186
1188
  b(this, "updateStateFromMousePos", () => {
1187
- var o, r, s, i, a;
1189
+ var t, r, s, i, a;
1188
1190
  if (this.menuFrozen || !this.mousePos)
1189
1191
  return;
1190
1192
  const e = this.findClosestEditorElement({
@@ -1192,16 +1194,16 @@ class Ft {
1192
1194
  clientY: this.mousePos.y
1193
1195
  });
1194
1196
  if ((e == null ? void 0 : e.element) !== this.pmView.dom || e.distance > se) {
1195
- (o = this.state) != null && o.show && (this.state.show = !1, this.updateState(this.state));
1197
+ (t = this.state) != null && t.show && (this.state.show = !1, this.updateState(this.state));
1196
1198
  return;
1197
1199
  }
1198
- const t = Ht(this.mousePos, this.pmView);
1199
- if (!t || !this.editor.isEditable) {
1200
+ const o = Ht(this.mousePos, this.pmView);
1201
+ if (!o || !this.editor.isEditable) {
1200
1202
  (r = this.state) != null && r.show && (this.state.show = !1, this.updateState(this.state));
1201
1203
  return;
1202
1204
  }
1203
- if (!((s = this.state) != null && s.show && ((i = this.hoveredBlock) != null && i.hasAttribute("data-id")) && ((a = this.hoveredBlock) == null ? void 0 : a.getAttribute("data-id")) === t.id) && (this.hoveredBlock = t.node, this.editor.isEditable)) {
1204
- const c = t.node.getBoundingClientRect(), l = t.node.closest("[data-node-type=column]");
1205
+ if (!((s = this.state) != null && s.show && ((i = this.hoveredBlock) != null && i.hasAttribute("data-id")) && ((a = this.hoveredBlock) == null ? void 0 : a.getAttribute("data-id")) === o.id) && (this.hoveredBlock = o.node, this.editor.isEditable)) {
1206
+ const c = o.node.getBoundingClientRect(), l = o.node.closest("[data-node-type=column]");
1205
1207
  this.state = {
1206
1208
  show: !0,
1207
1209
  referencePos: new DOMRect(
@@ -1242,12 +1244,12 @@ class Ft {
1242
1244
  */
1243
1245
  b(this, "onDragStart", (e) => {
1244
1246
  var i;
1245
- const t = (i = e.dataTransfer) == null ? void 0 : i.getData("blocknote/html");
1246
- if (!t || this.pmView.dragging)
1247
+ const o = (i = e.dataTransfer) == null ? void 0 : i.getData("blocknote/html");
1248
+ if (!o || this.pmView.dragging)
1247
1249
  return;
1248
- const o = document.createElement("div");
1249
- o.innerHTML = t;
1250
- const s = et.fromSchema(this.pmView.state.schema).parse(o, {
1250
+ const t = document.createElement("div");
1251
+ t.innerHTML = o;
1252
+ const s = et.fromSchema(this.pmView.state.schema).parse(t, {
1251
1253
  topNode: this.pmView.state.schema.nodes.blockGroup.create()
1252
1254
  });
1253
1255
  this.pmView.dragging = {
@@ -1259,17 +1261,17 @@ class Ft {
1259
1261
  * Finds the closest editor visually to the given coordinates
1260
1262
  */
1261
1263
  b(this, "findClosestEditorElement", (e) => {
1262
- const t = Array.from(this.pmView.root.querySelectorAll(".bn-editor"));
1263
- if (t.length === 0)
1264
+ const o = Array.from(this.pmView.root.querySelectorAll(".bn-editor"));
1265
+ if (o.length === 0)
1264
1266
  return null;
1265
- let o = t[0], r = Number.MAX_VALUE;
1266
- return t.forEach((s) => {
1267
+ let t = o[0], r = Number.MAX_VALUE;
1268
+ return o.forEach((s) => {
1267
1269
  const i = s.querySelector(".bn-block-group").getBoundingClientRect(), a = e.clientX < i.left ? i.left - e.clientX : e.clientX > i.right ? e.clientX - i.right : 0, c = e.clientY < i.top ? i.top - e.clientY : e.clientY > i.bottom ? e.clientY - i.bottom : 0, l = Math.sqrt(
1268
1270
  Math.pow(a, 2) + Math.pow(c, 2)
1269
1271
  );
1270
- l < r && (r = l, o = s);
1272
+ l < r && (r = l, t = s);
1271
1273
  }), {
1272
- element: o,
1274
+ element: t,
1273
1275
  distance: r
1274
1276
  };
1275
1277
  });
@@ -1287,7 +1289,8 @@ class Ft {
1287
1289
  * 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
1290
  */
1289
1291
  b(this, "onDragOver", (e) => {
1290
- if (e.synthetic)
1292
+ var r;
1293
+ 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)))
1291
1294
  return;
1292
1295
  const t = this.getDragEventContext(e);
1293
1296
  if (!t || !t.isDropPoint) {
@@ -1312,16 +1315,18 @@ class Ft {
1312
1315
  * - Whether the drop event is within the bounds of the current editor instance
1313
1316
  */
1314
1317
  b(this, "getDragEventContext", (e) => {
1315
- var c;
1316
- const t = !((c = e.dataTransfer) != null && c.types.includes("blocknote/html")) && !!this.pmView.dragging, o = !!this.isDragOrigin, r = t || o, s = this.findClosestEditorElement(e);
1317
- if (!s || s.distance > se)
1318
+ var l, u;
1319
+ 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
1320
  return;
1319
- const i = s.element === this.pmView.dom, a = i && s.distance === 0;
1320
- if (!(!i && !r))
1321
+ 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)
1323
+ return;
1324
+ const a = i.element === this.pmView.dom, c = a && i.distance === 0;
1325
+ if (!(!a && !s))
1321
1326
  return {
1322
- isDropPoint: i,
1323
- isDropWithinEditorBounds: a,
1324
- isDragOrigin: r
1327
+ isDropPoint: a,
1328
+ isDropWithinEditorBounds: c,
1329
+ isDragOrigin: s
1325
1330
  };
1326
1331
  });
1327
1332
  /**
@@ -1338,15 +1343,16 @@ class Ft {
1338
1343
  * - Delete the dragged content from our editor after a delay
1339
1344
  */
1340
1345
  b(this, "onDrop", (e) => {
1341
- if (e.synthetic)
1346
+ var a;
1347
+ 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)))
1342
1348
  return;
1343
1349
  const t = this.getDragEventContext(e);
1344
1350
  if (!t) {
1345
1351
  this.closeDropCursor();
1346
1352
  return;
1347
1353
  }
1348
- const { isDropPoint: o, isDropWithinEditorBounds: r, isDragOrigin: s } = t;
1349
- if (!r && o && this.dispatchSyntheticEvent(e), o) {
1354
+ const { isDropPoint: r, isDropWithinEditorBounds: s, isDragOrigin: i } = t;
1355
+ if (!s && r && this.dispatchSyntheticEvent(e), r) {
1350
1356
  if (this.pmView.dragging)
1351
1357
  return;
1352
1358
  this.pmView.dispatch(
@@ -1358,7 +1364,7 @@ class Ft {
1358
1364
  )
1359
1365
  );
1360
1366
  return;
1361
- } else if (s) {
1367
+ } else if (i) {
1362
1368
  setTimeout(
1363
1369
  () => this.pmView.dispatch(this.pmView.state.tr.deleteSelection()),
1364
1370
  0
@@ -1370,18 +1376,18 @@ class Ft {
1370
1376
  e.synthetic || (this.pmView.dragging = null);
1371
1377
  });
1372
1378
  b(this, "onKeyDown", (e) => {
1373
- var t;
1374
- (t = this.state) != null && t.show && this.editor.isFocused() && (this.state.show = !1, this.emitUpdate(this.state));
1379
+ var o;
1380
+ (o = this.state) != null && o.show && this.editor.isFocused() && (this.state.show = !1, this.emitUpdate(this.state));
1375
1381
  });
1376
1382
  b(this, "onMouseMove", (e) => {
1377
1383
  var s;
1378
1384
  if (this.menuFrozen)
1379
1385
  return;
1380
1386
  this.mousePos = { x: e.clientX, y: e.clientY };
1381
- const t = this.pmView.dom.getBoundingClientRect(), o = this.mousePos.x > t.left && this.mousePos.x < t.right && this.mousePos.y > t.top && this.mousePos.y < t.bottom, r = this.pmView.dom.parentElement;
1387
+ const o = this.pmView.dom.getBoundingClientRect(), t = this.mousePos.x > o.left && this.mousePos.x < o.right && this.mousePos.y > o.top && this.mousePos.y < o.bottom, r = this.pmView.dom.parentElement;
1382
1388
  if (
1383
1389
  // Cursor is within the editor area
1384
- o && // An element is hovered
1390
+ t && // An element is hovered
1385
1391
  e && e.target && // Element is outside the editor
1386
1392
  !(r === e.target || r.contains(e.target))
1387
1393
  ) {
@@ -1390,10 +1396,10 @@ class Ft {
1390
1396
  }
1391
1397
  this.updateStateFromMousePos();
1392
1398
  });
1393
- this.editor = e, this.pmView = t, this.emitUpdate = () => {
1399
+ this.editor = e, this.pmView = o, this.emitUpdate = () => {
1394
1400
  if (!this.state)
1395
1401
  throw new Error("Attempting to update uninitialized side menu");
1396
- o(this.state);
1402
+ t(this.state);
1397
1403
  }, this.pmView.root.addEventListener(
1398
1404
  "dragstart",
1399
1405
  this.onDragStart
@@ -1419,14 +1425,14 @@ class Ft {
1419
1425
  );
1420
1426
  }
1421
1427
  dispatchSyntheticEvent(e) {
1422
- const t = new Event(e.type, e), o = this.pmView.dom.firstChild.getBoundingClientRect();
1423
- t.clientX = e.clientX, t.clientY = e.clientY, t.clientX = Math.min(
1424
- Math.max(e.clientX, o.left),
1425
- o.left + o.width
1426
- ), t.clientY = Math.min(
1427
- Math.max(e.clientY, o.top),
1428
- o.top + o.height
1429
- ), t.dataTransfer = e.dataTransfer, t.preventDefault = () => e.preventDefault(), t.synthetic = !0, this.pmView.dom.dispatchEvent(t);
1428
+ const o = new Event(e.type, e), t = this.pmView.dom.firstChild.getBoundingClientRect();
1429
+ o.clientX = e.clientX, o.clientY = e.clientY, o.clientX = Math.min(
1430
+ Math.max(e.clientX, t.left),
1431
+ t.left + t.width
1432
+ ), o.clientY = Math.min(
1433
+ Math.max(e.clientY, t.top),
1434
+ t.top + t.height
1435
+ ), o.dataTransfer = e.dataTransfer, o.preventDefault = () => e.preventDefault(), o.synthetic = !0, this.pmView.dom.dispatchEvent(o);
1430
1436
  }
1431
1437
  // Needed in cases where the editor state updates without the mouse cursor
1432
1438
  // moving, as some state updates can require a side menu update. For example,
@@ -1435,9 +1441,9 @@ class Ft {
1435
1441
  // allowing the user to click the button again without moving the cursor. This
1436
1442
  // would otherwise not update the side menu, and so clicking the button again
1437
1443
  // would attempt to remove the same block again, causing an error.
1438
- update(e, t) {
1444
+ update(e, o) {
1439
1445
  var r;
1440
- !t.doc.eq(this.pmView.state.doc) && ((r = this.state) != null && r.show) && this.updateStateFromMousePos();
1446
+ !o.doc.eq(this.pmView.state.doc) && ((r = this.state) != null && r.show) && this.updateStateFromMousePos();
1441
1447
  }
1442
1448
  destroy() {
1443
1449
  var e;
@@ -1466,27 +1472,27 @@ class Ft {
1466
1472
  );
1467
1473
  }
1468
1474
  }
1469
- const $t = new pe("SideMenuPlugin"), To = k(({ editor: n }) => {
1475
+ const $t = new pe("SideMenuPlugin"), To = C(({ editor: n }) => {
1470
1476
  let e;
1471
- const t = H(
1477
+ const o = H(
1472
1478
  void 0
1473
1479
  );
1474
1480
  return {
1475
1481
  key: "sideMenu",
1476
- store: t,
1482
+ store: o,
1477
1483
  prosemirrorPlugins: [
1478
1484
  new fe({
1479
1485
  key: $t,
1480
- view: (o) => (e = new Ft(n, o, (r) => {
1481
- t.setState({ ...r });
1486
+ view: (t) => (e = new Ft(n, t, (r) => {
1487
+ o.setState({ ...r });
1482
1488
  }), e)
1483
1489
  })
1484
1490
  ],
1485
1491
  /**
1486
1492
  * Handles drag & drop events for blocks.
1487
1493
  */
1488
- blockDragStart(o, r) {
1489
- e && (e.isDragOrigin = !0), Vt(o, r, n);
1494
+ blockDragStart(t, r) {
1495
+ e && (e.isDragOrigin = !0), Vt(t, r, n);
1490
1496
  },
1491
1497
  /**
1492
1498
  * Handles drag & drop events for blocks.
@@ -1527,10 +1533,10 @@ function _t(n) {
1527
1533
  for (; e && e.nodeName !== "TD" && e.nodeName !== "TH" && !e.classList.contains("tableWrapper"); ) {
1528
1534
  if (e.classList.contains("ProseMirror"))
1529
1535
  return;
1530
- const t = e.parentNode;
1531
- if (!t || !(t instanceof Element))
1536
+ const o = e.parentNode;
1537
+ if (!o || !(o instanceof Element))
1532
1538
  return;
1533
- e = t;
1539
+ e = o;
1534
1540
  }
1535
1541
  return e.nodeName === "TD" || e.nodeName === "TH" ? {
1536
1542
  type: "cell",
@@ -1543,12 +1549,12 @@ function _t(n) {
1543
1549
  };
1544
1550
  }
1545
1551
  function zt(n, e) {
1546
- const t = e.querySelectorAll(n);
1547
- for (let o = 0; o < t.length; o++)
1548
- t[o].style.visibility = "hidden";
1552
+ const o = e.querySelectorAll(n);
1553
+ for (let t = 0; t < o.length; t++)
1554
+ o[t].style.visibility = "hidden";
1549
1555
  }
1550
1556
  class Kt {
1551
- constructor(e, t, o) {
1557
+ constructor(e, o, t) {
1552
1558
  b(this, "state");
1553
1559
  b(this, "emitUpdate");
1554
1560
  b(this, "tableId");
@@ -1567,18 +1573,18 @@ class Kt {
1567
1573
  var l, u, h, g, m, p, d, f;
1568
1574
  if (this.menuFrozen || this.mouseState === "selecting" || !(e.target instanceof Element) || !this.pmView.dom.contains(e.target))
1569
1575
  return;
1570
- const t = _t(e.target);
1571
- if ((t == null ? void 0 : t.type) === "cell" && this.mouseState === "down" && !((l = this.state) != null && l.draggingState)) {
1576
+ const o = _t(e.target);
1577
+ if ((o == null ? void 0 : o.type) === "cell" && this.mouseState === "down" && !((l = this.state) != null && l.draggingState)) {
1572
1578
  this.mouseState = "selecting", (u = this.state) != null && u.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1573
1579
  return;
1574
1580
  }
1575
- if (!t || !this.editor.isEditable) {
1581
+ if (!o || !this.editor.isEditable) {
1576
1582
  (h = this.state) != null && h.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1577
1583
  return;
1578
1584
  }
1579
- if (!t.tbodyNode)
1585
+ if (!o.tbodyNode)
1580
1586
  return;
1581
- const o = t.tbodyNode.getBoundingClientRect(), r = Se(t.domNode, this.pmView);
1587
+ const t = o.tbodyNode.getBoundingClientRect(), r = Se(o.domNode, this.pmView);
1582
1588
  if (!r)
1583
1589
  return;
1584
1590
  this.tableElement = r.node;
@@ -1598,39 +1604,39 @@ class Kt {
1598
1604
  if (Ue(this.editor, "table") && (this.tablePos = i.posBeforeNode + 1, s = a), !s)
1599
1605
  return;
1600
1606
  this.tableId = r.id;
1601
- const c = (g = t.domNode.closest(".tableWrapper")) == null ? void 0 : g.querySelector(".table-widgets-container");
1602
- if ((t == null ? void 0 : t.type) === "wrapper") {
1603
- const w = e.clientY >= o.bottom - 1 && // -1 to account for fractions of pixels in "bottom"
1604
- e.clientY < o.bottom + 20, y = e.clientX >= o.right - 1 && e.clientX < o.right + 20, C = (
1607
+ const c = (g = o.domNode.closest(".tableWrapper")) == null ? void 0 : g.querySelector(".table-widgets-container");
1608
+ 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 = (
1605
1611
  // always hide handles when the actively hovered table changed
1606
1612
  ((m = this.state) == null ? void 0 : m.block.id) !== s.id || // make sure we don't hide existing handles (keep col / row index) when
1607
1613
  // we're hovering just above or to the right of a table
1608
- e.clientX > o.right || e.clientY > o.bottom
1614
+ e.clientX > t.right || e.clientY > t.bottom
1609
1615
  );
1610
1616
  this.state = {
1611
1617
  ...this.state,
1612
1618
  show: !0,
1613
1619
  showAddOrRemoveRowsButton: w,
1614
1620
  showAddOrRemoveColumnsButton: y,
1615
- referencePosTable: o,
1621
+ referencePosTable: t,
1616
1622
  block: s,
1617
1623
  widgetContainer: c,
1618
- colIndex: C || (p = this.state) == null ? void 0 : p.colIndex,
1619
- rowIndex: C || (d = this.state) == null ? void 0 : d.rowIndex,
1620
- referencePosCell: C || (f = this.state) == null ? void 0 : f.referencePosCell
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
1621
1627
  };
1622
1628
  } else {
1623
- const w = M(t.domNode), y = M(t.domNode.parentElement), C = t.domNode.getBoundingClientRect();
1629
+ const w = M(o.domNode), y = M(o.domNode.parentElement), v = o.domNode.getBoundingClientRect();
1624
1630
  if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex === y && this.state.colIndex === w)
1625
1631
  return;
1626
1632
  this.state = {
1627
1633
  show: !0,
1628
1634
  showAddOrRemoveColumnsButton: w === s.content.rows[0].cells.length - 1,
1629
1635
  showAddOrRemoveRowsButton: y === s.content.rows.length - 1,
1630
- referencePosTable: o,
1636
+ referencePosTable: t,
1631
1637
  block: s,
1632
1638
  draggingState: void 0,
1633
- referencePosCell: C,
1639
+ referencePosCell: v,
1634
1640
  colIndex: w,
1635
1641
  rowIndex: y,
1636
1642
  widgetContainer: c
@@ -1646,7 +1652,7 @@ class Kt {
1646
1652
  ".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",
1647
1653
  this.pmView.root
1648
1654
  );
1649
- const t = {
1655
+ const o = {
1650
1656
  left: Math.min(
1651
1657
  Math.max(e.clientX, this.state.referencePosTable.left + 1),
1652
1658
  this.state.referencePosTable.right - 1
@@ -1655,17 +1661,17 @@ class Kt {
1655
1661
  Math.max(e.clientY, this.state.referencePosTable.top + 1),
1656
1662
  this.state.referencePosTable.bottom - 1
1657
1663
  )
1658
- }, o = this.pmView.root.elementsFromPoint(t.left, t.top).filter(
1664
+ }, t = this.pmView.root.elementsFromPoint(o.left, o.top).filter(
1659
1665
  (m) => m.tagName === "TD" || m.tagName === "TH"
1660
1666
  );
1661
- if (o.length === 0)
1667
+ if (t.length === 0)
1662
1668
  return;
1663
- const r = o[0];
1669
+ const r = t[0];
1664
1670
  let s = !1;
1665
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;
1666
1672
  (this.state.rowIndex !== i || this.state.colIndex !== a) && (this.state.rowIndex = i, this.state.colIndex = a, this.state.referencePosCell = r.getBoundingClientRect(), s = !0);
1667
- const h = this.state.draggingState.draggedCellOrientation === "row" ? t.top : t.left;
1668
- this.state.draggingState.mousePos !== h && (this.state.draggingState.mousePos = h, s = !0), s && this.emitUpdate(), u && this.editor.transact((m) => m.setMeta(D, !0));
1673
+ 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));
1669
1675
  });
1670
1676
  b(this, "dropHandler", (e) => {
1671
1677
  if (this.mouseState = "up", this.state === void 0 || this.state.draggingState === void 0)
@@ -1675,17 +1681,17 @@ class Kt {
1675
1681
  "Attempted to drop table row or column, but no table block was hovered prior."
1676
1682
  );
1677
1683
  e.preventDefault();
1678
- const { draggingState: t, colIndex: o, rowIndex: r } = this.state, s = this.state.block.content.columnWidths;
1679
- if (t.draggedCellOrientation === "row") {
1684
+ const { draggingState: o, colIndex: t, rowIndex: r } = this.state, s = this.state.block.content.columnWidths;
1685
+ if (o.draggedCellOrientation === "row") {
1680
1686
  if (!de(
1681
1687
  this.state.block,
1682
- t.originalIndex,
1688
+ o.originalIndex,
1683
1689
  r
1684
1690
  ))
1685
1691
  return !1;
1686
1692
  const i = Re(
1687
1693
  this.state.block,
1688
- t.originalIndex,
1694
+ o.originalIndex,
1689
1695
  r
1690
1696
  );
1691
1697
  this.editor.updateBlock(this.state.block, {
@@ -1698,16 +1704,16 @@ class Kt {
1698
1704
  } else {
1699
1705
  if (!ue(
1700
1706
  this.state.block,
1701
- t.originalIndex,
1702
- o
1707
+ o.originalIndex,
1708
+ t
1703
1709
  ))
1704
1710
  return !1;
1705
1711
  const i = Le(
1706
1712
  this.state.block,
1707
- t.originalIndex,
1708
- o
1709
- ), [a] = s.splice(t.originalIndex, 1);
1710
- s.splice(o, 0, a), this.editor.updateBlock(this.state.block, {
1713
+ o.originalIndex,
1714
+ t
1715
+ ), [a] = s.splice(o.originalIndex, 1);
1716
+ s.splice(t, 0, a), this.editor.updateBlock(this.state.block, {
1711
1717
  type: "table",
1712
1718
  content: {
1713
1719
  ...this.state.block.content,
@@ -1718,14 +1724,14 @@ class Kt {
1718
1724
  }
1719
1725
  return this.editor.setTextCursorPosition(this.state.block.id), !0;
1720
1726
  });
1721
- this.editor = e, this.pmView = t, this.emitUpdate = () => {
1727
+ this.editor = e, this.pmView = o, this.emitUpdate = () => {
1722
1728
  if (!this.state)
1723
1729
  throw new Error("Attempting to update uninitialized image toolbar");
1724
- o(this.state);
1725
- }, t.dom.addEventListener("mousemove", this.mouseMoveHandler), t.dom.addEventListener("mousedown", this.viewMousedownHandler), window.addEventListener("mouseup", this.mouseUpHandler), t.root.addEventListener(
1730
+ t(this.state);
1731
+ }, o.dom.addEventListener("mousemove", this.mouseMoveHandler), o.dom.addEventListener("mousedown", this.viewMousedownHandler), window.addEventListener("mouseup", this.mouseUpHandler), o.root.addEventListener(
1726
1732
  "dragover",
1727
1733
  this.dragOverHandler
1728
- ), t.root.addEventListener(
1734
+ ), o.root.addEventListener(
1729
1735
  "drop",
1730
1736
  this.dropHandler
1731
1737
  );
@@ -1741,20 +1747,20 @@ class Kt {
1741
1747
  this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate();
1742
1748
  return;
1743
1749
  }
1744
- const { height: e, width: t } = Ve(
1750
+ const { height: e, width: o } = Ve(
1745
1751
  this.state.block
1746
1752
  );
1747
- this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= e && (this.state.rowIndex = e - 1), this.state.colIndex >= t && (this.state.colIndex = t - 1));
1748
- const o = this.tableElement.querySelector("tbody");
1749
- if (!o)
1753
+ 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));
1754
+ const t = this.tableElement.querySelector("tbody");
1755
+ if (!t)
1750
1756
  throw new Error(
1751
1757
  "Table block does not contain a 'tbody' HTML element. This should never happen."
1752
1758
  );
1753
1759
  if (this.state.rowIndex !== void 0 && this.state.colIndex !== void 0) {
1754
- const i = o.children[this.state.rowIndex].children[this.state.colIndex];
1760
+ const i = t.children[this.state.rowIndex].children[this.state.colIndex];
1755
1761
  i ? this.state.referencePosCell = i.getBoundingClientRect() : (this.state.rowIndex = void 0, this.state.colIndex = void 0);
1756
1762
  }
1757
- this.state.referencePosTable = o.getBoundingClientRect(), this.emitUpdate();
1763
+ this.state.referencePosTable = t.getBoundingClientRect(), this.emitUpdate();
1758
1764
  }
1759
1765
  destroy() {
1760
1766
  this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler), window.removeEventListener("mouseup", this.mouseUpHandler), this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.root.removeEventListener(
@@ -1766,17 +1772,17 @@ class Kt {
1766
1772
  );
1767
1773
  }
1768
1774
  }
1769
- const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1775
+ const O = new P("TableHandlesPlugin"), Po = C(({ editor: n }) => {
1770
1776
  let e;
1771
- const t = H(void 0);
1777
+ const o = H(void 0);
1772
1778
  return {
1773
1779
  key: "tableHandles",
1774
- store: t,
1780
+ store: o,
1775
1781
  prosemirrorPlugins: [
1776
1782
  new T({
1777
- key: D,
1778
- view: (o) => (e = new Kt(n, o, (r) => {
1779
- t.setState(
1783
+ key: O,
1784
+ view: (t) => (e = new Kt(n, t, (r) => {
1785
+ o.setState(
1780
1786
  r.block ? {
1781
1787
  ...r,
1782
1788
  draggingState: r.draggingState ? { ...r.draggingState } : void 0
@@ -1786,7 +1792,7 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1786
1792
  // We use decorations to render the drop cursor when dragging a table row
1787
1793
  // or column. The decorations are updated in the `dragOverHandler` method.
1788
1794
  props: {
1789
- decorations: (o) => {
1795
+ decorations: (t) => {
1790
1796
  if (e === void 0 || e.state === void 0 || e.state.draggingState === void 0 || e.tablePos === void 0)
1791
1797
  return;
1792
1798
  const r = e.state.draggingState.draggedCellOrientation === "row" ? e.state.rowIndex : e.state.colIndex;
@@ -1794,15 +1800,15 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1794
1800
  return;
1795
1801
  const s = [], { block: i, draggingState: a } = e.state, { originalIndex: c, draggedCellOrientation: l } = a;
1796
1802
  if (r === c || !i || l === "row" && !de(i, c, r) || l === "col" && !ue(i, c, r))
1797
- return V.create(o.doc, s);
1798
- const u = o.doc.resolve(e.tablePos + 1);
1803
+ return V.create(t.doc, s);
1804
+ const u = t.doc.resolve(e.tablePos + 1);
1799
1805
  return e.state.draggingState.draggedCellOrientation === "row" ? G(
1800
1806
  e.state.block,
1801
1807
  r
1802
1808
  ).forEach(({ row: g, col: m }) => {
1803
- const p = o.doc.resolve(
1809
+ const p = t.doc.resolve(
1804
1810
  u.posAtIndex(g) + 1
1805
- ), d = o.doc.resolve(
1811
+ ), d = t.doc.resolve(
1806
1812
  p.posAtIndex(m) + 1
1807
1813
  ), f = d.node(), w = d.pos + (r > c ? f.nodeSize - 2 : 0);
1808
1814
  s.push(
@@ -1816,9 +1822,9 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1816
1822
  e.state.block,
1817
1823
  r
1818
1824
  ).forEach(({ row: g, col: m }) => {
1819
- const p = o.doc.resolve(
1825
+ const p = t.doc.resolve(
1820
1826
  u.posAtIndex(g) + 1
1821
- ), d = o.doc.resolve(
1827
+ ), d = t.doc.resolve(
1822
1828
  p.posAtIndex(m) + 1
1823
1829
  ), f = d.node(), w = d.pos + (r > c ? f.nodeSize - 2 : 0);
1824
1830
  s.push(
@@ -1828,7 +1834,7 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1828
1834
  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;
1829
1835
  })
1830
1836
  );
1831
- }), V.create(o.doc, s);
1837
+ }), V.create(t.doc, s);
1832
1838
  }
1833
1839
  }
1834
1840
  })
@@ -1837,7 +1843,7 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1837
1843
  * Callback that should be set on the `dragStart` event for whichever element
1838
1844
  * is used as the column drag handle.
1839
1845
  */
1840
- colDragStart(o) {
1846
+ colDragStart(t) {
1841
1847
  if (e === void 0 || e.state === void 0 || e.state.colIndex === void 0)
1842
1848
  throw new Error(
1843
1849
  "Attempted to drag table column, but no table block was hovered prior."
@@ -1845,21 +1851,21 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1845
1851
  e.state.draggingState = {
1846
1852
  draggedCellOrientation: "col",
1847
1853
  originalIndex: e.state.colIndex,
1848
- mousePos: o.clientX
1854
+ mousePos: t.clientX
1849
1855
  }, e.emitUpdate(), n.transact(
1850
- (r) => r.setMeta(D, {
1856
+ (r) => r.setMeta(O, {
1851
1857
  draggedCellOrientation: e.state.draggingState.draggedCellOrientation,
1852
1858
  originalIndex: e.state.colIndex,
1853
1859
  newIndex: e.state.colIndex,
1854
1860
  tablePos: e.tablePos
1855
1861
  })
1856
- ), !n.headless && (ie(n.prosemirrorView.root), o.dataTransfer.setDragImage(S, 0, 0), o.dataTransfer.effectAllowed = "move");
1862
+ ), !n.headless && (ie(n.prosemirrorView.root), t.dataTransfer.setDragImage(S, 0, 0), t.dataTransfer.effectAllowed = "move");
1857
1863
  },
1858
1864
  /**
1859
1865
  * Callback that should be set on the `dragStart` event for whichever element
1860
1866
  * is used as the row drag handle.
1861
1867
  */
1862
- rowDragStart(o) {
1868
+ rowDragStart(t) {
1863
1869
  if (e.state === void 0 || e.state.rowIndex === void 0)
1864
1870
  throw new Error(
1865
1871
  "Attempted to drag table row, but no table block was hovered prior."
@@ -1867,15 +1873,15 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1867
1873
  e.state.draggingState = {
1868
1874
  draggedCellOrientation: "row",
1869
1875
  originalIndex: e.state.rowIndex,
1870
- mousePos: o.clientY
1876
+ mousePos: t.clientY
1871
1877
  }, e.emitUpdate(), n.transact(
1872
- (r) => r.setMeta(D, {
1878
+ (r) => r.setMeta(O, {
1873
1879
  draggedCellOrientation: e.state.draggingState.draggedCellOrientation,
1874
1880
  originalIndex: e.state.rowIndex,
1875
1881
  newIndex: e.state.rowIndex,
1876
1882
  tablePos: e.tablePos
1877
1883
  })
1878
- ), !n.headless && (ie(n.prosemirrorView.root), o.dataTransfer.setDragImage(S, 0, 0), o.dataTransfer.effectAllowed = "copyMove");
1884
+ ), !n.headless && (ie(n.prosemirrorView.root), t.dataTransfer.setDragImage(S, 0, 0), t.dataTransfer.effectAllowed = "copyMove");
1879
1885
  },
1880
1886
  /**
1881
1887
  * Callback that should be set on the `dragEnd` event for both the element
@@ -1886,7 +1892,7 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1886
1892
  throw new Error(
1887
1893
  "Attempted to drag table row, but no table block was hovered prior."
1888
1894
  );
1889
- e.state.draggingState = void 0, e.emitUpdate(), n.transact((o) => o.setMeta(D, null)), !n.headless && Ut(n.prosemirrorView.root);
1895
+ e.state.draggingState = void 0, e.emitUpdate(), n.transact((t) => t.setMeta(O, null)), !n.headless && Ut(n.prosemirrorView.root);
1890
1896
  },
1891
1897
  /**
1892
1898
  * Freezes the drag handles. When frozen, they will stay attached to the same
@@ -1902,45 +1908,45 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1902
1908
  unfreezeHandles() {
1903
1909
  e.menuFrozen = !1;
1904
1910
  },
1905
- getCellsAtRowHandle(o, r) {
1906
- return G(o, r);
1911
+ getCellsAtRowHandle(t, r) {
1912
+ return G(t, r);
1907
1913
  },
1908
1914
  /**
1909
1915
  * Get all the cells in a column of the table block.
1910
1916
  */
1911
- getCellsAtColumnHandle(o, r) {
1912
- return W(o, r);
1917
+ getCellsAtColumnHandle(t, r) {
1918
+ return W(t, r);
1913
1919
  },
1914
1920
  /**
1915
1921
  * Sets the selection to the given cell or a range of cells.
1916
1922
  * @returns The new state after the selection has been set.
1917
1923
  */
1918
- setCellSelection(o, r, s = r) {
1924
+ setCellSelection(t, r, s = r) {
1919
1925
  if (!e)
1920
1926
  throw new Error("Table handles view not initialized");
1921
- const i = o.doc.resolve(e.tablePos + 1), a = o.doc.resolve(
1927
+ const i = t.doc.resolve(e.tablePos + 1), a = t.doc.resolve(
1922
1928
  i.posAtIndex(r.row) + 1
1923
- ), c = o.doc.resolve(
1929
+ ), c = t.doc.resolve(
1924
1930
  // No need for +1, since CellSelection expects the position before the cell
1925
1931
  a.posAtIndex(r.col)
1926
- ), l = o.doc.resolve(
1932
+ ), l = t.doc.resolve(
1927
1933
  i.posAtIndex(s.row) + 1
1928
- ), u = o.doc.resolve(
1934
+ ), u = t.doc.resolve(
1929
1935
  // No need for +1, since CellSelection expects the position before the cell
1930
1936
  l.posAtIndex(s.col)
1931
- ), h = o.tr;
1937
+ ), h = t.tr;
1932
1938
  return h.setSelection(
1933
1939
  new yt(c, u)
1934
- ), o.apply(h);
1940
+ ), t.apply(h);
1935
1941
  },
1936
1942
  /**
1937
1943
  * Adds a row or column to the table using prosemirror-table commands
1938
1944
  */
1939
- addRowOrColumn(o, r) {
1945
+ addRowOrColumn(t, r) {
1940
1946
  n.exec((s, i) => {
1941
1947
  const a = this.setCellSelection(
1942
1948
  s,
1943
- r.orientation === "row" ? { row: o, col: 0 } : { row: 0, col: o }
1949
+ r.orientation === "row" ? { row: t, col: 0 } : { row: 0, col: t }
1944
1950
  );
1945
1951
  return r.orientation === "row" ? r.side === "above" ? pt(a, i) : ft(a, i) : r.side === "left" ? gt(a, i) : wt(a, i);
1946
1952
  });
@@ -1948,17 +1954,17 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1948
1954
  /**
1949
1955
  * Removes a row or column from the table using prosemirror-table commands
1950
1956
  */
1951
- removeRowOrColumn(o, r) {
1957
+ removeRowOrColumn(t, r) {
1952
1958
  return r === "row" ? n.exec((s, i) => {
1953
1959
  const a = this.setCellSelection(s, {
1954
- row: o,
1960
+ row: t,
1955
1961
  col: 0
1956
1962
  });
1957
1963
  return ht(a, i);
1958
1964
  }) : n.exec((s, i) => {
1959
1965
  const a = this.setCellSelection(s, {
1960
1966
  row: 0,
1961
- col: o
1967
+ col: t
1962
1968
  });
1963
1969
  return mt(a, i);
1964
1970
  });
@@ -1966,12 +1972,12 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1966
1972
  /**
1967
1973
  * Merges the cells in the table block.
1968
1974
  */
1969
- mergeCells(o) {
1975
+ mergeCells(t) {
1970
1976
  return n.exec((r, s) => {
1971
- const i = o ? this.setCellSelection(
1977
+ const i = t ? this.setCellSelection(
1972
1978
  r,
1973
- o.relativeStartCell,
1974
- o.relativeEndCell
1979
+ t.relativeStartCell,
1980
+ t.relativeEndCell
1975
1981
  ) : r;
1976
1982
  return ut(i, s);
1977
1983
  });
@@ -1980,9 +1986,9 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1980
1986
  * Splits the cell in the table block.
1981
1987
  * If no cell is provided, the current cell selected will be split.
1982
1988
  */
1983
- splitCell(o) {
1989
+ splitCell(t) {
1984
1990
  return n.exec((r, s) => {
1985
- const i = o ? this.setCellSelection(r, o) : r;
1991
+ const i = t ? this.setCellSelection(r, t) : r;
1986
1992
  return dt(i, s);
1987
1993
  });
1988
1994
  },
@@ -1991,23 +1997,23 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
1991
1997
  * @returns The start and end cells of the current cell selection.
1992
1998
  */
1993
1999
  getCellSelection() {
1994
- return n.transact((o) => {
1995
- const r = o.selection;
2000
+ return n.transact((t) => {
2001
+ const r = t.selection;
1996
2002
  let s = r.$from, i = r.$to;
1997
2003
  if (Q(r)) {
1998
2004
  const { ranges: d } = r;
1999
2005
  d.forEach((f) => {
2000
2006
  s = f.$from.min(s ?? f.$from), i = f.$to.max(i ?? f.$to);
2001
2007
  });
2002
- } else if (s = o.doc.resolve(
2008
+ } else if (s = t.doc.resolve(
2003
2009
  r.$from.pos - r.$from.parentOffset - 1
2004
- ), i = o.doc.resolve(
2010
+ ), i = t.doc.resolve(
2005
2011
  r.$to.pos - r.$to.parentOffset - 1
2006
2012
  ), s.pos === 0 || i.pos === 0)
2007
2013
  return;
2008
- const a = o.doc.resolve(
2014
+ const a = t.doc.resolve(
2009
2015
  s.pos - s.parentOffset - 1
2010
- ), c = o.doc.resolve(i.pos - i.parentOffset - 1), l = o.doc.resolve(a.pos - a.parentOffset - 1), u = s.index(a.depth), h = a.index(l.depth), g = i.index(c.depth), m = c.index(l.depth), p = [];
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 = [];
2011
2017
  for (let d = h; d <= m; d++)
2012
2018
  for (let f = u; f <= g; f++)
2013
2019
  p.push({ row: d, col: f });
@@ -2029,31 +2035,31 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
2029
2035
  *
2030
2036
  * Returns undefined when there is no cell selection, or the selection is not within a table.
2031
2037
  */
2032
- getMergeDirection(o) {
2038
+ getMergeDirection(t) {
2033
2039
  return n.transact((r) => {
2034
2040
  const s = Q(r.selection) ? r.selection : void 0;
2035
- if (!s || !o || // Only offer the merge button if there is more than one cell selected.
2041
+ if (!s || !t || // Only offer the merge button if there is more than one cell selected.
2036
2042
  s.ranges.length <= 1)
2037
2043
  return;
2038
2044
  const i = this.getCellSelection();
2039
2045
  if (i)
2040
- return $e(i.from, i.to, o) ? "vertical" : "horizontal";
2046
+ return $e(i.from, i.to, t) ? "vertical" : "horizontal";
2041
2047
  });
2042
2048
  },
2043
- cropEmptyRowsOrColumns(o, r) {
2044
- return Fe(o, r);
2049
+ cropEmptyRowsOrColumns(t, r) {
2050
+ return Fe(t, r);
2045
2051
  },
2046
- addRowsOrColumns(o, r, s) {
2047
- return He(o, r, s);
2052
+ addRowsOrColumns(t, r, s) {
2053
+ return He(t, r, s);
2048
2054
  }
2049
2055
  };
2050
- }), ae = new P("trailingNode"), Oo = k(() => ({
2056
+ }), ae = new P("trailingNode"), Do = C(() => ({
2051
2057
  key: "trailingNode",
2052
2058
  prosemirrorPlugins: [
2053
2059
  new T({
2054
2060
  key: ae,
2055
- appendTransaction: (n, e, t) => {
2056
- const { doc: o, tr: r, schema: s } = t, i = ae.getState(t), a = o.content.size - 2, c = s.nodes.blockContainer, l = s.nodes.paragraph;
2061
+ 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;
2057
2063
  if (i)
2058
2064
  return r.insert(
2059
2065
  a,
@@ -2066,15 +2072,15 @@ const D = new P("TableHandlesPlugin"), Po = k(({ editor: n }) => {
2066
2072
  apply: (n, e) => {
2067
2073
  if (!n.docChanged)
2068
2074
  return e;
2069
- let t = n.doc.lastChild;
2070
- if (!t || t.type.name !== "blockGroup")
2075
+ let o = n.doc.lastChild;
2076
+ if (!o || o.type.name !== "blockGroup")
2071
2077
  throw new Error("Expected blockGroup");
2072
- if (t = t.lastChild, !t || t.type.name !== "blockContainer")
2078
+ if (o = o.lastChild, !o || o.type.name !== "blockContainer")
2073
2079
  return !0;
2074
- const o = t.firstChild;
2075
- if (!o)
2080
+ const t = o.firstChild;
2081
+ if (!t)
2076
2082
  throw new Error("Expected blockContent");
2077
- return t.nodeSize > 4 || o.type.spec.content !== "inline*";
2083
+ return o.nodeSize > 4 || t.type.spec.content !== "inline*";
2078
2084
  }
2079
2085
  }
2080
2086
  })
@@ -2084,13 +2090,13 @@ export {
2084
2090
  fo as B,
2085
2091
  yo as D,
2086
2092
  go as F,
2087
- vo as H,
2088
- ko as L,
2093
+ ko as H,
2094
+ Co as L,
2089
2095
  xo as N,
2090
2096
  Eo as P,
2091
2097
  wo as S,
2092
2098
  Kt as T,
2093
- Co as V,
2099
+ vo as V,
2094
2100
  oe as Y,
2095
2101
  F as a,
2096
2102
  $ as b,
@@ -2100,13 +2106,13 @@ export {
2100
2106
  Ft as f,
2101
2107
  To as g,
2102
2108
  Po as h,
2103
- Oo as i,
2109
+ Do as i,
2104
2110
  xt as j,
2105
- ke as k,
2111
+ Ce as k,
2106
2112
  Bo as l,
2107
2113
  xe as m,
2108
2114
  Rt as n,
2109
2115
  $t as s,
2110
- D as t
2116
+ O as t
2111
2117
  };
2112
- //# sourceMappingURL=TrailingNode-CxM966vN.js.map
2118
+ //# sourceMappingURL=TrailingNode-F9hX_UlQ.js.map