@blocknote/core 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/blocknote.js +1126 -1031
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +2 -2
  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 +244 -3
  8. package/src/BlockNoteExtensions.ts +3 -2
  9. package/src/api/blockManipulation/__snapshots__/blockManipulation.test.ts.snap +35 -35
  10. package/src/api/formatConversions/__snapshots__/formatConversions.test.ts.snap +10 -10
  11. package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +10 -10
  12. package/src/api/nodeConversions/nodeConversions.ts +11 -10
  13. package/src/editor.module.css +12 -3
  14. package/src/extensions/Blocks/api/inlineContentTypes.ts +3 -2
  15. package/src/extensions/Blocks/api/selectionTypes.ts +5 -0
  16. package/src/extensions/Blocks/nodes/Block.module.css +20 -2
  17. package/src/extensions/DraggableBlocks/BlockSideMenuFactoryTypes.ts +5 -6
  18. package/src/extensions/DraggableBlocks/DraggableBlocksExtension.ts +5 -2
  19. package/src/extensions/DraggableBlocks/DraggableBlocksPlugin.ts +76 -113
  20. package/src/extensions/FormattingToolbar/FormattingToolbarExtension.ts +6 -3
  21. package/src/extensions/FormattingToolbar/FormattingToolbarFactoryTypes.ts +2 -34
  22. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +39 -113
  23. package/src/extensions/HyperlinkToolbar/HyperlinkToolbarPlugin.ts +56 -39
  24. package/src/extensions/UniqueID/UniqueID.ts +1 -1
  25. package/src/index.ts +1 -0
  26. package/src/shared/plugins/suggestion/SuggestionPlugin.ts +14 -2
  27. package/types/src/BlockNoteEditor.d.ts +79 -0
  28. package/types/src/extensions/Blocks/api/inlineContentTypes.d.ts +3 -2
  29. package/types/src/extensions/Blocks/api/selectionTypes.d.ts +4 -0
  30. package/types/src/extensions/DraggableBlocks/BlockSideMenuFactoryTypes.d.ts +4 -5
  31. package/types/src/extensions/DraggableBlocks/DraggableBlocksExtension.d.ts +3 -1
  32. package/types/src/extensions/DraggableBlocks/DraggableBlocksPlugin.d.ts +14 -16
  33. package/types/src/extensions/FormattingToolbar/FormattingToolbarExtension.d.ts +2 -0
  34. package/types/src/extensions/FormattingToolbar/FormattingToolbarFactoryTypes.d.ts +2 -25
  35. package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +9 -4
  36. package/types/src/index.d.ts +1 -0
  37. package/types/src/api/Editor.d.ts +0 -93
  38. package/types/src/extensions/SlashMenu/SlashMenuItem.d.ts +0 -24
  39. package/types/src/extensions/SlashMenu/defaultSlashCommands.d.ts +0 -5
package/dist/blocknote.js CHANGED
@@ -1,85 +1,85 @@
1
- var Ce = Object.defineProperty;
2
- var Be = (o, e, t) => e in o ? Ce(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var h = (o, e, t) => (Be(o, typeof e != "symbol" ? e + "" : e, t), t);
4
- import { Extension as C, findChildren as $, combineTransactionSteps as Te, getChangedRanges as Me, findChildrenInRange as we, Mark as ne, Node as E, mergeAttributes as x, InputRule as Y, findParentNode as xe, isTextSelection as Ee, isNodeSelection as Ie, posToDOMRect as re, getMarkRange as X, extensions as N, Editor as Se } from "@tiptap/core";
5
- import { Slice as A, Fragment as P, DOMSerializer as Ae, DOMParser as Pe } from "prosemirror-model";
6
- import { Plugin as B, PluginKey as v, TextSelection as Q, Selection as G, NodeSelection as Ne } from "prosemirror-state";
7
- import { v4 as Le } from "uuid";
8
- import ie from "rehype-parse";
9
- import He from "rehype-remark";
10
- import se from "rehype-stringify";
11
- import ae from "remark-gfm";
12
- import Oe from "remark-parse";
13
- import _e from "remark-rehype";
14
- import De from "remark-stringify";
15
- import { unified as W } from "unified";
1
+ var Et = Object.defineProperty;
2
+ var Ct = (o, t, e) => t in o ? Et(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var u = (o, t, e) => (Ct(o, typeof t != "symbol" ? t + "" : t, e), e);
4
+ import { Extension as E, findChildren as $, combineTransactionSteps as Mt, getChangedRanges as Bt, findChildrenInRange as Tt, Mark as rt, Node as S, mergeAttributes as w, InputRule as W, findParentNode as wt, isTextSelection as St, isNodeSelection as xt, posToDOMRect as nt, getMarkRange as X, extensions as H, Editor as It } from "@tiptap/core";
5
+ import { Slice as P, Fragment as L, DOMSerializer as Pt, DOMParser as Lt } from "prosemirror-model";
6
+ import { Plugin as C, PluginKey as v, TextSelection as Q, Selection as G, NodeSelection as At } from "prosemirror-state";
7
+ import { v4 as Ht } from "uuid";
8
+ import it from "rehype-parse";
9
+ import Nt from "rehype-remark";
10
+ import st from "rehype-stringify";
11
+ import at from "remark-gfm";
12
+ import _t from "remark-parse";
13
+ import Ot from "remark-rehype";
14
+ import Dt from "remark-stringify";
15
+ import { unified as j } from "unified";
16
16
  import { fromDom as Z } from "hast-util-from-dom";
17
- import { Bold as Fe } from "@tiptap/extension-bold";
18
- import { Code as Re } from "@tiptap/extension-code";
19
- import { Dropcursor as ze } from "@tiptap/extension-dropcursor";
20
- import { Gapcursor as Ue } from "@tiptap/extension-gapcursor";
21
- import { HardBreak as Ge } from "@tiptap/extension-hard-break";
22
- import { History as $e } from "@tiptap/extension-history";
23
- import { Italic as qe } from "@tiptap/extension-italic";
24
- import { Link as de } from "@tiptap/extension-link";
25
- import { Strike as Ye } from "@tiptap/extension-strike";
26
- import { Text as We } from "@tiptap/extension-text";
27
- import { Underline as je } from "@tiptap/extension-underline";
28
- import * as Ve from "prosemirror-view";
17
+ import { Bold as Ft } from "@tiptap/extension-bold";
18
+ import { Code as Rt } from "@tiptap/extension-code";
19
+ import { Dropcursor as zt } from "@tiptap/extension-dropcursor";
20
+ import { Gapcursor as Ut } from "@tiptap/extension-gapcursor";
21
+ import { HardBreak as Gt } from "@tiptap/extension-hard-break";
22
+ import { History as $t } from "@tiptap/extension-history";
23
+ import { Italic as qt } from "@tiptap/extension-italic";
24
+ import { Link as dt } from "@tiptap/extension-link";
25
+ import { Strike as Wt } from "@tiptap/extension-strike";
26
+ import { Text as jt } from "@tiptap/extension-text";
27
+ import { Underline as Yt } from "@tiptap/extension-underline";
28
+ import * as Kt from "prosemirror-view";
29
29
  import { Decoration as D, DecorationSet as F } from "prosemirror-view";
30
- const O = [
30
+ const _ = [
31
31
  "backgroundColor",
32
32
  "textColor",
33
33
  "textAlignment"
34
- ], ee = {
35
- paragraph: /* @__PURE__ */ new Set([...O]),
34
+ ], tt = {
35
+ paragraph: /* @__PURE__ */ new Set([..._]),
36
36
  heading: /* @__PURE__ */ new Set([
37
- ...O,
37
+ ..._,
38
38
  "level"
39
39
  ]),
40
40
  numberedListItem: /* @__PURE__ */ new Set([
41
- ...O
41
+ ..._
42
42
  ]),
43
- bulletListItem: /* @__PURE__ */ new Set([...O])
43
+ bulletListItem: /* @__PURE__ */ new Set([..._])
44
44
  };
45
- function k(o, e) {
46
- if (e < 0 || e > o.nodeSize)
45
+ function g(o, t) {
46
+ if (t < 0 || t > o.nodeSize)
47
47
  return;
48
- const t = o.resolve(e), n = t.depth;
49
- let r = t.node(n), i = n;
48
+ const e = o.resolve(t), r = e.depth;
49
+ let n = e.node(r), i = r;
50
50
  for (; ; ) {
51
51
  if (i < 0)
52
52
  return;
53
- if (r.type.name === "blockContainer")
53
+ if (n.type.name === "blockContainer")
54
54
  break;
55
- i -= 1, r = t.node(i);
55
+ i -= 1, n = e.node(i);
56
56
  }
57
- const a = r.attrs.id, s = r.firstChild, d = s.type, l = r.childCount === 2 ? r.lastChild.childCount : 0, c = t.start(i), u = t.end(i);
57
+ const a = n.attrs.id, s = n.firstChild, d = s.type, l = n.childCount === 2 ? n.lastChild.childCount : 0, c = e.start(i), h = e.end(i);
58
58
  return {
59
59
  id: a,
60
- node: r,
60
+ node: n,
61
61
  contentNode: s,
62
62
  contentType: d,
63
63
  numChildBlocks: l,
64
64
  startPos: c,
65
- endPos: u,
65
+ endPos: h,
66
66
  depth: i
67
67
  };
68
68
  }
69
- function Ke(o, e = JSON.stringify) {
70
- const t = {};
71
- return o.filter((n) => {
72
- const r = e(n);
73
- return Object.prototype.hasOwnProperty.call(t, r) ? !1 : t[r] = !0;
69
+ function Vt(o, t = JSON.stringify) {
70
+ const e = {};
71
+ return o.filter((r) => {
72
+ const n = t(r);
73
+ return Object.prototype.hasOwnProperty.call(e, n) ? !1 : e[n] = !0;
74
74
  });
75
75
  }
76
- function Je(o) {
77
- const e = o.filter(
78
- (n, r) => o.indexOf(n) !== r
76
+ function Jt(o) {
77
+ const t = o.filter(
78
+ (r, n) => o.indexOf(r) !== n
79
79
  );
80
- return Ke(e);
80
+ return Vt(t);
81
81
  }
82
- const j = C.create({
82
+ const Y = E.create({
83
83
  name: "uniqueID",
84
84
  // we’ll set a very high priority to make sure this runs first
85
85
  // and is compatible with `appendTransaction` hooks of other extensions
@@ -88,7 +88,7 @@ const j = C.create({
88
88
  return {
89
89
  attributeName: "id",
90
90
  types: [],
91
- generateID: () => window.__TEST_OPTIONS ? (window.__TEST_OPTIONS.mockID === void 0 ? window.__TEST_OPTIONS.mockID = 0 : window.__TEST_OPTIONS.mockID++, parseInt(window.__TEST_OPTIONS.mockID)) : Le(),
91
+ generateID: () => window.__TEST_OPTIONS ? (window.__TEST_OPTIONS.mockID === void 0 ? window.__TEST_OPTIONS.mockID = 0 : window.__TEST_OPTIONS.mockID++, window.__TEST_OPTIONS.mockID.toString()) : Ht(),
92
92
  filterTransaction: null
93
93
  };
94
94
  },
@@ -114,49 +114,49 @@ const j = C.create({
114
114
  (d) => d.name === "collaboration"
115
115
  ))
116
116
  return;
117
- const { view: o, state: e } = this.editor, { tr: t, doc: n } = e, { types: r, attributeName: i, generateID: a } = this.options;
118
- $(n, (d) => r.includes(d.type.name) && d.attrs[i] === null).forEach(({ node: d, pos: l }) => {
119
- t.setNodeMarkup(l, void 0, {
117
+ const { view: o, state: t } = this.editor, { tr: e, doc: r } = t, { types: n, attributeName: i, generateID: a } = this.options;
118
+ $(r, (d) => n.includes(d.type.name) && d.attrs[i] === null).forEach(({ node: d, pos: l }) => {
119
+ e.setNodeMarkup(l, void 0, {
120
120
  ...d.attrs,
121
121
  [i]: a()
122
122
  });
123
- }), t.setMeta("addToHistory", !1), o.dispatch(t);
123
+ }), e.setMeta("addToHistory", !1), o.dispatch(e);
124
124
  },
125
125
  addProseMirrorPlugins() {
126
- let o = null, e = !1;
126
+ let o = null, t = !1;
127
127
  return [
128
- new B({
128
+ new C({
129
129
  key: new v("uniqueID"),
130
- appendTransaction: (t, n, r) => {
131
- const i = t.some((m) => m.docChanged) && !n.doc.eq(r.doc), a = this.options.filterTransaction && t.some((m) => {
132
- var y, g;
133
- return !(!((g = (y = this.options).filterTransaction) === null || g === void 0) && g.call(y, m));
130
+ appendTransaction: (e, r, n) => {
131
+ const i = e.some((m) => m.docChanged) && !r.doc.eq(n.doc), a = this.options.filterTransaction && e.some((m) => {
132
+ var y, k;
133
+ return !(!((k = (y = this.options).filterTransaction) === null || k === void 0) && k.call(y, m));
134
134
  });
135
135
  if (!i || a)
136
136
  return;
137
- const { tr: s } = r, { types: d, attributeName: l, generateID: c } = this.options, u = Te(
138
- n.doc,
139
- t
140
- ), { mapping: f } = u;
141
- if (Me(u).forEach(({ newRange: m }) => {
142
- const y = we(
143
- r.doc,
137
+ const { tr: s } = n, { types: d, attributeName: l, generateID: c } = this.options, h = Mt(
138
+ r.doc,
139
+ e
140
+ ), { mapping: f } = h;
141
+ if (Bt(h).forEach(({ newRange: m }) => {
142
+ const y = Tt(
143
+ n.doc,
144
144
  m,
145
- (T) => d.includes(T.type.name)
146
- ), g = y.map(({ node: T }) => T.attrs[l]).filter((T) => T !== null), z = Je(g);
147
- y.forEach(({ node: T, pos: H }) => {
145
+ (M) => d.includes(M.type.name)
146
+ ), k = y.map(({ node: M }) => M.attrs[l]).filter((M) => M !== null), z = Jt(k);
147
+ y.forEach(({ node: M, pos: N }) => {
148
148
  var U;
149
- const J = (U = s.doc.nodeAt(H)) === null || U === void 0 ? void 0 : U.attrs[l];
149
+ const J = (U = s.doc.nodeAt(N)) === null || U === void 0 ? void 0 : U.attrs[l];
150
150
  if (J === null) {
151
- s.setNodeMarkup(H, void 0, {
152
- ...T.attrs,
151
+ s.setNodeMarkup(N, void 0, {
152
+ ...M.attrs,
153
153
  [l]: c()
154
154
  });
155
155
  return;
156
156
  }
157
- const { deleted: ve } = f.invert().mapResult(H);
158
- ve && z.includes(J) && s.setNodeMarkup(H, void 0, {
159
- ...T.attrs,
157
+ const { deleted: vt } = f.invert().mapResult(N);
158
+ vt && z.includes(J) && s.setNodeMarkup(N, void 0, {
159
+ ...M.attrs,
160
160
  [l]: c()
161
161
  });
162
162
  });
@@ -164,14 +164,14 @@ const j = C.create({
164
164
  return s;
165
165
  },
166
166
  // we register a global drag handler to track the current drag source element
167
- view(t) {
168
- const n = (r) => {
167
+ view(e) {
168
+ const r = (n) => {
169
169
  var i;
170
- o = !((i = t.dom.parentElement) === null || i === void 0) && i.contains(r.target) ? t.dom.parentElement : null;
170
+ o = !((i = e.dom.parentElement) === null || i === void 0) && i.contains(n.target) ? e.dom.parentElement : null;
171
171
  };
172
- return window.addEventListener("dragstart", n), {
172
+ return window.addEventListener("dragstart", r), {
173
173
  destroy() {
174
- window.removeEventListener("dragstart", n);
174
+ window.removeEventListener("dragstart", r);
175
175
  }
176
176
  };
177
177
  },
@@ -181,44 +181,44 @@ const j = C.create({
181
181
  handleDOMEvents: {
182
182
  // only create new ids for dropped content while holding `alt`
183
183
  // or content is dragged from another editor
184
- drop: (t, n) => {
185
- var r;
186
- return (o !== t.dom.parentElement || ((r = n.dataTransfer) === null || r === void 0 ? void 0 : r.effectAllowed) === "copy") && (o = null, e = !0), !1;
184
+ drop: (e, r) => {
185
+ var n;
186
+ return (o !== e.dom.parentElement || ((n = r.dataTransfer) === null || n === void 0 ? void 0 : n.effectAllowed) === "copy") && (o = null, t = !0), !1;
187
187
  },
188
188
  // always create new ids on pasted content
189
- paste: () => (e = !0, !1)
189
+ paste: () => (t = !0, !1)
190
190
  },
191
191
  // we’ll remove ids for every pasted node
192
192
  // so we can create a new one within `appendTransaction`
193
- transformPasted: (t) => {
194
- if (!e)
195
- return t;
196
- const { types: n, attributeName: r } = this.options, i = (a) => {
193
+ transformPasted: (e) => {
194
+ if (!t)
195
+ return e;
196
+ const { types: r, attributeName: n } = this.options, i = (a) => {
197
197
  const s = [];
198
198
  return a.forEach((d) => {
199
199
  if (d.isText) {
200
200
  s.push(d);
201
201
  return;
202
202
  }
203
- if (!n.includes(d.type.name)) {
203
+ if (!r.includes(d.type.name)) {
204
204
  s.push(d.copy(i(d.content)));
205
205
  return;
206
206
  }
207
207
  const l = d.type.create(
208
208
  {
209
209
  ...d.attrs,
210
- [r]: null
210
+ [n]: null
211
211
  },
212
212
  i(d.content),
213
213
  d.marks
214
214
  );
215
215
  s.push(l);
216
- }), P.from(s);
216
+ }), L.from(s);
217
217
  };
218
- return e = !1, new A(
219
- i(t.content),
220
- t.openStart,
221
- t.openEnd
218
+ return t = !1, new P(
219
+ i(e.content),
220
+ e.openStart,
221
+ e.openEnd
222
222
  );
223
223
  }
224
224
  }
@@ -226,249 +226,250 @@ const j = C.create({
226
226
  ];
227
227
  }
228
228
  });
229
- class Xe extends Error {
230
- constructor(e) {
231
- super(`Unreachable case: ${e}`);
229
+ class Xt extends Error {
230
+ constructor(t) {
231
+ super(`Unreachable case: ${t}`);
232
232
  }
233
233
  }
234
- const le = /* @__PURE__ */ new Set([
234
+ const lt = /* @__PURE__ */ new Set([
235
235
  "bold",
236
236
  "italic",
237
237
  "underline",
238
- "strike"
239
- ]), ce = /* @__PURE__ */ new Set(["textColor", "backgroundColor"]);
240
- function Qe(o, e) {
241
- const t = [];
242
- for (const [n, r] of Object.entries(o.styles))
243
- le.has(n) ? t.push(e.mark(n)) : ce.has(n) && t.push(e.mark(n, { color: r }));
244
- return e.text(o.text, t);
238
+ "strike",
239
+ "code"
240
+ ]), ct = /* @__PURE__ */ new Set(["textColor", "backgroundColor"]);
241
+ function Qt(o, t) {
242
+ const e = [];
243
+ for (const [r, n] of Object.entries(o.styles))
244
+ lt.has(r) ? e.push(t.mark(r)) : ct.has(r) && e.push(t.mark(r, { color: n }));
245
+ return t.text(o.text, e);
245
246
  }
246
- function Ze(o, e) {
247
- const t = e.marks.link.create({
247
+ function Zt(o, t) {
248
+ const e = t.marks.link.create({
248
249
  href: o.href
249
250
  });
250
- return ue(o.content, e).map((n) => n.mark([...n.marks, t]));
251
+ return ut(o.content, t).map((r) => r.mark([...r.marks, e]));
251
252
  }
252
- function ue(o, e) {
253
- let t = [];
253
+ function ut(o, t) {
254
+ let e = [];
254
255
  if (typeof o == "string")
255
- return t.push(e.text(o)), t;
256
- for (const n of o)
257
- t.push(Qe(n, e));
258
- return t;
256
+ return e.push(t.text(o)), e;
257
+ for (const r of o)
258
+ e.push(Qt(r, t));
259
+ return e;
259
260
  }
260
- function he(o, e) {
261
- let t = [];
262
- for (const n of o)
263
- if (n.type === "link")
264
- t.push(...Ze(n, e));
265
- else if (n.type === "text")
266
- t.push(...ue([n], e));
261
+ function ht(o, t) {
262
+ let e = [];
263
+ for (const r of o)
264
+ if (r.type === "link")
265
+ e.push(...Zt(r, t));
266
+ else if (r.type === "text")
267
+ e.push(...ut([r], t));
267
268
  else
268
- throw new Xe(n);
269
- return t;
269
+ throw new Xt(r);
270
+ return e;
270
271
  }
271
- function R(o, e) {
272
- let t = o.id;
273
- t === void 0 && (t = j.options.generateID());
274
- let n = o.type;
275
- n === void 0 && (n = "paragraph");
276
- let r;
272
+ function R(o, t) {
273
+ let e = o.id;
274
+ e === void 0 && (e = Y.options.generateID());
275
+ let r = o.type;
276
+ r === void 0 && (r = "paragraph");
277
+ let n;
277
278
  if (!o.content)
278
- r = e.nodes[n].create(o.props);
279
+ n = t.nodes[r].create(o.props);
279
280
  else if (typeof o.content == "string")
280
- r = e.nodes[n].create(
281
+ n = t.nodes[r].create(
281
282
  o.props,
282
- e.text(o.content)
283
+ t.text(o.content)
283
284
  );
284
285
  else {
285
- const s = he(o.content, e);
286
- r = e.nodes[n].create(o.props, s);
286
+ const s = ht(o.content, t);
287
+ n = t.nodes[r].create(o.props, s);
287
288
  }
288
289
  const i = [];
289
290
  if (o.children)
290
291
  for (const s of o.children)
291
- i.push(R(s, e));
292
- const a = e.nodes.blockGroup.create({}, i);
293
- return e.nodes.blockContainer.create(
292
+ i.push(R(s, t));
293
+ const a = t.nodes.blockGroup.create({}, i);
294
+ return t.nodes.blockContainer.create(
294
295
  {
295
- id: t,
296
+ id: e,
296
297
  ...o.props
297
298
  },
298
- i.length > 0 ? [r, a] : r
299
+ i.length > 0 ? [n, a] : n
299
300
  );
300
301
  }
301
- function et(o) {
302
- const e = [];
303
- let t;
304
- return o.content.forEach((n) => {
305
- const r = {};
302
+ function te(o) {
303
+ const t = [];
304
+ let e;
305
+ return o.content.forEach((r) => {
306
+ const n = {};
306
307
  let i;
307
- for (const a of n.marks)
308
+ for (const a of r.marks)
308
309
  if (a.type.name === "link")
309
310
  i = a;
310
- else if (le.has(a.type.name))
311
- r[a.type.name] = !0;
312
- else if (ce.has(a.type.name))
313
- r[a.type.name] = a.attrs.color;
311
+ else if (lt.has(a.type.name))
312
+ n[a.type.name] = !0;
313
+ else if (ct.has(a.type.name))
314
+ n[a.type.name] = a.attrs.color;
314
315
  else
315
316
  throw Error("Mark is of an unrecognized type: " + a.type.name);
316
- i && t && i.attrs.href === t.href ? t.content.push({
317
+ i && e && i.attrs.href === e.href ? e.content.push({
317
318
  type: "text",
318
- text: n.textContent,
319
- styles: r
320
- }) : i ? (t = {
319
+ text: r.textContent,
320
+ styles: n
321
+ }) : i ? (e = {
321
322
  type: "link",
322
323
  href: i.attrs.href,
323
324
  content: [
324
325
  {
325
326
  type: "text",
326
- text: n.textContent,
327
- styles: r
327
+ text: r.textContent,
328
+ styles: n
328
329
  }
329
330
  ]
330
- }, e.push(t)) : (e.push({
331
+ }, t.push(e)) : (t.push({
331
332
  type: "text",
332
- text: n.textContent,
333
- styles: r
334
- }), t = void 0);
335
- }), e;
333
+ text: r.textContent,
334
+ styles: n
335
+ }), e = void 0);
336
+ }), t;
336
337
  }
337
- function w(o, e) {
338
+ function B(o, t) {
338
339
  if (o.type.name !== "blockContainer")
339
340
  throw Error(
340
341
  "Node must be of type blockContainer, but is of type" + o.type.name + "."
341
342
  );
342
- const t = e == null ? void 0 : e.get(o);
343
- if (t)
344
- return t;
345
- const n = k(o, 0);
346
- let r = n.id;
347
- r === null && (r = j.options.generateID());
343
+ const e = t == null ? void 0 : t.get(o);
344
+ if (e)
345
+ return e;
346
+ const r = g(o, 0);
347
+ let n = r.id;
348
+ n === null && (n = Y.options.generateID());
348
349
  const i = {};
349
350
  for (const [l, c] of Object.entries({
350
- ...n.node.attrs,
351
- ...n.contentNode.attrs
351
+ ...r.node.attrs,
352
+ ...r.contentNode.attrs
352
353
  })) {
353
- if (!(n.contentType.name in ee))
354
+ if (!(r.contentType.name in tt))
354
355
  throw Error(
355
- "Block is of an unrecognized type: " + n.contentType.name
356
+ "Block is of an unrecognized type: " + r.contentType.name
356
357
  );
357
- ee[n.contentType.name].has(l) && (i[l] = c);
358
+ tt[r.contentType.name].has(l) && (i[l] = c);
358
359
  }
359
- const a = et(n.contentNode), s = [];
360
- for (let l = 0; l < n.numChildBlocks; l++)
361
- s.push(w(n.node.lastChild.child(l)));
360
+ const a = te(r.contentNode), s = [];
361
+ for (let l = 0; l < r.numChildBlocks; l++)
362
+ s.push(B(r.node.lastChild.child(l)));
362
363
  const d = {
363
- id: r,
364
- type: n.contentType.name,
364
+ id: n,
365
+ type: r.contentType.name,
365
366
  props: i,
366
367
  content: a,
367
368
  children: s
368
369
  };
369
- return e == null || e.set(o, d), d;
370
+ return t == null || t.set(o, d), d;
370
371
  }
371
- function V(o, e) {
372
- let t, n;
373
- if (e.firstChild.descendants((r, i) => t ? !1 : r.type.name !== "blockContainer" || r.attrs.id !== o ? !0 : (t = r, n = i + 1, !1)), t === void 0 || n === void 0)
372
+ function K(o, t) {
373
+ let e, r;
374
+ if (t.firstChild.descendants((n, i) => e ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== o ? !0 : (e = n, r = i + 1, !1)), e === void 0 || r === void 0)
374
375
  throw Error("Could not find block in the editor with matching ID.");
375
376
  return {
376
- node: t,
377
- posBeforeNode: n
377
+ node: e,
378
+ posBeforeNode: r
378
379
  };
379
380
  }
380
- function pe(o, e, t = "before", n) {
381
- const r = typeof e == "string" ? e : e.id, i = [];
381
+ function pt(o, t, e = "before", r) {
382
+ const n = typeof t == "string" ? t : t.id, i = [];
382
383
  for (const l of o)
383
- i.push(R(l, n.schema));
384
+ i.push(R(l, r.schema));
384
385
  let a = -1;
385
- const { node: s, posBeforeNode: d } = V(r, n.state.doc);
386
- if (t === "before" && (a = d), t === "after" && (a = d + s.nodeSize), t === "nested") {
386
+ const { node: s, posBeforeNode: d } = K(n, r.state.doc);
387
+ if (e === "before" && (a = d), e === "after" && (a = d + s.nodeSize), e === "nested") {
387
388
  if (s.childCount < 2) {
388
389
  a = d + s.firstChild.nodeSize + 1;
389
- const l = n.state.schema.nodes.blockGroup.create(
390
+ const l = r.state.schema.nodes.blockGroup.create(
390
391
  {},
391
392
  i
392
393
  );
393
- n.view.dispatch(
394
- n.state.tr.insert(a, l)
394
+ r.view.dispatch(
395
+ r.state.tr.insert(a, l)
395
396
  );
396
397
  return;
397
398
  }
398
399
  a = d + s.firstChild.nodeSize + 2;
399
400
  }
400
- n.view.dispatch(n.state.tr.insert(a, i));
401
+ r.view.dispatch(r.state.tr.insert(a, i));
401
402
  }
402
- function tt(o, e, t) {
403
- const n = typeof o == "string" ? o : o.id, { posBeforeNode: r } = V(n, t.state.doc);
404
- t.commands.BNUpdateBlock(r + 1, e);
403
+ function ee(o, t, e) {
404
+ const r = typeof o == "string" ? o : o.id, { posBeforeNode: n } = K(r, e.state.doc);
405
+ e.commands.BNUpdateBlock(n + 1, t);
405
406
  }
406
- function fe(o, e) {
407
- const t = new Set(
407
+ function ft(o, t) {
408
+ const e = new Set(
408
409
  o.map(
409
- (r) => typeof r == "string" ? r : r.id
410
+ (n) => typeof n == "string" ? n : n.id
410
411
  )
411
412
  );
412
- let n = 0;
413
- if (e.state.doc.descendants((r, i) => {
414
- if (t.size === 0)
413
+ let r = 0;
414
+ if (t.state.doc.descendants((n, i) => {
415
+ if (e.size === 0)
415
416
  return !1;
416
- if (r.type.name !== "blockContainer" || !t.has(r.attrs.id))
417
+ if (n.type.name !== "blockContainer" || !e.has(n.attrs.id))
417
418
  return !0;
418
- t.delete(r.attrs.id);
419
- const a = e.state.doc.nodeSize;
420
- e.commands.BNDeleteBlock(i - n + 1);
421
- const s = e.state.doc.nodeSize;
422
- return n += a - s, !1;
423
- }), t.size > 0) {
424
- let r = [...t].join(`
419
+ e.delete(n.attrs.id);
420
+ const a = t.state.doc.nodeSize;
421
+ t.commands.BNDeleteBlock(i - r + 1);
422
+ const s = t.state.doc.nodeSize;
423
+ return r += a - s, !1;
424
+ }), e.size > 0) {
425
+ let n = [...e].join(`
425
426
  `);
426
427
  throw Error(
427
- "Blocks with the following IDs could not be found in the editor: " + r
428
+ "Blocks with the following IDs could not be found in the editor: " + n
428
429
  );
429
430
  }
430
431
  }
431
- function ot(o, e, t) {
432
- pe(e, o[0], "before", t), fe(o, t);
432
+ function oe(o, t, e) {
433
+ pt(t, o[0], "before", e), ft(o, e);
433
434
  }
434
- function nt() {
435
- const o = (e) => {
436
- let t = e.children.length;
437
- for (let n = 0; n < t; n++) {
438
- const r = e.children[n];
439
- if (r.type === "element" && (o(r), r.tagName === "u"))
440
- if (r.children.length > 0) {
441
- e.children.splice(n, 1, ...r.children);
442
- const i = r.children.length - 1;
443
- t += i, n += i;
435
+ function re() {
436
+ const o = (t) => {
437
+ let e = t.children.length;
438
+ for (let r = 0; r < e; r++) {
439
+ const n = t.children[r];
440
+ if (n.type === "element" && (o(n), n.tagName === "u"))
441
+ if (n.children.length > 0) {
442
+ t.children.splice(r, 1, ...n.children);
443
+ const i = n.children.length - 1;
444
+ e += i, r += i;
444
445
  } else
445
- e.children.splice(n, 1), t--, n--;
446
+ t.children.splice(r, 1), e--, r--;
446
447
  }
447
448
  };
448
449
  return o;
449
450
  }
450
- function rt(o) {
451
- const e = /* @__PURE__ */ new Set([
451
+ function ne(o) {
452
+ const t = /* @__PURE__ */ new Set([
452
453
  ...o.orderedListItemBlockTypes,
453
454
  ...o.unorderedListItemBlockTypes
454
- ]), t = (n) => {
455
- let r = n.children.length, i;
456
- for (let a = 0; a < r; a++) {
457
- const d = n.children[a].children[0], l = d.children[0], c = d.children.length === 2 ? d.children[1] : null, u = e.has(
455
+ ]), e = (r) => {
456
+ let n = r.children.length, i;
457
+ for (let a = 0; a < n; a++) {
458
+ const d = r.children[a].children[0], l = d.children[0], c = d.children.length === 2 ? d.children[1] : null, h = t.has(
458
459
  l.properties.dataContentType
459
- ), f = u ? o.orderedListItemBlockTypes.has(
460
+ ), f = h ? o.orderedListItemBlockTypes.has(
460
461
  l.properties.dataContentType
461
462
  ) ? "ol" : "ul" : null;
462
- if (c !== null && t(c), i && i.tagName !== f) {
463
- n.children.splice(
463
+ if (c !== null && e(c), i && i.tagName !== f) {
464
+ r.children.splice(
464
465
  a - i.children.length,
465
466
  i.children.length,
466
467
  i
467
468
  );
468
469
  const p = i.children.length - 1;
469
- a -= p, r -= p, i = void 0;
470
+ a -= p, n -= p, i = void 0;
470
471
  }
471
- if (u) {
472
+ if (h) {
472
473
  i || (i = Z(
473
474
  document.createElement(f)
474
475
  ));
@@ -477,47 +478,47 @@ function rt(o) {
477
478
  );
478
479
  p.children.push(l.children[0]), c !== null && p.children.push(...c.children), i.children.push(p);
479
480
  } else if (c !== null) {
480
- n.children.splice(a + 1, 0, ...c.children), n.children[a] = l.children[0];
481
+ r.children.splice(a + 1, 0, ...c.children), r.children[a] = l.children[0];
481
482
  const p = c.children.length;
482
- a += p, r += p;
483
+ a += p, n += p;
483
484
  } else
484
- n.children[a] = l.children[0];
485
+ r.children[a] = l.children[0];
485
486
  }
486
- i && n.children.splice(
487
- r - i.children.length,
487
+ i && r.children.splice(
488
+ n - i.children.length,
488
489
  i.children.length,
489
490
  i
490
491
  );
491
492
  };
492
- return t;
493
+ return e;
493
494
  }
494
- async function me(o, e) {
495
- const t = document.createElement("div"), n = Ae.fromSchema(e);
495
+ async function mt(o, t) {
496
+ const e = document.createElement("div"), r = Pt.fromSchema(t);
496
497
  for (const i of o) {
497
- const a = R(i, e), s = n.serializeNode(a);
498
- t.appendChild(s);
498
+ const a = R(i, t), s = r.serializeNode(a);
499
+ e.appendChild(s);
499
500
  }
500
- return (await W().use(ie, { fragment: !0 }).use(rt, {
501
+ return (await j().use(it, { fragment: !0 }).use(ne, {
501
502
  orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
502
503
  unorderedListItemBlockTypes: /* @__PURE__ */ new Set(["bulletListItem"])
503
- }).use(se).process(t.innerHTML)).value;
504
+ }).use(st).process(e.innerHTML)).value;
504
505
  }
505
- async function ke(o, e) {
506
- const t = document.createElement("div");
507
- t.innerHTML = o.trim();
508
- const r = Pe.fromSchema(e).parse(t), i = [];
509
- for (let a = 0; a < r.firstChild.childCount; a++)
510
- i.push(w(r.firstChild.child(a)));
506
+ async function gt(o, t) {
507
+ const e = document.createElement("div");
508
+ e.innerHTML = o.trim();
509
+ const n = Lt.fromSchema(t).parse(e), i = [];
510
+ for (let a = 0; a < n.firstChild.childCount; a++)
511
+ i.push(B(n.firstChild.child(a)));
511
512
  return i;
512
513
  }
513
- async function it(o, e) {
514
- return (await W().use(ie, { fragment: !0 }).use(nt).use(He).use(ae).use(De).process(await me(o, e))).value;
514
+ async function ie(o, t) {
515
+ return (await j().use(it, { fragment: !0 }).use(re).use(Nt).use(at).use(Dt).process(await mt(o, t))).value;
515
516
  }
516
- async function st(o, e) {
517
- const t = await W().use(Oe).use(ae).use(_e).use(se).process(o);
518
- return ke(t.value, e);
517
+ async function se(o, t) {
518
+ const e = await j().use(_t).use(at).use(Ot).use(st).process(o);
519
+ return gt(e.value, t);
519
520
  }
520
- const at = C.create({
521
+ const ae = E.create({
521
522
  name: "blockBackgroundColor",
522
523
  addGlobalAttributes() {
523
524
  return [
@@ -537,17 +538,17 @@ const at = C.create({
537
538
  },
538
539
  addCommands() {
539
540
  return {
540
- setBlockBackgroundColor: (o, e) => ({ state: t, view: n }) => {
541
- const r = k(t.doc, o);
542
- return r === void 0 ? !1 : (t.tr.setNodeAttribute(
543
- r.startPos - 1,
541
+ setBlockBackgroundColor: (o, t) => ({ state: e, view: r }) => {
542
+ const n = g(e.doc, o);
543
+ return n === void 0 ? !1 : (e.tr.setNodeAttribute(
544
+ n.startPos - 1,
544
545
  "backgroundColor",
545
- e
546
- ), n.focus(), !0);
546
+ t
547
+ ), r.focus(), !0);
547
548
  }
548
549
  };
549
550
  }
550
- }), dt = ne.create({
551
+ }), de = rt.create({
551
552
  name: "backgroundColor",
552
553
  addAttributes() {
553
554
  return {
@@ -573,10 +574,10 @@ const at = C.create({
573
574
  },
574
575
  addCommands() {
575
576
  return {
576
- setBackgroundColor: (o) => ({ commands: e }) => o !== "default" ? e.setMark(this.name, { color: o }) : e.unsetMark(this.name)
577
+ setBackgroundColor: (o) => ({ commands: t }) => o !== "default" ? t.setMark(this.name, { color: o }) : t.unsetMark(this.name)
577
578
  };
578
579
  }
579
- }), te = new v("previous-blocks"), lt = {
580
+ }), et = new v("previous-blocks"), le = {
580
581
  // Numbered List Items
581
582
  index: "index",
582
583
  // Headings
@@ -585,17 +586,17 @@ const at = C.create({
585
586
  type: "type",
586
587
  depth: "depth",
587
588
  "depth-change": "depth-change"
588
- }, ct = () => {
589
+ }, ce = () => {
589
590
  let o;
590
- return new B({
591
- key: te,
592
- view(e) {
591
+ return new C({
592
+ key: et,
593
+ view(t) {
593
594
  return {
594
- update: async (t, n) => {
595
- var r;
596
- ((r = this.key) == null ? void 0 : r.getState(t.state).updatedBlocks.size) > 0 && (o = setTimeout(() => {
597
- t.dispatch(
598
- t.state.tr.setMeta(te, { clearUpdate: !0 })
595
+ update: async (e, r) => {
596
+ var n;
597
+ ((n = this.key) == null ? void 0 : n.getState(e.state).updatedBlocks.size) > 0 && (o = setTimeout(() => {
598
+ e.dispatch(
599
+ e.state.tr.setMeta(et, { clearUpdate: !0 })
599
600
  );
600
601
  }, 0));
601
602
  },
@@ -615,68 +616,68 @@ const at = C.create({
615
616
  updatedBlocks: /* @__PURE__ */ new Set()
616
617
  };
617
618
  },
618
- apply(e, t, n, r) {
619
- if (t.currentTransactionOldBlockAttrs = {}, t.updatedBlocks.clear(), !e.docChanged || n.doc.eq(r.doc))
620
- return t;
621
- const i = {}, a = $(n.doc, (l) => l.attrs.id), s = new Map(
619
+ apply(t, e, r, n) {
620
+ if (e.currentTransactionOldBlockAttrs = {}, e.updatedBlocks.clear(), !t.docChanged || r.doc.eq(n.doc))
621
+ return e;
622
+ const i = {}, a = $(r.doc, (l) => l.attrs.id), s = new Map(
622
623
  a.map((l) => [l.node.attrs.id, l])
623
- ), d = $(r.doc, (l) => l.attrs.id);
624
+ ), d = $(n.doc, (l) => l.attrs.id);
624
625
  for (let l of d) {
625
- const c = s.get(l.node.attrs.id), u = c == null ? void 0 : c.node.firstChild, f = l.node.firstChild;
626
- if (c && u && f) {
626
+ const c = s.get(l.node.attrs.id), h = c == null ? void 0 : c.node.firstChild, f = l.node.firstChild;
627
+ if (c && h && f) {
627
628
  const p = {
628
629
  index: f.attrs.index,
629
630
  level: f.attrs.level,
630
631
  type: f.type.name,
631
- depth: r.doc.resolve(l.pos).depth
632
+ depth: n.doc.resolve(l.pos).depth
632
633
  };
633
634
  let m = {
634
- index: u.attrs.index,
635
- level: u.attrs.level,
636
- type: u.type.name,
637
- depth: n.doc.resolve(c.pos).depth
635
+ index: h.attrs.index,
636
+ level: h.attrs.level,
637
+ type: h.type.name,
638
+ depth: r.doc.resolve(c.pos).depth
638
639
  };
639
- i[l.node.attrs.id] = m, e.getMeta("numberedListIndexing") && (l.node.attrs.id in t.prevTransactionOldBlockAttrs && (m = t.prevTransactionOldBlockAttrs[l.node.attrs.id]), p.type === "numberedListItem" && (m.index = p.index)), t.currentTransactionOldBlockAttrs[l.node.attrs.id] = m, JSON.stringify(m) !== JSON.stringify(p) && (m["depth-change"] = m.depth - p.depth, t.updatedBlocks.add(l.node.attrs.id));
640
+ i[l.node.attrs.id] = m, t.getMeta("numberedListIndexing") && (l.node.attrs.id in e.prevTransactionOldBlockAttrs && (m = e.prevTransactionOldBlockAttrs[l.node.attrs.id]), p.type === "numberedListItem" && (m.index = p.index)), e.currentTransactionOldBlockAttrs[l.node.attrs.id] = m, JSON.stringify(m) !== JSON.stringify(p) && (m["depth-change"] = m.depth - p.depth, e.updatedBlocks.add(l.node.attrs.id));
640
641
  }
641
642
  }
642
- return t.prevTransactionOldBlockAttrs = i, t;
643
+ return e.prevTransactionOldBlockAttrs = i, e;
643
644
  }
644
645
  },
645
646
  props: {
646
- decorations(e) {
647
- const t = this.getState(e);
648
- if (t.updatedBlocks.size === 0)
647
+ decorations(t) {
648
+ const e = this.getState(t);
649
+ if (e.updatedBlocks.size === 0)
649
650
  return;
650
- const n = [];
651
- return e.doc.descendants((r, i) => {
652
- if (!r.attrs.id || !t.updatedBlocks.has(r.attrs.id))
651
+ const r = [];
652
+ return t.doc.descendants((n, i) => {
653
+ if (!n.attrs.id || !e.updatedBlocks.has(n.attrs.id))
653
654
  return;
654
- const a = t.currentTransactionOldBlockAttrs[r.attrs.id], s = {};
655
+ const a = e.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
655
656
  for (let [l, c] of Object.entries(a))
656
- s["data-prev-" + lt[l]] = c || "none";
657
- const d = D.node(i, i + r.nodeSize, {
657
+ s["data-prev-" + le[l]] = c || "none";
658
+ const d = D.node(i, i + n.nodeSize, {
658
659
  ...s
659
660
  });
660
- n.push(d);
661
- }), F.create(e.doc, n);
661
+ r.push(d);
662
+ }), F.create(t.doc, r);
662
663
  }
663
664
  }
664
665
  });
665
- }, ut = "_blockOuter_1xym9_5", ht = "_blockContent_1xym9_10", pt = "_blockGroup_1xym9_26", ft = "_block_1xym9_5", mt = "_isEmpty_1xym9_215", kt = "_isFilter_1xym9_216", gt = "_hasAnchor_1xym9_229", b = {
666
- blockOuter: ut,
667
- blockContent: ht,
668
- blockGroup: pt,
669
- block: ft,
670
- isEmpty: mt,
671
- isFilter: kt,
672
- hasAnchor: gt
673
- }, yt = {
666
+ }, ue = "_blockOuter_63zqr_5", he = "_blockContent_63zqr_10", pe = "_blockGroup_63zqr_26", fe = "_block_63zqr_5", me = "_isEmpty_63zqr_224", ge = "_isFilter_63zqr_225", ke = "_hasAnchor_63zqr_247", b = {
667
+ blockOuter: ue,
668
+ blockContent: he,
669
+ blockGroup: pe,
670
+ block: fe,
671
+ isEmpty: me,
672
+ isFilter: ge,
673
+ hasAnchor: ke
674
+ }, ye = {
674
675
  blockColor: "data-block-color",
675
676
  blockStyle: "data-block-style",
676
677
  id: "data-id",
677
678
  depth: "data-depth",
678
679
  depthChange: "data-depth-change"
679
- }, bt = E.create({
680
+ }, be = S.create({
680
681
  name: "blockContainer",
681
682
  group: "blockContainer",
682
683
  // A block always contains content, and optionally a blockGroup which contains nested blocks
@@ -696,10 +697,10 @@ const at = C.create({
696
697
  getAttrs: (o) => {
697
698
  if (typeof o == "string")
698
699
  return !1;
699
- const e = {};
700
- for (let [t, n] of Object.entries(yt))
701
- o.getAttribute(n) && (e[t] = o.getAttribute(n));
702
- return o.getAttribute("data-node-type") === "blockContainer" ? e : !1;
700
+ const t = {};
701
+ for (let [e, r] of Object.entries(ye))
702
+ o.getAttribute(r) && (t[e] = o.getAttribute(r));
703
+ return o.getAttribute("data-node-type") === "blockContainer" ? t : !1;
703
704
  }
704
705
  }
705
706
  ];
@@ -707,13 +708,13 @@ const at = C.create({
707
708
  renderHTML({ HTMLAttributes: o }) {
708
709
  return [
709
710
  "div",
710
- x(o, {
711
+ w(o, {
711
712
  class: b.blockOuter,
712
713
  "data-node-type": "block-outer"
713
714
  }),
714
715
  [
715
716
  "div",
716
- x(o, {
717
+ w(o, {
717
718
  // TODO: maybe remove html attributes from inner block
718
719
  class: b.block,
719
720
  "data-node-type": this.name
@@ -725,56 +726,56 @@ const at = C.create({
725
726
  addCommands() {
726
727
  return {
727
728
  // Creates a new text block at a given position.
728
- BNCreateBlock: (o) => ({ state: e, dispatch: t }) => {
729
- const n = e.schema.nodes.blockContainer.createAndFill();
730
- return t && e.tr.insert(o, n), !0;
729
+ BNCreateBlock: (o) => ({ state: t, dispatch: e }) => {
730
+ const r = t.schema.nodes.blockContainer.createAndFill();
731
+ return e && t.tr.insert(o, r), !0;
731
732
  },
732
733
  // Deletes a block at a given position.
733
- BNDeleteBlock: (o) => ({ state: e, dispatch: t }) => {
734
- const n = k(e.doc, o);
735
- if (n === void 0)
734
+ BNDeleteBlock: (o) => ({ state: t, dispatch: e }) => {
735
+ const r = g(t.doc, o);
736
+ if (r === void 0)
736
737
  return !1;
737
- const { startPos: r, endPos: i } = n;
738
- return t && e.tr.deleteRange(r, i), !0;
738
+ const { startPos: n, endPos: i } = r;
739
+ return e && t.tr.deleteRange(n, i), !0;
739
740
  },
740
741
  // Updates a block at a given position.
741
- BNUpdateBlock: (o, e) => ({ state: t, dispatch: n }) => {
742
- const r = k(t.doc, o);
743
- if (r === void 0)
742
+ BNUpdateBlock: (o, t) => ({ state: e, dispatch: r }) => {
743
+ const n = g(e.doc, o);
744
+ if (n === void 0)
744
745
  return !1;
745
- const { startPos: i, endPos: a, node: s, contentNode: d } = r;
746
- if (n) {
747
- if (e.children !== void 0) {
746
+ const { startPos: i, endPos: a, node: s, contentNode: d } = n;
747
+ if (r) {
748
+ if (t.children !== void 0) {
748
749
  const l = [];
749
- for (const c of e.children)
750
- l.push(R(c, t.schema));
751
- s.childCount === 2 ? t.tr.replace(
750
+ for (const c of t.children)
751
+ l.push(R(c, e.schema));
752
+ s.childCount === 2 ? e.tr.replace(
752
753
  i + d.nodeSize + 1,
753
754
  a - 1,
754
- new A(P.from(l), 0, 0)
755
- ) : t.tr.insert(
755
+ new P(L.from(l), 0, 0)
756
+ ) : e.tr.insert(
756
757
  i + d.nodeSize,
757
- t.schema.nodes.blockGroup.create({}, l)
758
+ e.schema.nodes.blockGroup.create({}, l)
758
759
  );
759
760
  }
760
- if (e.content !== void 0) {
761
+ if (t.content !== void 0) {
761
762
  let l = [];
762
- typeof e.content == "string" ? l.push(t.schema.text(e.content)) : l = he(e.content, t.schema), t.tr.replace(
763
+ typeof t.content == "string" ? l.push(e.schema.text(t.content)) : l = ht(t.content, e.schema), e.tr.replace(
763
764
  i + 1,
764
765
  i + d.nodeSize - 1,
765
- new A(P.from(l), 0, 0)
766
+ new P(L.from(l), 0, 0)
766
767
  );
767
768
  }
768
- t.tr.setNodeMarkup(
769
+ e.tr.setNodeMarkup(
769
770
  i,
770
- e.type === void 0 ? void 0 : t.schema.nodes[e.type],
771
+ t.type === void 0 ? void 0 : e.schema.nodes[t.type],
771
772
  {
772
773
  ...d.attrs,
773
- ...e.props
774
+ ...t.props
774
775
  }
775
- ), t.tr.setNodeMarkup(i - 1, void 0, {
776
+ ), e.tr.setNodeMarkup(i - 1, void 0, {
776
777
  ...s.attrs,
777
- ...e.props
778
+ ...t.props
778
779
  });
779
780
  }
780
781
  return !0;
@@ -796,55 +797,55 @@ const at = C.create({
796
797
  // Block2Block3
797
798
  // Block4
798
799
  // Block5
799
- BNMergeBlocks: (o) => ({ state: e, dispatch: t }) => {
800
- const n = e.doc.resolve(o + 1).node().type.name === "blockContainer", r = e.doc.resolve(o - 1).node().type.name === "blockContainer";
801
- if (!n || !r)
800
+ BNMergeBlocks: (o) => ({ state: t, dispatch: e }) => {
801
+ const r = t.doc.resolve(o + 1).node().type.name === "blockContainer", n = t.doc.resolve(o - 1).node().type.name === "blockContainer";
802
+ if (!r || !n)
802
803
  return !1;
803
- const i = k(
804
- e.doc,
804
+ const i = g(
805
+ t.doc,
805
806
  o + 1
806
807
  ), { node: a, contentNode: s, startPos: d, endPos: l, depth: c } = i;
807
808
  if (a.childCount === 2) {
808
- const p = e.doc.resolve(
809
+ const p = t.doc.resolve(
809
810
  d + s.nodeSize + 1
810
- ), m = e.doc.resolve(l - 1), y = p.blockRange(m);
811
- t && e.tr.lift(y, c - 1);
811
+ ), m = t.doc.resolve(l - 1), y = p.blockRange(m);
812
+ e && t.tr.lift(y, c - 1);
812
813
  }
813
- let u = o - 1, f = k(e.doc, u);
814
+ let h = o - 1, f = g(t.doc, h);
814
815
  for (; f.numChildBlocks > 0; )
815
- if (u--, f = k(e.doc, u), f === void 0)
816
+ if (h--, f = g(t.doc, h), f === void 0)
816
817
  return !1;
817
- return t && (e.tr.deleteRange(d, d + s.nodeSize), e.tr.insertText(s.textContent, u - 1), e.tr.setSelection(
818
- new Q(e.doc.resolve(u - 1))
818
+ return e && (t.tr.deleteRange(d, d + s.nodeSize), t.tr.insertText(s.textContent, h - 1), t.tr.setSelection(
819
+ new Q(t.doc.resolve(h - 1))
819
820
  )), !0;
820
821
  },
821
822
  // Splits a block at a given position. Content after the position is moved to a new block below, at the same
822
823
  // nesting level.
823
- BNSplitBlock: (o, e) => ({ state: t, dispatch: n }) => {
824
- const r = k(t.doc, o);
825
- if (r === void 0)
824
+ BNSplitBlock: (o, t) => ({ state: e, dispatch: r }) => {
825
+ const n = g(e.doc, o);
826
+ if (n === void 0)
826
827
  return !1;
827
- const { contentNode: i, contentType: a, startPos: s, endPos: d, depth: l } = r, c = t.doc.cut(s + 1, o), u = t.doc.cut(o, d - 1), f = t.schema.nodes.blockContainer.createAndFill(), p = d + 1, m = p + 2;
828
- return n && (t.tr.insert(p, f), t.tr.replace(
828
+ const { contentNode: i, contentType: a, startPos: s, endPos: d, depth: l } = n, c = e.doc.cut(s + 1, o), h = e.doc.cut(o, d - 1), f = e.schema.nodes.blockContainer.createAndFill(), p = d + 1, m = p + 2;
829
+ return r && (e.tr.insert(p, f), e.tr.replace(
829
830
  m,
830
831
  m + 1,
831
- u.content.size > 0 ? new A(
832
- P.from(u),
832
+ h.content.size > 0 ? new P(
833
+ L.from(h),
833
834
  l + 2,
834
835
  l + 2
835
836
  ) : void 0
836
- ), e && t.tr.setBlockType(
837
+ ), t && e.tr.setBlockType(
837
838
  m,
838
839
  m,
839
- t.schema.node(a).type,
840
+ e.schema.node(a).type,
840
841
  i.attrs
841
- ), t.tr.setSelection(
842
- new Q(t.doc.resolve(m))
843
- ), t.tr.replace(
842
+ ), e.tr.setSelection(
843
+ new Q(e.doc.resolve(m))
844
+ ), e.tr.replace(
844
845
  s + 1,
845
846
  d - 1,
846
- c.content.size > 0 ? new A(
847
- P.from(c),
847
+ c.content.size > 0 ? new P(
848
+ L.from(c),
848
849
  l + 2,
849
850
  l + 2
850
851
  ) : void 0
@@ -853,69 +854,69 @@ const at = C.create({
853
854
  };
854
855
  },
855
856
  addProseMirrorPlugins() {
856
- return [ct()];
857
+ return [ce()];
857
858
  },
858
859
  addKeyboardShortcuts() {
859
860
  return {
860
- Backspace: () => this.editor.commands.first(({ commands: t }) => [
861
+ Backspace: () => this.editor.commands.first(({ commands: e }) => [
861
862
  // Deletes the selection if it's not empty.
862
- () => t.deleteSelection(),
863
+ () => e.deleteSelection(),
863
864
  // Undoes an input rule if one was triggered in the last editor state change.
864
- () => t.undoInputRule(),
865
+ () => e.undoInputRule(),
865
866
  // Reverts block content type to a paragraph if the selection is at the start of the block.
866
- () => t.command(({ state: n }) => {
867
- const { contentType: r } = k(
868
- n.doc,
869
- n.selection.from
870
- ), i = n.selection.$anchor.parentOffset === 0, a = r.name === "paragraph";
871
- return i && !a ? t.BNUpdateBlock(n.selection.from, {
867
+ () => e.command(({ state: r }) => {
868
+ const { contentType: n } = g(
869
+ r.doc,
870
+ r.selection.from
871
+ ), i = r.selection.$anchor.parentOffset === 0, a = n.name === "paragraph";
872
+ return i && !a ? e.BNUpdateBlock(r.selection.from, {
872
873
  type: "paragraph",
873
874
  props: {}
874
875
  }) : !1;
875
876
  }),
876
877
  // Removes a level of nesting if the block is indented if the selection is at the start of the block.
877
- () => t.command(({ state: n }) => n.selection.$anchor.parentOffset === 0 ? t.liftListItem("blockContainer") : !1),
878
+ () => e.command(({ state: r }) => r.selection.$anchor.parentOffset === 0 ? e.liftListItem("blockContainer") : !1),
878
879
  // Merges block with the previous one if it isn't indented, isn't the first block in the doc, and the selection
879
880
  // is at the start of the block.
880
- () => t.command(({ state: n }) => {
881
- const { depth: r, startPos: i } = k(
882
- n.doc,
883
- n.selection.from
884
- ), a = n.selection.$anchor.parentOffset === 0, s = n.selection.anchor === n.selection.head, d = i === 2, l = i - 1;
885
- return !d && a && s && r === 2 ? t.BNMergeBlocks(l) : !1;
881
+ () => e.command(({ state: r }) => {
882
+ const { depth: n, startPos: i } = g(
883
+ r.doc,
884
+ r.selection.from
885
+ ), a = r.selection.$anchor.parentOffset === 0, s = r.selection.anchor === r.selection.head, d = i === 2, l = i - 1;
886
+ return !d && a && s && n === 2 ? e.BNMergeBlocks(l) : !1;
886
887
  })
887
888
  ]),
888
- Enter: () => this.editor.commands.first(({ commands: t }) => [
889
+ Enter: () => this.editor.commands.first(({ commands: e }) => [
889
890
  // Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
890
891
  // of the block.
891
- () => t.command(({ state: n }) => {
892
- const { node: r, depth: i } = k(
893
- n.doc,
894
- n.selection.from
895
- ), a = n.selection.$anchor.parentOffset === 0, s = n.selection.anchor === n.selection.head, d = r.textContent.length === 0, l = i > 2;
896
- return a && s && d && l ? t.liftListItem("blockContainer") : !1;
892
+ () => e.command(({ state: r }) => {
893
+ const { node: n, depth: i } = g(
894
+ r.doc,
895
+ r.selection.from
896
+ ), a = r.selection.$anchor.parentOffset === 0, s = r.selection.anchor === r.selection.head, d = n.textContent.length === 0, l = i > 2;
897
+ return a && s && d && l ? e.liftListItem("blockContainer") : !1;
897
898
  }),
898
899
  // Creates a new block and moves the selection to it if the current one is empty, while the selection is also
899
900
  // empty & at the start of the block.
900
- () => t.command(({ state: n, chain: r }) => {
901
- const { node: i, endPos: a } = k(
902
- n.doc,
903
- n.selection.from
904
- ), s = n.selection.$anchor.parentOffset === 0, d = n.selection.anchor === n.selection.head, l = i.textContent.length === 0;
901
+ () => e.command(({ state: r, chain: n }) => {
902
+ const { node: i, endPos: a } = g(
903
+ r.doc,
904
+ r.selection.from
905
+ ), s = r.selection.$anchor.parentOffset === 0, d = r.selection.anchor === r.selection.head, l = i.textContent.length === 0;
905
906
  if (s && d && l) {
906
- const c = a + 1, u = c + 2;
907
- return r().BNCreateBlock(c).setTextSelection(u).run(), !0;
907
+ const c = a + 1, h = c + 2;
908
+ return n().BNCreateBlock(c).setTextSelection(h).run(), !0;
908
909
  }
909
910
  return !1;
910
911
  }),
911
912
  // Splits the current block, moving content inside that's after the cursor to a new text block below. Also
912
913
  // deletes the selection beforehand, if it's not empty.
913
- () => t.command(({ state: n, chain: r }) => {
914
- const { node: i } = k(
915
- n.doc,
916
- n.selection.from
914
+ () => e.command(({ state: r, chain: n }) => {
915
+ const { node: i } = g(
916
+ r.doc,
917
+ r.selection.from
917
918
  );
918
- return i.textContent.length === 0 ? !1 : (r().deleteSelection().BNSplitBlock(n.selection.from, !1).run(), !0);
919
+ return i.textContent.length === 0 ? !1 : (n().deleteSelection().BNSplitBlock(r.selection.from, !1).run(), !0);
919
920
  })
920
921
  ]),
921
922
  // Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
@@ -953,7 +954,7 @@ const at = C.create({
953
954
  })
954
955
  };
955
956
  }
956
- }), vt = E.create({
957
+ }), ve = S.create({
957
958
  name: "blockGroup",
958
959
  group: "blockGroup",
959
960
  content: "blockContainer+",
@@ -973,14 +974,14 @@ const at = C.create({
973
974
  renderHTML({ HTMLAttributes: o }) {
974
975
  return [
975
976
  "div",
976
- x(this.options.HTMLAttributes, o, {
977
+ w(this.options.HTMLAttributes, o, {
977
978
  class: b.blockGroup,
978
979
  "data-node-type": "blockGroup"
979
980
  }),
980
981
  0
981
982
  ];
982
983
  }
983
- }), Ct = E.create({
984
+ }), Ee = S.create({
984
985
  name: "paragraph",
985
986
  group: "blockContent",
986
987
  content: "inline*",
@@ -996,14 +997,14 @@ const at = C.create({
996
997
  renderHTML({ HTMLAttributes: o }) {
997
998
  return [
998
999
  "div",
999
- x(o, {
1000
+ w(o, {
1000
1001
  class: b.blockContent,
1001
1002
  "data-content-type": this.name
1002
1003
  }),
1003
1004
  ["p", 0]
1004
1005
  ];
1005
1006
  }
1006
- }), Bt = E.create({
1007
+ }), Ce = S.create({
1007
1008
  name: "heading",
1008
1009
  group: "blockContent",
1009
1010
  content: "inline*",
@@ -1021,15 +1022,15 @@ const at = C.create({
1021
1022
  },
1022
1023
  addInputRules() {
1023
1024
  return [
1024
- ...["1", "2", "3"].map((o) => new Y({
1025
+ ...["1", "2", "3"].map((o) => new W({
1025
1026
  find: new RegExp(`^(#{${parseInt(o)}})\\s$`),
1026
- handler: ({ state: e, chain: t, range: n }) => {
1027
- t().BNUpdateBlock(e.selection.from, {
1027
+ handler: ({ state: t, chain: e, range: r }) => {
1028
+ e().BNUpdateBlock(t.selection.from, {
1028
1029
  type: "heading",
1029
1030
  props: {
1030
1031
  level: o
1031
1032
  }
1032
- }).deleteRange({ from: n.from, to: n.to });
1033
+ }).deleteRange({ from: r.from, to: r.to });
1033
1034
  }
1034
1035
  }))
1035
1036
  ];
@@ -1053,25 +1054,25 @@ const at = C.create({
1053
1054
  }
1054
1055
  ];
1055
1056
  },
1056
- renderHTML({ node: o, HTMLAttributes: e }) {
1057
+ renderHTML({ node: o, HTMLAttributes: t }) {
1057
1058
  return [
1058
1059
  "div",
1059
- x(e, {
1060
+ w(t, {
1060
1061
  class: b.blockContent,
1061
1062
  "data-content-type": this.name
1062
1063
  }),
1063
1064
  ["h" + o.attrs.level, 0]
1064
1065
  ];
1065
1066
  }
1066
- }), ge = (o) => {
1067
- const { node: e, contentType: t } = k(
1067
+ }), kt = (o) => {
1068
+ const { node: t, contentType: e } = g(
1068
1069
  o.state.doc,
1069
1070
  o.state.selection.from
1070
- ), n = o.state.selection.anchor === o.state.selection.head;
1071
- return !t.name.endsWith("ListItem") || !n ? !1 : o.commands.first(({ state: r, chain: i, commands: a }) => [
1071
+ ), r = o.state.selection.anchor === o.state.selection.head;
1072
+ return !e.name.endsWith("ListItem") || !r ? !1 : o.commands.first(({ state: n, chain: i, commands: a }) => [
1072
1073
  () => (
1073
1074
  // Changes list item block to a text block if the content is empty.
1074
- a.command(() => e.textContent.length === 0 ? a.BNUpdateBlock(r.selection.from, {
1075
+ a.command(() => t.textContent.length === 0 ? a.BNUpdateBlock(n.selection.from, {
1075
1076
  type: "paragraph",
1076
1077
  props: {}
1077
1078
  }) : !1)
@@ -1079,30 +1080,30 @@ const at = C.create({
1079
1080
  () => (
1080
1081
  // Splits the current block, moving content inside that's after the cursor to a new block of the same type
1081
1082
  // below.
1082
- a.command(() => e.textContent.length > 0 ? (i().deleteSelection().BNSplitBlock(r.selection.from, !0).run(), !0) : !1)
1083
+ a.command(() => t.textContent.length > 0 ? (i().deleteSelection().BNSplitBlock(n.selection.from, !0).run(), !0) : !1)
1083
1084
  )
1084
1085
  ]);
1085
- }, Tt = E.create({
1086
+ }, Me = S.create({
1086
1087
  name: "bulletListItem",
1087
1088
  group: "blockContent",
1088
1089
  content: "inline*",
1089
1090
  addInputRules() {
1090
1091
  return [
1091
1092
  // Creates an unordered list when starting with "-", "+", or "*".
1092
- new Y({
1093
+ new W({
1093
1094
  find: new RegExp("^[-+*]\\s$"),
1094
- handler: ({ state: o, chain: e, range: t }) => {
1095
- e().BNUpdateBlock(o.selection.from, {
1095
+ handler: ({ state: o, chain: t, range: e }) => {
1096
+ t().BNUpdateBlock(o.selection.from, {
1096
1097
  type: "bulletListItem",
1097
1098
  props: {}
1098
- }).deleteRange({ from: t.from, to: t.to });
1099
+ }).deleteRange({ from: e.from, to: e.to });
1099
1100
  }
1100
1101
  })
1101
1102
  ];
1102
1103
  },
1103
1104
  addKeyboardShortcuts() {
1104
1105
  return {
1105
- Enter: () => ge(this.editor)
1106
+ Enter: () => kt(this.editor)
1106
1107
  };
1107
1108
  },
1108
1109
  parseHTML() {
@@ -1113,8 +1114,8 @@ const at = C.create({
1113
1114
  getAttrs: (o) => {
1114
1115
  if (typeof o == "string")
1115
1116
  return !1;
1116
- const e = o.parentElement;
1117
- return e === null ? !1 : e.tagName === "UL" ? {} : !1;
1117
+ const t = o.parentElement;
1118
+ return t === null ? !1 : t.tagName === "UL" ? {} : !1;
1118
1119
  },
1119
1120
  node: "bulletListItem"
1120
1121
  },
@@ -1124,8 +1125,8 @@ const at = C.create({
1124
1125
  getAttrs: (o) => {
1125
1126
  if (typeof o == "string")
1126
1127
  return !1;
1127
- const e = o.parentElement;
1128
- return e === null ? !1 : e.getAttribute("data-content-type") === "bulletListItem" ? {} : !1;
1128
+ const t = o.parentElement;
1129
+ return t === null ? !1 : t.getAttribute("data-content-type") === "bulletListItem" ? {} : !1;
1129
1130
  },
1130
1131
  priority: 300,
1131
1132
  node: "bulletListItem"
@@ -1135,27 +1136,27 @@ const at = C.create({
1135
1136
  renderHTML({ HTMLAttributes: o }) {
1136
1137
  return [
1137
1138
  "div",
1138
- x(o, {
1139
+ w(o, {
1139
1140
  class: b.blockContent,
1140
1141
  "data-content-type": this.name
1141
1142
  }),
1142
1143
  ["p", 0]
1143
1144
  ];
1144
1145
  }
1145
- }), Mt = new v("numbered-list-indexing"), wt = () => new B({
1146
- key: Mt,
1147
- appendTransaction: (o, e, t) => {
1148
- const n = t.tr;
1149
- n.setMeta("numberedListIndexing", !0);
1150
- let r = !1;
1151
- return t.doc.descendants((i, a) => {
1146
+ }), Be = new v("numbered-list-indexing"), Te = () => new C({
1147
+ key: Be,
1148
+ appendTransaction: (o, t, e) => {
1149
+ const r = e.tr;
1150
+ r.setMeta("numberedListIndexing", !0);
1151
+ let n = !1;
1152
+ return e.doc.descendants((i, a) => {
1152
1153
  if (i.type.name === "blockContainer" && i.firstChild.type.name === "numberedListItem") {
1153
1154
  let s = "1";
1154
- const d = a === 1, l = k(n.doc, a + 1);
1155
+ const d = a === 1, l = g(r.doc, a + 1);
1155
1156
  if (l === void 0)
1156
1157
  return;
1157
1158
  if (!d) {
1158
- const f = k(n.doc, a - 2);
1159
+ const f = g(r.doc, a - 2);
1159
1160
  if (f === void 0)
1160
1161
  return;
1161
1162
  if (!(l.depth !== f.depth)) {
@@ -1166,13 +1167,13 @@ const at = C.create({
1166
1167
  }
1167
1168
  }
1168
1169
  }
1169
- l.contentNode.attrs.index !== s && (r = !0, n.setNodeMarkup(a + 1, void 0, {
1170
+ l.contentNode.attrs.index !== s && (n = !0, r.setNodeMarkup(a + 1, void 0, {
1170
1171
  index: s
1171
1172
  }));
1172
1173
  }
1173
- }), r ? n : null;
1174
+ }), n ? r : null;
1174
1175
  }
1175
- }), xt = E.create({
1176
+ }), we = S.create({
1176
1177
  name: "numberedListItem",
1177
1178
  group: "blockContent",
1178
1179
  content: "inline*",
@@ -1190,24 +1191,24 @@ const at = C.create({
1190
1191
  addInputRules() {
1191
1192
  return [
1192
1193
  // Creates an ordered list when starting with "1.".
1193
- new Y({
1194
+ new W({
1194
1195
  find: new RegExp("^1\\.\\s$"),
1195
- handler: ({ state: o, chain: e, range: t }) => {
1196
- e().BNUpdateBlock(o.selection.from, {
1196
+ handler: ({ state: o, chain: t, range: e }) => {
1197
+ t().BNUpdateBlock(o.selection.from, {
1197
1198
  type: "numberedListItem",
1198
1199
  props: {}
1199
- }).deleteRange({ from: t.from, to: t.to });
1200
+ }).deleteRange({ from: e.from, to: e.to });
1200
1201
  }
1201
1202
  })
1202
1203
  ];
1203
1204
  },
1204
1205
  addKeyboardShortcuts() {
1205
1206
  return {
1206
- Enter: () => ge(this.editor)
1207
+ Enter: () => kt(this.editor)
1207
1208
  };
1208
1209
  },
1209
1210
  addProseMirrorPlugins() {
1210
- return [wt()];
1211
+ return [Te()];
1211
1212
  },
1212
1213
  parseHTML() {
1213
1214
  return [
@@ -1218,8 +1219,8 @@ const at = C.create({
1218
1219
  getAttrs: (o) => {
1219
1220
  if (typeof o == "string")
1220
1221
  return !1;
1221
- const e = o.parentElement;
1222
- return e === null ? !1 : e.tagName === "OL" ? {} : !1;
1222
+ const t = o.parentElement;
1223
+ return t === null ? !1 : t.tagName === "OL" ? {} : !1;
1223
1224
  },
1224
1225
  node: "numberedListItem"
1225
1226
  },
@@ -1230,8 +1231,8 @@ const at = C.create({
1230
1231
  getAttrs: (o) => {
1231
1232
  if (typeof o == "string")
1232
1233
  return !1;
1233
- const e = o.parentElement;
1234
- return e === null ? !1 : e.getAttribute("data-content-type") === "numberedListItem" ? {} : !1;
1234
+ const t = o.parentElement;
1235
+ return t === null ? !1 : t.getAttribute("data-content-type") === "numberedListItem" ? {} : !1;
1235
1236
  },
1236
1237
  priority: 300,
1237
1238
  node: "numberedListItem"
@@ -1241,7 +1242,7 @@ const at = C.create({
1241
1242
  renderHTML({ HTMLAttributes: o }) {
1242
1243
  return [
1243
1244
  "div",
1244
- x(o, {
1245
+ w(o, {
1245
1246
  class: b.blockContent,
1246
1247
  "data-content-type": this.name
1247
1248
  }),
@@ -1250,24 +1251,24 @@ const at = C.create({
1250
1251
  ["p", 0]
1251
1252
  ];
1252
1253
  }
1253
- }), Et = [
1254
- Ct,
1255
- Bt,
1256
- Tt,
1257
- xt,
1258
- bt,
1259
- vt,
1260
- E.create({
1254
+ }), Se = [
1255
+ Ee,
1256
+ Ce,
1257
+ Me,
1258
+ we,
1259
+ be,
1260
+ ve,
1261
+ S.create({
1261
1262
  name: "doc",
1262
1263
  topNode: !0,
1263
1264
  content: "blockGroup"
1264
1265
  })
1265
- ], It = "_bnEditor_8k3n0_3", St = "_bnRoot_8k3n0_19", At = "_defaultStyles_8k3n0_34", Pt = "_dragPreview_8k3n0_57", _ = {
1266
- bnEditor: It,
1267
- bnRoot: St,
1268
- defaultStyles: At,
1269
- dragPreview: Pt
1270
- }, Nt = xe(
1266
+ ], xe = "_bnEditor_dbz5y_3", Ie = "_bnRoot_dbz5y_20", Pe = "_defaultStyles_dbz5y_35", Le = "_dragPreview_dbz5y_66", O = {
1267
+ bnEditor: xe,
1268
+ bnRoot: Ie,
1269
+ defaultStyles: Pe,
1270
+ dragPreview: Le
1271
+ }, Ae = wt(
1271
1272
  (o) => o.type.name === "blockContainer"
1272
1273
  );
1273
1274
  function q() {
@@ -1281,78 +1282,84 @@ function q() {
1281
1282
  decorationId: void 0
1282
1283
  };
1283
1284
  }
1284
- class Lt {
1285
+ class He {
1285
1286
  constructor({
1286
- editor: e,
1287
- pluginKey: t,
1288
- onSelectItem: n = () => {
1287
+ editor: t,
1288
+ pluginKey: e,
1289
+ onSelectItem: r = () => {
1289
1290
  },
1290
- suggestionsMenuFactory: r
1291
+ suggestionsMenuFactory: n
1291
1292
  }) {
1292
- h(this, "editor");
1293
- h(this, "pluginKey");
1294
- h(this, "suggestionsMenu");
1295
- h(this, "pluginState");
1296
- h(this, "itemCallback");
1297
- this.editor = e, this.pluginKey = t, this.pluginState = q(), this.itemCallback = (i) => {
1298
- e._tiptapEditor.chain().focus().deleteRange({
1293
+ u(this, "editor");
1294
+ u(this, "pluginKey");
1295
+ u(this, "suggestionsMenu");
1296
+ u(this, "pluginState");
1297
+ u(this, "itemCallback");
1298
+ u(this, "handleScroll", () => {
1299
+ this.pluginKey.getState(this.editor._tiptapEditor.state).active && this.suggestionsMenu.render(this.getDynamicParams(), !1);
1300
+ });
1301
+ this.editor = t, this.pluginKey = e, this.pluginState = q(), this.itemCallback = (i) => {
1302
+ t._tiptapEditor.chain().focus().deleteRange({
1299
1303
  from: this.pluginState.queryStartPos - this.pluginState.triggerCharacter.length,
1300
- to: e._tiptapEditor.state.selection.from
1301
- }).run(), n({
1304
+ to: t._tiptapEditor.state.selection.from
1305
+ }).run(), r({
1302
1306
  item: i,
1303
- editor: e
1307
+ editor: t
1304
1308
  });
1305
- }, this.suggestionsMenu = r(this.getStaticParams());
1309
+ }, this.suggestionsMenu = n(this.getStaticParams()), document.addEventListener("scroll", this.handleScroll);
1306
1310
  }
1307
- update(e, t) {
1308
- const n = this.pluginKey.getState(t), r = this.pluginKey.getState(e.state), i = !n.active && r.active, a = n.active && !r.active, s = n.active && r.active;
1309
- !i && !s && !a || (this.pluginState = a ? n : r, a && (this.suggestionsMenu.hide(), this.suggestionsMenu.element.removeEventListener(
1311
+ update(t, e) {
1312
+ const r = this.pluginKey.getState(e), n = this.pluginKey.getState(t.state), i = !r.active && n.active, a = r.active && !n.active, s = r.active && n.active;
1313
+ !i && !s && !a || (this.pluginState = a ? r : n, (a || !this.editor.isEditable) && (this.suggestionsMenu.hide(), this.suggestionsMenu.element.removeEventListener(
1310
1314
  "mousedown",
1311
1315
  (d) => d.preventDefault()
1312
- )), s && this.suggestionsMenu.render(this.getDynamicParams(), !1), i && (this.suggestionsMenu.render(this.getDynamicParams(), !0), this.suggestionsMenu.element.addEventListener(
1316
+ )), s && this.suggestionsMenu.render(this.getDynamicParams(), !1), i && this.editor.isEditable && (this.suggestionsMenu.render(this.getDynamicParams(), !0), this.suggestionsMenu.element.addEventListener(
1313
1317
  "mousedown",
1314
1318
  (d) => d.preventDefault()
1315
1319
  )));
1316
1320
  }
1321
+ destroy() {
1322
+ document.removeEventListener("scroll", this.handleScroll);
1323
+ }
1317
1324
  getStaticParams() {
1318
1325
  return {
1319
- itemCallback: (e) => this.itemCallback(e)
1326
+ itemCallback: (t) => this.itemCallback(t)
1320
1327
  };
1321
1328
  }
1322
1329
  getDynamicParams() {
1323
- const e = document.querySelector(
1330
+ const t = document.querySelector(
1324
1331
  `[data-decoration-id="${this.pluginState.decorationId}"]`
1325
1332
  );
1326
1333
  return {
1327
1334
  items: this.pluginState.items,
1328
1335
  keyboardHoveredItemIndex: this.pluginState.keyboardHoveredItemIndex,
1329
- referenceRect: e.getBoundingClientRect()
1336
+ referenceRect: t.getBoundingClientRect()
1330
1337
  };
1331
1338
  }
1332
1339
  }
1333
- function Ht({
1340
+ function Ne({
1334
1341
  pluginKey: o,
1335
- editor: e,
1336
- defaultTriggerCharacter: t,
1337
- suggestionsMenuFactory: n,
1338
- onSelectItem: r = () => {
1342
+ editor: t,
1343
+ defaultTriggerCharacter: e,
1344
+ suggestionsMenuFactory: r,
1345
+ onSelectItem: n = () => {
1339
1346
  },
1340
1347
  items: i = () => []
1341
1348
  }) {
1342
- if (t.length !== 1)
1349
+ if (e.length !== 1)
1343
1350
  throw new Error("'char' should be a single character");
1344
1351
  const a = (s) => {
1345
1352
  s.dispatch(s.state.tr.setMeta(o, { deactivate: !0 }));
1346
1353
  };
1347
- return new B({
1354
+ return new C({
1348
1355
  key: o,
1349
- view: (s) => new Lt({
1350
- editor: e,
1356
+ view: (s) => new He({
1357
+ editor: t,
1351
1358
  pluginKey: o,
1352
1359
  onSelectItem: (d) => {
1353
- a(s), r(d);
1360
+ a(s), n(d);
1354
1361
  },
1355
- suggestionsMenuFactory: n
1362
+ suggestionsMenuFactory: r
1356
1363
  }),
1357
1364
  state: {
1358
1365
  // Initialize the plugin's internal state.
@@ -1378,10 +1385,10 @@ function Ht({
1378
1385
  };
1379
1386
  if (!d.active)
1380
1387
  return d;
1381
- const u = { ...d };
1382
- if (u.items = i(
1388
+ const h = { ...d };
1389
+ if (h.items = i(
1383
1390
  c.doc.textBetween(d.queryStartPos, c.selection.from)
1384
- ), u.notFoundCount = 0, u.items.length === 0 && (u.notFoundCount = Math.max(
1391
+ ), h.notFoundCount = 0, h.items.length === 0 && (h.notFoundCount = Math.max(
1385
1392
  0,
1386
1393
  d.notFoundCount + (c.selection.from - l.selection.from)
1387
1394
  )), // Highlighting text should hide the menu.
@@ -1391,30 +1398,30 @@ function Ht({
1391
1398
  s.getMeta("focus") || s.getMeta("blur") || s.getMeta("pointer") || // Moving the caret before the character which triggered the menu should hide it.
1392
1399
  d.active && c.selection.from < d.queryStartPos || // Entering more than 3 characters, after the last query that matched with at least 1 menu item, should hide
1393
1400
  // the menu.
1394
- u.notFoundCount > 3)
1401
+ h.notFoundCount > 3)
1395
1402
  return q();
1396
1403
  if (((y = s.getMeta(o)) == null ? void 0 : y.selectedItemIndexChanged) !== void 0) {
1397
- let g = s.getMeta(o).selectedItemIndexChanged;
1398
- g < 0 ? g = d.items.length - 1 : g >= d.items.length && (g = 0), u.keyboardHoveredItemIndex = g;
1404
+ let k = s.getMeta(o).selectedItemIndexChanged;
1405
+ k < 0 ? k = d.items.length - 1 : k >= d.items.length && (k = 0), h.keyboardHoveredItemIndex = k;
1399
1406
  }
1400
- return u;
1407
+ return h;
1401
1408
  }
1402
1409
  },
1403
1410
  props: {
1404
1411
  handleKeyDown(s, d) {
1405
1412
  const l = this.getState(s.state).active;
1406
- if (d.key === t && !l)
1413
+ if (d.key === e && !l)
1407
1414
  return s.dispatch(
1408
- s.state.tr.insertText(t).scrollIntoView().setMeta(o, {
1415
+ s.state.tr.insertText(e).scrollIntoView().setMeta(o, {
1409
1416
  activate: !0,
1410
- triggerCharacter: t
1417
+ triggerCharacter: e
1411
1418
  })
1412
1419
  ), !0;
1413
1420
  if (!l)
1414
1421
  return !1;
1415
1422
  const {
1416
1423
  triggerCharacter: c,
1417
- queryStartPos: u,
1424
+ queryStartPos: h,
1418
1425
  items: f,
1419
1426
  keyboardHoveredItemIndex: p
1420
1427
  } = o.getState(s.state);
@@ -1426,12 +1433,12 @@ function Ht({
1426
1433
  s.state.tr.setMeta(o, {
1427
1434
  selectedItemIndexChanged: p + 1
1428
1435
  })
1429
- ), !0) : d.key === "Enter" ? (a(s), e._tiptapEditor.chain().focus().deleteRange({
1430
- from: u - c.length,
1431
- to: e._tiptapEditor.state.selection.from
1432
- }).run(), r({
1436
+ ), !0) : d.key === "Enter" ? (a(s), t._tiptapEditor.chain().focus().deleteRange({
1437
+ from: h - c.length,
1438
+ to: t._tiptapEditor.state.selection.from
1439
+ }).run(), n({
1433
1440
  item: f[p],
1434
- editor: e
1441
+ editor: t
1435
1442
  }), !0) : d.key === "Escape" ? (a(s), !0) : !1;
1436
1443
  },
1437
1444
  // Hides menu in cases where mouse click does not cause an editor state change.
@@ -1440,11 +1447,11 @@ function Ht({
1440
1447
  },
1441
1448
  // Setup decorator on the currently active suggestion.
1442
1449
  decorations(s) {
1443
- const { active: d, decorationId: l, queryStartPos: c, triggerCharacter: u } = this.getState(s);
1450
+ const { active: d, decorationId: l, queryStartPos: c, triggerCharacter: h } = this.getState(s);
1444
1451
  if (!d)
1445
1452
  return null;
1446
- if (u === "") {
1447
- const f = Nt(s.selection);
1453
+ if (h === "") {
1454
+ const f = Ae(s.selection);
1448
1455
  if (f)
1449
1456
  return F.create(s.doc, [
1450
1457
  D.node(
@@ -1460,7 +1467,7 @@ function Ht({
1460
1467
  }
1461
1468
  return F.create(s.doc, [
1462
1469
  D.inline(
1463
- c - u.length,
1470
+ c - h.length,
1464
1471
  c,
1465
1472
  {
1466
1473
  nodeName: "span",
@@ -1473,7 +1480,7 @@ function Ht({
1473
1480
  }
1474
1481
  });
1475
1482
  }
1476
- const K = new v("suggestions-slash-commands"), Ot = C.create({
1483
+ const V = new v("suggestions-slash-commands"), _e = E.create({
1477
1484
  name: "slash-command",
1478
1485
  addOptions() {
1479
1486
  return {
@@ -1487,162 +1494,172 @@ const K = new v("suggestions-slash-commands"), Ot = C.create({
1487
1494
  throw new Error("required args not defined for SlashMenuExtension");
1488
1495
  const o = this.options.commands;
1489
1496
  return [
1490
- Ht({
1491
- pluginKey: K,
1497
+ Ne({
1498
+ pluginKey: V,
1492
1499
  editor: this.options.editor,
1493
1500
  defaultTriggerCharacter: "/",
1494
1501
  suggestionsMenuFactory: this.options.slashMenuFactory,
1495
- items: (e) => o.filter((t) => t.match(e)),
1496
- onSelectItem: ({ item: e, editor: t }) => {
1497
- e.execute(t);
1502
+ items: (t) => o.filter((e) => e.match(t)),
1503
+ onSelectItem: ({ item: t, editor: e }) => {
1504
+ t.execute(e);
1498
1505
  }
1499
1506
  })
1500
1507
  ];
1501
1508
  }
1502
1509
  });
1503
- class L extends G {
1504
- constructor(t, n) {
1505
- super(t, n);
1506
- h(this, "nodes");
1507
- const r = t.node();
1508
- this.nodes = [], t.doc.nodesBetween(t.pos, n.pos, (i, a, s) => {
1509
- if (s !== null && s.eq(r))
1510
+ class A extends G {
1511
+ constructor(e, r) {
1512
+ super(e, r);
1513
+ u(this, "nodes");
1514
+ const n = e.node();
1515
+ this.nodes = [], e.doc.nodesBetween(e.pos, r.pos, (i, a, s) => {
1516
+ if (s !== null && s.eq(n))
1510
1517
  return this.nodes.push(i), !1;
1511
1518
  });
1512
1519
  }
1513
- static create(t, n, r = n) {
1514
- return new L(t.resolve(n), t.resolve(r));
1520
+ static create(e, r, n = r) {
1521
+ return new A(e.resolve(r), e.resolve(n));
1515
1522
  }
1516
1523
  content() {
1517
- return new A(P.from(this.nodes), 0, 0);
1524
+ return new P(L.from(this.nodes), 0, 0);
1518
1525
  }
1519
- eq(t) {
1520
- if (!(t instanceof L) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to)
1526
+ eq(e) {
1527
+ if (!(e instanceof A) || this.nodes.length !== e.nodes.length || this.from !== e.from || this.to !== e.to)
1521
1528
  return !1;
1522
- for (let n = 0; n < this.nodes.length; n++)
1523
- if (!this.nodes[n].eq(t.nodes[n]))
1529
+ for (let r = 0; r < this.nodes.length; r++)
1530
+ if (!this.nodes[r].eq(e.nodes[r]))
1524
1531
  return !1;
1525
1532
  return !0;
1526
1533
  }
1527
- map(t, n) {
1528
- let r = n.mapResult(this.from), i = n.mapResult(this.to);
1529
- return i.deleted ? G.near(t.resolve(r.pos)) : r.deleted ? G.near(t.resolve(i.pos)) : new L(
1530
- t.resolve(r.pos),
1531
- t.resolve(i.pos)
1534
+ map(e, r) {
1535
+ let n = r.mapResult(this.from), i = r.mapResult(this.to);
1536
+ return i.deleted ? G.near(e.resolve(n.pos)) : n.deleted ? G.near(e.resolve(i.pos)) : new A(
1537
+ e.resolve(n.pos),
1538
+ e.resolve(i.pos)
1532
1539
  );
1533
1540
  }
1534
1541
  toJSON() {
1535
1542
  return { type: "node", anchor: this.anchor, head: this.head };
1536
1543
  }
1537
1544
  }
1538
- const _t = Ve.__serializeForClipboard;
1539
- let M;
1540
- function ye(o, e) {
1541
- var r;
1542
- if (!e.dom.isConnected)
1545
+ const Oe = Kt.__serializeForClipboard;
1546
+ let T;
1547
+ function yt(o, t) {
1548
+ var n;
1549
+ if (!t.dom.isConnected)
1543
1550
  return;
1544
- let t = e.posAtCoords(o);
1545
- if (!t)
1551
+ let e = t.posAtCoords(o);
1552
+ if (!e)
1546
1553
  return;
1547
- let n = e.domAtPos(t.pos).node;
1548
- if (n !== e.dom) {
1549
- for (; n && n.parentNode && n.parentNode !== e.dom && !((r = n.hasAttribute) != null && r.call(n, "data-id")); )
1550
- n = n.parentNode;
1551
- if (n)
1552
- return { node: n, id: n.getAttribute("data-id") };
1554
+ let r = t.domAtPos(e.pos).node;
1555
+ if (r !== t.dom) {
1556
+ for (; r && r.parentNode && r.parentNode !== t.dom && !((n = r.hasAttribute) != null && n.call(r, "data-id")); )
1557
+ r = r.parentNode;
1558
+ if (r)
1559
+ return { node: r, id: r.getAttribute("data-id") };
1553
1560
  }
1554
1561
  }
1555
- function Dt(o, e) {
1556
- let t = ye(o, e);
1557
- if (t && t.node.nodeType === 1) {
1558
- const n = e.docView;
1559
- let r = n.nearestDesc(t.node, !0);
1560
- return !r || r === n ? null : r.posBefore;
1562
+ function De(o, t) {
1563
+ let e = yt(o, t);
1564
+ if (e && e.node.nodeType === 1) {
1565
+ const r = t.docView;
1566
+ let n = r.nearestDesc(e.node, !0);
1567
+ return !n || n === r ? null : n.posBefore;
1561
1568
  }
1562
1569
  return null;
1563
1570
  }
1564
- function Ft(o, e) {
1565
- let t, n;
1566
- const r = e.resolve(o.from).node().type.spec.group === "blockContent", i = e.resolve(o.to).node().type.spec.group === "blockContent", a = Math.min(o.$anchor.depth, o.$head.depth);
1567
- if (r && i) {
1571
+ function Fe(o, t) {
1572
+ let e, r;
1573
+ const n = t.resolve(o.from).node().type.spec.group === "blockContent", i = t.resolve(o.to).node().type.spec.group === "blockContent", a = Math.min(o.$anchor.depth, o.$head.depth);
1574
+ if (n && i) {
1568
1575
  const s = o.$from.start(a - 1), d = o.$to.end(a - 1);
1569
- t = e.resolve(s - 1).pos, n = e.resolve(d + 1).pos;
1576
+ e = t.resolve(s - 1).pos, r = t.resolve(d + 1).pos;
1570
1577
  } else
1571
- t = o.from, n = o.to;
1572
- return { from: t, to: n };
1578
+ e = o.from, r = o.to;
1579
+ return { from: e, to: r };
1573
1580
  }
1574
- function oe(o, e, t = e) {
1575
- e === t && (t += o.state.doc.resolve(e + 1).node().nodeSize);
1576
- const n = o.domAtPos(e).node.cloneNode(!0), r = o.domAtPos(e).node, i = (c, u) => Array.prototype.indexOf.call(c.children, u), a = i(
1577
- r,
1581
+ function ot(o, t, e = t) {
1582
+ t === e && (e += o.state.doc.resolve(t + 1).node().nodeSize);
1583
+ const r = o.domAtPos(t).node.cloneNode(!0), n = o.domAtPos(t).node, i = (c, h) => Array.prototype.indexOf.call(c.children, h), a = i(
1584
+ n,
1578
1585
  // Expects from position to be just before the first selected block.
1579
- o.domAtPos(e + 1).node.parentElement
1586
+ o.domAtPos(t + 1).node.parentElement
1580
1587
  ), s = i(
1581
- r,
1588
+ n,
1582
1589
  // Expects to position to be just after the last selected block.
1583
- o.domAtPos(t - 1).node.parentElement
1590
+ o.domAtPos(e - 1).node.parentElement
1584
1591
  );
1585
- for (let c = r.childElementCount - 1; c >= 0; c--)
1586
- (c > s || c < a) && n.removeChild(n.children[c]);
1587
- be(), M = n;
1592
+ for (let c = n.childElementCount - 1; c >= 0; c--)
1593
+ (c > s || c < a) && r.removeChild(r.children[c]);
1594
+ bt(), T = r;
1588
1595
  const l = o.dom.className.split(" ").filter(
1589
1596
  (c) => !c.includes("bn") && !c.includes("ProseMirror") && !c.includes("editor")
1590
1597
  ).join(" ");
1591
- M.className = M.className + " " + _.dragPreview + " " + l, document.body.appendChild(M);
1598
+ T.className = T.className + " " + O.dragPreview + " " + l, document.body.appendChild(T);
1592
1599
  }
1593
- function be() {
1594
- M !== void 0 && (document.body.removeChild(M), M = void 0);
1600
+ function bt() {
1601
+ T !== void 0 && (document.body.removeChild(T), T = void 0);
1595
1602
  }
1596
- function Rt(o, e) {
1603
+ function Re(o, t) {
1597
1604
  if (!o.dataTransfer)
1598
1605
  return;
1599
- const t = e.dom.getBoundingClientRect();
1600
- let n = {
1601
- left: t.left + t.width / 2,
1606
+ const e = t.dom.getBoundingClientRect();
1607
+ let r = {
1608
+ left: e.left + e.width / 2,
1602
1609
  // take middle of editor
1603
1610
  top: o.clientY
1604
- }, r = Dt(n, e);
1605
- if (r != null) {
1606
- const i = e.state.selection, a = e.state.doc, { from: s, to: d } = Ft(i, a), l = s <= r && r < d, c = !i.$anchor.node().eq(i.$head.node());
1607
- l && c ? (e.dispatch(
1608
- e.state.tr.setSelection(L.create(a, s, d))
1609
- ), oe(e, s, d)) : (e.dispatch(
1610
- e.state.tr.setSelection(Ne.create(e.state.doc, r))
1611
- ), oe(e, r));
1612
- let u = e.state.selection.content(), { dom: f, text: p } = _t(e, u);
1613
- o.dataTransfer.clearData(), o.dataTransfer.setData("text/html", f.innerHTML), o.dataTransfer.setData("text/plain", p), o.dataTransfer.effectAllowed = "move", o.dataTransfer.setDragImage(M, 0, 0), e.dragging = { slice: u, move: !0 };
1611
+ }, n = De(r, t);
1612
+ if (n != null) {
1613
+ const i = t.state.selection, a = t.state.doc, { from: s, to: d } = Fe(i, a), l = s <= n && n < d, c = i.$anchor.node() !== i.$head.node() || i instanceof A;
1614
+ l && c ? (t.dispatch(
1615
+ t.state.tr.setSelection(A.create(a, s, d))
1616
+ ), ot(t, s, d)) : (t.dispatch(
1617
+ t.state.tr.setSelection(At.create(t.state.doc, n))
1618
+ ), ot(t, n));
1619
+ let h = t.state.selection.content(), { dom: f, text: p } = Oe(t, h);
1620
+ o.dataTransfer.clearData(), o.dataTransfer.setData("text/html", f.innerHTML), o.dataTransfer.setData("text/plain", p), o.dataTransfer.effectAllowed = "move", o.dataTransfer.setDragImage(T, 0, 0), t.dragging = { slice: h, move: !0 };
1614
1621
  }
1615
1622
  }
1616
- class zt {
1623
+ class ze {
1617
1624
  constructor({
1625
+ tiptapEditor: t,
1618
1626
  editor: e,
1619
- blockMenuFactory: t,
1627
+ blockMenuFactory: r,
1620
1628
  horizontalPosAnchoredAtRoot: n
1621
1629
  }) {
1622
- h(this, "editor");
1630
+ u(this, "editor");
1631
+ u(this, "ttEditor");
1623
1632
  // When true, the drag handle with be anchored at the same level as root elements
1624
1633
  // When false, the drag handle with be just to the left of the element
1625
- h(this, "horizontalPosAnchoredAtRoot");
1626
- h(this, "horizontalPosAnchor");
1627
- h(this, "blockMenu");
1628
- h(this, "hoveredBlockContent");
1629
- h(this, "menuOpen", !1);
1630
- h(this, "menuFrozen", !1);
1634
+ u(this, "horizontalPosAnchoredAtRoot");
1635
+ u(this, "horizontalPosAnchor");
1636
+ u(this, "blockMenu");
1637
+ u(this, "hoveredBlock");
1638
+ // Used to check if currently dragged content comes from this editor instance.
1639
+ u(this, "isDragging", !1);
1640
+ u(this, "menuOpen", !1);
1641
+ u(this, "menuFrozen", !1);
1631
1642
  /**
1632
- * If the event is outside of the editor contents,
1643
+ * Sets isDragging when dragging text.
1644
+ */
1645
+ u(this, "onDragStart", () => {
1646
+ this.isDragging = !0;
1647
+ });
1648
+ /**
1649
+ * If the event is outside the editor contents,
1633
1650
  * we dispatch a fake event, so that we can still drop the content
1634
1651
  * when dragging / dropping to the side of the editor
1635
1652
  */
1636
- h(this, "onDrop", (e) => {
1637
- if (e.synthetic)
1653
+ u(this, "onDrop", (t) => {
1654
+ if (t.synthetic || !this.isDragging)
1638
1655
  return;
1639
- let t = this.editor.view.posAtCoords({
1640
- left: e.clientX,
1641
- top: e.clientY
1656
+ let e = this.ttEditor.view.posAtCoords({
1657
+ left: t.clientX,
1658
+ top: t.clientY
1642
1659
  });
1643
- if (!t || t.inside === -1) {
1644
- const n = new Event("drop", e), r = this.editor.view.dom.firstChild.getBoundingClientRect();
1645
- n.clientX = r.left + r.width / 2, n.clientY = e.clientY, n.dataTransfer = e.dataTransfer, n.preventDefault = () => e.preventDefault(), n.synthetic = !0, this.editor.view.dom.dispatchEvent(n);
1660
+ if (this.isDragging = !1, !e || e.inside === -1) {
1661
+ const r = new Event("drop", t), n = this.ttEditor.view.dom.firstChild.getBoundingClientRect();
1662
+ r.clientX = n.left + n.width / 2, r.clientY = t.clientY, r.dataTransfer = t.dataTransfer, r.preventDefault = () => t.preventDefault(), r.synthetic = !0, this.ttEditor.view.dom.dispatchEvent(r);
1646
1663
  }
1647
1664
  });
1648
1665
  /**
@@ -1650,120 +1667,95 @@ class zt {
1650
1667
  * we dispatch a fake event, so that we can still drop the content
1651
1668
  * when dragging / dropping to the side of the editor
1652
1669
  */
1653
- h(this, "onDragOver", (e) => {
1654
- if (e.synthetic)
1670
+ u(this, "onDragOver", (t) => {
1671
+ if (t.synthetic || !this.isDragging)
1655
1672
  return;
1656
- let t = this.editor.view.posAtCoords({
1657
- left: e.clientX,
1658
- top: e.clientY
1673
+ let e = this.ttEditor.view.posAtCoords({
1674
+ left: t.clientX,
1675
+ top: t.clientY
1659
1676
  });
1660
- if (!t || t.inside === -1) {
1661
- const n = new Event("dragover", e), r = this.editor.view.dom.firstChild.getBoundingClientRect();
1662
- n.clientX = r.left + r.width / 2, n.clientY = e.clientY, n.dataTransfer = e.dataTransfer, n.preventDefault = () => e.preventDefault(), n.synthetic = !0, this.editor.view.dom.dispatchEvent(n);
1677
+ if (!e || e.inside === -1) {
1678
+ const r = new Event("dragover", t), n = this.ttEditor.view.dom.firstChild.getBoundingClientRect();
1679
+ r.clientX = n.left + n.width / 2, r.clientY = t.clientY, r.dataTransfer = t.dataTransfer, r.preventDefault = () => t.preventDefault(), r.synthetic = !0, this.ttEditor.view.dom.dispatchEvent(r);
1663
1680
  }
1664
1681
  });
1665
- h(this, "onKeyDown", (e) => {
1682
+ u(this, "onKeyDown", (t) => {
1666
1683
  this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide()), this.menuFrozen = !1;
1667
1684
  });
1668
- h(this, "onMouseDown", (e) => {
1669
- var t;
1670
- (t = this.blockMenu.element) != null && t.contains(e.target) || (this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide()), this.menuFrozen = !1);
1685
+ u(this, "onMouseDown", (t) => {
1686
+ var e;
1687
+ (e = this.blockMenu.element) != null && e.contains(t.target) || (this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide()), this.menuFrozen = !1);
1671
1688
  });
1672
- h(this, "onMouseMove", (e) => {
1689
+ u(this, "onMouseMove", (t) => {
1673
1690
  var a, s;
1674
1691
  if (this.menuFrozen)
1675
1692
  return;
1676
- const t = this.editor.view.dom.firstChild.getBoundingClientRect();
1677
- this.horizontalPosAnchor = t.x;
1678
- const n = {
1679
- left: t.left + t.width / 2,
1693
+ const e = this.ttEditor.view.dom.firstChild.getBoundingClientRect();
1694
+ this.horizontalPosAnchor = e.x;
1695
+ const r = {
1696
+ left: e.left + e.width / 2,
1680
1697
  // take middle of editor
1681
- top: e.clientY
1682
- }, r = ye(n, this.editor.view);
1683
- if (!r) {
1698
+ top: t.clientY
1699
+ }, n = yt(r, this.ttEditor.view);
1700
+ if (!n || !this.editor.isEditable) {
1684
1701
  this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide());
1685
1702
  return;
1686
1703
  }
1687
- if (this.menuOpen && ((a = this.hoveredBlockContent) != null && a.hasAttribute("data-id")) && ((s = this.hoveredBlockContent) == null ? void 0 : s.getAttribute("data-id")) === r.id)
1688
- return;
1689
- const i = r.node.firstChild;
1690
- this.hoveredBlockContent = i, i && (this.menuOpen ? this.blockMenu.render(this.getDynamicParams(), !1) : (this.menuOpen = !0, this.blockMenu.render(this.getDynamicParams(), !0)));
1704
+ this.menuOpen && ((a = this.hoveredBlock) != null && a.hasAttribute("data-id")) && ((s = this.hoveredBlock) == null ? void 0 : s.getAttribute("data-id")) === n.id || (this.hoveredBlock = n.node, !n.node.firstChild) || this.editor.isEditable && (this.menuOpen ? this.blockMenu.render(this.getDynamicParams(), !1) : (this.menuOpen = !0, this.blockMenu.render(this.getDynamicParams(), !0)));
1691
1705
  });
1692
- this.editor = e, this.horizontalPosAnchoredAtRoot = n, this.horizontalPosAnchor = e.view.dom.firstChild.getBoundingClientRect().x, this.blockMenu = t(this.getStaticParams()), document.body.addEventListener("drop", this.onDrop, !0), document.body.addEventListener("dragover", this.onDragOver), document.body.addEventListener("mousemove", this.onMouseMove, !0), document.body.addEventListener("mousedown", this.onMouseDown, !0), document.body.addEventListener("keydown", this.onKeyDown, !0);
1706
+ u(this, "onScroll", () => {
1707
+ this.menuOpen && this.blockMenu.render(this.getDynamicParams(), !1);
1708
+ });
1709
+ this.editor = e, this.ttEditor = t, this.horizontalPosAnchoredAtRoot = n, this.horizontalPosAnchor = this.ttEditor.view.dom.firstChild.getBoundingClientRect().x, this.blockMenu = r(this.getStaticParams()), document.body.addEventListener("drop", this.onDrop, !0), document.body.addEventListener("dragover", this.onDragOver), this.ttEditor.view.dom.addEventListener("dragstart", this.onDragStart), document.body.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("scroll", this.onScroll), document.body.addEventListener("mousedown", this.onMouseDown, !0), document.body.addEventListener("keydown", this.onKeyDown, !0);
1693
1710
  }
1694
1711
  destroy() {
1695
- this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide()), document.body.removeEventListener("mousemove", this.onMouseMove), document.body.removeEventListener("dragover", this.onDragOver), document.body.removeEventListener("drop", this.onDrop), document.body.removeEventListener("mousedown", this.onMouseDown), document.body.removeEventListener("keydown", this.onKeyDown);
1712
+ this.menuOpen && (this.menuOpen = !1, this.blockMenu.hide()), document.body.removeEventListener("mousemove", this.onMouseMove), document.body.removeEventListener("dragover", this.onDragOver), this.ttEditor.view.dom.removeEventListener("dragstart", this.onDragStart), document.body.removeEventListener("drop", this.onDrop), document.body.removeEventListener("mousedown", this.onMouseDown), document.removeEventListener("scroll", this.onScroll), document.body.removeEventListener("keydown", this.onKeyDown);
1696
1713
  }
1697
1714
  addBlock() {
1698
1715
  this.menuOpen = !1, this.menuFrozen = !0, this.blockMenu.hide();
1699
- const e = this.hoveredBlockContent.getBoundingClientRect(), t = this.editor.view.posAtCoords({
1716
+ const e = this.hoveredBlock.firstChild.getBoundingClientRect(), r = this.ttEditor.view.posAtCoords({
1700
1717
  left: e.left + e.width / 2,
1701
1718
  top: e.top + e.height / 2
1702
1719
  });
1703
- if (!t)
1720
+ if (!r)
1704
1721
  return;
1705
- const n = k(this.editor.state.doc, t.pos);
1722
+ const n = g(this.ttEditor.state.doc, r.pos);
1706
1723
  if (n === void 0)
1707
1724
  return;
1708
- const { contentNode: r, endPos: i } = n;
1709
- if (r.textContent.length !== 0) {
1710
- const a = i + 1, s = a + 2;
1711
- this.editor.chain().BNCreateBlock(a).BNUpdateBlock(s, { type: "paragraph", props: {} }).setTextSelection(s).run();
1725
+ const { contentNode: i, endPos: a } = n;
1726
+ if (i.textContent.length !== 0) {
1727
+ const s = a + 1, d = s + 2;
1728
+ this.ttEditor.chain().BNCreateBlock(s).BNUpdateBlock(d, { type: "paragraph", props: {} }).setTextSelection(d).run();
1712
1729
  } else
1713
- this.editor.commands.setTextSelection(i);
1714
- this.editor.view.focus(), this.editor.view.dispatch(
1715
- this.editor.view.state.tr.scrollIntoView().setMeta(K, {
1730
+ this.ttEditor.commands.setTextSelection(a);
1731
+ this.ttEditor.view.focus(), this.ttEditor.view.dispatch(
1732
+ this.ttEditor.view.state.tr.scrollIntoView().setMeta(V, {
1716
1733
  // TODO import suggestion plugin key
1717
1734
  activate: !0,
1718
1735
  type: "drag"
1719
1736
  })
1720
1737
  );
1721
1738
  }
1722
- deleteBlock() {
1723
- this.menuOpen = !1, this.blockMenu.hide();
1724
- const e = this.hoveredBlockContent.getBoundingClientRect(), t = this.editor.view.posAtCoords({
1725
- left: e.left + e.width / 2,
1726
- top: e.top + e.height / 2
1727
- });
1728
- t && this.editor.commands.BNDeleteBlock(t.pos);
1729
- }
1730
- setBlockBackgroundColor(e) {
1731
- this.menuOpen = !1, this.blockMenu.hide();
1732
- const t = this.hoveredBlockContent.getBoundingClientRect(), n = this.editor.view.posAtCoords({
1733
- left: t.left + t.width / 2,
1734
- top: t.top + t.height / 2
1735
- });
1736
- n && this.editor.commands.setBlockBackgroundColor(n.pos, e);
1737
- }
1738
- setBlockTextColor(e) {
1739
- this.menuOpen = !1, this.blockMenu.hide();
1740
- const t = this.hoveredBlockContent.getBoundingClientRect(), n = this.editor.view.posAtCoords({
1741
- left: t.left + t.width / 2,
1742
- top: t.top + t.height / 2
1743
- });
1744
- n && this.editor.commands.setBlockTextColor(n.pos, e);
1745
- }
1746
1739
  getStaticParams() {
1747
1740
  return {
1741
+ editor: this.editor,
1748
1742
  addBlock: () => this.addBlock(),
1749
- deleteBlock: () => this.deleteBlock(),
1750
- blockDragStart: (e) => Rt(e, this.editor.view),
1751
- blockDragEnd: () => be(),
1743
+ blockDragStart: (t) => {
1744
+ this.isDragging = !0, Re(t, this.ttEditor.view);
1745
+ },
1746
+ blockDragEnd: () => bt(),
1752
1747
  freezeMenu: () => {
1753
1748
  this.menuFrozen = !0;
1754
1749
  },
1755
1750
  unfreezeMenu: () => {
1756
1751
  this.menuFrozen = !1;
1757
- },
1758
- setBlockBackgroundColor: (e) => this.setBlockBackgroundColor(e),
1759
- setBlockTextColor: (e) => this.setBlockTextColor(e)
1752
+ }
1760
1753
  };
1761
1754
  }
1762
1755
  getDynamicParams() {
1763
- const e = this.hoveredBlockContent.getBoundingClientRect();
1756
+ const e = this.hoveredBlock.firstChild.getBoundingClientRect();
1764
1757
  return {
1765
- blockBackgroundColor: this.editor.getAttributes("blockContainer").backgroundColor,
1766
- blockTextColor: this.editor.getAttributes("blockContainer").textColor,
1758
+ block: this.editor.getBlock(this.hoveredBlock.getAttribute("data-id")),
1767
1759
  referenceRect: new DOMRect(
1768
1760
  this.horizontalPosAnchoredAtRoot ? this.horizontalPosAnchor : e.x,
1769
1761
  e.y,
@@ -1773,14 +1765,15 @@ class zt {
1773
1765
  };
1774
1766
  }
1775
1767
  }
1776
- const Ut = (o) => new B({
1768
+ const Ue = (o) => new C({
1777
1769
  key: new v("DraggableBlocksPlugin"),
1778
- view: () => new zt({
1770
+ view: () => new ze({
1771
+ tiptapEditor: o.tiptapEditor,
1779
1772
  editor: o.editor,
1780
1773
  blockMenuFactory: o.blockSideMenuFactory,
1781
1774
  horizontalPosAnchoredAtRoot: !0
1782
1775
  })
1783
- }), Gt = C.create({
1776
+ }), Ge = E.create({
1784
1777
  name: "DraggableBlocksExtension",
1785
1778
  priority: 1e3,
1786
1779
  // Need to be high, in order to hide menu when typing slash
@@ -1790,79 +1783,87 @@ const Ut = (o) => new B({
1790
1783
  "UI Element factory not defined for DraggableBlocksExtension"
1791
1784
  );
1792
1785
  return [
1793
- Ut({
1794
- editor: this.editor,
1786
+ Ue({
1787
+ tiptapEditor: this.editor,
1788
+ editor: this.options.editor,
1795
1789
  blockSideMenuFactory: this.options.blockSideMenuFactory
1796
1790
  })
1797
1791
  ];
1798
1792
  }
1799
1793
  });
1800
- class $t {
1794
+ class $e {
1801
1795
  constructor({
1802
- editor: e,
1803
- formattingToolbarFactory: t,
1796
+ editor: t,
1797
+ tiptapEditor: e,
1798
+ formattingToolbarFactory: r,
1804
1799
  view: n,
1805
- shouldShow: r
1800
+ shouldShow: i
1806
1801
  }) {
1807
- h(this, "editor");
1808
- h(this, "view");
1809
- h(this, "formattingToolbar");
1810
- h(this, "preventHide", !1);
1811
- h(this, "preventShow", !1);
1812
- h(this, "toolbarIsOpen", !1);
1813
- h(this, "shouldShow", ({ view: e, state: t, from: n, to: r }) => {
1814
- const { doc: i, selection: a } = t, { empty: s } = a, d = !i.textBetween(n, r).length && Ee(t.selection);
1815
- return !(!e.hasFocus() || s || d);
1802
+ u(this, "editor");
1803
+ u(this, "ttEditor");
1804
+ u(this, "view");
1805
+ u(this, "formattingToolbar");
1806
+ u(this, "preventHide", !1);
1807
+ u(this, "preventShow", !1);
1808
+ u(this, "toolbarIsOpen", !1);
1809
+ u(this, "prevWasEditable", null);
1810
+ u(this, "shouldShow", ({ view: t, state: e, from: r, to: n }) => {
1811
+ const { doc: i, selection: a } = e, { empty: s } = a, d = !i.textBetween(r, n).length && St(e.selection);
1812
+ return !(!t.hasFocus() || s || d);
1816
1813
  });
1817
- h(this, "viewMousedownHandler", () => {
1814
+ u(this, "viewMousedownHandler", () => {
1818
1815
  this.preventShow = !0;
1819
1816
  });
1820
- h(this, "viewMouseupHandler", () => {
1821
- this.preventShow = !1, setTimeout(() => this.update(this.editor.view));
1817
+ u(this, "viewMouseupHandler", () => {
1818
+ this.preventShow = !1, setTimeout(() => this.update(this.ttEditor.view));
1822
1819
  });
1823
- h(this, "dragstartHandler", () => {
1820
+ u(this, "dragstartHandler", () => {
1824
1821
  this.formattingToolbar.hide(), this.toolbarIsOpen = !1;
1825
1822
  });
1826
- h(this, "focusHandler", () => {
1827
- setTimeout(() => this.update(this.editor.view));
1823
+ u(this, "focusHandler", () => {
1824
+ setTimeout(() => this.update(this.ttEditor.view));
1828
1825
  });
1829
- h(this, "blurHandler", ({ event: e }) => {
1830
- var t, n;
1826
+ u(this, "blurHandler", ({ event: t }) => {
1827
+ var e, r;
1831
1828
  if (this.preventHide) {
1832
1829
  this.preventHide = !1;
1833
1830
  return;
1834
1831
  }
1835
- e != null && e.relatedTarget && ((n = (t = this.formattingToolbar.element) == null ? void 0 : t.parentNode) != null && n.contains(
1836
- e.relatedTarget
1832
+ t != null && t.relatedTarget && ((r = (e = this.formattingToolbar.element) == null ? void 0 : e.parentNode) != null && r.contains(
1833
+ t.relatedTarget
1837
1834
  )) || this.toolbarIsOpen && (this.formattingToolbar.hide(), this.toolbarIsOpen = !1);
1838
1835
  });
1839
- this.editor = e, this.view = n, this.formattingToolbar = t(this.getStaticParams()), r && (this.shouldShow = r), this.view.dom.addEventListener("mousedown", this.viewMousedownHandler), this.view.dom.addEventListener("mouseup", this.viewMouseupHandler), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler);
1836
+ u(this, "scrollHandler", () => {
1837
+ this.toolbarIsOpen && this.formattingToolbar.render(this.getDynamicParams(), !1);
1838
+ });
1839
+ this.editor = t, this.ttEditor = e, this.view = n, this.formattingToolbar = r(this.getStaticParams()), i && (this.shouldShow = i), this.view.dom.addEventListener("mousedown", this.viewMousedownHandler), this.view.dom.addEventListener("mouseup", this.viewMouseupHandler), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.ttEditor.on("focus", this.focusHandler), this.ttEditor.on("blur", this.blurHandler), document.addEventListener("scroll", this.scrollHandler);
1840
1840
  }
1841
- update(e, t) {
1841
+ update(t, e) {
1842
1842
  var f;
1843
- const { state: n, composing: r } = e, { doc: i, selection: a } = n, s = t && t.doc.eq(i) && t.selection.eq(a);
1844
- if (r || s)
1843
+ const { state: r, composing: n } = t, { doc: i, selection: a } = r, s = e && e.doc.eq(i) && e.selection.eq(a);
1844
+ if ((this.prevWasEditable === null || this.prevWasEditable === this.editor.isEditable) && (n || s))
1845
1845
  return;
1846
- const { ranges: d } = a, l = Math.min(...d.map((p) => p.$from.pos)), c = Math.max(...d.map((p) => p.$to.pos)), u = (f = this.shouldShow) == null ? void 0 : f.call(this, {
1846
+ this.prevWasEditable = this.editor.isEditable;
1847
+ const { ranges: d } = a, l = Math.min(...d.map((p) => p.$from.pos)), c = Math.max(...d.map((p) => p.$to.pos)), h = (f = this.shouldShow) == null ? void 0 : f.call(this, {
1847
1848
  editor: this.editor,
1848
- view: e,
1849
- state: n,
1850
- oldState: t,
1849
+ view: t,
1850
+ state: r,
1851
+ oldState: e,
1851
1852
  from: l,
1852
1853
  to: c
1853
1854
  });
1854
- if (!this.toolbarIsOpen && !this.preventShow && (u || this.preventHide)) {
1855
+ if (this.editor.isEditable && !this.toolbarIsOpen && !this.preventShow && (h || this.preventHide)) {
1855
1856
  this.formattingToolbar.render(this.getDynamicParams(), !0), this.toolbarIsOpen = !0, this.formattingToolbar.element.addEventListener(
1856
1857
  "mousedown",
1857
1858
  (p) => p.preventDefault()
1858
1859
  );
1859
1860
  return;
1860
1861
  }
1861
- if (this.toolbarIsOpen && !this.preventShow && (u || this.preventHide)) {
1862
+ if (this.toolbarIsOpen && !this.preventShow && (h || this.preventHide)) {
1862
1863
  this.formattingToolbar.render(this.getDynamicParams(), !1);
1863
1864
  return;
1864
1865
  }
1865
- if (this.toolbarIsOpen && !this.preventHide && (!u || this.preventShow)) {
1866
+ if (this.toolbarIsOpen && !this.preventHide && (!h || this.preventShow || !this.editor.isEditable)) {
1866
1867
  this.formattingToolbar.hide(), this.toolbarIsOpen = !1, this.formattingToolbar.element.removeEventListener(
1867
1868
  "mousedown",
1868
1869
  (p) => p.preventDefault()
@@ -1871,154 +1872,92 @@ class $t {
1871
1872
  }
1872
1873
  }
1873
1874
  destroy() {
1874
- this.view.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.view.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
1875
+ this.view.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.view.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.ttEditor.off("focus", this.focusHandler), this.ttEditor.off("blur", this.blurHandler), document.removeEventListener("scroll", this.scrollHandler);
1875
1876
  }
1876
1877
  getSelectionBoundingBox() {
1877
- const { state: e } = this.editor.view, { selection: t } = e, { ranges: n } = t, r = Math.min(...n.map((a) => a.$from.pos)), i = Math.max(...n.map((a) => a.$to.pos));
1878
- if (Ie(t)) {
1879
- const a = this.editor.view.nodeDOM(r);
1878
+ const { state: t } = this.ttEditor.view, { selection: e } = t, { ranges: r } = e, n = Math.min(...r.map((a) => a.$from.pos)), i = Math.max(...r.map((a) => a.$to.pos));
1879
+ if (xt(e)) {
1880
+ const a = this.ttEditor.view.nodeDOM(n);
1880
1881
  if (a)
1881
1882
  return a.getBoundingClientRect();
1882
1883
  }
1883
- return re(this.editor.view, r, i);
1884
+ return nt(this.ttEditor.view, n, i);
1884
1885
  }
1885
1886
  getStaticParams() {
1886
1887
  return {
1887
- toggleBold: () => {
1888
- this.editor.view.focus(), this.editor.commands.toggleBold();
1889
- },
1890
- toggleItalic: () => {
1891
- this.editor.view.focus(), this.editor.commands.toggleItalic();
1892
- },
1893
- toggleUnderline: () => {
1894
- this.editor.view.focus(), this.editor.commands.toggleUnderline();
1895
- },
1896
- toggleStrike: () => {
1897
- this.editor.view.focus(), this.editor.commands.toggleStrike();
1898
- },
1899
- setHyperlink: (e, t) => {
1900
- if (e === "")
1901
- return;
1902
- let { from: n, to: r } = this.editor.state.selection;
1903
- t || (t = this.editor.state.doc.textBetween(n, r));
1904
- const i = this.editor.schema.mark("link", { href: e });
1905
- this.editor.view.dispatch(
1906
- this.editor.view.state.tr.insertText(t, n, r).addMark(n, n + t.length, i)
1907
- ), this.editor.view.focus();
1908
- },
1909
- setTextColor: (e) => {
1910
- this.editor.view.focus(), this.editor.commands.setTextColor(e);
1911
- },
1912
- setBackgroundColor: (e) => {
1913
- this.editor.view.focus(), this.editor.commands.setBackgroundColor(e);
1914
- },
1915
- setTextAlignment: (e) => {
1916
- this.editor.view.focus(), this.editor.commands.setTextAlignment(e);
1917
- },
1918
- increaseBlockIndent: () => {
1919
- this.editor.view.focus(), this.editor.commands.sinkListItem("blockContainer");
1920
- },
1921
- decreaseBlockIndent: () => {
1922
- this.editor.view.focus(), this.editor.commands.liftListItem("blockContainer");
1923
- },
1924
- updateBlock: (e) => {
1925
- this.editor.view.focus(), this.editor.commands.BNUpdateBlock(
1926
- this.editor.state.selection.from,
1927
- e
1928
- );
1929
- }
1888
+ editor: this.editor
1930
1889
  };
1931
1890
  }
1932
1891
  getDynamicParams() {
1933
- const e = k(
1934
- this.editor.state.doc,
1935
- this.editor.state.selection.from
1936
- );
1937
1892
  return {
1938
- boldIsActive: this.editor.isActive("bold"),
1939
- italicIsActive: this.editor.isActive("italic"),
1940
- underlineIsActive: this.editor.isActive("underline"),
1941
- strikeIsActive: this.editor.isActive("strike"),
1942
- hyperlinkIsActive: this.editor.isActive("link"),
1943
- activeHyperlinkUrl: this.editor.getAttributes("link").href || "",
1944
- activeHyperlinkText: this.editor.state.doc.textBetween(
1945
- this.editor.state.selection.from,
1946
- this.editor.state.selection.to
1947
- ),
1948
- textColor: this.editor.getAttributes("textColor").color || "default",
1949
- backgroundColor: this.editor.getAttributes("backgroundColor").color || "default",
1950
- textAlignment: this.editor.getAttributes(e.contentType).textAlignment || "left",
1951
- canIncreaseBlockIndent: this.editor.state.doc.resolve(e.startPos).index(e.depth - 1) > 0,
1952
- canDecreaseBlockIndent: e.depth > 2,
1953
- // Needs type cast as there is no way to create a type that dynamically updates based on which extensions are
1954
- // loaded by the editor.
1955
- block: {
1956
- type: e.contentType.name,
1957
- props: e.contentNode.attrs
1958
- },
1959
1893
  referenceRect: this.getSelectionBoundingBox()
1960
1894
  };
1961
1895
  }
1962
1896
  }
1963
- const qt = (o) => new B({
1897
+ const qe = (o) => new C({
1964
1898
  key: new v("FormattingToolbarPlugin"),
1965
- view: (e) => new $t({ view: e, ...o })
1966
- }), Yt = C.create({
1899
+ view: (t) => new $e({ view: t, ...o })
1900
+ }), We = E.create({
1967
1901
  name: "FormattingToolbarExtension",
1968
1902
  addProseMirrorPlugins() {
1969
- if (!this.options.formattingToolbarFactory)
1903
+ if (!this.options.formattingToolbarFactory || !this.options.editor)
1970
1904
  throw new Error(
1971
- "UI Element factory not defined for FormattingToolbarExtension"
1905
+ "required args not defined for FormattingToolbarExtension"
1972
1906
  );
1973
1907
  return [
1974
- qt({
1975
- editor: this.editor,
1908
+ qe({
1909
+ tiptapEditor: this.editor,
1910
+ editor: this.options.editor,
1976
1911
  formattingToolbarFactory: this.options.formattingToolbarFactory,
1977
1912
  pluginKey: new v("FormattingToolbarPlugin")
1978
1913
  })
1979
1914
  ];
1980
1915
  }
1981
- }), Wt = new v("HyperlinkToolbarPlugin");
1982
- class jt {
1983
- constructor({ editor: e, hyperlinkToolbarFactory: t }) {
1984
- h(this, "editor");
1985
- h(this, "hyperlinkToolbar");
1986
- h(this, "menuUpdateTimer");
1987
- h(this, "startMenuUpdateTimer");
1988
- h(this, "stopMenuUpdateTimer");
1989
- h(this, "mouseHoveredHyperlinkMark");
1990
- h(this, "mouseHoveredHyperlinkMarkRange");
1991
- h(this, "keyboardHoveredHyperlinkMark");
1992
- h(this, "keyboardHoveredHyperlinkMarkRange");
1993
- h(this, "hyperlinkMark");
1994
- h(this, "hyperlinkMarkRange");
1995
- this.editor = e, this.hyperlinkToolbar = t(this.getStaticParams()), this.startMenuUpdateTimer = () => {
1996
- this.menuUpdateTimer = setTimeout(() => {
1997
- this.update();
1998
- }, 250);
1999
- }, this.stopMenuUpdateTimer = () => (this.menuUpdateTimer && (clearTimeout(this.menuUpdateTimer), this.menuUpdateTimer = void 0), !1), e.view.dom.addEventListener("mouseover", (n) => {
2000
- if (this.mouseHoveredHyperlinkMark = void 0, this.mouseHoveredHyperlinkMarkRange = void 0, this.stopMenuUpdateTimer(), n.target instanceof HTMLAnchorElement && n.target.nodeName === "A") {
2001
- const r = n.target, i = e.view.posAtDOM(r, 0) + 1, a = e.state.doc.resolve(
2002
- i
2003
- ), s = a.marks();
2004
- for (const d of s)
2005
- if (d.type.name === e.schema.mark("link").type.name) {
2006
- this.mouseHoveredHyperlinkMark = d, this.mouseHoveredHyperlinkMarkRange = X(
2007
- a,
2008
- d.type,
2009
- d.attrs
1916
+ }), je = new v("HyperlinkToolbarPlugin");
1917
+ class Ye {
1918
+ constructor({ editor: t, hyperlinkToolbarFactory: e }) {
1919
+ u(this, "editor");
1920
+ u(this, "hyperlinkToolbar");
1921
+ u(this, "menuUpdateTimer");
1922
+ u(this, "startMenuUpdateTimer");
1923
+ u(this, "stopMenuUpdateTimer");
1924
+ u(this, "mouseHoveredHyperlinkMark");
1925
+ u(this, "mouseHoveredHyperlinkMarkRange");
1926
+ u(this, "keyboardHoveredHyperlinkMark");
1927
+ u(this, "keyboardHoveredHyperlinkMarkRange");
1928
+ u(this, "hyperlinkMark");
1929
+ u(this, "hyperlinkMarkRange");
1930
+ u(this, "mouseOverHandler", (t) => {
1931
+ if (this.mouseHoveredHyperlinkMark = void 0, this.mouseHoveredHyperlinkMarkRange = void 0, this.stopMenuUpdateTimer(), t.target instanceof HTMLAnchorElement && t.target.nodeName === "A") {
1932
+ const e = t.target, r = this.editor.view.posAtDOM(e, 0) + 1, n = this.editor.state.doc.resolve(
1933
+ r
1934
+ ), i = n.marks();
1935
+ for (const a of i)
1936
+ if (a.type.name === this.editor.schema.mark("link").type.name) {
1937
+ this.mouseHoveredHyperlinkMark = a, this.mouseHoveredHyperlinkMarkRange = X(
1938
+ n,
1939
+ a.type,
1940
+ a.attrs
2010
1941
  ) || void 0;
2011
1942
  break;
2012
1943
  }
2013
1944
  }
2014
1945
  return this.startMenuUpdateTimer(), !1;
2015
1946
  });
1947
+ u(this, "scrollHandler", () => {
1948
+ this.hyperlinkMark !== void 0 && this.hyperlinkToolbar.render(this.getDynamicParams(), !1);
1949
+ });
1950
+ this.editor = t, this.hyperlinkToolbar = e(this.getStaticParams()), this.startMenuUpdateTimer = () => {
1951
+ this.menuUpdateTimer = setTimeout(() => {
1952
+ this.update();
1953
+ }, 250);
1954
+ }, this.stopMenuUpdateTimer = () => (this.menuUpdateTimer && (clearTimeout(this.menuUpdateTimer), this.menuUpdateTimer = void 0), !1), this.editor.view.dom.addEventListener("mouseover", this.mouseOverHandler), document.addEventListener("scroll", this.scrollHandler);
2016
1955
  }
2017
1956
  update() {
2018
- var t, n, r, i;
1957
+ var e, r, n, i;
2019
1958
  if (!this.editor.view.hasFocus())
2020
1959
  return;
2021
- const e = this.hyperlinkMark;
1960
+ const t = this.hyperlinkMark;
2022
1961
  if (this.hyperlinkMark = void 0, this.hyperlinkMarkRange = void 0, this.keyboardHoveredHyperlinkMark = void 0, this.keyboardHoveredHyperlinkMarkRange = void 0, this.editor.state.selection.empty) {
2023
1962
  const a = this.editor.state.selection.$from.marks();
2024
1963
  for (const s of a)
@@ -2031,12 +1970,12 @@ class jt {
2031
1970
  break;
2032
1971
  }
2033
1972
  }
2034
- if (this.mouseHoveredHyperlinkMark && (this.hyperlinkMark = this.mouseHoveredHyperlinkMark, this.hyperlinkMarkRange = this.mouseHoveredHyperlinkMarkRange), this.keyboardHoveredHyperlinkMark && (this.hyperlinkMark = this.keyboardHoveredHyperlinkMark, this.hyperlinkMarkRange = this.keyboardHoveredHyperlinkMarkRange), this.hyperlinkMark) {
2035
- if (this.getDynamicParams(), !e) {
2036
- this.hyperlinkToolbar.render(this.getDynamicParams(), !0), (t = this.hyperlinkToolbar.element) == null || t.addEventListener(
1973
+ 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) {
1974
+ if (this.getDynamicParams(), !t) {
1975
+ this.hyperlinkToolbar.render(this.getDynamicParams(), !0), (e = this.hyperlinkToolbar.element) == null || e.addEventListener(
2037
1976
  "mouseleave",
2038
1977
  this.startMenuUpdateTimer
2039
- ), (n = this.hyperlinkToolbar.element) == null || n.addEventListener(
1978
+ ), (r = this.hyperlinkToolbar.element) == null || r.addEventListener(
2040
1979
  "mouseenter",
2041
1980
  this.stopMenuUpdateTimer
2042
1981
  );
@@ -2045,8 +1984,8 @@ class jt {
2045
1984
  this.hyperlinkToolbar.render(this.getDynamicParams(), !1);
2046
1985
  return;
2047
1986
  }
2048
- if (!this.hyperlinkMark && e) {
2049
- (r = this.hyperlinkToolbar.element) == null || r.removeEventListener(
1987
+ if (t && (!this.hyperlinkMark || !this.editor.isEditable)) {
1988
+ (n = this.hyperlinkToolbar.element) == null || n.removeEventListener(
2050
1989
  "mouseleave",
2051
1990
  this.startMenuUpdateTimer
2052
1991
  ), (i = this.hyperlinkToolbar.element) == null || i.removeEventListener(
@@ -2056,19 +1995,25 @@ class jt {
2056
1995
  return;
2057
1996
  }
2058
1997
  }
1998
+ destroy() {
1999
+ this.editor.view.dom.removeEventListener(
2000
+ "mouseover",
2001
+ this.mouseOverHandler
2002
+ ), document.removeEventListener("scroll", this.scrollHandler);
2003
+ }
2059
2004
  getStaticParams() {
2060
2005
  return {
2061
- editHyperlink: (e, t) => {
2062
- const n = this.editor.view.state.tr.insertText(
2063
- t,
2006
+ editHyperlink: (t, e) => {
2007
+ const r = this.editor.view.state.tr.insertText(
2008
+ e,
2064
2009
  this.hyperlinkMarkRange.from,
2065
2010
  this.hyperlinkMarkRange.to
2066
2011
  );
2067
- n.addMark(
2012
+ r.addMark(
2068
2013
  this.hyperlinkMarkRange.from,
2069
- this.hyperlinkMarkRange.from + t.length,
2070
- this.editor.schema.mark("link", { href: e })
2071
- ), this.editor.view.dispatch(n), this.editor.view.focus(), this.hyperlinkToolbar.hide();
2014
+ this.hyperlinkMarkRange.from + e.length,
2015
+ this.editor.schema.mark("link", { href: t })
2016
+ ), this.editor.view.dispatch(r), this.editor.view.focus(), this.hyperlinkToolbar.hide();
2072
2017
  },
2073
2018
  deleteHyperlink: () => {
2074
2019
  this.editor.view.dispatch(
@@ -2088,7 +2033,7 @@ class jt {
2088
2033
  this.hyperlinkMarkRange.from,
2089
2034
  this.hyperlinkMarkRange.to
2090
2035
  ),
2091
- referenceRect: re(
2036
+ referenceRect: nt(
2092
2037
  this.editor.view,
2093
2038
  this.hyperlinkMarkRange.from,
2094
2039
  this.hyperlinkMarkRange.to
@@ -2096,13 +2041,13 @@ class jt {
2096
2041
  };
2097
2042
  }
2098
2043
  }
2099
- const Vt = (o, e) => new B({
2100
- key: Wt,
2101
- view: () => new jt({
2044
+ const Ke = (o, t) => new C({
2045
+ key: je,
2046
+ view: () => new Ye({
2102
2047
  editor: o,
2103
- hyperlinkToolbarFactory: e.hyperlinkToolbarFactory
2048
+ hyperlinkToolbarFactory: t.hyperlinkToolbarFactory
2104
2049
  })
2105
- }), Kt = de.extend({
2050
+ }), Ve = dt.extend({
2106
2051
  priority: 500,
2107
2052
  addProseMirrorPlugins() {
2108
2053
  var o;
@@ -2110,12 +2055,12 @@ const Vt = (o, e) => new B({
2110
2055
  throw new Error("UI Element factory not defined for HyperlinkMark");
2111
2056
  return [
2112
2057
  ...((o = this.parent) == null ? void 0 : o.call(this)) || [],
2113
- Vt(this.editor, {
2058
+ Ke(this.editor, {
2114
2059
  hyperlinkToolbarFactory: this.options.hyperlinkToolbarFactory
2115
2060
  })
2116
2061
  ];
2117
2062
  }
2118
- }), Jt = new v("blocknote-placeholder"), Xt = C.create({
2063
+ }), Je = new v("blocknote-placeholder"), Xe = E.create({
2119
2064
  name: "placeholder",
2120
2065
  addOptions() {
2121
2066
  return {
@@ -2131,36 +2076,36 @@ const Vt = (o, e) => new B({
2131
2076
  },
2132
2077
  addProseMirrorPlugins() {
2133
2078
  return [
2134
- new B({
2135
- key: Jt,
2079
+ new C({
2080
+ key: Je,
2136
2081
  props: {
2137
2082
  decorations: (o) => {
2138
- const { doc: e, selection: t } = o, n = K.getState(o), r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = t, a = [];
2139
- if (r)
2140
- return e.descendants((s, d) => {
2083
+ const { doc: t, selection: e } = o, r = V.getState(o), n = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = e, a = [];
2084
+ if (n)
2085
+ return t.descendants((s, d) => {
2141
2086
  const l = i >= d && i <= d + s.nodeSize, c = !s.isLeaf && !s.childCount;
2142
2087
  if ((l || !this.options.showOnlyCurrent) && c) {
2143
- const u = [this.options.emptyNodeClass];
2144
- this.editor.isEmpty && u.push(this.options.emptyEditorClass), l && u.push(this.options.hasAnchorClass), (n == null ? void 0 : n.triggerCharacter) === "" && (n != null && n.active) && u.push(this.options.isFilterClass);
2088
+ const h = [this.options.emptyNodeClass];
2089
+ this.editor.isEmpty && h.push(this.options.emptyEditorClass), l && h.push(this.options.hasAnchorClass), (r == null ? void 0 : r.triggerCharacter) === "" && (r != null && r.active) && h.push(this.options.isFilterClass);
2145
2090
  const f = D.node(d, d + s.nodeSize, {
2146
- class: u.join(" ")
2091
+ class: h.join(" ")
2147
2092
  });
2148
2093
  a.push(f);
2149
2094
  }
2150
2095
  return this.options.includeChildren;
2151
- }), F.create(e, a);
2096
+ }), F.create(t, a);
2152
2097
  }
2153
2098
  }
2154
2099
  })
2155
2100
  ];
2156
2101
  }
2157
2102
  });
2158
- class Qt {
2159
- constructor(e, t) {
2160
- this.name = e, this.match = t;
2103
+ class Qe {
2104
+ constructor(t, e) {
2105
+ this.name = t, this.match = e;
2161
2106
  }
2162
2107
  }
2163
- class I extends Qt {
2108
+ class x extends Qe {
2164
2109
  /**
2165
2110
  * Constructs a new slash-command.
2166
2111
  *
@@ -2168,64 +2113,64 @@ class I extends Qt {
2168
2113
  * @param execute The callback for creating a new node
2169
2114
  * @param aliases Aliases for this command
2170
2115
  */
2171
- constructor(e, t, n = []) {
2172
- super(e, (r) => this.name.toLowerCase().startsWith(r.toLowerCase()) || this.aliases.filter(
2173
- (i) => i.toLowerCase().startsWith(r.toLowerCase())
2174
- ).length !== 0), this.name = e, this.execute = t, this.aliases = n;
2116
+ constructor(t, e, r = []) {
2117
+ super(t, (n) => this.name.toLowerCase().startsWith(n.toLowerCase()) || this.aliases.filter(
2118
+ (i) => i.toLowerCase().startsWith(n.toLowerCase())
2119
+ ).length !== 0), this.name = t, this.execute = e, this.aliases = r;
2175
2120
  }
2176
2121
  }
2177
- function S(o, e) {
2178
- const t = o.getTextCursorPosition().block;
2179
- t.content.length === 1 && t.content[0].type === "text" && t.content[0].text === "/" || t.content.length === 0 ? o.updateBlock(t, e) : (o.insertBlocks([e], t, "after"), o.setTextCursorPosition(o.getTextCursorPosition().nextBlock));
2122
+ function I(o, t) {
2123
+ const e = o.getTextCursorPosition().block;
2124
+ e.content.length === 1 && e.content[0].type === "text" && e.content[0].text === "/" || e.content.length === 0 ? o.updateBlock(e, t) : (o.insertBlocks([t], e, "after"), o.setTextCursorPosition(o.getTextCursorPosition().nextBlock));
2180
2125
  }
2181
- const Zt = [
2126
+ const Ze = [
2182
2127
  // Command for creating a level 1 heading
2183
- new I(
2128
+ new x(
2184
2129
  "Heading",
2185
- (o) => S(o, {
2130
+ (o) => I(o, {
2186
2131
  type: "heading",
2187
2132
  props: { level: "1" }
2188
2133
  }),
2189
2134
  ["h", "heading1", "h1"]
2190
2135
  ),
2191
2136
  // Command for creating a level 2 heading
2192
- new I(
2137
+ new x(
2193
2138
  "Heading 2",
2194
- (o) => S(o, {
2139
+ (o) => I(o, {
2195
2140
  type: "heading",
2196
2141
  props: { level: "2" }
2197
2142
  }),
2198
2143
  ["h2", "heading2", "subheading"]
2199
2144
  ),
2200
2145
  // Command for creating a level 3 heading
2201
- new I(
2146
+ new x(
2202
2147
  "Heading 3",
2203
- (o) => S(o, {
2148
+ (o) => I(o, {
2204
2149
  type: "heading",
2205
2150
  props: { level: "3" }
2206
2151
  }),
2207
2152
  ["h3", "heading3", "subheading"]
2208
2153
  ),
2209
2154
  // Command for creating an ordered list
2210
- new I(
2155
+ new x(
2211
2156
  "Numbered List",
2212
- (o) => S(o, {
2157
+ (o) => I(o, {
2213
2158
  type: "numberedListItem"
2214
2159
  }),
2215
2160
  ["li", "list", "numberedlist", "numbered list"]
2216
2161
  ),
2217
2162
  // Command for creating a bullet list
2218
- new I(
2163
+ new x(
2219
2164
  "Bullet List",
2220
- (o) => S(o, {
2165
+ (o) => I(o, {
2221
2166
  type: "bulletListItem"
2222
2167
  }),
2223
2168
  ["ul", "list", "bulletlist", "bullet list"]
2224
2169
  ),
2225
2170
  // Command for creating a paragraph (pretty useless)
2226
- new I(
2171
+ new x(
2227
2172
  "Paragraph",
2228
- (o) => S(o, {
2173
+ (o) => I(o, {
2229
2174
  type: "paragraph"
2230
2175
  }),
2231
2176
  ["p"]
@@ -2321,7 +2266,7 @@ const Zt = [
2321
2266
  // TableIcon,
2322
2267
  // "Used to create a simple table"
2323
2268
  // ),
2324
- ], eo = C.create({
2269
+ ], to = E.create({
2325
2270
  name: "textAlignment",
2326
2271
  addGlobalAttributes() {
2327
2272
  return [
@@ -2343,23 +2288,23 @@ const Zt = [
2343
2288
  },
2344
2289
  addCommands() {
2345
2290
  return {
2346
- setTextAlignment: (o) => ({ state: e }) => {
2347
- const t = [], n = k(
2348
- e.doc,
2349
- e.selection.from
2291
+ setTextAlignment: (o) => ({ state: t }) => {
2292
+ const e = [], r = g(
2293
+ t.doc,
2294
+ t.selection.from
2350
2295
  );
2351
- if (n === void 0)
2296
+ if (r === void 0)
2352
2297
  return !1;
2353
- let r = n.startPos;
2354
- for (; r < e.selection.to; )
2355
- e.doc.resolve(r).node().type.spec.group === "blockContent" ? (t.push(r - 1), r += e.doc.resolve(r).node().nodeSize - 1) : r += 1;
2356
- for (const i of t)
2357
- e.tr.setNodeAttribute(i, "textAlignment", o);
2298
+ let n = r.startPos;
2299
+ for (; n < t.selection.to; )
2300
+ t.doc.resolve(n).node().type.spec.group === "blockContent" ? (e.push(n - 1), n += t.doc.resolve(n).node().nodeSize - 1) : n += 1;
2301
+ for (const i of e)
2302
+ t.tr.setNodeAttribute(i, "textAlignment", o);
2358
2303
  return !0;
2359
2304
  }
2360
2305
  };
2361
2306
  }
2362
- }), to = C.create({
2307
+ }), eo = E.create({
2363
2308
  name: "blockTextColor",
2364
2309
  addGlobalAttributes() {
2365
2310
  return [
@@ -2379,13 +2324,13 @@ const Zt = [
2379
2324
  },
2380
2325
  addCommands() {
2381
2326
  return {
2382
- setBlockTextColor: (o, e) => ({ state: t, view: n }) => {
2383
- const r = k(t.doc, o);
2384
- return r === void 0 ? !1 : (t.tr.setNodeAttribute(r.startPos - 1, "textColor", e), n.focus(), !0);
2327
+ setBlockTextColor: (o, t) => ({ state: e, view: r }) => {
2328
+ const n = g(e.doc, o);
2329
+ return n === void 0 ? !1 : (e.tr.setNodeAttribute(n.startPos - 1, "textColor", t), r.focus(), !0);
2385
2330
  }
2386
2331
  };
2387
2332
  }
2388
- }), oo = ne.create({
2333
+ }), oo = rt.create({
2389
2334
  name: "textColor",
2390
2335
  addAttributes() {
2391
2336
  return {
@@ -2411,18 +2356,18 @@ const Zt = [
2411
2356
  },
2412
2357
  addCommands() {
2413
2358
  return {
2414
- setTextColor: (o) => ({ commands: e }) => o !== "default" ? e.setMark(this.name, { color: o }) : e.unsetMark(this.name)
2359
+ setTextColor: (o) => ({ commands: t }) => o !== "default" ? t.setMark(this.name, { color: o }) : t.unsetMark(this.name)
2415
2360
  };
2416
2361
  }
2417
- }), no = C.create({
2362
+ }), ro = E.create({
2418
2363
  name: "trailingNode",
2419
2364
  addProseMirrorPlugins() {
2420
2365
  const o = new v(this.name);
2421
2366
  return [
2422
- new B({
2367
+ new C({
2423
2368
  key: o,
2424
- appendTransaction: (e, t, n) => {
2425
- const { doc: r, tr: i, schema: a } = n, s = o.getState(n), d = r.content.size - 2, l = a.nodes.blockContainer, c = a.nodes.paragraph;
2369
+ appendTransaction: (t, e, r) => {
2370
+ const { doc: n, tr: i, schema: a } = r, s = o.getState(r), d = n.content.size - 2, l = a.nodes.blockContainer, c = a.nodes.paragraph;
2426
2371
  if (s)
2427
2372
  return i.insert(
2428
2373
  d,
@@ -2430,105 +2375,107 @@ const Zt = [
2430
2375
  );
2431
2376
  },
2432
2377
  state: {
2433
- init: (e, t) => {
2378
+ init: (t, e) => {
2434
2379
  },
2435
- apply: (e, t) => {
2436
- if (!e.docChanged)
2437
- return t;
2438
- let n = e.doc.lastChild;
2439
- if (!n || n.type.name !== "blockGroup")
2380
+ apply: (t, e) => {
2381
+ if (!t.docChanged)
2382
+ return e;
2383
+ let r = t.doc.lastChild;
2384
+ if (!r || r.type.name !== "blockGroup")
2440
2385
  throw new Error("Expected blockGroup");
2441
- if (n = n.lastChild, !n || n.type.name !== "blockContainer")
2386
+ if (r = r.lastChild, !r || r.type.name !== "blockContainer")
2442
2387
  throw new Error("Expected blockContainer");
2443
- return n.nodeSize > 4;
2388
+ return r.nodeSize > 4;
2444
2389
  }
2445
2390
  }
2446
2391
  })
2447
2392
  ];
2448
2393
  }
2449
- }), ro = (o) => {
2450
- const e = [
2451
- N.ClipboardTextSerializer,
2452
- N.Commands,
2453
- N.Editable,
2454
- N.FocusEvents,
2455
- N.Tabindex,
2394
+ }), no = (o) => {
2395
+ const t = [
2396
+ H.ClipboardTextSerializer,
2397
+ H.Commands,
2398
+ H.Editable,
2399
+ H.FocusEvents,
2400
+ H.Tabindex,
2456
2401
  // DevTools,
2457
- Ue,
2402
+ Ut,
2458
2403
  // DropCursor,
2459
- Xt.configure({
2404
+ Xe.configure({
2460
2405
  emptyNodeClass: b.isEmpty,
2461
2406
  hasAnchorClass: b.hasAnchor,
2462
2407
  isFilterClass: b.isFilter,
2463
2408
  includeChildren: !0,
2464
2409
  showOnlyCurrent: !1
2465
2410
  }),
2466
- j.configure({
2411
+ Y.configure({
2467
2412
  types: ["blockContainer"]
2468
2413
  }),
2469
- Ge,
2414
+ Gt,
2470
2415
  // Comments,
2471
2416
  // basics:
2472
- We,
2417
+ jt,
2473
2418
  // marks:
2474
- Fe,
2475
- Re,
2476
- qe,
2477
- Ye,
2478
- je,
2419
+ Ft,
2420
+ Rt,
2421
+ qt,
2422
+ Wt,
2423
+ Yt,
2479
2424
  oo,
2480
- to,
2481
- dt,
2482
- at,
2483
2425
  eo,
2426
+ de,
2427
+ ae,
2428
+ to,
2484
2429
  // custom blocks:
2485
- ...Et,
2486
- ze.configure({ width: 5, color: "#ddeeff" }),
2487
- $e,
2430
+ ...Se,
2431
+ zt.configure({ width: 5, color: "#ddeeff" }),
2432
+ $t,
2488
2433
  // This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
2489
2434
  // should be handled before Enter handlers in other components like splitListItem
2490
- no
2435
+ ro
2491
2436
  ];
2492
- return o.uiFactories.blockSideMenuFactory && e.push(
2493
- Gt.configure({
2437
+ return o.uiFactories.blockSideMenuFactory && t.push(
2438
+ Ge.configure({
2439
+ editor: o.editor,
2494
2440
  blockSideMenuFactory: o.uiFactories.blockSideMenuFactory
2495
2441
  })
2496
- ), o.uiFactories.formattingToolbarFactory && e.push(
2497
- Yt.configure({
2442
+ ), o.uiFactories.formattingToolbarFactory && t.push(
2443
+ We.configure({
2444
+ editor: o.editor,
2498
2445
  formattingToolbarFactory: o.uiFactories.formattingToolbarFactory
2499
2446
  })
2500
- ), o.uiFactories.hyperlinkToolbarFactory ? e.push(
2501
- Kt.configure({
2447
+ ), o.uiFactories.hyperlinkToolbarFactory ? t.push(
2448
+ Ve.configure({
2502
2449
  hyperlinkToolbarFactory: o.uiFactories.hyperlinkToolbarFactory
2503
2450
  })
2504
- ) : e.push(de), o.uiFactories.slashMenuFactory && e.push(
2505
- Ot.configure({
2451
+ ) : t.push(dt), o.uiFactories.slashMenuFactory && t.push(
2452
+ _e.configure({
2506
2453
  editor: o.editor,
2507
2454
  commands: o.slashCommands,
2508
2455
  slashMenuFactory: o.uiFactories.slashMenuFactory
2509
2456
  })
2510
- ), e;
2457
+ ), t;
2511
2458
  }, io = {
2512
2459
  enableInputRules: !0,
2513
2460
  enablePasteRules: !0,
2514
2461
  enableCoreExtensions: !1
2515
2462
  };
2516
- class Ho {
2517
- constructor(e = {}) {
2518
- h(this, "_tiptapEditor");
2519
- h(this, "blockCache", /* @__PURE__ */ new WeakMap());
2463
+ class No {
2464
+ constructor(t = {}) {
2465
+ u(this, "_tiptapEditor");
2466
+ u(this, "blockCache", /* @__PURE__ */ new WeakMap());
2520
2467
  var i, a, s;
2521
- e = {
2468
+ t = {
2522
2469
  defaultStyles: !0,
2523
- ...e
2470
+ ...t
2524
2471
  };
2525
- const t = ro({
2472
+ const e = no({
2526
2473
  editor: this,
2527
- uiFactories: e.uiFactories || {},
2528
- slashCommands: e.slashCommands || Zt
2474
+ uiFactories: t.uiFactories || {},
2475
+ slashCommands: t.slashCommands || Ze
2529
2476
  });
2530
- let n = e.disableHistoryExtension ? t.filter((d) => d.name !== "history") : t;
2531
- const r = {
2477
+ let r = t.disableHistoryExtension ? e.filter((d) => d.name !== "history") : e;
2478
+ const n = {
2532
2479
  // TODO: This approach to setting initial content is "cleaner" but requires the PM editor schema, which is only
2533
2480
  // created after initializing the TipTap editor. Not sure it's feasible.
2534
2481
  // content:
@@ -2537,91 +2484,96 @@ class Ho {
2537
2484
  // blockToNode(block, this._tiptapEditor.schema).toJSON()
2538
2485
  // ),
2539
2486
  ...io,
2540
- ...e._tiptapOptions,
2487
+ ...t._tiptapOptions,
2541
2488
  onCreate: () => {
2542
2489
  var d;
2543
- (d = e.onEditorReady) == null || d.call(e, this), e.initialContent && this.replaceBlocks(this.topLevelBlocks, e.initialContent);
2490
+ (d = t.onEditorReady) == null || d.call(t, this), t.initialContent && this.replaceBlocks(this.topLevelBlocks, t.initialContent);
2544
2491
  },
2545
2492
  onUpdate: () => {
2546
2493
  var d;
2547
- (d = e.onEditorContentChange) == null || d.call(e, this);
2494
+ (d = t.onEditorContentChange) == null || d.call(t, this);
2548
2495
  },
2549
2496
  onSelectionUpdate: () => {
2550
2497
  var d;
2551
- (d = e.onTextCursorPositionChange) == null || d.call(e, this);
2498
+ (d = t.onTextCursorPositionChange) == null || d.call(t, this);
2552
2499
  },
2553
- extensions: e.enableBlockNoteExtensions === !1 ? (i = e._tiptapOptions) == null ? void 0 : i.extensions : [...((a = e._tiptapOptions) == null ? void 0 : a.extensions) || [], ...n],
2500
+ editable: t.editable === void 0 ? !0 : t.editable,
2501
+ extensions: t.enableBlockNoteExtensions === !1 ? (i = t._tiptapOptions) == null ? void 0 : i.extensions : [...((a = t._tiptapOptions) == null ? void 0 : a.extensions) || [], ...r],
2554
2502
  editorProps: {
2555
2503
  attributes: {
2556
- ...e.editorDOMAttributes || {},
2504
+ "data-theme": t.theme || "light",
2505
+ ...t.editorDOMAttributes || {},
2557
2506
  class: [
2558
- _.bnEditor,
2559
- _.bnRoot,
2560
- e.defaultStyles ? _.defaultStyles : "",
2561
- ((s = e.editorDOMAttributes) == null ? void 0 : s.class) || ""
2507
+ O.bnEditor,
2508
+ O.bnRoot,
2509
+ t.defaultStyles ? O.defaultStyles : "",
2510
+ ((s = t.editorDOMAttributes) == null ? void 0 : s.class) || ""
2562
2511
  ].join(" ")
2563
2512
  }
2564
2513
  }
2565
2514
  };
2566
- e.parentElement && (r.element = e.parentElement), this._tiptapEditor = new Se(r);
2515
+ t.parentElement && (n.element = t.parentElement), this._tiptapEditor = new It(n);
2567
2516
  }
2568
2517
  get domElement() {
2569
2518
  return this._tiptapEditor.view.dom;
2570
2519
  }
2520
+ focus() {
2521
+ this._tiptapEditor.view.focus();
2522
+ }
2571
2523
  /**
2572
2524
  * Gets a snapshot of all top-level (non-nested) blocks in the editor.
2573
2525
  * @returns A snapshot of all top-level (non-nested) blocks in the editor.
2574
2526
  */
2575
2527
  get topLevelBlocks() {
2576
- const e = [];
2577
- return this._tiptapEditor.state.doc.firstChild.descendants((t) => (e.push(w(t, this.blockCache)), !1)), e;
2528
+ const t = [];
2529
+ return this._tiptapEditor.state.doc.firstChild.descendants((e) => (t.push(B(e, this.blockCache)), !1)), t;
2578
2530
  }
2579
2531
  /**
2580
2532
  * Gets a snapshot of an existing block from the editor.
2581
2533
  * @param blockIdentifier The identifier of an existing block that should be retrieved.
2582
2534
  * @returns The block that matches the identifier, or `undefined` if no matching block was found.
2583
2535
  */
2584
- getBlock(e) {
2585
- const t = typeof e == "string" ? e : e.id;
2586
- let n;
2587
- return this._tiptapEditor.state.doc.firstChild.descendants((r) => typeof n < "u" ? !1 : r.type.name !== "blockContainer" || r.attrs.id !== t ? !0 : (n = w(r, this.blockCache), !1)), n;
2536
+ getBlock(t) {
2537
+ const e = typeof t == "string" ? t : t.id;
2538
+ let r;
2539
+ return this._tiptapEditor.state.doc.firstChild.descendants((n) => typeof r < "u" ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== e ? !0 : (r = B(n, this.blockCache), !1)), r;
2588
2540
  }
2589
2541
  /**
2590
2542
  * Traverses all blocks in the editor depth-first, and executes a callback for each.
2591
2543
  * @param callback The callback to execute for each block. Returning `false` stops the traversal.
2592
2544
  * @param reverse Whether the blocks should be traversed in reverse order.
2593
2545
  */
2594
- forEachBlock(e, t = !1) {
2595
- const n = this.topLevelBlocks.slice();
2596
- t && n.reverse();
2597
- function r(i) {
2546
+ forEachBlock(t, e = !1) {
2547
+ const r = this.topLevelBlocks.slice();
2548
+ e && r.reverse();
2549
+ function n(i) {
2598
2550
  for (const a of i) {
2599
- if (e(a) === !1)
2551
+ if (!t(a))
2600
2552
  return !1;
2601
- const s = t ? a.children.slice().reverse() : a.children;
2602
- if (r(s) === !1)
2553
+ const s = e ? a.children.slice().reverse() : a.children;
2554
+ if (!n(s))
2603
2555
  return !1;
2604
2556
  }
2605
2557
  return !0;
2606
2558
  }
2607
- r(n);
2559
+ n(r);
2608
2560
  }
2609
2561
  /**
2610
2562
  * Gets a snapshot of the current text cursor position.
2611
2563
  * @returns A snapshot of the current text cursor position.
2612
2564
  */
2613
2565
  getTextCursorPosition() {
2614
- const { node: e, depth: t, startPos: n, endPos: r } = k(
2566
+ const { node: t, depth: e, startPos: r, endPos: n } = g(
2615
2567
  this._tiptapEditor.state.doc,
2616
2568
  this._tiptapEditor.state.selection.from
2617
- ), i = this._tiptapEditor.state.doc.resolve(r).index(t - 1), a = this._tiptapEditor.state.doc.resolve(r + 1).node().childCount;
2569
+ ), i = this._tiptapEditor.state.doc.resolve(n).index(e - 1), a = this._tiptapEditor.state.doc.resolve(n + 1).node().childCount;
2618
2570
  let s;
2619
- i > 0 && (s = this._tiptapEditor.state.doc.resolve(n - 2).node());
2571
+ i > 0 && (s = this._tiptapEditor.state.doc.resolve(r - 2).node());
2620
2572
  let d;
2621
- return i < a - 1 && (d = this._tiptapEditor.state.doc.resolve(r + 2).node()), {
2622
- block: w(e, this.blockCache),
2623
- prevBlock: s === void 0 ? void 0 : w(s, this.blockCache),
2624
- nextBlock: d === void 0 ? void 0 : w(d, this.blockCache)
2573
+ return i < a - 1 && (d = this._tiptapEditor.state.doc.resolve(n + 2).node()), {
2574
+ block: B(t, this.blockCache),
2575
+ prevBlock: s === void 0 ? void 0 : B(s, this.blockCache),
2576
+ nextBlock: d === void 0 ? void 0 : B(d, this.blockCache)
2625
2577
  };
2626
2578
  }
2627
2579
  /**
@@ -2630,15 +2582,43 @@ class Ho {
2630
2582
  * @param targetBlock The identifier of an existing block that the text cursor should be moved to.
2631
2583
  * @param placement Whether the text cursor should be placed at the start or end of the block.
2632
2584
  */
2633
- setTextCursorPosition(e, t = "start") {
2634
- const n = typeof e == "string" ? e : e.id, { posBeforeNode: r } = V(n, this._tiptapEditor.state.doc), { startPos: i, contentNode: a } = k(
2585
+ setTextCursorPosition(t, e = "start") {
2586
+ const r = typeof t == "string" ? t : t.id, { posBeforeNode: n } = K(r, this._tiptapEditor.state.doc), { startPos: i, contentNode: a } = g(
2635
2587
  this._tiptapEditor.state.doc,
2636
- r + 2
2588
+ n + 2
2637
2589
  );
2638
- t === "start" ? this._tiptapEditor.commands.setTextSelection(i + 1) : this._tiptapEditor.commands.setTextSelection(
2590
+ e === "start" ? this._tiptapEditor.commands.setTextSelection(i + 1) : this._tiptapEditor.commands.setTextSelection(
2639
2591
  i + a.nodeSize - 1
2640
2592
  );
2641
2593
  }
2594
+ /**
2595
+ * Gets a snapshot of the current selection.
2596
+ */
2597
+ getSelection() {
2598
+ if (this._tiptapEditor.state.selection.from === this._tiptapEditor.state.selection.to)
2599
+ return;
2600
+ const t = [];
2601
+ return this._tiptapEditor.state.doc.descendants((e, r) => e.type.spec.group !== "blockContent" || r + e.nodeSize < this._tiptapEditor.state.selection.from || r > this._tiptapEditor.state.selection.to ? !0 : (t.push(
2602
+ B(
2603
+ this._tiptapEditor.state.doc.resolve(r).node(),
2604
+ this.blockCache
2605
+ )
2606
+ ), !1)), { blocks: t };
2607
+ }
2608
+ /**
2609
+ * Checks if the editor is currently editable, or if it's locked.
2610
+ * @returns True if the editor is editable, false otherwise.
2611
+ */
2612
+ get isEditable() {
2613
+ return this._tiptapEditor.isEditable;
2614
+ }
2615
+ /**
2616
+ * Makes the editor editable or locks it, depending on the argument passed.
2617
+ * @param editable True to make the editor editable, or false to lock it.
2618
+ */
2619
+ set isEditable(t) {
2620
+ this._tiptapEditor.setEditable(t);
2621
+ }
2642
2622
  /**
2643
2623
  * Inserts new blocks into the editor. If a block's `id` is undefined, BlockNote generates one automatically. Throws an
2644
2624
  * error if the reference block could not be found.
@@ -2647,8 +2627,8 @@ class Ho {
2647
2627
  * @param placement Whether the blocks should be inserted just before, just after, or nested inside the
2648
2628
  * `referenceBlock`. Inserts the blocks at the start of the existing block's children if "nested" is used.
2649
2629
  */
2650
- insertBlocks(e, t, n = "before") {
2651
- pe(e, t, n, this._tiptapEditor);
2630
+ insertBlocks(t, e, r = "before") {
2631
+ pt(t, e, r, this._tiptapEditor);
2652
2632
  }
2653
2633
  /**
2654
2634
  * Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be
@@ -2657,15 +2637,15 @@ class Ho {
2657
2637
  * @param blockToUpdate The block that should be updated.
2658
2638
  * @param update A partial block which defines how the existing block should be changed.
2659
2639
  */
2660
- updateBlock(e, t) {
2661
- tt(e, t, this._tiptapEditor);
2640
+ updateBlock(t, e) {
2641
+ ee(t, e, this._tiptapEditor);
2662
2642
  }
2663
2643
  /**
2664
2644
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
2665
2645
  * @param blocksToRemove An array of identifiers for existing blocks that should be removed.
2666
2646
  */
2667
- removeBlocks(e) {
2668
- fe(e, this._tiptapEditor);
2647
+ removeBlocks(t) {
2648
+ ft(t, this._tiptapEditor);
2669
2649
  }
2670
2650
  /**
2671
2651
  * Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or
@@ -2674,8 +2654,123 @@ class Ho {
2674
2654
  * @param blocksToRemove An array of blocks that should be replaced.
2675
2655
  * @param blocksToInsert An array of partial blocks to replace the old ones with.
2676
2656
  */
2677
- replaceBlocks(e, t) {
2678
- ot(e, t, this._tiptapEditor);
2657
+ replaceBlocks(t, e) {
2658
+ oe(t, e, this._tiptapEditor);
2659
+ }
2660
+ /**
2661
+ * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
2662
+ */
2663
+ getActiveStyles() {
2664
+ const t = {}, e = this._tiptapEditor.state.selection.$to.marks(), r = /* @__PURE__ */ new Set([
2665
+ "bold",
2666
+ "italic",
2667
+ "underline",
2668
+ "strike",
2669
+ "code"
2670
+ ]), n = /* @__PURE__ */ new Set(["textColor", "backgroundColor"]);
2671
+ for (const i of e)
2672
+ r.has(i.type.name) ? t[i.type.name] = !0 : n.has(i.type.name) && (t[i.type.name] = i.attrs.color);
2673
+ return t;
2674
+ }
2675
+ /**
2676
+ * Adds styles to the currently selected content.
2677
+ * @param styles The styles to add.
2678
+ */
2679
+ addStyles(t) {
2680
+ const e = /* @__PURE__ */ new Set([
2681
+ "bold",
2682
+ "italic",
2683
+ "underline",
2684
+ "strike",
2685
+ "code"
2686
+ ]), r = /* @__PURE__ */ new Set(["textColor", "backgroundColor"]);
2687
+ for (const [n, i] of Object.entries(t))
2688
+ e.has(n) ? this._tiptapEditor.commands.setMark(n) : r.has(n) && this._tiptapEditor.commands.setMark(n, { color: i });
2689
+ }
2690
+ /**
2691
+ * Removes styles from the currently selected content.
2692
+ * @param styles The styles to remove.
2693
+ */
2694
+ removeStyles(t) {
2695
+ for (const e of Object.keys(t))
2696
+ this._tiptapEditor.commands.unsetMark(e);
2697
+ }
2698
+ /**
2699
+ * Toggles styles on the currently selected content.
2700
+ * @param styles The styles to toggle.
2701
+ */
2702
+ toggleStyles(t) {
2703
+ const e = /* @__PURE__ */ new Set([
2704
+ "bold",
2705
+ "italic",
2706
+ "underline",
2707
+ "strike",
2708
+ "code"
2709
+ ]), r = /* @__PURE__ */ new Set(["textColor", "backgroundColor"]);
2710
+ for (const [n, i] of Object.entries(t))
2711
+ e.has(n) ? this._tiptapEditor.commands.toggleMark(n) : r.has(n) && this._tiptapEditor.commands.toggleMark(n, { color: i });
2712
+ }
2713
+ /**
2714
+ * Gets the currently selected text.
2715
+ */
2716
+ getSelectedText() {
2717
+ return this._tiptapEditor.state.doc.textBetween(
2718
+ this._tiptapEditor.state.selection.from,
2719
+ this._tiptapEditor.state.selection.to
2720
+ );
2721
+ }
2722
+ /**
2723
+ * Gets the URL of the last link in the current selection, or `undefined` if there are no links in the selection.
2724
+ */
2725
+ getSelectedLinkUrl() {
2726
+ return this._tiptapEditor.getAttributes("link").href;
2727
+ }
2728
+ /**
2729
+ * Creates a new link to replace the selected content.
2730
+ * @param url The link URL.
2731
+ * @param text The text to display the link with.
2732
+ */
2733
+ createLink(t, e) {
2734
+ if (t === "")
2735
+ return;
2736
+ let { from: r, to: n } = this._tiptapEditor.state.selection;
2737
+ e || (e = this._tiptapEditor.state.doc.textBetween(r, n));
2738
+ const i = this._tiptapEditor.schema.mark("link", { href: t });
2739
+ this._tiptapEditor.view.dispatch(
2740
+ this._tiptapEditor.view.state.tr.insertText(e, r, n).addMark(r, r + e.length, i)
2741
+ );
2742
+ }
2743
+ /**
2744
+ * Checks if the block containing the text cursor can be nested.
2745
+ */
2746
+ canNestBlock() {
2747
+ const { startPos: t, depth: e } = g(
2748
+ this._tiptapEditor.state.doc,
2749
+ this._tiptapEditor.state.selection.from
2750
+ );
2751
+ return this._tiptapEditor.state.doc.resolve(t).index(e - 1) > 0;
2752
+ }
2753
+ /**
2754
+ * Nests the block containing the text cursor into the block above it.
2755
+ */
2756
+ nestBlock() {
2757
+ this._tiptapEditor.commands.sinkListItem("blockContainer");
2758
+ }
2759
+ /**
2760
+ * Checks if the block containing the text cursor is nested.
2761
+ */
2762
+ canUnnestBlock() {
2763
+ const { depth: t } = g(
2764
+ this._tiptapEditor.state.doc,
2765
+ this._tiptapEditor.state.selection.from
2766
+ );
2767
+ return t > 2;
2768
+ }
2769
+ /**
2770
+ * Lifts the block containing the text cursor out of its parent.
2771
+ */
2772
+ unnestBlock() {
2773
+ this._tiptapEditor.commands.liftListItem("blockContainer");
2679
2774
  }
2680
2775
  /**
2681
2776
  * Serializes blocks into an HTML string. To better conform to HTML standards, children of blocks which aren't list
@@ -2683,8 +2778,8 @@ class Ho {
2683
2778
  * @param blocks An array of blocks that should be serialized into HTML.
2684
2779
  * @returns The blocks, serialized as an HTML string.
2685
2780
  */
2686
- async blocksToHTML(e) {
2687
- return me(e, this._tiptapEditor.schema);
2781
+ async blocksToHTML(t) {
2782
+ return mt(t, this._tiptapEditor.schema);
2688
2783
  }
2689
2784
  /**
2690
2785
  * Parses blocks from an HTML string. Tries to create `Block` objects out of any HTML block-level elements, and
@@ -2693,8 +2788,8 @@ class Ho {
2693
2788
  * @param html The HTML string to parse blocks from.
2694
2789
  * @returns The blocks parsed from the HTML string.
2695
2790
  */
2696
- async HTMLToBlocks(e) {
2697
- return ke(e, this._tiptapEditor.schema);
2791
+ async HTMLToBlocks(t) {
2792
+ return gt(t, this._tiptapEditor.schema);
2698
2793
  }
2699
2794
  /**
2700
2795
  * Serializes blocks into a Markdown string. The output is simplified as Markdown does not support all features of
@@ -2702,8 +2797,8 @@ class Ho {
2702
2797
  * @param blocks An array of blocks that should be serialized into Markdown.
2703
2798
  * @returns The blocks, serialized as a Markdown string.
2704
2799
  */
2705
- async blocksToMarkdown(e) {
2706
- return it(e, this._tiptapEditor.schema);
2800
+ async blocksToMarkdown(t) {
2801
+ return ie(t, this._tiptapEditor.schema);
2707
2802
  }
2708
2803
  /**
2709
2804
  * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
@@ -2712,16 +2807,16 @@ class Ho {
2712
2807
  * @param markdown The Markdown string to parse blocks from.
2713
2808
  * @returns The blocks parsed from the Markdown string.
2714
2809
  */
2715
- async markdownToBlocks(e) {
2716
- return st(e, this._tiptapEditor.schema);
2810
+ async markdownToBlocks(t) {
2811
+ return se(t, this._tiptapEditor.schema);
2717
2812
  }
2718
2813
  }
2719
2814
  export {
2720
- I as BaseSlashMenuItem,
2721
- Ho as BlockNoteEditor,
2722
- ee as blockProps,
2723
- Zt as defaultSlashMenuItems,
2724
- ro as getBlockNoteExtensions,
2725
- O as globalProps
2815
+ x as BaseSlashMenuItem,
2816
+ No as BlockNoteEditor,
2817
+ tt as blockProps,
2818
+ Ze as defaultSlashMenuItems,
2819
+ no as getBlockNoteExtensions,
2820
+ _ as globalProps
2726
2821
  };
2727
2822
  //# sourceMappingURL=blocknote.js.map