@blocknote/core 0.8.5 → 0.9.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 (65) hide show
  1. package/dist/blocknote.js +705 -572
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +5 -4
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/package.json +2 -2
  7. package/src/BlockNoteEditor.ts +13 -17
  8. package/src/BlockNoteExtensions.ts +42 -27
  9. package/src/api/blockManipulation/blockManipulation.test.ts +2 -2
  10. package/src/api/blockManipulation/blockManipulation.ts +1 -1
  11. package/src/api/formatConversions/formatConversions.test.ts +2 -2
  12. package/src/api/formatConversions/formatConversions.ts +47 -3
  13. package/src/api/nodeConversions/nodeConversions.test.ts +6 -6
  14. package/src/api/nodeConversions/nodeConversions.ts +6 -6
  15. package/src/editor.module.css +0 -11
  16. package/src/extensions/Blocks/PreviousBlockTypePlugin.ts +2 -2
  17. package/src/extensions/Blocks/api/block.ts +55 -22
  18. package/src/extensions/Blocks/api/blockTypes.ts +22 -3
  19. package/src/extensions/Blocks/helpers/getBlockInfoFromPos.ts +27 -5
  20. package/src/extensions/Blocks/index.ts +7 -12
  21. package/src/extensions/Blocks/nodes/Block.module.css +1 -1
  22. package/src/extensions/Blocks/nodes/BlockContainer.ts +20 -19
  23. package/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.ts +20 -2
  24. package/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +20 -2
  25. package/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +20 -2
  26. package/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.ts +29 -6
  27. package/src/extensions/Blocks/nodes/BlockGroup.ts +19 -11
  28. package/src/extensions/SideMenu/MultipleNodeSelection.ts +3 -3
  29. package/src/extensions/SideMenu/SideMenuPlugin.ts +9 -9
  30. package/src/extensions/UniqueID/UniqueID.ts +10 -9
  31. package/src/index.ts +1 -0
  32. package/src/shared/EventEmitter.ts +1 -0
  33. package/src/shared/plugins/suggestion/SuggestionPlugin.ts +6 -2
  34. package/src/shared/utils.ts +4 -0
  35. package/types/src/BlockNoteEditor.d.ts +4 -10
  36. package/types/src/BlockNoteExtensions.d.ts +2 -0
  37. package/types/src/extensions/Blocks/api/block.d.ts +6 -1
  38. package/types/src/extensions/Blocks/api/blockTypes.d.ts +15 -3
  39. package/types/src/extensions/Blocks/api/defaultBlocks.d.ts +36 -4
  40. package/types/src/extensions/Blocks/helpers/getBlockInfoFromPos.d.ts +9 -1
  41. package/types/src/extensions/Blocks/index.d.ts +4 -1
  42. package/types/src/extensions/Blocks/nodes/BlockContainer.d.ts +9 -4
  43. package/types/src/extensions/Blocks/nodes/BlockContent/HeadingBlockContent/HeadingBlockContent.d.ts +9 -1
  44. package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.d.ts +9 -1
  45. package/types/src/extensions/Blocks/nodes/BlockContent/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.d.ts +9 -1
  46. package/types/src/extensions/Blocks/nodes/BlockContent/ParagraphBlockContent/ParagraphBlockContent.d.ts +9 -1
  47. package/types/src/extensions/Blocks/nodes/BlockGroup.d.ts +9 -1
  48. package/types/src/extensions/Blocks/nodes/TableCell.d.ts +5 -0
  49. package/types/src/extensions/Blocks/nodes/TableRow.d.ts +5 -0
  50. package/types/src/extensions/SideMenu/MultipleNodeSelection.d.ts +1 -1
  51. package/types/src/index.d.ts +1 -0
  52. package/types/src/shared/utils.d.ts +1 -0
  53. package/src/node_modules/.vitest/results.json +0 -1
  54. package/types/src/EventEmitter.d.ts +0 -11
  55. package/types/src/extensions/DraggableBlocks/BlockSideMenuFactoryTypes.d.ts +0 -0
  56. package/types/src/extensions/DraggableBlocks/DraggableBlocksExtension.d.ts +0 -16
  57. package/types/src/extensions/DraggableBlocks/DraggableBlocksPlugin.d.ts +0 -55
  58. package/types/src/extensions/DraggableBlocks/MultipleNodeSelection.d.ts +0 -24
  59. package/types/src/extensions/FormattingToolbar/FormattingToolbarExtension.d.ts +0 -11
  60. package/types/src/extensions/FormattingToolbar/FormattingToolbarFactoryTypes.d.ts +0 -10
  61. package/types/src/extensions/HyperlinkToolbar/HyperlinkMark.d.ts +0 -8
  62. package/types/src/extensions/HyperlinkToolbar/HyperlinkToolbarFactoryTypes.d.ts +0 -0
  63. package/types/src/extensions/SlashMenu/SlashMenuExtension.d.ts +0 -13
  64. package/types/src/extensions/SlashMenu/index.d.ts +0 -3
  65. package/types/src/shared/plugins/suggestion/SuggestionsMenuFactoryTypes.d.ts +0 -12
package/dist/blocknote.js CHANGED
@@ -1,43 +1,53 @@
1
- var Lt = Object.defineProperty;
2
- var Nt = (n, e, t) => e in n ? Lt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var u = (n, e, t) => (Nt(n, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { Extension as B, Mark as at, Node as V, InputRule as Y, mergeAttributes as x, combineTransactionSteps as Pt, getChangedRanges as Ot, findChildrenInRange as Dt, findChildren as Q, findParentNode as Rt, extensions as L, isTextSelection as zt, isNodeSelection as Vt, posToDOMRect as j, getMarkRange as tt, Editor as Ut } from "@tiptap/core";
5
- import { Bold as Ft } from "@tiptap/extension-bold";
6
- import { Code as Gt } from "@tiptap/extension-code";
7
- import $t from "@tiptap/extension-collaboration";
8
- import jt from "@tiptap/extension-collaboration-cursor";
9
- import { Dropcursor as qt } from "@tiptap/extension-dropcursor";
10
- import { Gapcursor as Wt } from "@tiptap/extension-gapcursor";
11
- import { HardBreak as Yt } from "@tiptap/extension-hard-break";
12
- import { History as Jt } from "@tiptap/extension-history";
13
- import { Italic as Kt } from "@tiptap/extension-italic";
14
- import { Link as Xt } from "@tiptap/extension-link";
15
- import { Strike as Zt } from "@tiptap/extension-strike";
16
- import { Text as Qt } from "@tiptap/extension-text";
17
- import { Underline as te } from "@tiptap/extension-underline";
18
- import { Slice as T, Fragment as I, DOMSerializer as q, DOMParser as ee } from "prosemirror-model";
19
- import { PluginKey as S, Plugin as y, TextSelection as et, Selection as $, NodeSelection as oe } from "prosemirror-state";
20
- import { v4 as ne } from "uuid";
21
- import * as re from "prosemirror-view";
22
- import { Decoration as R, DecorationSet as z } from "prosemirror-view";
23
- import lt from "rehype-parse";
24
- import ie from "rehype-remark";
25
- import dt from "rehype-stringify";
26
- import ct from "remark-gfm";
27
- import se from "remark-parse";
28
- import ae from "remark-rehype";
29
- import le from "remark-stringify";
1
+ var Pt = Object.defineProperty;
2
+ var Ot = (n, e, t) => e in n ? Pt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var u = (n, e, t) => (Ot(n, typeof e != "symbol" ? e + "" : e, t), t);
4
+ import { Extension as T, Mark as lt, Node as U, InputRule as K, mergeAttributes as A, combineTransactionSteps as Dt, getChangedRanges as Rt, findChildrenInRange as Vt, findChildren as tt, findParentNode as zt, extensions as L, isTextSelection as Ut, isNodeSelection as Ft, posToDOMRect as q, getMarkRange as et, Editor as Gt } from "@tiptap/core";
5
+ import { Bold as $t } from "@tiptap/extension-bold";
6
+ import { Code as jt } from "@tiptap/extension-code";
7
+ import qt from "@tiptap/extension-collaboration";
8
+ import Wt from "@tiptap/extension-collaboration-cursor";
9
+ import { Dropcursor as Yt } from "@tiptap/extension-dropcursor";
10
+ import { Gapcursor as Kt } from "@tiptap/extension-gapcursor";
11
+ import { HardBreak as Jt } from "@tiptap/extension-hard-break";
12
+ import { History as Xt } from "@tiptap/extension-history";
13
+ import { Italic as Zt } from "@tiptap/extension-italic";
14
+ import { Link as Qt } from "@tiptap/extension-link";
15
+ import { Strike as te } from "@tiptap/extension-strike";
16
+ import { Text as ee } from "@tiptap/extension-text";
17
+ import { Underline as oe } from "@tiptap/extension-underline";
18
+ import { Slice as x, Fragment as _, DOMSerializer as W, DOMParser as ne } from "prosemirror-model";
19
+ import { PluginKey as S, Plugin as w, TextSelection as ot, Selection as j, NodeSelection as re } from "prosemirror-state";
20
+ import { v4 as ie } from "uuid";
21
+ import * as se from "prosemirror-view";
22
+ import { Decoration as V, DecorationSet as z } from "prosemirror-view";
23
+ import dt from "rehype-parse";
24
+ import ae from "rehype-remark";
25
+ import ct from "rehype-stringify";
26
+ import ut from "remark-gfm";
27
+ import le from "remark-parse";
28
+ import de, { defaultHandlers as ce } from "remark-rehype";
29
+ import ue from "remark-stringify";
30
30
  import { unified as J } from "unified";
31
- import { fromDom as ot } from "hast-util-from-dom";
32
- const de = "_bnEditor_4vj2p_3", ce = "_bnRoot_4vj2p_20", ue = "_defaultStyles_4vj2p_35", pe = "_dragPreview_4vj2p_68", H = {
33
- bnEditor: de,
34
- bnRoot: ce,
35
- defaultStyles: ue,
36
- dragPreview: pe,
37
- "collaboration-cursor__caret": "_collaboration-cursor__caret_4vj2p_74",
38
- "collaboration-cursor__label": "_collaboration-cursor__label_4vj2p_85"
31
+ import { fromDom as nt } from "hast-util-from-dom";
32
+ const pe = "_bnEditor_1pmoa_3", he = "_bnRoot_1pmoa_19", fe = "_defaultStyles_1pmoa_34", me = "_dragPreview_1pmoa_57", H = {
33
+ bnEditor: pe,
34
+ bnRoot: he,
35
+ defaultStyles: fe,
36
+ dragPreview: me,
37
+ "collaboration-cursor__caret": "_collaboration-cursor__caret_1pmoa_63",
38
+ "collaboration-cursor__label": "_collaboration-cursor__label_1pmoa_74"
39
39
  };
40
- function g(n, e) {
40
+ function pt(n) {
41
+ const e = n.attrs.id, t = n.firstChild, o = t.type, r = n.childCount === 2 ? n.lastChild.childCount : 0;
42
+ return {
43
+ id: e,
44
+ node: n,
45
+ contentNode: t,
46
+ contentType: o,
47
+ numChildBlocks: r
48
+ };
49
+ }
50
+ function k(n, e) {
41
51
  const o = n.nodeSize - 2;
42
52
  if (e <= 1)
43
53
  for (e = 1 + 1; n.resolve(e).parent.type.name !== "blockContainer" && e < o; )
@@ -57,19 +67,19 @@ function g(n, e) {
57
67
  break;
58
68
  l -= 1, s = r.node(l);
59
69
  }
60
- const a = s.attrs.id, d = s.firstChild, c = d.type, p = s.childCount === 2 ? s.lastChild.childCount : 0, h = r.start(l), f = r.end(l);
70
+ const { id: a, contentNode: d, contentType: c, numChildBlocks: h } = pt(s), p = r.start(l), f = r.end(l);
61
71
  return {
62
72
  id: a,
63
73
  node: s,
64
74
  contentNode: d,
65
75
  contentType: c,
66
- numChildBlocks: p,
67
- startPos: h,
76
+ numChildBlocks: h,
77
+ startPos: p,
68
78
  endPos: f,
69
79
  depth: l
70
80
  };
71
81
  }
72
- const he = B.create({
82
+ const ke = T.create({
73
83
  name: "blockBackgroundColor",
74
84
  addGlobalAttributes() {
75
85
  return [
@@ -90,7 +100,7 @@ const he = B.create({
90
100
  addCommands() {
91
101
  return {
92
102
  setBlockBackgroundColor: (n, e) => ({ state: t, view: o }) => {
93
- const r = g(t.doc, n);
103
+ const r = k(t.doc, n);
94
104
  return r === void 0 ? !1 : (t.tr.setNodeAttribute(
95
105
  r.startPos - 1,
96
106
  "backgroundColor",
@@ -99,7 +109,7 @@ const he = B.create({
99
109
  }
100
110
  };
101
111
  }
102
- }), fe = at.create({
112
+ }), ge = lt.create({
103
113
  name: "backgroundColor",
104
114
  addAttributes() {
105
115
  return {
@@ -128,33 +138,44 @@ const he = B.create({
128
138
  setBackgroundColor: (n) => ({ commands: e }) => n !== "default" ? e.setMark(this.name, { color: n }) : e.unsetMark(this.name)
129
139
  };
130
140
  }
131
- }), ut = "_blockOuter_xgzwr_5", pt = "_block_xgzwr_5", ht = "_reactNodeViewRenderer_xgzwr_17", ft = "_blockContent_xgzwr_22", mt = "_blockGroup_xgzwr_42", gt = "_isEmpty_xgzwr_240", kt = "_inlineContent_xgzwr_240", bt = "_isFilter_xgzwr_241", yt = "_hasAnchor_xgzwr_263", k = {
132
- blockOuter: ut,
133
- block: pt,
134
- reactNodeViewRenderer: ht,
135
- blockContent: ft,
136
- blockGroup: mt,
137
- isEmpty: gt,
138
- inlineContent: kt,
139
- isFilter: bt,
140
- hasAnchor: yt
141
- }, jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
141
+ }), ht = "_blockOuter_7sok8_5", ft = "_block_7sok8_5", mt = "_reactNodeViewRenderer_7sok8_17", kt = "_blockContent_7sok8_22", gt = "_blockGroup_7sok8_42", bt = "_isEmpty_7sok8_240", yt = "_inlineContent_7sok8_240", vt = "_isFilter_7sok8_241", Ct = "_hasAnchor_7sok8_263", y = {
142
+ blockOuter: ht,
143
+ block: ft,
144
+ reactNodeViewRenderer: mt,
145
+ blockContent: kt,
146
+ blockGroup: gt,
147
+ isEmpty: bt,
148
+ inlineContent: yt,
149
+ isFilter: vt,
150
+ hasAnchor: Ct
151
+ }, Jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
142
152
  __proto__: null,
143
- block: pt,
144
- blockContent: ft,
145
- blockGroup: mt,
146
- blockOuter: ut,
147
- default: k,
148
- hasAnchor: yt,
149
- inlineContent: kt,
150
- isEmpty: gt,
151
- isFilter: bt,
152
- reactNodeViewRenderer: ht
153
- }, Symbol.toStringTag, { value: "Module" }));
154
- function nt(n) {
153
+ block: ft,
154
+ blockContent: kt,
155
+ blockGroup: gt,
156
+ blockOuter: ht,
157
+ default: y,
158
+ hasAnchor: Ct,
159
+ inlineContent: yt,
160
+ isEmpty: bt,
161
+ isFilter: vt,
162
+ reactNodeViewRenderer: mt
163
+ }, Symbol.toStringTag, { value: "Module" })), be = () => /Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
164
+ function Xo(n) {
165
+ return be() ? n.replace("Mod", "⌘") : n.replace("Mod", "Ctrl");
166
+ }
167
+ function v(...n) {
168
+ return n.filter((e) => e).join(" ");
169
+ }
170
+ class ye extends Error {
171
+ constructor(e) {
172
+ super(`Unreachable case: ${e}`);
173
+ }
174
+ }
175
+ function rt(n) {
155
176
  return "data-" + n.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
156
177
  }
157
- function me(n) {
178
+ function ve(n) {
158
179
  const e = {};
159
180
  return Object.entries(n.propSchema).forEach(([t, o]) => {
160
181
  e[t] = {
@@ -163,21 +184,21 @@ function me(n) {
163
184
  // Props are displayed in kebab-case as HTML attributes. If a prop's
164
185
  // value is the same as its default, we don't display an HTML
165
186
  // attribute for it.
166
- parseHTML: (r) => r.getAttribute(nt(t)),
187
+ parseHTML: (r) => r.getAttribute(rt(t)),
167
188
  renderHTML: (r) => r[t] !== o.default ? {
168
- [nt(t)]: r[t]
189
+ [rt(t)]: r[t]
169
190
  } : {}
170
191
  };
171
192
  }), e;
172
193
  }
173
- function ge(n) {
194
+ function Ce(n) {
174
195
  return [
175
196
  {
176
197
  tag: "div[data-content-type=" + n.type + "]"
177
198
  }
178
199
  ];
179
200
  }
180
- function ke(n, e) {
201
+ function we(n, e) {
181
202
  const t = document.createElement("div");
182
203
  t.setAttribute("data-content-type", n.type);
183
204
  for (const [r, i] of Object.entries(e))
@@ -190,42 +211,57 @@ function ke(n, e) {
190
211
  dom: t
191
212
  };
192
213
  }
193
- function qo(n) {
214
+ function Zo(n) {
194
215
  return {
195
- node: P({
216
+ node: O({
196
217
  name: n.type,
197
218
  content: n.containsInlineContent ? "inline*" : "",
198
219
  selectable: n.containsInlineContent,
199
- addOptions() {
200
- return {
201
- editor: void 0
202
- };
203
- },
204
220
  addAttributes() {
205
- return me(n);
221
+ return ve(n);
206
222
  },
207
223
  parseHTML() {
208
- return ge(n);
224
+ return Ce(n);
209
225
  },
210
226
  renderHTML({ HTMLAttributes: t }) {
211
- return ke(n, t);
227
+ return we(n, t);
212
228
  },
213
229
  addNodeView() {
214
230
  return ({ HTMLAttributes: t, getPos: o }) => {
215
- const r = document.createElement("div");
216
- r.className = k.blockContent, r.setAttribute("data-content-type", n.type);
217
- for (const [h, f] of Object.entries(t))
218
- r.setAttribute(h, f);
219
- const i = this.options.editor;
231
+ var f, m;
232
+ const r = document.createElement("div"), i = ((f = this.options.domAttributes) == null ? void 0 : f.blockContent) || {};
233
+ for (const [g, b] of Object.entries(
234
+ i
235
+ ))
236
+ g !== "class" && r.setAttribute(g, b);
237
+ r.className = v(
238
+ y.blockContent,
239
+ i.class
240
+ ), r.setAttribute("data-content-type", n.type);
241
+ for (const [g, b] of Object.entries(t))
242
+ r.setAttribute(g, b);
243
+ const s = this.options.editor;
220
244
  if (typeof o == "boolean")
221
245
  throw new Error(
222
246
  "Cannot find node position as getPos is a boolean, not a function."
223
247
  );
224
- const s = o(), d = i._tiptapEditor.state.doc.resolve(s).node().attrs.id, c = i.getBlock(d);
225
- if (c.type !== n.type)
248
+ const l = o(), c = s._tiptapEditor.state.doc.resolve(l).node().attrs.id, h = s.getBlock(c);
249
+ if (h.type !== n.type)
226
250
  throw new Error("Block type does not match");
227
- const p = n.render(c, i);
228
- return "contentDOM" in p && (p.contentDOM.className = `${p.contentDOM.className ? p.contentDOM.className + " " : ""}${k.inlineContent}`), r.appendChild(p.dom), "contentDOM" in p ? {
251
+ const p = n.render(h, s);
252
+ if ("contentDOM" in p) {
253
+ const g = ((m = this.options.domAttributes) == null ? void 0 : m.inlineContent) || {};
254
+ for (const [b, C] of Object.entries(
255
+ g
256
+ ))
257
+ b !== "class" && p.contentDOM.setAttribute(b, C);
258
+ p.contentDOM.className = v(
259
+ p.contentDOM.className,
260
+ y.inlineContent,
261
+ g.class
262
+ );
263
+ }
264
+ return r.appendChild(p.dom), "contentDOM" in p ? {
229
265
  dom: r,
230
266
  contentDOM: p.contentDOM
231
267
  } : {
@@ -237,13 +273,13 @@ function qo(n) {
237
273
  propSchema: n.propSchema
238
274
  };
239
275
  }
240
- function P(n) {
241
- return V.create({
276
+ function O(n) {
277
+ return U.create({
242
278
  ...n,
243
279
  group: "blockContent"
244
280
  });
245
281
  }
246
- const be = P({
282
+ const Se = O({
247
283
  name: "heading",
248
284
  content: "inline*",
249
285
  addAttributes() {
@@ -260,7 +296,7 @@ const be = P({
260
296
  },
261
297
  addInputRules() {
262
298
  return [
263
- ...["1", "2", "3"].map((n) => new Y({
299
+ ...["1", "2", "3"].map((n) => new K({
264
300
  find: new RegExp(`^(#{${parseInt(n)}})\\s$`),
265
301
  handler: ({ state: e, chain: t, range: o }) => {
266
302
  t().BNUpdateBlock(e.selection.from, {
@@ -293,17 +329,31 @@ const be = P({
293
329
  ];
294
330
  },
295
331
  renderHTML({ node: n, HTMLAttributes: e }) {
332
+ var r, i;
333
+ const t = ((r = this.options.domAttributes) == null ? void 0 : r.blockContent) || {}, o = ((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {};
296
334
  return [
297
335
  "div",
298
- x(e, {
299
- class: k.blockContent,
336
+ A(e, {
337
+ class: v(
338
+ y.blockContent,
339
+ t.class
340
+ ),
300
341
  "data-content-type": this.name
301
342
  }),
302
- ["h" + n.attrs.level, { class: k.inlineContent }, 0]
343
+ [
344
+ "h" + n.attrs.level,
345
+ {
346
+ class: v(
347
+ y.inlineContent,
348
+ o.class
349
+ )
350
+ },
351
+ 0
352
+ ]
303
353
  ];
304
354
  }
305
- }), vt = (n) => {
306
- const { node: e, contentType: t } = g(
355
+ }), wt = (n) => {
356
+ const { node: e, contentType: t } = k(
307
357
  n.state.doc,
308
358
  n.state.selection.from
309
359
  ), o = n.state.selection.anchor === n.state.selection.head;
@@ -321,13 +371,13 @@ const be = P({
321
371
  s.command(() => e.textContent.length > 0 ? (i().deleteSelection().BNSplitBlock(r.selection.from, !0).run(), !0) : !1)
322
372
  )
323
373
  ]);
324
- }, ye = P({
374
+ }, Me = O({
325
375
  name: "bulletListItem",
326
376
  content: "inline*",
327
377
  addInputRules() {
328
378
  return [
329
379
  // Creates an unordered list when starting with "-", "+", or "*".
330
- new Y({
380
+ new K({
331
381
  find: new RegExp("^[-+*]\\s$"),
332
382
  handler: ({ state: n, chain: e, range: t }) => {
333
383
  e().BNUpdateBlock(n.selection.from, {
@@ -340,7 +390,7 @@ const be = P({
340
390
  },
341
391
  addKeyboardShortcuts() {
342
392
  return {
343
- Enter: () => vt(this.editor)
393
+ Enter: () => wt(this.editor)
344
394
  };
345
395
  },
346
396
  parseHTML() {
@@ -371,17 +421,31 @@ const be = P({
371
421
  ];
372
422
  },
373
423
  renderHTML({ HTMLAttributes: n }) {
424
+ var o, r;
425
+ const e = ((o = this.options.domAttributes) == null ? void 0 : o.blockContent) || {}, t = ((r = this.options.domAttributes) == null ? void 0 : r.inlineContent) || {};
374
426
  return [
375
427
  "div",
376
- x(n, {
377
- class: k.blockContent,
428
+ A(n, {
429
+ class: v(
430
+ y.blockContent,
431
+ e.class
432
+ ),
378
433
  "data-content-type": this.name
379
434
  }),
380
- ["p", { class: k.inlineContent }, 0]
435
+ [
436
+ "p",
437
+ {
438
+ class: v(
439
+ y.inlineContent,
440
+ t.class
441
+ )
442
+ },
443
+ 0
444
+ ]
381
445
  ];
382
446
  }
383
- }), ve = new S("numbered-list-indexing"), we = () => new y({
384
- key: ve,
447
+ }), Ee = new S("numbered-list-indexing"), Be = () => new w({
448
+ key: Ee,
385
449
  appendTransaction: (n, e, t) => {
386
450
  const o = t.tr;
387
451
  o.setMeta("numberedListIndexing", !0);
@@ -389,18 +453,18 @@ const be = P({
389
453
  return t.doc.descendants((i, s) => {
390
454
  if (i.type.name === "blockContainer" && i.firstChild.type.name === "numberedListItem") {
391
455
  let l = "1";
392
- const a = s === 1, d = g(o.doc, s + 1);
456
+ const a = s === 1, d = k(o.doc, s + 1);
393
457
  if (d === void 0)
394
458
  return;
395
459
  if (!a) {
396
- const h = g(o.doc, s - 2);
397
- if (h === void 0)
460
+ const p = k(o.doc, s - 2);
461
+ if (p === void 0)
398
462
  return;
399
- if (!(d.depth !== h.depth)) {
400
- const m = h.contentNode;
401
- if (h.contentType.name === "numberedListItem") {
402
- const w = m.attrs.index;
403
- l = (parseInt(w) + 1).toString();
463
+ if (!(d.depth !== p.depth)) {
464
+ const m = p.contentNode;
465
+ if (p.contentType.name === "numberedListItem") {
466
+ const C = m.attrs.index;
467
+ l = (parseInt(C) + 1).toString();
404
468
  }
405
469
  }
406
470
  }
@@ -410,7 +474,7 @@ const be = P({
410
474
  }
411
475
  }), r ? o : null;
412
476
  }
413
- }), Se = P({
477
+ }), Te = O({
414
478
  name: "numberedListItem",
415
479
  content: "inline*",
416
480
  addAttributes() {
@@ -427,7 +491,7 @@ const be = P({
427
491
  addInputRules() {
428
492
  return [
429
493
  // Creates an ordered list when starting with "1.".
430
- new Y({
494
+ new K({
431
495
  find: new RegExp("^1\\.\\s$"),
432
496
  handler: ({ state: n, chain: e, range: t }) => {
433
497
  e().BNUpdateBlock(n.selection.from, {
@@ -440,11 +504,11 @@ const be = P({
440
504
  },
441
505
  addKeyboardShortcuts() {
442
506
  return {
443
- Enter: () => vt(this.editor)
507
+ Enter: () => wt(this.editor)
444
508
  };
445
509
  },
446
510
  addProseMirrorPlugins() {
447
- return [we()];
511
+ return [Be()];
448
512
  },
449
513
  parseHTML() {
450
514
  return [
@@ -476,18 +540,32 @@ const be = P({
476
540
  ];
477
541
  },
478
542
  renderHTML({ HTMLAttributes: n }) {
543
+ var o, r;
544
+ const e = ((o = this.options.domAttributes) == null ? void 0 : o.blockContent) || {}, t = ((r = this.options.domAttributes) == null ? void 0 : r.inlineContent) || {};
479
545
  return [
480
546
  "div",
481
- x(n, {
482
- class: k.blockContent,
547
+ A(n, {
548
+ class: v(
549
+ y.blockContent,
550
+ e.class
551
+ ),
483
552
  "data-content-type": this.name
484
553
  }),
485
554
  // we use a <p> tag, because for <li> tags we'd need to add a <ul> parent for around siblings to be semantically correct,
486
555
  // which would be quite cumbersome
487
- ["p", { class: k.inlineContent }, 0]
556
+ [
557
+ "p",
558
+ {
559
+ class: v(
560
+ y.inlineContent,
561
+ t.class
562
+ )
563
+ },
564
+ 0
565
+ ]
488
566
  ];
489
567
  }
490
- }), Ce = P({
568
+ }), xe = O({
491
569
  name: "paragraph",
492
570
  content: "inline*",
493
571
  parseHTML() {
@@ -500,16 +578,35 @@ const be = P({
500
578
  ];
501
579
  },
502
580
  renderHTML({ HTMLAttributes: n }) {
581
+ var o, r;
582
+ const e = ((o = this.options.domAttributes) == null ? void 0 : o.blockContent) || {}, t = ((r = this.options.domAttributes) == null ? void 0 : r.inlineContent) || {};
503
583
  return [
504
584
  "div",
505
- x(n, {
506
- class: k.blockContent,
507
- "data-content-type": this.name
508
- }),
509
- ["p", { class: k.inlineContent }, 0]
585
+ A(
586
+ {
587
+ ...e,
588
+ class: v(
589
+ y.blockContent,
590
+ e.class
591
+ ),
592
+ "data-content-type": this.name
593
+ },
594
+ n
595
+ ),
596
+ [
597
+ "p",
598
+ {
599
+ ...t,
600
+ class: v(
601
+ y.inlineContent,
602
+ t.class
603
+ )
604
+ },
605
+ 0
606
+ ]
510
607
  ];
511
608
  }
512
- }), N = {
609
+ }), P = {
513
610
  backgroundColor: {
514
611
  default: "transparent"
515
612
  },
@@ -521,41 +618,41 @@ const be = P({
521
618
  default: "left",
522
619
  values: ["left", "center", "right", "justify"]
523
620
  }
524
- }, wt = {
621
+ }, St = {
525
622
  paragraph: {
526
- propSchema: N,
527
- node: Ce
623
+ propSchema: P,
624
+ node: xe
528
625
  },
529
626
  heading: {
530
627
  propSchema: {
531
- ...N,
628
+ ...P,
532
629
  level: { default: "1", values: ["1", "2", "3"] }
533
630
  },
534
- node: be
631
+ node: Se
535
632
  },
536
633
  bulletListItem: {
537
- propSchema: N,
538
- node: ye
634
+ propSchema: P,
635
+ node: Me
539
636
  },
540
637
  numberedListItem: {
541
- propSchema: N,
542
- node: Se
638
+ propSchema: P,
639
+ node: Te
543
640
  }
544
641
  };
545
- function Me(n, e = JSON.stringify) {
642
+ function Ae(n, e = JSON.stringify) {
546
643
  const t = {};
547
644
  return n.filter((o) => {
548
645
  const r = e(o);
549
646
  return Object.prototype.hasOwnProperty.call(t, r) ? !1 : t[r] = !0;
550
647
  });
551
648
  }
552
- function Ee(n) {
649
+ function Ie(n) {
553
650
  const e = n.filter(
554
651
  (o, r) => n.indexOf(o) !== r
555
652
  );
556
- return Me(e);
653
+ return Ae(e);
557
654
  }
558
- const U = B.create({
655
+ const F = T.create({
559
656
  name: "uniqueID",
560
657
  // we’ll set a very high priority to make sure this runs first
561
658
  // and is compatible with `appendTransaction` hooks of other extensions
@@ -564,7 +661,13 @@ const U = B.create({
564
661
  return {
565
662
  attributeName: "id",
566
663
  types: [],
567
- generateID: () => window.__TEST_OPTIONS ? (window.__TEST_OPTIONS.mockID === void 0 ? window.__TEST_OPTIONS.mockID = 0 : window.__TEST_OPTIONS.mockID++, window.__TEST_OPTIONS.mockID.toString()) : ne(),
664
+ generateID: () => {
665
+ if (typeof window < "u" && window.__TEST_OPTIONS) {
666
+ const n = window.__TEST_OPTIONS;
667
+ return n.mockID === void 0 ? n.mockID = 0 : n.mockID++, n.mockID.toString();
668
+ }
669
+ return ie();
670
+ },
568
671
  filterTransaction: null
569
672
  };
570
673
  },
@@ -617,38 +720,38 @@ const U = B.create({
617
720
  addProseMirrorPlugins() {
618
721
  let n = null, e = !1;
619
722
  return [
620
- new y({
723
+ new w({
621
724
  key: new S("uniqueID"),
622
725
  appendTransaction: (t, o, r) => {
623
726
  const i = t.some((m) => m.docChanged) && !o.doc.eq(r.doc), s = this.options.filterTransaction && t.some((m) => {
624
- var b, v;
625
- return !(!((v = (b = this.options).filterTransaction) === null || v === void 0) && v.call(b, m));
727
+ let g, b;
728
+ return !(!((b = (g = this.options).filterTransaction) === null || b === void 0) && b.call(g, m));
626
729
  });
627
730
  if (!i || s)
628
731
  return;
629
- const { tr: l } = r, { types: a, attributeName: d, generateID: c } = this.options, p = Pt(
732
+ const { tr: l } = r, { types: a, attributeName: d, generateID: c } = this.options, h = Dt(
630
733
  o.doc,
631
734
  t
632
- ), { mapping: h } = p;
633
- if (Ot(p).forEach(({ newRange: m }) => {
634
- const b = Dt(
735
+ ), { mapping: p } = h;
736
+ if (Rt(h).forEach(({ newRange: m }) => {
737
+ const g = Vt(
635
738
  r.doc,
636
739
  m,
637
- (C) => a.includes(C.type.name)
638
- ), v = b.map(({ node: C }) => C.attrs[d]).filter((C) => C !== null), w = Ee(v);
639
- b.forEach(({ node: C, pos: D }) => {
640
- var G;
641
- const Z = (G = l.doc.nodeAt(D)) === null || G === void 0 ? void 0 : G.attrs[d];
642
- if (Z === null) {
643
- l.setNodeMarkup(D, void 0, {
644
- ...C.attrs,
740
+ (M) => a.includes(M.type.name)
741
+ ), b = g.map(({ node: M }) => M.attrs[d]).filter((M) => M !== null), C = Ie(b);
742
+ g.forEach(({ node: M, pos: R }) => {
743
+ let $;
744
+ const Q = ($ = l.doc.nodeAt(R)) === null || $ === void 0 ? void 0 : $.attrs[d];
745
+ if (Q === null) {
746
+ l.setNodeMarkup(R, void 0, {
747
+ ...M.attrs,
645
748
  [d]: c()
646
749
  });
647
750
  return;
648
751
  }
649
- const { deleted: At } = h.invert().mapResult(D);
650
- At && w.includes(Z) && l.setNodeMarkup(D, void 0, {
651
- ...C.attrs,
752
+ const { deleted: Lt } = p.invert().mapResult(R);
753
+ Lt && C.includes(Q) && l.setNodeMarkup(R, void 0, {
754
+ ...M.attrs,
652
755
  [d]: c()
653
756
  });
654
757
  });
@@ -658,7 +761,7 @@ const U = B.create({
658
761
  // we register a global drag handler to track the current drag source element
659
762
  view(t) {
660
763
  const o = (r) => {
661
- var i;
764
+ let i;
662
765
  n = !((i = t.dom.parentElement) === null || i === void 0) && i.contains(r.target) ? t.dom.parentElement : null;
663
766
  };
664
767
  return window.addEventListener("dragstart", o), {
@@ -674,7 +777,7 @@ const U = B.create({
674
777
  // only create new ids for dropped content while holding `alt`
675
778
  // or content is dragged from another editor
676
779
  drop: (t, o) => {
677
- var r;
780
+ let r;
678
781
  return (n !== t.dom.parentElement || ((r = o.dataTransfer) === null || r === void 0 ? void 0 : r.effectAllowed) === "copy") && (n = null, e = !0), !1;
679
782
  },
680
783
  // always create new ids on pasted content
@@ -705,9 +808,9 @@ const U = B.create({
705
808
  a.marks
706
809
  );
707
810
  l.push(d);
708
- }), I.from(l);
811
+ }), _.from(l);
709
812
  };
710
- return e = !1, new T(
813
+ return e = !1, new x(
711
814
  i(t.content),
712
815
  t.openStart,
713
816
  t.openEnd
@@ -717,31 +820,25 @@ const U = B.create({
717
820
  })
718
821
  ];
719
822
  }
720
- });
721
- class Be extends Error {
722
- constructor(e) {
723
- super(`Unreachable case: ${e}`);
724
- }
725
- }
726
- const St = /* @__PURE__ */ new Set([
823
+ }), Mt = /* @__PURE__ */ new Set([
727
824
  "bold",
728
825
  "italic",
729
826
  "underline",
730
827
  "strike",
731
828
  "code"
732
- ]), Ct = /* @__PURE__ */ new Set(["textColor", "backgroundColor"]);
733
- function rt(n, e) {
829
+ ]), Et = /* @__PURE__ */ new Set(["textColor", "backgroundColor"]);
830
+ function it(n, e) {
734
831
  const t = [];
735
832
  for (const [o, r] of Object.entries(n.styles))
736
- St.has(o) ? t.push(e.mark(o)) : Ct.has(o) && t.push(e.mark(o, { color: r }));
833
+ Mt.has(o) ? t.push(e.mark(o)) : Et.has(o) && t.push(e.mark(o, { color: r }));
737
834
  return n.text.split(/(\n)/g).filter((o) => o.length > 0).map((o) => o === `
738
835
  ` ? e.nodes.hardBreak.create() : e.text(o, t));
739
836
  }
740
- function Te(n, e) {
837
+ function _e(n, e) {
741
838
  const t = e.marks.link.create({
742
839
  href: n.href
743
840
  });
744
- return Mt(n.content, e).map((o) => {
841
+ return Bt(n.content, e).map((o) => {
745
842
  if (o.type.name === "text")
746
843
  return o.mark([...o.marks, t]);
747
844
  if (o.type.name === "hardBreak")
@@ -749,30 +846,30 @@ function Te(n, e) {
749
846
  throw new Error("unexpected node type");
750
847
  });
751
848
  }
752
- function Mt(n, e) {
753
- let t = [];
849
+ function Bt(n, e) {
850
+ const t = [];
754
851
  if (typeof n == "string")
755
852
  return t.push(
756
- ...rt({ type: "text", text: n, styles: {} }, e)
853
+ ...it({ type: "text", text: n, styles: {} }, e)
757
854
  ), t;
758
855
  for (const o of n)
759
- t.push(...rt(o, e));
856
+ t.push(...it(o, e));
760
857
  return t;
761
858
  }
762
- function Et(n, e) {
763
- let t = [];
859
+ function Tt(n, e) {
860
+ const t = [];
764
861
  for (const o of n)
765
862
  if (o.type === "link")
766
- t.push(...Te(o, e));
863
+ t.push(..._e(o, e));
767
864
  else if (o.type === "text")
768
- t.push(...Mt([o], e));
865
+ t.push(...Bt([o], e));
769
866
  else
770
- throw new Be(o);
867
+ throw new ye(o);
771
868
  return t;
772
869
  }
773
- function O(n, e) {
870
+ function D(n, e) {
774
871
  let t = n.id;
775
- t === void 0 && (t = U.options.generateID());
872
+ t === void 0 && (t = F.options.generateID());
776
873
  let o = n.type;
777
874
  o === void 0 && (o = "paragraph");
778
875
  let r;
@@ -784,13 +881,13 @@ function O(n, e) {
784
881
  e.text(n.content)
785
882
  );
786
883
  else {
787
- const l = Et(n.content, e);
884
+ const l = Tt(n.content, e);
788
885
  r = e.nodes[o].create(n.props, l);
789
886
  }
790
887
  const i = [];
791
888
  if (n.children)
792
889
  for (const l of n.children)
793
- i.push(O(l, e));
890
+ i.push(D(l, e));
794
891
  const s = e.nodes.blockGroup.create({}, i);
795
892
  return e.nodes.blockContainer.create(
796
893
  {
@@ -800,7 +897,7 @@ function O(n, e) {
800
897
  i.length > 0 ? [r, s] : r
801
898
  );
802
899
  }
803
- function xe(n) {
900
+ function He(n) {
804
901
  const e = [];
805
902
  let t;
806
903
  return n.content.forEach((o) => {
@@ -820,9 +917,9 @@ function xe(n) {
820
917
  for (const s of o.marks)
821
918
  if (s.type.name === "link")
822
919
  i = s;
823
- else if (St.has(s.type.name))
920
+ else if (Mt.has(s.type.name))
824
921
  r[s.type.name] = !0;
825
- else if (Ct.has(s.type.name))
922
+ else if (Et.has(s.type.name))
826
923
  r[s.type.name] = s.attrs.color;
827
924
  else
828
925
  throw Error("Mark is of an unrecognized type: " + s.type.name);
@@ -877,7 +974,7 @@ function xe(n) {
877
974
  };
878
975
  }), t && e.push(t), e;
879
976
  }
880
- function M(n, e, t) {
977
+ function E(n, e, t) {
881
978
  if (n.type.name !== "blockContainer")
882
979
  throw Error(
883
980
  "Node must be of type blockContainer, but is of type" + n.type.name + "."
@@ -885,26 +982,26 @@ function M(n, e, t) {
885
982
  const o = t == null ? void 0 : t.get(n);
886
983
  if (o)
887
984
  return o;
888
- const r = g(n, 0);
985
+ const r = pt(n);
889
986
  let i = r.id;
890
- i === null && (i = U.options.generateID());
987
+ i === null && (i = F.options.generateID());
891
988
  const s = {};
892
- for (const [c, p] of Object.entries({
893
- ...r.node.attrs,
989
+ for (const [c, h] of Object.entries({
990
+ ...n.attrs,
894
991
  ...r.contentNode.attrs
895
992
  })) {
896
- const h = e[r.contentType.name];
897
- if (!h)
993
+ const p = e[r.contentType.name];
994
+ if (!p)
898
995
  throw Error(
899
996
  "Block is of an unrecognized type: " + r.contentType.name
900
997
  );
901
- const f = h.propSchema;
902
- c in f ? s[c] = p : c !== "id" && !(c in N) && console.warn("Block has an unrecognized attribute: " + c);
998
+ const f = p.propSchema;
999
+ c in f ? s[c] = h : c !== "id" && !(c in P) && console.warn("Block has an unrecognized attribute: " + c);
903
1000
  }
904
- const l = xe(r.contentNode), a = [];
1001
+ const l = He(r.contentNode), a = [];
905
1002
  for (let c = 0; c < r.numChildBlocks; c++)
906
1003
  a.push(
907
- M(r.node.lastChild.child(c), e, t)
1004
+ E(n.lastChild.child(c), e, t)
908
1005
  );
909
1006
  const d = {
910
1007
  id: i,
@@ -915,7 +1012,7 @@ function M(n, e, t) {
915
1012
  };
916
1013
  return t == null || t.set(n, d), d;
917
1014
  }
918
- const it = new S("previous-blocks"), _e = {
1015
+ const st = new S("previous-blocks"), Ne = {
919
1016
  // Numbered List Items
920
1017
  index: "index",
921
1018
  // Headings
@@ -924,17 +1021,17 @@ const it = new S("previous-blocks"), _e = {
924
1021
  type: "type",
925
1022
  depth: "depth",
926
1023
  "depth-change": "depth-change"
927
- }, Ie = () => {
1024
+ }, Le = () => {
928
1025
  let n;
929
- return new y({
930
- key: it,
1026
+ return new w({
1027
+ key: st,
931
1028
  view(e) {
932
1029
  return {
933
1030
  update: async (t, o) => {
934
1031
  var r;
935
1032
  ((r = this.key) == null ? void 0 : r.getState(t.state).updatedBlocks.size) > 0 && (n = setTimeout(() => {
936
1033
  t.dispatch(
937
- t.state.tr.setMeta(it, { clearUpdate: !0 })
1034
+ t.state.tr.setMeta(st, { clearUpdate: !0 })
938
1035
  );
939
1036
  }, 0));
940
1037
  },
@@ -957,22 +1054,22 @@ const it = new S("previous-blocks"), _e = {
957
1054
  apply(e, t, o, r) {
958
1055
  if (t.currentTransactionOldBlockAttrs = {}, t.updatedBlocks.clear(), !e.docChanged || o.doc.eq(r.doc))
959
1056
  return t;
960
- const i = {}, s = Q(o.doc, (d) => d.attrs.id), l = new Map(
1057
+ const i = {}, s = tt(o.doc, (d) => d.attrs.id), l = new Map(
961
1058
  s.map((d) => [d.node.attrs.id, d])
962
- ), a = Q(r.doc, (d) => d.attrs.id);
963
- for (let d of a) {
964
- const c = l.get(d.node.attrs.id), p = c == null ? void 0 : c.node.firstChild, h = d.node.firstChild;
965
- if (c && p && h) {
1059
+ ), a = tt(r.doc, (d) => d.attrs.id);
1060
+ for (const d of a) {
1061
+ const c = l.get(d.node.attrs.id), h = c == null ? void 0 : c.node.firstChild, p = d.node.firstChild;
1062
+ if (c && h && p) {
966
1063
  const f = {
967
- index: h.attrs.index,
968
- level: h.attrs.level,
969
- type: h.type.name,
970
- depth: r.doc.resolve(d.pos).depth
971
- };
972
- let m = {
973
1064
  index: p.attrs.index,
974
1065
  level: p.attrs.level,
975
1066
  type: p.type.name,
1067
+ depth: r.doc.resolve(d.pos).depth
1068
+ };
1069
+ let m = {
1070
+ index: h.attrs.index,
1071
+ level: h.attrs.level,
1072
+ type: h.type.name,
976
1073
  depth: o.doc.resolve(c.pos).depth
977
1074
  };
978
1075
  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));
@@ -991,9 +1088,9 @@ const it = new S("previous-blocks"), _e = {
991
1088
  if (!r.attrs.id || !t.updatedBlocks.has(r.attrs.id))
992
1089
  return;
993
1090
  const s = t.currentTransactionOldBlockAttrs[r.attrs.id], l = {};
994
- for (let [d, c] of Object.entries(s))
995
- l["data-prev-" + _e[d]] = c || "none";
996
- const a = R.node(i, i + r.nodeSize, {
1091
+ for (const [d, c] of Object.entries(s))
1092
+ l["data-prev-" + Ne[d]] = c || "none";
1093
+ const a = V.node(i, i + r.nodeSize, {
997
1094
  ...l
998
1095
  });
999
1096
  o.push(a);
@@ -1001,13 +1098,13 @@ const it = new S("previous-blocks"), _e = {
1001
1098
  }
1002
1099
  }
1003
1100
  });
1004
- }, He = {
1101
+ }, Pe = {
1005
1102
  blockColor: "data-block-color",
1006
1103
  blockStyle: "data-block-style",
1007
1104
  id: "data-id",
1008
1105
  depth: "data-depth",
1009
1106
  depthChange: "data-depth-change"
1010
- }, Ae = V.create({
1107
+ }, Oe = U.create({
1011
1108
  name: "blockContainer",
1012
1109
  group: "blockContainer",
1013
1110
  // A block always contains content, and optionally a blockGroup which contains nested blocks
@@ -1015,11 +1112,6 @@ const it = new S("previous-blocks"), _e = {
1015
1112
  // Ensures content-specific keyboard handlers trigger first.
1016
1113
  priority: 50,
1017
1114
  defining: !0,
1018
- addOptions() {
1019
- return {
1020
- HTMLAttributes: {}
1021
- };
1022
- },
1023
1115
  parseHTML() {
1024
1116
  return [
1025
1117
  {
@@ -1028,7 +1120,7 @@ const it = new S("previous-blocks"), _e = {
1028
1120
  if (typeof n == "string")
1029
1121
  return !1;
1030
1122
  const e = {};
1031
- for (let [t, o] of Object.entries(He))
1123
+ for (const [t, o] of Object.entries(Pe))
1032
1124
  n.getAttribute(o) && (e[t] = n.getAttribute(o));
1033
1125
  return n.getAttribute("data-node-type") === "blockContainer" ? e : !1;
1034
1126
  }
@@ -1036,19 +1128,24 @@ const it = new S("previous-blocks"), _e = {
1036
1128
  ];
1037
1129
  },
1038
1130
  renderHTML({ HTMLAttributes: n }) {
1131
+ var t;
1132
+ const e = ((t = this.options.domAttributes) == null ? void 0 : t.blockContainer) || {};
1039
1133
  return [
1040
1134
  "div",
1041
- x(n, {
1042
- class: k.blockOuter,
1135
+ A(n, {
1136
+ class: y.blockOuter,
1043
1137
  "data-node-type": "block-outer"
1044
1138
  }),
1045
1139
  [
1046
1140
  "div",
1047
- x(n, {
1048
- // TODO: maybe remove html attributes from inner block
1049
- class: k.block,
1050
- "data-node-type": this.name
1051
- }),
1141
+ A(
1142
+ {
1143
+ ...e,
1144
+ class: v(y.block, e.class),
1145
+ "data-node-type": this.name
1146
+ },
1147
+ n
1148
+ ),
1052
1149
  0
1053
1150
  ]
1054
1151
  ];
@@ -1062,7 +1159,7 @@ const it = new S("previous-blocks"), _e = {
1062
1159
  },
1063
1160
  // Deletes a block at a given position.
1064
1161
  BNDeleteBlock: (n) => ({ state: e, dispatch: t }) => {
1065
- const o = g(e.doc, n);
1162
+ const o = k(e.doc, n);
1066
1163
  if (o === void 0)
1067
1164
  return !1;
1068
1165
  const { startPos: r, endPos: i } = o;
@@ -1070,7 +1167,7 @@ const it = new S("previous-blocks"), _e = {
1070
1167
  },
1071
1168
  // Updates a block at a given position.
1072
1169
  BNUpdateBlock: (n, e) => ({ state: t, dispatch: o }) => {
1073
- const r = g(t.doc, n);
1170
+ const r = k(t.doc, n);
1074
1171
  if (r === void 0)
1075
1172
  return !1;
1076
1173
  const { startPos: i, endPos: s, node: l, contentNode: a } = r;
@@ -1078,11 +1175,11 @@ const it = new S("previous-blocks"), _e = {
1078
1175
  if (e.children !== void 0) {
1079
1176
  const d = [];
1080
1177
  for (const c of e.children)
1081
- d.push(O(c, t.schema));
1178
+ d.push(D(c, t.schema));
1082
1179
  l.childCount === 2 ? t.tr.replace(
1083
1180
  i + a.nodeSize + 1,
1084
1181
  s - 1,
1085
- new T(I.from(d), 0, 0)
1182
+ new x(_.from(d), 0, 0)
1086
1183
  ) : t.tr.insert(
1087
1184
  i + a.nodeSize,
1088
1185
  t.schema.nodes.blockGroup.create({}, d)
@@ -1090,10 +1187,10 @@ const it = new S("previous-blocks"), _e = {
1090
1187
  }
1091
1188
  if (e.content !== void 0) {
1092
1189
  let d = [];
1093
- typeof e.content == "string" ? d.push(t.schema.text(e.content)) : d = Et(e.content, t.schema), t.tr.replace(
1190
+ typeof e.content == "string" ? d.push(t.schema.text(e.content)) : d = Tt(e.content, t.schema), t.tr.replace(
1094
1191
  i + 1,
1095
1192
  i + a.nodeSize - 1,
1096
- new T(I.from(d), 0, 0)
1193
+ new x(_.from(d), 0, 0)
1097
1194
  );
1098
1195
  }
1099
1196
  t.tr.setNodeMarkup(
@@ -1131,42 +1228,42 @@ const it = new S("previous-blocks"), _e = {
1131
1228
  const o = e.doc.resolve(n + 1).node().type.name === "blockContainer", r = e.doc.resolve(n - 1).node().type.name === "blockContainer";
1132
1229
  if (!o || !r)
1133
1230
  return !1;
1134
- const i = g(
1231
+ const i = k(
1135
1232
  e.doc,
1136
1233
  n + 1
1137
1234
  ), { node: s, contentNode: l, startPos: a, endPos: d, depth: c } = i;
1138
1235
  if (s.childCount === 2) {
1139
1236
  const f = e.doc.resolve(
1140
1237
  a + l.nodeSize + 1
1141
- ), m = e.doc.resolve(d - 1), b = f.blockRange(m);
1142
- t && e.tr.lift(b, c - 1);
1238
+ ), m = e.doc.resolve(d - 1), g = f.blockRange(m);
1239
+ t && e.tr.lift(g, c - 1);
1143
1240
  }
1144
- let p = n - 1, h = g(e.doc, p);
1145
- for (; h.numChildBlocks > 0; )
1146
- if (p--, h = g(e.doc, p), h === void 0)
1241
+ let h = n - 1, p = k(e.doc, h);
1242
+ for (; p.numChildBlocks > 0; )
1243
+ if (h--, p = k(e.doc, h), p === void 0)
1147
1244
  return !1;
1148
1245
  return t && (t(
1149
1246
  e.tr.deleteRange(a, a + l.nodeSize).replace(
1150
- p - 1,
1247
+ h - 1,
1151
1248
  a,
1152
- new T(l.content, 0, 0)
1249
+ new x(l.content, 0, 0)
1153
1250
  ).scrollIntoView()
1154
1251
  ), e.tr.setSelection(
1155
- new et(e.doc.resolve(p - 1))
1252
+ new ot(e.doc.resolve(h - 1))
1156
1253
  )), !0;
1157
1254
  },
1158
1255
  // Splits a block at a given position. Content after the position is moved to a new block below, at the same
1159
1256
  // nesting level.
1160
1257
  BNSplitBlock: (n, e) => ({ state: t, dispatch: o }) => {
1161
- const r = g(t.doc, n);
1258
+ const r = k(t.doc, n);
1162
1259
  if (r === void 0)
1163
1260
  return !1;
1164
- const { contentNode: i, contentType: s, startPos: l, endPos: a, depth: d } = r, c = t.doc.cut(l + 1, n), p = t.doc.cut(n, a - 1), h = t.schema.nodes.blockContainer.createAndFill(), f = a + 1, m = f + 2;
1165
- return o && (t.tr.insert(f, h), t.tr.replace(
1261
+ const { contentNode: i, contentType: s, startPos: l, endPos: a, depth: d } = r, c = t.doc.cut(l + 1, n), h = t.doc.cut(n, a - 1), p = t.schema.nodes.blockContainer.createAndFill(), f = a + 1, m = f + 2;
1262
+ return o && (t.tr.insert(f, p), t.tr.replace(
1166
1263
  m,
1167
1264
  m + 1,
1168
- p.content.size > 0 ? new T(
1169
- I.from(p),
1265
+ h.content.size > 0 ? new x(
1266
+ _.from(h),
1170
1267
  d + 2,
1171
1268
  d + 2
1172
1269
  ) : void 0
@@ -1176,12 +1273,12 @@ const it = new S("previous-blocks"), _e = {
1176
1273
  t.schema.node(s).type,
1177
1274
  i.attrs
1178
1275
  ), t.tr.setSelection(
1179
- new et(t.doc.resolve(m))
1276
+ new ot(t.doc.resolve(m))
1180
1277
  ), t.tr.replace(
1181
1278
  l + 1,
1182
1279
  a - 1,
1183
- c.content.size > 0 ? new T(
1184
- I.from(c),
1280
+ c.content.size > 0 ? new x(
1281
+ _.from(c),
1185
1282
  d + 2,
1186
1283
  d + 2
1187
1284
  ) : void 0
@@ -1190,7 +1287,7 @@ const it = new S("previous-blocks"), _e = {
1190
1287
  };
1191
1288
  },
1192
1289
  addProseMirrorPlugins() {
1193
- return [Ie()];
1290
+ return [Le()];
1194
1291
  },
1195
1292
  addKeyboardShortcuts() {
1196
1293
  return {
@@ -1201,7 +1298,7 @@ const it = new S("previous-blocks"), _e = {
1201
1298
  () => t.undoInputRule(),
1202
1299
  // Reverts block content type to a paragraph if the selection is at the start of the block.
1203
1300
  () => t.command(({ state: o }) => {
1204
- const { contentType: r } = g(
1301
+ const { contentType: r } = k(
1205
1302
  o.doc,
1206
1303
  o.selection.from
1207
1304
  ), i = o.selection.$anchor.parentOffset === 0, s = r.name === "paragraph";
@@ -1215,7 +1312,7 @@ const it = new S("previous-blocks"), _e = {
1215
1312
  // Merges block with the previous one if it isn't indented, isn't the first block in the doc, and the selection
1216
1313
  // is at the start of the block.
1217
1314
  () => t.command(({ state: o }) => {
1218
- const { depth: r, startPos: i } = g(
1315
+ const { depth: r, startPos: i } = k(
1219
1316
  o.doc,
1220
1317
  o.selection.from
1221
1318
  ), s = o.selection.$anchor.parentOffset === 0, l = o.selection.anchor === o.selection.head, a = i === 2, d = i - 1;
@@ -1226,7 +1323,7 @@ const it = new S("previous-blocks"), _e = {
1226
1323
  // Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
1227
1324
  // of the block.
1228
1325
  () => t.command(({ state: o }) => {
1229
- const { node: r, depth: i } = g(
1326
+ const { node: r, depth: i } = k(
1230
1327
  o.doc,
1231
1328
  o.selection.from
1232
1329
  ), s = o.selection.$anchor.parentOffset === 0, l = o.selection.anchor === o.selection.head, a = r.textContent.length === 0, d = i > 2;
@@ -1235,20 +1332,20 @@ const it = new S("previous-blocks"), _e = {
1235
1332
  // Creates a new block and moves the selection to it if the current one is empty, while the selection is also
1236
1333
  // empty & at the start of the block.
1237
1334
  () => t.command(({ state: o, chain: r }) => {
1238
- const { node: i, endPos: s } = g(
1335
+ const { node: i, endPos: s } = k(
1239
1336
  o.doc,
1240
1337
  o.selection.from
1241
1338
  ), l = o.selection.$anchor.parentOffset === 0, a = o.selection.anchor === o.selection.head, d = i.textContent.length === 0;
1242
1339
  if (l && a && d) {
1243
- const c = s + 1, p = c + 2;
1244
- return r().BNCreateBlock(c).setTextSelection(p).run(), !0;
1340
+ const c = s + 1, h = c + 2;
1341
+ return r().BNCreateBlock(c).setTextSelection(h).run(), !0;
1245
1342
  }
1246
1343
  return !1;
1247
1344
  }),
1248
1345
  // Splits the current block, moving content inside that's after the cursor to a new text block below. Also
1249
1346
  // deletes the selection beforehand, if it's not empty.
1250
1347
  () => t.command(({ state: o, chain: r }) => {
1251
- const { node: i } = g(
1348
+ const { node: i } = k(
1252
1349
  o.doc,
1253
1350
  o.selection.from
1254
1351
  );
@@ -1290,15 +1387,10 @@ const it = new S("previous-blocks"), _e = {
1290
1387
  })
1291
1388
  };
1292
1389
  }
1293
- }), Le = V.create({
1390
+ }), De = U.create({
1294
1391
  name: "blockGroup",
1295
1392
  group: "blockGroup",
1296
1393
  content: "blockContainer+",
1297
- addOptions() {
1298
- return {
1299
- HTMLAttributes: {}
1300
- };
1301
- },
1302
1394
  parseHTML() {
1303
1395
  return [
1304
1396
  {
@@ -1308,26 +1400,31 @@ const it = new S("previous-blocks"), _e = {
1308
1400
  ];
1309
1401
  },
1310
1402
  renderHTML({ HTMLAttributes: n }) {
1403
+ var t;
1404
+ const e = ((t = this.options.domAttributes) == null ? void 0 : t.blockGroup) || {};
1311
1405
  return [
1312
1406
  "div",
1313
- x(this.options.HTMLAttributes, n, {
1314
- class: k.blockGroup,
1315
- "data-node-type": "blockGroup"
1316
- }),
1407
+ A(
1408
+ {
1409
+ ...e,
1410
+ class: v(
1411
+ y.blockGroup,
1412
+ e.class
1413
+ ),
1414
+ "data-node-type": "blockGroup"
1415
+ },
1416
+ n
1417
+ ),
1317
1418
  0
1318
1419
  ];
1319
1420
  }
1320
- }), Ne = [
1321
- Ae,
1322
- Le,
1323
- V.create({
1324
- name: "doc",
1325
- topNode: !0,
1326
- content: "blockGroup"
1327
- })
1328
- ], Pe = (n) => {
1329
- const e = q.fromSchema(n);
1330
- return new q(
1421
+ }), Re = U.create({
1422
+ name: "doc",
1423
+ topNode: !0,
1424
+ content: "blockGroup"
1425
+ }), Ve = (n) => {
1426
+ const e = W.fromSchema(n);
1427
+ return new W(
1331
1428
  {
1332
1429
  ...e.nodes
1333
1430
  // TODO: If a serializer is defined in the config for a custom block, it
@@ -1337,19 +1434,20 @@ const it = new S("previous-blocks"), _e = {
1337
1434
  },
1338
1435
  e.marks
1339
1436
  );
1340
- }, Oe = B.create({
1437
+ }, ze = T.create({
1341
1438
  addProseMirrorPlugins() {
1342
1439
  return [
1343
- new y({
1440
+ new w({
1344
1441
  props: {
1345
- clipboardSerializer: Pe(this.editor.schema)
1442
+ clipboardSerializer: Ve(this.editor.schema)
1346
1443
  }
1347
1444
  })
1348
1445
  ];
1349
1446
  }
1350
1447
  });
1351
- class F {
1448
+ class G {
1352
1449
  constructor() {
1450
+ // eslint-disable-next-line @typescript-eslint/ban-types
1353
1451
  u(this, "callbacks", {});
1354
1452
  }
1355
1453
  on(e, t) {
@@ -1367,10 +1465,10 @@ class F {
1367
1465
  this.callbacks = {};
1368
1466
  }
1369
1467
  }
1370
- const De = Rt(
1468
+ const Ue = zt(
1371
1469
  (n) => n.type.name === "blockContainer"
1372
1470
  );
1373
- class Re {
1471
+ class Fe {
1374
1472
  constructor(e, t, o = () => {
1375
1473
  }) {
1376
1474
  u(this, "suggestionsMenuState");
@@ -1385,7 +1483,7 @@ class Re {
1385
1483
  this.suggestionsMenuState.referencePos = t.getBoundingClientRect(), this.updateSuggestionsMenu();
1386
1484
  }
1387
1485
  });
1388
- this.editor = e, this.pluginKey = t, this.pluginState = W(), this.updateSuggestionsMenu = () => {
1486
+ this.editor = e, this.pluginKey = t, this.pluginState = Y(), this.updateSuggestionsMenu = () => {
1389
1487
  if (!this.suggestionsMenuState)
1390
1488
  throw new Error("Attempting to update uninitialized suggestions menu");
1391
1489
  o(this.suggestionsMenuState);
@@ -1413,7 +1511,7 @@ class Re {
1413
1511
  document.removeEventListener("scroll", this.handleScroll);
1414
1512
  }
1415
1513
  }
1416
- function W() {
1514
+ function Y() {
1417
1515
  return {
1418
1516
  active: !1,
1419
1517
  triggerCharacter: void 0,
@@ -1424,7 +1522,7 @@ function W() {
1424
1522
  decorationId: void 0
1425
1523
  };
1426
1524
  }
1427
- const ze = (n, e, t, o, r = () => [], i = () => {
1525
+ const Ge = (n, e, t, o, r = () => [], i = () => {
1428
1526
  }) => {
1429
1527
  if (o.length !== 1)
1430
1528
  throw new Error("'char' should be a single character");
@@ -1433,9 +1531,9 @@ const ze = (n, e, t, o, r = () => [], i = () => {
1433
1531
  a.dispatch(a.state.tr.setMeta(t, { deactivate: !0 }));
1434
1532
  };
1435
1533
  return {
1436
- plugin: new y({
1534
+ plugin: new w({
1437
1535
  key: t,
1438
- view: () => (s = new Re(
1536
+ view: () => (s = new Fe(
1439
1537
  n,
1440
1538
  t,
1441
1539
  e
@@ -1443,18 +1541,18 @@ const ze = (n, e, t, o, r = () => [], i = () => {
1443
1541
  state: {
1444
1542
  // Initialize the plugin's internal state.
1445
1543
  init() {
1446
- return W();
1544
+ return Y();
1447
1545
  },
1448
1546
  // Apply changes to the plugin state from an editor transaction.
1449
- apply(a, d, c, p) {
1450
- var f, m, b, v;
1547
+ apply(a, d, c, h) {
1548
+ var f, m, g, b;
1451
1549
  if (a.getMeta("orderedListIndexing") !== void 0)
1452
1550
  return d;
1453
1551
  if ((f = a.getMeta(t)) != null && f.activate)
1454
1552
  return {
1455
1553
  active: !0,
1456
1554
  triggerCharacter: ((m = a.getMeta(t)) == null ? void 0 : m.triggerCharacter) || "",
1457
- queryStartPos: p.selection.from,
1555
+ queryStartPos: h.selection.from,
1458
1556
  items: r(""),
1459
1557
  keyboardHoveredItemIndex: 0,
1460
1558
  // TODO: Maybe should be 1 if the menu has no possible items? Probably redundant since a menu with no items
@@ -1464,30 +1562,30 @@ const ze = (n, e, t, o, r = () => [], i = () => {
1464
1562
  };
1465
1563
  if (!d.active)
1466
1564
  return d;
1467
- const h = { ...d };
1468
- if (h.items = r(
1469
- p.doc.textBetween(
1565
+ const p = { ...d };
1566
+ if (p.items = r(
1567
+ h.doc.textBetween(
1470
1568
  d.queryStartPos,
1471
- p.selection.from
1569
+ h.selection.from
1472
1570
  )
1473
- ), h.notFoundCount = 0, h.items.length === 0 && (h.notFoundCount = Math.max(
1571
+ ), p.notFoundCount = 0, p.items.length === 0 && (p.notFoundCount = Math.max(
1474
1572
  0,
1475
- d.notFoundCount + (p.selection.from - c.selection.from)
1573
+ d.notFoundCount + (h.selection.from - c.selection.from)
1476
1574
  )), // Highlighting text should hide the menu.
1477
- p.selection.from !== p.selection.to || // Transactions with plugin metadata {deactivate: true} should hide the menu.
1478
- (b = a.getMeta(t)) != null && b.deactivate || // Certain mouse events should hide the menu.
1575
+ h.selection.from !== h.selection.to || // Transactions with plugin metadata {deactivate: true} should hide the menu.
1576
+ (g = a.getMeta(t)) != null && g.deactivate || // Certain mouse events should hide the menu.
1479
1577
  // TODO: Change to global mousedown listener.
1480
1578
  a.getMeta("focus") || a.getMeta("blur") || a.getMeta("pointer") || // Moving the caret before the character which triggered the menu should hide it.
1481
- d.active && p.selection.from < d.queryStartPos || // Entering more than 3 characters, after the last query that matched with at least 1 menu item, should hide
1579
+ d.active && h.selection.from < d.queryStartPos || // Entering more than 3 characters, after the last query that matched with at least 1 menu item, should hide
1482
1580
  // the menu.
1483
- h.notFoundCount > 3)
1484
- return W();
1485
- if (((v = a.getMeta(t)) == null ? void 0 : v.selectedItemIndexChanged) !== void 0) {
1486
- let w = a.getMeta(t).selectedItemIndexChanged;
1487
- w < 0 ? w = d.items.length - 1 : w >= d.items.length && (w = 0), h.keyboardHoveredItemIndex = w;
1581
+ p.notFoundCount > 3)
1582
+ return Y();
1583
+ if (((b = a.getMeta(t)) == null ? void 0 : b.selectedItemIndexChanged) !== void 0) {
1584
+ let C = a.getMeta(t).selectedItemIndexChanged;
1585
+ C < 0 ? C = d.items.length - 1 : C >= d.items.length && (C = 0), p.keyboardHoveredItemIndex = C;
1488
1586
  } else
1489
- c.selection.from !== p.selection.from && (h.keyboardHoveredItemIndex = 0);
1490
- return h;
1587
+ c.selection.from !== h.selection.from && (p.keyboardHoveredItemIndex = 0);
1588
+ return p;
1491
1589
  }
1492
1590
  },
1493
1591
  props: {
@@ -1503,8 +1601,8 @@ const ze = (n, e, t, o, r = () => [], i = () => {
1503
1601
  if (!c)
1504
1602
  return !1;
1505
1603
  const {
1506
- triggerCharacter: p,
1507
- queryStartPos: h,
1604
+ triggerCharacter: h,
1605
+ queryStartPos: p,
1508
1606
  items: f,
1509
1607
  keyboardHoveredItemIndex: m
1510
1608
  } = t.getState(a.state);
@@ -1517,7 +1615,7 @@ const ze = (n, e, t, o, r = () => [], i = () => {
1517
1615
  selectedItemIndexChanged: m + 1
1518
1616
  })
1519
1617
  ), !0) : d.key === "Enter" ? (l(a), n._tiptapEditor.chain().focus().deleteRange({
1520
- from: h - p.length,
1618
+ from: p - h.length,
1521
1619
  to: n._tiptapEditor.state.selection.from
1522
1620
  }).run(), i({
1523
1621
  item: f[m],
@@ -1526,14 +1624,14 @@ const ze = (n, e, t, o, r = () => [], i = () => {
1526
1624
  },
1527
1625
  // Setup decorator on the currently active suggestion.
1528
1626
  decorations(a) {
1529
- const { active: d, decorationId: c, queryStartPos: p, triggerCharacter: h } = this.getState(a);
1627
+ const { active: d, decorationId: c, queryStartPos: h, triggerCharacter: p } = this.getState(a);
1530
1628
  if (!d)
1531
1629
  return null;
1532
- if (h === "") {
1533
- const f = De(a.selection);
1630
+ if (p === "") {
1631
+ const f = Ue(a.selection);
1534
1632
  if (f)
1535
1633
  return z.create(a.doc, [
1536
- R.node(
1634
+ V.node(
1537
1635
  f.pos,
1538
1636
  f.pos + f.node.nodeSize,
1539
1637
  {
@@ -1545,9 +1643,9 @@ const ze = (n, e, t, o, r = () => [], i = () => {
1545
1643
  ]);
1546
1644
  }
1547
1645
  return z.create(a.doc, [
1548
- R.inline(
1549
- p - h.length,
1550
- p,
1646
+ V.inline(
1647
+ h - p.length,
1648
+ h,
1551
1649
  {
1552
1650
  nodeName: "span",
1553
1651
  class: "suggestion-decorator",
@@ -1568,18 +1666,18 @@ const ze = (n, e, t, o, r = () => [], i = () => {
1568
1666
  });
1569
1667
  }
1570
1668
  };
1571
- }, K = new S("SlashMenuPlugin");
1572
- class Ve extends F {
1669
+ }, X = new S("SlashMenuPlugin");
1670
+ class $e extends G {
1573
1671
  constructor(t, o) {
1574
1672
  super();
1575
1673
  u(this, "plugin");
1576
1674
  u(this, "itemCallback");
1577
- const r = ze(
1675
+ const r = Ge(
1578
1676
  t,
1579
1677
  (i) => {
1580
1678
  this.emit("update", i);
1581
1679
  },
1582
- K,
1680
+ X,
1583
1681
  "/",
1584
1682
  (i) => o.filter(
1585
1683
  ({ name: s, aliases: l }) => s.toLowerCase().startsWith(i.toLowerCase()) || l && l.filter(
@@ -1594,7 +1692,7 @@ class Ve extends F {
1594
1692
  return this.on("update", t);
1595
1693
  }
1596
1694
  }
1597
- const Ue = new S("blocknote-placeholder"), Fe = B.create({
1695
+ const je = new S("blocknote-placeholder"), qe = T.create({
1598
1696
  name: "placeholder",
1599
1697
  addOptions() {
1600
1698
  return {
@@ -1610,21 +1708,21 @@ const Ue = new S("blocknote-placeholder"), Fe = B.create({
1610
1708
  },
1611
1709
  addProseMirrorPlugins() {
1612
1710
  return [
1613
- new y({
1614
- key: Ue,
1711
+ new w({
1712
+ key: je,
1615
1713
  props: {
1616
1714
  decorations: (n) => {
1617
- const { doc: e, selection: t } = n, o = K.getState(n), r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = t, s = [];
1715
+ const { doc: e, selection: t } = n, o = X.getState(n), r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = t, s = [];
1618
1716
  if (r)
1619
1717
  return e.descendants((l, a) => {
1620
1718
  const d = i >= a && i <= a + l.nodeSize, c = !l.isLeaf && !l.childCount;
1621
1719
  if ((d || !this.options.showOnlyCurrent) && c) {
1622
- const p = [this.options.emptyNodeClass];
1623
- this.editor.isEmpty && p.push(this.options.emptyEditorClass), d && p.push(this.options.hasAnchorClass), (o == null ? void 0 : o.triggerCharacter) === "" && (o != null && o.active) && p.push(this.options.isFilterClass);
1624
- const h = R.node(a, a + l.nodeSize, {
1625
- class: p.join(" ")
1720
+ const h = [this.options.emptyNodeClass];
1721
+ this.editor.isEmpty && h.push(this.options.emptyEditorClass), d && h.push(this.options.hasAnchorClass), (o == null ? void 0 : o.triggerCharacter) === "" && (o != null && o.active) && h.push(this.options.isFilterClass);
1722
+ const p = V.node(a, a + l.nodeSize, {
1723
+ class: h.join(" ")
1626
1724
  });
1627
- s.push(h);
1725
+ s.push(p);
1628
1726
  }
1629
1727
  return this.options.includeChildren;
1630
1728
  }), z.create(e, s);
@@ -1633,7 +1731,7 @@ const Ue = new S("blocknote-placeholder"), Fe = B.create({
1633
1731
  })
1634
1732
  ];
1635
1733
  }
1636
- }), Ge = B.create({
1734
+ }), We = T.create({
1637
1735
  name: "textAlignment",
1638
1736
  addGlobalAttributes() {
1639
1737
  return [
@@ -1656,7 +1754,7 @@ const Ue = new S("blocknote-placeholder"), Fe = B.create({
1656
1754
  addCommands() {
1657
1755
  return {
1658
1756
  setTextAlignment: (n) => ({ state: e }) => {
1659
- const t = [], o = g(
1757
+ const t = [], o = k(
1660
1758
  e.doc,
1661
1759
  e.selection.from
1662
1760
  );
@@ -1671,7 +1769,7 @@ const Ue = new S("blocknote-placeholder"), Fe = B.create({
1671
1769
  }
1672
1770
  };
1673
1771
  }
1674
- }), $e = B.create({
1772
+ }), Ye = T.create({
1675
1773
  name: "blockTextColor",
1676
1774
  addGlobalAttributes() {
1677
1775
  return [
@@ -1692,12 +1790,12 @@ const Ue = new S("blocknote-placeholder"), Fe = B.create({
1692
1790
  addCommands() {
1693
1791
  return {
1694
1792
  setBlockTextColor: (n, e) => ({ state: t, view: o }) => {
1695
- const r = g(t.doc, n);
1793
+ const r = k(t.doc, n);
1696
1794
  return r === void 0 ? !1 : (t.tr.setNodeAttribute(r.startPos - 1, "textColor", e), o.focus(), !0);
1697
1795
  }
1698
1796
  };
1699
1797
  }
1700
- }), je = at.create({
1798
+ }), Ke = lt.create({
1701
1799
  name: "textColor",
1702
1800
  addAttributes() {
1703
1801
  return {
@@ -1726,12 +1824,12 @@ const Ue = new S("blocknote-placeholder"), Fe = B.create({
1726
1824
  setTextColor: (n) => ({ commands: e }) => n !== "default" ? e.setMark(this.name, { color: n }) : e.unsetMark(this.name)
1727
1825
  };
1728
1826
  }
1729
- }), qe = B.create({
1827
+ }), Je = T.create({
1730
1828
  name: "trailingNode",
1731
1829
  addProseMirrorPlugins() {
1732
1830
  const n = new S(this.name);
1733
1831
  return [
1734
- new y({
1832
+ new w({
1735
1833
  key: n,
1736
1834
  appendTransaction: (e, t, o) => {
1737
1835
  const { doc: r, tr: i, schema: s } = o, l = n.getState(o), a = r.content.size - 2, d = s.nodes.blockContainer, c = s.nodes.paragraph;
@@ -1758,7 +1856,8 @@ const Ue = new S("blocknote-placeholder"), Fe = B.create({
1758
1856
  })
1759
1857
  ];
1760
1858
  }
1761
- }), We = (n) => {
1859
+ }), Xe = (n) => {
1860
+ var t;
1762
1861
  const e = [
1763
1862
  L.ClipboardTextSerializer,
1764
1863
  L.Commands,
@@ -1766,71 +1865,81 @@ const Ue = new S("blocknote-placeholder"), Fe = B.create({
1766
1865
  L.FocusEvents,
1767
1866
  L.Tabindex,
1768
1867
  // DevTools,
1769
- Wt,
1868
+ Kt,
1770
1869
  // DropCursor,
1771
- Fe.configure({
1772
- emptyNodeClass: k.isEmpty,
1773
- hasAnchorClass: k.hasAnchor,
1774
- isFilterClass: k.isFilter,
1870
+ qe.configure({
1871
+ emptyNodeClass: y.isEmpty,
1872
+ hasAnchorClass: y.hasAnchor,
1873
+ isFilterClass: y.isFilter,
1775
1874
  includeChildren: !0,
1776
1875
  showOnlyCurrent: !1
1777
1876
  }),
1778
- U.configure({
1877
+ F.configure({
1779
1878
  types: ["blockContainer"]
1780
1879
  }),
1781
- Yt,
1880
+ Jt,
1782
1881
  // Comments,
1783
1882
  // basics:
1784
- Qt,
1883
+ ee,
1785
1884
  // marks:
1786
- Ft,
1787
- Gt,
1788
- Kt,
1885
+ $t,
1886
+ jt,
1789
1887
  Zt,
1790
1888
  te,
1791
- Xt,
1792
- je,
1793
- $e,
1794
- fe,
1795
- he,
1796
- Ge,
1797
- // custom blocks:
1798
- ...Ne,
1889
+ oe,
1890
+ Qt,
1891
+ Ke,
1892
+ Ye,
1893
+ ge,
1894
+ ke,
1895
+ We,
1896
+ // nodes
1897
+ Re,
1898
+ Oe.configure({
1899
+ domAttributes: n.domAttributes
1900
+ }),
1901
+ De.configure({
1902
+ domAttributes: n.domAttributes
1903
+ }),
1799
1904
  ...Object.values(n.blockSchema).map(
1800
- (t) => t.node.configure({ editor: n.editor })
1905
+ (o) => o.node.configure({
1906
+ editor: n.editor,
1907
+ domAttributes: n.domAttributes
1908
+ })
1801
1909
  ),
1802
- Oe,
1803
- qt.configure({ width: 5, color: "#ddeeff" }),
1910
+ ze,
1911
+ Yt.configure({ width: 5, color: "#ddeeff" }),
1804
1912
  // This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
1805
1913
  // should be handled before Enter handlers in other components like splitListItem
1806
- qe
1914
+ Je
1807
1915
  ];
1808
1916
  if (n.collaboration) {
1809
- e.push(
1810
- $t.configure({
1917
+ if (e.push(
1918
+ qt.configure({
1811
1919
  fragment: n.collaboration.fragment
1812
1920
  })
1813
- );
1814
- const t = (o) => {
1815
- const r = document.createElement("span");
1816
- r.classList.add(H["collaboration-cursor__caret"]), r.setAttribute("style", `border-color: ${o.color}`);
1817
- const i = document.createElement("span");
1818
- i.classList.add(H["collaboration-cursor__label"]), i.setAttribute("style", `background-color: ${o.color}`), i.insertBefore(document.createTextNode(o.name), null);
1819
- const s = document.createTextNode("⁠"), l = document.createTextNode("⁠");
1820
- return r.insertBefore(s, null), r.insertBefore(i, null), r.insertBefore(l, null), r;
1821
- };
1822
- e.push(
1823
- jt.configure({
1824
- user: n.collaboration.user,
1825
- render: n.collaboration.renderCursor || t,
1826
- provider: n.collaboration.provider
1827
- })
1828
- );
1921
+ ), (t = n.collaboration.provider) != null && t.awareness) {
1922
+ const o = (r) => {
1923
+ const i = document.createElement("span");
1924
+ i.classList.add(H["collaboration-cursor__caret"]), i.setAttribute("style", `border-color: ${r.color}`);
1925
+ const s = document.createElement("span");
1926
+ s.classList.add(H["collaboration-cursor__label"]), s.setAttribute("style", `background-color: ${r.color}`), s.insertBefore(document.createTextNode(r.name), null);
1927
+ const l = document.createTextNode("⁠"), a = document.createTextNode("⁠");
1928
+ return i.insertBefore(l, null), i.insertBefore(s, null), i.insertBefore(a, null), i;
1929
+ };
1930
+ e.push(
1931
+ Wt.configure({
1932
+ user: n.collaboration.user,
1933
+ render: n.collaboration.renderCursor || o,
1934
+ provider: n.collaboration.provider
1935
+ })
1936
+ );
1937
+ }
1829
1938
  } else
1830
- e.push(Jt);
1939
+ e.push(Xt);
1831
1940
  return e;
1832
1941
  };
1833
- function X(n, e) {
1942
+ function Z(n, e) {
1834
1943
  let t, o;
1835
1944
  if (e.firstChild.descendants((r, i) => t ? !1 : r.type.name !== "blockContainer" || r.attrs.id !== n ? !0 : (t = r, o = i + 1, !1)), t === void 0 || o === void 0)
1836
1945
  throw Error("Could not find block in the editor with matching ID.");
@@ -1839,12 +1948,12 @@ function X(n, e) {
1839
1948
  posBeforeNode: o
1840
1949
  };
1841
1950
  }
1842
- function Bt(n, e, t = "before", o) {
1951
+ function xt(n, e, t = "before", o) {
1843
1952
  const r = typeof e == "string" ? e : e.id, i = [];
1844
1953
  for (const d of n)
1845
- i.push(O(d, o.schema));
1954
+ i.push(D(d, o.schema));
1846
1955
  let s = -1;
1847
- const { node: l, posBeforeNode: a } = X(r, o.state.doc);
1956
+ const { node: l, posBeforeNode: a } = Z(r, o.state.doc);
1848
1957
  if (t === "before" && (s = a), t === "after" && (s = a + l.nodeSize), t === "nested") {
1849
1958
  if (l.childCount < 2) {
1850
1959
  s = a + l.firstChild.nodeSize + 1;
@@ -1861,11 +1970,11 @@ function Bt(n, e, t = "before", o) {
1861
1970
  }
1862
1971
  o.view.dispatch(o.state.tr.insert(s, i));
1863
1972
  }
1864
- function Ye(n, e, t) {
1865
- const o = typeof n == "string" ? n : n.id, { posBeforeNode: r } = X(o, t.state.doc);
1973
+ function Ze(n, e, t) {
1974
+ const o = typeof n == "string" ? n : n.id, { posBeforeNode: r } = Z(o, t.state.doc);
1866
1975
  t.commands.BNUpdateBlock(r + 1, e);
1867
1976
  }
1868
- function Tt(n, e) {
1977
+ function At(n, e) {
1869
1978
  const t = new Set(
1870
1979
  n.map(
1871
1980
  (r) => typeof r == "string" ? r : r.id
@@ -1883,17 +1992,17 @@ function Tt(n, e) {
1883
1992
  const l = e.state.doc.nodeSize;
1884
1993
  return o += s - l, !1;
1885
1994
  }), t.size > 0) {
1886
- let r = [...t].join(`
1995
+ const r = [...t].join(`
1887
1996
  `);
1888
1997
  throw Error(
1889
1998
  "Blocks with the following IDs could not be found in the editor: " + r
1890
1999
  );
1891
2000
  }
1892
2001
  }
1893
- function Je(n, e, t) {
1894
- Bt(e, n[0], "before", t), Tt(n, t);
2002
+ function Qe(n, e, t) {
2003
+ xt(e, n[0], "before", t), At(n, t);
1895
2004
  }
1896
- function Ke() {
2005
+ function to() {
1897
2006
  const n = (e) => {
1898
2007
  let t = e.children.length;
1899
2008
  for (let o = 0; o < t; o++) {
@@ -1909,19 +2018,19 @@ function Ke() {
1909
2018
  };
1910
2019
  return n;
1911
2020
  }
1912
- function Xe(n) {
2021
+ function eo(n) {
1913
2022
  const e = /* @__PURE__ */ new Set([
1914
2023
  ...n.orderedListItemBlockTypes,
1915
2024
  ...n.unorderedListItemBlockTypes
1916
2025
  ]), t = (o) => {
1917
2026
  let r = o.children.length, i;
1918
2027
  for (let s = 0; s < r; s++) {
1919
- const a = o.children[s].children[0], d = a.children[0], c = a.children.length === 2 ? a.children[1] : null, p = e.has(
2028
+ const a = o.children[s].children[0], d = a.children[0], c = a.children.length === 2 ? a.children[1] : null, h = e.has(
1920
2029
  d.properties.dataContentType
1921
- ), h = p ? n.orderedListItemBlockTypes.has(
2030
+ ), p = h ? n.orderedListItemBlockTypes.has(
1922
2031
  d.properties.dataContentType
1923
2032
  ) ? "ol" : "ul" : null;
1924
- if (c !== null && t(c), i && i.tagName !== h) {
2033
+ if (c !== null && t(c), i && i.tagName !== p) {
1925
2034
  o.children.splice(
1926
2035
  s - i.children.length,
1927
2036
  i.children.length,
@@ -1930,11 +2039,11 @@ function Xe(n) {
1930
2039
  const f = i.children.length - 1;
1931
2040
  s -= f, r -= f, i = void 0;
1932
2041
  }
1933
- if (p) {
1934
- i || (i = ot(
1935
- document.createElement(h)
2042
+ if (h) {
2043
+ i || (i = nt(
2044
+ document.createElement(p)
1936
2045
  ));
1937
- const f = ot(
2046
+ const f = nt(
1938
2047
  document.createElement("li")
1939
2048
  );
1940
2049
  f.children.push(d.children[0]), c !== null && f.children.push(...c.children), i.children.push(f);
@@ -1953,33 +2062,55 @@ function Xe(n) {
1953
2062
  };
1954
2063
  return t;
1955
2064
  }
1956
- async function xt(n, e) {
1957
- const t = document.createElement("div"), o = q.fromSchema(e);
2065
+ async function It(n, e) {
2066
+ const t = document.createElement("div"), o = W.fromSchema(e);
1958
2067
  for (const i of n) {
1959
- const s = O(i, e), l = o.serializeNode(s);
2068
+ const s = D(i, e), l = o.serializeNode(s);
1960
2069
  t.appendChild(l);
1961
2070
  }
1962
- return (await J().use(lt, { fragment: !0 }).use(Xe, {
2071
+ return (await J().use(dt, { fragment: !0 }).use(eo, {
1963
2072
  orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
1964
2073
  unorderedListItemBlockTypes: /* @__PURE__ */ new Set(["bulletListItem"])
1965
- }).use(dt).process(t.innerHTML)).value;
2074
+ }).use(ct).process(t.innerHTML)).value;
1966
2075
  }
1967
2076
  async function _t(n, e, t) {
1968
2077
  const o = document.createElement("div");
1969
2078
  o.innerHTML = n.trim();
1970
- const i = ee.fromSchema(t).parse(o), s = [];
2079
+ const i = ne.fromSchema(t).parse(o), s = [];
1971
2080
  for (let l = 0; l < i.firstChild.childCount; l++)
1972
- s.push(M(i.firstChild.child(l), e));
2081
+ s.push(E(i.firstChild.child(l), e));
1973
2082
  return s;
1974
2083
  }
1975
- async function Ze(n, e) {
1976
- return (await J().use(lt, { fragment: !0 }).use(Ke).use(ie).use(ct).use(le).process(await xt(n, e))).value;
2084
+ async function oo(n, e) {
2085
+ return (await J().use(dt, { fragment: !0 }).use(to).use(ae).use(ut).use(ue).process(await It(n, e))).value;
2086
+ }
2087
+ function no(n, e) {
2088
+ const t = e.value ? e.value + `
2089
+ ` : "", o = {};
2090
+ e.lang && (o["data-language"] = e.lang);
2091
+ let r = {
2092
+ type: "element",
2093
+ tagName: "code",
2094
+ properties: o,
2095
+ children: [{ type: "text", value: t }]
2096
+ };
2097
+ return e.meta && (r.data = { meta: e.meta }), n.patch(e, r), r = n.applyData(e, r), r = {
2098
+ type: "element",
2099
+ tagName: "pre",
2100
+ properties: {},
2101
+ children: [r]
2102
+ }, n.patch(e, r), r;
1977
2103
  }
1978
- async function Qe(n, e, t) {
1979
- const o = await J().use(se).use(ct).use(ae).use(dt).process(n);
2104
+ async function ro(n, e, t) {
2105
+ const o = await J().use(le).use(ut).use(de, {
2106
+ handlers: {
2107
+ ...ce,
2108
+ code: no
2109
+ }
2110
+ }).use(ct).process(n);
1980
2111
  return _t(o.value, e, t);
1981
2112
  }
1982
- class to {
2113
+ class io {
1983
2114
  constructor(e, t, o) {
1984
2115
  u(this, "formattingToolbarState");
1985
2116
  u(this, "updateFormattingToolbar");
@@ -1987,7 +2118,7 @@ class to {
1987
2118
  u(this, "preventShow", !1);
1988
2119
  u(this, "prevWasEditable", null);
1989
2120
  u(this, "shouldShow", ({ view: e, state: t, from: o, to: r }) => {
1990
- const { doc: i, selection: s } = t, { empty: l } = s, a = !i.textBetween(o, r).length && zt(t.selection);
2121
+ const { doc: i, selection: s } = t, { empty: l } = s, a = !i.textBetween(o, r).length && Ut(t.selection);
1991
2122
  return !(!e.hasFocus() || l || a);
1992
2123
  });
1993
2124
  u(this, "viewMousedownHandler", () => {
@@ -2028,25 +2159,25 @@ class to {
2028
2159
  }, t.dom.addEventListener("mousedown", this.viewMousedownHandler), t.dom.addEventListener("mouseup", this.viewMouseupHandler), t.dom.addEventListener("dragstart", this.dragstartHandler), t.dom.addEventListener("focus", this.focusHandler), t.dom.addEventListener("blur", this.blurHandler), document.addEventListener("scroll", this.scrollHandler);
2029
2160
  }
2030
2161
  update(e, t) {
2031
- var h, f;
2162
+ var p, f;
2032
2163
  const { state: o, composing: r } = e, { doc: i, selection: s } = o, l = t && t.doc.eq(i) && t.selection.eq(s);
2033
2164
  if ((this.prevWasEditable === null || this.prevWasEditable === this.editor.isEditable) && (r || l))
2034
2165
  return;
2035
2166
  this.prevWasEditable = this.editor.isEditable;
2036
- const { ranges: a } = s, d = Math.min(...a.map((m) => m.$from.pos)), c = Math.max(...a.map((m) => m.$to.pos)), p = (h = this.shouldShow) == null ? void 0 : h.call(this, {
2167
+ const { ranges: a } = s, d = Math.min(...a.map((m) => m.$from.pos)), c = Math.max(...a.map((m) => m.$to.pos)), h = (p = this.shouldShow) == null ? void 0 : p.call(this, {
2037
2168
  view: e,
2038
2169
  state: o,
2039
2170
  from: d,
2040
2171
  to: c
2041
2172
  });
2042
- if (this.editor.isEditable && !this.preventShow && (p || this.preventHide)) {
2173
+ if (this.editor.isEditable && !this.preventShow && (h || this.preventHide)) {
2043
2174
  this.formattingToolbarState = {
2044
2175
  show: !0,
2045
2176
  referencePos: this.getSelectionBoundingBox()
2046
2177
  }, this.updateFormattingToolbar();
2047
2178
  return;
2048
2179
  }
2049
- if ((f = this.formattingToolbarState) != null && f.show && !this.preventHide && (!p || this.preventShow || !this.editor.isEditable)) {
2180
+ if ((f = this.formattingToolbarState) != null && f.show && !this.preventHide && (!h || this.preventShow || !this.editor.isEditable)) {
2050
2181
  this.formattingToolbarState.show = !1, this.updateFormattingToolbar();
2051
2182
  return;
2052
2183
  }
@@ -2056,25 +2187,25 @@ class to {
2056
2187
  }
2057
2188
  getSelectionBoundingBox() {
2058
2189
  const { state: e } = this.pmView, { selection: t } = e, { ranges: o } = t, r = Math.min(...o.map((s) => s.$from.pos)), i = Math.max(...o.map((s) => s.$to.pos));
2059
- if (Vt(t)) {
2190
+ if (Ft(t)) {
2060
2191
  const s = this.pmView.nodeDOM(r);
2061
2192
  if (s)
2062
2193
  return s.getBoundingClientRect();
2063
2194
  }
2064
- return j(this.pmView, r, i);
2195
+ return q(this.pmView, r, i);
2065
2196
  }
2066
2197
  }
2067
- const eo = new S(
2198
+ const so = new S(
2068
2199
  "FormattingToolbarPlugin"
2069
2200
  );
2070
- class oo extends F {
2201
+ class ao extends G {
2071
2202
  constructor(t) {
2072
2203
  super();
2073
2204
  u(this, "view");
2074
2205
  u(this, "plugin");
2075
- this.plugin = new y({
2076
- key: eo,
2077
- view: (o) => (this.view = new to(t, o, (r) => {
2206
+ this.plugin = new w({
2207
+ key: so,
2208
+ view: (o) => (this.view = new io(t, o, (r) => {
2078
2209
  this.emit("update", r);
2079
2210
  }), this.view)
2080
2211
  });
@@ -2083,7 +2214,7 @@ class oo extends F {
2083
2214
  return this.on("update", t);
2084
2215
  }
2085
2216
  }
2086
- class no {
2217
+ class lo {
2087
2218
  constructor(e, t, o) {
2088
2219
  u(this, "hyperlinkToolbarState");
2089
2220
  u(this, "updateHyperlinkToolbar");
@@ -2103,7 +2234,7 @@ class no {
2103
2234
  ), i = r.marks();
2104
2235
  for (const s of i)
2105
2236
  if (s.type.name === this.pmView.state.schema.mark("link").type.name) {
2106
- this.mouseHoveredHyperlinkMark = s, this.mouseHoveredHyperlinkMarkRange = tt(
2237
+ this.mouseHoveredHyperlinkMark = s, this.mouseHoveredHyperlinkMarkRange = et(
2107
2238
  r,
2108
2239
  s.type,
2109
2240
  s.attrs
@@ -2123,7 +2254,7 @@ class no {
2123
2254
  });
2124
2255
  u(this, "scrollHandler", () => {
2125
2256
  var e;
2126
- this.hyperlinkMark !== void 0 && (e = this.hyperlinkToolbarState) != null && e.show && (this.hyperlinkToolbarState.referencePos = j(
2257
+ this.hyperlinkMark !== void 0 && (e = this.hyperlinkToolbarState) != null && e.show && (this.hyperlinkToolbarState.referencePos = q(
2127
2258
  this.pmView,
2128
2259
  this.hyperlinkMarkRange.from,
2129
2260
  this.hyperlinkMarkRange.to
@@ -2171,7 +2302,7 @@ class no {
2171
2302
  const o = this.pmView.state.selection.$from.marks();
2172
2303
  for (const r of o)
2173
2304
  if (r.type.name === this.pmView.state.schema.mark("link").type.name) {
2174
- this.keyboardHoveredHyperlinkMark = r, this.keyboardHoveredHyperlinkMarkRange = tt(
2305
+ this.keyboardHoveredHyperlinkMark = r, this.keyboardHoveredHyperlinkMarkRange = et(
2175
2306
  this.pmView.state.selection.$from,
2176
2307
  r.type,
2177
2308
  r.attrs
@@ -2182,7 +2313,7 @@ class no {
2182
2313
  if (this.mouseHoveredHyperlinkMark && (this.hyperlinkMark = this.mouseHoveredHyperlinkMark, this.hyperlinkMarkRange = this.mouseHoveredHyperlinkMarkRange), this.keyboardHoveredHyperlinkMark && (this.hyperlinkMark = this.keyboardHoveredHyperlinkMark, this.hyperlinkMarkRange = this.keyboardHoveredHyperlinkMarkRange), this.hyperlinkMark && this.editor.isEditable) {
2183
2314
  this.hyperlinkToolbarState = {
2184
2315
  show: !0,
2185
- referencePos: j(
2316
+ referencePos: q(
2186
2317
  this.pmView,
2187
2318
  this.hyperlinkMarkRange.from,
2188
2319
  this.hyperlinkMarkRange.to
@@ -2204,10 +2335,10 @@ class no {
2204
2335
  this.pmView.dom.removeEventListener("mouseover", this.mouseOverHandler), document.removeEventListener("scroll", this.scrollHandler), document.removeEventListener("click", this.clickHandler, !0);
2205
2336
  }
2206
2337
  }
2207
- const ro = new S(
2338
+ const co = new S(
2208
2339
  "HyperlinkToolbarPlugin"
2209
2340
  );
2210
- class io extends F {
2341
+ class uo extends G {
2211
2342
  constructor(t) {
2212
2343
  super();
2213
2344
  u(this, "view");
@@ -2242,9 +2373,9 @@ class io extends F {
2242
2373
  u(this, "stopHideTimer", () => {
2243
2374
  this.view.stopMenuUpdateTimer();
2244
2375
  });
2245
- this.plugin = new y({
2246
- key: ro,
2247
- view: (o) => (this.view = new no(t, o, (r) => {
2376
+ this.plugin = new w({
2377
+ key: co,
2378
+ view: (o) => (this.view = new lo(t, o, (r) => {
2248
2379
  this.emit("update", r);
2249
2380
  }), this.view)
2250
2381
  });
@@ -2253,7 +2384,7 @@ class io extends F {
2253
2384
  return this.on("update", t);
2254
2385
  }
2255
2386
  }
2256
- class A extends $ {
2387
+ class N extends j {
2257
2388
  constructor(t, o) {
2258
2389
  super(t, o);
2259
2390
  u(this, "nodes");
@@ -2264,13 +2395,13 @@ class A extends $ {
2264
2395
  });
2265
2396
  }
2266
2397
  static create(t, o, r = o) {
2267
- return new A(t.resolve(o), t.resolve(r));
2398
+ return new N(t.resolve(o), t.resolve(r));
2268
2399
  }
2269
2400
  content() {
2270
- return new T(I.from(this.nodes), 0, 0);
2401
+ return new x(_.from(this.nodes), 0, 0);
2271
2402
  }
2272
2403
  eq(t) {
2273
- if (!(t instanceof A) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to)
2404
+ if (!(t instanceof N) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to)
2274
2405
  return !1;
2275
2406
  for (let o = 0; o < this.nodes.length; o++)
2276
2407
  if (!this.nodes[o].eq(t.nodes[o]))
@@ -2278,8 +2409,8 @@ class A extends $ {
2278
2409
  return !0;
2279
2410
  }
2280
2411
  map(t, o) {
2281
- let r = o.mapResult(this.from), i = o.mapResult(this.to);
2282
- return i.deleted ? $.near(t.resolve(r.pos)) : r.deleted ? $.near(t.resolve(i.pos)) : new A(
2412
+ const r = o.mapResult(this.from), i = o.mapResult(this.to);
2413
+ return i.deleted ? j.near(t.resolve(r.pos)) : r.deleted ? j.near(t.resolve(i.pos)) : new N(
2283
2414
  t.resolve(r.pos),
2284
2415
  t.resolve(i.pos)
2285
2416
  );
@@ -2288,13 +2419,13 @@ class A extends $ {
2288
2419
  return { type: "node", anchor: this.anchor, head: this.head };
2289
2420
  }
2290
2421
  }
2291
- const so = re.__serializeForClipboard;
2292
- let E;
2293
- function It(n, e) {
2422
+ const po = se.__serializeForClipboard;
2423
+ let B;
2424
+ function Ht(n, e) {
2294
2425
  var r;
2295
2426
  if (!e.dom.isConnected)
2296
2427
  return;
2297
- let t = e.posAtCoords(n);
2428
+ const t = e.posAtCoords(n);
2298
2429
  if (!t)
2299
2430
  return;
2300
2431
  let o = e.domAtPos(t.pos).node;
@@ -2305,16 +2436,15 @@ function It(n, e) {
2305
2436
  return { node: o, id: o.getAttribute("data-id") };
2306
2437
  }
2307
2438
  }
2308
- function ao(n, e) {
2309
- let t = It(n, e);
2439
+ function ho(n, e) {
2440
+ const t = Ht(n, e);
2310
2441
  if (t && t.node.nodeType === 1) {
2311
- const o = e.docView;
2312
- let r = o.nearestDesc(t.node, !0);
2442
+ const o = e.docView, r = o.nearestDesc(t.node, !0);
2313
2443
  return !r || r === o ? null : r.posBefore;
2314
2444
  }
2315
2445
  return null;
2316
2446
  }
2317
- function lo(n, e) {
2447
+ function fo(n, e) {
2318
2448
  let t, o;
2319
2449
  const r = e.resolve(n.from).node().type.spec.group === "blockContent", i = e.resolve(n.to).node().type.spec.group === "blockContent", s = Math.min(n.$anchor.depth, n.$head.depth);
2320
2450
  if (r && i) {
@@ -2324,9 +2454,9 @@ function lo(n, e) {
2324
2454
  t = n.from, o = n.to;
2325
2455
  return { from: t, to: o };
2326
2456
  }
2327
- function st(n, e, t = e) {
2457
+ function at(n, e, t = e) {
2328
2458
  e === t && (t += n.state.doc.resolve(e + 1).node().nodeSize);
2329
- const o = n.domAtPos(e).node.cloneNode(!0), r = n.domAtPos(e).node, i = (c, p) => Array.prototype.indexOf.call(c.children, p), s = i(
2459
+ const o = n.domAtPos(e).node.cloneNode(!0), r = n.domAtPos(e).node, i = (c, h) => Array.prototype.indexOf.call(c.children, h), s = i(
2330
2460
  r,
2331
2461
  // Expects from position to be just before the first selected block.
2332
2462
  n.domAtPos(e + 1).node.parentElement
@@ -2337,36 +2467,35 @@ function st(n, e, t = e) {
2337
2467
  );
2338
2468
  for (let c = r.childElementCount - 1; c >= 0; c--)
2339
2469
  (c > l || c < s) && o.removeChild(o.children[c]);
2340
- Ht(), E = o;
2470
+ Nt(), B = o;
2341
2471
  const d = n.dom.className.split(" ").filter(
2342
2472
  (c) => !c.includes("bn") && !c.includes("ProseMirror") && !c.includes("editor")
2343
2473
  ).join(" ");
2344
- E.className = E.className + " " + H.dragPreview + " " + d, document.body.appendChild(E);
2474
+ B.className = B.className + " " + H.dragPreview + " " + d, document.body.appendChild(B);
2345
2475
  }
2346
- function Ht() {
2347
- E !== void 0 && (document.body.removeChild(E), E = void 0);
2476
+ function Nt() {
2477
+ B !== void 0 && (document.body.removeChild(B), B = void 0);
2348
2478
  }
2349
- function co(n, e) {
2479
+ function mo(n, e) {
2350
2480
  if (!n.dataTransfer)
2351
2481
  return;
2352
- const t = e.dom.getBoundingClientRect();
2353
- let o = {
2482
+ const t = e.dom.getBoundingClientRect(), o = {
2354
2483
  left: t.left + t.width / 2,
2355
2484
  // take middle of editor
2356
2485
  top: n.clientY
2357
- }, r = ao(o, e);
2486
+ }, r = ho(o, e);
2358
2487
  if (r != null) {
2359
- const i = e.state.selection, s = e.state.doc, { from: l, to: a } = lo(i, s), d = l <= r && r < a, c = i.$anchor.node() !== i.$head.node() || i instanceof A;
2488
+ const i = e.state.selection, s = e.state.doc, { from: l, to: a } = fo(i, s), d = l <= r && r < a, c = i.$anchor.node() !== i.$head.node() || i instanceof N;
2360
2489
  d && c ? (e.dispatch(
2361
- e.state.tr.setSelection(A.create(s, l, a))
2362
- ), st(e, l, a)) : (e.dispatch(
2363
- e.state.tr.setSelection(oe.create(e.state.doc, r))
2364
- ), st(e, r));
2365
- let p = e.state.selection.content(), { dom: h, text: f } = so(e, p);
2366
- n.dataTransfer.clearData(), n.dataTransfer.setData("text/html", h.innerHTML), n.dataTransfer.setData("text/plain", f), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(E, 0, 0), e.dragging = { slice: p, move: !0 };
2490
+ e.state.tr.setSelection(N.create(s, l, a))
2491
+ ), at(e, l, a)) : (e.dispatch(
2492
+ e.state.tr.setSelection(re.create(e.state.doc, r))
2493
+ ), at(e, r));
2494
+ const h = e.state.selection.content(), { dom: p, text: f } = po(e, h);
2495
+ n.dataTransfer.clearData(), n.dataTransfer.setData("text/html", p.innerHTML), n.dataTransfer.setData("text/plain", f), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(B, 0, 0), e.dragging = { slice: h, move: !0 };
2367
2496
  }
2368
2497
  }
2369
- class uo {
2498
+ class ko {
2370
2499
  constructor(e, t, o) {
2371
2500
  u(this, "sideMenuState");
2372
2501
  // When true, the drag handle with be anchored at the same level as root elements
@@ -2392,7 +2521,7 @@ class uo {
2392
2521
  u(this, "onDrop", (e) => {
2393
2522
  if (this.editor._tiptapEditor.commands.blur(), e.synthetic || !this.isDragging)
2394
2523
  return;
2395
- let t = this.pmView.posAtCoords({
2524
+ const t = this.pmView.posAtCoords({
2396
2525
  left: e.clientX,
2397
2526
  top: e.clientY
2398
2527
  });
@@ -2409,7 +2538,7 @@ class uo {
2409
2538
  u(this, "onDragOver", (e) => {
2410
2539
  if (e.synthetic || !this.isDragging)
2411
2540
  return;
2412
- let t = this.pmView.posAtCoords({
2541
+ const t = this.pmView.posAtCoords({
2413
2542
  left: e.clientX,
2414
2543
  top: e.clientY
2415
2544
  });
@@ -2423,7 +2552,7 @@ class uo {
2423
2552
  (t = this.sideMenuState) != null && t.show && (this.sideMenuState.show = !1, this.updateSideMenu(this.sideMenuState)), this.menuFrozen = !1;
2424
2553
  });
2425
2554
  u(this, "onMouseMove", (e) => {
2426
- var d, c, p, h, f;
2555
+ var d, c, h, p, f;
2427
2556
  if (this.menuFrozen)
2428
2557
  return;
2429
2558
  const t = this.pmView.dom.firstChild.getBoundingClientRect(), o = this.pmView.dom.getBoundingClientRect(), r = e.clientX >= o.left && e.clientX <= o.right && e.clientY >= o.top && e.clientY <= o.bottom, i = this.pmView.dom.parentElement;
@@ -2441,12 +2570,12 @@ class uo {
2441
2570
  left: t.left + t.width / 2,
2442
2571
  // take middle of editor
2443
2572
  top: e.clientY
2444
- }, l = It(s, this.pmView);
2573
+ }, l = Ht(s, this.pmView);
2445
2574
  if (!l || !this.editor.isEditable) {
2446
2575
  (c = this.sideMenuState) != null && c.show && (this.sideMenuState.show = !1, this.updateSideMenu(this.sideMenuState));
2447
2576
  return;
2448
2577
  }
2449
- if ((p = this.sideMenuState) != null && p.show && ((h = this.hoveredBlock) != null && h.hasAttribute("data-id")) && ((f = this.hoveredBlock) == null ? void 0 : f.getAttribute("data-id")) === l.id)
2578
+ if ((h = this.sideMenuState) != null && h.show && ((p = this.hoveredBlock) != null && p.hasAttribute("data-id")) && ((f = this.hoveredBlock) == null ? void 0 : f.getAttribute("data-id")) === l.id)
2450
2579
  return;
2451
2580
  this.hoveredBlock = l.node;
2452
2581
  const a = l.node.firstChild;
@@ -2493,7 +2622,7 @@ class uo {
2493
2622
  });
2494
2623
  if (!o)
2495
2624
  return;
2496
- const r = g(
2625
+ const r = k(
2497
2626
  this.editor._tiptapEditor.state.doc,
2498
2627
  o.pos
2499
2628
  );
@@ -2506,7 +2635,7 @@ class uo {
2506
2635
  } else
2507
2636
  this.editor._tiptapEditor.commands.setTextSelection(s);
2508
2637
  this.pmView.focus(), this.pmView.dispatch(
2509
- this.pmView.state.tr.scrollIntoView().setMeta(K, {
2638
+ this.pmView.state.tr.scrollIntoView().setMeta(X, {
2510
2639
  // TODO import suggestion plugin key
2511
2640
  activate: !0,
2512
2641
  type: "drag"
@@ -2514,8 +2643,8 @@ class uo {
2514
2643
  );
2515
2644
  }
2516
2645
  }
2517
- const po = new S("SideMenuPlugin");
2518
- class ho extends F {
2646
+ const go = new S("SideMenuPlugin");
2647
+ class bo extends G {
2519
2648
  constructor(t) {
2520
2649
  super();
2521
2650
  u(this, "sideMenuView");
@@ -2529,12 +2658,12 @@ class ho extends F {
2529
2658
  * Handles drag & drop events for blocks.
2530
2659
  */
2531
2660
  u(this, "blockDragStart", (t) => {
2532
- this.sideMenuView.isDragging = !0, co(t, this.editor.prosemirrorView);
2661
+ this.sideMenuView.isDragging = !0, mo(t, this.editor.prosemirrorView);
2533
2662
  });
2534
2663
  /**
2535
2664
  * Handles drag & drop events for blocks.
2536
2665
  */
2537
- u(this, "blockDragEnd", () => Ht());
2666
+ u(this, "blockDragEnd", () => Nt());
2538
2667
  /**
2539
2668
  * Freezes the side menu. When frozen, the side menu will stay
2540
2669
  * attached to the same block regardless of which block is hovered by the
@@ -2547,9 +2676,9 @@ class ho extends F {
2547
2676
  * mouse cursor.
2548
2677
  */
2549
2678
  u(this, "unfreezeMenu", () => this.sideMenuView.menuFrozen = !1);
2550
- this.editor = t, this.plugin = new y({
2551
- key: po,
2552
- view: (o) => (this.sideMenuView = new uo(
2679
+ this.editor = t, this.plugin = new w({
2680
+ key: go,
2681
+ view: (o) => (this.sideMenuView = new ko(
2553
2682
  t,
2554
2683
  o,
2555
2684
  (r) => {
@@ -2562,59 +2691,59 @@ class ho extends F {
2562
2691
  return this.on("update", t);
2563
2692
  }
2564
2693
  }
2565
- function _(n, e) {
2694
+ function I(n, e) {
2566
2695
  const t = n.getTextCursorPosition().block;
2567
2696
  t.content.length === 1 && t.content[0].type === "text" && t.content[0].text === "/" || t.content.length === 0 ? n.updateBlock(t, e) : (n.insertBlocks([e], t, "after"), n.setTextCursorPosition(n.getTextCursorPosition().nextBlock));
2568
2697
  }
2569
- const fo = (n = wt) => {
2698
+ const yo = (n = St) => {
2570
2699
  var t, o, r;
2571
2700
  const e = [];
2572
2701
  return "heading" in n && "level" in n.heading.propSchema && ((t = n.heading.propSchema.level.values) != null && t.includes("1") && e.push({
2573
2702
  name: "Heading",
2574
2703
  aliases: ["h", "heading1", "h1"],
2575
- execute: (i) => _(i, {
2704
+ execute: (i) => I(i, {
2576
2705
  type: "heading",
2577
2706
  props: { level: "1" }
2578
2707
  })
2579
2708
  }), (o = n.heading.propSchema.level.values) != null && o.includes("2") && e.push({
2580
2709
  name: "Heading 2",
2581
2710
  aliases: ["h2", "heading2", "subheading"],
2582
- execute: (i) => _(i, {
2711
+ execute: (i) => I(i, {
2583
2712
  type: "heading",
2584
2713
  props: { level: "2" }
2585
2714
  })
2586
2715
  }), (r = n.heading.propSchema.level.values) != null && r.includes("3") && e.push({
2587
2716
  name: "Heading 3",
2588
2717
  aliases: ["h3", "heading3", "subheading"],
2589
- execute: (i) => _(i, {
2718
+ execute: (i) => I(i, {
2590
2719
  type: "heading",
2591
2720
  props: { level: "3" }
2592
2721
  })
2593
2722
  })), "bulletListItem" in n && e.push({
2594
2723
  name: "Bullet List",
2595
2724
  aliases: ["ul", "list", "bulletlist", "bullet list"],
2596
- execute: (i) => _(i, {
2725
+ execute: (i) => I(i, {
2597
2726
  type: "bulletListItem"
2598
2727
  })
2599
2728
  }), "numberedListItem" in n && e.push({
2600
2729
  name: "Numbered List",
2601
2730
  aliases: ["li", "list", "numberedlist", "numbered list"],
2602
- execute: (i) => _(i, {
2731
+ execute: (i) => I(i, {
2603
2732
  type: "numberedListItem"
2604
2733
  })
2605
2734
  }), "paragraph" in n && e.push({
2606
2735
  name: "Paragraph",
2607
2736
  aliases: ["p"],
2608
- execute: (i) => _(i, {
2737
+ execute: (i) => I(i, {
2609
2738
  type: "paragraph"
2610
2739
  })
2611
2740
  }), e;
2612
- }, mo = {
2741
+ }, vo = {
2613
2742
  enableInputRules: !0,
2614
2743
  enablePasteRules: !0,
2615
2744
  enableCoreExtensions: !1
2616
2745
  };
2617
- class Wo {
2746
+ class Qo {
2618
2747
  constructor(e = {}) {
2619
2748
  u(this, "_tiptapEditor");
2620
2749
  u(this, "blockCache", /* @__PURE__ */ new WeakMap());
@@ -2624,7 +2753,7 @@ class Wo {
2624
2753
  u(this, "formattingToolbar");
2625
2754
  u(this, "slashMenu");
2626
2755
  u(this, "hyperlinkToolbar");
2627
- var l, a, d;
2756
+ var l, a, d, c, h;
2628
2757
  this.options = e;
2629
2758
  const t = {
2630
2759
  defaultStyles: !0,
@@ -2633,18 +2762,19 @@ class Wo {
2633
2762
  // If BSchema is not specified, then options.blockSchema should also not
2634
2763
  // be defined. Unfortunately, trying to implement these constraints seems
2635
2764
  // to be a huge pain, hence the `as any` casts.
2636
- blockSchema: e.blockSchema || wt,
2765
+ blockSchema: e.blockSchema || St,
2637
2766
  ...e
2638
2767
  };
2639
- this.sideMenu = new ho(this), this.formattingToolbar = new oo(this), this.slashMenu = new Ve(
2768
+ this.sideMenu = new bo(this), this.formattingToolbar = new ao(this), this.slashMenu = new $e(
2640
2769
  this,
2641
- t.slashMenuItems || fo(t.blockSchema)
2642
- ), this.hyperlinkToolbar = new io(this);
2643
- const o = We({
2770
+ t.slashMenuItems || yo(t.blockSchema)
2771
+ ), this.hyperlinkToolbar = new uo(this);
2772
+ const o = Xe({
2644
2773
  editor: this,
2774
+ domAttributes: t.domAttributes || {},
2645
2775
  blockSchema: t.blockSchema,
2646
2776
  collaboration: t.collaboration
2647
- }), r = B.create({
2777
+ }), r = T.create({
2648
2778
  name: "BlockNoteUIExtension",
2649
2779
  addProseMirrorPlugins: () => [
2650
2780
  this.sideMenu.plugin,
@@ -2657,49 +2787,48 @@ class Wo {
2657
2787
  const i = t.initialContent || (e.collaboration ? void 0 : [
2658
2788
  {
2659
2789
  type: "paragraph",
2660
- id: U.options.generateID()
2790
+ id: F.options.generateID()
2661
2791
  }
2662
2792
  ]), s = {
2663
- ...mo,
2793
+ ...vo,
2664
2794
  ...t._tiptapOptions,
2665
2795
  onCreate: () => {
2666
- var c;
2667
- (c = t.onEditorReady) == null || c.call(t, this), this.ready = !0;
2796
+ var p;
2797
+ (p = t.onEditorReady) == null || p.call(t, this), this.ready = !0;
2668
2798
  },
2669
- onBeforeCreate(c) {
2799
+ onBeforeCreate(p) {
2670
2800
  if (!i)
2671
2801
  return;
2672
- const p = c.editor.schema, h = i.map((m) => O(m, p)), f = p.node(
2802
+ const f = p.editor.schema, m = i.map((b) => D(b, f)), g = f.node(
2673
2803
  "doc",
2674
2804
  void 0,
2675
- p.node("blockGroup", void 0, h)
2805
+ f.node("blockGroup", void 0, m)
2676
2806
  );
2677
- c.editor.options.content = f.toJSON();
2807
+ p.editor.options.content = g.toJSON();
2678
2808
  },
2679
2809
  onUpdate: () => {
2680
- var c;
2681
- this.ready && ((c = t.onEditorContentChange) == null || c.call(t, this));
2810
+ var p;
2811
+ this.ready && ((p = t.onEditorContentChange) == null || p.call(t, this));
2682
2812
  },
2683
2813
  onSelectionUpdate: () => {
2684
- var c;
2685
- this.ready && ((c = t.onTextCursorPositionChange) == null || c.call(t, this));
2814
+ var p;
2815
+ this.ready && ((p = t.onTextCursorPositionChange) == null || p.call(t, this));
2686
2816
  },
2687
2817
  editable: e.editable === void 0 ? !0 : e.editable,
2688
2818
  extensions: t.enableBlockNoteExtensions === !1 ? (l = t._tiptapOptions) == null ? void 0 : l.extensions : [...((a = t._tiptapOptions) == null ? void 0 : a.extensions) || [], ...o],
2689
2819
  editorProps: {
2690
2820
  attributes: {
2691
- "data-theme": e.theme || "light",
2692
- ...t.editorDOMAttributes || {},
2693
- class: [
2821
+ ...(d = t.domAttributes) == null ? void 0 : d.editor,
2822
+ class: v(
2694
2823
  H.bnEditor,
2695
2824
  H.bnRoot,
2696
2825
  t.defaultStyles ? H.defaultStyles : "",
2697
- ((d = t.editorDOMAttributes) == null ? void 0 : d.class) || ""
2698
- ].join(" ")
2826
+ ((h = (c = t.domAttributes) == null ? void 0 : c.editor) == null ? void 0 : h.class) || ""
2827
+ )
2699
2828
  }
2700
2829
  }
2701
2830
  };
2702
- t.parentElement && (s.element = t.parentElement), this._tiptapEditor = new Ut(s);
2831
+ t.parentElement && (s.element = t.parentElement), this._tiptapEditor = new Gt(s);
2703
2832
  }
2704
2833
  get prosemirrorView() {
2705
2834
  return this._tiptapEditor.view;
@@ -2719,7 +2848,7 @@ class Wo {
2719
2848
  */
2720
2849
  get topLevelBlocks() {
2721
2850
  const e = [];
2722
- return this._tiptapEditor.state.doc.firstChild.descendants((t) => (e.push(M(t, this.schema, this.blockCache)), !1)), e;
2851
+ return this._tiptapEditor.state.doc.firstChild.descendants((t) => (e.push(E(t, this.schema, this.blockCache)), !1)), e;
2723
2852
  }
2724
2853
  /**
2725
2854
  * Gets a snapshot of an existing block from the editor.
@@ -2729,7 +2858,7 @@ class Wo {
2729
2858
  getBlock(e) {
2730
2859
  const t = typeof e == "string" ? e : e.id;
2731
2860
  let o;
2732
- return this._tiptapEditor.state.doc.firstChild.descendants((r) => typeof o < "u" ? !1 : r.type.name !== "blockContainer" || r.attrs.id !== t ? !0 : (o = M(r, this.schema, this.blockCache), !1)), o;
2861
+ return this._tiptapEditor.state.doc.firstChild.descendants((r) => typeof o < "u" ? !1 : r.type.name !== "blockContainer" || r.attrs.id !== t ? !0 : (o = E(r, this.schema, this.blockCache), !1)), o;
2733
2862
  }
2734
2863
  /**
2735
2864
  * Traverses all blocks in the editor depth-first, and executes a callback for each.
@@ -2770,7 +2899,7 @@ class Wo {
2770
2899
  * @returns A snapshot of the current text cursor position.
2771
2900
  */
2772
2901
  getTextCursorPosition() {
2773
- const { node: e, depth: t, startPos: o, endPos: r } = g(
2902
+ const { node: e, depth: t, startPos: o, endPos: r } = k(
2774
2903
  this._tiptapEditor.state.doc,
2775
2904
  this._tiptapEditor.state.selection.from
2776
2905
  ), i = this._tiptapEditor.state.doc.resolve(r).index(t - 1), s = this._tiptapEditor.state.doc.resolve(r + 1).node().childCount;
@@ -2778,9 +2907,9 @@ class Wo {
2778
2907
  i > 0 && (l = this._tiptapEditor.state.doc.resolve(o - 2).node());
2779
2908
  let a;
2780
2909
  return i < s - 1 && (a = this._tiptapEditor.state.doc.resolve(r + 2).node()), {
2781
- block: M(e, this.schema, this.blockCache),
2782
- prevBlock: l === void 0 ? void 0 : M(l, this.schema, this.blockCache),
2783
- nextBlock: a === void 0 ? void 0 : M(a, this.schema, this.blockCache)
2910
+ block: E(e, this.schema, this.blockCache),
2911
+ prevBlock: l === void 0 ? void 0 : E(l, this.schema, this.blockCache),
2912
+ nextBlock: a === void 0 ? void 0 : E(a, this.schema, this.blockCache)
2784
2913
  };
2785
2914
  }
2786
2915
  /**
@@ -2790,7 +2919,7 @@ class Wo {
2790
2919
  * @param placement Whether the text cursor should be placed at the start or end of the block.
2791
2920
  */
2792
2921
  setTextCursorPosition(e, t = "start") {
2793
- const o = typeof e == "string" ? e : e.id, { posBeforeNode: r } = X(o, this._tiptapEditor.state.doc), { startPos: i, contentNode: s } = g(
2922
+ const o = typeof e == "string" ? e : e.id, { posBeforeNode: r } = Z(o, this._tiptapEditor.state.doc), { startPos: i, contentNode: s } = k(
2794
2923
  this._tiptapEditor.state.doc,
2795
2924
  r + 2
2796
2925
  );
@@ -2806,7 +2935,7 @@ class Wo {
2806
2935
  return;
2807
2936
  const e = [];
2808
2937
  return this._tiptapEditor.state.doc.descendants((t, o) => t.type.spec.group !== "blockContent" || o + t.nodeSize < this._tiptapEditor.state.selection.from || o > this._tiptapEditor.state.selection.to ? !0 : (e.push(
2809
- M(
2938
+ E(
2810
2939
  this._tiptapEditor.state.doc.resolve(o).node(),
2811
2940
  this.schema,
2812
2941
  this.blockCache
@@ -2836,7 +2965,7 @@ class Wo {
2836
2965
  * `referenceBlock`. Inserts the blocks at the start of the existing block's children if "nested" is used.
2837
2966
  */
2838
2967
  insertBlocks(e, t, o = "before") {
2839
- Bt(e, t, o, this._tiptapEditor);
2968
+ xt(e, t, o, this._tiptapEditor);
2840
2969
  }
2841
2970
  /**
2842
2971
  * Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be
@@ -2846,14 +2975,14 @@ class Wo {
2846
2975
  * @param update A partial block which defines how the existing block should be changed.
2847
2976
  */
2848
2977
  updateBlock(e, t) {
2849
- Ye(e, t, this._tiptapEditor);
2978
+ Ze(e, t, this._tiptapEditor);
2850
2979
  }
2851
2980
  /**
2852
2981
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
2853
2982
  * @param blocksToRemove An array of identifiers for existing blocks that should be removed.
2854
2983
  */
2855
2984
  removeBlocks(e) {
2856
- Tt(e, this._tiptapEditor);
2985
+ At(e, this._tiptapEditor);
2857
2986
  }
2858
2987
  /**
2859
2988
  * Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
@@ -2863,7 +2992,7 @@ class Wo {
2863
2992
  * @param blocksToInsert An array of partial blocks to replace the old ones with.
2864
2993
  */
2865
2994
  replaceBlocks(e, t) {
2866
- Je(e, t, this._tiptapEditor);
2995
+ Qe(e, t, this._tiptapEditor);
2867
2996
  }
2868
2997
  /**
2869
2998
  * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
@@ -2944,7 +3073,7 @@ class Wo {
2944
3073
  createLink(e, t) {
2945
3074
  if (e === "")
2946
3075
  return;
2947
- let { from: o, to: r } = this._tiptapEditor.state.selection;
3076
+ const { from: o, to: r } = this._tiptapEditor.state.selection;
2948
3077
  t || (t = this._tiptapEditor.state.doc.textBetween(o, r));
2949
3078
  const i = this._tiptapEditor.schema.mark("link", { href: e });
2950
3079
  this._tiptapEditor.view.dispatch(
@@ -2955,7 +3084,7 @@ class Wo {
2955
3084
  * Checks if the block containing the text cursor can be nested.
2956
3085
  */
2957
3086
  canNestBlock() {
2958
- const { startPos: e, depth: t } = g(
3087
+ const { startPos: e, depth: t } = k(
2959
3088
  this._tiptapEditor.state.doc,
2960
3089
  this._tiptapEditor.state.selection.from
2961
3090
  );
@@ -2971,7 +3100,7 @@ class Wo {
2971
3100
  * Checks if the block containing the text cursor is nested.
2972
3101
  */
2973
3102
  canUnnestBlock() {
2974
- const { depth: e } = g(
3103
+ const { depth: e } = k(
2975
3104
  this._tiptapEditor.state.doc,
2976
3105
  this._tiptapEditor.state.selection.from
2977
3106
  );
@@ -2990,7 +3119,7 @@ class Wo {
2990
3119
  * @returns The blocks, serialized as an HTML string.
2991
3120
  */
2992
3121
  async blocksToHTML(e) {
2993
- return xt(e, this._tiptapEditor.schema);
3122
+ return It(e, this._tiptapEditor.schema);
2994
3123
  }
2995
3124
  /**
2996
3125
  * Parses blocks from an HTML string. Tries to create `Block` objects out of any HTML block-level elements, and
@@ -3009,7 +3138,7 @@ class Wo {
3009
3138
  * @returns The blocks, serialized as a Markdown string.
3010
3139
  */
3011
3140
  async blocksToMarkdown(e) {
3012
- return Ze(e, this._tiptapEditor.schema);
3141
+ return oo(e, this._tiptapEditor.schema);
3013
3142
  }
3014
3143
  /**
3015
3144
  * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
@@ -3019,7 +3148,7 @@ class Wo {
3019
3148
  * @returns The blocks parsed from the Markdown string.
3020
3149
  */
3021
3150
  async markdownToBlocks(e) {
3022
- return Qe(e, this.schema, this._tiptapEditor.schema);
3151
+ return ro(e, this.schema, this._tiptapEditor.schema);
3023
3152
  }
3024
3153
  /**
3025
3154
  * Updates the user info for the current user that's shown to other collaborators.
@@ -3033,29 +3162,33 @@ class Wo {
3033
3162
  }
3034
3163
  }
3035
3164
  export {
3036
- Wo as BlockNoteEditor,
3037
- Oe as CustomBlockSerializerExtension,
3038
- oo as FormattingToolbarProsemirrorPlugin,
3039
- to as FormattingToolbarView,
3040
- io as HyperlinkToolbarProsemirrorPlugin,
3041
- ho as SideMenuProsemirrorPlugin,
3042
- uo as SideMenuView,
3043
- Ve as SlashMenuProsemirrorPlugin,
3044
- jo as blockStyles,
3045
- nt as camelToDataKebab,
3046
- qo as createBlockSpec,
3047
- P as createTipTapBlock,
3048
- wt as defaultBlockSchema,
3049
- N as defaultProps,
3050
- eo as formattingToolbarPluginKey,
3051
- We as getBlockNoteExtensions,
3052
- fo as getDefaultSlashMenuItems,
3053
- ro as hyperlinkToolbarPluginKey,
3054
- ge as parse,
3055
- me as propsToAttributes,
3056
- ke as render,
3057
- ze as setupSuggestionsMenu,
3058
- po as sideMenuPluginKey,
3059
- K as slashMenuPluginKey
3165
+ Qo as BlockNoteEditor,
3166
+ ze as CustomBlockSerializerExtension,
3167
+ ao as FormattingToolbarProsemirrorPlugin,
3168
+ io as FormattingToolbarView,
3169
+ uo as HyperlinkToolbarProsemirrorPlugin,
3170
+ bo as SideMenuProsemirrorPlugin,
3171
+ ko as SideMenuView,
3172
+ $e as SlashMenuProsemirrorPlugin,
3173
+ ye as UnreachableCaseError,
3174
+ Jo as blockStyles,
3175
+ rt as camelToDataKebab,
3176
+ Zo as createBlockSpec,
3177
+ O as createTipTapBlock,
3178
+ St as defaultBlockSchema,
3179
+ P as defaultProps,
3180
+ Xo as formatKeyboardShortcut,
3181
+ so as formattingToolbarPluginKey,
3182
+ Xe as getBlockNoteExtensions,
3183
+ yo as getDefaultSlashMenuItems,
3184
+ co as hyperlinkToolbarPluginKey,
3185
+ be as isAppleOS,
3186
+ v as mergeCSSClasses,
3187
+ Ce as parse,
3188
+ ve as propsToAttributes,
3189
+ we as render,
3190
+ Ge as setupSuggestionsMenu,
3191
+ go as sideMenuPluginKey,
3192
+ X as slashMenuPluginKey
3060
3193
  };
3061
3194
  //# sourceMappingURL=blocknote.js.map