@blocknote/core 0.6.2 → 0.7.1-alpha.0

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.
package/dist/blocknote.js CHANGED
@@ -1,46 +1,48 @@
1
1
  var Et = Object.defineProperty;
2
2
  var Ct = (o, t, e) => t in o ? Et(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
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";
4
+ import { Extension as E, findChildren as G, combineTransactionSteps as Mt, getChangedRanges as Bt, findChildrenInRange as Tt, Mark as rt, Node as S, mergeAttributes as w, InputRule as j, findParentNode as wt, isTextSelection as St, isNodeSelection as xt, posToDOMRect as nt, getMarkRange as X, extensions as N, Editor as It } from "@tiptap/core";
5
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";
6
+ import { Plugin as C, PluginKey as v, TextSelection as Q, Selection as $, NodeSelection as _t } from "prosemirror-state";
7
+ import { v4 as At } from "uuid";
8
8
  import it from "rehype-parse";
9
9
  import Nt from "rehype-remark";
10
10
  import st from "rehype-stringify";
11
11
  import at from "remark-gfm";
12
- import _t from "remark-parse";
12
+ import Ht from "remark-parse";
13
13
  import Ot from "remark-rehype";
14
14
  import Dt from "remark-stringify";
15
- import { unified as j } from "unified";
15
+ import { unified as W } from "unified";
16
16
  import { fromDom as Z } from "hast-util-from-dom";
17
17
  import { Bold as Ft } from "@tiptap/extension-bold";
18
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";
19
+ import zt from "@tiptap/extension-collaboration";
20
+ import Ut from "@tiptap/extension-collaboration-cursor";
21
+ import { Dropcursor as $t } from "@tiptap/extension-dropcursor";
22
+ import { Gapcursor as Gt } from "@tiptap/extension-gapcursor";
23
+ import { HardBreak as qt } from "@tiptap/extension-hard-break";
24
+ import { History as jt } from "@tiptap/extension-history";
25
+ import { Italic as Wt } from "@tiptap/extension-italic";
26
+ import { Link as lt } from "@tiptap/extension-link";
27
+ import { Strike as Yt } from "@tiptap/extension-strike";
28
+ import { Text as Kt } from "@tiptap/extension-text";
29
+ import { Underline as Vt } from "@tiptap/extension-underline";
30
+ import * as Jt from "prosemirror-view";
29
31
  import { Decoration as D, DecorationSet as F } from "prosemirror-view";
30
- const _ = [
32
+ const O = [
31
33
  "backgroundColor",
32
34
  "textColor",
33
35
  "textAlignment"
34
36
  ], tt = {
35
- paragraph: /* @__PURE__ */ new Set([..._]),
37
+ paragraph: /* @__PURE__ */ new Set([...O]),
36
38
  heading: /* @__PURE__ */ new Set([
37
- ..._,
39
+ ...O,
38
40
  "level"
39
41
  ]),
40
42
  numberedListItem: /* @__PURE__ */ new Set([
41
- ..._
43
+ ...O
42
44
  ]),
43
- bulletListItem: /* @__PURE__ */ new Set([..._])
45
+ bulletListItem: /* @__PURE__ */ new Set([...O])
44
46
  };
45
47
  function g(o, t) {
46
48
  if (t < 0 || t > o.nodeSize)
@@ -54,30 +56,30 @@ function g(o, t) {
54
56
  break;
55
57
  i -= 1, n = e.node(i);
56
58
  }
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);
59
+ const a = n.attrs.id, s = n.firstChild, l = s.type, d = n.childCount === 2 ? n.lastChild.childCount : 0, c = e.start(i), h = e.end(i);
58
60
  return {
59
61
  id: a,
60
62
  node: n,
61
63
  contentNode: s,
62
- contentType: d,
63
- numChildBlocks: l,
64
+ contentType: l,
65
+ numChildBlocks: d,
64
66
  startPos: c,
65
67
  endPos: h,
66
68
  depth: i
67
69
  };
68
70
  }
69
- function Vt(o, t = JSON.stringify) {
71
+ function Xt(o, t = JSON.stringify) {
70
72
  const e = {};
71
73
  return o.filter((r) => {
72
74
  const n = t(r);
73
75
  return Object.prototype.hasOwnProperty.call(e, n) ? !1 : e[n] = !0;
74
76
  });
75
77
  }
76
- function Jt(o) {
78
+ function Qt(o) {
77
79
  const t = o.filter(
78
80
  (r, n) => o.indexOf(r) !== n
79
81
  );
80
- return Vt(t);
82
+ return Xt(t);
81
83
  }
82
84
  const Y = E.create({
83
85
  name: "uniqueID",
@@ -88,7 +90,7 @@ const Y = E.create({
88
90
  return {
89
91
  attributeName: "id",
90
92
  types: [],
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(),
93
+ generateID: () => window.__TEST_OPTIONS ? (window.__TEST_OPTIONS.mockID === void 0 ? window.__TEST_OPTIONS.mockID = 0 : window.__TEST_OPTIONS.mockID++, window.__TEST_OPTIONS.mockID.toString()) : At(),
92
94
  filterTransaction: null
93
95
  };
94
96
  },
@@ -111,13 +113,13 @@ const Y = E.create({
111
113
  // check initial content for missing ids
112
114
  onCreate() {
113
115
  if (this.editor.extensionManager.extensions.find(
114
- (d) => d.name === "collaboration"
116
+ (l) => l.name === "collaboration"
115
117
  ))
116
118
  return;
117
119
  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
- ...d.attrs,
120
+ G(r, (l) => n.includes(l.type.name) && l.attrs[i] === null).forEach(({ node: l, pos: d }) => {
121
+ e.setNodeMarkup(d, void 0, {
122
+ ...l.attrs,
121
123
  [i]: a()
122
124
  });
123
125
  }), e.setMeta("addToHistory", !1), o.dispatch(e);
@@ -134,7 +136,7 @@ const Y = E.create({
134
136
  });
135
137
  if (!i || a)
136
138
  return;
137
- const { tr: s } = n, { types: d, attributeName: l, generateID: c } = this.options, h = Mt(
139
+ const { tr: s } = n, { types: l, attributeName: d, generateID: c } = this.options, h = Mt(
138
140
  r.doc,
139
141
  e
140
142
  ), { mapping: f } = h;
@@ -142,22 +144,22 @@ const Y = E.create({
142
144
  const y = Tt(
143
145
  n.doc,
144
146
  m,
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 }) => {
147
+ (M) => l.includes(M.type.name)
148
+ ), k = y.map(({ node: M }) => M.attrs[d]).filter((M) => M !== null), z = Qt(k);
149
+ y.forEach(({ node: M, pos: H }) => {
148
150
  var U;
149
- const J = (U = s.doc.nodeAt(N)) === null || U === void 0 ? void 0 : U.attrs[l];
151
+ const J = (U = s.doc.nodeAt(H)) === null || U === void 0 ? void 0 : U.attrs[d];
150
152
  if (J === null) {
151
- s.setNodeMarkup(N, void 0, {
153
+ s.setNodeMarkup(H, void 0, {
152
154
  ...M.attrs,
153
- [l]: c()
155
+ [d]: c()
154
156
  });
155
157
  return;
156
158
  }
157
- const { deleted: vt } = f.invert().mapResult(N);
158
- vt && z.includes(J) && s.setNodeMarkup(N, void 0, {
159
+ const { deleted: vt } = f.invert().mapResult(H);
160
+ vt && z.includes(J) && s.setNodeMarkup(H, void 0, {
159
161
  ...M.attrs,
160
- [l]: c()
162
+ [d]: c()
161
163
  });
162
164
  });
163
165
  }), !!s.steps.length)
@@ -195,24 +197,24 @@ const Y = E.create({
195
197
  return e;
196
198
  const { types: r, attributeName: n } = this.options, i = (a) => {
197
199
  const s = [];
198
- return a.forEach((d) => {
199
- if (d.isText) {
200
- s.push(d);
200
+ return a.forEach((l) => {
201
+ if (l.isText) {
202
+ s.push(l);
201
203
  return;
202
204
  }
203
- if (!r.includes(d.type.name)) {
204
- s.push(d.copy(i(d.content)));
205
+ if (!r.includes(l.type.name)) {
206
+ s.push(l.copy(i(l.content)));
205
207
  return;
206
208
  }
207
- const l = d.type.create(
209
+ const d = l.type.create(
208
210
  {
209
- ...d.attrs,
211
+ ...l.attrs,
210
212
  [n]: null
211
213
  },
212
- i(d.content),
213
- d.marks
214
+ i(l.content),
215
+ l.marks
214
216
  );
215
- s.push(l);
217
+ s.push(d);
216
218
  }), L.from(s);
217
219
  };
218
220
  return t = !1, new P(
@@ -226,25 +228,25 @@ const Y = E.create({
226
228
  ];
227
229
  }
228
230
  });
229
- class Xt extends Error {
231
+ class Zt extends Error {
230
232
  constructor(t) {
231
233
  super(`Unreachable case: ${t}`);
232
234
  }
233
235
  }
234
- const lt = /* @__PURE__ */ new Set([
236
+ const dt = /* @__PURE__ */ new Set([
235
237
  "bold",
236
238
  "italic",
237
239
  "underline",
238
240
  "strike",
239
241
  "code"
240
242
  ]), ct = /* @__PURE__ */ new Set(["textColor", "backgroundColor"]);
241
- function Qt(o, t) {
243
+ function te(o, t) {
242
244
  const e = [];
243
245
  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 }));
246
+ dt.has(r) ? e.push(t.mark(r)) : ct.has(r) && e.push(t.mark(r, { color: n }));
245
247
  return t.text(o.text, e);
246
248
  }
247
- function Zt(o, t) {
249
+ function ee(o, t) {
248
250
  const e = t.marks.link.create({
249
251
  href: o.href
250
252
  });
@@ -255,18 +257,18 @@ function ut(o, t) {
255
257
  if (typeof o == "string")
256
258
  return e.push(t.text(o)), e;
257
259
  for (const r of o)
258
- e.push(Qt(r, t));
260
+ e.push(te(r, t));
259
261
  return e;
260
262
  }
261
263
  function ht(o, t) {
262
264
  let e = [];
263
265
  for (const r of o)
264
266
  if (r.type === "link")
265
- e.push(...Zt(r, t));
267
+ e.push(...ee(r, t));
266
268
  else if (r.type === "text")
267
269
  e.push(...ut([r], t));
268
270
  else
269
- throw new Xt(r);
271
+ throw new Zt(r);
270
272
  return e;
271
273
  }
272
274
  function R(o, t) {
@@ -299,7 +301,7 @@ function R(o, t) {
299
301
  i.length > 0 ? [n, a] : n
300
302
  );
301
303
  }
302
- function te(o) {
304
+ function oe(o) {
303
305
  const t = [];
304
306
  let e;
305
307
  return o.content.forEach((r) => {
@@ -308,7 +310,7 @@ function te(o) {
308
310
  for (const a of r.marks)
309
311
  if (a.type.name === "link")
310
312
  i = a;
311
- else if (lt.has(a.type.name))
313
+ else if (dt.has(a.type.name))
312
314
  n[a.type.name] = !0;
313
315
  else if (ct.has(a.type.name))
314
316
  n[a.type.name] = a.attrs.color;
@@ -347,7 +349,7 @@ function B(o, t) {
347
349
  let n = r.id;
348
350
  n === null && (n = Y.options.generateID());
349
351
  const i = {};
350
- for (const [l, c] of Object.entries({
352
+ for (const [d, c] of Object.entries({
351
353
  ...r.node.attrs,
352
354
  ...r.contentNode.attrs
353
355
  })) {
@@ -355,19 +357,19 @@ function B(o, t) {
355
357
  throw Error(
356
358
  "Block is of an unrecognized type: " + r.contentType.name
357
359
  );
358
- tt[r.contentType.name].has(l) && (i[l] = c);
360
+ tt[r.contentType.name].has(d) && (i[d] = c);
359
361
  }
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)));
363
- const d = {
362
+ const a = oe(r.contentNode), s = [];
363
+ for (let d = 0; d < r.numChildBlocks; d++)
364
+ s.push(B(r.node.lastChild.child(d)));
365
+ const l = {
364
366
  id: n,
365
367
  type: r.contentType.name,
366
368
  props: i,
367
369
  content: a,
368
370
  children: s
369
371
  };
370
- return t == null || t.set(o, d), d;
372
+ return t == null || t.set(o, l), l;
371
373
  }
372
374
  function K(o, t) {
373
375
  let e, r;
@@ -380,27 +382,27 @@ function K(o, t) {
380
382
  }
381
383
  function pt(o, t, e = "before", r) {
382
384
  const n = typeof t == "string" ? t : t.id, i = [];
383
- for (const l of o)
384
- i.push(R(l, r.schema));
385
+ for (const d of o)
386
+ i.push(R(d, r.schema));
385
387
  let a = -1;
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") {
388
+ const { node: s, posBeforeNode: l } = K(n, r.state.doc);
389
+ if (e === "before" && (a = l), e === "after" && (a = l + s.nodeSize), e === "nested") {
388
390
  if (s.childCount < 2) {
389
- a = d + s.firstChild.nodeSize + 1;
390
- const l = r.state.schema.nodes.blockGroup.create(
391
+ a = l + s.firstChild.nodeSize + 1;
392
+ const d = r.state.schema.nodes.blockGroup.create(
391
393
  {},
392
394
  i
393
395
  );
394
396
  r.view.dispatch(
395
- r.state.tr.insert(a, l)
397
+ r.state.tr.insert(a, d)
396
398
  );
397
399
  return;
398
400
  }
399
- a = d + s.firstChild.nodeSize + 2;
401
+ a = l + s.firstChild.nodeSize + 2;
400
402
  }
401
403
  r.view.dispatch(r.state.tr.insert(a, i));
402
404
  }
403
- function ee(o, t, e) {
405
+ function re(o, t, e) {
404
406
  const r = typeof o == "string" ? o : o.id, { posBeforeNode: n } = K(r, e.state.doc);
405
407
  e.commands.BNUpdateBlock(n + 1, t);
406
408
  }
@@ -429,10 +431,10 @@ function ft(o, t) {
429
431
  );
430
432
  }
431
433
  }
432
- function oe(o, t, e) {
434
+ function ne(o, t, e) {
433
435
  pt(t, o[0], "before", e), ft(o, e);
434
436
  }
435
- function re() {
437
+ function ie() {
436
438
  const o = (t) => {
437
439
  let e = t.children.length;
438
440
  for (let r = 0; r < e; r++) {
@@ -448,17 +450,17 @@ function re() {
448
450
  };
449
451
  return o;
450
452
  }
451
- function ne(o) {
453
+ function se(o) {
452
454
  const t = /* @__PURE__ */ new Set([
453
455
  ...o.orderedListItemBlockTypes,
454
456
  ...o.unorderedListItemBlockTypes
455
457
  ]), e = (r) => {
456
458
  let n = r.children.length, i;
457
459
  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(
459
- l.properties.dataContentType
460
+ const l = r.children[a].children[0], d = l.children[0], c = l.children.length === 2 ? l.children[1] : null, h = t.has(
461
+ d.properties.dataContentType
460
462
  ), f = h ? o.orderedListItemBlockTypes.has(
461
- l.properties.dataContentType
463
+ d.properties.dataContentType
462
464
  ) ? "ol" : "ul" : null;
463
465
  if (c !== null && e(c), i && i.tagName !== f) {
464
466
  r.children.splice(
@@ -476,13 +478,13 @@ function ne(o) {
476
478
  const p = Z(
477
479
  document.createElement("li")
478
480
  );
479
- p.children.push(l.children[0]), c !== null && p.children.push(...c.children), i.children.push(p);
481
+ p.children.push(d.children[0]), c !== null && p.children.push(...c.children), i.children.push(p);
480
482
  } else if (c !== null) {
481
- r.children.splice(a + 1, 0, ...c.children), r.children[a] = l.children[0];
483
+ r.children.splice(a + 1, 0, ...c.children), r.children[a] = d.children[0];
482
484
  const p = c.children.length;
483
485
  a += p, n += p;
484
486
  } else
485
- r.children[a] = l.children[0];
487
+ r.children[a] = d.children[0];
486
488
  }
487
489
  i && r.children.splice(
488
490
  n - i.children.length,
@@ -498,7 +500,7 @@ async function mt(o, t) {
498
500
  const a = R(i, t), s = r.serializeNode(a);
499
501
  e.appendChild(s);
500
502
  }
501
- return (await j().use(it, { fragment: !0 }).use(ne, {
503
+ return (await W().use(it, { fragment: !0 }).use(se, {
502
504
  orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
503
505
  unorderedListItemBlockTypes: /* @__PURE__ */ new Set(["bulletListItem"])
504
506
  }).use(st).process(e.innerHTML)).value;
@@ -511,14 +513,21 @@ async function gt(o, t) {
511
513
  i.push(B(n.firstChild.child(a)));
512
514
  return i;
513
515
  }
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;
516
+ async function ae(o, t) {
517
+ return (await W().use(it, { fragment: !0 }).use(ie).use(Nt).use(at).use(Dt).process(await mt(o, t))).value;
516
518
  }
517
- async function se(o, t) {
518
- const e = await j().use(_t).use(at).use(Ot).use(st).process(o);
519
+ async function le(o, t) {
520
+ const e = await W().use(Ht).use(at).use(Ot).use(st).process(o);
519
521
  return gt(e.value, t);
520
522
  }
521
- const ae = E.create({
523
+ const de = "_bnEditor_ywyu7_3", ce = "_bnRoot_ywyu7_20", ue = "_defaultStyles_ywyu7_35", he = "_dragPreview_ywyu7_69", _ = {
524
+ bnEditor: de,
525
+ bnRoot: ce,
526
+ defaultStyles: ue,
527
+ dragPreview: he,
528
+ "collaboration-cursor__caret": "_collaboration-cursor__caret_ywyu7_75",
529
+ "collaboration-cursor__label": "_collaboration-cursor__label_ywyu7_86"
530
+ }, pe = E.create({
522
531
  name: "blockBackgroundColor",
523
532
  addGlobalAttributes() {
524
533
  return [
@@ -548,7 +557,7 @@ const ae = E.create({
548
557
  }
549
558
  };
550
559
  }
551
- }), de = rt.create({
560
+ }), fe = rt.create({
552
561
  name: "backgroundColor",
553
562
  addAttributes() {
554
563
  return {
@@ -577,7 +586,7 @@ const ae = E.create({
577
586
  setBackgroundColor: (o) => ({ commands: t }) => o !== "default" ? t.setMark(this.name, { color: o }) : t.unsetMark(this.name)
578
587
  };
579
588
  }
580
- }), et = new v("previous-blocks"), le = {
589
+ }), et = new v("previous-blocks"), me = {
581
590
  // Numbered List Items
582
591
  index: "index",
583
592
  // Headings
@@ -586,7 +595,7 @@ const ae = E.create({
586
595
  type: "type",
587
596
  depth: "depth",
588
597
  "depth-change": "depth-change"
589
- }, ce = () => {
598
+ }, ge = () => {
590
599
  let o;
591
600
  return new C({
592
601
  key: et,
@@ -619,17 +628,17 @@ const ae = E.create({
619
628
  apply(t, e, r, n) {
620
629
  if (e.currentTransactionOldBlockAttrs = {}, e.updatedBlocks.clear(), !t.docChanged || r.doc.eq(n.doc))
621
630
  return e;
622
- const i = {}, a = $(r.doc, (l) => l.attrs.id), s = new Map(
623
- a.map((l) => [l.node.attrs.id, l])
624
- ), d = $(n.doc, (l) => l.attrs.id);
625
- for (let l of d) {
626
- const c = s.get(l.node.attrs.id), h = c == null ? void 0 : c.node.firstChild, f = l.node.firstChild;
631
+ const i = {}, a = G(r.doc, (d) => d.attrs.id), s = new Map(
632
+ a.map((d) => [d.node.attrs.id, d])
633
+ ), l = G(n.doc, (d) => d.attrs.id);
634
+ for (let d of l) {
635
+ const c = s.get(d.node.attrs.id), h = c == null ? void 0 : c.node.firstChild, f = d.node.firstChild;
627
636
  if (c && h && f) {
628
637
  const p = {
629
638
  index: f.attrs.index,
630
639
  level: f.attrs.level,
631
640
  type: f.type.name,
632
- depth: n.doc.resolve(l.pos).depth
641
+ depth: n.doc.resolve(d.pos).depth
633
642
  };
634
643
  let m = {
635
644
  index: h.attrs.index,
@@ -637,7 +646,7 @@ const ae = E.create({
637
646
  type: h.type.name,
638
647
  depth: r.doc.resolve(c.pos).depth
639
648
  };
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));
649
+ i[d.node.attrs.id] = m, t.getMeta("numberedListIndexing") && (d.node.attrs.id in e.prevTransactionOldBlockAttrs && (m = e.prevTransactionOldBlockAttrs[d.node.attrs.id]), p.type === "numberedListItem" && (m.index = p.index)), e.currentTransactionOldBlockAttrs[d.node.attrs.id] = m, JSON.stringify(m) !== JSON.stringify(p) && (m["depth-change"] = m.depth - p.depth, e.updatedBlocks.add(d.node.attrs.id));
641
650
  }
642
651
  }
643
652
  return e.prevTransactionOldBlockAttrs = i, e;
@@ -653,31 +662,31 @@ const ae = E.create({
653
662
  if (!n.attrs.id || !e.updatedBlocks.has(n.attrs.id))
654
663
  return;
655
664
  const a = e.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
656
- for (let [l, c] of Object.entries(a))
657
- s["data-prev-" + le[l]] = c || "none";
658
- const d = D.node(i, i + n.nodeSize, {
665
+ for (let [d, c] of Object.entries(a))
666
+ s["data-prev-" + me[d]] = c || "none";
667
+ const l = D.node(i, i + n.nodeSize, {
659
668
  ...s
660
669
  });
661
- r.push(d);
670
+ r.push(l);
662
671
  }), F.create(t.doc, r);
663
672
  }
664
673
  }
665
674
  });
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 = {
675
+ }, ke = "_blockOuter_1qj38_5", ye = "_blockContent_1qj38_10", be = "_blockGroup_1qj38_30", ve = "_block_1qj38_5", Ee = "_isEmpty_1qj38_228", Ce = "_isFilter_1qj38_229", Me = "_hasAnchor_1qj38_251", b = {
676
+ blockOuter: ke,
677
+ blockContent: ye,
678
+ blockGroup: be,
679
+ block: ve,
680
+ isEmpty: Ee,
681
+ isFilter: Ce,
682
+ hasAnchor: Me
683
+ }, Be = {
675
684
  blockColor: "data-block-color",
676
685
  blockStyle: "data-block-style",
677
686
  id: "data-id",
678
687
  depth: "data-depth",
679
688
  depthChange: "data-depth-change"
680
- }, be = S.create({
689
+ }, Te = S.create({
681
690
  name: "blockContainer",
682
691
  group: "blockContainer",
683
692
  // A block always contains content, and optionally a blockGroup which contains nested blocks
@@ -698,7 +707,7 @@ const ae = E.create({
698
707
  if (typeof o == "string")
699
708
  return !1;
700
709
  const t = {};
701
- for (let [e, r] of Object.entries(ye))
710
+ for (let [e, r] of Object.entries(Be))
702
711
  o.getAttribute(r) && (t[e] = o.getAttribute(r));
703
712
  return o.getAttribute("data-node-type") === "blockContainer" ? t : !1;
704
713
  }
@@ -743,34 +752,34 @@ const ae = E.create({
743
752
  const n = g(e.doc, o);
744
753
  if (n === void 0)
745
754
  return !1;
746
- const { startPos: i, endPos: a, node: s, contentNode: d } = n;
755
+ const { startPos: i, endPos: a, node: s, contentNode: l } = n;
747
756
  if (r) {
748
757
  if (t.children !== void 0) {
749
- const l = [];
758
+ const d = [];
750
759
  for (const c of t.children)
751
- l.push(R(c, e.schema));
760
+ d.push(R(c, e.schema));
752
761
  s.childCount === 2 ? e.tr.replace(
753
- i + d.nodeSize + 1,
762
+ i + l.nodeSize + 1,
754
763
  a - 1,
755
- new P(L.from(l), 0, 0)
764
+ new P(L.from(d), 0, 0)
756
765
  ) : e.tr.insert(
757
- i + d.nodeSize,
758
- e.schema.nodes.blockGroup.create({}, l)
766
+ i + l.nodeSize,
767
+ e.schema.nodes.blockGroup.create({}, d)
759
768
  );
760
769
  }
761
770
  if (t.content !== void 0) {
762
- let l = [];
763
- typeof t.content == "string" ? l.push(e.schema.text(t.content)) : l = ht(t.content, e.schema), e.tr.replace(
771
+ let d = [];
772
+ typeof t.content == "string" ? d.push(e.schema.text(t.content)) : d = ht(t.content, e.schema), e.tr.replace(
764
773
  i + 1,
765
- i + d.nodeSize - 1,
766
- new P(L.from(l), 0, 0)
774
+ i + l.nodeSize - 1,
775
+ new P(L.from(d), 0, 0)
767
776
  );
768
777
  }
769
778
  e.tr.setNodeMarkup(
770
779
  i,
771
780
  t.type === void 0 ? void 0 : e.schema.nodes[t.type],
772
781
  {
773
- ...d.attrs,
782
+ ...l.attrs,
774
783
  ...t.props
775
784
  }
776
785
  ), e.tr.setNodeMarkup(i - 1, void 0, {
@@ -804,18 +813,18 @@ const ae = E.create({
804
813
  const i = g(
805
814
  t.doc,
806
815
  o + 1
807
- ), { node: a, contentNode: s, startPos: d, endPos: l, depth: c } = i;
816
+ ), { node: a, contentNode: s, startPos: l, endPos: d, depth: c } = i;
808
817
  if (a.childCount === 2) {
809
818
  const p = t.doc.resolve(
810
- d + s.nodeSize + 1
811
- ), m = t.doc.resolve(l - 1), y = p.blockRange(m);
819
+ l + s.nodeSize + 1
820
+ ), m = t.doc.resolve(d - 1), y = p.blockRange(m);
812
821
  e && t.tr.lift(y, c - 1);
813
822
  }
814
823
  let h = o - 1, f = g(t.doc, h);
815
824
  for (; f.numChildBlocks > 0; )
816
825
  if (h--, f = g(t.doc, h), f === void 0)
817
826
  return !1;
818
- return e && (t.tr.deleteRange(d, d + s.nodeSize), t.tr.insertText(s.textContent, h - 1), t.tr.setSelection(
827
+ return e && (t.tr.deleteRange(l, l + s.nodeSize), t.tr.insertText(s.textContent, h - 1), t.tr.setSelection(
819
828
  new Q(t.doc.resolve(h - 1))
820
829
  )), !0;
821
830
  },
@@ -825,14 +834,14 @@ const ae = E.create({
825
834
  const n = g(e.doc, o);
826
835
  if (n === void 0)
827
836
  return !1;
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;
837
+ const { contentNode: i, contentType: a, startPos: s, endPos: l, depth: d } = n, c = e.doc.cut(s + 1, o), h = e.doc.cut(o, l - 1), f = e.schema.nodes.blockContainer.createAndFill(), p = l + 1, m = p + 2;
829
838
  return r && (e.tr.insert(p, f), e.tr.replace(
830
839
  m,
831
840
  m + 1,
832
841
  h.content.size > 0 ? new P(
833
842
  L.from(h),
834
- l + 2,
835
- l + 2
843
+ d + 2,
844
+ d + 2
836
845
  ) : void 0
837
846
  ), t && e.tr.setBlockType(
838
847
  m,
@@ -843,18 +852,18 @@ const ae = E.create({
843
852
  new Q(e.doc.resolve(m))
844
853
  ), e.tr.replace(
845
854
  s + 1,
846
- d - 1,
855
+ l - 1,
847
856
  c.content.size > 0 ? new P(
848
857
  L.from(c),
849
- l + 2,
850
- l + 2
858
+ d + 2,
859
+ d + 2
851
860
  ) : void 0
852
861
  )), !0;
853
862
  }
854
863
  };
855
864
  },
856
865
  addProseMirrorPlugins() {
857
- return [ce()];
866
+ return [ge()];
858
867
  },
859
868
  addKeyboardShortcuts() {
860
869
  return {
@@ -882,8 +891,8 @@ const ae = E.create({
882
891
  const { depth: n, startPos: i } = g(
883
892
  r.doc,
884
893
  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;
894
+ ), a = r.selection.$anchor.parentOffset === 0, s = r.selection.anchor === r.selection.head, l = i === 2, d = i - 1;
895
+ return !l && a && s && n === 2 ? e.BNMergeBlocks(d) : !1;
887
896
  })
888
897
  ]),
889
898
  Enter: () => this.editor.commands.first(({ commands: e }) => [
@@ -893,8 +902,8 @@ const ae = E.create({
893
902
  const { node: n, depth: i } = g(
894
903
  r.doc,
895
904
  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;
905
+ ), a = r.selection.$anchor.parentOffset === 0, s = r.selection.anchor === r.selection.head, l = n.textContent.length === 0, d = i > 2;
906
+ return a && s && l && d ? e.liftListItem("blockContainer") : !1;
898
907
  }),
899
908
  // Creates a new block and moves the selection to it if the current one is empty, while the selection is also
900
909
  // empty & at the start of the block.
@@ -902,8 +911,8 @@ const ae = E.create({
902
911
  const { node: i, endPos: a } = g(
903
912
  r.doc,
904
913
  r.selection.from
905
- ), s = r.selection.$anchor.parentOffset === 0, d = r.selection.anchor === r.selection.head, l = i.textContent.length === 0;
906
- if (s && d && l) {
914
+ ), s = r.selection.$anchor.parentOffset === 0, l = r.selection.anchor === r.selection.head, d = i.textContent.length === 0;
915
+ if (s && l && d) {
907
916
  const c = a + 1, h = c + 2;
908
917
  return n().BNCreateBlock(c).setTextSelection(h).run(), !0;
909
918
  }
@@ -954,7 +963,7 @@ const ae = E.create({
954
963
  })
955
964
  };
956
965
  }
957
- }), ve = S.create({
966
+ }), we = S.create({
958
967
  name: "blockGroup",
959
968
  group: "blockGroup",
960
969
  content: "blockContainer+",
@@ -981,7 +990,7 @@ const ae = E.create({
981
990
  0
982
991
  ];
983
992
  }
984
- }), Ee = S.create({
993
+ }), Se = S.create({
985
994
  name: "paragraph",
986
995
  group: "blockContent",
987
996
  content: "inline*",
@@ -1004,7 +1013,7 @@ const ae = E.create({
1004
1013
  ["p", 0]
1005
1014
  ];
1006
1015
  }
1007
- }), Ce = S.create({
1016
+ }), xe = S.create({
1008
1017
  name: "heading",
1009
1018
  group: "blockContent",
1010
1019
  content: "inline*",
@@ -1022,7 +1031,7 @@ const ae = E.create({
1022
1031
  },
1023
1032
  addInputRules() {
1024
1033
  return [
1025
- ...["1", "2", "3"].map((o) => new W({
1034
+ ...["1", "2", "3"].map((o) => new j({
1026
1035
  find: new RegExp(`^(#{${parseInt(o)}})\\s$`),
1027
1036
  handler: ({ state: t, chain: e, range: r }) => {
1028
1037
  e().BNUpdateBlock(t.selection.from, {
@@ -1083,14 +1092,14 @@ const ae = E.create({
1083
1092
  a.command(() => t.textContent.length > 0 ? (i().deleteSelection().BNSplitBlock(n.selection.from, !0).run(), !0) : !1)
1084
1093
  )
1085
1094
  ]);
1086
- }, Me = S.create({
1095
+ }, Ie = S.create({
1087
1096
  name: "bulletListItem",
1088
1097
  group: "blockContent",
1089
1098
  content: "inline*",
1090
1099
  addInputRules() {
1091
1100
  return [
1092
1101
  // Creates an unordered list when starting with "-", "+", or "*".
1093
- new W({
1102
+ new j({
1094
1103
  find: new RegExp("^[-+*]\\s$"),
1095
1104
  handler: ({ state: o, chain: t, range: e }) => {
1096
1105
  t().BNUpdateBlock(o.selection.from, {
@@ -1143,8 +1152,8 @@ const ae = E.create({
1143
1152
  ["p", 0]
1144
1153
  ];
1145
1154
  }
1146
- }), Be = new v("numbered-list-indexing"), Te = () => new C({
1147
- key: Be,
1155
+ }), Pe = new v("numbered-list-indexing"), Le = () => new C({
1156
+ key: Pe,
1148
1157
  appendTransaction: (o, t, e) => {
1149
1158
  const r = e.tr;
1150
1159
  r.setMeta("numberedListIndexing", !0);
@@ -1152,14 +1161,14 @@ const ae = E.create({
1152
1161
  return e.doc.descendants((i, a) => {
1153
1162
  if (i.type.name === "blockContainer" && i.firstChild.type.name === "numberedListItem") {
1154
1163
  let s = "1";
1155
- const d = a === 1, l = g(r.doc, a + 1);
1156
- if (l === void 0)
1164
+ const l = a === 1, d = g(r.doc, a + 1);
1165
+ if (d === void 0)
1157
1166
  return;
1158
- if (!d) {
1167
+ if (!l) {
1159
1168
  const f = g(r.doc, a - 2);
1160
1169
  if (f === void 0)
1161
1170
  return;
1162
- if (!(l.depth !== f.depth)) {
1171
+ if (!(d.depth !== f.depth)) {
1163
1172
  const m = f.contentNode;
1164
1173
  if (f.contentType.name === "numberedListItem") {
1165
1174
  const z = m.attrs.index;
@@ -1167,13 +1176,13 @@ const ae = E.create({
1167
1176
  }
1168
1177
  }
1169
1178
  }
1170
- l.contentNode.attrs.index !== s && (n = !0, r.setNodeMarkup(a + 1, void 0, {
1179
+ d.contentNode.attrs.index !== s && (n = !0, r.setNodeMarkup(a + 1, void 0, {
1171
1180
  index: s
1172
1181
  }));
1173
1182
  }
1174
1183
  }), n ? r : null;
1175
1184
  }
1176
- }), we = S.create({
1185
+ }), _e = S.create({
1177
1186
  name: "numberedListItem",
1178
1187
  group: "blockContent",
1179
1188
  content: "inline*",
@@ -1191,7 +1200,7 @@ const ae = E.create({
1191
1200
  addInputRules() {
1192
1201
  return [
1193
1202
  // Creates an ordered list when starting with "1.".
1194
- new W({
1203
+ new j({
1195
1204
  find: new RegExp("^1\\.\\s$"),
1196
1205
  handler: ({ state: o, chain: t, range: e }) => {
1197
1206
  t().BNUpdateBlock(o.selection.from, {
@@ -1208,7 +1217,7 @@ const ae = E.create({
1208
1217
  };
1209
1218
  },
1210
1219
  addProseMirrorPlugins() {
1211
- return [Te()];
1220
+ return [Le()];
1212
1221
  },
1213
1222
  parseHTML() {
1214
1223
  return [
@@ -1251,24 +1260,19 @@ const ae = E.create({
1251
1260
  ["p", 0]
1252
1261
  ];
1253
1262
  }
1254
- }), Se = [
1255
- Ee,
1256
- Ce,
1257
- Me,
1263
+ }), Ae = [
1264
+ Se,
1265
+ xe,
1266
+ Ie,
1267
+ _e,
1268
+ Te,
1258
1269
  we,
1259
- be,
1260
- ve,
1261
1270
  S.create({
1262
1271
  name: "doc",
1263
1272
  topNode: !0,
1264
1273
  content: "blockGroup"
1265
1274
  })
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(
1275
+ ], Ne = wt(
1272
1276
  (o) => o.type.name === "blockContainer"
1273
1277
  );
1274
1278
  function q() {
@@ -1312,10 +1316,10 @@ class He {
1312
1316
  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
1317
  !i && !s && !a || (this.pluginState = a ? r : n, (a || !this.editor.isEditable) && (this.suggestionsMenu.hide(), this.suggestionsMenu.element.removeEventListener(
1314
1318
  "mousedown",
1315
- (d) => d.preventDefault()
1319
+ (l) => l.preventDefault()
1316
1320
  )), s && this.suggestionsMenu.render(this.getDynamicParams(), !1), i && this.editor.isEditable && (this.suggestionsMenu.render(this.getDynamicParams(), !0), this.suggestionsMenu.element.addEventListener(
1317
1321
  "mousedown",
1318
- (d) => d.preventDefault()
1322
+ (l) => l.preventDefault()
1319
1323
  )));
1320
1324
  }
1321
1325
  destroy() {
@@ -1337,7 +1341,7 @@ class He {
1337
1341
  };
1338
1342
  }
1339
1343
  }
1340
- function Ne({
1344
+ function Oe({
1341
1345
  pluginKey: o,
1342
1346
  editor: t,
1343
1347
  defaultTriggerCharacter: e,
@@ -1356,8 +1360,8 @@ function Ne({
1356
1360
  view: (s) => new He({
1357
1361
  editor: t,
1358
1362
  pluginKey: o,
1359
- onSelectItem: (d) => {
1360
- a(s), n(d);
1363
+ onSelectItem: (l) => {
1364
+ a(s), n(l);
1361
1365
  },
1362
1366
  suggestionsMenuFactory: r
1363
1367
  }),
@@ -1367,10 +1371,10 @@ function Ne({
1367
1371
  return q();
1368
1372
  },
1369
1373
  // Apply changes to the plugin state from an editor transaction.
1370
- apply(s, d, l, c) {
1374
+ apply(s, l, d, c) {
1371
1375
  var f, p, m, y;
1372
1376
  if (s.getMeta("orderedListIndexing") !== void 0)
1373
- return d;
1377
+ return l;
1374
1378
  if ((f = s.getMeta(o)) != null && f.activate)
1375
1379
  return {
1376
1380
  active: !0,
@@ -1383,41 +1387,41 @@ function Ne({
1383
1387
  notFoundCount: 0,
1384
1388
  decorationId: `id_${Math.floor(Math.random() * 4294967295)}`
1385
1389
  };
1386
- if (!d.active)
1387
- return d;
1388
- const h = { ...d };
1390
+ if (!l.active)
1391
+ return l;
1392
+ const h = { ...l };
1389
1393
  if (h.items = i(
1390
- c.doc.textBetween(d.queryStartPos, c.selection.from)
1394
+ c.doc.textBetween(l.queryStartPos, c.selection.from)
1391
1395
  ), h.notFoundCount = 0, h.items.length === 0 && (h.notFoundCount = Math.max(
1392
1396
  0,
1393
- d.notFoundCount + (c.selection.from - l.selection.from)
1397
+ l.notFoundCount + (c.selection.from - d.selection.from)
1394
1398
  )), // Highlighting text should hide the menu.
1395
1399
  c.selection.from !== c.selection.to || // Transactions with plugin metadata {deactivate: true} should hide the menu.
1396
1400
  (m = s.getMeta(o)) != null && m.deactivate || // Certain mouse events should hide the menu.
1397
1401
  // TODO: Change to global mousedown listener.
1398
1402
  s.getMeta("focus") || s.getMeta("blur") || s.getMeta("pointer") || // Moving the caret before the character which triggered the menu should hide it.
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
1403
+ l.active && c.selection.from < l.queryStartPos || // Entering more than 3 characters, after the last query that matched with at least 1 menu item, should hide
1400
1404
  // the menu.
1401
1405
  h.notFoundCount > 3)
1402
1406
  return q();
1403
1407
  if (((y = s.getMeta(o)) == null ? void 0 : y.selectedItemIndexChanged) !== void 0) {
1404
1408
  let k = s.getMeta(o).selectedItemIndexChanged;
1405
- k < 0 ? k = d.items.length - 1 : k >= d.items.length && (k = 0), h.keyboardHoveredItemIndex = k;
1409
+ k < 0 ? k = l.items.length - 1 : k >= l.items.length && (k = 0), h.keyboardHoveredItemIndex = k;
1406
1410
  }
1407
1411
  return h;
1408
1412
  }
1409
1413
  },
1410
1414
  props: {
1411
- handleKeyDown(s, d) {
1412
- const l = this.getState(s.state).active;
1413
- if (d.key === e && !l)
1415
+ handleKeyDown(s, l) {
1416
+ const d = this.getState(s.state).active;
1417
+ if (l.key === e && !d)
1414
1418
  return s.dispatch(
1415
1419
  s.state.tr.insertText(e).scrollIntoView().setMeta(o, {
1416
1420
  activate: !0,
1417
1421
  triggerCharacter: e
1418
1422
  })
1419
1423
  ), !0;
1420
- if (!l)
1424
+ if (!d)
1421
1425
  return !1;
1422
1426
  const {
1423
1427
  triggerCharacter: c,
@@ -1425,21 +1429,21 @@ function Ne({
1425
1429
  items: f,
1426
1430
  keyboardHoveredItemIndex: p
1427
1431
  } = o.getState(s.state);
1428
- return d.key === "ArrowUp" ? (s.dispatch(
1432
+ return l.key === "ArrowUp" ? (s.dispatch(
1429
1433
  s.state.tr.setMeta(o, {
1430
1434
  selectedItemIndexChanged: p - 1
1431
1435
  })
1432
- ), !0) : d.key === "ArrowDown" ? (s.dispatch(
1436
+ ), !0) : l.key === "ArrowDown" ? (s.dispatch(
1433
1437
  s.state.tr.setMeta(o, {
1434
1438
  selectedItemIndexChanged: p + 1
1435
1439
  })
1436
- ), !0) : d.key === "Enter" ? (a(s), t._tiptapEditor.chain().focus().deleteRange({
1440
+ ), !0) : l.key === "Enter" ? (a(s), t._tiptapEditor.chain().focus().deleteRange({
1437
1441
  from: h - c.length,
1438
1442
  to: t._tiptapEditor.state.selection.from
1439
1443
  }).run(), n({
1440
1444
  item: f[p],
1441
1445
  editor: t
1442
- }), !0) : d.key === "Escape" ? (a(s), !0) : !1;
1446
+ }), !0) : l.key === "Escape" ? (a(s), !0) : !1;
1443
1447
  },
1444
1448
  // Hides menu in cases where mouse click does not cause an editor state change.
1445
1449
  handleClick(s) {
@@ -1447,11 +1451,11 @@ function Ne({
1447
1451
  },
1448
1452
  // Setup decorator on the currently active suggestion.
1449
1453
  decorations(s) {
1450
- const { active: d, decorationId: l, queryStartPos: c, triggerCharacter: h } = this.getState(s);
1451
- if (!d)
1454
+ const { active: l, decorationId: d, queryStartPos: c, triggerCharacter: h } = this.getState(s);
1455
+ if (!l)
1452
1456
  return null;
1453
1457
  if (h === "") {
1454
- const f = Ae(s.selection);
1458
+ const f = Ne(s.selection);
1455
1459
  if (f)
1456
1460
  return F.create(s.doc, [
1457
1461
  D.node(
@@ -1460,7 +1464,7 @@ function Ne({
1460
1464
  {
1461
1465
  nodeName: "span",
1462
1466
  class: "suggestion-decorator",
1463
- "data-decoration-id": l
1467
+ "data-decoration-id": d
1464
1468
  }
1465
1469
  )
1466
1470
  ]);
@@ -1472,7 +1476,7 @@ function Ne({
1472
1476
  {
1473
1477
  nodeName: "span",
1474
1478
  class: "suggestion-decorator",
1475
- "data-decoration-id": l
1479
+ "data-decoration-id": d
1476
1480
  }
1477
1481
  )
1478
1482
  ]);
@@ -1480,7 +1484,7 @@ function Ne({
1480
1484
  }
1481
1485
  });
1482
1486
  }
1483
- const V = new v("suggestions-slash-commands"), _e = E.create({
1487
+ const V = new v("suggestions-slash-commands"), De = E.create({
1484
1488
  name: "slash-command",
1485
1489
  addOptions() {
1486
1490
  return {
@@ -1494,7 +1498,7 @@ const V = new v("suggestions-slash-commands"), _e = E.create({
1494
1498
  throw new Error("required args not defined for SlashMenuExtension");
1495
1499
  const o = this.options.commands;
1496
1500
  return [
1497
- Ne({
1501
+ Oe({
1498
1502
  pluginKey: V,
1499
1503
  editor: this.options.editor,
1500
1504
  defaultTriggerCharacter: "/",
@@ -1507,7 +1511,7 @@ const V = new v("suggestions-slash-commands"), _e = E.create({
1507
1511
  ];
1508
1512
  }
1509
1513
  });
1510
- class A extends G {
1514
+ class A extends $ {
1511
1515
  constructor(e, r) {
1512
1516
  super(e, r);
1513
1517
  u(this, "nodes");
@@ -1533,7 +1537,7 @@ class A extends G {
1533
1537
  }
1534
1538
  map(e, r) {
1535
1539
  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(
1540
+ return i.deleted ? $.near(e.resolve(n.pos)) : n.deleted ? $.near(e.resolve(i.pos)) : new A(
1537
1541
  e.resolve(n.pos),
1538
1542
  e.resolve(i.pos)
1539
1543
  );
@@ -1542,7 +1546,7 @@ class A extends G {
1542
1546
  return { type: "node", anchor: this.anchor, head: this.head };
1543
1547
  }
1544
1548
  }
1545
- const Oe = Kt.__serializeForClipboard;
1549
+ const Fe = Jt.__serializeForClipboard;
1546
1550
  let T;
1547
1551
  function yt(o, t) {
1548
1552
  var n;
@@ -1559,7 +1563,7 @@ function yt(o, t) {
1559
1563
  return { node: r, id: r.getAttribute("data-id") };
1560
1564
  }
1561
1565
  }
1562
- function De(o, t) {
1566
+ function Re(o, t) {
1563
1567
  let e = yt(o, t);
1564
1568
  if (e && e.node.nodeType === 1) {
1565
1569
  const r = t.docView;
@@ -1568,12 +1572,12 @@ function De(o, t) {
1568
1572
  }
1569
1573
  return null;
1570
1574
  }
1571
- function Fe(o, t) {
1575
+ function ze(o, t) {
1572
1576
  let e, r;
1573
1577
  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
1578
  if (n && i) {
1575
- const s = o.$from.start(a - 1), d = o.$to.end(a - 1);
1576
- e = t.resolve(s - 1).pos, r = t.resolve(d + 1).pos;
1579
+ const s = o.$from.start(a - 1), l = o.$to.end(a - 1);
1580
+ e = t.resolve(s - 1).pos, r = t.resolve(l + 1).pos;
1577
1581
  } else
1578
1582
  e = o.from, r = o.to;
1579
1583
  return { from: e, to: r };
@@ -1592,15 +1596,15 @@ function ot(o, t, e = t) {
1592
1596
  for (let c = n.childElementCount - 1; c >= 0; c--)
1593
1597
  (c > s || c < a) && r.removeChild(r.children[c]);
1594
1598
  bt(), T = r;
1595
- const l = o.dom.className.split(" ").filter(
1599
+ const d = o.dom.className.split(" ").filter(
1596
1600
  (c) => !c.includes("bn") && !c.includes("ProseMirror") && !c.includes("editor")
1597
1601
  ).join(" ");
1598
- T.className = T.className + " " + O.dragPreview + " " + l, document.body.appendChild(T);
1602
+ T.className = T.className + " " + _.dragPreview + " " + d, document.body.appendChild(T);
1599
1603
  }
1600
1604
  function bt() {
1601
1605
  T !== void 0 && (document.body.removeChild(T), T = void 0);
1602
1606
  }
1603
- function Re(o, t) {
1607
+ function Ue(o, t) {
1604
1608
  if (!o.dataTransfer)
1605
1609
  return;
1606
1610
  const e = t.dom.getBoundingClientRect();
@@ -1608,19 +1612,19 @@ function Re(o, t) {
1608
1612
  left: e.left + e.width / 2,
1609
1613
  // take middle of editor
1610
1614
  top: o.clientY
1611
- }, n = De(r, t);
1615
+ }, n = Re(r, t);
1612
1616
  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))
1617
+ const i = t.state.selection, a = t.state.doc, { from: s, to: l } = ze(i, a), d = s <= n && n < l, c = i.$anchor.node() !== i.$head.node() || i instanceof A;
1618
+ d && c ? (t.dispatch(
1619
+ t.state.tr.setSelection(A.create(a, s, l))
1620
+ ), ot(t, s, l)) : (t.dispatch(
1621
+ t.state.tr.setSelection(_t.create(t.state.doc, n))
1618
1622
  ), ot(t, n));
1619
- let h = t.state.selection.content(), { dom: f, text: p } = Oe(t, h);
1623
+ let h = t.state.selection.content(), { dom: f, text: p } = Fe(t, h);
1620
1624
  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 };
1621
1625
  }
1622
1626
  }
1623
- class ze {
1627
+ class $e {
1624
1628
  constructor({
1625
1629
  tiptapEditor: t,
1626
1630
  editor: e,
@@ -1724,8 +1728,8 @@ class ze {
1724
1728
  return;
1725
1729
  const { contentNode: i, endPos: a } = n;
1726
1730
  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();
1731
+ const s = a + 1, l = s + 2;
1732
+ this.ttEditor.chain().BNCreateBlock(s).BNUpdateBlock(l, { type: "paragraph", props: {} }).setTextSelection(l).run();
1729
1733
  } else
1730
1734
  this.ttEditor.commands.setTextSelection(a);
1731
1735
  this.ttEditor.view.focus(), this.ttEditor.view.dispatch(
@@ -1741,7 +1745,7 @@ class ze {
1741
1745
  editor: this.editor,
1742
1746
  addBlock: () => this.addBlock(),
1743
1747
  blockDragStart: (t) => {
1744
- this.isDragging = !0, Re(t, this.ttEditor.view);
1748
+ this.isDragging = !0, Ue(t, this.ttEditor.view);
1745
1749
  },
1746
1750
  blockDragEnd: () => bt(),
1747
1751
  freezeMenu: () => {
@@ -1765,15 +1769,15 @@ class ze {
1765
1769
  };
1766
1770
  }
1767
1771
  }
1768
- const Ue = (o) => new C({
1772
+ const Ge = (o) => new C({
1769
1773
  key: new v("DraggableBlocksPlugin"),
1770
- view: () => new ze({
1774
+ view: () => new $e({
1771
1775
  tiptapEditor: o.tiptapEditor,
1772
1776
  editor: o.editor,
1773
1777
  blockMenuFactory: o.blockSideMenuFactory,
1774
1778
  horizontalPosAnchoredAtRoot: !0
1775
1779
  })
1776
- }), Ge = E.create({
1780
+ }), qe = E.create({
1777
1781
  name: "DraggableBlocksExtension",
1778
1782
  priority: 1e3,
1779
1783
  // Need to be high, in order to hide menu when typing slash
@@ -1783,7 +1787,7 @@ const Ue = (o) => new C({
1783
1787
  "UI Element factory not defined for DraggableBlocksExtension"
1784
1788
  );
1785
1789
  return [
1786
- Ue({
1790
+ Ge({
1787
1791
  tiptapEditor: this.editor,
1788
1792
  editor: this.options.editor,
1789
1793
  blockSideMenuFactory: this.options.blockSideMenuFactory
@@ -1791,7 +1795,7 @@ const Ue = (o) => new C({
1791
1795
  ];
1792
1796
  }
1793
1797
  });
1794
- class $e {
1798
+ class je {
1795
1799
  constructor({
1796
1800
  editor: t,
1797
1801
  tiptapEditor: e,
@@ -1808,8 +1812,8 @@ class $e {
1808
1812
  u(this, "toolbarIsOpen", !1);
1809
1813
  u(this, "prevWasEditable", null);
1810
1814
  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);
1815
+ const { doc: i, selection: a } = e, { empty: s } = a, l = !i.textBetween(r, n).length && St(e.selection);
1816
+ return !(!t.hasFocus() || s || l);
1813
1817
  });
1814
1818
  u(this, "viewMousedownHandler", () => {
1815
1819
  this.preventShow = !0;
@@ -1844,12 +1848,12 @@ class $e {
1844
1848
  if ((this.prevWasEditable === null || this.prevWasEditable === this.editor.isEditable) && (n || s))
1845
1849
  return;
1846
1850
  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, {
1851
+ const { ranges: l } = a, d = Math.min(...l.map((p) => p.$from.pos)), c = Math.max(...l.map((p) => p.$to.pos)), h = (f = this.shouldShow) == null ? void 0 : f.call(this, {
1848
1852
  editor: this.editor,
1849
1853
  view: t,
1850
1854
  state: r,
1851
1855
  oldState: e,
1852
- from: l,
1856
+ from: d,
1853
1857
  to: c
1854
1858
  });
1855
1859
  if (this.editor.isEditable && !this.toolbarIsOpen && !this.preventShow && (h || this.preventHide)) {
@@ -1894,10 +1898,10 @@ class $e {
1894
1898
  };
1895
1899
  }
1896
1900
  }
1897
- const qe = (o) => new C({
1901
+ const We = (o) => new C({
1898
1902
  key: new v("FormattingToolbarPlugin"),
1899
- view: (t) => new $e({ view: t, ...o })
1900
- }), We = E.create({
1903
+ view: (t) => new je({ view: t, ...o })
1904
+ }), Ye = E.create({
1901
1905
  name: "FormattingToolbarExtension",
1902
1906
  addProseMirrorPlugins() {
1903
1907
  if (!this.options.formattingToolbarFactory || !this.options.editor)
@@ -1905,7 +1909,7 @@ const qe = (o) => new C({
1905
1909
  "required args not defined for FormattingToolbarExtension"
1906
1910
  );
1907
1911
  return [
1908
- qe({
1912
+ We({
1909
1913
  tiptapEditor: this.editor,
1910
1914
  editor: this.options.editor,
1911
1915
  formattingToolbarFactory: this.options.formattingToolbarFactory,
@@ -1913,8 +1917,8 @@ const qe = (o) => new C({
1913
1917
  })
1914
1918
  ];
1915
1919
  }
1916
- }), je = new v("HyperlinkToolbarPlugin");
1917
- class Ye {
1920
+ }), Ke = new v("HyperlinkToolbarPlugin");
1921
+ class Ve {
1918
1922
  constructor({ editor: t, hyperlinkToolbarFactory: e }) {
1919
1923
  u(this, "editor");
1920
1924
  u(this, "hyperlinkToolbar");
@@ -2041,13 +2045,13 @@ class Ye {
2041
2045
  };
2042
2046
  }
2043
2047
  }
2044
- const Ke = (o, t) => new C({
2045
- key: je,
2046
- view: () => new Ye({
2048
+ const Je = (o, t) => new C({
2049
+ key: Ke,
2050
+ view: () => new Ve({
2047
2051
  editor: o,
2048
2052
  hyperlinkToolbarFactory: t.hyperlinkToolbarFactory
2049
2053
  })
2050
- }), Ve = dt.extend({
2054
+ }), Xe = lt.extend({
2051
2055
  priority: 500,
2052
2056
  addProseMirrorPlugins() {
2053
2057
  var o;
@@ -2055,12 +2059,12 @@ const Ke = (o, t) => new C({
2055
2059
  throw new Error("UI Element factory not defined for HyperlinkMark");
2056
2060
  return [
2057
2061
  ...((o = this.parent) == null ? void 0 : o.call(this)) || [],
2058
- Ke(this.editor, {
2062
+ Je(this.editor, {
2059
2063
  hyperlinkToolbarFactory: this.options.hyperlinkToolbarFactory
2060
2064
  })
2061
2065
  ];
2062
2066
  }
2063
- }), Je = new v("blocknote-placeholder"), Xe = E.create({
2067
+ }), Qe = new v("blocknote-placeholder"), Ze = E.create({
2064
2068
  name: "placeholder",
2065
2069
  addOptions() {
2066
2070
  return {
@@ -2077,17 +2081,17 @@ const Ke = (o, t) => new C({
2077
2081
  addProseMirrorPlugins() {
2078
2082
  return [
2079
2083
  new C({
2080
- key: Je,
2084
+ key: Qe,
2081
2085
  props: {
2082
2086
  decorations: (o) => {
2083
2087
  const { doc: t, selection: e } = o, r = V.getState(o), n = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = e, a = [];
2084
2088
  if (n)
2085
- return t.descendants((s, d) => {
2086
- const l = i >= d && i <= d + s.nodeSize, c = !s.isLeaf && !s.childCount;
2087
- if ((l || !this.options.showOnlyCurrent) && c) {
2089
+ return t.descendants((s, l) => {
2090
+ const d = i >= l && i <= l + s.nodeSize, c = !s.isLeaf && !s.childCount;
2091
+ if ((d || !this.options.showOnlyCurrent) && c) {
2088
2092
  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);
2090
- const f = D.node(d, d + s.nodeSize, {
2093
+ this.editor.isEmpty && h.push(this.options.emptyEditorClass), d && h.push(this.options.hasAnchorClass), (r == null ? void 0 : r.triggerCharacter) === "" && (r != null && r.active) && h.push(this.options.isFilterClass);
2094
+ const f = D.node(l, l + s.nodeSize, {
2091
2095
  class: h.join(" ")
2092
2096
  });
2093
2097
  a.push(f);
@@ -2100,12 +2104,12 @@ const Ke = (o, t) => new C({
2100
2104
  ];
2101
2105
  }
2102
2106
  });
2103
- class Qe {
2107
+ class to {
2104
2108
  constructor(t, e) {
2105
2109
  this.name = t, this.match = e;
2106
2110
  }
2107
2111
  }
2108
- class x extends Qe {
2112
+ class x extends to {
2109
2113
  /**
2110
2114
  * Constructs a new slash-command.
2111
2115
  *
@@ -2123,7 +2127,7 @@ function I(o, t) {
2123
2127
  const e = o.getTextCursorPosition().block;
2124
2128
  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));
2125
2129
  }
2126
- const Ze = [
2130
+ const eo = [
2127
2131
  // Command for creating a level 1 heading
2128
2132
  new x(
2129
2133
  "Heading",
@@ -2266,7 +2270,7 @@ const Ze = [
2266
2270
  // TableIcon,
2267
2271
  // "Used to create a simple table"
2268
2272
  // ),
2269
- ], to = E.create({
2273
+ ], oo = E.create({
2270
2274
  name: "textAlignment",
2271
2275
  addGlobalAttributes() {
2272
2276
  return [
@@ -2304,7 +2308,7 @@ const Ze = [
2304
2308
  }
2305
2309
  };
2306
2310
  }
2307
- }), eo = E.create({
2311
+ }), ro = E.create({
2308
2312
  name: "blockTextColor",
2309
2313
  addGlobalAttributes() {
2310
2314
  return [
@@ -2330,7 +2334,7 @@ const Ze = [
2330
2334
  }
2331
2335
  };
2332
2336
  }
2333
- }), oo = rt.create({
2337
+ }), no = rt.create({
2334
2338
  name: "textColor",
2335
2339
  addAttributes() {
2336
2340
  return {
@@ -2359,7 +2363,7 @@ const Ze = [
2359
2363
  setTextColor: (o) => ({ commands: t }) => o !== "default" ? t.setMark(this.name, { color: o }) : t.unsetMark(this.name)
2360
2364
  };
2361
2365
  }
2362
- }), ro = E.create({
2366
+ }), io = E.create({
2363
2367
  name: "trailingNode",
2364
2368
  addProseMirrorPlugins() {
2365
2369
  const o = new v(this.name);
@@ -2367,11 +2371,11 @@ const Ze = [
2367
2371
  new C({
2368
2372
  key: o,
2369
2373
  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;
2374
+ const { doc: n, tr: i, schema: a } = r, s = o.getState(r), l = n.content.size - 2, d = a.nodes.blockContainer, c = a.nodes.paragraph;
2371
2375
  if (s)
2372
2376
  return i.insert(
2373
- d,
2374
- l.create(void 0, c.create())
2377
+ l,
2378
+ d.create(void 0, c.create())
2375
2379
  );
2376
2380
  },
2377
2381
  state: {
@@ -2391,17 +2395,17 @@ const Ze = [
2391
2395
  })
2392
2396
  ];
2393
2397
  }
2394
- }), no = (o) => {
2398
+ }), so = (o) => {
2395
2399
  const t = [
2396
- H.ClipboardTextSerializer,
2397
- H.Commands,
2398
- H.Editable,
2399
- H.FocusEvents,
2400
- H.Tabindex,
2400
+ N.ClipboardTextSerializer,
2401
+ N.Commands,
2402
+ N.Editable,
2403
+ N.FocusEvents,
2404
+ N.Tabindex,
2401
2405
  // DevTools,
2402
- Ut,
2406
+ Gt,
2403
2407
  // DropCursor,
2404
- Xe.configure({
2408
+ Ze.configure({
2405
2409
  emptyNodeClass: b.isEmpty,
2406
2410
  hasAnchorClass: b.hasAnchor,
2407
2411
  isFilterClass: b.isFilter,
@@ -2411,71 +2415,92 @@ const Ze = [
2411
2415
  Y.configure({
2412
2416
  types: ["blockContainer"]
2413
2417
  }),
2414
- Gt,
2418
+ qt,
2415
2419
  // Comments,
2416
2420
  // basics:
2417
- jt,
2421
+ Kt,
2418
2422
  // marks:
2419
2423
  Ft,
2420
2424
  Rt,
2421
- qt,
2422
2425
  Wt,
2423
2426
  Yt,
2427
+ Vt,
2428
+ no,
2429
+ ro,
2430
+ fe,
2431
+ pe,
2424
2432
  oo,
2425
- eo,
2426
- de,
2427
- ae,
2428
- to,
2429
2433
  // custom blocks:
2430
- ...Se,
2431
- zt.configure({ width: 5, color: "#ddeeff" }),
2432
- $t,
2434
+ ...Ae,
2435
+ $t.configure({ width: 5, color: "#ddeeff" }),
2433
2436
  // This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
2434
2437
  // should be handled before Enter handlers in other components like splitListItem
2435
- ro
2438
+ io
2436
2439
  ];
2440
+ if (o.collaboration) {
2441
+ t.push(
2442
+ zt.configure({
2443
+ fragment: o.collaboration.fragment
2444
+ })
2445
+ );
2446
+ const e = (r) => {
2447
+ const n = document.createElement("span");
2448
+ n.classList.add(_["collaboration-cursor__caret"]), n.setAttribute("style", `border-color: ${r.color}`);
2449
+ const i = document.createElement("span");
2450
+ i.classList.add(_["collaboration-cursor__label"]), i.setAttribute("style", `background-color: ${r.color}`), i.insertBefore(document.createTextNode(r.name), null);
2451
+ const a = document.createTextNode("⁠"), s = document.createTextNode("⁠");
2452
+ return n.insertBefore(a, null), n.insertBefore(i, null), n.insertBefore(s, null), n;
2453
+ };
2454
+ t.push(
2455
+ Ut.configure({
2456
+ user: o.collaboration.user,
2457
+ render: o.collaboration.renderCursor || e,
2458
+ provider: o.collaboration.provider
2459
+ })
2460
+ );
2461
+ } else
2462
+ t.push(jt);
2437
2463
  return o.uiFactories.blockSideMenuFactory && t.push(
2438
- Ge.configure({
2464
+ qe.configure({
2439
2465
  editor: o.editor,
2440
2466
  blockSideMenuFactory: o.uiFactories.blockSideMenuFactory
2441
2467
  })
2442
2468
  ), o.uiFactories.formattingToolbarFactory && t.push(
2443
- We.configure({
2469
+ Ye.configure({
2444
2470
  editor: o.editor,
2445
2471
  formattingToolbarFactory: o.uiFactories.formattingToolbarFactory
2446
2472
  })
2447
2473
  ), o.uiFactories.hyperlinkToolbarFactory ? t.push(
2448
- Ve.configure({
2474
+ Xe.configure({
2449
2475
  hyperlinkToolbarFactory: o.uiFactories.hyperlinkToolbarFactory
2450
2476
  })
2451
- ) : t.push(dt), o.uiFactories.slashMenuFactory && t.push(
2452
- _e.configure({
2477
+ ) : t.push(lt), o.uiFactories.slashMenuFactory && t.push(
2478
+ De.configure({
2453
2479
  editor: o.editor,
2454
2480
  commands: o.slashCommands,
2455
2481
  slashMenuFactory: o.uiFactories.slashMenuFactory
2456
2482
  })
2457
2483
  ), t;
2458
- }, io = {
2484
+ }, ao = {
2459
2485
  enableInputRules: !0,
2460
2486
  enablePasteRules: !0,
2461
2487
  enableCoreExtensions: !1
2462
2488
  };
2463
- class No {
2489
+ class Fo {
2464
2490
  constructor(t = {}) {
2465
2491
  u(this, "_tiptapEditor");
2466
2492
  u(this, "blockCache", /* @__PURE__ */ new WeakMap());
2467
- var i, a, s;
2468
- t = {
2493
+ var n, i, a;
2494
+ this.options = t, t = {
2469
2495
  defaultStyles: !0,
2470
2496
  ...t
2471
2497
  };
2472
- const e = no({
2498
+ const e = so({
2473
2499
  editor: this,
2474
2500
  uiFactories: t.uiFactories || {},
2475
- slashCommands: t.slashCommands || Ze
2476
- });
2477
- let r = t.disableHistoryExtension ? e.filter((d) => d.name !== "history") : e;
2478
- const n = {
2501
+ slashCommands: t.slashCommands || eo,
2502
+ collaboration: t.collaboration
2503
+ }), r = {
2479
2504
  // TODO: This approach to setting initial content is "cleaner" but requires the PM editor schema, which is only
2480
2505
  // created after initializing the TipTap editor. Not sure it's feasible.
2481
2506
  // content:
@@ -2483,36 +2508,36 @@ class No {
2483
2508
  // options.initialContent.map((block) =>
2484
2509
  // blockToNode(block, this._tiptapEditor.schema).toJSON()
2485
2510
  // ),
2486
- ...io,
2511
+ ...ao,
2487
2512
  ...t._tiptapOptions,
2488
2513
  onCreate: () => {
2489
- var d;
2490
- (d = t.onEditorReady) == null || d.call(t, this), t.initialContent && this.replaceBlocks(this.topLevelBlocks, t.initialContent);
2514
+ var s;
2515
+ (s = t.onEditorReady) == null || s.call(t, this), t.initialContent && this.replaceBlocks(this.topLevelBlocks, t.initialContent);
2491
2516
  },
2492
2517
  onUpdate: () => {
2493
- var d;
2494
- (d = t.onEditorContentChange) == null || d.call(t, this);
2518
+ var s;
2519
+ (s = t.onEditorContentChange) == null || s.call(t, this);
2495
2520
  },
2496
2521
  onSelectionUpdate: () => {
2497
- var d;
2498
- (d = t.onTextCursorPositionChange) == null || d.call(t, this);
2522
+ var s;
2523
+ (s = t.onTextCursorPositionChange) == null || s.call(t, this);
2499
2524
  },
2500
2525
  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],
2526
+ extensions: t.enableBlockNoteExtensions === !1 ? (n = t._tiptapOptions) == null ? void 0 : n.extensions : [...((i = t._tiptapOptions) == null ? void 0 : i.extensions) || [], ...e],
2502
2527
  editorProps: {
2503
2528
  attributes: {
2504
2529
  "data-theme": t.theme || "light",
2505
2530
  ...t.editorDOMAttributes || {},
2506
2531
  class: [
2507
- O.bnEditor,
2508
- O.bnRoot,
2509
- t.defaultStyles ? O.defaultStyles : "",
2510
- ((s = t.editorDOMAttributes) == null ? void 0 : s.class) || ""
2532
+ _.bnEditor,
2533
+ _.bnRoot,
2534
+ t.defaultStyles ? _.defaultStyles : "",
2535
+ ((a = t.editorDOMAttributes) == null ? void 0 : a.class) || ""
2511
2536
  ].join(" ")
2512
2537
  }
2513
2538
  }
2514
2539
  };
2515
- t.parentElement && (n.element = t.parentElement), this._tiptapEditor = new It(n);
2540
+ t.parentElement && (r.element = t.parentElement), this._tiptapEditor = new It(r);
2516
2541
  }
2517
2542
  get domElement() {
2518
2543
  return this._tiptapEditor.view.dom;
@@ -2569,11 +2594,11 @@ class No {
2569
2594
  ), i = this._tiptapEditor.state.doc.resolve(n).index(e - 1), a = this._tiptapEditor.state.doc.resolve(n + 1).node().childCount;
2570
2595
  let s;
2571
2596
  i > 0 && (s = this._tiptapEditor.state.doc.resolve(r - 2).node());
2572
- let d;
2573
- return i < a - 1 && (d = this._tiptapEditor.state.doc.resolve(n + 2).node()), {
2597
+ let l;
2598
+ return i < a - 1 && (l = this._tiptapEditor.state.doc.resolve(n + 2).node()), {
2574
2599
  block: B(t, this.blockCache),
2575
2600
  prevBlock: s === void 0 ? void 0 : B(s, this.blockCache),
2576
- nextBlock: d === void 0 ? void 0 : B(d, this.blockCache)
2601
+ nextBlock: l === void 0 ? void 0 : B(l, this.blockCache)
2577
2602
  };
2578
2603
  }
2579
2604
  /**
@@ -2638,7 +2663,7 @@ class No {
2638
2663
  * @param update A partial block which defines how the existing block should be changed.
2639
2664
  */
2640
2665
  updateBlock(t, e) {
2641
- ee(t, e, this._tiptapEditor);
2666
+ re(t, e, this._tiptapEditor);
2642
2667
  }
2643
2668
  /**
2644
2669
  * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.
@@ -2655,7 +2680,7 @@ class No {
2655
2680
  * @param blocksToInsert An array of partial blocks to replace the old ones with.
2656
2681
  */
2657
2682
  replaceBlocks(t, e) {
2658
- oe(t, e, this._tiptapEditor);
2683
+ ne(t, e, this._tiptapEditor);
2659
2684
  }
2660
2685
  /**
2661
2686
  * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
@@ -2798,7 +2823,7 @@ class No {
2798
2823
  * @returns The blocks, serialized as a Markdown string.
2799
2824
  */
2800
2825
  async blocksToMarkdown(t) {
2801
- return ie(t, this._tiptapEditor.schema);
2826
+ return ae(t, this._tiptapEditor.schema);
2802
2827
  }
2803
2828
  /**
2804
2829
  * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on
@@ -2808,15 +2833,25 @@ class No {
2808
2833
  * @returns The blocks parsed from the Markdown string.
2809
2834
  */
2810
2835
  async markdownToBlocks(t) {
2811
- return se(t, this._tiptapEditor.schema);
2836
+ return le(t, this._tiptapEditor.schema);
2837
+ }
2838
+ /**
2839
+ * Updates the user info for the current user that's shown to other collaborators.
2840
+ */
2841
+ updateCollaborationUserInfo(t) {
2842
+ if (!this.options.collaboration)
2843
+ throw new Error(
2844
+ "Cannot update collaboration user info when collaboration is disabled."
2845
+ );
2846
+ this._tiptapEditor.commands.updateUser(t);
2812
2847
  }
2813
2848
  }
2814
2849
  export {
2815
2850
  x as BaseSlashMenuItem,
2816
- No as BlockNoteEditor,
2851
+ Fo as BlockNoteEditor,
2817
2852
  tt as blockProps,
2818
- Ze as defaultSlashMenuItems,
2819
- no as getBlockNoteExtensions,
2820
- _ as globalProps
2853
+ eo as defaultSlashMenuItems,
2854
+ so as getBlockNoteExtensions,
2855
+ O as globalProps
2821
2856
  };
2822
2857
  //# sourceMappingURL=blocknote.js.map