@blocknote/core 0.8.0 → 0.8.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 (34) hide show
  1. package/dist/blocknote.js +594 -503
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +6 -2
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/package.json +3 -3
  7. package/src/BlockNoteEditor.ts +18 -0
  8. package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +292 -0
  9. package/src/api/nodeConversions/nodeConversions.test.ts +236 -0
  10. package/src/api/nodeConversions/nodeConversions.ts +166 -35
  11. package/src/editor.module.css +5 -5
  12. package/src/extensions/Blocks/nodes/Block.module.css +4 -4
  13. package/src/extensions/Blocks/nodes/BlockContainer.ts +12 -3
  14. package/src/extensions/DraggableBlocks/BlockSideMenuFactoryTypes.ts +2 -2
  15. package/src/extensions/DraggableBlocks/DraggableBlocksPlugin.ts +59 -24
  16. package/src/extensions/FormattingToolbar/FormattingToolbarFactoryTypes.ts +4 -6
  17. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +28 -35
  18. package/src/extensions/HyperlinkToolbar/HyperlinkToolbarFactoryTypes.ts +2 -2
  19. package/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.ts +38 -10
  20. package/src/shared/EditorElement.ts +3 -3
  21. package/src/shared/plugins/suggestion/SuggestionPlugin.ts +23 -17
  22. package/src/shared/plugins/suggestion/SuggestionsMenuFactoryTypes.ts +2 -2
  23. package/types/src/BlockNoteEditor.d.ts +2 -0
  24. package/types/src/extensions/DraggableBlocks/BlockSideMenuFactoryTypes.d.ts +1 -1
  25. package/types/src/extensions/DraggableBlocks/DraggableBlocksPlugin.d.ts +2 -2
  26. package/types/src/extensions/FormattingToolbar/FormattingToolbarFactoryTypes.d.ts +2 -3
  27. package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +2 -3
  28. package/types/src/extensions/HyperlinkToolbar/HyperlinkToolbarFactoryTypes.d.ts +1 -1
  29. package/types/src/extensions/Placeholder/localisation/index.d.ts +2 -0
  30. package/types/src/extensions/Placeholder/localisation/translation.d.ts +51 -0
  31. package/types/src/shared/EditorElement.d.ts +3 -3
  32. package/types/src/shared/plugins/suggestion/SuggestionsMenuFactoryTypes.d.ts +1 -1
  33. package/types/src/extensions/Blocks/api/alertBlock.d.ts +0 -13
  34. package/types/src/extensions/Blocks/api/alertBlock2.d.ts +0 -13
package/dist/blocknote.js CHANGED
@@ -1,61 +1,61 @@
1
- var Lt = Object.defineProperty;
2
- var At = (o, e, t) => e in o ? Lt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var h = (o, e, t) => (At(o, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { Node as R, InputRule as V, mergeAttributes as w, Extension as v, findChildren as j, combineTransactionSteps as Nt, getChangedRanges as Ht, findChildrenInRange as Ot, Mark as it, findParentNode as Dt, isTextSelection as Ft, isNodeSelection as Rt, posToDOMRect as st, getMarkRange as Q, extensions as A, Editor as zt } from "@tiptap/core";
5
- import { PluginKey as E, Plugin as C, TextSelection as tt, Selection as G, NodeSelection as Ut } from "prosemirror-state";
6
- import { Slice as I, Fragment as _, DOMSerializer as q, DOMParser as $t } from "prosemirror-model";
7
- import { v4 as Gt } from "uuid";
8
- import at from "rehype-parse";
9
- import jt from "rehype-remark";
10
- import lt from "rehype-stringify";
11
- import dt from "remark-gfm";
12
- import qt from "remark-parse";
13
- import Wt from "remark-rehype";
14
- import Vt from "remark-stringify";
1
+ var Nt = Object.defineProperty;
2
+ var Lt = (o, e, t) => e in o ? Nt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var h = (o, e, t) => (Lt(o, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { Node as R, InputRule as V, mergeAttributes as x, Extension as v, findChildren as j, combineTransactionSteps as Ht, getChangedRanges as Ot, findChildrenInRange as Dt, Mark as st, findParentNode as Ft, isTextSelection as Rt, isNodeSelection as zt, posToDOMRect as at, getMarkRange as Q, extensions as N, Editor as Ut } from "@tiptap/core";
5
+ import { PluginKey as E, Plugin as C, TextSelection as tt, Selection as G, NodeSelection as $t } from "prosemirror-state";
6
+ import { Slice as T, Fragment as P, DOMSerializer as q, DOMParser as Gt } from "prosemirror-model";
7
+ import { v4 as jt } from "uuid";
8
+ import lt from "rehype-parse";
9
+ import qt from "rehype-remark";
10
+ import dt from "rehype-stringify";
11
+ import ct from "remark-gfm";
12
+ import Wt from "remark-parse";
13
+ import Vt from "remark-rehype";
14
+ import Yt from "remark-stringify";
15
15
  import { unified as Y } from "unified";
16
16
  import { fromDom as et } from "hast-util-from-dom";
17
- import { Bold as Yt } from "@tiptap/extension-bold";
18
- import { Code as Kt } from "@tiptap/extension-code";
19
- import Jt from "@tiptap/extension-collaboration";
20
- import Xt from "@tiptap/extension-collaboration-cursor";
21
- import { Dropcursor as Zt } from "@tiptap/extension-dropcursor";
22
- import { Gapcursor as Qt } from "@tiptap/extension-gapcursor";
23
- import { HardBreak as te } from "@tiptap/extension-hard-break";
24
- import { History as ee } from "@tiptap/extension-history";
25
- import { Italic as oe } from "@tiptap/extension-italic";
26
- import { Link as ct } from "@tiptap/extension-link";
27
- import { Strike as ne } from "@tiptap/extension-strike";
28
- import { Text as re } from "@tiptap/extension-text";
29
- import { Underline as ie } from "@tiptap/extension-underline";
30
- import * as se from "prosemirror-view";
17
+ import { Bold as Kt } from "@tiptap/extension-bold";
18
+ import { Code as Jt } from "@tiptap/extension-code";
19
+ import Xt from "@tiptap/extension-collaboration";
20
+ import Zt from "@tiptap/extension-collaboration-cursor";
21
+ import { Dropcursor as Qt } from "@tiptap/extension-dropcursor";
22
+ import { Gapcursor as te } from "@tiptap/extension-gapcursor";
23
+ import { HardBreak as ee } from "@tiptap/extension-hard-break";
24
+ import { History as oe } from "@tiptap/extension-history";
25
+ import { Italic as ne } from "@tiptap/extension-italic";
26
+ import { Link as ut } from "@tiptap/extension-link";
27
+ import { Strike as re } from "@tiptap/extension-strike";
28
+ import { Text as ie } from "@tiptap/extension-text";
29
+ import { Underline as se } from "@tiptap/extension-underline";
30
+ import * as ae from "prosemirror-view";
31
31
  import { Decoration as D, DecorationSet as F } from "prosemirror-view";
32
- const ut = "_blockOuter_1a5p7_5", ht = "_block_1a5p7_5", pt = "_reactNodeViewRenderer_1a5p7_17", mt = "_blockContent_1a5p7_22", ft = "_blockGroup_1a5p7_42", gt = "_isEmpty_1a5p7_240", kt = "_inlineContent_1a5p7_240", bt = "_isFilter_1a5p7_241", yt = "_hasAnchor_1a5p7_263", k = {
33
- blockOuter: ut,
34
- block: ht,
35
- reactNodeViewRenderer: pt,
32
+ const ht = "_blockOuter_xgzwr_5", pt = "_block_xgzwr_5", ft = "_reactNodeViewRenderer_xgzwr_17", mt = "_blockContent_xgzwr_22", gt = "_blockGroup_xgzwr_42", kt = "_isEmpty_xgzwr_240", yt = "_inlineContent_xgzwr_240", bt = "_isFilter_xgzwr_241", vt = "_hasAnchor_xgzwr_263", k = {
33
+ blockOuter: ht,
34
+ block: pt,
35
+ reactNodeViewRenderer: ft,
36
36
  blockContent: mt,
37
- blockGroup: ft,
38
- isEmpty: gt,
39
- inlineContent: kt,
37
+ blockGroup: gt,
38
+ isEmpty: kt,
39
+ inlineContent: yt,
40
40
  isFilter: bt,
41
- hasAnchor: yt
41
+ hasAnchor: vt
42
42
  }, Vo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
43
43
  __proto__: null,
44
- block: ht,
44
+ block: pt,
45
45
  blockContent: mt,
46
- blockGroup: ft,
47
- blockOuter: ut,
46
+ blockGroup: gt,
47
+ blockOuter: ht,
48
48
  default: k,
49
- hasAnchor: yt,
50
- inlineContent: kt,
51
- isEmpty: gt,
49
+ hasAnchor: vt,
50
+ inlineContent: yt,
51
+ isEmpty: kt,
52
52
  isFilter: bt,
53
- reactNodeViewRenderer: pt
53
+ reactNodeViewRenderer: ft
54
54
  }, Symbol.toStringTag, { value: "Module" }));
55
55
  function ot(o) {
56
56
  return "data-" + o.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
57
57
  }
58
- function ae(o) {
58
+ function le(o) {
59
59
  const e = {};
60
60
  return Object.entries(o.propSchema).forEach(([t, n]) => {
61
61
  e[t] = {
@@ -71,14 +71,14 @@ function ae(o) {
71
71
  };
72
72
  }), e;
73
73
  }
74
- function le(o) {
74
+ function de(o) {
75
75
  return [
76
76
  {
77
77
  tag: "div[data-content-type=" + o.type + "]"
78
78
  }
79
79
  ];
80
80
  }
81
- function de(o, e) {
81
+ function ce(o, e) {
82
82
  const t = document.createElement("div");
83
83
  t.setAttribute("data-content-type", o.type);
84
84
  for (const [r, i] of Object.entries(e))
@@ -103,26 +103,26 @@ function Yo(o) {
103
103
  };
104
104
  },
105
105
  addAttributes() {
106
- return ae(o);
106
+ return le(o);
107
107
  },
108
108
  parseHTML() {
109
- return le(o);
109
+ return de(o);
110
110
  },
111
111
  renderHTML({ HTMLAttributes: t }) {
112
- return de(o, t);
112
+ return ce(o, t);
113
113
  },
114
114
  addNodeView() {
115
115
  return ({ HTMLAttributes: t, getPos: n }) => {
116
116
  const r = document.createElement("div");
117
117
  r.className = k.blockContent, r.setAttribute("data-content-type", o.type);
118
- for (const [p, m] of Object.entries(t))
119
- r.setAttribute(p, m);
118
+ for (const [p, f] of Object.entries(t))
119
+ r.setAttribute(p, f);
120
120
  const i = this.options.editor;
121
121
  if (typeof n == "boolean")
122
122
  throw new Error(
123
123
  "Cannot find node position as getPos is a boolean, not a function."
124
124
  );
125
- const a = n(), d = i._tiptapEditor.state.doc.resolve(a).node().attrs.id, c = i.getBlock(d);
125
+ const s = n(), d = i._tiptapEditor.state.doc.resolve(s).node().attrs.id, c = i.getBlock(d);
126
126
  if (c.type !== o.type)
127
127
  throw new Error("Block type does not match");
128
128
  const u = o.render(c, i);
@@ -144,7 +144,7 @@ function H(o) {
144
144
  group: "blockContent"
145
145
  });
146
146
  }
147
- const ce = H({
147
+ const ue = H({
148
148
  name: "heading",
149
149
  content: "inline*",
150
150
  addAttributes() {
@@ -196,7 +196,7 @@ const ce = H({
196
196
  renderHTML({ node: o, HTMLAttributes: e }) {
197
197
  return [
198
198
  "div",
199
- w(e, {
199
+ x(e, {
200
200
  class: k.blockContent,
201
201
  "data-content-type": this.name
202
202
  }),
@@ -216,11 +216,11 @@ function g(o, e) {
216
216
  break;
217
217
  i -= 1, r = t.node(i);
218
218
  }
219
- const a = r.attrs.id, s = r.firstChild, l = s.type, d = r.childCount === 2 ? r.lastChild.childCount : 0, c = t.start(i), u = t.end(i);
219
+ const s = r.attrs.id, a = r.firstChild, l = a.type, d = r.childCount === 2 ? r.lastChild.childCount : 0, c = t.start(i), u = t.end(i);
220
220
  return {
221
- id: a,
221
+ id: s,
222
222
  node: r,
223
- contentNode: s,
223
+ contentNode: a,
224
224
  contentType: l,
225
225
  numChildBlocks: d,
226
226
  startPos: c,
@@ -228,15 +228,15 @@ function g(o, e) {
228
228
  depth: i
229
229
  };
230
230
  }
231
- const vt = (o) => {
231
+ const Et = (o) => {
232
232
  const { node: e, contentType: t } = g(
233
233
  o.state.doc,
234
234
  o.state.selection.from
235
235
  ), n = o.state.selection.anchor === o.state.selection.head;
236
- return !t.name.endsWith("ListItem") || !n ? !1 : o.commands.first(({ state: r, chain: i, commands: a }) => [
236
+ return !t.name.endsWith("ListItem") || !n ? !1 : o.commands.first(({ state: r, chain: i, commands: s }) => [
237
237
  () => (
238
238
  // Changes list item block to a text block if the content is empty.
239
- a.command(() => e.textContent.length === 0 ? a.BNUpdateBlock(r.selection.from, {
239
+ s.command(() => e.textContent.length === 0 ? s.BNUpdateBlock(r.selection.from, {
240
240
  type: "paragraph",
241
241
  props: {}
242
242
  }) : !1)
@@ -244,10 +244,10 @@ const vt = (o) => {
244
244
  () => (
245
245
  // Splits the current block, moving content inside that's after the cursor to a new block of the same type
246
246
  // below.
247
- a.command(() => e.textContent.length > 0 ? (i().deleteSelection().BNSplitBlock(r.selection.from, !0).run(), !0) : !1)
247
+ s.command(() => e.textContent.length > 0 ? (i().deleteSelection().BNSplitBlock(r.selection.from, !0).run(), !0) : !1)
248
248
  )
249
249
  ]);
250
- }, ue = H({
250
+ }, he = H({
251
251
  name: "bulletListItem",
252
252
  content: "inline*",
253
253
  addInputRules() {
@@ -266,7 +266,7 @@ const vt = (o) => {
266
266
  },
267
267
  addKeyboardShortcuts() {
268
268
  return {
269
- Enter: () => vt(this.editor)
269
+ Enter: () => Et(this.editor)
270
270
  };
271
271
  },
272
272
  parseHTML() {
@@ -299,39 +299,39 @@ const vt = (o) => {
299
299
  renderHTML({ HTMLAttributes: o }) {
300
300
  return [
301
301
  "div",
302
- w(o, {
302
+ x(o, {
303
303
  class: k.blockContent,
304
304
  "data-content-type": this.name
305
305
  }),
306
306
  ["p", { class: k.inlineContent }, 0]
307
307
  ];
308
308
  }
309
- }), he = new E("numbered-list-indexing"), pe = () => new C({
310
- key: he,
309
+ }), pe = new E("numbered-list-indexing"), fe = () => new C({
310
+ key: pe,
311
311
  appendTransaction: (o, e, t) => {
312
312
  const n = t.tr;
313
313
  n.setMeta("numberedListIndexing", !0);
314
314
  let r = !1;
315
- return t.doc.descendants((i, a) => {
315
+ return t.doc.descendants((i, s) => {
316
316
  if (i.type.name === "blockContainer" && i.firstChild.type.name === "numberedListItem") {
317
- let s = "1";
318
- const l = a === 1, d = g(n.doc, a + 1);
317
+ let a = "1";
318
+ const l = s === 1, d = g(n.doc, s + 1);
319
319
  if (d === void 0)
320
320
  return;
321
321
  if (!l) {
322
- const p = g(n.doc, a - 2);
322
+ const p = g(n.doc, s - 2);
323
323
  if (p === void 0)
324
324
  return;
325
325
  if (!(d.depth !== p.depth)) {
326
- const f = p.contentNode;
326
+ const m = p.contentNode;
327
327
  if (p.contentType.name === "numberedListItem") {
328
- const U = f.attrs.index;
329
- s = (parseInt(U) + 1).toString();
328
+ const U = m.attrs.index;
329
+ a = (parseInt(U) + 1).toString();
330
330
  }
331
331
  }
332
332
  }
333
- d.contentNode.attrs.index !== s && (r = !0, n.setNodeMarkup(a + 1, void 0, {
334
- index: s
333
+ d.contentNode.attrs.index !== a && (r = !0, n.setNodeMarkup(s + 1, void 0, {
334
+ index: a
335
335
  }));
336
336
  }
337
337
  }), r ? n : null;
@@ -366,11 +366,11 @@ const vt = (o) => {
366
366
  },
367
367
  addKeyboardShortcuts() {
368
368
  return {
369
- Enter: () => vt(this.editor)
369
+ Enter: () => Et(this.editor)
370
370
  };
371
371
  },
372
372
  addProseMirrorPlugins() {
373
- return [pe()];
373
+ return [fe()];
374
374
  },
375
375
  parseHTML() {
376
376
  return [
@@ -404,7 +404,7 @@ const vt = (o) => {
404
404
  renderHTML({ HTMLAttributes: o }) {
405
405
  return [
406
406
  "div",
407
- w(o, {
407
+ x(o, {
408
408
  class: k.blockContent,
409
409
  "data-content-type": this.name
410
410
  }),
@@ -413,7 +413,7 @@ const vt = (o) => {
413
413
  ["p", { class: k.inlineContent }, 0]
414
414
  ];
415
415
  }
416
- }), fe = H({
416
+ }), ge = H({
417
417
  name: "paragraph",
418
418
  content: "inline*",
419
419
  parseHTML() {
@@ -428,14 +428,14 @@ const vt = (o) => {
428
428
  renderHTML({ HTMLAttributes: o }) {
429
429
  return [
430
430
  "div",
431
- w(o, {
431
+ x(o, {
432
432
  class: k.blockContent,
433
433
  "data-content-type": this.name
434
434
  }),
435
435
  ["p", { class: k.inlineContent }, 0]
436
436
  ];
437
437
  }
438
- }), N = {
438
+ }), L = {
439
439
  backgroundColor: {
440
440
  default: "transparent"
441
441
  },
@@ -447,28 +447,28 @@ const vt = (o) => {
447
447
  default: "left",
448
448
  values: ["left", "center", "right", "justify"]
449
449
  }
450
- }, ge = {
450
+ }, ke = {
451
451
  paragraph: {
452
- propSchema: N,
453
- node: fe
452
+ propSchema: L,
453
+ node: ge
454
454
  },
455
455
  heading: {
456
456
  propSchema: {
457
- ...N,
457
+ ...L,
458
458
  level: { default: "1", values: ["1", "2", "3"] }
459
459
  },
460
- node: ce
460
+ node: ue
461
461
  },
462
462
  bulletListItem: {
463
- propSchema: N,
464
- node: ue
463
+ propSchema: L,
464
+ node: he
465
465
  },
466
466
  numberedListItem: {
467
- propSchema: N,
467
+ propSchema: L,
468
468
  node: me
469
469
  }
470
470
  };
471
- function ke(o, e = JSON.stringify) {
471
+ function ye(o, e = JSON.stringify) {
472
472
  const t = {};
473
473
  return o.filter((n) => {
474
474
  const r = e(n);
@@ -479,7 +479,7 @@ function be(o) {
479
479
  const e = o.filter(
480
480
  (n, r) => o.indexOf(n) !== r
481
481
  );
482
- return ke(e);
482
+ return ye(e);
483
483
  }
484
484
  const K = v.create({
485
485
  name: "uniqueID",
@@ -490,7 +490,7 @@ const K = v.create({
490
490
  return {
491
491
  attributeName: "id",
492
492
  types: [],
493
- generateID: () => window.__TEST_OPTIONS ? (window.__TEST_OPTIONS.mockID === void 0 ? window.__TEST_OPTIONS.mockID = 0 : window.__TEST_OPTIONS.mockID++, window.__TEST_OPTIONS.mockID.toString()) : Gt(),
493
+ generateID: () => window.__TEST_OPTIONS ? (window.__TEST_OPTIONS.mockID === void 0 ? window.__TEST_OPTIONS.mockID = 0 : window.__TEST_OPTIONS.mockID++, window.__TEST_OPTIONS.mockID.toString()) : jt(),
494
494
  filterTransaction: null
495
495
  };
496
496
  },
@@ -516,11 +516,11 @@ const K = v.create({
516
516
  (l) => l.name === "collaboration"
517
517
  ))
518
518
  return;
519
- const { view: o, state: e } = this.editor, { tr: t, doc: n } = e, { types: r, attributeName: i, generateID: a } = this.options;
519
+ const { view: o, state: e } = this.editor, { tr: t, doc: n } = e, { types: r, attributeName: i, generateID: s } = this.options;
520
520
  j(n, (l) => r.includes(l.type.name) && l.attrs[i] === null).forEach(({ node: l, pos: d }) => {
521
521
  t.setNodeMarkup(d, void 0, {
522
522
  ...l.attrs,
523
- [i]: a()
523
+ [i]: s()
524
524
  });
525
525
  }), t.setMeta("addToHistory", !1), o.dispatch(t);
526
526
  },
@@ -530,40 +530,40 @@ const K = v.create({
530
530
  new C({
531
531
  key: new E("uniqueID"),
532
532
  appendTransaction: (t, n, r) => {
533
- const i = t.some((f) => f.docChanged) && !n.doc.eq(r.doc), a = this.options.filterTransaction && t.some((f) => {
534
- var y, b;
535
- return !(!((b = (y = this.options).filterTransaction) === null || b === void 0) && b.call(y, f));
533
+ const i = t.some((m) => m.docChanged) && !n.doc.eq(r.doc), s = this.options.filterTransaction && t.some((m) => {
534
+ var b, y;
535
+ return !(!((y = (b = this.options).filterTransaction) === null || y === void 0) && y.call(b, m));
536
536
  });
537
- if (!i || a)
537
+ if (!i || s)
538
538
  return;
539
- const { tr: s } = r, { types: l, attributeName: d, generateID: c } = this.options, u = Nt(
539
+ const { tr: a } = r, { types: l, attributeName: d, generateID: c } = this.options, u = Ht(
540
540
  n.doc,
541
541
  t
542
542
  ), { mapping: p } = u;
543
- if (Ht(u).forEach(({ newRange: f }) => {
544
- const y = Ot(
543
+ if (Ot(u).forEach(({ newRange: m }) => {
544
+ const b = Dt(
545
545
  r.doc,
546
- f,
547
- (M) => l.includes(M.type.name)
548
- ), b = y.map(({ node: M }) => M.attrs[d]).filter((M) => M !== null), U = be(b);
549
- y.forEach(({ node: M, pos: O }) => {
546
+ m,
547
+ (B) => l.includes(B.type.name)
548
+ ), y = b.map(({ node: B }) => B.attrs[d]).filter((B) => B !== null), U = be(y);
549
+ b.forEach(({ node: B, pos: O }) => {
550
550
  var $;
551
- const Z = ($ = s.doc.nodeAt(O)) === null || $ === void 0 ? void 0 : $.attrs[d];
551
+ const Z = ($ = a.doc.nodeAt(O)) === null || $ === void 0 ? void 0 : $.attrs[d];
552
552
  if (Z === null) {
553
- s.setNodeMarkup(O, void 0, {
554
- ...M.attrs,
553
+ a.setNodeMarkup(O, void 0, {
554
+ ...B.attrs,
555
555
  [d]: c()
556
556
  });
557
557
  return;
558
558
  }
559
- const { deleted: Pt } = p.invert().mapResult(O);
560
- Pt && U.includes(Z) && s.setNodeMarkup(O, void 0, {
561
- ...M.attrs,
559
+ const { deleted: At } = p.invert().mapResult(O);
560
+ At && U.includes(Z) && a.setNodeMarkup(O, void 0, {
561
+ ...B.attrs,
562
562
  [d]: c()
563
563
  });
564
564
  });
565
- }), !!s.steps.length)
566
- return s;
565
+ }), !!a.steps.length)
566
+ return a;
567
567
  },
568
568
  // we register a global drag handler to track the current drag source element
569
569
  view(t) {
@@ -595,15 +595,15 @@ const K = v.create({
595
595
  transformPasted: (t) => {
596
596
  if (!e)
597
597
  return t;
598
- const { types: n, attributeName: r } = this.options, i = (a) => {
599
- const s = [];
600
- return a.forEach((l) => {
598
+ const { types: n, attributeName: r } = this.options, i = (s) => {
599
+ const a = [];
600
+ return s.forEach((l) => {
601
601
  if (l.isText) {
602
- s.push(l);
602
+ a.push(l);
603
603
  return;
604
604
  }
605
605
  if (!n.includes(l.type.name)) {
606
- s.push(l.copy(i(l.content)));
606
+ a.push(l.copy(i(l.content)));
607
607
  return;
608
608
  }
609
609
  const d = l.type.create(
@@ -614,10 +614,10 @@ const K = v.create({
614
614
  i(l.content),
615
615
  l.marks
616
616
  );
617
- s.push(d);
618
- }), _.from(s);
617
+ a.push(d);
618
+ }), P.from(a);
619
619
  };
620
- return e = !1, new I(
620
+ return e = !1, new T(
621
621
  i(t.content),
622
622
  t.openStart,
623
623
  t.openEnd
@@ -628,47 +628,56 @@ const K = v.create({
628
628
  ];
629
629
  }
630
630
  });
631
- class ye extends Error {
631
+ class ve extends Error {
632
632
  constructor(e) {
633
633
  super(`Unreachable case: ${e}`);
634
634
  }
635
635
  }
636
- const Et = /* @__PURE__ */ new Set([
636
+ const Ct = /* @__PURE__ */ new Set([
637
637
  "bold",
638
638
  "italic",
639
639
  "underline",
640
640
  "strike",
641
641
  "code"
642
- ]), Ct = /* @__PURE__ */ new Set(["textColor", "backgroundColor"]);
643
- function ve(o, e) {
642
+ ]), Bt = /* @__PURE__ */ new Set(["textColor", "backgroundColor"]);
643
+ function nt(o, e) {
644
644
  const t = [];
645
645
  for (const [n, r] of Object.entries(o.styles))
646
- Et.has(n) ? t.push(e.mark(n)) : Ct.has(n) && t.push(e.mark(n, { color: r }));
647
- return e.text(o.text, t);
646
+ Ct.has(n) ? t.push(e.mark(n)) : Bt.has(n) && t.push(e.mark(n, { color: r }));
647
+ return o.text.split(/(\n)/g).filter((n) => n.length > 0).map((n) => n === `
648
+ ` ? e.nodes.hardBreak.create() : e.text(n, t));
648
649
  }
649
650
  function Ee(o, e) {
650
651
  const t = e.marks.link.create({
651
652
  href: o.href
652
653
  });
653
- return Mt(o.content, e).map((n) => n.mark([...n.marks, t]));
654
+ return wt(o.content, e).map((n) => {
655
+ if (n.type.name === "text")
656
+ return n.mark([...n.marks, t]);
657
+ if (n.type.name === "hardBreak")
658
+ return n;
659
+ throw new Error("unexpected node type");
660
+ });
654
661
  }
655
- function Mt(o, e) {
662
+ function wt(o, e) {
656
663
  let t = [];
657
664
  if (typeof o == "string")
658
- return t.push(e.text(o)), t;
665
+ return t.push(
666
+ ...nt({ type: "text", text: o, styles: {} }, e)
667
+ ), t;
659
668
  for (const n of o)
660
- t.push(ve(n, e));
669
+ t.push(...nt(n, e));
661
670
  return t;
662
671
  }
663
- function Bt(o, e) {
672
+ function Mt(o, e) {
664
673
  let t = [];
665
674
  for (const n of o)
666
675
  if (n.type === "link")
667
676
  t.push(...Ee(n, e));
668
677
  else if (n.type === "text")
669
- t.push(...Mt([n], e));
678
+ t.push(...wt([n], e));
670
679
  else
671
- throw new ye(n);
680
+ throw new ve(n);
672
681
  return t;
673
682
  }
674
683
  function z(o, e) {
@@ -685,42 +694,69 @@ function z(o, e) {
685
694
  e.text(o.content)
686
695
  );
687
696
  else {
688
- const s = Bt(o.content, e);
689
- r = e.nodes[n].create(o.props, s);
697
+ const a = Mt(o.content, e);
698
+ r = e.nodes[n].create(o.props, a);
690
699
  }
691
700
  const i = [];
692
701
  if (o.children)
693
- for (const s of o.children)
694
- i.push(z(s, e));
695
- const a = e.nodes.blockGroup.create({}, i);
702
+ for (const a of o.children)
703
+ i.push(z(a, e));
704
+ const s = e.nodes.blockGroup.create({}, i);
696
705
  return e.nodes.blockContainer.create(
697
706
  {
698
707
  id: t,
699
708
  ...o.props
700
709
  },
701
- i.length > 0 ? [r, a] : r
710
+ i.length > 0 ? [r, s] : r
702
711
  );
703
712
  }
704
713
  function Ce(o) {
705
714
  const e = [];
706
715
  let t;
707
716
  return o.content.forEach((n) => {
717
+ if (n.type.name === "hardBreak") {
718
+ t ? t.type === "text" ? t.text += `
719
+ ` : t.type === "link" && (t.content[t.content.length - 1].text += `
720
+ `) : t = {
721
+ type: "text",
722
+ text: `
723
+ `,
724
+ styles: {}
725
+ };
726
+ return;
727
+ }
708
728
  const r = {};
709
729
  let i;
710
- for (const a of n.marks)
711
- if (a.type.name === "link")
712
- i = a;
713
- else if (Et.has(a.type.name))
714
- r[a.type.name] = !0;
715
- else if (Ct.has(a.type.name))
716
- r[a.type.name] = a.attrs.color;
730
+ for (const s of n.marks)
731
+ if (s.type.name === "link")
732
+ i = s;
733
+ else if (Ct.has(s.type.name))
734
+ r[s.type.name] = !0;
735
+ else if (Bt.has(s.type.name))
736
+ r[s.type.name] = s.attrs.color;
717
737
  else
718
- throw Error("Mark is of an unrecognized type: " + a.type.name);
719
- i && t && i.attrs.href === t.href ? t.content.push({
738
+ throw Error("Mark is of an unrecognized type: " + s.type.name);
739
+ t ? t.type === "text" ? i ? (e.push(t), t = {
740
+ type: "link",
741
+ href: i.attrs.href,
742
+ content: [
743
+ {
744
+ type: "text",
745
+ text: n.textContent,
746
+ styles: r
747
+ }
748
+ ]
749
+ }) : JSON.stringify(t.styles) === JSON.stringify(r) ? t.text += n.textContent : (e.push(t), t = {
750
+ type: "text",
751
+ text: n.textContent,
752
+ styles: r
753
+ }) : t.type === "link" && (i ? t.href === i.attrs.href ? JSON.stringify(
754
+ t.content[t.content.length - 1].styles
755
+ ) === JSON.stringify(r) ? t.content[t.content.length - 1].text += n.textContent : t.content.push({
720
756
  type: "text",
721
757
  text: n.textContent,
722
758
  styles: r
723
- }) : i ? (t = {
759
+ }) : (e.push(t), t = {
724
760
  type: "link",
725
761
  href: i.attrs.href,
726
762
  content: [
@@ -730,14 +766,28 @@ function Ce(o) {
730
766
  styles: r
731
767
  }
732
768
  ]
733
- }, e.push(t)) : (e.push({
769
+ }) : (e.push(t), t = {
734
770
  type: "text",
735
771
  text: n.textContent,
736
772
  styles: r
737
- }), t = void 0);
738
- }), e;
773
+ })) : i ? t = {
774
+ type: "link",
775
+ href: i.attrs.href,
776
+ content: [
777
+ {
778
+ type: "text",
779
+ text: n.textContent,
780
+ styles: r
781
+ }
782
+ ]
783
+ } : t = {
784
+ type: "text",
785
+ text: n.textContent,
786
+ styles: r
787
+ };
788
+ }), t && e.push(t), e;
739
789
  }
740
- function B(o, e, t) {
790
+ function w(o, e, t) {
741
791
  if (o.type.name !== "blockContainer")
742
792
  throw Error(
743
793
  "Node must be of type blockContainer, but is of type" + o.type.name + "."
@@ -748,7 +798,7 @@ function B(o, e, t) {
748
798
  const r = g(o, 0);
749
799
  let i = r.id;
750
800
  i === null && (i = K.options.generateID());
751
- const a = {};
801
+ const s = {};
752
802
  for (const [c, u] of Object.entries({
753
803
  ...r.node.attrs,
754
804
  ...r.contentNode.attrs
@@ -758,19 +808,19 @@ function B(o, e, t) {
758
808
  throw Error(
759
809
  "Block is of an unrecognized type: " + r.contentType.name
760
810
  );
761
- const m = p.propSchema;
762
- c in m ? a[c] = u : c !== "id" && !(c in N) && console.warn("Block has an unrecognized attribute: " + c);
811
+ const f = p.propSchema;
812
+ c in f ? s[c] = u : c !== "id" && !(c in L) && console.warn("Block has an unrecognized attribute: " + c);
763
813
  }
764
- const s = Ce(r.contentNode), l = [];
814
+ const a = Ce(r.contentNode), l = [];
765
815
  for (let c = 0; c < r.numChildBlocks; c++)
766
816
  l.push(
767
- B(r.node.lastChild.child(c), e, t)
817
+ w(r.node.lastChild.child(c), e, t)
768
818
  );
769
819
  const d = {
770
820
  id: i,
771
821
  type: r.contentType.name,
772
- props: a,
773
- content: s,
822
+ props: s,
823
+ content: a,
774
824
  children: l
775
825
  };
776
826
  return t == null || t.set(o, d), d;
@@ -788,29 +838,29 @@ function Tt(o, e, t = "before", n) {
788
838
  const r = typeof e == "string" ? e : e.id, i = [];
789
839
  for (const d of o)
790
840
  i.push(z(d, n.schema));
791
- let a = -1;
792
- const { node: s, posBeforeNode: l } = J(r, n.state.doc);
793
- if (t === "before" && (a = l), t === "after" && (a = l + s.nodeSize), t === "nested") {
794
- if (s.childCount < 2) {
795
- a = l + s.firstChild.nodeSize + 1;
841
+ let s = -1;
842
+ const { node: a, posBeforeNode: l } = J(r, n.state.doc);
843
+ if (t === "before" && (s = l), t === "after" && (s = l + a.nodeSize), t === "nested") {
844
+ if (a.childCount < 2) {
845
+ s = l + a.firstChild.nodeSize + 1;
796
846
  const d = n.state.schema.nodes.blockGroup.create(
797
847
  {},
798
848
  i
799
849
  );
800
850
  n.view.dispatch(
801
- n.state.tr.insert(a, d)
851
+ n.state.tr.insert(s, d)
802
852
  );
803
853
  return;
804
854
  }
805
- a = l + s.firstChild.nodeSize + 2;
855
+ s = l + a.firstChild.nodeSize + 2;
806
856
  }
807
- n.view.dispatch(n.state.tr.insert(a, i));
857
+ n.view.dispatch(n.state.tr.insert(s, i));
808
858
  }
809
- function Me(o, e, t) {
859
+ function Be(o, e, t) {
810
860
  const n = typeof o == "string" ? o : o.id, { posBeforeNode: r } = J(n, t.state.doc);
811
861
  t.commands.BNUpdateBlock(r + 1, e);
812
862
  }
813
- function wt(o, e) {
863
+ function xt(o, e) {
814
864
  const t = new Set(
815
865
  o.map(
816
866
  (r) => typeof r == "string" ? r : r.id
@@ -823,10 +873,10 @@ function wt(o, e) {
823
873
  if (r.type.name !== "blockContainer" || !t.has(r.attrs.id))
824
874
  return !0;
825
875
  t.delete(r.attrs.id);
826
- const a = e.state.doc.nodeSize;
827
- e.commands.BNDeleteBlock(i - n + 1);
828
876
  const s = e.state.doc.nodeSize;
829
- return n += a - s, !1;
877
+ e.commands.BNDeleteBlock(i - n + 1);
878
+ const a = e.state.doc.nodeSize;
879
+ return n += s - a, !1;
830
880
  }), t.size > 0) {
831
881
  let r = [...t].join(`
832
882
  `);
@@ -835,10 +885,10 @@ function wt(o, e) {
835
885
  );
836
886
  }
837
887
  }
838
- function Be(o, e, t) {
839
- Tt(e, o[0], "before", t), wt(o, t);
888
+ function we(o, e, t) {
889
+ Tt(e, o[0], "before", t), xt(o, t);
840
890
  }
841
- function Te() {
891
+ function Me() {
842
892
  const o = (e) => {
843
893
  let t = e.children.length;
844
894
  for (let n = 0; n < t; n++) {
@@ -854,41 +904,41 @@ function Te() {
854
904
  };
855
905
  return o;
856
906
  }
857
- function we(o) {
907
+ function Te(o) {
858
908
  const e = /* @__PURE__ */ new Set([
859
909
  ...o.orderedListItemBlockTypes,
860
910
  ...o.unorderedListItemBlockTypes
861
911
  ]), t = (n) => {
862
912
  let r = n.children.length, i;
863
- for (let a = 0; a < r; a++) {
864
- const l = n.children[a].children[0], d = l.children[0], c = l.children.length === 2 ? l.children[1] : null, u = e.has(
913
+ for (let s = 0; s < r; s++) {
914
+ const l = n.children[s].children[0], d = l.children[0], c = l.children.length === 2 ? l.children[1] : null, u = e.has(
865
915
  d.properties.dataContentType
866
916
  ), p = u ? o.orderedListItemBlockTypes.has(
867
917
  d.properties.dataContentType
868
918
  ) ? "ol" : "ul" : null;
869
919
  if (c !== null && t(c), i && i.tagName !== p) {
870
920
  n.children.splice(
871
- a - i.children.length,
921
+ s - i.children.length,
872
922
  i.children.length,
873
923
  i
874
924
  );
875
- const m = i.children.length - 1;
876
- a -= m, r -= m, i = void 0;
925
+ const f = i.children.length - 1;
926
+ s -= f, r -= f, i = void 0;
877
927
  }
878
928
  if (u) {
879
929
  i || (i = et(
880
930
  document.createElement(p)
881
931
  ));
882
- const m = et(
932
+ const f = et(
883
933
  document.createElement("li")
884
934
  );
885
- m.children.push(d.children[0]), c !== null && m.children.push(...c.children), i.children.push(m);
935
+ f.children.push(d.children[0]), c !== null && f.children.push(...c.children), i.children.push(f);
886
936
  } else if (c !== null) {
887
- n.children.splice(a + 1, 0, ...c.children), n.children[a] = d.children[0];
888
- const m = c.children.length;
889
- a += m, r += m;
937
+ n.children.splice(s + 1, 0, ...c.children), n.children[s] = d.children[0];
938
+ const f = c.children.length;
939
+ s += f, r += f;
890
940
  } else
891
- n.children[a] = d.children[0];
941
+ n.children[s] = d.children[0];
892
942
  }
893
943
  i && n.children.splice(
894
944
  r - i.children.length,
@@ -901,37 +951,37 @@ function we(o) {
901
951
  async function St(o, e) {
902
952
  const t = document.createElement("div"), n = q.fromSchema(e);
903
953
  for (const i of o) {
904
- const a = z(i, e), s = n.serializeNode(a);
905
- t.appendChild(s);
954
+ const s = z(i, e), a = n.serializeNode(s);
955
+ t.appendChild(a);
906
956
  }
907
- return (await Y().use(at, { fragment: !0 }).use(we, {
957
+ return (await Y().use(lt, { fragment: !0 }).use(Te, {
908
958
  orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
909
959
  unorderedListItemBlockTypes: /* @__PURE__ */ new Set(["bulletListItem"])
910
- }).use(lt).process(t.innerHTML)).value;
960
+ }).use(dt).process(t.innerHTML)).value;
911
961
  }
912
- async function xt(o, e, t) {
962
+ async function It(o, e, t) {
913
963
  const n = document.createElement("div");
914
964
  n.innerHTML = o.trim();
915
- const i = $t.fromSchema(t).parse(n), a = [];
916
- for (let s = 0; s < i.firstChild.childCount; s++)
917
- a.push(B(i.firstChild.child(s), e));
918
- return a;
965
+ const i = Gt.fromSchema(t).parse(n), s = [];
966
+ for (let a = 0; a < i.firstChild.childCount; a++)
967
+ s.push(w(i.firstChild.child(a), e));
968
+ return s;
919
969
  }
920
- async function Se(o, e) {
921
- return (await Y().use(at, { fragment: !0 }).use(Te).use(jt).use(dt).use(Vt).process(await St(o, e))).value;
970
+ async function xe(o, e) {
971
+ return (await Y().use(lt, { fragment: !0 }).use(Me).use(qt).use(ct).use(Yt).process(await St(o, e))).value;
922
972
  }
923
- async function xe(o, e, t) {
924
- const n = await Y().use(qt).use(dt).use(Wt).use(lt).process(o);
925
- return xt(n.value, e, t);
973
+ async function Se(o, e, t) {
974
+ const n = await Y().use(Wt).use(ct).use(Vt).use(dt).process(o);
975
+ return It(n.value, e, t);
926
976
  }
927
- const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14aht_35", Le = "_dragPreview_14aht_68", P = {
977
+ const Ie = "_bnEditor_4vj2p_3", Pe = "_bnRoot_4vj2p_20", _e = "_defaultStyles_4vj2p_35", Ae = "_dragPreview_4vj2p_68", _ = {
928
978
  bnEditor: Ie,
929
- bnRoot: _e,
930
- defaultStyles: Pe,
931
- dragPreview: Le,
932
- "collaboration-cursor__caret": "_collaboration-cursor__caret_14aht_74",
933
- "collaboration-cursor__label": "_collaboration-cursor__label_14aht_85"
934
- }, Ae = v.create({
979
+ bnRoot: Pe,
980
+ defaultStyles: _e,
981
+ dragPreview: Ae,
982
+ "collaboration-cursor__caret": "_collaboration-cursor__caret_4vj2p_74",
983
+ "collaboration-cursor__label": "_collaboration-cursor__label_4vj2p_85"
984
+ }, Ne = v.create({
935
985
  name: "blockBackgroundColor",
936
986
  addGlobalAttributes() {
937
987
  return [
@@ -961,7 +1011,7 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
961
1011
  }
962
1012
  };
963
1013
  }
964
- }), Ne = it.create({
1014
+ }), Le = st.create({
965
1015
  name: "backgroundColor",
966
1016
  addAttributes() {
967
1017
  return {
@@ -990,7 +1040,7 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
990
1040
  setBackgroundColor: (o) => ({ commands: e }) => o !== "default" ? e.setMark(this.name, { color: o }) : e.unsetMark(this.name)
991
1041
  };
992
1042
  }
993
- }), nt = new E("previous-blocks"), He = {
1043
+ }), rt = new E("previous-blocks"), He = {
994
1044
  // Numbered List Items
995
1045
  index: "index",
996
1046
  // Headings
@@ -1002,14 +1052,14 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1002
1052
  }, Oe = () => {
1003
1053
  let o;
1004
1054
  return new C({
1005
- key: nt,
1055
+ key: rt,
1006
1056
  view(e) {
1007
1057
  return {
1008
1058
  update: async (t, n) => {
1009
1059
  var r;
1010
1060
  ((r = this.key) == null ? void 0 : r.getState(t.state).updatedBlocks.size) > 0 && (o = setTimeout(() => {
1011
1061
  t.dispatch(
1012
- t.state.tr.setMeta(nt, { clearUpdate: !0 })
1062
+ t.state.tr.setMeta(rt, { clearUpdate: !0 })
1013
1063
  );
1014
1064
  }, 0));
1015
1065
  },
@@ -1032,25 +1082,25 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1032
1082
  apply(e, t, n, r) {
1033
1083
  if (t.currentTransactionOldBlockAttrs = {}, t.updatedBlocks.clear(), !e.docChanged || n.doc.eq(r.doc))
1034
1084
  return t;
1035
- const i = {}, a = j(n.doc, (d) => d.attrs.id), s = new Map(
1036
- a.map((d) => [d.node.attrs.id, d])
1085
+ const i = {}, s = j(n.doc, (d) => d.attrs.id), a = new Map(
1086
+ s.map((d) => [d.node.attrs.id, d])
1037
1087
  ), l = j(r.doc, (d) => d.attrs.id);
1038
1088
  for (let d of l) {
1039
- const c = s.get(d.node.attrs.id), u = c == null ? void 0 : c.node.firstChild, p = d.node.firstChild;
1089
+ const c = a.get(d.node.attrs.id), u = c == null ? void 0 : c.node.firstChild, p = d.node.firstChild;
1040
1090
  if (c && u && p) {
1041
- const m = {
1091
+ const f = {
1042
1092
  index: p.attrs.index,
1043
1093
  level: p.attrs.level,
1044
1094
  type: p.type.name,
1045
1095
  depth: r.doc.resolve(d.pos).depth
1046
1096
  };
1047
- let f = {
1097
+ let m = {
1048
1098
  index: u.attrs.index,
1049
1099
  level: u.attrs.level,
1050
1100
  type: u.type.name,
1051
1101
  depth: n.doc.resolve(c.pos).depth
1052
1102
  };
1053
- i[d.node.attrs.id] = f, e.getMeta("numberedListIndexing") && (d.node.attrs.id in t.prevTransactionOldBlockAttrs && (f = t.prevTransactionOldBlockAttrs[d.node.attrs.id]), m.type === "numberedListItem" && (f.index = m.index)), t.currentTransactionOldBlockAttrs[d.node.attrs.id] = f, JSON.stringify(f) !== JSON.stringify(m) && (f["depth-change"] = f.depth - m.depth, t.updatedBlocks.add(d.node.attrs.id));
1103
+ i[d.node.attrs.id] = m, e.getMeta("numberedListIndexing") && (d.node.attrs.id in t.prevTransactionOldBlockAttrs && (m = t.prevTransactionOldBlockAttrs[d.node.attrs.id]), f.type === "numberedListItem" && (m.index = f.index)), t.currentTransactionOldBlockAttrs[d.node.attrs.id] = m, JSON.stringify(m) !== JSON.stringify(f) && (m["depth-change"] = m.depth - f.depth, t.updatedBlocks.add(d.node.attrs.id));
1054
1104
  }
1055
1105
  }
1056
1106
  return t.prevTransactionOldBlockAttrs = i, t;
@@ -1065,11 +1115,11 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1065
1115
  return e.doc.descendants((r, i) => {
1066
1116
  if (!r.attrs.id || !t.updatedBlocks.has(r.attrs.id))
1067
1117
  return;
1068
- const a = t.currentTransactionOldBlockAttrs[r.attrs.id], s = {};
1069
- for (let [d, c] of Object.entries(a))
1070
- s["data-prev-" + He[d]] = c || "none";
1118
+ const s = t.currentTransactionOldBlockAttrs[r.attrs.id], a = {};
1119
+ for (let [d, c] of Object.entries(s))
1120
+ a["data-prev-" + He[d]] = c || "none";
1071
1121
  const l = D.node(i, i + r.nodeSize, {
1072
- ...s
1122
+ ...a
1073
1123
  });
1074
1124
  n.push(l);
1075
1125
  }), F.create(e.doc, n);
@@ -1113,13 +1163,13 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1113
1163
  renderHTML({ HTMLAttributes: o }) {
1114
1164
  return [
1115
1165
  "div",
1116
- w(o, {
1166
+ x(o, {
1117
1167
  class: k.blockOuter,
1118
1168
  "data-node-type": "block-outer"
1119
1169
  }),
1120
1170
  [
1121
1171
  "div",
1122
- w(o, {
1172
+ x(o, {
1123
1173
  // TODO: maybe remove html attributes from inner block
1124
1174
  class: k.block,
1125
1175
  "data-node-type": this.name
@@ -1148,16 +1198,16 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1148
1198
  const r = g(t.doc, o);
1149
1199
  if (r === void 0)
1150
1200
  return !1;
1151
- const { startPos: i, endPos: a, node: s, contentNode: l } = r;
1201
+ const { startPos: i, endPos: s, node: a, contentNode: l } = r;
1152
1202
  if (n) {
1153
1203
  if (e.children !== void 0) {
1154
1204
  const d = [];
1155
1205
  for (const c of e.children)
1156
1206
  d.push(z(c, t.schema));
1157
- s.childCount === 2 ? t.tr.replace(
1207
+ a.childCount === 2 ? t.tr.replace(
1158
1208
  i + l.nodeSize + 1,
1159
- a - 1,
1160
- new I(_.from(d), 0, 0)
1209
+ s - 1,
1210
+ new T(P.from(d), 0, 0)
1161
1211
  ) : t.tr.insert(
1162
1212
  i + l.nodeSize,
1163
1213
  t.schema.nodes.blockGroup.create({}, d)
@@ -1165,10 +1215,10 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1165
1215
  }
1166
1216
  if (e.content !== void 0) {
1167
1217
  let d = [];
1168
- typeof e.content == "string" ? d.push(t.schema.text(e.content)) : d = Bt(e.content, t.schema), t.tr.replace(
1218
+ typeof e.content == "string" ? d.push(t.schema.text(e.content)) : d = Mt(e.content, t.schema), t.tr.replace(
1169
1219
  i + 1,
1170
1220
  i + l.nodeSize - 1,
1171
- new I(_.from(d), 0, 0)
1221
+ new T(P.from(d), 0, 0)
1172
1222
  );
1173
1223
  }
1174
1224
  t.tr.setNodeMarkup(
@@ -1179,7 +1229,7 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1179
1229
  ...e.props
1180
1230
  }
1181
1231
  ), t.tr.setNodeMarkup(i - 1, void 0, {
1182
- ...s.attrs,
1232
+ ...a.attrs,
1183
1233
  ...e.props
1184
1234
  });
1185
1235
  }
@@ -1209,18 +1259,24 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1209
1259
  const i = g(
1210
1260
  e.doc,
1211
1261
  o + 1
1212
- ), { node: a, contentNode: s, startPos: l, endPos: d, depth: c } = i;
1213
- if (a.childCount === 2) {
1214
- const m = e.doc.resolve(
1215
- l + s.nodeSize + 1
1216
- ), f = e.doc.resolve(d - 1), y = m.blockRange(f);
1217
- t && e.tr.lift(y, c - 1);
1262
+ ), { node: s, contentNode: a, startPos: l, endPos: d, depth: c } = i;
1263
+ if (s.childCount === 2) {
1264
+ const f = e.doc.resolve(
1265
+ l + a.nodeSize + 1
1266
+ ), m = e.doc.resolve(d - 1), b = f.blockRange(m);
1267
+ t && e.tr.lift(b, c - 1);
1218
1268
  }
1219
1269
  let u = o - 1, p = g(e.doc, u);
1220
1270
  for (; p.numChildBlocks > 0; )
1221
1271
  if (u--, p = g(e.doc, u), p === void 0)
1222
1272
  return !1;
1223
- return t && (e.tr.deleteRange(l, l + s.nodeSize), e.tr.insertText(s.textContent, u - 1), e.tr.setSelection(
1273
+ return t && (t(
1274
+ e.tr.deleteRange(l, l + a.nodeSize).replace(
1275
+ u - 1,
1276
+ l,
1277
+ new T(a.content, 0, 0)
1278
+ ).scrollIntoView()
1279
+ ), e.tr.setSelection(
1224
1280
  new tt(e.doc.resolve(u - 1))
1225
1281
  )), !0;
1226
1282
  },
@@ -1230,27 +1286,27 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1230
1286
  const r = g(t.doc, o);
1231
1287
  if (r === void 0)
1232
1288
  return !1;
1233
- const { contentNode: i, contentType: a, startPos: s, endPos: l, depth: d } = r, c = t.doc.cut(s + 1, o), u = t.doc.cut(o, l - 1), p = t.schema.nodes.blockContainer.createAndFill(), m = l + 1, f = m + 2;
1234
- return n && (t.tr.insert(m, p), t.tr.replace(
1235
- f,
1236
- f + 1,
1237
- u.content.size > 0 ? new I(
1238
- _.from(u),
1289
+ const { contentNode: i, contentType: s, startPos: a, endPos: l, depth: d } = r, c = t.doc.cut(a + 1, o), u = t.doc.cut(o, l - 1), p = t.schema.nodes.blockContainer.createAndFill(), f = l + 1, m = f + 2;
1290
+ return n && (t.tr.insert(f, p), t.tr.replace(
1291
+ m,
1292
+ m + 1,
1293
+ u.content.size > 0 ? new T(
1294
+ P.from(u),
1239
1295
  d + 2,
1240
1296
  d + 2
1241
1297
  ) : void 0
1242
1298
  ), e && t.tr.setBlockType(
1243
- f,
1244
- f,
1245
- t.schema.node(a).type,
1299
+ m,
1300
+ m,
1301
+ t.schema.node(s).type,
1246
1302
  i.attrs
1247
1303
  ), t.tr.setSelection(
1248
- new tt(t.doc.resolve(f))
1304
+ new tt(t.doc.resolve(m))
1249
1305
  ), t.tr.replace(
1250
- s + 1,
1306
+ a + 1,
1251
1307
  l - 1,
1252
- c.content.size > 0 ? new I(
1253
- _.from(c),
1308
+ c.content.size > 0 ? new T(
1309
+ P.from(c),
1254
1310
  d + 2,
1255
1311
  d + 2
1256
1312
  ) : void 0
@@ -1273,8 +1329,8 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1273
1329
  const { contentType: r } = g(
1274
1330
  n.doc,
1275
1331
  n.selection.from
1276
- ), i = n.selection.$anchor.parentOffset === 0, a = r.name === "paragraph";
1277
- return i && !a ? t.BNUpdateBlock(n.selection.from, {
1332
+ ), i = n.selection.$anchor.parentOffset === 0, s = r.name === "paragraph";
1333
+ return i && !s ? t.BNUpdateBlock(n.selection.from, {
1278
1334
  type: "paragraph",
1279
1335
  props: {}
1280
1336
  }) : !1;
@@ -1287,8 +1343,8 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1287
1343
  const { depth: r, startPos: i } = g(
1288
1344
  n.doc,
1289
1345
  n.selection.from
1290
- ), a = n.selection.$anchor.parentOffset === 0, s = n.selection.anchor === n.selection.head, l = i === 2, d = i - 1;
1291
- return !l && a && s && r === 2 ? t.BNMergeBlocks(d) : !1;
1346
+ ), s = n.selection.$anchor.parentOffset === 0, a = n.selection.anchor === n.selection.head, l = i === 2, d = i - 1;
1347
+ return !l && s && a && r === 2 ? t.BNMergeBlocks(d) : !1;
1292
1348
  })
1293
1349
  ]),
1294
1350
  Enter: () => this.editor.commands.first(({ commands: t }) => [
@@ -1298,18 +1354,18 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1298
1354
  const { node: r, depth: i } = g(
1299
1355
  n.doc,
1300
1356
  n.selection.from
1301
- ), a = n.selection.$anchor.parentOffset === 0, s = n.selection.anchor === n.selection.head, l = r.textContent.length === 0, d = i > 2;
1302
- return a && s && l && d ? t.liftListItem("blockContainer") : !1;
1357
+ ), s = n.selection.$anchor.parentOffset === 0, a = n.selection.anchor === n.selection.head, l = r.textContent.length === 0, d = i > 2;
1358
+ return s && a && l && d ? t.liftListItem("blockContainer") : !1;
1303
1359
  }),
1304
1360
  // Creates a new block and moves the selection to it if the current one is empty, while the selection is also
1305
1361
  // empty & at the start of the block.
1306
1362
  () => t.command(({ state: n, chain: r }) => {
1307
- const { node: i, endPos: a } = g(
1363
+ const { node: i, endPos: s } = g(
1308
1364
  n.doc,
1309
1365
  n.selection.from
1310
- ), s = n.selection.$anchor.parentOffset === 0, l = n.selection.anchor === n.selection.head, d = i.textContent.length === 0;
1311
- if (s && l && d) {
1312
- const c = a + 1, u = c + 2;
1366
+ ), a = n.selection.$anchor.parentOffset === 0, l = n.selection.anchor === n.selection.head, d = i.textContent.length === 0;
1367
+ if (a && l && d) {
1368
+ const c = s + 1, u = c + 2;
1313
1369
  return r().BNCreateBlock(c).setTextSelection(u).run(), !0;
1314
1370
  }
1315
1371
  return !1;
@@ -1379,7 +1435,7 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1379
1435
  renderHTML({ HTMLAttributes: o }) {
1380
1436
  return [
1381
1437
  "div",
1382
- w(this.options.HTMLAttributes, o, {
1438
+ x(this.options.HTMLAttributes, o, {
1383
1439
  class: k.blockGroup,
1384
1440
  "data-node-type": "blockGroup"
1385
1441
  }),
@@ -1416,7 +1472,7 @@ const Ie = "_bnEditor_14aht_3", _e = "_bnRoot_14aht_20", Pe = "_defaultStyles_14
1416
1472
  })
1417
1473
  ];
1418
1474
  }
1419
- }), Ge = Dt(
1475
+ }), Ge = Ft(
1420
1476
  (o) => o.type.name === "blockContainer"
1421
1477
  );
1422
1478
  function W() {
@@ -1443,9 +1499,7 @@ class je {
1443
1499
  h(this, "suggestionsMenu");
1444
1500
  h(this, "pluginState");
1445
1501
  h(this, "itemCallback");
1446
- h(this, "handleScroll", () => {
1447
- this.pluginKey.getState(this.editor._tiptapEditor.state).active && this.suggestionsMenu.render(this.getDynamicParams(), !1);
1448
- });
1502
+ h(this, "lastPosition");
1449
1503
  this.editor = e, this.pluginKey = t, this.pluginState = W(), this.itemCallback = (i) => {
1450
1504
  e._tiptapEditor.chain().focus().deleteRange({
1451
1505
  from: this.pluginState.queryStartPos - this.pluginState.triggerCharacter.length,
@@ -1454,34 +1508,41 @@ class je {
1454
1508
  item: i,
1455
1509
  editor: e
1456
1510
  });
1457
- }, this.suggestionsMenu = r(this.getStaticParams()), document.addEventListener("scroll", this.handleScroll);
1511
+ }, this.suggestionsMenu = r(this.getStaticParams());
1458
1512
  }
1459
1513
  update(e, t) {
1460
- const n = this.pluginKey.getState(t), r = this.pluginKey.getState(e.state), i = !n.active && r.active, a = n.active && !r.active, s = n.active && r.active;
1461
- !i && !s && !a || (this.pluginState = a ? n : r, (a || !this.editor.isEditable) && (this.suggestionsMenu.hide(), this.suggestionsMenu.element.removeEventListener(
1514
+ const n = this.pluginKey.getState(t), r = this.pluginKey.getState(e.state), i = !n.active && r.active, s = n.active && !r.active, a = n.active && r.active;
1515
+ !i && !a && !s || (this.pluginState = s ? n : r, (s || !this.editor.isEditable) && (this.suggestionsMenu.hide(), this.suggestionsMenu.element.removeEventListener(
1462
1516
  "mousedown",
1463
1517
  (l) => l.preventDefault()
1464
- )), s && this.suggestionsMenu.render(this.getDynamicParams(), !1), i && this.editor.isEditable && (this.suggestionsMenu.render(this.getDynamicParams(), !0), this.suggestionsMenu.element.addEventListener(
1518
+ )), a && this.suggestionsMenu.render(this.getDynamicParams(), !1), i && this.editor.isEditable && (this.suggestionsMenu.render(this.getDynamicParams(), !0), this.suggestionsMenu.element.addEventListener(
1465
1519
  "mousedown",
1466
1520
  (l) => l.preventDefault()
1467
1521
  )));
1468
1522
  }
1469
- destroy() {
1470
- document.removeEventListener("scroll", this.handleScroll);
1471
- }
1472
1523
  getStaticParams() {
1473
1524
  return {
1474
- itemCallback: (e) => this.itemCallback(e)
1525
+ itemCallback: (e) => this.itemCallback(e),
1526
+ getReferenceRect: () => {
1527
+ const e = document.querySelector(
1528
+ `[data-decoration-id="${this.pluginState.decorationId}"]`
1529
+ );
1530
+ if (!e) {
1531
+ if (this.lastPosition === void 0)
1532
+ throw new Error(
1533
+ "Attempted to access trigger character reference rect before rendering suggestions menu."
1534
+ );
1535
+ return this.lastPosition;
1536
+ }
1537
+ const t = e.getBoundingClientRect();
1538
+ return this.lastPosition = t, t;
1539
+ }
1475
1540
  };
1476
1541
  }
1477
1542
  getDynamicParams() {
1478
- const e = document.querySelector(
1479
- `[data-decoration-id="${this.pluginState.decorationId}"]`
1480
- );
1481
1543
  return {
1482
1544
  items: this.pluginState.items,
1483
- keyboardHoveredItemIndex: this.pluginState.keyboardHoveredItemIndex,
1484
- referenceRect: e.getBoundingClientRect()
1545
+ keyboardHoveredItemIndex: this.pluginState.keyboardHoveredItemIndex
1485
1546
  };
1486
1547
  }
1487
1548
  }
@@ -1496,16 +1557,16 @@ function qe({
1496
1557
  }) {
1497
1558
  if (t.length !== 1)
1498
1559
  throw new Error("'char' should be a single character");
1499
- const a = (s) => {
1500
- s.dispatch(s.state.tr.setMeta(o, { deactivate: !0 }));
1560
+ const s = (a) => {
1561
+ a.dispatch(a.state.tr.setMeta(o, { deactivate: !0 }));
1501
1562
  };
1502
1563
  return new C({
1503
1564
  key: o,
1504
- view: (s) => new je({
1565
+ view: (a) => new je({
1505
1566
  editor: e,
1506
1567
  pluginKey: o,
1507
1568
  onSelectItem: (l) => {
1508
- a(s), r(l);
1569
+ s(a), r(l);
1509
1570
  },
1510
1571
  suggestionsMenuFactory: n
1511
1572
  }),
@@ -1515,14 +1576,14 @@ function qe({
1515
1576
  return W();
1516
1577
  },
1517
1578
  // Apply changes to the plugin state from an editor transaction.
1518
- apply(s, l, d, c) {
1519
- var p, m, f, y;
1520
- if (s.getMeta("orderedListIndexing") !== void 0)
1579
+ apply(a, l, d, c) {
1580
+ var p, f, m, b;
1581
+ if (a.getMeta("orderedListIndexing") !== void 0)
1521
1582
  return l;
1522
- if ((p = s.getMeta(o)) != null && p.activate)
1583
+ if ((p = a.getMeta(o)) != null && p.activate)
1523
1584
  return {
1524
1585
  active: !0,
1525
- triggerCharacter: ((m = s.getMeta(o)) == null ? void 0 : m.triggerCharacter) || "",
1586
+ triggerCharacter: ((f = a.getMeta(o)) == null ? void 0 : f.triggerCharacter) || "",
1526
1587
  queryStartPos: c.selection.from,
1527
1588
  items: i(""),
1528
1589
  keyboardHoveredItemIndex: 0,
@@ -1541,26 +1602,26 @@ function qe({
1541
1602
  l.notFoundCount + (c.selection.from - d.selection.from)
1542
1603
  )), // Highlighting text should hide the menu.
1543
1604
  c.selection.from !== c.selection.to || // Transactions with plugin metadata {deactivate: true} should hide the menu.
1544
- (f = s.getMeta(o)) != null && f.deactivate || // Certain mouse events should hide the menu.
1605
+ (m = a.getMeta(o)) != null && m.deactivate || // Certain mouse events should hide the menu.
1545
1606
  // TODO: Change to global mousedown listener.
1546
- s.getMeta("focus") || s.getMeta("blur") || s.getMeta("pointer") || // Moving the caret before the character which triggered the menu should hide it.
1607
+ a.getMeta("focus") || a.getMeta("blur") || a.getMeta("pointer") || // Moving the caret before the character which triggered the menu should hide it.
1547
1608
  l.active && c.selection.from < l.queryStartPos || // Entering more than 3 characters, after the last query that matched with at least 1 menu item, should hide
1548
1609
  // the menu.
1549
1610
  u.notFoundCount > 3)
1550
1611
  return W();
1551
- if (((y = s.getMeta(o)) == null ? void 0 : y.selectedItemIndexChanged) !== void 0) {
1552
- let b = s.getMeta(o).selectedItemIndexChanged;
1553
- b < 0 ? b = l.items.length - 1 : b >= l.items.length && (b = 0), u.keyboardHoveredItemIndex = b;
1612
+ if (((b = a.getMeta(o)) == null ? void 0 : b.selectedItemIndexChanged) !== void 0) {
1613
+ let y = a.getMeta(o).selectedItemIndexChanged;
1614
+ y < 0 ? y = l.items.length - 1 : y >= l.items.length && (y = 0), u.keyboardHoveredItemIndex = y;
1554
1615
  }
1555
1616
  return u;
1556
1617
  }
1557
1618
  },
1558
1619
  props: {
1559
- handleKeyDown(s, l) {
1560
- const d = this.getState(s.state).active;
1620
+ handleKeyDown(a, l) {
1621
+ const d = this.getState(a.state).active;
1561
1622
  if (l.key === t && !d)
1562
- return s.dispatch(
1563
- s.state.tr.insertText(t).scrollIntoView().setMeta(o, {
1623
+ return a.dispatch(
1624
+ a.state.tr.insertText(t).scrollIntoView().setMeta(o, {
1564
1625
  activate: !0,
1565
1626
  triggerCharacter: t
1566
1627
  })
@@ -1571,37 +1632,37 @@ function qe({
1571
1632
  triggerCharacter: c,
1572
1633
  queryStartPos: u,
1573
1634
  items: p,
1574
- keyboardHoveredItemIndex: m
1575
- } = o.getState(s.state);
1576
- return l.key === "ArrowUp" ? (s.dispatch(
1577
- s.state.tr.setMeta(o, {
1578
- selectedItemIndexChanged: m - 1
1635
+ keyboardHoveredItemIndex: f
1636
+ } = o.getState(a.state);
1637
+ return l.key === "ArrowUp" ? (a.dispatch(
1638
+ a.state.tr.setMeta(o, {
1639
+ selectedItemIndexChanged: f - 1
1579
1640
  })
1580
- ), !0) : l.key === "ArrowDown" ? (s.dispatch(
1581
- s.state.tr.setMeta(o, {
1582
- selectedItemIndexChanged: m + 1
1641
+ ), !0) : l.key === "ArrowDown" ? (a.dispatch(
1642
+ a.state.tr.setMeta(o, {
1643
+ selectedItemIndexChanged: f + 1
1583
1644
  })
1584
- ), !0) : l.key === "Enter" ? (a(s), e._tiptapEditor.chain().focus().deleteRange({
1645
+ ), !0) : l.key === "Enter" ? (s(a), e._tiptapEditor.chain().focus().deleteRange({
1585
1646
  from: u - c.length,
1586
1647
  to: e._tiptapEditor.state.selection.from
1587
1648
  }).run(), r({
1588
- item: p[m],
1649
+ item: p[f],
1589
1650
  editor: e
1590
- }), !0) : l.key === "Escape" ? (a(s), !0) : !1;
1651
+ }), !0) : l.key === "Escape" ? (s(a), !0) : !1;
1591
1652
  },
1592
1653
  // Hides menu in cases where mouse click does not cause an editor state change.
1593
- handleClick(s) {
1594
- a(s);
1654
+ handleClick(a) {
1655
+ s(a);
1595
1656
  },
1596
1657
  // Setup decorator on the currently active suggestion.
1597
- decorations(s) {
1598
- const { active: l, decorationId: d, queryStartPos: c, triggerCharacter: u } = this.getState(s);
1658
+ decorations(a) {
1659
+ const { active: l, decorationId: d, queryStartPos: c, triggerCharacter: u } = this.getState(a);
1599
1660
  if (!l)
1600
1661
  return null;
1601
1662
  if (u === "") {
1602
- const p = Ge(s.selection);
1663
+ const p = Ge(a.selection);
1603
1664
  if (p)
1604
- return F.create(s.doc, [
1665
+ return F.create(a.doc, [
1605
1666
  D.node(
1606
1667
  p.pos,
1607
1668
  p.pos + p.node.nodeSize,
@@ -1613,7 +1674,7 @@ function qe({
1613
1674
  )
1614
1675
  ]);
1615
1676
  }
1616
- return F.create(s.doc, [
1677
+ return F.create(a.doc, [
1617
1678
  D.inline(
1618
1679
  c - u.length,
1619
1680
  c,
@@ -1657,24 +1718,24 @@ const X = new E("suggestions-slash-commands"), We = () => v.create({
1657
1718
  ];
1658
1719
  }
1659
1720
  });
1660
- class L extends G {
1721
+ class A extends G {
1661
1722
  constructor(t, n) {
1662
1723
  super(t, n);
1663
1724
  h(this, "nodes");
1664
1725
  const r = t.node();
1665
- this.nodes = [], t.doc.nodesBetween(t.pos, n.pos, (i, a, s) => {
1666
- if (s !== null && s.eq(r))
1726
+ this.nodes = [], t.doc.nodesBetween(t.pos, n.pos, (i, s, a) => {
1727
+ if (a !== null && a.eq(r))
1667
1728
  return this.nodes.push(i), !1;
1668
1729
  });
1669
1730
  }
1670
1731
  static create(t, n, r = n) {
1671
- return new L(t.resolve(n), t.resolve(r));
1732
+ return new A(t.resolve(n), t.resolve(r));
1672
1733
  }
1673
1734
  content() {
1674
- return new I(_.from(this.nodes), 0, 0);
1735
+ return new T(P.from(this.nodes), 0, 0);
1675
1736
  }
1676
1737
  eq(t) {
1677
- if (!(t instanceof L) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to)
1738
+ if (!(t instanceof A) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to)
1678
1739
  return !1;
1679
1740
  for (let n = 0; n < this.nodes.length; n++)
1680
1741
  if (!this.nodes[n].eq(t.nodes[n]))
@@ -1683,7 +1744,7 @@ class L extends G {
1683
1744
  }
1684
1745
  map(t, n) {
1685
1746
  let r = n.mapResult(this.from), i = n.mapResult(this.to);
1686
- return i.deleted ? G.near(t.resolve(r.pos)) : r.deleted ? G.near(t.resolve(i.pos)) : new L(
1747
+ return i.deleted ? G.near(t.resolve(r.pos)) : r.deleted ? G.near(t.resolve(i.pos)) : new A(
1687
1748
  t.resolve(r.pos),
1688
1749
  t.resolve(i.pos)
1689
1750
  );
@@ -1692,9 +1753,9 @@ class L extends G {
1692
1753
  return { type: "node", anchor: this.anchor, head: this.head };
1693
1754
  }
1694
1755
  }
1695
- const Ve = se.__serializeForClipboard;
1696
- let T;
1697
- function It(o, e) {
1756
+ const Ve = ae.__serializeForClipboard;
1757
+ let M;
1758
+ function Pt(o, e) {
1698
1759
  var r;
1699
1760
  if (!e.dom.isConnected)
1700
1761
  return;
@@ -1710,7 +1771,7 @@ function It(o, e) {
1710
1771
  }
1711
1772
  }
1712
1773
  function Ye(o, e) {
1713
- let t = It(o, e);
1774
+ let t = Pt(o, e);
1714
1775
  if (t && t.node.nodeType === 1) {
1715
1776
  const n = e.docView;
1716
1777
  let r = n.nearestDesc(t.node, !0);
@@ -1720,35 +1781,35 @@ function Ye(o, e) {
1720
1781
  }
1721
1782
  function Ke(o, e) {
1722
1783
  let t, n;
1723
- const r = e.resolve(o.from).node().type.spec.group === "blockContent", i = e.resolve(o.to).node().type.spec.group === "blockContent", a = Math.min(o.$anchor.depth, o.$head.depth);
1784
+ const r = e.resolve(o.from).node().type.spec.group === "blockContent", i = e.resolve(o.to).node().type.spec.group === "blockContent", s = Math.min(o.$anchor.depth, o.$head.depth);
1724
1785
  if (r && i) {
1725
- const s = o.$from.start(a - 1), l = o.$to.end(a - 1);
1726
- t = e.resolve(s - 1).pos, n = e.resolve(l + 1).pos;
1786
+ const a = o.$from.start(s - 1), l = o.$to.end(s - 1);
1787
+ t = e.resolve(a - 1).pos, n = e.resolve(l + 1).pos;
1727
1788
  } else
1728
1789
  t = o.from, n = o.to;
1729
1790
  return { from: t, to: n };
1730
1791
  }
1731
- function rt(o, e, t = e) {
1792
+ function it(o, e, t = e) {
1732
1793
  e === t && (t += o.state.doc.resolve(e + 1).node().nodeSize);
1733
- const n = o.domAtPos(e).node.cloneNode(!0), r = o.domAtPos(e).node, i = (c, u) => Array.prototype.indexOf.call(c.children, u), a = i(
1794
+ const n = o.domAtPos(e).node.cloneNode(!0), r = o.domAtPos(e).node, i = (c, u) => Array.prototype.indexOf.call(c.children, u), s = i(
1734
1795
  r,
1735
1796
  // Expects from position to be just before the first selected block.
1736
1797
  o.domAtPos(e + 1).node.parentElement
1737
- ), s = i(
1798
+ ), a = i(
1738
1799
  r,
1739
1800
  // Expects to position to be just after the last selected block.
1740
1801
  o.domAtPos(t - 1).node.parentElement
1741
1802
  );
1742
1803
  for (let c = r.childElementCount - 1; c >= 0; c--)
1743
- (c > s || c < a) && n.removeChild(n.children[c]);
1744
- _t(), T = n;
1804
+ (c > a || c < s) && n.removeChild(n.children[c]);
1805
+ _t(), M = n;
1745
1806
  const d = o.dom.className.split(" ").filter(
1746
1807
  (c) => !c.includes("bn") && !c.includes("ProseMirror") && !c.includes("editor")
1747
1808
  ).join(" ");
1748
- T.className = T.className + " " + P.dragPreview + " " + d, document.body.appendChild(T);
1809
+ M.className = M.className + " " + _.dragPreview + " " + d, document.body.appendChild(M);
1749
1810
  }
1750
1811
  function _t() {
1751
- T !== void 0 && (document.body.removeChild(T), T = void 0);
1812
+ M !== void 0 && (document.body.removeChild(M), M = void 0);
1752
1813
  }
1753
1814
  function Je(o, e) {
1754
1815
  if (!o.dataTransfer)
@@ -1760,14 +1821,14 @@ function Je(o, e) {
1760
1821
  top: o.clientY
1761
1822
  }, r = Ye(n, e);
1762
1823
  if (r != null) {
1763
- const i = e.state.selection, a = e.state.doc, { from: s, to: l } = Ke(i, a), d = s <= r && r < l, c = i.$anchor.node() !== i.$head.node() || i instanceof L;
1824
+ const i = e.state.selection, s = e.state.doc, { from: a, to: l } = Ke(i, s), d = a <= r && r < l, c = i.$anchor.node() !== i.$head.node() || i instanceof A;
1764
1825
  d && c ? (e.dispatch(
1765
- e.state.tr.setSelection(L.create(a, s, l))
1766
- ), rt(e, s, l)) : (e.dispatch(
1767
- e.state.tr.setSelection(Ut.create(e.state.doc, r))
1768
- ), rt(e, r));
1769
- let u = e.state.selection.content(), { dom: p, text: m } = Ve(e, u);
1770
- o.dataTransfer.clearData(), o.dataTransfer.setData("text/html", p.innerHTML), o.dataTransfer.setData("text/plain", m), o.dataTransfer.effectAllowed = "move", o.dataTransfer.setDragImage(T, 0, 0), e.dragging = { slice: u, move: !0 };
1826
+ e.state.tr.setSelection(A.create(s, a, l))
1827
+ ), it(e, a, l)) : (e.dispatch(
1828
+ e.state.tr.setSelection($t.create(e.state.doc, r))
1829
+ ), it(e, r));
1830
+ let u = e.state.selection.content(), { dom: p, text: f } = Ve(e, u);
1831
+ o.dataTransfer.clearData(), o.dataTransfer.setData("text/html", p.innerHTML), o.dataTransfer.setData("text/plain", f), o.dataTransfer.effectAllowed = "move", o.dataTransfer.setDragImage(M, 0, 0), e.dragging = { slice: u, move: !0 };
1771
1832
  }
1772
1833
  }
1773
1834
  class Xe {
@@ -1789,6 +1850,7 @@ class Xe {
1789
1850
  h(this, "isDragging", !1);
1790
1851
  h(this, "menuOpen", !1);
1791
1852
  h(this, "menuFrozen", !1);
1853
+ h(this, "lastPosition");
1792
1854
  /**
1793
1855
  * Sets isDragging when dragging text.
1794
1856
  */
@@ -1813,7 +1875,7 @@ class Xe {
1813
1875
  }
1814
1876
  });
1815
1877
  /**
1816
- * If the event is outside of the editor contents,
1878
+ * If the event is outside the editor contents,
1817
1879
  * we dispatch a fake event, so that we can still drop the content
1818
1880
  * when dragging / dropping to the side of the editor
1819
1881
  */
@@ -1837,29 +1899,36 @@ class Xe {
1837
1899
  (t = this.blockMenu.element) != null && t.contains(e.target) || (this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide()), this.menuFrozen = !1);
1838
1900
  });
1839
1901
  h(this, "onMouseMove", (e) => {
1840
- var a, s;
1902
+ var l, d, c;
1841
1903
  if (this.menuFrozen)
1842
1904
  return;
1843
- const t = this.ttEditor.view.dom.firstChild.getBoundingClientRect();
1905
+ const t = this.ttEditor.view.dom.firstChild.getBoundingClientRect(), n = this.ttEditor.view.dom.getBoundingClientRect();
1906
+ if (
1907
+ // Cursor is within the editor area
1908
+ e.clientX >= n.left && e.clientX <= n.right && e.clientY >= n.top && e.clientY <= n.bottom && // An element is hovered
1909
+ e && e.target && // Element is outside the editor
1910
+ this.ttEditor.view.dom !== e.target && !this.ttEditor.view.dom.contains(e.target) && // Element is outside the side menu
1911
+ this.blockMenu.element !== e.target && !((l = this.blockMenu.element) != null && l.contains(e.target))
1912
+ ) {
1913
+ this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide());
1914
+ return;
1915
+ }
1844
1916
  this.horizontalPosAnchor = t.x;
1845
- const n = {
1917
+ const i = {
1846
1918
  left: t.left + t.width / 2,
1847
1919
  // take middle of editor
1848
1920
  top: e.clientY
1849
- }, r = It(n, this.ttEditor.view);
1850
- if (!r || !this.editor.isEditable) {
1921
+ }, s = Pt(i, this.ttEditor.view);
1922
+ if (!s || !this.editor.isEditable) {
1851
1923
  this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide());
1852
1924
  return;
1853
1925
  }
1854
- this.menuOpen && ((a = this.hoveredBlock) != null && a.hasAttribute("data-id")) && ((s = this.hoveredBlock) == null ? void 0 : s.getAttribute("data-id")) === r.id || (this.hoveredBlock = r.node, !r.node.firstChild) || this.editor.isEditable && (this.menuOpen ? this.blockMenu.render(this.getDynamicParams(), !1) : (this.menuOpen = !0, this.blockMenu.render(this.getDynamicParams(), !0)));
1855
- });
1856
- h(this, "onScroll", () => {
1857
- this.menuOpen && this.blockMenu.render(this.getDynamicParams(), !1);
1926
+ this.menuOpen && ((d = this.hoveredBlock) != null && d.hasAttribute("data-id")) && ((c = this.hoveredBlock) == null ? void 0 : c.getAttribute("data-id")) === s.id || (this.hoveredBlock = s.node, !s.node.firstChild) || this.editor.isEditable && (this.menuOpen ? this.blockMenu.render(this.getDynamicParams(), !1) : (this.menuOpen = !0, this.blockMenu.render(this.getDynamicParams(), !0)));
1858
1927
  });
1859
- this.editor = t, this.ttEditor = e, this.horizontalPosAnchoredAtRoot = r, this.horizontalPosAnchor = this.ttEditor.view.dom.firstChild.getBoundingClientRect().x, this.blockMenu = n(this.getStaticParams()), document.body.addEventListener("drop", this.onDrop, !0), document.body.addEventListener("dragover", this.onDragOver), this.ttEditor.view.dom.addEventListener("dragstart", this.onDragStart), document.body.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("scroll", this.onScroll), document.body.addEventListener("mousedown", this.onMouseDown, !0), document.body.addEventListener("keydown", this.onKeyDown, !0);
1928
+ this.editor = t, this.ttEditor = e, this.horizontalPosAnchoredAtRoot = r, this.horizontalPosAnchor = this.ttEditor.view.dom.firstChild.getBoundingClientRect().x, this.blockMenu = n(this.getStaticParams()), document.body.addEventListener("drop", this.onDrop, !0), document.body.addEventListener("dragover", this.onDragOver), this.ttEditor.view.dom.addEventListener("dragstart", this.onDragStart), document.body.addEventListener("mousemove", this.onMouseMove, !0), document.body.addEventListener("mousedown", this.onMouseDown, !0), document.body.addEventListener("keydown", this.onKeyDown, !0);
1860
1929
  }
1861
1930
  destroy() {
1862
- this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide()), document.body.removeEventListener("mousemove", this.onMouseMove), document.body.removeEventListener("dragover", this.onDragOver), this.ttEditor.view.dom.removeEventListener("dragstart", this.onDragStart), document.body.removeEventListener("drop", this.onDrop), document.body.removeEventListener("mousedown", this.onMouseDown), document.removeEventListener("scroll", this.onScroll), document.body.removeEventListener("keydown", this.onKeyDown);
1931
+ this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide()), document.body.removeEventListener("mousemove", this.onMouseMove), document.body.removeEventListener("dragover", this.onDragOver), this.ttEditor.view.dom.removeEventListener("dragstart", this.onDragStart), document.body.removeEventListener("drop", this.onDrop), document.body.removeEventListener("mousedown", this.onMouseDown), document.body.removeEventListener("keydown", this.onKeyDown);
1863
1932
  }
1864
1933
  addBlock() {
1865
1934
  this.menuOpen = !1, this.menuFrozen = !0, this.blockMenu.hide();
@@ -1872,12 +1941,12 @@ class Xe {
1872
1941
  const r = g(this.ttEditor.state.doc, n.pos);
1873
1942
  if (r === void 0)
1874
1943
  return;
1875
- const { contentNode: i, endPos: a } = r;
1944
+ const { contentNode: i, endPos: s } = r;
1876
1945
  if (i.textContent.length !== 0) {
1877
- const s = a + 1, l = s + 2;
1878
- this.ttEditor.chain().BNCreateBlock(s).BNUpdateBlock(l, { type: "paragraph", props: {} }).setTextSelection(l).run();
1946
+ const a = s + 1, l = a + 2;
1947
+ this.ttEditor.chain().BNCreateBlock(a).BNUpdateBlock(l, { type: "paragraph", props: {} }).setTextSelection(l).run();
1879
1948
  } else
1880
- this.ttEditor.commands.setTextSelection(a);
1949
+ this.ttEditor.commands.setTextSelection(s);
1881
1950
  this.ttEditor.view.focus(), this.ttEditor.view.dispatch(
1882
1951
  this.ttEditor.view.state.tr.scrollIntoView().setMeta(X, {
1883
1952
  // TODO import suggestion plugin key
@@ -1899,19 +1968,23 @@ class Xe {
1899
1968
  },
1900
1969
  unfreezeMenu: () => {
1901
1970
  this.menuFrozen = !1;
1971
+ },
1972
+ getReferenceRect: () => {
1973
+ if (!this.menuOpen) {
1974
+ if (this.lastPosition === void 0)
1975
+ throw new Error(
1976
+ "Attempted to access block reference rect before rendering block side menu."
1977
+ );
1978
+ return this.lastPosition;
1979
+ }
1980
+ const t = this.hoveredBlock.firstChild.getBoundingClientRect();
1981
+ return this.horizontalPosAnchoredAtRoot && (t.x = this.horizontalPosAnchor), this.lastPosition = t, t;
1902
1982
  }
1903
1983
  };
1904
1984
  }
1905
1985
  getDynamicParams() {
1906
- const t = this.hoveredBlock.firstChild.getBoundingClientRect();
1907
1986
  return {
1908
- block: this.editor.getBlock(this.hoveredBlock.getAttribute("data-id")),
1909
- referenceRect: new DOMRect(
1910
- this.horizontalPosAnchoredAtRoot ? this.horizontalPosAnchor : t.x,
1911
- t.y,
1912
- t.width,
1913
- t.height
1914
- )
1987
+ block: this.editor.getBlock(this.hoveredBlock.getAttribute("data-id"))
1915
1988
  };
1916
1989
  }
1917
1990
  }
@@ -1956,9 +2029,10 @@ class to {
1956
2029
  h(this, "preventShow", !1);
1957
2030
  h(this, "toolbarIsOpen", !1);
1958
2031
  h(this, "prevWasEditable", null);
2032
+ h(this, "lastPosition");
1959
2033
  h(this, "shouldShow", ({ view: e, state: t, from: n, to: r }) => {
1960
- const { doc: i, selection: a } = t, { empty: s } = a, l = !i.textBetween(n, r).length && Ft(t.selection);
1961
- return !(!e.hasFocus() || s || l);
2034
+ const { doc: i, selection: s } = t, { empty: a } = s, l = !i.textBetween(n, r).length && Rt(t.selection);
2035
+ return !(!e.hasFocus() || a || l);
1962
2036
  });
1963
2037
  h(this, "viewMousedownHandler", () => {
1964
2038
  this.preventShow = !0;
@@ -1973,71 +2047,68 @@ class to {
1973
2047
  setTimeout(() => this.update(this.ttEditor.view));
1974
2048
  });
1975
2049
  h(this, "blurHandler", ({ event: e }) => {
1976
- var t, n;
2050
+ var t;
1977
2051
  if (this.preventHide) {
1978
2052
  this.preventHide = !1;
1979
2053
  return;
1980
2054
  }
1981
- e != null && e.relatedTarget && ((n = (t = this.formattingToolbar.element) == null ? void 0 : t.parentNode) != null && n.contains(
1982
- e.relatedTarget
1983
- )) || this.toolbarIsOpen && (this.formattingToolbar.hide(), this.toolbarIsOpen = !1);
2055
+ // An element is clicked.
2056
+ e && e.relatedTarget && // Element is outside the toolbar.
2057
+ (this.formattingToolbar.element === e.relatedTarget || (t = this.formattingToolbar.element) != null && t.contains(e.relatedTarget)) || this.toolbarIsOpen && (this.formattingToolbar.hide(), this.toolbarIsOpen = !1);
1984
2058
  });
1985
- h(this, "scrollHandler", () => {
1986
- this.toolbarIsOpen && this.formattingToolbar.render(this.getDynamicParams(), !1);
1987
- });
1988
- this.editor = e, this.ttEditor = t, this.view = r, this.formattingToolbar = n(this.getStaticParams()), this.view.dom.addEventListener("mousedown", this.viewMousedownHandler), this.view.dom.addEventListener("mouseup", this.viewMouseupHandler), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.ttEditor.on("focus", this.focusHandler), this.ttEditor.on("blur", this.blurHandler), document.addEventListener("scroll", this.scrollHandler);
2059
+ this.editor = e, this.ttEditor = t, this.view = r, this.formattingToolbar = n(this.getStaticParams()), this.view.dom.addEventListener("mousedown", this.viewMousedownHandler), this.view.dom.addEventListener("mouseup", this.viewMouseupHandler), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.ttEditor.on("focus", this.focusHandler), this.ttEditor.on("blur", this.blurHandler);
1989
2060
  }
1990
2061
  update(e, t) {
1991
2062
  var p;
1992
- const { state: n, composing: r } = e, { doc: i, selection: a } = n, s = t && t.doc.eq(i) && t.selection.eq(a);
1993
- if ((this.prevWasEditable === null || this.prevWasEditable === this.editor.isEditable) && (r || s))
2063
+ const { state: n, composing: r } = e, { doc: i, selection: s } = n, a = t && t.doc.eq(i) && t.selection.eq(s);
2064
+ if ((this.prevWasEditable === null || this.prevWasEditable === this.editor.isEditable) && (r || a))
1994
2065
  return;
1995
2066
  this.prevWasEditable = this.editor.isEditable;
1996
- const { ranges: l } = a, d = Math.min(...l.map((m) => m.$from.pos)), c = Math.max(...l.map((m) => m.$to.pos)), u = (p = this.shouldShow) == null ? void 0 : p.call(this, {
2067
+ const { ranges: l } = s, d = Math.min(...l.map((f) => f.$from.pos)), c = Math.max(...l.map((f) => f.$to.pos)), u = (p = this.shouldShow) == null ? void 0 : p.call(this, {
1997
2068
  view: e,
1998
2069
  state: n,
1999
2070
  from: d,
2000
2071
  to: c
2001
2072
  });
2002
2073
  if (this.editor.isEditable && !this.toolbarIsOpen && !this.preventShow && (u || this.preventHide)) {
2003
- this.formattingToolbar.render(this.getDynamicParams(), !0), this.toolbarIsOpen = !0, this.formattingToolbar.element.addEventListener(
2004
- "mousedown",
2005
- (m) => m.preventDefault()
2006
- );
2074
+ this.formattingToolbar.render({}, !0), this.toolbarIsOpen = !0;
2007
2075
  return;
2008
2076
  }
2009
2077
  if (this.toolbarIsOpen && !this.preventShow && (u || this.preventHide)) {
2010
- this.formattingToolbar.render(this.getDynamicParams(), !1);
2078
+ this.formattingToolbar.render({}, !1);
2011
2079
  return;
2012
2080
  }
2013
2081
  if (this.toolbarIsOpen && !this.preventHide && (!u || this.preventShow || !this.editor.isEditable)) {
2014
- this.formattingToolbar.hide(), this.toolbarIsOpen = !1, this.formattingToolbar.element.removeEventListener(
2015
- "mousedown",
2016
- (m) => m.preventDefault()
2017
- );
2082
+ this.formattingToolbar.hide(), this.toolbarIsOpen = !1;
2018
2083
  return;
2019
2084
  }
2020
2085
  }
2021
2086
  destroy() {
2022
- this.view.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.view.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.ttEditor.off("focus", this.focusHandler), this.ttEditor.off("blur", this.blurHandler), document.removeEventListener("scroll", this.scrollHandler);
2087
+ this.view.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.view.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.ttEditor.off("focus", this.focusHandler), this.ttEditor.off("blur", this.blurHandler);
2023
2088
  }
2024
2089
  getSelectionBoundingBox() {
2025
- const { state: e } = this.ttEditor.view, { selection: t } = e, { ranges: n } = t, r = Math.min(...n.map((a) => a.$from.pos)), i = Math.max(...n.map((a) => a.$to.pos));
2026
- if (Rt(t)) {
2027
- const a = this.ttEditor.view.nodeDOM(r);
2028
- if (a)
2029
- return a.getBoundingClientRect();
2090
+ const { state: e } = this.ttEditor.view, { selection: t } = e, { ranges: n } = t, r = Math.min(...n.map((s) => s.$from.pos)), i = Math.max(...n.map((s) => s.$to.pos));
2091
+ if (zt(t)) {
2092
+ const s = this.ttEditor.view.nodeDOM(r);
2093
+ if (s)
2094
+ return s.getBoundingClientRect();
2030
2095
  }
2031
- return st(this.ttEditor.view, r, i);
2096
+ return at(this.ttEditor.view, r, i);
2032
2097
  }
2033
2098
  getStaticParams() {
2034
2099
  return {
2035
- editor: this.editor
2036
- };
2037
- }
2038
- getDynamicParams() {
2039
- return {
2040
- referenceRect: this.getSelectionBoundingBox()
2100
+ editor: this.editor,
2101
+ getReferenceRect: () => {
2102
+ if (!this.toolbarIsOpen) {
2103
+ if (this.lastPosition === void 0)
2104
+ throw new Error(
2105
+ "Attempted to access selection reference rect before rendering formatting toolbar."
2106
+ );
2107
+ return this.lastPosition;
2108
+ }
2109
+ const e = this.getSelectionBoundingBox();
2110
+ return this.lastPosition = e, e;
2111
+ }
2041
2112
  };
2042
2113
  }
2043
2114
  }
@@ -2074,31 +2145,37 @@ class ro {
2074
2145
  h(this, "keyboardHoveredHyperlinkMarkRange");
2075
2146
  h(this, "hyperlinkMark");
2076
2147
  h(this, "hyperlinkMarkRange");
2148
+ h(this, "lastPosition");
2077
2149
  h(this, "mouseOverHandler", (e) => {
2078
2150
  if (this.mouseHoveredHyperlinkMark = void 0, this.mouseHoveredHyperlinkMarkRange = void 0, this.stopMenuUpdateTimer(), e.target instanceof HTMLAnchorElement && e.target.nodeName === "A") {
2079
2151
  const t = e.target, n = this.editor.view.posAtDOM(t, 0) + 1, r = this.editor.state.doc.resolve(
2080
2152
  n
2081
2153
  ), i = r.marks();
2082
- for (const a of i)
2083
- if (a.type.name === this.editor.schema.mark("link").type.name) {
2084
- this.mouseHoveredHyperlinkMark = a, this.mouseHoveredHyperlinkMarkRange = Q(
2154
+ for (const s of i)
2155
+ if (s.type.name === this.editor.schema.mark("link").type.name) {
2156
+ this.mouseHoveredHyperlinkMark = s, this.mouseHoveredHyperlinkMarkRange = Q(
2085
2157
  r,
2086
- a.type,
2087
- a.attrs
2158
+ s.type,
2159
+ s.attrs
2088
2160
  ) || void 0;
2089
2161
  break;
2090
2162
  }
2091
2163
  }
2092
2164
  return this.startMenuUpdateTimer(), !1;
2093
2165
  });
2094
- h(this, "scrollHandler", () => {
2095
- this.hyperlinkMark !== void 0 && this.hyperlinkToolbar.render(this.getDynamicParams(), !1);
2166
+ h(this, "clickHandler", (e) => {
2167
+ var t;
2168
+ // Toolbar is open.
2169
+ this.hyperlinkMark && // An element is clicked.
2170
+ e && e.target && // Element is outside the editor.
2171
+ this.editor.view.dom !== e.target && !this.editor.view.dom.contains(e.target) && // Element is outside the toolbar.
2172
+ this.hyperlinkToolbar.element !== e.target && !((t = this.hyperlinkToolbar.element) != null && t.contains(e.target)) && this.hyperlinkToolbar.hide();
2096
2173
  });
2097
2174
  this.editor = e, this.hyperlinkToolbar = t(this.getStaticParams()), this.startMenuUpdateTimer = () => {
2098
2175
  this.menuUpdateTimer = setTimeout(() => {
2099
2176
  this.update();
2100
2177
  }, 250);
2101
- }, this.stopMenuUpdateTimer = () => (this.menuUpdateTimer && (clearTimeout(this.menuUpdateTimer), this.menuUpdateTimer = void 0), !1), this.editor.view.dom.addEventListener("mouseover", this.mouseOverHandler), document.addEventListener("scroll", this.scrollHandler);
2178
+ }, this.stopMenuUpdateTimer = () => (this.menuUpdateTimer && (clearTimeout(this.menuUpdateTimer), this.menuUpdateTimer = void 0), !1), this.editor.view.dom.addEventListener("mouseover", this.mouseOverHandler), document.addEventListener("click", this.clickHandler, !0);
2102
2179
  }
2103
2180
  update() {
2104
2181
  var t, n, r, i;
@@ -2106,13 +2183,13 @@ class ro {
2106
2183
  return;
2107
2184
  const e = this.hyperlinkMark;
2108
2185
  if (this.hyperlinkMark = void 0, this.hyperlinkMarkRange = void 0, this.keyboardHoveredHyperlinkMark = void 0, this.keyboardHoveredHyperlinkMarkRange = void 0, this.editor.state.selection.empty) {
2109
- const a = this.editor.state.selection.$from.marks();
2110
- for (const s of a)
2111
- if (s.type.name === this.editor.schema.mark("link").type.name) {
2112
- this.keyboardHoveredHyperlinkMark = s, this.keyboardHoveredHyperlinkMarkRange = Q(
2186
+ const s = this.editor.state.selection.$from.marks();
2187
+ for (const a of s)
2188
+ if (a.type.name === this.editor.schema.mark("link").type.name) {
2189
+ this.keyboardHoveredHyperlinkMark = a, this.keyboardHoveredHyperlinkMarkRange = Q(
2113
2190
  this.editor.state.selection.$from,
2114
- s.type,
2115
- s.attrs
2191
+ a.type,
2192
+ a.attrs
2116
2193
  ) || void 0;
2117
2194
  break;
2118
2195
  }
@@ -2146,7 +2223,7 @@ class ro {
2146
2223
  this.editor.view.dom.removeEventListener(
2147
2224
  "mouseover",
2148
2225
  this.mouseOverHandler
2149
- ), document.removeEventListener("scroll", this.scrollHandler);
2226
+ );
2150
2227
  }
2151
2228
  getStaticParams() {
2152
2229
  return {
@@ -2170,6 +2247,21 @@ class ro {
2170
2247
  this.hyperlinkMark.type
2171
2248
  ).setMeta("preventAutolink", !0)
2172
2249
  ), this.editor.view.focus(), this.hyperlinkToolbar.hide();
2250
+ },
2251
+ getReferenceRect: () => {
2252
+ if (!this.hyperlinkMark) {
2253
+ if (this.lastPosition === void 0)
2254
+ throw new Error(
2255
+ "Attempted to access hyperlink reference rect before rendering hyperlink toolbar."
2256
+ );
2257
+ return this.lastPosition;
2258
+ }
2259
+ const e = at(
2260
+ this.editor.view,
2261
+ this.hyperlinkMarkRange.from,
2262
+ this.hyperlinkMarkRange.to
2263
+ );
2264
+ return this.lastPosition = e, e;
2173
2265
  }
2174
2266
  };
2175
2267
  }
@@ -2179,11 +2271,6 @@ class ro {
2179
2271
  text: this.editor.view.state.doc.textBetween(
2180
2272
  this.hyperlinkMarkRange.from,
2181
2273
  this.hyperlinkMarkRange.to
2182
- ),
2183
- referenceRect: st(
2184
- this.editor.view,
2185
- this.hyperlinkMarkRange.from,
2186
- this.hyperlinkMarkRange.to
2187
2274
  )
2188
2275
  };
2189
2276
  }
@@ -2194,7 +2281,7 @@ const io = (o, e) => new C({
2194
2281
  editor: o,
2195
2282
  hyperlinkToolbarFactory: e.hyperlinkToolbarFactory
2196
2283
  })
2197
- }), so = ct.extend({
2284
+ }), so = ut.extend({
2198
2285
  priority: 500,
2199
2286
  addProseMirrorPlugins() {
2200
2287
  var o;
@@ -2227,20 +2314,20 @@ const io = (o, e) => new C({
2227
2314
  key: ao,
2228
2315
  props: {
2229
2316
  decorations: (o) => {
2230
- const { doc: e, selection: t } = o, n = X.getState(o), r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = t, a = [];
2317
+ const { doc: e, selection: t } = o, n = X.getState(o), r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = t, s = [];
2231
2318
  if (r)
2232
- return e.descendants((s, l) => {
2233
- const d = i >= l && i <= l + s.nodeSize, c = !s.isLeaf && !s.childCount;
2319
+ return e.descendants((a, l) => {
2320
+ const d = i >= l && i <= l + a.nodeSize, c = !a.isLeaf && !a.childCount;
2234
2321
  if ((d || !this.options.showOnlyCurrent) && c) {
2235
2322
  const u = [this.options.emptyNodeClass];
2236
2323
  this.editor.isEmpty && u.push(this.options.emptyEditorClass), d && u.push(this.options.hasAnchorClass), (n == null ? void 0 : n.triggerCharacter) === "" && (n != null && n.active) && u.push(this.options.isFilterClass);
2237
- const p = D.node(l, l + s.nodeSize, {
2324
+ const p = D.node(l, l + a.nodeSize, {
2238
2325
  class: u.join(" ")
2239
2326
  });
2240
- a.push(p);
2327
+ s.push(p);
2241
2328
  }
2242
2329
  return this.options.includeChildren;
2243
- }), F.create(e, a);
2330
+ }), F.create(e, s);
2244
2331
  }
2245
2332
  }
2246
2333
  })
@@ -2266,7 +2353,7 @@ class S extends co {
2266
2353
  ).length !== 0), this.name = e, this.execute = t, this.aliases = n;
2267
2354
  }
2268
2355
  }
2269
- function x(o, e) {
2356
+ function I(o, e) {
2270
2357
  const t = o.getTextCursorPosition().block;
2271
2358
  t.content.length === 1 && t.content[0].type === "text" && t.content[0].text === "/" || t.content.length === 0 ? o.updateBlock(t, e) : (o.insertBlocks([e], t, "after"), o.setTextCursorPosition(o.getTextCursorPosition().nextBlock));
2272
2359
  }
@@ -2274,7 +2361,7 @@ const uo = [
2274
2361
  // Command for creating a level 1 heading
2275
2362
  new S(
2276
2363
  "Heading",
2277
- (o) => x(o, {
2364
+ (o) => I(o, {
2278
2365
  type: "heading",
2279
2366
  props: { level: "1" }
2280
2367
  }),
@@ -2283,7 +2370,7 @@ const uo = [
2283
2370
  // Command for creating a level 2 heading
2284
2371
  new S(
2285
2372
  "Heading 2",
2286
- (o) => x(o, {
2373
+ (o) => I(o, {
2287
2374
  type: "heading",
2288
2375
  props: { level: "2" }
2289
2376
  }),
@@ -2292,7 +2379,7 @@ const uo = [
2292
2379
  // Command for creating a level 3 heading
2293
2380
  new S(
2294
2381
  "Heading 3",
2295
- (o) => x(o, {
2382
+ (o) => I(o, {
2296
2383
  type: "heading",
2297
2384
  props: { level: "3" }
2298
2385
  }),
@@ -2301,7 +2388,7 @@ const uo = [
2301
2388
  // Command for creating an ordered list
2302
2389
  new S(
2303
2390
  "Numbered List",
2304
- (o) => x(o, {
2391
+ (o) => I(o, {
2305
2392
  type: "numberedListItem"
2306
2393
  }),
2307
2394
  ["li", "list", "numberedlist", "numbered list"]
@@ -2309,7 +2396,7 @@ const uo = [
2309
2396
  // Command for creating a bullet list
2310
2397
  new S(
2311
2398
  "Bullet List",
2312
- (o) => x(o, {
2399
+ (o) => I(o, {
2313
2400
  type: "bulletListItem"
2314
2401
  }),
2315
2402
  ["ul", "list", "bulletlist", "bullet list"]
@@ -2317,7 +2404,7 @@ const uo = [
2317
2404
  // Command for creating a paragraph (pretty useless)
2318
2405
  new S(
2319
2406
  "Paragraph",
2320
- (o) => x(o, {
2407
+ (o) => I(o, {
2321
2408
  type: "paragraph"
2322
2409
  }),
2323
2410
  ["p"]
@@ -2477,7 +2564,7 @@ const uo = [
2477
2564
  }
2478
2565
  };
2479
2566
  }
2480
- }), mo = it.create({
2567
+ }), fo = st.create({
2481
2568
  name: "textColor",
2482
2569
  addAttributes() {
2483
2570
  return {
@@ -2506,7 +2593,7 @@ const uo = [
2506
2593
  setTextColor: (o) => ({ commands: e }) => o !== "default" ? e.setMark(this.name, { color: o }) : e.unsetMark(this.name)
2507
2594
  };
2508
2595
  }
2509
- }), fo = v.create({
2596
+ }), mo = v.create({
2510
2597
  name: "trailingNode",
2511
2598
  addProseMirrorPlugins() {
2512
2599
  const o = new E(this.name);
@@ -2514,8 +2601,8 @@ const uo = [
2514
2601
  new C({
2515
2602
  key: o,
2516
2603
  appendTransaction: (e, t, n) => {
2517
- const { doc: r, tr: i, schema: a } = n, s = o.getState(n), l = r.content.size - 2, d = a.nodes.blockContainer, c = a.nodes.paragraph;
2518
- if (s)
2604
+ const { doc: r, tr: i, schema: s } = n, a = o.getState(n), l = r.content.size - 2, d = s.nodes.blockContainer, c = s.nodes.paragraph;
2605
+ if (a)
2519
2606
  return i.insert(
2520
2607
  l,
2521
2608
  d.create(void 0, c.create())
@@ -2540,13 +2627,13 @@ const uo = [
2540
2627
  }
2541
2628
  }), go = (o) => {
2542
2629
  const e = [
2543
- A.ClipboardTextSerializer,
2544
- A.Commands,
2545
- A.Editable,
2546
- A.FocusEvents,
2547
- A.Tabindex,
2630
+ N.ClipboardTextSerializer,
2631
+ N.Commands,
2632
+ N.Editable,
2633
+ N.FocusEvents,
2634
+ N.Tabindex,
2548
2635
  // DevTools,
2549
- Qt,
2636
+ te,
2550
2637
  // DropCursor,
2551
2638
  lo.configure({
2552
2639
  emptyNodeClass: k.isEmpty,
@@ -2558,20 +2645,20 @@ const uo = [
2558
2645
  K.configure({
2559
2646
  types: ["blockContainer"]
2560
2647
  }),
2561
- te,
2648
+ ee,
2562
2649
  // Comments,
2563
2650
  // basics:
2564
- re,
2651
+ ie,
2565
2652
  // marks:
2566
- Yt,
2567
2653
  Kt,
2568
- oe,
2654
+ Jt,
2569
2655
  ne,
2570
- ie,
2571
- mo,
2656
+ re,
2657
+ se,
2658
+ fo,
2572
2659
  po,
2660
+ Le,
2573
2661
  Ne,
2574
- Ae,
2575
2662
  ho,
2576
2663
  // custom blocks:
2577
2664
  ...ze,
@@ -2579,34 +2666,34 @@ const uo = [
2579
2666
  (t) => t.node.configure({ editor: o.editor })
2580
2667
  ),
2581
2668
  $e,
2582
- Zt.configure({ width: 5, color: "#ddeeff" }),
2669
+ Qt.configure({ width: 5, color: "#ddeeff" }),
2583
2670
  // This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
2584
2671
  // should be handled before Enter handlers in other components like splitListItem
2585
- fo
2672
+ mo
2586
2673
  ];
2587
2674
  if (o.collaboration) {
2588
2675
  e.push(
2589
- Jt.configure({
2676
+ Xt.configure({
2590
2677
  fragment: o.collaboration.fragment
2591
2678
  })
2592
2679
  );
2593
2680
  const t = (n) => {
2594
2681
  const r = document.createElement("span");
2595
- r.classList.add(P["collaboration-cursor__caret"]), r.setAttribute("style", `border-color: ${n.color}`);
2682
+ r.classList.add(_["collaboration-cursor__caret"]), r.setAttribute("style", `border-color: ${n.color}`);
2596
2683
  const i = document.createElement("span");
2597
- i.classList.add(P["collaboration-cursor__label"]), i.setAttribute("style", `background-color: ${n.color}`), i.insertBefore(document.createTextNode(n.name), null);
2598
- const a = document.createTextNode("⁠"), s = document.createTextNode("⁠");
2599
- return r.insertBefore(a, null), r.insertBefore(i, null), r.insertBefore(s, null), r;
2684
+ i.classList.add(_["collaboration-cursor__label"]), i.setAttribute("style", `background-color: ${n.color}`), i.insertBefore(document.createTextNode(n.name), null);
2685
+ const s = document.createTextNode("⁠"), a = document.createTextNode("⁠");
2686
+ return r.insertBefore(s, null), r.insertBefore(i, null), r.insertBefore(a, null), r;
2600
2687
  };
2601
2688
  e.push(
2602
- Xt.configure({
2689
+ Zt.configure({
2603
2690
  user: o.collaboration.user,
2604
2691
  render: o.collaboration.renderCursor || t,
2605
2692
  provider: o.collaboration.provider
2606
2693
  })
2607
2694
  );
2608
2695
  } else
2609
- e.push(ee);
2696
+ e.push(oe);
2610
2697
  return o.uiFactories.blockSideMenuFactory && e.push(
2611
2698
  Qe().configure({
2612
2699
  editor: o.editor,
@@ -2621,7 +2708,7 @@ const uo = [
2621
2708
  so.configure({
2622
2709
  hyperlinkToolbarFactory: o.uiFactories.hyperlinkToolbarFactory
2623
2710
  })
2624
- ) : e.push(ct), o.uiFactories.slashMenuFactory && e.push(
2711
+ ) : e.push(ut), o.uiFactories.slashMenuFactory && e.push(
2625
2712
  We().configure({
2626
2713
  editor: o.editor,
2627
2714
  commands: o.slashCommands,
@@ -2638,7 +2725,8 @@ class Ko {
2638
2725
  h(this, "_tiptapEditor");
2639
2726
  h(this, "blockCache", /* @__PURE__ */ new WeakMap());
2640
2727
  h(this, "schema");
2641
- var i, a, s;
2728
+ h(this, "ready", !1);
2729
+ var i, s, a;
2642
2730
  this.options = e;
2643
2731
  const t = {
2644
2732
  defaultStyles: !0,
@@ -2647,7 +2735,7 @@ class Ko {
2647
2735
  // If BSchema is not specified, then options.blockSchema should also not
2648
2736
  // be defined. Unfortunately, trying to implement these constraints seems
2649
2737
  // to be a huge pain, hence the `as any` casts.
2650
- blockSchema: e.blockSchema || ge,
2738
+ blockSchema: e.blockSchema || ke,
2651
2739
  ...e
2652
2740
  }, n = go({
2653
2741
  editor: this,
@@ -2669,36 +2757,39 @@ class Ko {
2669
2757
  ...t._tiptapOptions,
2670
2758
  onCreate: () => {
2671
2759
  var l;
2672
- (l = t.onEditorReady) == null || l.call(t, this), t.initialContent && this.replaceBlocks(this.topLevelBlocks, t.initialContent);
2760
+ (l = t.onEditorReady) == null || l.call(t, this), t.initialContent && this.replaceBlocks(this.topLevelBlocks, t.initialContent), this.ready = !0;
2673
2761
  },
2674
2762
  onUpdate: () => {
2675
2763
  var l;
2676
- (l = t.onEditorContentChange) == null || l.call(t, this);
2764
+ this.ready && ((l = t.onEditorContentChange) == null || l.call(t, this));
2677
2765
  },
2678
2766
  onSelectionUpdate: () => {
2679
2767
  var l;
2680
- (l = t.onTextCursorPositionChange) == null || l.call(t, this);
2768
+ this.ready && ((l = t.onTextCursorPositionChange) == null || l.call(t, this));
2681
2769
  },
2682
2770
  editable: e.editable === void 0 ? !0 : e.editable,
2683
- extensions: t.enableBlockNoteExtensions === !1 ? (i = t._tiptapOptions) == null ? void 0 : i.extensions : [...((a = t._tiptapOptions) == null ? void 0 : a.extensions) || [], ...n],
2771
+ extensions: t.enableBlockNoteExtensions === !1 ? (i = t._tiptapOptions) == null ? void 0 : i.extensions : [...((s = t._tiptapOptions) == null ? void 0 : s.extensions) || [], ...n],
2684
2772
  editorProps: {
2685
2773
  attributes: {
2686
2774
  "data-theme": e.theme || "light",
2687
2775
  ...t.editorDOMAttributes || {},
2688
2776
  class: [
2689
- P.bnEditor,
2690
- P.bnRoot,
2691
- t.defaultStyles ? P.defaultStyles : "",
2692
- ((s = t.editorDOMAttributes) == null ? void 0 : s.class) || ""
2777
+ _.bnEditor,
2778
+ _.bnRoot,
2779
+ t.defaultStyles ? _.defaultStyles : "",
2780
+ ((a = t.editorDOMAttributes) == null ? void 0 : a.class) || ""
2693
2781
  ].join(" ")
2694
2782
  }
2695
2783
  }
2696
2784
  };
2697
- t.parentElement && (r.element = t.parentElement), this._tiptapEditor = new zt(r);
2785
+ t.parentElement && (r.element = t.parentElement), this._tiptapEditor = new Ut(r);
2698
2786
  }
2699
2787
  get domElement() {
2700
2788
  return this._tiptapEditor.view.dom;
2701
2789
  }
2790
+ isFocused() {
2791
+ return this._tiptapEditor.view.hasFocus();
2792
+ }
2702
2793
  focus() {
2703
2794
  this._tiptapEditor.view.focus();
2704
2795
  }
@@ -2708,7 +2799,7 @@ class Ko {
2708
2799
  */
2709
2800
  get topLevelBlocks() {
2710
2801
  const e = [];
2711
- return this._tiptapEditor.state.doc.firstChild.descendants((t) => (e.push(B(t, this.schema, this.blockCache)), !1)), e;
2802
+ return this._tiptapEditor.state.doc.firstChild.descendants((t) => (e.push(w(t, this.schema, this.blockCache)), !1)), e;
2712
2803
  }
2713
2804
  /**
2714
2805
  * Gets a snapshot of an existing block from the editor.
@@ -2718,7 +2809,7 @@ class Ko {
2718
2809
  getBlock(e) {
2719
2810
  const t = typeof e == "string" ? e : e.id;
2720
2811
  let n;
2721
- return this._tiptapEditor.state.doc.firstChild.descendants((r) => typeof n < "u" ? !1 : r.type.name !== "blockContainer" || r.attrs.id !== t ? !0 : (n = B(r, this.schema, this.blockCache), !1)), n;
2812
+ return this._tiptapEditor.state.doc.firstChild.descendants((r) => typeof n < "u" ? !1 : r.type.name !== "blockContainer" || r.attrs.id !== t ? !0 : (n = w(r, this.schema, this.blockCache), !1)), n;
2722
2813
  }
2723
2814
  /**
2724
2815
  * Traverses all blocks in the editor depth-first, and executes a callback for each.
@@ -2729,11 +2820,11 @@ class Ko {
2729
2820
  const n = this.topLevelBlocks.slice();
2730
2821
  t && n.reverse();
2731
2822
  function r(i) {
2732
- for (const a of i) {
2733
- if (!e(a))
2823
+ for (const s of i) {
2824
+ if (!e(s))
2734
2825
  return !1;
2735
- const s = t ? a.children.slice().reverse() : a.children;
2736
- if (!r(s))
2826
+ const a = t ? s.children.slice().reverse() : s.children;
2827
+ if (!r(a))
2737
2828
  return !1;
2738
2829
  }
2739
2830
  return !0;
@@ -2755,14 +2846,14 @@ class Ko {
2755
2846
  const { node: e, depth: t, startPos: n, endPos: r } = g(
2756
2847
  this._tiptapEditor.state.doc,
2757
2848
  this._tiptapEditor.state.selection.from
2758
- ), i = this._tiptapEditor.state.doc.resolve(r).index(t - 1), a = this._tiptapEditor.state.doc.resolve(r + 1).node().childCount;
2759
- let s;
2760
- i > 0 && (s = this._tiptapEditor.state.doc.resolve(n - 2).node());
2849
+ ), i = this._tiptapEditor.state.doc.resolve(r).index(t - 1), s = this._tiptapEditor.state.doc.resolve(r + 1).node().childCount;
2850
+ let a;
2851
+ i > 0 && (a = this._tiptapEditor.state.doc.resolve(n - 2).node());
2761
2852
  let l;
2762
- return i < a - 1 && (l = this._tiptapEditor.state.doc.resolve(r + 2).node()), {
2763
- block: B(e, this.schema, this.blockCache),
2764
- prevBlock: s === void 0 ? void 0 : B(s, this.schema, this.blockCache),
2765
- nextBlock: l === void 0 ? void 0 : B(l, this.schema, this.blockCache)
2853
+ return i < s - 1 && (l = this._tiptapEditor.state.doc.resolve(r + 2).node()), {
2854
+ block: w(e, this.schema, this.blockCache),
2855
+ prevBlock: a === void 0 ? void 0 : w(a, this.schema, this.blockCache),
2856
+ nextBlock: l === void 0 ? void 0 : w(l, this.schema, this.blockCache)
2766
2857
  };
2767
2858
  }
2768
2859
  /**
@@ -2772,12 +2863,12 @@ class Ko {
2772
2863
  * @param placement Whether the text cursor should be placed at the start or end of the block.
2773
2864
  */
2774
2865
  setTextCursorPosition(e, t = "start") {
2775
- const n = typeof e == "string" ? e : e.id, { posBeforeNode: r } = J(n, this._tiptapEditor.state.doc), { startPos: i, contentNode: a } = g(
2866
+ const n = typeof e == "string" ? e : e.id, { posBeforeNode: r } = J(n, this._tiptapEditor.state.doc), { startPos: i, contentNode: s } = g(
2776
2867
  this._tiptapEditor.state.doc,
2777
2868
  r + 2
2778
2869
  );
2779
2870
  t === "start" ? this._tiptapEditor.commands.setTextSelection(i + 1) : this._tiptapEditor.commands.setTextSelection(
2780
- i + a.nodeSize - 1
2871
+ i + s.nodeSize - 1
2781
2872
  );
2782
2873
  }
2783
2874
  /**
@@ -2788,7 +2879,7 @@ class Ko {
2788
2879
  return;
2789
2880
  const e = [];
2790
2881
  return this._tiptapEditor.state.doc.descendants((t, n) => t.type.spec.group !== "blockContent" || n + t.nodeSize < this._tiptapEditor.state.selection.from || n > this._tiptapEditor.state.selection.to ? !0 : (e.push(
2791
- B(
2882
+ w(
2792
2883
  this._tiptapEditor.state.doc.resolve(n).node(),
2793
2884
  this.schema,
2794
2885
  this.blockCache
@@ -2828,14 +2919,14 @@ class Ko {
2828
2919
  * @param update A partial block which defines how the existing block should be changed.
2829
2920
  */
2830
2921
  updateBlock(e, t) {
2831
- Me(e, t, this._tiptapEditor);
2922
+ Be(e, t, this._tiptapEditor);
2832
2923
  }
2833
2924
  /**
2834
2925
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
2835
2926
  * @param blocksToRemove An array of identifiers for existing blocks that should be removed.
2836
2927
  */
2837
2928
  removeBlocks(e) {
2838
- wt(e, this._tiptapEditor);
2929
+ xt(e, this._tiptapEditor);
2839
2930
  }
2840
2931
  /**
2841
2932
  * Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
@@ -2845,7 +2936,7 @@ class Ko {
2845
2936
  * @param blocksToInsert An array of partial blocks to replace the old ones with.
2846
2937
  */
2847
2938
  replaceBlocks(e, t) {
2848
- Be(e, t, this._tiptapEditor);
2939
+ we(e, t, this._tiptapEditor);
2849
2940
  }
2850
2941
  /**
2851
2942
  * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
@@ -2982,7 +3073,7 @@ class Ko {
2982
3073
  * @returns The blocks parsed from the HTML string.
2983
3074
  */
2984
3075
  async HTMLToBlocks(e) {
2985
- return xt(e, this.schema, this._tiptapEditor.schema);
3076
+ return It(e, this.schema, this._tiptapEditor.schema);
2986
3077
  }
2987
3078
  /**
2988
3079
  * Serializes blocks into a Markdown string. The output is simplified as Markdown does not support all features of
@@ -2991,7 +3082,7 @@ class Ko {
2991
3082
  * @returns The blocks, serialized as a Markdown string.
2992
3083
  */
2993
3084
  async blocksToMarkdown(e) {
2994
- return Se(e, this._tiptapEditor.schema);
3085
+ return xe(e, this._tiptapEditor.schema);
2995
3086
  }
2996
3087
  /**
2997
3088
  * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
@@ -3001,7 +3092,7 @@ class Ko {
3001
3092
  * @returns The blocks parsed from the Markdown string.
3002
3093
  */
3003
3094
  async markdownToBlocks(e) {
3004
- return xe(e, this.schema, this._tiptapEditor.schema);
3095
+ return Se(e, this.schema, this._tiptapEditor.schema);
3005
3096
  }
3006
3097
  /**
3007
3098
  * Updates the user info for the current user that's shown to other collaborators.
@@ -3022,12 +3113,12 @@ export {
3022
3113
  ot as camelToDataKebab,
3023
3114
  Yo as createBlockSpec,
3024
3115
  H as createTipTapBlock,
3025
- ge as defaultBlockSchema,
3026
- N as defaultProps,
3116
+ ke as defaultBlockSchema,
3117
+ L as defaultProps,
3027
3118
  uo as defaultSlashMenuItems,
3028
3119
  go as getBlockNoteExtensions,
3029
- le as parse,
3030
- ae as propsToAttributes,
3031
- de as render
3120
+ de as parse,
3121
+ le as propsToAttributes,
3122
+ ce as render
3032
3123
  };
3033
3124
  //# sourceMappingURL=blocknote.js.map