reactjs-tiptap-editor 0.0.37 → 0.0.38

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.
@@ -1,8 +1,8 @@
1
1
  import Ve from "tippy.js";
2
- import { P, a as $, N as Z, S as G, f as We, c as Bt, T as Ke, l as Ue, b as qe, d as N, e as Ge, g as Je, j as Ye, h as Xe, i as Qe, k as Ze, m as Me, n as tn, o as en, p as nn, q as rn, r as sn, s as on, t as an, u as ln, v as cn, w as dn, x as un, y as Yt, z as pn, A as lt, F as ct, B as hn, C as fn, D as mn, E as gn, G as yn, H as bn, I as Se, J as wt, R as vn, K as Mn, L as Sn, M as Xt, O as ke, Q as kn, U as wn, V as Tn, W as En, X as Cn, Y as xn, Z as ut, _ as jt, $ as An, a0 as On, a1 as Ln, a2 as Rn, a3 as _n, a4 as Hn, a5 as In, a6 as Pn, a7 as Qt, a8 as Zt, a9 as te, aa as Nn, ab as $n, ac as ee, ad as Dn, ae as we, af as Bn, ag as jn } from "./vendor-CnblLvXI.js";
3
- import O, { forwardRef as Fn, useRef as zn, useState as Ft, useDebugValue as Te, useEffect as zt, createContext as Ee, useContext as Ce } from "react";
2
+ import { P, a as $, N as Z, S as G, f as We, c as jt, T as Ke, l as Ue, b as qe, d as D, e as Ge, g as Je, j as Ye, h as Xe, i as Qe, k as Ze, m as Me, n as tn, o as en, p as nn, q as rn, r as sn, s as on, t as an, u as ln, v as cn, w as dn, x as un, y as Yt, z as pn, A as lt, F as ct, B as hn, C as fn, D as mn, E as gn, G as yn, H as bn, I as Se, J as Tt, R as vn, K as Mn, L as Sn, M as Xt, O as ke, Q as kn, U as wn, V as En, W as Tn, X as Cn, Y as An, Z as ut, _ as Ft, $ as xn, a0 as On, a1 as Ln, a2 as _n, a3 as Hn, a4 as Rn, a5 as Pn, a6 as In, a7 as Qt, a8 as Zt, a9 as te, aa as $n, ab as Dn, ac as ee, ad as Nn, ae as we, af as Bn, ag as jn } from "./vendor-C6gAEa0t.js";
3
+ import O, { forwardRef as Fn, useRef as zn, useState as zt, useDebugValue as Ee, useEffect as Vt, createContext as Te, useContext as Ce } from "react";
4
4
  import Vn, { flushSync as Wn } from "react-dom";
5
- function ft(e) {
5
+ function mt(e) {
6
6
  const { state: t, transaction: n } = e;
7
7
  let { selection: r } = n, { doc: s } = n, { storedMarks: o } = n;
8
8
  return {
@@ -27,7 +27,7 @@ function ft(e) {
27
27
  }
28
28
  };
29
29
  }
30
- class mt {
30
+ class gt {
31
31
  constructor(t) {
32
32
  this.editor = t.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = t.state;
33
33
  }
@@ -52,9 +52,9 @@ class mt {
52
52
  }
53
53
  createChain(t, n = !0) {
54
54
  const { rawCommands: r, editor: s, state: o } = this, { view: i } = s, a = [], l = !!t, c = t || o.tr, u = () => (!l && n && !c.getMeta("preventDispatch") && !this.hasCustomState && i.dispatch(c), a.every((p) => p === !0)), d = {
55
- ...Object.fromEntries(Object.entries(r).map(([p, h]) => [p, (...y) => {
56
- const g = this.buildProps(c, n), m = h(...y)(g);
57
- return a.push(m), d;
55
+ ...Object.fromEntries(Object.entries(r).map(([p, h]) => [p, (...m) => {
56
+ const y = this.buildProps(c, n), g = h(...m)(y);
57
+ return a.push(g), d;
58
58
  }])),
59
59
  run: u
60
60
  };
@@ -72,7 +72,7 @@ class mt {
72
72
  tr: t,
73
73
  editor: s,
74
74
  view: i,
75
- state: ft({
75
+ state: mt({
76
76
  state: o,
77
77
  transaction: t
78
78
  }),
@@ -112,7 +112,7 @@ function v(e, t, n) {
112
112
  parent: e.parent ? v(e.parent, t, n) : null
113
113
  }) : e.config[t];
114
114
  }
115
- function gt(e) {
115
+ function yt(e) {
116
116
  const t = e.filter((s) => s.type === "extension"), n = e.filter((s) => s.type === "node"), r = e.filter((s) => s.type === "mark");
117
117
  return {
118
118
  baseExtensions: t,
@@ -120,8 +120,8 @@ function gt(e) {
120
120
  markExtensions: r
121
121
  };
122
122
  }
123
- function xe(e) {
124
- const t = [], { nodeExtensions: n, markExtensions: r } = gt(e), s = [...n, ...r], o = {
123
+ function Ae(e) {
124
+ const t = [], { nodeExtensions: n, markExtensions: r } = yt(e), s = [...n, ...r], o = {
125
125
  default: null,
126
126
  rendered: !0,
127
127
  renderHTML: null,
@@ -174,7 +174,7 @@ function xe(e) {
174
174
  });
175
175
  }), t;
176
176
  }
177
- function H(e, t) {
177
+ function R(e, t) {
178
178
  if (typeof e == "string") {
179
179
  if (!t.nodes[e])
180
180
  throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
@@ -182,7 +182,7 @@ function H(e, t) {
182
182
  }
183
183
  return e;
184
184
  }
185
- function x(...e) {
185
+ function A(...e) {
186
186
  return e.filter((t) => !!t).reduce((t, n) => {
187
187
  const r = { ...t };
188
188
  return Object.entries(n).forEach(([s, o]) => {
@@ -193,20 +193,30 @@ function x(...e) {
193
193
  if (s === "class") {
194
194
  const a = o ? o.split(" ") : [], l = r[s] ? r[s].split(" ") : [], c = a.filter((u) => !l.includes(u));
195
195
  r[s] = [...l, ...c].join(" ");
196
- } else s === "style" ? r[s] = [r[s], o].join("; ") : r[s] = o;
196
+ } else if (s === "style") {
197
+ const a = o ? o.split(";").map((u) => u.trim()).filter(Boolean) : [], l = r[s] ? r[s].split(";").map((u) => u.trim()).filter(Boolean) : [], c = /* @__PURE__ */ new Map();
198
+ l.forEach((u) => {
199
+ const [d, p] = u.split(":").map((h) => h.trim());
200
+ c.set(d, p);
201
+ }), a.forEach((u) => {
202
+ const [d, p] = u.split(":").map((h) => h.trim());
203
+ c.set(d, p);
204
+ }), r[s] = Array.from(c.entries()).map(([u, d]) => `${u}: ${d}`).join("; ");
205
+ } else
206
+ r[s] = o;
197
207
  }), r;
198
208
  }, {});
199
209
  }
200
- function Rt(e, t) {
210
+ function pt(e, t) {
201
211
  return t.filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
202
212
  [n.name]: e.attrs[n.name]
203
- }).reduce((n, r) => x(n, r), {});
213
+ }).reduce((n, r) => A(n, r), {});
204
214
  }
205
- function Ae(e) {
215
+ function xe(e) {
206
216
  return typeof e == "function";
207
217
  }
208
- function T(e, t = void 0, ...n) {
209
- return Ae(e) ? t ? e.bind(t)(...n) : e(...n) : e;
218
+ function E(e, t = void 0, ...n) {
219
+ return xe(e) ? t ? e.bind(t)(...n) : e(...n) : e;
210
220
  }
211
221
  function Un(e = {}) {
212
222
  return Object.keys(e).length === 0 && e.constructor === Object;
@@ -240,73 +250,73 @@ function re(e) {
240
250
  }
241
251
  function Gn(e, t) {
242
252
  var n;
243
- const r = xe(e), { nodeExtensions: s, markExtensions: o } = gt(e), i = (n = s.find((c) => v(c, "topNode"))) === null || n === void 0 ? void 0 : n.name, a = Object.fromEntries(s.map((c) => {
244
- const u = r.filter((m) => m.type === c.name), d = {
253
+ const r = Ae(e), { nodeExtensions: s, markExtensions: o } = yt(e), i = (n = s.find((c) => v(c, "topNode"))) === null || n === void 0 ? void 0 : n.name, a = Object.fromEntries(s.map((c) => {
254
+ const u = r.filter((g) => g.type === c.name), d = {
245
255
  name: c.name,
246
256
  options: c.options,
247
257
  storage: c.storage,
248
258
  editor: t
249
- }, p = e.reduce((m, k) => {
259
+ }, p = e.reduce((g, k) => {
250
260
  const b = v(k, "extendNodeSchema", d);
251
261
  return {
252
- ...m,
262
+ ...g,
253
263
  ...b ? b(c) : {}
254
264
  };
255
265
  }, {}), h = re({
256
266
  ...p,
257
- content: T(v(c, "content", d)),
258
- marks: T(v(c, "marks", d)),
259
- group: T(v(c, "group", d)),
260
- inline: T(v(c, "inline", d)),
261
- atom: T(v(c, "atom", d)),
262
- selectable: T(v(c, "selectable", d)),
263
- draggable: T(v(c, "draggable", d)),
264
- code: T(v(c, "code", d)),
265
- whitespace: T(v(c, "whitespace", d)),
266
- defining: T(v(c, "defining", d)),
267
- isolating: T(v(c, "isolating", d)),
268
- attrs: Object.fromEntries(u.map((m) => {
267
+ content: E(v(c, "content", d)),
268
+ marks: E(v(c, "marks", d)),
269
+ group: E(v(c, "group", d)),
270
+ inline: E(v(c, "inline", d)),
271
+ atom: E(v(c, "atom", d)),
272
+ selectable: E(v(c, "selectable", d)),
273
+ draggable: E(v(c, "draggable", d)),
274
+ code: E(v(c, "code", d)),
275
+ whitespace: E(v(c, "whitespace", d)),
276
+ defining: E(v(c, "defining", d)),
277
+ isolating: E(v(c, "isolating", d)),
278
+ attrs: Object.fromEntries(u.map((g) => {
269
279
  var k;
270
- return [m.name, { default: (k = m == null ? void 0 : m.attribute) === null || k === void 0 ? void 0 : k.default }];
280
+ return [g.name, { default: (k = g == null ? void 0 : g.attribute) === null || k === void 0 ? void 0 : k.default }];
271
281
  }))
272
- }), f = T(v(c, "parseHTML", d));
273
- f && (h.parseDOM = f.map((m) => ne(m, u)));
274
- const y = v(c, "renderHTML", d);
275
- y && (h.toDOM = (m) => y({
276
- node: m,
277
- HTMLAttributes: Rt(m, u)
282
+ }), f = E(v(c, "parseHTML", d));
283
+ f && (h.parseDOM = f.map((g) => ne(g, u)));
284
+ const m = v(c, "renderHTML", d);
285
+ m && (h.toDOM = (g) => m({
286
+ node: g,
287
+ HTMLAttributes: pt(g, u)
278
288
  }));
279
- const g = v(c, "renderText", d);
280
- return g && (h.toText = g), [c.name, h];
289
+ const y = v(c, "renderText", d);
290
+ return y && (h.toText = y), [c.name, h];
281
291
  })), l = Object.fromEntries(o.map((c) => {
282
- const u = r.filter((g) => g.type === c.name), d = {
292
+ const u = r.filter((y) => y.type === c.name), d = {
283
293
  name: c.name,
284
294
  options: c.options,
285
295
  storage: c.storage,
286
296
  editor: t
287
- }, p = e.reduce((g, m) => {
288
- const k = v(m, "extendMarkSchema", d);
297
+ }, p = e.reduce((y, g) => {
298
+ const k = v(g, "extendMarkSchema", d);
289
299
  return {
290
- ...g,
300
+ ...y,
291
301
  ...k ? k(c) : {}
292
302
  };
293
303
  }, {}), h = re({
294
304
  ...p,
295
- inclusive: T(v(c, "inclusive", d)),
296
- excludes: T(v(c, "excludes", d)),
297
- group: T(v(c, "group", d)),
298
- spanning: T(v(c, "spanning", d)),
299
- code: T(v(c, "code", d)),
300
- attrs: Object.fromEntries(u.map((g) => {
301
- var m;
302
- return [g.name, { default: (m = g == null ? void 0 : g.attribute) === null || m === void 0 ? void 0 : m.default }];
305
+ inclusive: E(v(c, "inclusive", d)),
306
+ excludes: E(v(c, "excludes", d)),
307
+ group: E(v(c, "group", d)),
308
+ spanning: E(v(c, "spanning", d)),
309
+ code: E(v(c, "code", d)),
310
+ attrs: Object.fromEntries(u.map((y) => {
311
+ var g;
312
+ return [y.name, { default: (g = y == null ? void 0 : y.attribute) === null || g === void 0 ? void 0 : g.default }];
303
313
  }))
304
- }), f = T(v(c, "parseHTML", d));
305
- f && (h.parseDOM = f.map((g) => ne(g, u)));
306
- const y = v(c, "renderHTML", d);
307
- return y && (h.toDOM = (g) => y({
308
- mark: g,
309
- HTMLAttributes: Rt(g, u)
314
+ }), f = E(v(c, "parseHTML", d));
315
+ f && (h.parseDOM = f.map((y) => ne(y, u)));
316
+ const m = v(c, "renderHTML", d);
317
+ return m && (h.toDOM = (y) => m({
318
+ mark: y,
319
+ HTMLAttributes: pt(y, u)
310
320
  })), [c.name, h];
311
321
  }));
312
322
  return new Se({
@@ -315,7 +325,7 @@ function Gn(e, t) {
315
325
  marks: l
316
326
  });
317
327
  }
318
- function Tt(e, t) {
328
+ function Ct(e, t) {
319
329
  return t.nodes[e] || t.marks[e] || null;
320
330
  }
321
331
  function se(e, t) {
@@ -335,16 +345,16 @@ const Jn = (e, t = 500) => {
335
345
  n += s.isAtom && !s.isText ? u : u.slice(0, Math.max(0, r - o));
336
346
  }), n;
337
347
  };
338
- function Vt(e) {
348
+ function Wt(e) {
339
349
  return Object.prototype.toString.call(e) === "[object RegExp]";
340
350
  }
341
- class yt {
351
+ class bt {
342
352
  constructor(t) {
343
353
  this.find = t.find, this.handler = t.handler;
344
354
  }
345
355
  }
346
356
  const Yn = (e, t) => {
347
- if (Vt(t))
357
+ if (Wt(t))
348
358
  return t.exec(e);
349
359
  const n = t(e);
350
360
  if (!n)
@@ -371,21 +381,21 @@ function st(e) {
371
381
  const h = Yn(d, p.find);
372
382
  if (!h)
373
383
  return;
374
- const f = l.state.tr, y = ft({
384
+ const f = l.state.tr, m = mt({
375
385
  state: l.state,
376
386
  transaction: f
377
- }), g = {
387
+ }), y = {
378
388
  from: r - (h[0].length - o.length),
379
389
  to: s
380
- }, { commands: m, chain: k, can: b } = new mt({
390
+ }, { commands: g, chain: k, can: b } = new gt({
381
391
  editor: n,
382
- state: y
392
+ state: m
383
393
  });
384
394
  p.handler({
385
- state: y,
386
- range: g,
395
+ state: m,
396
+ range: y,
387
397
  match: h,
388
- commands: m,
398
+ commands: g,
389
399
  chain: k,
390
400
  can: b
391
401
  }) === null || !f.steps.length || (f.setMeta(a, {
@@ -475,7 +485,7 @@ class Zn {
475
485
  }
476
486
  }
477
487
  const tr = (e, t, n) => {
478
- if (Vt(t))
488
+ if (Wt(t))
479
489
  return [...e.matchAll(t)];
480
490
  const r = t(e, n);
481
491
  return r ? r.map((s) => {
@@ -484,23 +494,23 @@ const tr = (e, t, n) => {
484
494
  }) : [];
485
495
  };
486
496
  function er(e) {
487
- const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: l, chain: c, can: u } = new mt({
497
+ const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: l, chain: c, can: u } = new gt({
488
498
  editor: t,
489
499
  state: n
490
500
  }), d = [];
491
501
  return n.doc.nodesBetween(r, s, (h, f) => {
492
502
  if (!h.isTextblock || h.type.spec.code)
493
503
  return;
494
- const y = Math.max(r, f), g = Math.min(s, f + h.content.size), m = h.textBetween(y - f, g - f, void 0, "");
495
- tr(m, o.find, i).forEach((b) => {
504
+ const m = Math.max(r, f), y = Math.min(s, f + h.content.size), g = h.textBetween(m - f, y - f, void 0, "");
505
+ tr(g, o.find, i).forEach((b) => {
496
506
  if (b.index === void 0)
497
507
  return;
498
- const S = y + b.index + 1, w = S + b[0].length, M = {
499
- from: n.tr.mapping.map(S),
508
+ const M = m + b.index + 1, w = M + b[0].length, S = {
509
+ from: n.tr.mapping.map(M),
500
510
  to: n.tr.mapping.map(w)
501
511
  }, C = o.handler({
502
512
  state: n,
503
- range: M,
513
+ range: S,
504
514
  match: b,
505
515
  commands: l,
506
516
  chain: c,
@@ -523,20 +533,20 @@ function rr(e) {
523
533
  const { editor: t, rules: n } = e;
524
534
  let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
525
535
  const l = ({ state: u, from: d, to: p, rule: h, pasteEvt: f }) => {
526
- const y = u.tr, g = ft({
536
+ const m = u.tr, y = mt({
527
537
  state: u,
528
- transaction: y
538
+ transaction: m
529
539
  });
530
540
  if (!(!er({
531
541
  editor: t,
532
- state: g,
542
+ state: y,
533
543
  from: Math.max(d - 1, 0),
534
544
  to: p.b - 1,
535
545
  rule: h,
536
546
  pasteEvent: f,
537
547
  dropEvent: a
538
- }) || !y.steps.length))
539
- return a = typeof DragEvent < "u" ? new DragEvent("drop") : null, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, y;
548
+ }) || !m.steps.length))
549
+ return a = typeof DragEvent < "u" ? new DragEvent("drop") : null, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, m;
540
550
  };
541
551
  return n.map((u) => new P({
542
552
  // we register a global drag handler to track the current drag source element
@@ -562,26 +572,26 @@ function rr(e) {
562
572
  }
563
573
  },
564
574
  appendTransaction: (d, p, h) => {
565
- const f = d[0], y = f.getMeta("uiEvent") === "paste" && !s, g = f.getMeta("uiEvent") === "drop" && !o, m = f.getMeta("applyPasteRules"), k = !!m;
566
- if (!y && !g && !k)
575
+ const f = d[0], m = f.getMeta("uiEvent") === "paste" && !s, y = f.getMeta("uiEvent") === "drop" && !o, g = f.getMeta("applyPasteRules"), k = !!g;
576
+ if (!m && !y && !k)
567
577
  return;
568
578
  if (k) {
569
- const { from: w, text: M } = m, C = w + M.length, A = nr(M);
579
+ const { from: w, text: S } = g, C = w + S.length, x = nr(S);
570
580
  return l({
571
581
  rule: u,
572
582
  state: h,
573
583
  from: w,
574
584
  to: { b: C },
575
- pasteEvt: A
585
+ pasteEvt: x
576
586
  });
577
587
  }
578
- const b = p.doc.content.findDiffStart(h.doc.content), S = p.doc.content.findDiffEnd(h.doc.content);
579
- if (!(!Qn(b) || !S || b === S.b))
588
+ const b = p.doc.content.findDiffStart(h.doc.content), M = p.doc.content.findDiffEnd(h.doc.content);
589
+ if (!(!Qn(b) || !M || b === M.b))
580
590
  return l({
581
591
  rule: u,
582
592
  state: h,
583
593
  from: b,
584
- to: S,
594
+ to: M,
585
595
  pasteEvt: i
586
596
  });
587
597
  }
@@ -642,7 +652,7 @@ class Q {
642
652
  options: n.options,
643
653
  storage: n.storage,
644
654
  editor: this.editor,
645
- type: Tt(n.name, this.schema)
655
+ type: Ct(n.name, this.schema)
646
656
  }, s = v(n, "addCommands", r);
647
657
  return s ? {
648
658
  ...t,
@@ -661,12 +671,12 @@ class Q {
661
671
  options: i.options,
662
672
  storage: i.storage,
663
673
  editor: t,
664
- type: Tt(i.name, this.schema)
674
+ type: Ct(i.name, this.schema)
665
675
  }, l = [], c = v(i, "addKeyboardShortcuts", a);
666
676
  let u = {};
667
677
  if (i.type === "mark" && v(i, "exitable", a) && (u.ArrowRight = () => I.handleExit({ editor: t, mark: i })), c) {
668
- const y = Object.fromEntries(Object.entries(c()).map(([g, m]) => [g, () => m({ editor: t })]));
669
- u = { ...u, ...y };
678
+ const m = Object.fromEntries(Object.entries(c()).map(([y, g]) => [y, () => g({ editor: t })]));
679
+ u = { ...u, ...m };
670
680
  }
671
681
  const d = bn(u);
672
682
  l.push(d);
@@ -676,8 +686,8 @@ class Q {
676
686
  se(i, t.options.enablePasteRules) && h && s.push(...h());
677
687
  const f = v(i, "addProseMirrorPlugins", a);
678
688
  if (f) {
679
- const y = f();
680
- l.push(...y);
689
+ const m = f();
690
+ l.push(...m);
681
691
  }
682
692
  return l;
683
693
  }).flat();
@@ -698,33 +708,37 @@ class Q {
698
708
  * @returns An array of attributes
699
709
  */
700
710
  get attributes() {
701
- return xe(this.extensions);
711
+ return Ae(this.extensions);
702
712
  }
703
713
  /**
704
714
  * Get all node views from the extensions.
705
715
  * @returns An object with all node views where the key is the node name and the value is the node view function
706
716
  */
707
717
  get nodeViews() {
708
- const { editor: t } = this, { nodeExtensions: n } = gt(this.extensions);
718
+ const { editor: t } = this, { nodeExtensions: n } = yt(this.extensions);
709
719
  return Object.fromEntries(n.filter((r) => !!v(r, "addNodeView")).map((r) => {
710
720
  const s = this.attributes.filter((l) => l.type === r.name), o = {
711
721
  name: r.name,
712
722
  options: r.options,
713
723
  storage: r.storage,
714
724
  editor: t,
715
- type: H(r.name, this.schema)
725
+ type: R(r.name, this.schema)
716
726
  }, i = v(r, "addNodeView", o);
717
727
  if (!i)
718
728
  return [];
719
- const a = (l, c, u, d) => {
720
- const p = Rt(l, s);
729
+ const a = (l, c, u, d, p) => {
730
+ const h = pt(l, s);
721
731
  return i()({
722
- editor: t,
732
+ // pass-through
723
733
  node: l,
734
+ view: c,
724
735
  getPos: u,
725
736
  decorations: d,
726
- HTMLAttributes: p,
727
- extension: r
737
+ innerDecorations: p,
738
+ // tiptap-specific
739
+ editor: t,
740
+ extension: r,
741
+ HTMLAttributes: h
728
742
  });
729
743
  };
730
744
  return [r.name, a];
@@ -743,9 +757,9 @@ class Q {
743
757
  options: t.options,
744
758
  storage: t.storage,
745
759
  editor: this.editor,
746
- type: Tt(t.name, this.schema)
760
+ type: Ct(t.name, this.schema)
747
761
  };
748
- t.type === "mark" && (!((n = T(v(t, "keepOnSplit", r))) !== null && n !== void 0) || n) && this.splittableMarks.push(t.name);
762
+ t.type === "mark" && (!((n = E(v(t, "keepOnSplit", r))) !== null && n !== void 0) || n) && this.splittableMarks.push(t.name);
749
763
  const s = v(t, "onBeforeCreate", r), o = v(t, "onCreate", r), i = v(t, "onUpdate", r), a = v(t, "onSelectionUpdate", r), l = v(t, "onTransaction", r), c = v(t, "onFocus", r), u = v(t, "onBlur", r), d = v(t, "onDestroy", r);
750
764
  s && this.editor.on("beforeCreate", s), o && this.editor.on("create", o), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), l && this.editor.on("transaction", l), c && this.editor.on("focus", c), u && this.editor.on("blur", u), d && this.editor.on("destroy", d);
751
765
  });
@@ -757,13 +771,13 @@ function or(e) {
757
771
  function ot(e) {
758
772
  return or(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
759
773
  }
760
- function bt(e, t) {
774
+ function vt(e, t) {
761
775
  const n = { ...e };
762
776
  return ot(e) && ot(t) && Object.keys(t).forEach((r) => {
763
- ot(t[r]) && ot(e[r]) ? n[r] = bt(e[r], t[r]) : n[r] = t[r];
777
+ ot(t[r]) && ot(e[r]) ? n[r] = vt(e[r], t[r]) : n[r] = t[r];
764
778
  }), n;
765
779
  }
766
- class R {
780
+ class _ {
767
781
  constructor(t = {}) {
768
782
  this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
769
783
  name: this.name,
@@ -771,28 +785,28 @@ class R {
771
785
  }, this.config = {
772
786
  ...this.config,
773
787
  ...t
774
- }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = T(v(this, "addOptions", {
788
+ }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = E(v(this, "addOptions", {
775
789
  name: this.name
776
- }))), this.storage = T(v(this, "addStorage", {
790
+ }))), this.storage = E(v(this, "addStorage", {
777
791
  name: this.name,
778
792
  options: this.options
779
793
  })) || {};
780
794
  }
781
795
  static create(t = {}) {
782
- return new R(t);
796
+ return new _(t);
783
797
  }
784
798
  configure(t = {}) {
785
799
  const n = this.extend({
786
800
  ...this.config,
787
- addOptions: () => bt(this.options, t)
801
+ addOptions: () => vt(this.options, t)
788
802
  });
789
803
  return n.name = this.name, n.parent = this.parent, n;
790
804
  }
791
805
  extend(t = {}) {
792
- const n = new R({ ...this.config, ...t });
793
- return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = T(v(n, "addOptions", {
806
+ const n = new _({ ...this.config, ...t });
807
+ return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = E(v(n, "addOptions", {
794
808
  name: n.name
795
- })), n.storage = T(v(n, "addStorage", {
809
+ })), n.storage = E(v(n, "addStorage", {
796
810
  name: n.name,
797
811
  options: n.options
798
812
  })), n;
@@ -821,7 +835,7 @@ function Oe(e, t, n) {
821
835
  function Le(e) {
822
836
  return Object.fromEntries(Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText]));
823
837
  }
824
- const ir = R.create({
838
+ const ir = _.create({
825
839
  name: "clipboardTextSerializer",
826
840
  addOptions() {
827
841
  return {
@@ -858,8 +872,8 @@ const ir = R.create({
858
872
  return;
859
873
  const f = Ue(h);
860
874
  if (a.type.isTextblock) {
861
- const { defaultType: y } = d.parent.contentMatchAt(d.index());
862
- t.setNodeMarkup(h.start, y);
875
+ const { defaultType: m } = d.parent.contentMatchAt(d.index());
876
+ t.setNodeMarkup(h.start, m);
863
877
  }
864
878
  (f || f === 0) && t.lift(h, f);
865
879
  });
@@ -868,7 +882,7 @@ const ir = R.create({
868
882
  const { state: s } = n, o = s.doc.slice(e.from, e.to);
869
883
  r.deleteRange(e.from, e.to);
870
884
  const i = r.mapping.map(t);
871
- return r.insert(i, o.content), r.setSelection(new N(r.doc.resolve(i - 1))), !0;
885
+ return r.insert(i, o.content), r.setSelection(new D(r.doc.resolve(i - 1))), !0;
872
886
  }, hr = () => ({ tr: e, dispatch: t }) => {
873
887
  const { selection: n } = e, r = n.$anchor.node();
874
888
  if (r.content.size > 0)
@@ -884,7 +898,7 @@ const ir = R.create({
884
898
  }
885
899
  return !1;
886
900
  }, fr = (e) => ({ tr: t, state: n, dispatch: r }) => {
887
- const s = H(e, n.schema), o = t.selection.$anchor;
901
+ const s = R(e, n.schema), o = t.selection.$anchor;
888
902
  for (let i = o.depth; i > 0; i -= 1)
889
903
  if (o.node(i).type === s) {
890
904
  if (r) {
@@ -898,27 +912,27 @@ const ir = R.create({
898
912
  const { from: r, to: s } = e;
899
913
  return n && t.delete(r, s), !0;
900
914
  }, gr = () => ({ state: e, dispatch: t }) => Ge(e, t), yr = () => ({ commands: e }) => e.keyboardShortcut("Enter"), br = () => ({ state: e, dispatch: t }) => Je(e, t);
901
- function pt(e, t, n = { strict: !0 }) {
915
+ function ht(e, t, n = { strict: !0 }) {
902
916
  const r = Object.keys(t);
903
- return r.length ? r.every((s) => n.strict ? t[s] === e[s] : Vt(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
917
+ return r.length ? r.every((s) => n.strict ? t[s] === e[s] : Wt(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
904
918
  }
905
- function _t(e, t, n = {}) {
906
- return e.find((r) => r.type === t && pt(r.attrs, n));
919
+ function Rt(e, t, n = {}) {
920
+ return e.find((r) => r.type === t && ht(r.attrs, n));
907
921
  }
908
922
  function vr(e, t, n = {}) {
909
- return !!_t(e, t, n);
923
+ return !!Rt(e, t, n);
910
924
  }
911
- function Wt(e, t, n = {}) {
925
+ function Kt(e, t, n = {}) {
912
926
  if (!e || !t)
913
927
  return;
914
928
  let r = e.parent.childAfter(e.parentOffset);
915
929
  if (e.parentOffset === r.offset && r.offset !== 0 && (r = e.parent.childBefore(e.parentOffset)), !r.node)
916
930
  return;
917
- const s = _t([...r.node.marks], t, n);
931
+ const s = Rt([...r.node.marks], t, n);
918
932
  if (!s)
919
933
  return;
920
934
  let o = r.index, i = e.start() + r.offset, a = o + 1, l = i + r.node.nodeSize;
921
- for (_t([...r.node.marks], t, n); o > 0 && s.isInSet(e.parent.child(o - 1).marks); )
935
+ for (Rt([...r.node.marks], t, n); o > 0 && s.isInSet(e.parent.child(o - 1).marks); )
922
936
  o -= 1, i -= e.parent.child(o).nodeSize;
923
937
  for (; a < e.parent.childCount && vr([...e.parent.child(a).marks], t, n); )
924
938
  l += e.parent.child(a).nodeSize, a += 1;
@@ -938,9 +952,9 @@ function V(e, t) {
938
952
  const Mr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
939
953
  const o = V(e, r.schema), { doc: i, selection: a } = n, { $from: l, from: c, to: u } = a;
940
954
  if (s) {
941
- const d = Wt(l, o, t);
955
+ const d = Kt(l, o, t);
942
956
  if (d && d.from <= c && d.to >= u) {
943
- const p = N.create(i, d.from, d.to);
957
+ const p = D.create(i, d.from, d.to);
944
958
  n.setSelection(p);
945
959
  }
946
960
  }
@@ -952,13 +966,13 @@ const Mr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
952
966
  return !0;
953
967
  return !1;
954
968
  };
955
- function Kt(e) {
956
- return e instanceof N;
969
+ function Ut(e) {
970
+ return e instanceof D;
957
971
  }
958
972
  function B(e = 0, t = 0, n = 0) {
959
973
  return Math.min(Math.max(e, t), n);
960
974
  }
961
- function Re(e, t = null) {
975
+ function _e(e, t = null) {
962
976
  if (!t)
963
977
  return null;
964
978
  const n = G.atStart(e), r = G.atEnd(e);
@@ -967,9 +981,9 @@ function Re(e, t = null) {
967
981
  if (t === "end")
968
982
  return r;
969
983
  const s = n.from, o = r.to;
970
- return t === "all" ? N.create(e, B(0, s, o), B(e.content.size, s, o)) : N.create(e, B(t, s, o), B(t, s, o));
984
+ return t === "all" ? D.create(e, B(0, s, o), B(e.content.size, s, o)) : D.create(e, B(t, s, o), B(t, s, o));
971
985
  }
972
- function vt() {
986
+ function Mt() {
973
987
  return [
974
988
  "iPad Simulator",
975
989
  "iPhone Simulator",
@@ -985,29 +999,29 @@ const kr = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) =>
985
999
  ...t
986
1000
  };
987
1001
  const i = () => {
988
- vt() && r.dom.focus(), requestAnimationFrame(() => {
1002
+ Mt() && r.dom.focus(), requestAnimationFrame(() => {
989
1003
  n.isDestroyed || (r.focus(), t != null && t.scrollIntoView && n.commands.scrollIntoView());
990
1004
  });
991
1005
  };
992
1006
  if (r.hasFocus() && e === null || e === !1)
993
1007
  return !0;
994
- if (o && e === null && !Kt(n.state.selection))
1008
+ if (o && e === null && !Ut(n.state.selection))
995
1009
  return i(), !0;
996
- const a = Re(s.doc, e) || n.state.selection, l = n.state.selection.eq(a);
1010
+ const a = _e(s.doc, e) || n.state.selection, l = n.state.selection.eq(a);
997
1011
  return o && (l || s.setSelection(a), l && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
998
- }, wr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), Tr = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), _e = (e) => {
1012
+ }, wr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), Er = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), He = (e) => {
999
1013
  const t = e.childNodes;
1000
1014
  for (let n = t.length - 1; n >= 0; n -= 1) {
1001
1015
  const r = t[n];
1002
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && _e(r);
1016
+ r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && He(r);
1003
1017
  }
1004
1018
  return e;
1005
1019
  };
1006
1020
  function it(e) {
1007
1021
  const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
1008
- return _e(n);
1022
+ return He(n);
1009
1023
  }
1010
- function ht(e, t, n) {
1024
+ function ft(e, t, n) {
1011
1025
  n = {
1012
1026
  slice: !0,
1013
1027
  parseOptions: {},
@@ -1023,7 +1037,7 @@ function ht(e, t, n) {
1023
1037
  } catch (o) {
1024
1038
  if (n.errorOnInvalidContent)
1025
1039
  throw new Error("[tiptap error]: Invalid JSON content", { cause: o });
1026
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), ht("", t, n);
1040
+ return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), ft("", t, n);
1027
1041
  }
1028
1042
  if (s) {
1029
1043
  if (n.errorOnInvalidContent) {
@@ -1046,15 +1060,15 @@ function ht(e, t, n) {
1046
1060
  }
1047
1061
  })
1048
1062
  });
1049
- if (n.slice ? wt.fromSchema(l).parseSlice(it(e), n.parseOptions) : wt.fromSchema(l).parse(it(e), n.parseOptions), n.errorOnInvalidContent && i)
1063
+ if (n.slice ? Tt.fromSchema(l).parseSlice(it(e), n.parseOptions) : Tt.fromSchema(l).parse(it(e), n.parseOptions), n.errorOnInvalidContent && i)
1050
1064
  throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${a}`) });
1051
1065
  }
1052
- const o = wt.fromSchema(t);
1066
+ const o = Tt.fromSchema(t);
1053
1067
  return n.slice ? o.parseSlice(it(e), n.parseOptions).content : o.parse(it(e), n.parseOptions);
1054
1068
  }
1055
- return ht("", t, n);
1069
+ return ft("", t, n);
1056
1070
  }
1057
- function Er(e, t, n) {
1071
+ function Tr(e, t, n) {
1058
1072
  const r = e.steps.length - 1;
1059
1073
  if (r < t)
1060
1074
  return;
@@ -1067,7 +1081,7 @@ function Er(e, t, n) {
1067
1081
  i === 0 && (i = u);
1068
1082
  }), e.setSelection(G.near(e.doc.resolve(i), n));
1069
1083
  }
1070
- const Cr = (e) => !("type" in e), xr = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
1084
+ const Cr = (e) => !("type" in e), Ar = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
1071
1085
  var i;
1072
1086
  if (s) {
1073
1087
  n = {
@@ -1079,7 +1093,7 @@ const Cr = (e) => !("type" in e), xr = (e, t, n) => ({ tr: r, dispatch: s, edito
1079
1093
  };
1080
1094
  let a;
1081
1095
  try {
1082
- a = ht(t, o.schema, {
1096
+ a = ft(t, o.schema, {
1083
1097
  parseOptions: {
1084
1098
  preserveWhitespace: "full",
1085
1099
  ...n.parseOptions
@@ -1103,28 +1117,28 @@ const Cr = (e) => !("type" in e), xr = (e, t, n) => ({ tr: r, dispatch: s, edito
1103
1117
  f.isTextblock && !f.type.spec.code && !f.childCount && (l -= 1, c += 1);
1104
1118
  }
1105
1119
  let h;
1106
- u ? (Array.isArray(t) ? h = t.map((f) => f.text || "").join("") : typeof t == "object" && t && t.text ? h = t.text : h = t, r.insertText(h, l, c)) : (h = a, r.replaceWith(l, c, h)), n.updateSelection && Er(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: l, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: l, text: h });
1120
+ u ? (Array.isArray(t) ? h = t.map((f) => f.text || "").join("") : typeof t == "object" && t && t.text ? h = t.text : h = t, r.insertText(h, l, c)) : (h = a, r.replaceWith(l, c, h)), n.updateSelection && Tr(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: l, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: l, text: h });
1107
1121
  }
1108
1122
  return !0;
1109
- }, Ar = () => ({ state: e, dispatch: t }) => Ye(e, t), Or = () => ({ state: e, dispatch: t }) => Xe(e, t), Lr = () => ({ state: e, dispatch: t }) => Qe(e, t), Rr = () => ({ state: e, dispatch: t }) => Ze(e, t), _r = () => ({ state: e, dispatch: t, tr: n }) => {
1123
+ }, xr = () => ({ state: e, dispatch: t }) => Ye(e, t), Or = () => ({ state: e, dispatch: t }) => Xe(e, t), Lr = () => ({ state: e, dispatch: t }) => Qe(e, t), _r = () => ({ state: e, dispatch: t }) => Ze(e, t), Hr = () => ({ state: e, dispatch: t, tr: n }) => {
1110
1124
  try {
1111
1125
  const r = Me(e.doc, e.selection.$from.pos, -1);
1112
1126
  return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
1113
1127
  } catch {
1114
1128
  return !1;
1115
1129
  }
1116
- }, Hr = () => ({ state: e, dispatch: t, tr: n }) => {
1130
+ }, Rr = () => ({ state: e, dispatch: t, tr: n }) => {
1117
1131
  try {
1118
1132
  const r = Me(e.doc, e.selection.$from.pos, 1);
1119
1133
  return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
1120
1134
  } catch {
1121
1135
  return !1;
1122
1136
  }
1123
- }, Ir = () => ({ state: e, dispatch: t }) => tn(e, t), Pr = () => ({ state: e, dispatch: t }) => en(e, t);
1124
- function He() {
1137
+ }, Pr = () => ({ state: e, dispatch: t }) => tn(e, t), Ir = () => ({ state: e, dispatch: t }) => en(e, t);
1138
+ function Re() {
1125
1139
  return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
1126
1140
  }
1127
- function Nr(e) {
1141
+ function $r(e) {
1128
1142
  const t = e.split(/-(?!$)/);
1129
1143
  let n = t[t.length - 1];
1130
1144
  n === "Space" && (n = " ");
@@ -1140,14 +1154,14 @@ function Nr(e) {
1140
1154
  else if (/^s(hift)?$/i.test(l))
1141
1155
  o = !0;
1142
1156
  else if (/^mod$/i.test(l))
1143
- vt() || He() ? i = !0 : s = !0;
1157
+ Mt() || Re() ? i = !0 : s = !0;
1144
1158
  else
1145
1159
  throw new Error(`Unrecognized modifier name: ${l}`);
1146
1160
  }
1147
1161
  return r && (n = `Alt-${n}`), s && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), o && (n = `Shift-${n}`), n;
1148
1162
  }
1149
- const $r = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
1150
- const o = Nr(e).split(/-(?!$)/), i = o.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), a = new KeyboardEvent("keydown", {
1163
+ const Dr = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
1164
+ const o = $r(e).split(/-(?!$)/), i = o.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), a = new KeyboardEvent("keydown", {
1151
1165
  key: i === "Space" ? " " : i,
1152
1166
  altKey: o.includes("Alt"),
1153
1167
  ctrlKey: o.includes("Ctrl"),
@@ -1164,7 +1178,7 @@ const $r = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
1164
1178
  }), !0;
1165
1179
  };
1166
1180
  function nt(e, t, n = {}) {
1167
- const { from: r, to: s, empty: o } = e.selection, i = t ? H(t, e.schema) : null, a = [];
1181
+ const { from: r, to: s, empty: o } = e.selection, i = t ? R(t, e.schema) : null, a = [];
1168
1182
  e.doc.nodesBetween(r, s, (d, p) => {
1169
1183
  if (d.isText)
1170
1184
  return;
@@ -1175,17 +1189,17 @@ function nt(e, t, n = {}) {
1175
1189
  to: f
1176
1190
  });
1177
1191
  });
1178
- const l = s - r, c = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => pt(d.node.attrs, n, { strict: !1 }));
1192
+ const l = s - r, c = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => ht(d.node.attrs, n, { strict: !1 }));
1179
1193
  return o ? !!c.length : c.reduce((d, p) => d + p.to - p.from, 0) >= l;
1180
1194
  }
1181
- const Dr = (e, t = {}) => ({ state: n, dispatch: r }) => {
1182
- const s = H(e, n.schema);
1195
+ const Nr = (e, t = {}) => ({ state: n, dispatch: r }) => {
1196
+ const s = R(e, n.schema);
1183
1197
  return nt(n, s, t) ? nn(n, r) : !1;
1184
1198
  }, Br = () => ({ state: e, dispatch: t }) => rn(e, t), jr = (e) => ({ state: t, dispatch: n }) => {
1185
- const r = H(e, t.schema);
1199
+ const r = R(e, t.schema);
1186
1200
  return sn(r)(t, n);
1187
1201
  }, Fr = () => ({ state: e, dispatch: t }) => on(e, t);
1188
- function Mt(e, t) {
1202
+ function St(e, t) {
1189
1203
  return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
1190
1204
  }
1191
1205
  function oe(e, t) {
@@ -1194,8 +1208,8 @@ function oe(e, t) {
1194
1208
  }
1195
1209
  const zr = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
1196
1210
  let o = null, i = null;
1197
- const a = Mt(typeof e == "string" ? e : e.name, r.schema);
1198
- return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = V(e, r.schema)), s && n.selection.ranges.forEach((l) => {
1211
+ const a = St(typeof e == "string" ? e : e.name, r.schema);
1212
+ return a ? (a === "node" && (o = R(e, r.schema)), a === "mark" && (i = V(e, r.schema)), s && n.selection.ranges.forEach((l) => {
1199
1213
  r.doc.nodesBetween(l.$from.pos, l.$to.pos, (c, u) => {
1200
1214
  o && o === c.type && n.setNodeMarkup(u, void 0, oe(c.attrs, t)), i && c.marks.length && c.marks.forEach((d) => {
1201
1215
  i === d.type && n.addMark(u, u + c.nodeSize, i.create(oe(d.attrs, t)));
@@ -1206,8 +1220,8 @@ const zr = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
1206
1220
  from: 0,
1207
1221
  to: e.doc.content.size
1208
1222
  }), Kr = () => ({ state: e, dispatch: t }) => an(e, t), Ur = () => ({ state: e, dispatch: t }) => ln(e, t), qr = () => ({ state: e, dispatch: t }) => cn(e, t), Gr = () => ({ state: e, dispatch: t }) => dn(e, t), Jr = () => ({ state: e, dispatch: t }) => un(e, t);
1209
- function Ht(e, t, n = {}, r = {}) {
1210
- return ht(e, t, {
1223
+ function Pt(e, t, n = {}, r = {}) {
1224
+ return ft(e, t, {
1211
1225
  slice: !1,
1212
1226
  parseOptions: n,
1213
1227
  errorOnInvalidContent: r.errorOnInvalidContent
@@ -1217,7 +1231,7 @@ const Yr = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, comm
1217
1231
  var l, c;
1218
1232
  const { doc: u } = o;
1219
1233
  if (n.preserveWhitespace !== "full") {
1220
- const d = Ht(e, s.schema, n, {
1234
+ const d = Pt(e, s.schema, n, {
1221
1235
  errorOnInvalidContent: (l = r.errorOnInvalidContent) !== null && l !== void 0 ? l : s.options.enableContentCheck
1222
1236
  });
1223
1237
  return i && o.replaceWith(0, u.content.size, d).setMeta("preventUpdate", !t), !0;
@@ -1251,7 +1265,7 @@ function Qr(e) {
1251
1265
  }
1252
1266
  return null;
1253
1267
  }
1254
- function Vo(e, t) {
1268
+ function Go(e, t) {
1255
1269
  const n = [];
1256
1270
  return e.descendants((r, s) => {
1257
1271
  t(r) && n.push({
@@ -1269,7 +1283,7 @@ function Zr(e, t, n) {
1269
1283
  });
1270
1284
  }), r;
1271
1285
  }
1272
- function Ie(e, t) {
1286
+ function Pe(e, t) {
1273
1287
  for (let n = e.depth; n > 0; n -= 1) {
1274
1288
  const r = e.node(n);
1275
1289
  if (t(r))
@@ -1281,8 +1295,8 @@ function Ie(e, t) {
1281
1295
  };
1282
1296
  }
1283
1297
  }
1284
- function Ut(e) {
1285
- return (t) => Ie(t.$from, e);
1298
+ function qt(e) {
1299
+ return (t) => Pe(t.$from, e);
1286
1300
  }
1287
1301
  function ts(e, t) {
1288
1302
  const n = Sn.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
@@ -1296,15 +1310,15 @@ function es(e, t) {
1296
1310
  return Oe(e, n, t);
1297
1311
  }
1298
1312
  function ns(e, t) {
1299
- const n = H(t, e.schema), { from: r, to: s } = e.selection, o = [];
1313
+ const n = R(t, e.schema), { from: r, to: s } = e.selection, o = [];
1300
1314
  e.doc.nodesBetween(r, s, (a) => {
1301
1315
  o.push(a);
1302
1316
  });
1303
1317
  const i = o.reverse().find((a) => a.type.name === n.name);
1304
1318
  return i ? { ...i.attrs } : {};
1305
1319
  }
1306
- function Pe(e, t) {
1307
- const n = Mt(typeof t == "string" ? t : t.name, e.schema);
1320
+ function Ie(e, t) {
1321
+ const n = St(typeof t == "string" ? t : t.name, e.schema);
1308
1322
  return n === "node" ? ns(e, t) : n === "mark" ? rt(e, t) : {};
1309
1323
  }
1310
1324
  function rs(e, t = JSON.stringify) {
@@ -1347,10 +1361,10 @@ function os(e) {
1347
1361
  });
1348
1362
  }), ss(r);
1349
1363
  }
1350
- function qt(e, t, n) {
1364
+ function Gt(e, t, n) {
1351
1365
  const r = [];
1352
1366
  return e === t ? n.resolve(e).marks().forEach((s) => {
1353
- const o = n.resolve(e), i = Wt(o, s.type);
1367
+ const o = n.resolve(e), i = Kt(o, s.type);
1354
1368
  i && r.push({
1355
1369
  mark: s,
1356
1370
  ...i
@@ -1372,44 +1386,44 @@ function dt(e, t, n) {
1372
1386
  function It(e, t, n = {}) {
1373
1387
  const { empty: r, ranges: s } = e.selection, o = t ? V(t, e.schema) : null;
1374
1388
  if (r)
1375
- return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => pt(d.attrs, n, { strict: !1 }));
1389
+ return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => ht(d.attrs, n, { strict: !1 }));
1376
1390
  let i = 0;
1377
1391
  const a = [];
1378
1392
  if (s.forEach(({ $from: d, $to: p }) => {
1379
1393
  const h = d.pos, f = p.pos;
1380
- e.doc.nodesBetween(h, f, (y, g) => {
1381
- if (!y.isText && !y.marks.length)
1394
+ e.doc.nodesBetween(h, f, (m, y) => {
1395
+ if (!m.isText && !m.marks.length)
1382
1396
  return;
1383
- const m = Math.max(h, g), k = Math.min(f, g + y.nodeSize), b = k - m;
1384
- i += b, a.push(...y.marks.map((S) => ({
1385
- mark: S,
1386
- from: m,
1397
+ const g = Math.max(h, y), k = Math.min(f, y + m.nodeSize), b = k - g;
1398
+ i += b, a.push(...m.marks.map((M) => ({
1399
+ mark: M,
1400
+ from: g,
1387
1401
  to: k
1388
1402
  })));
1389
1403
  });
1390
1404
  }), i === 0)
1391
1405
  return !1;
1392
- const l = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => pt(d.mark.attrs, n, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), c = a.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, p) => d + p.to - p.from, 0);
1406
+ const l = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => ht(d.mark.attrs, n, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), c = a.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, p) => d + p.to - p.from, 0);
1393
1407
  return (l > 0 ? l + c : l) >= i;
1394
1408
  }
1395
1409
  function is(e, t, n = {}) {
1396
1410
  if (!t)
1397
1411
  return nt(e, null, n) || It(e, null, n);
1398
- const r = Mt(t, e.schema);
1412
+ const r = St(t, e.schema);
1399
1413
  return r === "node" ? nt(e, t, n) : r === "mark" ? It(e, t, n) : !1;
1400
1414
  }
1401
1415
  function ie(e, t) {
1402
- const { nodeExtensions: n } = gt(t), r = n.find((i) => i.name === e);
1416
+ const { nodeExtensions: n } = yt(t), r = n.find((i) => i.name === e);
1403
1417
  if (!r)
1404
1418
  return !1;
1405
1419
  const s = {
1406
1420
  name: r.name,
1407
1421
  options: r.options,
1408
1422
  storage: r.storage
1409
- }, o = T(v(r, "group", s));
1423
+ }, o = E(v(r, "group", s));
1410
1424
  return typeof o != "string" ? !1 : o.split(" ").includes("list");
1411
1425
  }
1412
- function Gt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1426
+ function kt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1413
1427
  var r;
1414
1428
  if (n) {
1415
1429
  if (e.type.name === "hardBreak")
@@ -1426,16 +1440,16 @@ function Gt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1426
1440
  if (t) {
1427
1441
  let s = !0;
1428
1442
  return e.content.forEach((o) => {
1429
- s !== !1 && (Gt(o, { ignoreWhitespace: n, checkChildren: t }) || (s = !1));
1443
+ s !== !1 && (kt(o, { ignoreWhitespace: n, checkChildren: t }) || (s = !1));
1430
1444
  }), s;
1431
1445
  }
1432
1446
  return !1;
1433
1447
  }
1434
- function Ne(e) {
1448
+ function $e(e) {
1435
1449
  return e instanceof Z;
1436
1450
  }
1437
1451
  function as(e, t, n) {
1438
- const s = e.state.doc.content.size, o = B(t, 0, s), i = B(n, 0, s), a = e.coordsAtPos(o), l = e.coordsAtPos(i, -1), c = Math.min(a.top, l.top), u = Math.max(a.bottom, l.bottom), d = Math.min(a.left, l.left), p = Math.max(a.right, l.right), h = p - d, f = u - c, m = {
1452
+ const s = e.state.doc.content.size, o = B(t, 0, s), i = B(n, 0, s), a = e.coordsAtPos(o), l = e.coordsAtPos(i, -1), c = Math.min(a.top, l.top), u = Math.max(a.bottom, l.bottom), d = Math.min(a.left, l.left), p = Math.max(a.right, l.right), h = p - d, f = u - c, g = {
1439
1453
  top: c,
1440
1454
  bottom: u,
1441
1455
  left: d,
@@ -1446,15 +1460,15 @@ function as(e, t, n) {
1446
1460
  y: c
1447
1461
  };
1448
1462
  return {
1449
- ...m,
1450
- toJSON: () => m
1463
+ ...g,
1464
+ toJSON: () => g
1451
1465
  };
1452
1466
  }
1453
1467
  function ls(e, t, n) {
1454
1468
  var r;
1455
1469
  const { selection: s } = t;
1456
1470
  let o = null;
1457
- if (Kt(s) && (o = s.$cursor), o) {
1471
+ if (Ut(s) && (o = s.$cursor), o) {
1458
1472
  const a = (r = e.storedMarks) !== null && r !== void 0 ? r : o.marks();
1459
1473
  return !!n.isInSet(a) || !a.some((l) => l.type.excludes(n));
1460
1474
  }
@@ -1465,7 +1479,7 @@ function ls(e, t, n) {
1465
1479
  if (c)
1466
1480
  return !1;
1467
1481
  if (u.isInline) {
1468
- const h = !p || p.type.allowsMarkType(n), f = !!n.isInSet(u.marks) || !u.marks.some((y) => y.type.excludes(n));
1482
+ const h = !p || p.type.allowsMarkType(n), f = !!n.isInSet(u.marks) || !u.marks.some((m) => m.type.excludes(n));
1469
1483
  c = h && f;
1470
1484
  }
1471
1485
  return !c;
@@ -1485,18 +1499,18 @@ const cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1485
1499
  a.forEach((c) => {
1486
1500
  const u = c.$from.pos, d = c.$to.pos;
1487
1501
  r.doc.nodesBetween(u, d, (p, h) => {
1488
- const f = Math.max(h, u), y = Math.min(h + p.nodeSize, d);
1489
- p.marks.find((m) => m.type === l) ? p.marks.forEach((m) => {
1490
- l === m.type && n.addMark(f, y, l.create({
1491
- ...m.attrs,
1502
+ const f = Math.max(h, u), m = Math.min(h + p.nodeSize, d);
1503
+ p.marks.find((g) => g.type === l) ? p.marks.forEach((g) => {
1504
+ l === g.type && n.addMark(f, m, l.create({
1505
+ ...g.attrs,
1492
1506
  ...t
1493
1507
  }));
1494
- }) : n.addMark(f, y, l.create(t));
1508
+ }) : n.addMark(f, m, l.create(t));
1495
1509
  });
1496
1510
  });
1497
1511
  return ls(r, n, l);
1498
1512
  }, ds = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), us = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
1499
- const o = H(e, n.schema);
1513
+ const o = R(e, n.schema);
1500
1514
  return o.isTextblock ? s().command(({ commands: i }) => Yt(o, t)(n) ? !0 : i.clearNodes()).command(({ state: i }) => Yt(o, t)(i, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1501
1515
  }, ps = (e) => ({ tr: t, dispatch: n }) => {
1502
1516
  if (n) {
@@ -1506,12 +1520,12 @@ const cs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1506
1520
  return !0;
1507
1521
  }, hs = (e) => ({ tr: t, dispatch: n }) => {
1508
1522
  if (n) {
1509
- const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = N.atStart(r).from, a = N.atEnd(r).to, l = B(s, i, a), c = B(o, i, a), u = N.create(r, l, c);
1523
+ const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = D.atStart(r).from, a = D.atEnd(r).to, l = B(s, i, a), c = B(o, i, a), u = D.create(r, l, c);
1510
1524
  t.setSelection(u);
1511
1525
  }
1512
1526
  return !0;
1513
1527
  }, fs = (e) => ({ state: t, dispatch: n }) => {
1514
- const r = H(e, t.schema);
1528
+ const r = R(e, t.schema);
1515
1529
  return pn(r)(t, n);
1516
1530
  };
1517
1531
  function ae(e, t) {
@@ -1540,16 +1554,16 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
1540
1554
  attrs: u
1541
1555
  }
1542
1556
  ] : void 0), r) {
1543
- if (f && (o instanceof N && t.deleteSelection(), t.split(t.mapping.map(a.pos), 1, h), p && !d && !a.parentOffset && a.parent.type !== p)) {
1544
- const y = t.mapping.map(a.before()), g = t.doc.resolve(y);
1545
- a.node(-1).canReplaceWith(g.index(), g.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
1557
+ if (f && (o instanceof D && t.deleteSelection(), t.split(t.mapping.map(a.pos), 1, h), p && !d && !a.parentOffset && a.parent.type !== p)) {
1558
+ const m = t.mapping.map(a.before()), y = t.doc.resolve(m);
1559
+ a.node(-1).canReplaceWith(y.index(), y.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
1546
1560
  }
1547
1561
  e && ae(n, s.extensionManager.splittableMarks), t.scrollIntoView();
1548
1562
  }
1549
1563
  return f;
1550
1564
  }, gs = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
1551
1565
  var i;
1552
- const a = H(e, r.schema), { $from: l, $to: c } = r.selection, u = r.selection.node;
1566
+ const a = R(e, r.schema), { $from: l, $to: c } = r.selection, u = r.selection.node;
1553
1567
  if (u && u.isBlock || l.depth < 2 || !l.sameParent(c))
1554
1568
  return !1;
1555
1569
  const d = l.node(-1);
@@ -1560,89 +1574,90 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
1560
1574
  if (l.depth === 2 || l.node(-3).type !== a || l.index(-2) !== l.node(-2).childCount - 1)
1561
1575
  return !1;
1562
1576
  if (s) {
1563
- let m = ct.empty;
1577
+ let g = ct.empty;
1564
1578
  const k = l.index(-1) ? 1 : l.index(-2) ? 2 : 3;
1565
- for (let A = l.depth - k; A >= l.depth - 3; A -= 1)
1566
- m = ct.from(l.node(A).copy(m));
1567
- const b = l.indexAfter(-1) < l.node(-2).childCount ? 1 : l.indexAfter(-2) < l.node(-3).childCount ? 2 : 3, S = {
1579
+ for (let x = l.depth - k; x >= l.depth - 3; x -= 1)
1580
+ g = ct.from(l.node(x).copy(g));
1581
+ const b = l.indexAfter(-1) < l.node(-2).childCount ? 1 : l.indexAfter(-2) < l.node(-3).childCount ? 2 : 3, M = {
1568
1582
  ...dt(p, l.node().type.name, l.node().attrs),
1569
1583
  ...t
1570
- }, w = ((i = a.contentMatch.defaultType) === null || i === void 0 ? void 0 : i.createAndFill(S)) || void 0;
1571
- m = m.append(ct.from(a.createAndFill(null, w) || void 0));
1572
- const M = l.before(l.depth - (k - 1));
1573
- n.replace(M, l.after(-b), new hn(m, 4 - k, 0));
1584
+ }, w = ((i = a.contentMatch.defaultType) === null || i === void 0 ? void 0 : i.createAndFill(M)) || void 0;
1585
+ g = g.append(ct.from(a.createAndFill(null, w) || void 0));
1586
+ const S = l.before(l.depth - (k - 1));
1587
+ n.replace(S, l.after(-b), new hn(g, 4 - k, 0));
1574
1588
  let C = -1;
1575
- n.doc.nodesBetween(M, n.doc.content.size, (A, E) => {
1589
+ n.doc.nodesBetween(S, n.doc.content.size, (x, T) => {
1576
1590
  if (C > -1)
1577
1591
  return !1;
1578
- A.isTextblock && A.content.size === 0 && (C = E + 1);
1579
- }), C > -1 && n.setSelection(N.near(n.doc.resolve(C))), n.scrollIntoView();
1592
+ x.isTextblock && x.content.size === 0 && (C = T + 1);
1593
+ }), C > -1 && n.setSelection(D.near(n.doc.resolve(C))), n.scrollIntoView();
1580
1594
  }
1581
1595
  return !0;
1582
1596
  }
1583
1597
  const h = c.pos === l.end() ? d.contentMatchAt(0).defaultType : null, f = {
1584
1598
  ...dt(p, d.type.name, d.attrs),
1585
1599
  ...t
1586
- }, y = {
1600
+ }, m = {
1587
1601
  ...dt(p, l.node().type.name, l.node().attrs),
1588
1602
  ...t
1589
1603
  };
1590
1604
  n.delete(l.pos, c.pos);
1591
- const g = h ? [
1605
+ const y = h ? [
1592
1606
  { type: a, attrs: f },
1593
- { type: h, attrs: y }
1607
+ { type: h, attrs: m }
1594
1608
  ] : [{ type: a, attrs: f }];
1595
1609
  if (!lt(n.doc, l.pos, 2))
1596
1610
  return !1;
1597
1611
  if (s) {
1598
- const { selection: m, storedMarks: k } = r, { splittableMarks: b } = o.extensionManager, S = k || m.$to.parentOffset && m.$from.marks();
1599
- if (n.split(l.pos, 2, g).scrollIntoView(), !S || !s)
1612
+ const { selection: g, storedMarks: k } = r, { splittableMarks: b } = o.extensionManager, M = k || g.$to.parentOffset && g.$from.marks();
1613
+ if (n.split(l.pos, 2, y).scrollIntoView(), !M || !s)
1600
1614
  return !0;
1601
- const w = S.filter((M) => b.includes(M.type.name));
1615
+ const w = M.filter((S) => b.includes(S.type.name));
1602
1616
  n.ensureMarks(w);
1603
1617
  }
1604
1618
  return !0;
1605
- }, Et = (e, t) => {
1606
- const n = Ut((i) => i.type === t)(e.selection);
1619
+ }, At = (e, t) => {
1620
+ const n = qt((i) => i.type === t)(e.selection);
1607
1621
  if (!n)
1608
1622
  return !0;
1609
1623
  const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1610
1624
  if (r === void 0)
1611
1625
  return !0;
1612
1626
  const s = e.doc.nodeAt(r);
1613
- return n.node.type === (s == null ? void 0 : s.type) && Bt(e.doc, n.pos) && e.join(n.pos), !0;
1614
- }, Ct = (e, t) => {
1615
- const n = Ut((i) => i.type === t)(e.selection);
1627
+ return n.node.type === (s == null ? void 0 : s.type) && jt(e.doc, n.pos) && e.join(n.pos), !0;
1628
+ }, xt = (e, t) => {
1629
+ const n = qt((i) => i.type === t)(e.selection);
1616
1630
  if (!n)
1617
1631
  return !0;
1618
1632
  const r = e.doc.resolve(n.start).after(n.depth);
1619
1633
  if (r === void 0)
1620
1634
  return !0;
1621
1635
  const s = e.doc.nodeAt(r);
1622
- return n.node.type === (s == null ? void 0 : s.type) && Bt(e.doc, r) && e.join(r), !0;
1636
+ return n.node.type === (s == null ? void 0 : s.type) && jt(e.doc, r) && e.join(r), !0;
1623
1637
  }, ys = (e, t, n, r = {}) => ({ editor: s, tr: o, state: i, dispatch: a, chain: l, commands: c, can: u }) => {
1624
- const { extensions: d, splittableMarks: p } = s.extensionManager, h = H(e, i.schema), f = H(t, i.schema), { selection: y, storedMarks: g } = i, { $from: m, $to: k } = y, b = m.blockRange(k), S = g || y.$to.parentOffset && y.$from.marks();
1638
+ const { extensions: d, splittableMarks: p } = s.extensionManager, h = R(e, i.schema), f = R(t, i.schema), { selection: m, storedMarks: y } = i, { $from: g, $to: k } = m, b = g.blockRange(k), M = y || m.$to.parentOffset && m.$from.marks();
1625
1639
  if (!b)
1626
1640
  return !1;
1627
- const w = Ut((M) => ie(M.type.name, d))(y);
1641
+ const w = qt((S) => ie(S.type.name, d))(m);
1628
1642
  if (b.depth >= 1 && w && b.depth - w.depth <= 1) {
1629
1643
  if (w.node.type === h)
1630
1644
  return c.liftListItem(f);
1631
1645
  if (ie(w.node.type.name, d) && h.validContent(w.node.content) && a)
1632
- return l().command(() => (o.setNodeMarkup(w.pos, h), !0)).command(() => Et(o, h)).command(() => Ct(o, h)).run();
1646
+ return l().command(() => (o.setNodeMarkup(w.pos, h), !0)).command(() => At(o, h)).command(() => xt(o, h)).run();
1633
1647
  }
1634
- return !n || !S || !a ? l().command(() => u().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() => Et(o, h)).command(() => Ct(o, h)).run() : l().command(() => {
1635
- const M = u().wrapInList(h, r), C = S.filter((A) => p.includes(A.type.name));
1636
- return o.ensureMarks(C), M ? !0 : c.clearNodes();
1637
- }).wrapInList(h, r).command(() => Et(o, h)).command(() => Ct(o, h)).run();
1648
+ return !n || !M || !a ? l().command(() => u().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() => At(o, h)).command(() => xt(o, h)).run() : l().command(() => {
1649
+ const S = u().wrapInList(h, r), C = M.filter((x) => p.includes(x.type.name));
1650
+ return o.ensureMarks(C), S ? !0 : c.clearNodes();
1651
+ }).wrapInList(h, r).command(() => At(o, h)).command(() => xt(o, h)).run();
1638
1652
  }, bs = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
1639
1653
  const { extendEmptyMarkRange: o = !1 } = n, i = V(e, r.schema);
1640
1654
  return It(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
1641
1655
  }, vs = (e, t, n = {}) => ({ state: r, commands: s }) => {
1642
- const o = H(e, r.schema), i = H(t, r.schema);
1643
- return nt(r, o, n) ? s.setNode(i) : s.setNode(o, n);
1656
+ const o = R(e, r.schema), i = R(t, r.schema), a = nt(r, o, n);
1657
+ let l;
1658
+ return r.selection.$anchor.sameParent(r.selection.$head) && (l = r.selection.$anchor.parent.attrs), a ? s.setNode(i, l) : s.setNode(o, { ...l, ...n });
1644
1659
  }, Ms = (e, t = {}) => ({ state: n, commands: r }) => {
1645
- const s = H(e, n.schema);
1660
+ const s = R(e, n.schema);
1646
1661
  return nt(n, s, t) ? r.lift(s) : r.wrapIn(s, t);
1647
1662
  }, Ss = () => ({ state: e, dispatch: t }) => {
1648
1663
  const n = e.plugins;
@@ -1676,17 +1691,17 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
1676
1691
  return !0;
1677
1692
  if (u && i) {
1678
1693
  let { from: p, to: h } = a;
1679
- const f = (o = c.marks().find((g) => g.type === l)) === null || o === void 0 ? void 0 : o.attrs, y = Wt(c, l, f);
1680
- y && (p = y.from, h = y.to), n.removeMark(p, h, l);
1694
+ const f = (o = c.marks().find((y) => y.type === l)) === null || o === void 0 ? void 0 : o.attrs, m = Kt(c, l, f);
1695
+ m && (p = m.from, h = m.to), n.removeMark(p, h, l);
1681
1696
  } else
1682
1697
  d.forEach((p) => {
1683
1698
  n.removeMark(p.$from.pos, p.$to.pos, l);
1684
1699
  });
1685
1700
  return n.removeStoredMark(l), !0;
1686
- }, Ts = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1701
+ }, Es = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1687
1702
  let o = null, i = null;
1688
- const a = Mt(typeof e == "string" ? e : e.name, r.schema);
1689
- return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = V(e, r.schema)), s && n.selection.ranges.forEach((l) => {
1703
+ const a = St(typeof e == "string" ? e : e.name, r.schema);
1704
+ return a ? (a === "node" && (o = R(e, r.schema)), a === "mark" && (i = V(e, r.schema)), s && n.selection.ranges.forEach((l) => {
1690
1705
  const c = l.$from.pos, u = l.$to.pos;
1691
1706
  r.doc.nodesBetween(c, u, (d, p) => {
1692
1707
  o && o === d.type && n.setNodeMarkup(p, void 0, {
@@ -1694,8 +1709,8 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
1694
1709
  ...t
1695
1710
  }), i && d.marks.length && d.marks.forEach((h) => {
1696
1711
  if (i === h.type) {
1697
- const f = Math.max(p, c), y = Math.min(p + d.nodeSize, u);
1698
- n.addMark(f, y, i.create({
1712
+ const f = Math.max(p, c), m = Math.min(p + d.nodeSize, u);
1713
+ n.addMark(f, m, i.create({
1699
1714
  ...h.attrs,
1700
1715
  ...t
1701
1716
  }));
@@ -1703,14 +1718,14 @@ const ms = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
1703
1718
  });
1704
1719
  });
1705
1720
  }), !0) : !1;
1706
- }, Es = (e, t = {}) => ({ state: n, dispatch: r }) => {
1707
- const s = H(e, n.schema);
1721
+ }, Ts = (e, t = {}) => ({ state: n, dispatch: r }) => {
1722
+ const s = R(e, n.schema);
1708
1723
  return fn(s, t)(n, r);
1709
1724
  }, Cs = (e, t = {}) => ({ state: n, dispatch: r }) => {
1710
- const s = H(e, n.schema);
1725
+ const s = R(e, n.schema);
1711
1726
  return mn(s, t)(n, r);
1712
1727
  };
1713
- var xs = /* @__PURE__ */ Object.freeze({
1728
+ var As = /* @__PURE__ */ Object.freeze({
1714
1729
  __proto__: null,
1715
1730
  blur: ar,
1716
1731
  clearContent: lr,
@@ -1728,18 +1743,18 @@ var xs = /* @__PURE__ */ Object.freeze({
1728
1743
  first: Sr,
1729
1744
  focus: kr,
1730
1745
  forEach: wr,
1731
- insertContent: Tr,
1732
- insertContentAt: xr,
1746
+ insertContent: Er,
1747
+ insertContentAt: Ar,
1733
1748
  joinBackward: Lr,
1734
1749
  joinDown: Or,
1735
- joinForward: Rr,
1736
- joinItemBackward: _r,
1737
- joinItemForward: Hr,
1738
- joinTextblockBackward: Ir,
1739
- joinTextblockForward: Pr,
1740
- joinUp: Ar,
1741
- keyboardShortcut: $r,
1742
- lift: Dr,
1750
+ joinForward: _r,
1751
+ joinItemBackward: Hr,
1752
+ joinItemForward: Rr,
1753
+ joinTextblockBackward: Pr,
1754
+ joinTextblockForward: Ir,
1755
+ joinUp: xr,
1756
+ keyboardShortcut: Dr,
1757
+ lift: Nr,
1743
1758
  liftEmptyBlock: Br,
1744
1759
  liftListItem: jr,
1745
1760
  newlineInCode: Fr,
@@ -1767,18 +1782,18 @@ var xs = /* @__PURE__ */ Object.freeze({
1767
1782
  undoInputRule: Ss,
1768
1783
  unsetAllMarks: ks,
1769
1784
  unsetMark: ws,
1770
- updateAttributes: Ts,
1771
- wrapIn: Es,
1785
+ updateAttributes: Es,
1786
+ wrapIn: Ts,
1772
1787
  wrapInList: Cs
1773
1788
  });
1774
- const As = R.create({
1789
+ const xs = _.create({
1775
1790
  name: "commands",
1776
1791
  addCommands() {
1777
1792
  return {
1778
- ...xs
1793
+ ...As
1779
1794
  };
1780
1795
  }
1781
- }), Os = R.create({
1796
+ }), Os = _.create({
1782
1797
  name: "editable",
1783
1798
  addProseMirrorPlugins() {
1784
1799
  return [
@@ -1790,7 +1805,7 @@ const As = R.create({
1790
1805
  })
1791
1806
  ];
1792
1807
  }
1793
- }), Ls = R.create({
1808
+ }), Ls = _.create({
1794
1809
  name: "focusEvents",
1795
1810
  addProseMirrorPlugins() {
1796
1811
  const { editor: e } = this;
@@ -1814,15 +1829,15 @@ const As = R.create({
1814
1829
  })
1815
1830
  ];
1816
1831
  }
1817
- }), Rs = R.create({
1832
+ }), _s = _.create({
1818
1833
  name: "keymap",
1819
1834
  addKeyboardShortcuts() {
1820
1835
  const e = () => this.editor.commands.first(({ commands: i }) => [
1821
1836
  () => i.undoInputRule(),
1822
1837
  // maybe convert first text block node to default node
1823
1838
  () => i.command(({ tr: a }) => {
1824
- const { selection: l, doc: c } = a, { empty: u, $anchor: d } = l, { pos: p, parent: h } = d, f = d.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : d, y = f.parent.type.spec.isolating, g = d.pos - d.parentOffset, m = y && f.parent.childCount === 1 ? g === d.pos : G.atStart(c).from === p;
1825
- return !u || !h.type.isTextblock || h.textContent.length || !m || m && d.parent.type.name === "paragraph" ? !1 : i.clearNodes();
1839
+ const { selection: l, doc: c } = a, { empty: u, $anchor: d } = l, { pos: p, parent: h } = d, f = d.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : d, m = f.parent.type.spec.isolating, y = d.pos - d.parentOffset, g = m && f.parent.childCount === 1 ? y === d.pos : G.atStart(c).from === p;
1840
+ return !u || !h.type.isTextblock || h.textContent.length || !g || g && d.parent.type.name === "paragraph" ? !1 : i.clearNodes();
1826
1841
  }),
1827
1842
  () => i.deleteSelection(),
1828
1843
  () => i.joinBackward(),
@@ -1859,7 +1874,7 @@ const As = R.create({
1859
1874
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
1860
1875
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
1861
1876
  };
1862
- return vt() || He() ? o : s;
1877
+ return Mt() || Re() ? o : s;
1863
1878
  },
1864
1879
  addProseMirrorPlugins() {
1865
1880
  return [
@@ -1871,25 +1886,26 @@ const As = R.create({
1871
1886
  new P({
1872
1887
  key: new $("clearDocument"),
1873
1888
  appendTransaction: (e, t, n) => {
1874
- if (!(e.some((f) => f.docChanged) && !t.doc.eq(n.doc)))
1889
+ const r = e.some((m) => m.docChanged) && !t.doc.eq(n.doc), s = e.some((m) => m.getMeta("preventClearDocument"));
1890
+ if (!r || s)
1875
1891
  return;
1876
- const { empty: s, from: o, to: i } = t.selection, a = G.atStart(t.doc).from, l = G.atEnd(t.doc).to;
1877
- if (s || !(o === a && i === l) || !(n.doc.textBetween(0, n.doc.content.size, " ", " ").length === 0))
1892
+ const { empty: o, from: i, to: a } = t.selection, l = G.atStart(t.doc).from, c = G.atEnd(t.doc).to;
1893
+ if (o || !(i === l && a === c) || !kt(n.doc))
1878
1894
  return;
1879
- const d = n.tr, p = ft({
1895
+ const p = n.tr, h = mt({
1880
1896
  state: n,
1881
- transaction: d
1882
- }), { commands: h } = new mt({
1897
+ transaction: p
1898
+ }), { commands: f } = new gt({
1883
1899
  editor: this.editor,
1884
- state: p
1900
+ state: h
1885
1901
  });
1886
- if (h.clearNodes(), !!d.steps.length)
1887
- return d;
1902
+ if (f.clearNodes(), !!p.steps.length)
1903
+ return p;
1888
1904
  }
1889
1905
  })
1890
1906
  ];
1891
1907
  }
1892
- }), _s = R.create({
1908
+ }), Hs = _.create({
1893
1909
  name: "tabindex",
1894
1910
  addProseMirrorPlugins() {
1895
1911
  return [
@@ -2022,7 +2038,21 @@ class q {
2022
2038
  this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name, t).setTextSelection(n.from).run();
2023
2039
  }
2024
2040
  }
2025
- const Hs = `.ProseMirror {
2041
+ const Rs = (e) => new P({
2042
+ key: new $("tiptapDrop"),
2043
+ props: {
2044
+ handleDrop: (t, n, r, s) => {
2045
+ e(n, r, s);
2046
+ }
2047
+ }
2048
+ }), Ps = (e) => new P({
2049
+ key: new $("tiptapPaste"),
2050
+ props: {
2051
+ handlePaste: (t, n, r) => {
2052
+ e(n, r);
2053
+ }
2054
+ }
2055
+ }), Is = `.ProseMirror {
2026
2056
  position: relative;
2027
2057
  }
2028
2058
 
@@ -2097,14 +2127,14 @@ img.ProseMirror-separator {
2097
2127
  .tippy-box[data-animation=fade][data-state=hidden] {
2098
2128
  opacity: 0
2099
2129
  }`;
2100
- function Is(e, t, n) {
2130
+ function $s(e, t, n) {
2101
2131
  const r = document.querySelector("style[data-tiptap-style]");
2102
2132
  if (r !== null)
2103
2133
  return r;
2104
2134
  const s = document.createElement("style");
2105
2135
  return t && s.setAttribute("nonce", t), s.setAttribute("data-tiptap-style", ""), s.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(s), s;
2106
2136
  }
2107
- class Ps extends Kn {
2137
+ class Ds extends Kn {
2108
2138
  constructor(t = {}) {
2109
2139
  super(), this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.options = {
2110
2140
  element: document.createElement("div"),
@@ -2131,8 +2161,10 @@ class Ps extends Kn {
2131
2161
  onDestroy: () => null,
2132
2162
  onContentError: ({ error: n }) => {
2133
2163
  throw n;
2134
- }
2135
- }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.setOptions(t), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("contentError", this.options.onContentError), this.createView(), this.injectCSS(), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), window.setTimeout(() => {
2164
+ },
2165
+ onPaste: () => null,
2166
+ onDrop: () => null
2167
+ }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.setOptions(t), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("contentError", this.options.onContentError), this.createView(), this.injectCSS(), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.options.onPaste && this.registerPlugin(Ps(this.options.onPaste)), this.options.onDrop && this.registerPlugin(Rs(this.options.onDrop)), window.setTimeout(() => {
2136
2168
  this.isDestroyed || (this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0);
2137
2169
  }, 0);
2138
2170
  }
@@ -2164,7 +2196,7 @@ class Ps extends Kn {
2164
2196
  * Inject CSS styles.
2165
2197
  */
2166
2198
  injectCSS() {
2167
- this.options.injectCSS && document && (this.css = Is(Hs, this.options.injectNonce));
2199
+ this.options.injectCSS && document && (this.css = $s(Is, this.options.injectNonce));
2168
2200
  }
2169
2201
  /**
2170
2202
  * Update editor options.
@@ -2200,15 +2232,17 @@ class Ps extends Kn {
2200
2232
  *
2201
2233
  * @param plugin A ProseMirror plugin
2202
2234
  * @param handlePlugins Control how to merge the plugin into the existing plugins.
2235
+ * @returns The new editor state
2203
2236
  */
2204
2237
  registerPlugin(t, n) {
2205
- const r = Ae(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
2206
- this.view.updateState(s);
2238
+ const r = xe(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
2239
+ return this.view.updateState(s), s;
2207
2240
  }
2208
2241
  /**
2209
2242
  * Unregister a ProseMirror plugin.
2210
2243
  *
2211
2244
  * @param nameOrPluginKey The plugins name
2245
+ * @returns The new editor state or undefined if the editor is destroyed
2212
2246
  */
2213
2247
  unregisterPlugin(t) {
2214
2248
  if (this.isDestroyed)
@@ -2217,7 +2251,7 @@ class Ps extends Kn {
2217
2251
  // @ts-ignore
2218
2252
  plugins: this.state.plugins.filter((s) => !s.key.startsWith(n))
2219
2253
  });
2220
- this.view.updateState(r);
2254
+ return this.view.updateState(r), r;
2221
2255
  }
2222
2256
  /**
2223
2257
  * Creates an extension manager.
@@ -2229,18 +2263,18 @@ class Ps extends Kn {
2229
2263
  ir.configure({
2230
2264
  blockSeparator: (n = (t = this.options.coreExtensionOptions) === null || t === void 0 ? void 0 : t.clipboardTextSerializer) === null || n === void 0 ? void 0 : n.blockSeparator
2231
2265
  }),
2232
- As,
2266
+ xs,
2233
2267
  Ls,
2234
- Rs,
2235
- _s
2236
- ] : [], ...this.options.extensions].filter((o) => ["extension", "node", "mark"].includes(o == null ? void 0 : o.type));
2268
+ _s,
2269
+ Hs
2270
+ ].filter((o) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[o.name] !== !1 : !0) : [], ...this.options.extensions].filter((o) => ["extension", "node", "mark"].includes(o == null ? void 0 : o.type));
2237
2271
  this.extensionManager = new Q(s, this);
2238
2272
  }
2239
2273
  /**
2240
2274
  * Creates an command manager.
2241
2275
  */
2242
2276
  createCommandManager() {
2243
- this.commandManager = new mt({
2277
+ this.commandManager = new gt({
2244
2278
  editor: this
2245
2279
  });
2246
2280
  }
@@ -2256,7 +2290,7 @@ class Ps extends Kn {
2256
2290
  createView() {
2257
2291
  let t;
2258
2292
  try {
2259
- t = Ht(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
2293
+ t = Pt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
2260
2294
  } catch (o) {
2261
2295
  if (!(o instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(o.message))
2262
2296
  throw o;
@@ -2266,9 +2300,9 @@ class Ps extends Kn {
2266
2300
  disableCollaboration: () => {
2267
2301
  this.options.extensions = this.options.extensions.filter((i) => i.name !== "collaboration"), this.createExtensionManager();
2268
2302
  }
2269
- }), t = Ht(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
2303
+ }), t = Pt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
2270
2304
  }
2271
- const n = Re(t, this.options.autofocus);
2305
+ const n = _e(t, this.options.autofocus);
2272
2306
  this.view = new gn(this.options.element, {
2273
2307
  ...this.options.editorProps,
2274
2308
  dispatchTransaction: this.dispatchTransaction.bind(this),
@@ -2352,7 +2386,7 @@ class Ps extends Kn {
2352
2386
  * Get attributes of the currently selected node or mark.
2353
2387
  */
2354
2388
  getAttributes(t) {
2355
- return Pe(this.state, t);
2389
+ return Ie(this.state, t);
2356
2390
  }
2357
2391
  isActive(t, n) {
2358
2392
  const r = typeof t == "string" ? t : null, s = typeof t == "string" ? n : t;
@@ -2389,7 +2423,7 @@ class Ps extends Kn {
2389
2423
  * Check if there is no content.
2390
2424
  */
2391
2425
  get isEmpty() {
2392
- return Gt(this.state.doc);
2426
+ return kt(this.state.doc);
2393
2427
  }
2394
2428
  /**
2395
2429
  * Get the number of characters for the current document.
@@ -2429,16 +2463,16 @@ class Ps extends Kn {
2429
2463
  }
2430
2464
  }
2431
2465
  function J(e) {
2432
- return new yt({
2466
+ return new bt({
2433
2467
  find: e.find,
2434
2468
  handler: ({ state: t, range: n, match: r }) => {
2435
- const s = T(e.getAttributes, void 0, r);
2469
+ const s = E(e.getAttributes, void 0, r);
2436
2470
  if (s === !1 || s === null)
2437
2471
  return null;
2438
2472
  const { tr: o } = t, i = r[r.length - 1], a = r[0];
2439
2473
  if (i) {
2440
2474
  const l = a.search(/\S/), c = n.from + a.indexOf(i), u = c + i.length;
2441
- if (qt(n.from, n.to, t.doc).filter((h) => h.mark.type.excluded.find((y) => y === e.type && y !== h.mark.type)).filter((h) => h.to > c).length)
2475
+ if (Gt(n.from, n.to, t.doc).filter((h) => h.mark.type.excluded.find((m) => m === e.type && m !== h.mark.type)).filter((h) => h.to > c).length)
2442
2476
  return null;
2443
2477
  u < n.to && o.delete(u, n.to), c > n.from && o.delete(n.from + l, c);
2444
2478
  const p = n.from + l + i.length;
@@ -2447,11 +2481,11 @@ function J(e) {
2447
2481
  }
2448
2482
  });
2449
2483
  }
2450
- function $e(e) {
2451
- return new yt({
2484
+ function De(e) {
2485
+ return new bt({
2452
2486
  find: e.find,
2453
2487
  handler: ({ state: t, range: n, match: r }) => {
2454
- const s = T(e.getAttributes, void 0, r) || {}, { tr: o } = t, i = n.from;
2488
+ const s = E(e.getAttributes, void 0, r) || {}, { tr: o } = t, i = n.from;
2455
2489
  let a = n.to;
2456
2490
  const l = e.type.create(s);
2457
2491
  if (r[1]) {
@@ -2468,11 +2502,11 @@ function $e(e) {
2468
2502
  }
2469
2503
  });
2470
2504
  }
2471
- function Pt(e) {
2472
- return new yt({
2505
+ function $t(e) {
2506
+ return new bt({
2473
2507
  find: e.find,
2474
2508
  handler: ({ state: t, range: n, match: r }) => {
2475
- const s = t.doc.resolve(n.from), o = T(e.getAttributes, void 0, r) || {};
2509
+ const s = t.doc.resolve(n.from), o = E(e.getAttributes, void 0, r) || {};
2476
2510
  if (!s.node(-1).canReplaceWith(s.index(-1), s.indexAfter(-1), e.type))
2477
2511
  return null;
2478
2512
  t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, o);
@@ -2480,17 +2514,17 @@ function Pt(e) {
2480
2514
  });
2481
2515
  }
2482
2516
  function tt(e) {
2483
- return new yt({
2517
+ return new bt({
2484
2518
  find: e.find,
2485
2519
  handler: ({ state: t, range: n, match: r, chain: s }) => {
2486
- const o = T(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), l = i.doc.resolve(n.from).blockRange(), c = l && We(l, e.type, o);
2520
+ const o = E(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), l = i.doc.resolve(n.from).blockRange(), c = l && We(l, e.type, o);
2487
2521
  if (!c)
2488
2522
  return null;
2489
2523
  if (i.wrap(l, c), e.keepMarks && e.editor) {
2490
2524
  const { selection: d, storedMarks: p } = t, { splittableMarks: h } = e.editor.extensionManager, f = p || d.$to.parentOffset && d.$from.marks();
2491
2525
  if (f) {
2492
- const y = f.filter((g) => h.includes(g.type.name));
2493
- i.ensureMarks(y);
2526
+ const m = f.filter((y) => h.includes(y.type.name));
2527
+ i.ensureMarks(m);
2494
2528
  }
2495
2529
  }
2496
2530
  if (e.keepAttributes) {
@@ -2498,7 +2532,7 @@ function tt(e) {
2498
2532
  s().updateAttributes(d, o).run();
2499
2533
  }
2500
2534
  const u = i.doc.resolve(n.from - 1).nodeBefore;
2501
- u && u.type === e.type && Bt(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, u)) && i.join(n.from - 1);
2535
+ u && u.type === e.type && jt(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, u)) && i.join(n.from - 1);
2502
2536
  }
2503
2537
  });
2504
2538
  }
@@ -2510,9 +2544,9 @@ class I {
2510
2544
  }, this.config = {
2511
2545
  ...this.config,
2512
2546
  ...t
2513
- }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = T(v(this, "addOptions", {
2547
+ }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = E(v(this, "addOptions", {
2514
2548
  name: this.name
2515
- }))), this.storage = T(v(this, "addStorage", {
2549
+ }))), this.storage = E(v(this, "addStorage", {
2516
2550
  name: this.name,
2517
2551
  options: this.options
2518
2552
  })) || {};
@@ -2523,15 +2557,15 @@ class I {
2523
2557
  configure(t = {}) {
2524
2558
  const n = this.extend({
2525
2559
  ...this.config,
2526
- addOptions: () => bt(this.options, t)
2560
+ addOptions: () => vt(this.options, t)
2527
2561
  });
2528
2562
  return n.name = this.name, n.parent = this.parent, n;
2529
2563
  }
2530
2564
  extend(t = {}) {
2531
2565
  const n = new I(t);
2532
- return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = T(v(n, "addOptions", {
2566
+ return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = E(v(n, "addOptions", {
2533
2567
  name: n.name
2534
- })), n.storage = T(v(n, "addStorage", {
2568
+ })), n.storage = E(v(n, "addStorage", {
2535
2569
  name: n.name,
2536
2570
  options: n.options
2537
2571
  })), n;
@@ -2556,9 +2590,9 @@ class L {
2556
2590
  }, this.config = {
2557
2591
  ...this.config,
2558
2592
  ...t
2559
- }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = T(v(this, "addOptions", {
2593
+ }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = E(v(this, "addOptions", {
2560
2594
  name: this.name
2561
- }))), this.storage = T(v(this, "addStorage", {
2595
+ }))), this.storage = E(v(this, "addStorage", {
2562
2596
  name: this.name,
2563
2597
  options: this.options
2564
2598
  })) || {};
@@ -2569,15 +2603,15 @@ class L {
2569
2603
  configure(t = {}) {
2570
2604
  const n = this.extend({
2571
2605
  ...this.config,
2572
- addOptions: () => bt(this.options, t)
2606
+ addOptions: () => vt(this.options, t)
2573
2607
  });
2574
2608
  return n.name = this.name, n.parent = this.parent, n;
2575
2609
  }
2576
2610
  extend(t = {}) {
2577
2611
  const n = new L(t);
2578
- return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = T(v(n, "addOptions", {
2612
+ return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = E(v(n, "addOptions", {
2579
2613
  name: n.name
2580
- })), n.storage = T(v(n, "addStorage", {
2614
+ })), n.storage = E(v(n, "addStorage", {
2581
2615
  name: n.name,
2582
2616
  options: n.options
2583
2617
  })), n;
@@ -2586,13 +2620,13 @@ class L {
2586
2620
  function Ns() {
2587
2621
  return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
2588
2622
  }
2589
- class $s {
2623
+ class Bs {
2590
2624
  constructor(t, n, r) {
2591
2625
  this.isDragging = !1, this.component = t, this.editor = n.editor, this.options = {
2592
2626
  stopEvent: null,
2593
2627
  ignoreMutation: null,
2594
2628
  ...r
2595
- }, this.extension = n.extension, this.node = n.node, this.decorations = n.decorations, this.getPos = n.getPos, this.mount();
2629
+ }, this.extension = n.extension, this.node = n.node, this.decorations = n.decorations, this.innerDecorations = n.innerDecorations, this.view = n.view, this.HTMLAttributes = n.HTMLAttributes, this.getPos = n.getPos, this.mount();
2596
2630
  }
2597
2631
  mount() {
2598
2632
  }
@@ -2609,11 +2643,14 @@ class $s {
2609
2643
  return;
2610
2644
  let p = 0, h = 0;
2611
2645
  if (this.dom !== d) {
2612
- const g = this.dom.getBoundingClientRect(), m = d.getBoundingClientRect(), k = (s = t.offsetX) !== null && s !== void 0 ? s : (o = t.nativeEvent) === null || o === void 0 ? void 0 : o.offsetX, b = (i = t.offsetY) !== null && i !== void 0 ? i : (a = t.nativeEvent) === null || a === void 0 ? void 0 : a.offsetY;
2613
- p = m.x - g.x + k, h = m.y - g.y + b;
2646
+ const g = this.dom.getBoundingClientRect(), k = d.getBoundingClientRect(), b = (s = t.offsetX) !== null && s !== void 0 ? s : (o = t.nativeEvent) === null || o === void 0 ? void 0 : o.offsetX, M = (i = t.offsetY) !== null && i !== void 0 ? i : (a = t.nativeEvent) === null || a === void 0 ? void 0 : a.offsetY;
2647
+ p = k.x - g.x + b, h = k.y - g.y + M;
2614
2648
  }
2615
2649
  (l = t.dataTransfer) === null || l === void 0 || l.setDragImage(this.dom, p, h);
2616
- const f = Z.create(c.state.doc, this.getPos()), y = c.state.tr.setSelection(f);
2650
+ const f = this.getPos();
2651
+ if (typeof f != "number")
2652
+ return;
2653
+ const m = Z.create(c.state.doc, f), y = c.state.tr.setSelection(m);
2617
2654
  c.dispatch(y);
2618
2655
  }
2619
2656
  stopEvent(t) {
@@ -2628,12 +2665,12 @@ class $s {
2628
2665
  const o = t.type.startsWith("drag"), i = t.type === "drop";
2629
2666
  if ((["INPUT", "BUTTON", "SELECT", "TEXTAREA"].includes(r.tagName) || r.isContentEditable) && !i && !o)
2630
2667
  return !0;
2631
- const { isEditable: l } = this.editor, { isDragging: c } = this, u = !!this.node.type.spec.draggable, d = Z.isSelectable(this.node), p = t.type === "copy", h = t.type === "paste", f = t.type === "cut", y = t.type === "mousedown";
2668
+ const { isEditable: l } = this.editor, { isDragging: c } = this, u = !!this.node.type.spec.draggable, d = Z.isSelectable(this.node), p = t.type === "copy", h = t.type === "paste", f = t.type === "cut", m = t.type === "mousedown";
2632
2669
  if (!u && d && o && t.preventDefault(), u && o && !c)
2633
2670
  return t.preventDefault(), !1;
2634
- if (u && l && !c && y) {
2635
- const g = r.closest("[data-drag-handle]");
2636
- g && (this.dom === g || this.dom.contains(g)) && (this.isDragging = !0, document.addEventListener("dragend", () => {
2671
+ if (u && l && !c && m) {
2672
+ const y = r.closest("[data-drag-handle]");
2673
+ y && (this.dom === y || this.dom.contains(y)) && (this.isDragging = !0, document.addEventListener("dragend", () => {
2637
2674
  this.isDragging = !1;
2638
2675
  }, { once: !0 }), document.addEventListener("drop", () => {
2639
2676
  this.isDragging = !1;
@@ -2641,25 +2678,39 @@ class $s {
2641
2678
  this.isDragging = !1;
2642
2679
  }, { once: !0 }));
2643
2680
  }
2644
- return !(c || i || p || h || f || y && d);
2681
+ return !(c || i || p || h || f || m && d);
2645
2682
  }
2683
+ /**
2684
+ * Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view.
2685
+ * @return `false` if the editor should re-read the selection or re-parse the range around the mutation
2686
+ * @return `true` if it can safely be ignored.
2687
+ */
2646
2688
  ignoreMutation(t) {
2647
- return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: t }) : this.node.isLeaf || this.node.isAtom ? !0 : t.type === "selection" || this.dom.contains(t.target) && t.type === "childList" && (vt() || Ns()) && this.editor.isFocused && [
2689
+ return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: t }) : this.node.isLeaf || this.node.isAtom ? !0 : t.type === "selection" || this.dom.contains(t.target) && t.type === "childList" && (Mt() || Ns()) && this.editor.isFocused && [
2648
2690
  ...Array.from(t.addedNodes),
2649
2691
  ...Array.from(t.removedNodes)
2650
2692
  ].every((r) => r.isContentEditable) ? !1 : this.contentDOM === t.target && t.type === "attributes" ? !0 : !this.contentDOM.contains(t.target);
2651
2693
  }
2694
+ /**
2695
+ * Update the attributes of the prosemirror node.
2696
+ */
2652
2697
  updateAttributes(t) {
2653
2698
  this.editor.commands.command(({ tr: n }) => {
2654
2699
  const r = this.getPos();
2655
- return n.setNodeMarkup(r, void 0, {
2700
+ return typeof r != "number" ? !1 : (n.setNodeMarkup(r, void 0, {
2656
2701
  ...this.node.attrs,
2657
2702
  ...t
2658
- }), !0;
2703
+ }), !0);
2659
2704
  });
2660
2705
  }
2706
+ /**
2707
+ * Delete the node.
2708
+ */
2661
2709
  deleteNode() {
2662
- const t = this.getPos(), n = t + this.node.nodeSize;
2710
+ const t = this.getPos();
2711
+ if (typeof t != "number")
2712
+ return;
2713
+ const n = t + this.node.nodeSize;
2663
2714
  this.editor.commands.deleteRange({ from: t, to: n });
2664
2715
  }
2665
2716
  }
@@ -2667,24 +2718,24 @@ function z(e) {
2667
2718
  return new Zn({
2668
2719
  find: e.find,
2669
2720
  handler: ({ state: t, range: n, match: r, pasteEvent: s }) => {
2670
- const o = T(e.getAttributes, void 0, r, s);
2721
+ const o = E(e.getAttributes, void 0, r, s);
2671
2722
  if (o === !1 || o === null)
2672
2723
  return null;
2673
2724
  const { tr: i } = t, a = r[r.length - 1], l = r[0];
2674
2725
  let c = n.to;
2675
2726
  if (a) {
2676
2727
  const u = l.search(/\S/), d = n.from + l.indexOf(a), p = d + a.length;
2677
- if (qt(n.from, n.to, t.doc).filter((f) => f.mark.type.excluded.find((g) => g === e.type && g !== f.mark.type)).filter((f) => f.to > d).length)
2728
+ if (Gt(n.from, n.to, t.doc).filter((f) => f.mark.type.excluded.find((y) => y === e.type && y !== f.mark.type)).filter((f) => f.to > d).length)
2678
2729
  return null;
2679
2730
  p < n.to && i.delete(p, n.to), d > n.from && i.delete(n.from + u, d), c = n.from + u + a.length, i.addMark(n.from + u, c, e.type.create(o || {})), i.removeStoredMark(e.type);
2680
2731
  }
2681
2732
  }
2682
2733
  });
2683
2734
  }
2684
- function Ds(e) {
2735
+ function js(e) {
2685
2736
  return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
2686
2737
  }
2687
- const Bs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, js = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, Fs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, zs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Wo = I.create({
2738
+ const Fs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, zs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, Vs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, Ws = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Jo = I.create({
2688
2739
  name: "bold",
2689
2740
  addOptions() {
2690
2741
  return {
@@ -2707,7 +2758,7 @@ const Bs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, js = /(?:^|\s
2707
2758
  ];
2708
2759
  },
2709
2760
  renderHTML({ HTMLAttributes: e }) {
2710
- return ["strong", x(this.options.HTMLAttributes, e), 0];
2761
+ return ["strong", A(this.options.HTMLAttributes, e), 0];
2711
2762
  },
2712
2763
  addCommands() {
2713
2764
  return {
@@ -2725,11 +2776,11 @@ const Bs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, js = /(?:^|\s
2725
2776
  addInputRules() {
2726
2777
  return [
2727
2778
  J({
2728
- find: Bs,
2779
+ find: Fs,
2729
2780
  type: this.type
2730
2781
  }),
2731
2782
  J({
2732
- find: Fs,
2783
+ find: Vs,
2733
2784
  type: this.type
2734
2785
  })
2735
2786
  ];
@@ -2737,21 +2788,21 @@ const Bs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, js = /(?:^|\s
2737
2788
  addPasteRules() {
2738
2789
  return [
2739
2790
  z({
2740
- find: js,
2791
+ find: zs,
2741
2792
  type: this.type
2742
2793
  }),
2743
2794
  z({
2744
- find: zs,
2795
+ find: Ws,
2745
2796
  type: this.type
2746
2797
  })
2747
2798
  ];
2748
2799
  }
2749
2800
  });
2750
- class Vs {
2801
+ class Ks {
2751
2802
  constructor({ editor: t, element: n, view: r, tippyOptions: s = {}, updateDelay: o = 250, shouldShow: i }) {
2752
2803
  this.preventHide = !1, this.shouldShow = ({ view: a, state: l, from: c, to: u }) => {
2753
- const { doc: d, selection: p } = l, { empty: h } = p, f = !d.textBetween(c, u).length && Kt(l.selection), y = this.element.contains(document.activeElement);
2754
- return !(!(a.hasFocus() || y) || h || f || !this.editor.isEditable);
2804
+ const { doc: d, selection: p } = l, { empty: h } = p, f = !d.textBetween(c, u).length && Ut(l.selection), m = this.element.contains(document.activeElement);
2805
+ return !(!(a.hasFocus() || m) || h || f || !this.editor.isEditable);
2755
2806
  }, this.mousedownHandler = () => {
2756
2807
  this.preventHide = !0;
2757
2808
  }, this.dragstartHandler = () => {
@@ -2774,31 +2825,31 @@ class Vs {
2774
2825
  }, this.updateDelay));
2775
2826
  }, this.updateHandler = (a, l, c, u) => {
2776
2827
  var d, p, h;
2777
- const { state: f, composing: y } = a, { selection: g } = f;
2778
- if (y || !l && !c)
2828
+ const { state: f, composing: m } = a, { selection: y } = f;
2829
+ if (m || !l && !c)
2779
2830
  return;
2780
2831
  this.createTooltip();
2781
- const { ranges: k } = g, b = Math.min(...k.map((M) => M.$from.pos)), S = Math.max(...k.map((M) => M.$to.pos));
2832
+ const { ranges: k } = y, b = Math.min(...k.map((S) => S.$from.pos)), M = Math.max(...k.map((S) => S.$to.pos));
2782
2833
  if (!((d = this.shouldShow) === null || d === void 0 ? void 0 : d.call(this, {
2783
2834
  editor: this.editor,
2784
2835
  view: a,
2785
2836
  state: f,
2786
2837
  oldState: u,
2787
2838
  from: b,
2788
- to: S
2839
+ to: M
2789
2840
  }))) {
2790
2841
  this.hide();
2791
2842
  return;
2792
2843
  }
2793
2844
  (p = this.tippy) === null || p === void 0 || p.setProps({
2794
2845
  getReferenceClientRect: ((h = this.tippyOptions) === null || h === void 0 ? void 0 : h.getReferenceClientRect) || (() => {
2795
- if (Ne(f.selection)) {
2796
- let M = a.nodeDOM(b);
2797
- const C = M.dataset.nodeViewWrapper ? M : M.querySelector("[data-node-view-wrapper]");
2798
- if (C && (M = C.firstChild), M)
2799
- return M.getBoundingClientRect();
2846
+ if ($e(f.selection)) {
2847
+ let S = a.nodeDOM(b);
2848
+ const C = S.dataset.nodeViewWrapper ? S : S.querySelector("[data-node-view-wrapper]");
2849
+ if (C && (S = C.firstChild), S)
2850
+ return S.getBoundingClientRect();
2800
2851
  }
2801
- return as(a, b, S);
2852
+ return as(a, b, M);
2802
2853
  })
2803
2854
  }), this.show();
2804
2855
  }, this.editor = t, this.element = n, this.view = r, this.updateDelay = o, i && (this.shouldShow = i), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = s, this.element.remove(), this.element.style.visibility = "visible";
@@ -2838,11 +2889,11 @@ class Vs {
2838
2889
  !((t = this.tippy) === null || t === void 0) && t.popper.firstChild && this.tippy.popper.firstChild.removeEventListener("blur", this.tippyBlurHandler), (n = this.tippy) === null || n === void 0 || n.destroy(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
2839
2890
  }
2840
2891
  }
2841
- const De = (e) => new P({
2892
+ const Ne = (e) => new P({
2842
2893
  key: typeof e.pluginKey == "string" ? new $(e.pluginKey) : e.pluginKey,
2843
- view: (t) => new Vs({ view: t, ...e })
2894
+ view: (t) => new Ks({ view: t, ...e })
2844
2895
  });
2845
- R.create({
2896
+ _.create({
2846
2897
  name: "bubbleMenu",
2847
2898
  addOptions() {
2848
2899
  return {
@@ -2855,7 +2906,7 @@ R.create({
2855
2906
  },
2856
2907
  addProseMirrorPlugins() {
2857
2908
  return this.options.element ? [
2858
- De({
2909
+ Ne({
2859
2910
  pluginKey: this.options.pluginKey,
2860
2911
  editor: this.editor,
2861
2912
  element: this.options.element,
@@ -2866,7 +2917,10 @@ R.create({
2866
2917
  ] : [];
2867
2918
  }
2868
2919
  });
2869
- var Nt = { exports: {} }, xt = {};
2920
+ function Us(e) {
2921
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
2922
+ }
2923
+ var Dt = { exports: {} }, Ot = {};
2870
2924
  /**
2871
2925
  * @license React
2872
2926
  * use-sync-external-store-shim.production.min.js
@@ -2877,8 +2931,8 @@ var Nt = { exports: {} }, xt = {};
2877
2931
  * LICENSE file in the root directory of this source tree.
2878
2932
  */
2879
2933
  var le;
2880
- function Ws() {
2881
- if (le) return xt;
2934
+ function qs() {
2935
+ if (le) return Ot;
2882
2936
  le = 1;
2883
2937
  var e = O;
2884
2938
  function t(d, p) {
@@ -2886,12 +2940,12 @@ function Ws() {
2886
2940
  }
2887
2941
  var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, s = e.useEffect, o = e.useLayoutEffect, i = e.useDebugValue;
2888
2942
  function a(d, p) {
2889
- var h = p(), f = r({ inst: { value: h, getSnapshot: p } }), y = f[0].inst, g = f[1];
2943
+ var h = p(), f = r({ inst: { value: h, getSnapshot: p } }), m = f[0].inst, y = f[1];
2890
2944
  return o(function() {
2891
- y.value = h, y.getSnapshot = p, l(y) && g({ inst: y });
2945
+ m.value = h, m.getSnapshot = p, l(m) && y({ inst: m });
2892
2946
  }, [d, h, p]), s(function() {
2893
- return l(y) && g({ inst: y }), d(function() {
2894
- l(y) && g({ inst: y });
2947
+ return l(m) && y({ inst: m }), d(function() {
2948
+ l(m) && y({ inst: m });
2895
2949
  });
2896
2950
  }, [d]), i(h), h;
2897
2951
  }
@@ -2909,9 +2963,9 @@ function Ws() {
2909
2963
  return p();
2910
2964
  }
2911
2965
  var u = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? c : a;
2912
- return xt.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u, xt;
2966
+ return Ot.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u, Ot;
2913
2967
  }
2914
- var At = {};
2968
+ var Lt = {};
2915
2969
  /**
2916
2970
  * @license React
2917
2971
  * use-sync-external-store-shim.development.js
@@ -2922,87 +2976,87 @@ var At = {};
2922
2976
  * LICENSE file in the root directory of this source tree.
2923
2977
  */
2924
2978
  var ce;
2925
- function Ks() {
2979
+ function Gs() {
2926
2980
  return ce || (ce = 1, process.env.NODE_ENV !== "production" && function() {
2927
2981
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2928
2982
  var e = O, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2929
2983
  function n(b) {
2930
2984
  {
2931
- for (var S = arguments.length, w = new Array(S > 1 ? S - 1 : 0), M = 1; M < S; M++)
2932
- w[M - 1] = arguments[M];
2985
+ for (var M = arguments.length, w = new Array(M > 1 ? M - 1 : 0), S = 1; S < M; S++)
2986
+ w[S - 1] = arguments[S];
2933
2987
  r("error", b, w);
2934
2988
  }
2935
2989
  }
2936
- function r(b, S, w) {
2990
+ function r(b, M, w) {
2937
2991
  {
2938
- var M = t.ReactDebugCurrentFrame, C = M.getStackAddendum();
2939
- C !== "" && (S += "%s", w = w.concat([C]));
2940
- var A = w.map(function(E) {
2941
- return String(E);
2992
+ var S = t.ReactDebugCurrentFrame, C = S.getStackAddendum();
2993
+ C !== "" && (M += "%s", w = w.concat([C]));
2994
+ var x = w.map(function(T) {
2995
+ return String(T);
2942
2996
  });
2943
- A.unshift("Warning: " + S), Function.prototype.apply.call(console[b], console, A);
2997
+ x.unshift("Warning: " + M), Function.prototype.apply.call(console[b], console, x);
2944
2998
  }
2945
2999
  }
2946
- function s(b, S) {
2947
- return b === S && (b !== 0 || 1 / b === 1 / S) || b !== b && S !== S;
3000
+ function s(b, M) {
3001
+ return b === M && (b !== 0 || 1 / b === 1 / M) || b !== b && M !== M;
2948
3002
  }
2949
3003
  var o = typeof Object.is == "function" ? Object.is : s, i = e.useState, a = e.useEffect, l = e.useLayoutEffect, c = e.useDebugValue, u = !1, d = !1;
2950
- function p(b, S, w) {
3004
+ function p(b, M, w) {
2951
3005
  u || e.startTransition !== void 0 && (u = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
2952
- var M = S();
3006
+ var S = M();
2953
3007
  if (!d) {
2954
- var C = S();
2955
- o(M, C) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), d = !0);
3008
+ var C = M();
3009
+ o(S, C) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), d = !0);
2956
3010
  }
2957
- var A = i({
3011
+ var x = i({
2958
3012
  inst: {
2959
- value: M,
2960
- getSnapshot: S
3013
+ value: S,
3014
+ getSnapshot: M
2961
3015
  }
2962
- }), E = A[0].inst, _ = A[1];
3016
+ }), T = x[0].inst, H = x[1];
2963
3017
  return l(function() {
2964
- E.value = M, E.getSnapshot = S, h(E) && _({
2965
- inst: E
3018
+ T.value = S, T.getSnapshot = M, h(T) && H({
3019
+ inst: T
2966
3020
  });
2967
- }, [b, M, S]), a(function() {
2968
- h(E) && _({
2969
- inst: E
3021
+ }, [b, S, M]), a(function() {
3022
+ h(T) && H({
3023
+ inst: T
2970
3024
  });
2971
- var D = function() {
2972
- h(E) && _({
2973
- inst: E
3025
+ var N = function() {
3026
+ h(T) && H({
3027
+ inst: T
2974
3028
  });
2975
3029
  };
2976
- return b(D);
2977
- }, [b]), c(M), M;
3030
+ return b(N);
3031
+ }, [b]), c(S), S;
2978
3032
  }
2979
3033
  function h(b) {
2980
- var S = b.getSnapshot, w = b.value;
3034
+ var M = b.getSnapshot, w = b.value;
2981
3035
  try {
2982
- var M = S();
2983
- return !o(w, M);
3036
+ var S = M();
3037
+ return !o(w, S);
2984
3038
  } catch {
2985
3039
  return !0;
2986
3040
  }
2987
3041
  }
2988
- function f(b, S, w) {
2989
- return S();
3042
+ function f(b, M, w) {
3043
+ return M();
2990
3044
  }
2991
- var y = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", g = !y, m = g ? f : p, k = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : m;
2992
- At.useSyncExternalStore = k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2993
- }()), At;
3045
+ var m = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", y = !m, g = y ? f : p, k = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : g;
3046
+ Lt.useSyncExternalStore = k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
3047
+ }()), Lt;
2994
3048
  }
2995
- process.env.NODE_ENV === "production" ? Nt.exports = Ws() : Nt.exports = Ks();
2996
- var St = Nt.exports;
2997
- const Us = (...e) => (t) => {
3049
+ process.env.NODE_ENV === "production" ? Dt.exports = qs() : Dt.exports = Gs();
3050
+ var wt = Dt.exports;
3051
+ const Js = (...e) => (t) => {
2998
3052
  e.forEach((n) => {
2999
3053
  typeof n == "function" ? n(t) : n && (n.current = t);
3000
3054
  });
3001
- }, qs = ({ contentComponent: e }) => {
3002
- const t = St.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getServerSnapshot);
3055
+ }, Ys = ({ contentComponent: e }) => {
3056
+ const t = wt.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getServerSnapshot);
3003
3057
  return O.createElement(O.Fragment, null, Object.values(t));
3004
3058
  };
3005
- function Gs() {
3059
+ function Xs() {
3006
3060
  const e = /* @__PURE__ */ new Set();
3007
3061
  let t = {};
3008
3062
  return {
@@ -3038,7 +3092,7 @@ function Gs() {
3038
3092
  }
3039
3093
  };
3040
3094
  }
3041
- class Js extends O.Component {
3095
+ class Qs extends O.Component {
3042
3096
  constructor(t) {
3043
3097
  var n;
3044
3098
  super(t), this.editorContentRef = O.createRef(), this.initialized = !1, this.state = {
@@ -3059,7 +3113,7 @@ class Js extends O.Component {
3059
3113
  const n = this.editorContentRef.current;
3060
3114
  n.append(...t.options.element.childNodes), t.setOptions({
3061
3115
  element: n
3062
- }), t.contentComponent = Gs(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => {
3116
+ }), t.contentComponent = Xs(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => {
3063
3117
  this.setState((r) => r.hasContentComponentInitialized ? r : {
3064
3118
  hasContentComponentInitialized: !0
3065
3119
  }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
@@ -3082,20 +3136,65 @@ class Js extends O.Component {
3082
3136
  return O.createElement(
3083
3137
  O.Fragment,
3084
3138
  null,
3085
- O.createElement("div", { ref: Us(n, this.editorContentRef), ...r }),
3086
- (t == null ? void 0 : t.contentComponent) && O.createElement(qs, { contentComponent: t.contentComponent })
3139
+ O.createElement("div", { ref: Js(n, this.editorContentRef), ...r }),
3140
+ (t == null ? void 0 : t.contentComponent) && O.createElement(Ys, { contentComponent: t.contentComponent })
3087
3141
  );
3088
3142
  }
3089
3143
  }
3090
- const Ys = Fn((e, t) => {
3144
+ const Zs = Fn((e, t) => {
3091
3145
  const n = O.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
3092
- return O.createElement(Js, {
3146
+ return O.createElement(Qs, {
3093
3147
  key: n,
3094
3148
  innerRef: t,
3095
3149
  ...e
3096
3150
  });
3097
- }), Ko = O.memo(Ys);
3098
- var $t = { exports: {} }, Ot = {};
3151
+ }), Yo = O.memo(Zs);
3152
+ var to = function e(t, n) {
3153
+ if (t === n) return !0;
3154
+ if (t && n && typeof t == "object" && typeof n == "object") {
3155
+ if (t.constructor !== n.constructor) return !1;
3156
+ var r, s, o;
3157
+ if (Array.isArray(t)) {
3158
+ if (r = t.length, r != n.length) return !1;
3159
+ for (s = r; s-- !== 0; )
3160
+ if (!e(t[s], n[s])) return !1;
3161
+ return !0;
3162
+ }
3163
+ if (t instanceof Map && n instanceof Map) {
3164
+ if (t.size !== n.size) return !1;
3165
+ for (s of t.entries())
3166
+ if (!n.has(s[0])) return !1;
3167
+ for (s of t.entries())
3168
+ if (!e(s[1], n.get(s[0]))) return !1;
3169
+ return !0;
3170
+ }
3171
+ if (t instanceof Set && n instanceof Set) {
3172
+ if (t.size !== n.size) return !1;
3173
+ for (s of t.entries())
3174
+ if (!n.has(s[0])) return !1;
3175
+ return !0;
3176
+ }
3177
+ if (ArrayBuffer.isView(t) && ArrayBuffer.isView(n)) {
3178
+ if (r = t.length, r != n.length) return !1;
3179
+ for (s = r; s-- !== 0; )
3180
+ if (t[s] !== n[s]) return !1;
3181
+ return !0;
3182
+ }
3183
+ if (t.constructor === RegExp) return t.source === n.source && t.flags === n.flags;
3184
+ if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === n.valueOf();
3185
+ if (t.toString !== Object.prototype.toString) return t.toString() === n.toString();
3186
+ if (o = Object.keys(t), r = o.length, r !== Object.keys(n).length) return !1;
3187
+ for (s = r; s-- !== 0; )
3188
+ if (!Object.prototype.hasOwnProperty.call(n, o[s])) return !1;
3189
+ for (s = r; s-- !== 0; ) {
3190
+ var i = o[s];
3191
+ if (!(i === "_owner" && t.$$typeof) && !e(t[i], n[i]))
3192
+ return !1;
3193
+ }
3194
+ return !0;
3195
+ }
3196
+ return t !== t && n !== n;
3197
+ }, eo = /* @__PURE__ */ Us(to), Nt = { exports: {} }, _t = {};
3099
3198
  /**
3100
3199
  * @license React
3101
3200
  * use-sync-external-store-shim/with-selector.production.min.js
@@ -3106,47 +3205,47 @@ var $t = { exports: {} }, Ot = {};
3106
3205
  * LICENSE file in the root directory of this source tree.
3107
3206
  */
3108
3207
  var de;
3109
- function Xs() {
3110
- if (de) return Ot;
3208
+ function no() {
3209
+ if (de) return _t;
3111
3210
  de = 1;
3112
- var e = O, t = St;
3211
+ var e = O, t = wt;
3113
3212
  function n(c, u) {
3114
3213
  return c === u && (c !== 0 || 1 / c === 1 / u) || c !== c && u !== u;
3115
3214
  }
3116
3215
  var r = typeof Object.is == "function" ? Object.is : n, s = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, a = e.useMemo, l = e.useDebugValue;
3117
- return Ot.useSyncExternalStoreWithSelector = function(c, u, d, p, h) {
3216
+ return _t.useSyncExternalStoreWithSelector = function(c, u, d, p, h) {
3118
3217
  var f = o(null);
3119
3218
  if (f.current === null) {
3120
- var y = { hasValue: !1, value: null };
3121
- f.current = y;
3122
- } else y = f.current;
3219
+ var m = { hasValue: !1, value: null };
3220
+ f.current = m;
3221
+ } else m = f.current;
3123
3222
  f = a(function() {
3124
- function m(M) {
3223
+ function g(S) {
3125
3224
  if (!k) {
3126
- if (k = !0, b = M, M = p(M), h !== void 0 && y.hasValue) {
3127
- var C = y.value;
3128
- if (h(C, M)) return S = C;
3225
+ if (k = !0, b = S, S = p(S), h !== void 0 && m.hasValue) {
3226
+ var C = m.value;
3227
+ if (h(C, S)) return M = C;
3129
3228
  }
3130
- return S = M;
3229
+ return M = S;
3131
3230
  }
3132
- if (C = S, r(b, M)) return C;
3133
- var A = p(M);
3134
- return h !== void 0 && h(C, A) ? C : (b = M, S = A);
3231
+ if (C = M, r(b, S)) return C;
3232
+ var x = p(S);
3233
+ return h !== void 0 && h(C, x) ? C : (b = S, M = x);
3135
3234
  }
3136
- var k = !1, b, S, w = d === void 0 ? null : d;
3235
+ var k = !1, b, M, w = d === void 0 ? null : d;
3137
3236
  return [function() {
3138
- return m(u());
3237
+ return g(u());
3139
3238
  }, w === null ? void 0 : function() {
3140
- return m(w());
3239
+ return g(w());
3141
3240
  }];
3142
3241
  }, [u, d, p, h]);
3143
- var g = s(c, f[0], f[1]);
3242
+ var y = s(c, f[0], f[1]);
3144
3243
  return i(function() {
3145
- y.hasValue = !0, y.value = g;
3146
- }, [g]), l(g), g;
3147
- }, Ot;
3244
+ m.hasValue = !0, m.value = y;
3245
+ }, [y]), l(y), y;
3246
+ }, _t;
3148
3247
  }
3149
- var Lt = {};
3248
+ var Ht = {};
3150
3249
  /**
3151
3250
  * @license React
3152
3251
  * use-sync-external-store-shim/with-selector.development.js
@@ -3157,54 +3256,54 @@ var Lt = {};
3157
3256
  * LICENSE file in the root directory of this source tree.
3158
3257
  */
3159
3258
  var ue;
3160
- function Qs() {
3259
+ function ro() {
3161
3260
  return ue || (ue = 1, process.env.NODE_ENV !== "production" && function() {
3162
3261
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
3163
- var e = O, t = St;
3262
+ var e = O, t = wt;
3164
3263
  function n(u, d) {
3165
3264
  return u === d && (u !== 0 || 1 / u === 1 / d) || u !== u && d !== d;
3166
3265
  }
3167
3266
  var r = typeof Object.is == "function" ? Object.is : n, s = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, a = e.useMemo, l = e.useDebugValue;
3168
3267
  function c(u, d, p, h, f) {
3169
- var y = o(null), g;
3170
- y.current === null ? (g = {
3268
+ var m = o(null), y;
3269
+ m.current === null ? (y = {
3171
3270
  hasValue: !1,
3172
3271
  value: null
3173
- }, y.current = g) : g = y.current;
3174
- var m = a(function() {
3175
- var w = !1, M, C, A = function(j) {
3272
+ }, m.current = y) : y = m.current;
3273
+ var g = a(function() {
3274
+ var w = !1, S, C, x = function(j) {
3176
3275
  if (!w) {
3177
- w = !0, M = j;
3276
+ w = !0, S = j;
3178
3277
  var Y = h(j);
3179
- if (f !== void 0 && g.hasValue) {
3180
- var W = g.value;
3278
+ if (f !== void 0 && y.hasValue) {
3279
+ var W = y.value;
3181
3280
  if (f(W, Y))
3182
3281
  return C = W, W;
3183
3282
  }
3184
3283
  return C = Y, Y;
3185
3284
  }
3186
- var K = M, F = C;
3285
+ var K = S, F = C;
3187
3286
  if (r(K, j))
3188
3287
  return F;
3189
3288
  var U = h(j);
3190
- return f !== void 0 && f(F, U) ? F : (M = j, C = U, U);
3191
- }, E = p === void 0 ? null : p, _ = function() {
3192
- return A(d());
3193
- }, D = E === null ? void 0 : function() {
3194
- return A(E());
3289
+ return f !== void 0 && f(F, U) ? F : (S = j, C = U, U);
3290
+ }, T = p === void 0 ? null : p, H = function() {
3291
+ return x(d());
3292
+ }, N = T === null ? void 0 : function() {
3293
+ return x(T());
3195
3294
  };
3196
- return [_, D];
3197
- }, [d, p, h, f]), k = m[0], b = m[1], S = s(u, k, b);
3295
+ return [H, N];
3296
+ }, [d, p, h, f]), k = g[0], b = g[1], M = s(u, k, b);
3198
3297
  return i(function() {
3199
- g.hasValue = !0, g.value = S;
3200
- }, [S]), l(S), S;
3298
+ y.hasValue = !0, y.value = M;
3299
+ }, [M]), l(M), M;
3201
3300
  }
3202
- Lt.useSyncExternalStoreWithSelector = c, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
3203
- }()), Lt;
3301
+ Ht.useSyncExternalStoreWithSelector = c, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
3302
+ }()), Ht;
3204
3303
  }
3205
- process.env.NODE_ENV === "production" ? $t.exports = Xs() : $t.exports = Qs();
3206
- var Zs = $t.exports;
3207
- class to {
3304
+ process.env.NODE_ENV === "production" ? Nt.exports = no() : Nt.exports = ro();
3305
+ var so = Nt.exports;
3306
+ class oo {
3208
3307
  constructor(t) {
3209
3308
  this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = t, this.lastSnapshot = { editor: t, transactionNumber: 0 }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
3210
3309
  }
@@ -3242,12 +3341,13 @@ class to {
3242
3341
  }
3243
3342
  }
3244
3343
  }
3245
- function eo(e) {
3246
- const [t] = Ft(() => new to(e.editor)), n = Zs.useSyncExternalStoreWithSelector(t.subscribe, t.getSnapshot, t.getServerSnapshot, e.selector, e.equalityFn);
3247
- return zt(() => t.watch(e.editor), [e.editor, t]), Te(n), n;
3344
+ function io(e) {
3345
+ var t;
3346
+ const [n] = zt(() => new oo(e.editor)), r = so.useSyncExternalStoreWithSelector(n.subscribe, n.getSnapshot, n.getServerSnapshot, e.selector, (t = e.equalityFn) !== null && t !== void 0 ? t : eo);
3347
+ return Vt(() => n.watch(e.editor), [e.editor, n]), Ee(r), r;
3248
3348
  }
3249
- const pe = process.env.NODE_ENV !== "production", Dt = typeof window > "u", no = Dt || !!(typeof window < "u" && window.next);
3250
- class ro {
3349
+ const pe = process.env.NODE_ENV !== "production", Bt = typeof window > "u", ao = Bt || !!(typeof window < "u" && window.next);
3350
+ class lo {
3251
3351
  constructor(t) {
3252
3352
  this.editor = null, this.subscriptions = /* @__PURE__ */ new Set(), this.isComponentMounted = !1, this.previousDeps = null, this.instanceId = "", this.options = t, this.subscriptions = /* @__PURE__ */ new Set(), this.setEditor(this.getInitialEditor()), this.scheduleDestroy(), this.getEditor = this.getEditor.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.subscribe = this.subscribe.bind(this), this.refreshEditorInstance = this.refreshEditorInstance.bind(this), this.scheduleDestroy = this.scheduleDestroy.bind(this), this.onRender = this.onRender.bind(this), this.createEditor = this.createEditor.bind(this);
3253
3353
  }
@@ -3256,8 +3356,8 @@ class ro {
3256
3356
  }
3257
3357
  getInitialEditor() {
3258
3358
  if (this.options.current.immediatelyRender === void 0)
3259
- return Dt || no ? (pe && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
3260
- if (this.options.current.immediatelyRender && Dt && pe)
3359
+ return Bt || ao ? (pe && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
3360
+ if (this.options.current.immediatelyRender && Bt && pe)
3261
3361
  throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");
3262
3362
  return this.options.current.immediatelyRender ? this.createEditor() : null;
3263
3363
  }
@@ -3303,9 +3403,17 @@ class ro {
3303
3403
  onContentError: (...r) => {
3304
3404
  var s, o;
3305
3405
  return (o = (s = this.options.current).onContentError) === null || o === void 0 ? void 0 : o.call(s, ...r);
3406
+ },
3407
+ onDrop: (...r) => {
3408
+ var s, o;
3409
+ return (o = (s = this.options.current).onDrop) === null || o === void 0 ? void 0 : o.call(s, ...r);
3410
+ },
3411
+ onPaste: (...r) => {
3412
+ var s, o;
3413
+ return (o = (s = this.options.current).onPaste) === null || o === void 0 ? void 0 : o.call(s, ...r);
3306
3414
  }
3307
3415
  };
3308
- return new Ps(t);
3416
+ return new Ds(t);
3309
3417
  }
3310
3418
  /**
3311
3419
  * Get the current editor instance.
@@ -3367,22 +3475,22 @@ class ro {
3367
3475
  }, 1);
3368
3476
  }
3369
3477
  }
3370
- function Uo(e = {}, t = []) {
3478
+ function Xo(e = {}, t = []) {
3371
3479
  const n = zn(e);
3372
3480
  n.current = e;
3373
- const [r] = Ft(() => new ro(n)), s = St.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
3374
- return Te(s), zt(r.onRender(t)), eo({
3481
+ const [r] = zt(() => new lo(n)), s = wt.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
3482
+ return Ee(s), Vt(r.onRender(t)), io({
3375
3483
  editor: s,
3376
3484
  selector: ({ transactionNumber: o }) => e.shouldRerenderOnTransaction === !1 ? null : e.immediatelyRender && o === 0 ? 0 : o + 1
3377
3485
  }), s;
3378
3486
  }
3379
- const Be = Ee({
3487
+ const Be = Te({
3380
3488
  editor: null
3381
3489
  });
3382
3490
  Be.Consumer;
3383
- const so = () => Ce(Be), qo = (e) => {
3384
- const [t, n] = Ft(null), { editor: r } = so();
3385
- return zt(() => {
3491
+ const co = () => Ce(Be), Qo = (e) => {
3492
+ const [t, n] = zt(null), { editor: r } = co();
3493
+ return Vt(() => {
3386
3494
  var s;
3387
3495
  if (!t || !((s = e.editor) === null || s === void 0) && s.isDestroyed || r != null && r.isDestroyed)
3388
3496
  return;
@@ -3391,7 +3499,7 @@ const so = () => Ce(Be), qo = (e) => {
3391
3499
  console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
3392
3500
  return;
3393
3501
  }
3394
- const d = De({
3502
+ const d = Ne({
3395
3503
  updateDelay: l,
3396
3504
  editor: u,
3397
3505
  element: t,
@@ -3399,11 +3507,13 @@ const so = () => Ce(Be), qo = (e) => {
3399
3507
  shouldShow: c,
3400
3508
  tippyOptions: a
3401
3509
  });
3402
- return u.registerPlugin(d), () => u.unregisterPlugin(o);
3510
+ return u.registerPlugin(d), () => {
3511
+ u.unregisterPlugin(o);
3512
+ };
3403
3513
  }, [e.editor, r, t]), O.createElement("div", { ref: n, className: e.className, style: { visibility: "hidden" } }, e.children);
3404
- }, je = Ee({
3514
+ }, je = Te({
3405
3515
  onDragStart: void 0
3406
- }), Fe = () => Ce(je), Go = (e) => {
3516
+ }), Fe = () => Ce(je), Zo = (e) => {
3407
3517
  const t = e.as || "div", { nodeViewContentRef: n } = Fe();
3408
3518
  return (
3409
3519
  // @ts-ignore
@@ -3412,7 +3522,7 @@ const so = () => Ce(Be), qo = (e) => {
3412
3522
  ...e.style
3413
3523
  } })
3414
3524
  );
3415
- }, Jo = O.forwardRef((e, t) => {
3525
+ }, ti = O.forwardRef((e, t) => {
3416
3526
  const { onDragStart: n } = Fe(), r = e.as || "div";
3417
3527
  return (
3418
3528
  // @ts-ignore
@@ -3422,48 +3532,73 @@ const so = () => Ce(Be), qo = (e) => {
3422
3532
  } })
3423
3533
  );
3424
3534
  });
3425
- function oo(e) {
3535
+ function uo(e) {
3426
3536
  return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
3427
3537
  }
3428
- function io(e) {
3538
+ function po(e) {
3429
3539
  var t;
3430
3540
  return typeof e == "object" && ((t = e.$$typeof) === null || t === void 0 ? void 0 : t.toString()) === "Symbol(react.forward_ref)";
3431
3541
  }
3432
- class ao {
3433
- constructor(t, { editor: n, props: r = {}, as: s = "div", className: o = "", attrs: i }) {
3434
- this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = t, this.editor = n, this.props = r, this.element = document.createElement(s), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), i && Object.keys(i).forEach((a) => {
3435
- this.element.setAttribute(a, i[a]);
3436
- }), this.editor.isInitialized ? Wn(() => {
3542
+ class ho {
3543
+ /**
3544
+ * Immediately creates element and renders the provided React component.
3545
+ */
3546
+ constructor(t, { editor: n, props: r = {}, as: s = "div", className: o = "" }) {
3547
+ this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = t, this.editor = n, this.props = r, this.element = document.createElement(s), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ? Wn(() => {
3437
3548
  this.render();
3438
3549
  }) : this.render();
3439
3550
  }
3551
+ /**
3552
+ * Render the React component.
3553
+ */
3440
3554
  render() {
3441
3555
  var t;
3442
3556
  const n = this.component, r = this.props, s = this.editor;
3443
- (oo(n) || io(n)) && (r.ref = (o) => {
3557
+ (uo(n) || po(n)) && (r.ref = (o) => {
3444
3558
  this.ref = o;
3445
3559
  }), this.reactElement = O.createElement(n, r), (t = s == null ? void 0 : s.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
3446
3560
  }
3561
+ /**
3562
+ * Re-renders the React component with new props.
3563
+ */
3447
3564
  updateProps(t = {}) {
3448
3565
  this.props = {
3449
3566
  ...this.props,
3450
3567
  ...t
3451
3568
  }, this.render();
3452
3569
  }
3570
+ /**
3571
+ * Destroy the React component.
3572
+ */
3453
3573
  destroy() {
3454
3574
  var t;
3455
3575
  const n = this.editor;
3456
3576
  (t = n == null ? void 0 : n.contentComponent) === null || t === void 0 || t.removeRenderer(this.id);
3457
3577
  }
3578
+ /**
3579
+ * Update the attributes of the element that holds the React component.
3580
+ */
3581
+ updateAttributes(t) {
3582
+ Object.keys(t).forEach((n) => {
3583
+ this.element.setAttribute(n, t[n]);
3584
+ });
3585
+ }
3458
3586
  }
3459
- class lo extends $s {
3587
+ class fo extends Bs {
3588
+ /**
3589
+ * Setup the React component.
3590
+ * Called on initialization.
3591
+ */
3460
3592
  mount() {
3461
3593
  const t = {
3462
3594
  editor: this.editor,
3463
3595
  node: this.node,
3464
3596
  decorations: this.decorations,
3597
+ innerDecorations: this.innerDecorations,
3598
+ view: this.view,
3465
3599
  selected: !1,
3466
3600
  extension: this.extension,
3601
+ HTMLAttributes: this.HTMLAttributes,
3467
3602
  getPos: () => this.getPos(),
3468
3603
  updateAttributes: (c = {}) => this.updateAttributes(c),
3469
3604
  deleteNode: () => this.deleteNode()
@@ -3475,75 +3610,119 @@ class lo extends $s {
3475
3610
  const s = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (c) => {
3476
3611
  c && this.contentDOMElement && c.firstChild !== this.contentDOMElement && c.appendChild(this.contentDOMElement);
3477
3612
  } }, o = this.component, i = O.memo((c) => O.createElement(je.Provider, { value: s }, O.createElement(o, c)));
3478
- i.displayName = "ReactNodeView", this.node.isLeaf ? this.contentDOMElement = null : this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement && (this.contentDOMElement.style.whiteSpace = "inherit");
3613
+ i.displayName = "ReactNodeView", this.node.isLeaf ? this.contentDOMElement = null : this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement && (this.contentDOMElement.dataset.nodeViewContentReact = "", this.contentDOMElement.style.whiteSpace = "inherit");
3479
3614
  let a = this.node.isInline ? "span" : "div";
3480
3615
  this.options.as && (a = this.options.as);
3481
3616
  const { className: l = "" } = this.options;
3482
- this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.renderer = new ao(i, {
3617
+ this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.renderer = new ho(i, {
3483
3618
  editor: this.editor,
3484
3619
  props: t,
3485
3620
  as: a,
3486
- className: `node-${this.node.type.name} ${l}`.trim(),
3487
- attrs: this.options.attrs
3488
- });
3621
+ className: `node-${this.node.type.name} ${l}`.trim()
3622
+ }), this.updateElementAttributes();
3489
3623
  }
3624
+ /**
3625
+ * Return the DOM element.
3626
+ * This is the element that will be used to display the node view.
3627
+ */
3490
3628
  get dom() {
3491
3629
  var t;
3492
3630
  if (this.renderer.element.firstElementChild && !(!((t = this.renderer.element.firstElementChild) === null || t === void 0) && t.hasAttribute("data-node-view-wrapper")))
3493
3631
  throw Error("Please use the NodeViewWrapper component for your node view.");
3494
3632
  return this.renderer.element;
3495
3633
  }
3634
+ /**
3635
+ * Return the content DOM element.
3636
+ * This is the element that will be used to display the rich-text content of the node.
3637
+ */
3496
3638
  get contentDOM() {
3497
3639
  return this.node.isLeaf ? null : this.contentDOMElement;
3498
3640
  }
3641
+ /**
3642
+ * On editor selection update, check if the node is selected.
3643
+ * If it is, call `selectNode`, otherwise call `deselectNode`.
3644
+ */
3499
3645
  handleSelectionUpdate() {
3500
- const { from: t, to: n } = this.editor.state.selection;
3501
- if (t <= this.getPos() && n >= this.getPos() + this.node.nodeSize) {
3502
- if (this.renderer.props.selected)
3503
- return;
3504
- this.selectNode();
3505
- } else {
3506
- if (!this.renderer.props.selected)
3507
- return;
3508
- this.deselectNode();
3509
- }
3646
+ const { from: t, to: n } = this.editor.state.selection, r = this.getPos();
3647
+ if (typeof r == "number")
3648
+ if (t <= r && n >= r + this.node.nodeSize) {
3649
+ if (this.renderer.props.selected)
3650
+ return;
3651
+ this.selectNode();
3652
+ } else {
3653
+ if (!this.renderer.props.selected)
3654
+ return;
3655
+ this.deselectNode();
3656
+ }
3510
3657
  }
3511
- update(t, n) {
3512
- const r = (s) => {
3513
- this.renderer.updateProps(s);
3658
+ /**
3659
+ * On update, update the React component.
3660
+ * To prevent unnecessary updates, the `update` option can be used.
3661
+ */
3662
+ update(t, n, r) {
3663
+ const s = (o) => {
3664
+ this.renderer.updateProps(o), typeof this.options.attrs == "function" && this.updateElementAttributes();
3514
3665
  };
3515
3666
  if (t.type !== this.node.type)
3516
3667
  return !1;
3517
3668
  if (typeof this.options.update == "function") {
3518
- const s = this.node, o = this.decorations;
3519
- return this.node = t, this.decorations = n, this.options.update({
3520
- oldNode: s,
3521
- oldDecorations: o,
3669
+ const o = this.node, i = this.decorations, a = this.innerDecorations;
3670
+ return this.node = t, this.decorations = n, this.innerDecorations = r, this.options.update({
3671
+ oldNode: o,
3672
+ oldDecorations: i,
3522
3673
  newNode: t,
3523
3674
  newDecorations: n,
3524
- updateProps: () => r({ node: t, decorations: n })
3675
+ oldInnerDecorations: a,
3676
+ innerDecorations: r,
3677
+ updateProps: () => s({ node: t, decorations: n, innerDecorations: r })
3525
3678
  });
3526
3679
  }
3527
- return t === this.node && this.decorations === n || (this.node = t, this.decorations = n, r({ node: t, decorations: n })), !0;
3680
+ return t === this.node && this.decorations === n && this.innerDecorations === r || (this.node = t, this.decorations = n, this.innerDecorations = r, s({ node: t, decorations: n, innerDecorations: r })), !0;
3528
3681
  }
3682
+ /**
3683
+ * Select the node.
3684
+ * Add the `selected` prop and the `ProseMirror-selectednode` class.
3685
+ */
3529
3686
  selectNode() {
3530
3687
  this.renderer.updateProps({
3531
3688
  selected: !0
3532
3689
  }), this.renderer.element.classList.add("ProseMirror-selectednode");
3533
3690
  }
3691
+ /**
3692
+ * Deselect the node.
3693
+ * Remove the `selected` prop and the `ProseMirror-selectednode` class.
3694
+ */
3534
3695
  deselectNode() {
3535
3696
  this.renderer.updateProps({
3536
3697
  selected: !1
3537
3698
  }), this.renderer.element.classList.remove("ProseMirror-selectednode");
3538
3699
  }
3700
+ /**
3701
+ * Destroy the React component instance.
3702
+ */
3539
3703
  destroy() {
3540
3704
  this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.contentDOMElement = null;
3541
3705
  }
3706
+ /**
3707
+ * Update the attributes of the top-level element that holds the React component.
3708
+ * Applying the attributes defined in the `attrs` option.
3709
+ */
3710
+ updateElementAttributes() {
3711
+ if (this.options.attrs) {
3712
+ let t = {};
3713
+ if (typeof this.options.attrs == "function") {
3714
+ const n = this.editor.extensionManager.attributes, r = pt(this.node, n);
3715
+ t = this.options.attrs({ node: this.node, HTMLAttributes: r });
3716
+ } else
3717
+ t = this.options.attrs;
3718
+ this.renderer.updateAttributes(t);
3719
+ }
3720
+ }
3542
3721
  }
3543
- function Yo(e, t) {
3544
- return (n) => n.editor.contentComponent ? new lo(e, n, t) : {};
3722
+ function ei(e, t) {
3723
+ return (n) => n.editor.contentComponent ? new fo(e, n, t) : {};
3545
3724
  }
3546
- const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, po = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, ho = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Xo = I.create({
3725
+ const mo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, go = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, yo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, bo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, ni = I.create({
3547
3726
  name: "italic",
3548
3727
  addOptions() {
3549
3728
  return {
@@ -3565,7 +3744,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3565
3744
  ];
3566
3745
  },
3567
3746
  renderHTML({ HTMLAttributes: e }) {
3568
- return ["em", x(this.options.HTMLAttributes, e), 0];
3747
+ return ["em", A(this.options.HTMLAttributes, e), 0];
3569
3748
  },
3570
3749
  addCommands() {
3571
3750
  return {
@@ -3583,11 +3762,11 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3583
3762
  addInputRules() {
3584
3763
  return [
3585
3764
  J({
3586
- find: co,
3765
+ find: mo,
3587
3766
  type: this.type
3588
3767
  }),
3589
3768
  J({
3590
- find: po,
3769
+ find: yo,
3591
3770
  type: this.type
3592
3771
  })
3593
3772
  ];
@@ -3595,16 +3774,16 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3595
3774
  addPasteRules() {
3596
3775
  return [
3597
3776
  z({
3598
- find: uo,
3777
+ find: go,
3599
3778
  type: this.type
3600
3779
  }),
3601
3780
  z({
3602
- find: ho,
3781
+ find: bo,
3603
3782
  type: this.type
3604
3783
  })
3605
3784
  ];
3606
3785
  }
3607
- }), Qo = I.create({
3786
+ }), ri = I.create({
3608
3787
  name: "underline",
3609
3788
  addOptions() {
3610
3789
  return {
@@ -3624,7 +3803,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3624
3803
  ];
3625
3804
  },
3626
3805
  renderHTML({ HTMLAttributes: e }) {
3627
- return ["u", x(this.options.HTMLAttributes, e), 0];
3806
+ return ["u", A(this.options.HTMLAttributes, e), 0];
3628
3807
  },
3629
3808
  addCommands() {
3630
3809
  return {
@@ -3639,7 +3818,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3639
3818
  "Mod-U": () => this.editor.commands.toggleUnderline()
3640
3819
  };
3641
3820
  }
3642
- }), fo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, mo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, Zo = I.create({
3821
+ }), vo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Mo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, si = I.create({
3643
3822
  name: "strike",
3644
3823
  addOptions() {
3645
3824
  return {
@@ -3665,7 +3844,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3665
3844
  ];
3666
3845
  },
3667
3846
  renderHTML({ HTMLAttributes: e }) {
3668
- return ["s", x(this.options.HTMLAttributes, e), 0];
3847
+ return ["s", A(this.options.HTMLAttributes, e), 0];
3669
3848
  },
3670
3849
  addCommands() {
3671
3850
  return {
@@ -3682,7 +3861,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3682
3861
  addInputRules() {
3683
3862
  return [
3684
3863
  J({
3685
- find: fo,
3864
+ find: vo,
3686
3865
  type: this.type
3687
3866
  })
3688
3867
  ];
@@ -3690,12 +3869,12 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3690
3869
  addPasteRules() {
3691
3870
  return [
3692
3871
  z({
3693
- find: mo,
3872
+ find: Mo,
3694
3873
  type: this.type
3695
3874
  })
3696
3875
  ];
3697
3876
  }
3698
- }), go = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/, yo = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g, ti = I.create({
3877
+ }), So = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/, ko = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g, oi = I.create({
3699
3878
  name: "code",
3700
3879
  addOptions() {
3701
3880
  return {
@@ -3711,7 +3890,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3711
3890
  ];
3712
3891
  },
3713
3892
  renderHTML({ HTMLAttributes: e }) {
3714
- return ["code", x(this.options.HTMLAttributes, e), 0];
3893
+ return ["code", A(this.options.HTMLAttributes, e), 0];
3715
3894
  },
3716
3895
  addCommands() {
3717
3896
  return {
@@ -3728,7 +3907,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3728
3907
  addInputRules() {
3729
3908
  return [
3730
3909
  J({
3731
- find: go,
3910
+ find: So,
3732
3911
  type: this.type
3733
3912
  })
3734
3913
  ];
@@ -3736,12 +3915,12 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3736
3915
  addPasteRules() {
3737
3916
  return [
3738
3917
  z({
3739
- find: yo,
3918
+ find: ko,
3740
3919
  type: this.type
3741
3920
  })
3742
3921
  ];
3743
3922
  }
3744
- }), bo = /^```([a-z]+)?[\s\n]$/, vo = /^~~~([a-z]+)?[\s\n]$/, ei = L.create({
3923
+ }), wo = /^```([a-z]+)?[\s\n]$/, Eo = /^~~~([a-z]+)?[\s\n]$/, ii = L.create({
3745
3924
  name: "codeBlock",
3746
3925
  addOptions() {
3747
3926
  return {
@@ -3781,7 +3960,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3781
3960
  renderHTML({ node: e, HTMLAttributes: t }) {
3782
3961
  return [
3783
3962
  "pre",
3784
- x(this.options.HTMLAttributes, t),
3963
+ A(this.options.HTMLAttributes, t),
3785
3964
  [
3786
3965
  "code",
3787
3966
  {
@@ -3831,15 +4010,15 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3831
4010
  },
3832
4011
  addInputRules() {
3833
4012
  return [
3834
- Pt({
3835
- find: bo,
4013
+ $t({
4014
+ find: wo,
3836
4015
  type: this.type,
3837
4016
  getAttributes: (e) => ({
3838
4017
  language: e[1]
3839
4018
  })
3840
4019
  }),
3841
- Pt({
3842
- find: vo,
4020
+ $t({
4021
+ find: Eo,
3843
4022
  type: this.type,
3844
4023
  getAttributes: (e) => ({
3845
4024
  language: e[1]
@@ -3862,13 +4041,13 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3862
4041
  return !1;
3863
4042
  const { tr: i, schema: a } = e.state, l = a.text(n.replace(/\r\n?/g, `
3864
4043
  `));
3865
- return i.replaceSelectionWith(this.type.create({ language: o }, l)), i.selection.$from.parent.type !== this.type && i.setSelection(N.near(i.doc.resolve(Math.max(0, i.selection.from - 2)))), i.setMeta("paste", !0), e.dispatch(i), !0;
4044
+ return i.replaceSelectionWith(this.type.create({ language: o }, l)), i.selection.$from.parent.type !== this.type && i.setSelection(D.near(i.doc.resolve(Math.max(0, i.selection.from - 2)))), i.setMeta("paste", !0), e.dispatch(i), !0;
3866
4045
  }
3867
4046
  }
3868
4047
  })
3869
4048
  ];
3870
4049
  }
3871
- }), ni = I.create({
4050
+ }), ai = I.create({
3872
4051
  name: "textStyle",
3873
4052
  priority: 101,
3874
4053
  addOptions() {
@@ -3885,7 +4064,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3885
4064
  ];
3886
4065
  },
3887
4066
  renderHTML({ HTMLAttributes: e }) {
3888
- return ["span", x(this.options.HTMLAttributes, e), 0];
4067
+ return ["span", A(this.options.HTMLAttributes, e), 0];
3889
4068
  },
3890
4069
  addCommands() {
3891
4070
  return {
@@ -3895,7 +4074,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3895
4074
  }
3896
4075
  };
3897
4076
  }
3898
- }), ri = R.create({
4077
+ }), li = _.create({
3899
4078
  name: "fontFamily",
3900
4079
  addOptions() {
3901
4080
  return {
@@ -3927,7 +4106,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3927
4106
  unsetFontFamily: () => ({ chain: e }) => e().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
3928
4107
  };
3929
4108
  }
3930
- }), si = L.create({
4109
+ }), ci = L.create({
3931
4110
  name: "heading",
3932
4111
  addOptions() {
3933
4112
  return {
@@ -3953,7 +4132,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3953
4132
  }));
3954
4133
  },
3955
4134
  renderHTML({ node: e, HTMLAttributes: t }) {
3956
- return [`h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`, x(this.options.HTMLAttributes, t), 0];
4135
+ return [`h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`, A(this.options.HTMLAttributes, t), 0];
3957
4136
  },
3958
4137
  addCommands() {
3959
4138
  return {
@@ -3968,7 +4147,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3968
4147
  }), {});
3969
4148
  },
3970
4149
  addInputRules() {
3971
- return this.options.levels.map((e) => Pt({
4150
+ return this.options.levels.map((e) => $t({
3972
4151
  find: new RegExp(`^(#{1,${e}})\\s$`),
3973
4152
  type: this.type,
3974
4153
  getAttributes: {
@@ -3976,7 +4155,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
3976
4155
  }
3977
4156
  }));
3978
4157
  }
3979
- }), oi = R.create({
4158
+ }), di = _.create({
3980
4159
  name: "textAlign",
3981
4160
  addOptions() {
3982
4161
  return {
@@ -4016,7 +4195,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4016
4195
  "Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
4017
4196
  };
4018
4197
  }
4019
- }), ii = R.create({
4198
+ }), ui = _.create({
4020
4199
  name: "color",
4021
4200
  addOptions() {
4022
4201
  return {
@@ -4048,7 +4227,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4048
4227
  unsetColor: () => ({ chain: e }) => e().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
4049
4228
  };
4050
4229
  }
4051
- }), Mo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, So = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, ai = I.create({
4230
+ }), To = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, Co = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, pi = I.create({
4052
4231
  name: "highlight",
4053
4232
  addOptions() {
4054
4233
  return {
@@ -4076,7 +4255,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4076
4255
  ];
4077
4256
  },
4078
4257
  renderHTML({ HTMLAttributes: e }) {
4079
- return ["mark", x(this.options.HTMLAttributes, e), 0];
4258
+ return ["mark", A(this.options.HTMLAttributes, e), 0];
4080
4259
  },
4081
4260
  addCommands() {
4082
4261
  return {
@@ -4093,7 +4272,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4093
4272
  addInputRules() {
4094
4273
  return [
4095
4274
  J({
4096
- find: Mo,
4275
+ find: To,
4097
4276
  type: this.type
4098
4277
  })
4099
4278
  ];
@@ -4101,12 +4280,12 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4101
4280
  addPasteRules() {
4102
4281
  return [
4103
4282
  z({
4104
- find: So,
4283
+ find: Co,
4105
4284
  type: this.type
4106
4285
  })
4107
4286
  ];
4108
4287
  }
4109
- }), ko = L.create({
4288
+ }), Ao = L.create({
4110
4289
  name: "listItem",
4111
4290
  addOptions() {
4112
4291
  return {
@@ -4125,7 +4304,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4125
4304
  ];
4126
4305
  },
4127
4306
  renderHTML({ HTMLAttributes: e }) {
4128
- return ["li", x(this.options.HTMLAttributes, e), 0];
4307
+ return ["li", A(this.options.HTMLAttributes, e), 0];
4129
4308
  },
4130
4309
  addKeyboardShortcuts() {
4131
4310
  return {
@@ -4151,7 +4330,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4151
4330
  ];
4152
4331
  },
4153
4332
  renderHTML({ HTMLAttributes: e }) {
4154
- return ["span", x(this.options.HTMLAttributes, e), 0];
4333
+ return ["span", A(this.options.HTMLAttributes, e), 0];
4155
4334
  },
4156
4335
  addCommands() {
4157
4336
  return {
@@ -4161,7 +4340,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4161
4340
  }
4162
4341
  };
4163
4342
  }
4164
- }), fe = /^\s*([-+*])\s$/, li = L.create({
4343
+ }), fe = /^\s*([-+*])\s$/, hi = L.create({
4165
4344
  name: "bulletList",
4166
4345
  addOptions() {
4167
4346
  return {
@@ -4181,11 +4360,11 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4181
4360
  ];
4182
4361
  },
4183
4362
  renderHTML({ HTMLAttributes: e }) {
4184
- return ["ul", x(this.options.HTMLAttributes, e), 0];
4363
+ return ["ul", A(this.options.HTMLAttributes, e), 0];
4185
4364
  },
4186
4365
  addCommands() {
4187
4366
  return {
4188
- toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ko.name, this.editor.getAttributes(he.name)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
4367
+ toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ao.name, this.editor.getAttributes(he.name)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
4189
4368
  };
4190
4369
  },
4191
4370
  addKeyboardShortcuts() {
@@ -4209,7 +4388,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4209
4388
  e
4210
4389
  ];
4211
4390
  }
4212
- }), wo = L.create({
4391
+ }), xo = L.create({
4213
4392
  name: "listItem",
4214
4393
  addOptions() {
4215
4394
  return {
@@ -4228,7 +4407,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4228
4407
  ];
4229
4408
  },
4230
4409
  renderHTML({ HTMLAttributes: e }) {
4231
- return ["li", x(this.options.HTMLAttributes, e), 0];
4410
+ return ["li", A(this.options.HTMLAttributes, e), 0];
4232
4411
  },
4233
4412
  addKeyboardShortcuts() {
4234
4413
  return {
@@ -4254,7 +4433,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4254
4433
  ];
4255
4434
  },
4256
4435
  renderHTML({ HTMLAttributes: e }) {
4257
- return ["span", x(this.options.HTMLAttributes, e), 0];
4436
+ return ["span", A(this.options.HTMLAttributes, e), 0];
4258
4437
  },
4259
4438
  addCommands() {
4260
4439
  return {
@@ -4264,7 +4443,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4264
4443
  }
4265
4444
  };
4266
4445
  }
4267
- }), ge = /^(\d+)\.\s$/, ci = L.create({
4446
+ }), ge = /^(\d+)\.\s$/, fi = L.create({
4268
4447
  name: "orderedList",
4269
4448
  addOptions() {
4270
4449
  return {
@@ -4299,11 +4478,11 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4299
4478
  },
4300
4479
  renderHTML({ HTMLAttributes: e }) {
4301
4480
  const { start: t, ...n } = e;
4302
- return t === 1 ? ["ol", x(this.options.HTMLAttributes, n), 0] : ["ol", x(this.options.HTMLAttributes, e), 0];
4481
+ return t === 1 ? ["ol", A(this.options.HTMLAttributes, n), 0] : ["ol", A(this.options.HTMLAttributes, e), 0];
4303
4482
  },
4304
4483
  addCommands() {
4305
4484
  return {
4306
- toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(wo.name, this.editor.getAttributes(me.name)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
4485
+ toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(xo.name, this.editor.getAttributes(me.name)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
4307
4486
  };
4308
4487
  },
4309
4488
  addKeyboardShortcuts() {
@@ -4330,7 +4509,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4330
4509
  e
4331
4510
  ];
4332
4511
  }
4333
- }), To = /^\s*(\[([( |x])?\])\s$/, di = L.create({
4512
+ }), Oo = /^\s*(\[([( |x])?\])\s$/, mi = L.create({
4334
4513
  name: "taskItem",
4335
4514
  addOptions() {
4336
4515
  return {
@@ -4369,7 +4548,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4369
4548
  renderHTML({ node: e, HTMLAttributes: t }) {
4370
4549
  return [
4371
4550
  "li",
4372
- x(this.options.HTMLAttributes, t, {
4551
+ A(this.options.HTMLAttributes, t, {
4373
4552
  "data-type": this.name
4374
4553
  }),
4375
4554
  [
@@ -4399,14 +4578,17 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4399
4578
  addNodeView() {
4400
4579
  return ({ node: e, HTMLAttributes: t, getPos: n, editor: r }) => {
4401
4580
  const s = document.createElement("li"), o = document.createElement("label"), i = document.createElement("span"), a = document.createElement("input"), l = document.createElement("div");
4402
- return o.contentEditable = "false", a.type = "checkbox", a.addEventListener("change", (c) => {
4581
+ return o.contentEditable = "false", a.type = "checkbox", a.addEventListener("mousedown", (c) => c.preventDefault()), a.addEventListener("change", (c) => {
4403
4582
  if (!r.isEditable && !this.options.onReadOnlyChecked) {
4404
4583
  a.checked = !a.checked;
4405
4584
  return;
4406
4585
  }
4407
4586
  const { checked: u } = c.target;
4408
4587
  r.isEditable && typeof n == "function" && r.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: d }) => {
4409
- const p = n(), h = d.doc.nodeAt(p);
4588
+ const p = n();
4589
+ if (typeof p != "number")
4590
+ return !1;
4591
+ const h = d.doc.nodeAt(p);
4410
4592
  return d.setNodeMarkup(p, void 0, {
4411
4593
  ...h == null ? void 0 : h.attrs,
4412
4594
  checked: u
@@ -4426,7 +4608,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4426
4608
  addInputRules() {
4427
4609
  return [
4428
4610
  tt({
4429
- find: To,
4611
+ find: Oo,
4430
4612
  type: this.type,
4431
4613
  getAttributes: (e) => ({
4432
4614
  checked: e[e.length - 1] === "x"
@@ -4434,7 +4616,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4434
4616
  })
4435
4617
  ];
4436
4618
  }
4437
- }), ui = L.create({
4619
+ }), gi = L.create({
4438
4620
  name: "taskList",
4439
4621
  addOptions() {
4440
4622
  return {
@@ -4455,7 +4637,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4455
4637
  ];
4456
4638
  },
4457
4639
  renderHTML({ HTMLAttributes: e }) {
4458
- return ["ul", x(this.options.HTMLAttributes, e, { "data-type": this.name }), 0];
4640
+ return ["ul", A(this.options.HTMLAttributes, e, { "data-type": this.name }), 0];
4459
4641
  },
4460
4642
  addCommands() {
4461
4643
  return {
@@ -4467,7 +4649,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4467
4649
  "Mod-Shift-9": () => this.editor.commands.toggleTaskList()
4468
4650
  };
4469
4651
  }
4470
- }), Eo = /^\s*>\s$/, pi = L.create({
4652
+ }), Lo = /^\s*>\s$/, yi = L.create({
4471
4653
  name: "blockquote",
4472
4654
  addOptions() {
4473
4655
  return {
@@ -4483,7 +4665,7 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4483
4665
  ];
4484
4666
  },
4485
4667
  renderHTML({ HTMLAttributes: e }) {
4486
- return ["blockquote", x(this.options.HTMLAttributes, e), 0];
4668
+ return ["blockquote", A(this.options.HTMLAttributes, e), 0];
4487
4669
  },
4488
4670
  addCommands() {
4489
4671
  return {
@@ -4500,16 +4682,16 @@ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\
4500
4682
  addInputRules() {
4501
4683
  return [
4502
4684
  tt({
4503
- find: Eo,
4685
+ find: Lo,
4504
4686
  type: this.type
4505
4687
  })
4506
4688
  ];
4507
4689
  }
4508
4690
  });
4509
- function Co(e) {
4691
+ function _o(e) {
4510
4692
  return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
4511
4693
  }
4512
- function xo(e) {
4694
+ function Ho(e) {
4513
4695
  return new P({
4514
4696
  key: new $("autolink"),
4515
4697
  appendTransaction: (t, n, r) => {
@@ -4521,22 +4703,22 @@ function xo(e) {
4521
4703
  const u = Zr(r.doc, c, (h) => h.isTextblock);
4522
4704
  let d, p;
4523
4705
  if (u.length > 1 ? (d = u[0], p = r.doc.textBetween(d.pos, d.pos + d.node.nodeSize, void 0, " ")) : u.length && r.doc.textBetween(c.from, c.to, " ", " ").endsWith(" ") && (d = u[0], p = r.doc.textBetween(d.pos, c.to, void 0, " ")), d && p) {
4524
- const h = p.split(" ").filter((m) => m !== "");
4706
+ const h = p.split(" ").filter((g) => g !== "");
4525
4707
  if (h.length <= 0)
4526
4708
  return !1;
4527
- const f = h[h.length - 1], y = d.pos + p.lastIndexOf(f);
4709
+ const f = h[h.length - 1], m = d.pos + p.lastIndexOf(f);
4528
4710
  if (!f)
4529
4711
  return !1;
4530
- const g = kn(f).map((m) => m.toObject(e.defaultProtocol));
4531
- if (!Co(g))
4712
+ const y = kn(f).map((g) => g.toObject(e.defaultProtocol));
4713
+ if (!_o(y))
4532
4714
  return !1;
4533
- g.filter((m) => m.isLink).map((m) => ({
4534
- ...m,
4535
- from: y + m.start + 1,
4536
- to: y + m.end + 1
4537
- })).filter((m) => r.schema.marks.code ? !r.doc.rangeHasMark(m.from, m.to, r.schema.marks.code) : !0).filter((m) => e.validate(m.value)).forEach((m) => {
4538
- qt(m.from, m.to, r.doc).some((k) => k.mark.type === e.type) || i.addMark(m.from, m.to, e.type.create({
4539
- href: m.href
4715
+ y.filter((g) => g.isLink).map((g) => ({
4716
+ ...g,
4717
+ from: m + g.start + 1,
4718
+ to: m + g.end + 1
4719
+ })).filter((g) => r.schema.marks.code ? !r.doc.rangeHasMark(g.from, g.to, r.schema.marks.code) : !0).filter((g) => e.validate(g.value)).forEach((g) => {
4720
+ Gt(g.from, g.to, r.doc).some((k) => k.mark.type === e.type) || i.addMark(g.from, g.to, e.type.create({
4721
+ href: g.href
4540
4722
  }));
4541
4723
  });
4542
4724
  }
@@ -4545,7 +4727,7 @@ function xo(e) {
4545
4727
  }
4546
4728
  });
4547
4729
  }
4548
- function Ao(e) {
4730
+ function Ro(e) {
4549
4731
  return new P({
4550
4732
  key: new $("handleClickLink"),
4551
4733
  props: {
@@ -4559,13 +4741,13 @@ function Ao(e) {
4559
4741
  a.push(i), i = i.parentNode;
4560
4742
  if (!a.find((p) => p.nodeName === "A"))
4561
4743
  return !1;
4562
- const l = Pe(t.state, e.type.name), c = r.target, u = (s = c == null ? void 0 : c.href) !== null && s !== void 0 ? s : l.href, d = (o = c == null ? void 0 : c.target) !== null && o !== void 0 ? o : l.target;
4744
+ const l = Ie(t.state, e.type.name), c = r.target, u = (s = c == null ? void 0 : c.href) !== null && s !== void 0 ? s : l.href, d = (o = c == null ? void 0 : c.target) !== null && o !== void 0 ? o : l.target;
4563
4745
  return c && u ? (window.open(u, d), !0) : !1;
4564
4746
  }
4565
4747
  }
4566
4748
  });
4567
4749
  }
4568
- function Oo(e) {
4750
+ function Po(e) {
4569
4751
  return new P({
4570
4752
  key: new $("handlePasteLink"),
4571
4753
  props: {
@@ -4585,15 +4767,15 @@ function Oo(e) {
4585
4767
  }
4586
4768
  });
4587
4769
  }
4588
- const Lo = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
4770
+ const Io = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
4589
4771
  function ye(e, t) {
4590
4772
  const n = ["http", "https", "ftp", "ftps", "mailto", "tel", "callto", "sms", "cid", "xmpp"];
4591
4773
  return t && t.forEach((r) => {
4592
4774
  const s = typeof r == "string" ? r : r.scheme;
4593
4775
  s && n.push(s);
4594
- }), !e || e.replace(Lo, "").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`, "i"));
4776
+ }), !e || e.replace(Io, "").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`, "i"));
4595
4777
  }
4596
- const hi = I.create({
4778
+ const bi = I.create({
4597
4779
  name: "link",
4598
4780
  priority: 1e3,
4599
4781
  keepOnSplit: !1,
@@ -4657,7 +4839,7 @@ const hi = I.create({
4657
4839
  }];
4658
4840
  },
4659
4841
  renderHTML({ HTMLAttributes: e }) {
4660
- return ye(e.href, this.options.protocols) ? ["a", x(this.options.HTMLAttributes, e), 0] : ["a", x(this.options.HTMLAttributes, { ...e, href: "" }), 0];
4842
+ return ye(e.href, this.options.protocols) ? ["a", A(this.options.HTMLAttributes, e), 0] : ["a", A(this.options.HTMLAttributes, { ...e, href: "" }), 0];
4661
4843
  },
4662
4844
  addCommands() {
4663
4845
  return {
@@ -4695,19 +4877,19 @@ const hi = I.create({
4695
4877
  },
4696
4878
  addProseMirrorPlugins() {
4697
4879
  const e = [];
4698
- return this.options.autolink && e.push(xo({
4880
+ return this.options.autolink && e.push(Ho({
4699
4881
  type: this.type,
4700
4882
  defaultProtocol: this.options.defaultProtocol,
4701
4883
  validate: this.options.validate
4702
- })), this.options.openOnClick === !0 && e.push(Ao({
4884
+ })), this.options.openOnClick === !0 && e.push(Ro({
4703
4885
  type: this.type
4704
- })), this.options.linkOnPaste && e.push(Oo({
4886
+ })), this.options.linkOnPaste && e.push(Po({
4705
4887
  editor: this.editor,
4706
4888
  defaultProtocol: this.options.defaultProtocol,
4707
4889
  type: this.type
4708
4890
  })), e;
4709
4891
  }
4710
- }), fi = L.create({
4892
+ }), vi = L.create({
4711
4893
  name: "horizontalRule",
4712
4894
  addOptions() {
4713
4895
  return {
@@ -4719,7 +4901,7 @@ const hi = I.create({
4719
4901
  return [{ tag: "hr" }];
4720
4902
  },
4721
4903
  renderHTML({ HTMLAttributes: e }) {
4722
- return ["hr", x(this.options.HTMLAttributes, e)];
4904
+ return ["hr", A(this.options.HTMLAttributes, e)];
4723
4905
  },
4724
4906
  addCommands() {
4725
4907
  return {
@@ -4730,17 +4912,17 @@ const hi = I.create({
4730
4912
  to: s.pos
4731
4913
  }, {
4732
4914
  type: this.name
4733
- }) : Ne(n) ? o.insertContentAt(s.pos, {
4915
+ }) : $e(n) ? o.insertContentAt(s.pos, {
4734
4916
  type: this.name
4735
4917
  }) : o.insertContent({ type: this.name }), o.command(({ tr: i, dispatch: a }) => {
4736
4918
  var l;
4737
4919
  if (a) {
4738
4920
  const { $to: c } = i.selection, u = c.end();
4739
4921
  if (c.nodeAfter)
4740
- c.nodeAfter.isTextblock ? i.setSelection(N.create(i.doc, c.pos + 1)) : c.nodeAfter.isBlock ? i.setSelection(Z.create(i.doc, c.pos)) : i.setSelection(N.create(i.doc, c.pos));
4922
+ c.nodeAfter.isTextblock ? i.setSelection(D.create(i.doc, c.pos + 1)) : c.nodeAfter.isBlock ? i.setSelection(Z.create(i.doc, c.pos)) : i.setSelection(D.create(i.doc, c.pos));
4741
4923
  else {
4742
4924
  const d = (l = c.parent.type.contentMatch.defaultType) === null || l === void 0 ? void 0 : l.create();
4743
- d && (i.insert(u, d), i.setSelection(N.create(i.doc, u + 1)));
4925
+ d && (i.insert(u, d), i.setSelection(D.create(i.doc, u + 1)));
4744
4926
  }
4745
4927
  i.scrollIntoView();
4746
4928
  }
@@ -4751,13 +4933,13 @@ const hi = I.create({
4751
4933
  },
4752
4934
  addInputRules() {
4753
4935
  return [
4754
- $e({
4936
+ De({
4755
4937
  find: /^(?:---|—-|___\s|\*\*\*\s)$/,
4756
4938
  type: this.type
4757
4939
  })
4758
4940
  ];
4759
4941
  }
4760
- }), mi = R.create({
4942
+ }), Mi = _.create({
4761
4943
  name: "history",
4762
4944
  addOptions() {
4763
4945
  return {
@@ -4767,8 +4949,8 @@ const hi = I.create({
4767
4949
  },
4768
4950
  addCommands() {
4769
4951
  return {
4770
- undo: () => ({ state: e, dispatch: t }) => Tn(e, t),
4771
- redo: () => ({ state: e, dispatch: t }) => En(e, t)
4952
+ undo: () => ({ state: e, dispatch: t }) => En(e, t),
4953
+ redo: () => ({ state: e, dispatch: t }) => Tn(e, t)
4772
4954
  };
4773
4955
  },
4774
4956
  addProseMirrorPlugins() {
@@ -4786,7 +4968,7 @@ const hi = I.create({
4786
4968
  "Shift-Mod-я": () => this.editor.commands.redo()
4787
4969
  };
4788
4970
  }
4789
- }), gi = R.create({
4971
+ }), Si = _.create({
4790
4972
  name: "characterCount",
4791
4973
  addOptions() {
4792
4974
  return {
@@ -4828,7 +5010,7 @@ const hi = I.create({
4828
5010
  })
4829
5011
  ];
4830
5012
  }
4831
- }), yi = R.create({
5013
+ }), ki = _.create({
4832
5014
  name: "dropCursor",
4833
5015
  addOptions() {
4834
5016
  return {
@@ -4839,10 +5021,10 @@ const hi = I.create({
4839
5021
  },
4840
5022
  addProseMirrorPlugins() {
4841
5023
  return [
4842
- xn(this.options)
5024
+ An(this.options)
4843
5025
  ];
4844
5026
  }
4845
- }), bi = R.create({
5027
+ }), wi = _.create({
4846
5028
  name: "focus",
4847
5029
  addOptions() {
4848
5030
  return {
@@ -4873,7 +5055,7 @@ const hi = I.create({
4873
5055
  return !1;
4874
5056
  if (a += 1, this.options.mode === "deepest" && i - a > 0 || this.options.mode === "shallowest" && a > 1)
4875
5057
  return this.options.mode === "deepest";
4876
- o.push(jt.node(c, c + l.nodeSize, {
5058
+ o.push(Ft.node(c, c + l.nodeSize, {
4877
5059
  class: this.options.className
4878
5060
  }));
4879
5061
  }), ut.create(e, o);
@@ -4882,11 +5064,11 @@ const hi = I.create({
4882
5064
  })
4883
5065
  ];
4884
5066
  }
4885
- }), vi = R.create({
5067
+ }), Ei = _.create({
4886
5068
  name: "gapCursor",
4887
5069
  addProseMirrorPlugins() {
4888
5070
  return [
4889
- An()
5071
+ xn()
4890
5072
  ];
4891
5073
  },
4892
5074
  extendNodeSchema(e) {
@@ -4897,10 +5079,10 @@ const hi = I.create({
4897
5079
  storage: e.storage
4898
5080
  };
4899
5081
  return {
4900
- allowGapCursor: (t = T(v(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null
5082
+ allowGapCursor: (t = E(v(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null
4901
5083
  };
4902
5084
  }
4903
- }), Mi = L.create({
5085
+ }), Ti = L.create({
4904
5086
  name: "hardBreak",
4905
5087
  addOptions() {
4906
5088
  return {
@@ -4917,7 +5099,7 @@ const hi = I.create({
4917
5099
  ];
4918
5100
  },
4919
5101
  renderHTML({ HTMLAttributes: e }) {
4920
- return ["br", x(this.options.HTMLAttributes, e)];
5102
+ return ["br", A(this.options.HTMLAttributes, e)];
4921
5103
  },
4922
5104
  renderText() {
4923
5105
  return `
@@ -4949,7 +5131,7 @@ const hi = I.create({
4949
5131
  "Shift-Enter": () => this.editor.commands.setHardBreak()
4950
5132
  };
4951
5133
  }
4952
- }), Si = L.create({
5134
+ }), Ci = L.create({
4953
5135
  name: "listItem",
4954
5136
  addOptions() {
4955
5137
  return {
@@ -4968,7 +5150,7 @@ const hi = I.create({
4968
5150
  ];
4969
5151
  },
4970
5152
  renderHTML({ HTMLAttributes: e }) {
4971
- return ["li", x(this.options.HTMLAttributes, e), 0];
5153
+ return ["li", A(this.options.HTMLAttributes, e), 0];
4972
5154
  },
4973
5155
  addKeyboardShortcuts() {
4974
5156
  return {
@@ -4977,7 +5159,7 @@ const hi = I.create({
4977
5159
  "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
4978
5160
  };
4979
5161
  }
4980
- }), ki = L.create({
5162
+ }), Ai = L.create({
4981
5163
  name: "paragraph",
4982
5164
  priority: 1e3,
4983
5165
  addOptions() {
@@ -4993,7 +5175,7 @@ const hi = I.create({
4993
5175
  ];
4994
5176
  },
4995
5177
  renderHTML({ HTMLAttributes: e }) {
4996
- return ["p", x(this.options.HTMLAttributes, e), 0];
5178
+ return ["p", A(this.options.HTMLAttributes, e), 0];
4997
5179
  },
4998
5180
  addCommands() {
4999
5181
  return {
@@ -5005,7 +5187,7 @@ const hi = I.create({
5005
5187
  "Mod-Alt-0": () => this.editor.commands.setParagraph()
5006
5188
  };
5007
5189
  }
5008
- }), wi = R.create({
5190
+ }), xi = _.create({
5009
5191
  name: "placeholder",
5010
5192
  addOptions() {
5011
5193
  return {
@@ -5028,11 +5210,11 @@ const hi = I.create({
5028
5210
  return null;
5029
5211
  const o = this.editor.isEmpty;
5030
5212
  return e.descendants((i, a) => {
5031
- const l = r >= a && r <= a + i.nodeSize, c = !i.isLeaf && Gt(i);
5213
+ const l = r >= a && r <= a + i.nodeSize, c = !i.isLeaf && kt(i);
5032
5214
  if ((l || !this.options.showOnlyCurrent) && c) {
5033
5215
  const u = [this.options.emptyNodeClass];
5034
5216
  o && u.push(this.options.emptyEditorClass);
5035
- const d = jt.node(a, a + i.nodeSize, {
5217
+ const d = Ft.node(a, a + i.nodeSize, {
5036
5218
  class: u.join(" "),
5037
5219
  "data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
5038
5220
  editor: this.editor,
@@ -5050,14 +5232,14 @@ const hi = I.create({
5050
5232
  })
5051
5233
  ];
5052
5234
  }
5053
- }), Ti = L.create({
5235
+ }), Oi = L.create({
5054
5236
  name: "text",
5055
5237
  group: "inline"
5056
- }), Ei = L.create({
5238
+ }), Li = L.create({
5057
5239
  name: "doc",
5058
5240
  topNode: !0,
5059
5241
  content: "block+"
5060
- }), Ci = I.create({
5242
+ }), _i = I.create({
5061
5243
  name: "subscript",
5062
5244
  addOptions() {
5063
5245
  return {
@@ -5078,7 +5260,7 @@ const hi = I.create({
5078
5260
  ];
5079
5261
  },
5080
5262
  renderHTML({ HTMLAttributes: e }) {
5081
- return ["sub", x(this.options.HTMLAttributes, e), 0];
5263
+ return ["sub", A(this.options.HTMLAttributes, e), 0];
5082
5264
  },
5083
5265
  addCommands() {
5084
5266
  return {
@@ -5092,7 +5274,7 @@ const hi = I.create({
5092
5274
  "Mod-,": () => this.editor.commands.toggleSubscript()
5093
5275
  };
5094
5276
  }
5095
- }), xi = I.create({
5277
+ }), Hi = I.create({
5096
5278
  name: "superscript",
5097
5279
  addOptions() {
5098
5280
  return {
@@ -5113,7 +5295,7 @@ const hi = I.create({
5113
5295
  ];
5114
5296
  },
5115
5297
  renderHTML({ HTMLAttributes: e }) {
5116
- return ["sup", x(this.options.HTMLAttributes, e), 0];
5298
+ return ["sup", A(this.options.HTMLAttributes, e), 0];
5117
5299
  },
5118
5300
  addCommands() {
5119
5301
  return {
@@ -5128,41 +5310,41 @@ const hi = I.create({
5128
5310
  };
5129
5311
  }
5130
5312
  });
5131
- function Ro(e) {
5313
+ function $o(e) {
5132
5314
  var t;
5133
- const { char: n, allowSpaces: r, allowedPrefixes: s, startOfLine: o, $position: i } = e, a = Ds(n), l = new RegExp(`\\s${a}$`), c = o ? "^" : "", u = r ? new RegExp(`${c}${a}.*?(?=\\s${a}|$)`, "gm") : new RegExp(`${c}(?:^)?${a}[^\\s${a}]*`, "gm"), d = ((t = i.nodeBefore) === null || t === void 0 ? void 0 : t.isText) && i.nodeBefore.text;
5315
+ const { char: n, allowSpaces: r, allowedPrefixes: s, startOfLine: o, $position: i } = e, a = js(n), l = new RegExp(`\\s${a}$`), c = o ? "^" : "", u = r ? new RegExp(`${c}${a}.*?(?=\\s${a}|$)`, "gm") : new RegExp(`${c}(?:^)?${a}[^\\s${a}]*`, "gm"), d = ((t = i.nodeBefore) === null || t === void 0 ? void 0 : t.isText) && i.nodeBefore.text;
5134
5316
  if (!d)
5135
5317
  return null;
5136
5318
  const p = i.pos - d.length, h = Array.from(d.matchAll(u)).pop();
5137
5319
  if (!h || h.input === void 0 || h.index === void 0)
5138
5320
  return null;
5139
- const f = h.input.slice(Math.max(0, h.index - 1), h.index), y = new RegExp(`^[${s == null ? void 0 : s.join("")}\0]?$`).test(f);
5140
- if (s !== null && !y)
5321
+ const f = h.input.slice(Math.max(0, h.index - 1), h.index), m = new RegExp(`^[${s == null ? void 0 : s.join("")}\0]?$`).test(f);
5322
+ if (s !== null && !m)
5141
5323
  return null;
5142
- const g = p + h.index;
5143
- let m = g + h[0].length;
5144
- return r && l.test(d.slice(m - 1, m + 1)) && (h[0] += " ", m += 1), g < i.pos && m >= i.pos ? {
5324
+ const y = p + h.index;
5325
+ let g = y + h[0].length;
5326
+ return r && l.test(d.slice(g - 1, g + 1)) && (h[0] += " ", g += 1), y < i.pos && g >= i.pos ? {
5145
5327
  range: {
5146
- from: g,
5147
- to: m
5328
+ from: y,
5329
+ to: g
5148
5330
  },
5149
5331
  query: h[0].slice(n.length),
5150
5332
  text: h[0]
5151
5333
  } : null;
5152
5334
  }
5153
- const _o = new $("suggestion");
5154
- function Ai({ pluginKey: e = _o, editor: t, char: n = "@", allowSpaces: r = !1, allowedPrefixes: s = [" "], startOfLine: o = !1, decorationTag: i = "span", decorationClass: a = "suggestion", command: l = () => null, items: c = () => [], render: u = () => ({}), allow: d = () => !0, findSuggestionMatch: p = Ro }) {
5335
+ const Do = new $("suggestion");
5336
+ function Ri({ pluginKey: e = Do, editor: t, char: n = "@", allowSpaces: r = !1, allowedPrefixes: s = [" "], startOfLine: o = !1, decorationTag: i = "span", decorationClass: a = "suggestion", command: l = () => null, items: c = () => [], render: u = () => ({}), allow: d = () => !0, findSuggestionMatch: p = $o }) {
5155
5337
  let h;
5156
- const f = u == null ? void 0 : u(), y = new P({
5338
+ const f = u == null ? void 0 : u(), m = new P({
5157
5339
  key: e,
5158
5340
  view() {
5159
5341
  return {
5160
- update: async (g, m) => {
5161
- var k, b, S, w, M, C, A;
5162
- const E = (k = this.key) === null || k === void 0 ? void 0 : k.getState(m), _ = (b = this.key) === null || b === void 0 ? void 0 : b.getState(g.state), D = E.active && _.active && E.range.from !== _.range.from, j = !E.active && _.active, Y = E.active && !_.active, W = !j && !Y && E.query !== _.query, K = j || D && W, F = W || D, U = Y || D && W;
5342
+ update: async (y, g) => {
5343
+ var k, b, M, w, S, C, x;
5344
+ const T = (k = this.key) === null || k === void 0 ? void 0 : k.getState(g), H = (b = this.key) === null || b === void 0 ? void 0 : b.getState(y.state), N = T.active && H.active && T.range.from !== H.range.from, j = !T.active && H.active, Y = T.active && !H.active, W = !j && !Y && T.query !== H.query, K = j || N && W, F = W || N, U = Y || N && W;
5163
5345
  if (!K && !F && !U)
5164
5346
  return;
5165
- const X = U && !K ? E : _, Jt = g.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`);
5347
+ const X = U && !K ? T : H, Jt = y.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`);
5166
5348
  h = {
5167
5349
  editor: t,
5168
5350
  range: X.range,
@@ -5179,17 +5361,17 @@ function Ai({ pluginKey: e = _o, editor: t, char: n = "@", allowSpaces: r = !1,
5179
5361
  // this can be used for building popups without a DOM node
5180
5362
  clientRect: Jt ? () => {
5181
5363
  var et;
5182
- const { decorationId: ze } = (et = this.key) === null || et === void 0 ? void 0 : et.getState(t.state), kt = g.dom.querySelector(`[data-decoration-id="${ze}"]`);
5183
- return (kt == null ? void 0 : kt.getBoundingClientRect()) || null;
5364
+ const { decorationId: ze } = (et = this.key) === null || et === void 0 ? void 0 : et.getState(t.state), Et = y.dom.querySelector(`[data-decoration-id="${ze}"]`);
5365
+ return (Et == null ? void 0 : Et.getBoundingClientRect()) || null;
5184
5366
  } : null
5185
- }, K && ((S = f == null ? void 0 : f.onBeforeStart) === null || S === void 0 || S.call(f, h)), F && ((w = f == null ? void 0 : f.onBeforeUpdate) === null || w === void 0 || w.call(f, h)), (F || K) && (h.items = await c({
5367
+ }, K && ((M = f == null ? void 0 : f.onBeforeStart) === null || M === void 0 || M.call(f, h)), F && ((w = f == null ? void 0 : f.onBeforeUpdate) === null || w === void 0 || w.call(f, h)), (F || K) && (h.items = await c({
5186
5368
  editor: t,
5187
5369
  query: X.query
5188
- })), U && ((M = f == null ? void 0 : f.onExit) === null || M === void 0 || M.call(f, h)), F && ((C = f == null ? void 0 : f.onUpdate) === null || C === void 0 || C.call(f, h)), K && ((A = f == null ? void 0 : f.onStart) === null || A === void 0 || A.call(f, h));
5370
+ })), U && ((S = f == null ? void 0 : f.onExit) === null || S === void 0 || S.call(f, h)), F && ((C = f == null ? void 0 : f.onUpdate) === null || C === void 0 || C.call(f, h)), K && ((x = f == null ? void 0 : f.onStart) === null || x === void 0 || x.call(f, h));
5189
5371
  },
5190
5372
  destroy: () => {
5191
- var g;
5192
- h && ((g = f == null ? void 0 : f.onExit) === null || g === void 0 || g.call(f, h));
5373
+ var y;
5374
+ h && ((y = f == null ? void 0 : f.onExit) === null || y === void 0 || y.call(f, h));
5193
5375
  }
5194
5376
  };
5195
5377
  },
@@ -5208,40 +5390,40 @@ function Ai({ pluginKey: e = _o, editor: t, char: n = "@", allowSpaces: r = !1,
5208
5390
  };
5209
5391
  },
5210
5392
  // Apply changes to the plugin state from a view transaction.
5211
- apply(g, m, k, b) {
5212
- const { isEditable: S } = t, { composing: w } = t.view, { selection: M } = g, { empty: C, from: A } = M, E = { ...m };
5213
- if (E.composing = w, S && (C || t.view.composing)) {
5214
- (A < m.range.from || A > m.range.to) && !w && !m.composing && (E.active = !1);
5215
- const _ = p({
5393
+ apply(y, g, k, b) {
5394
+ const { isEditable: M } = t, { composing: w } = t.view, { selection: S } = y, { empty: C, from: x } = S, T = { ...g };
5395
+ if (T.composing = w, M && (C || t.view.composing)) {
5396
+ (x < g.range.from || x > g.range.to) && !w && !g.composing && (T.active = !1);
5397
+ const H = p({
5216
5398
  char: n,
5217
5399
  allowSpaces: r,
5218
5400
  allowedPrefixes: s,
5219
5401
  startOfLine: o,
5220
- $position: M.$from
5221
- }), D = `id_${Math.floor(Math.random() * 4294967295)}`;
5222
- _ && d({
5402
+ $position: S.$from
5403
+ }), N = `id_${Math.floor(Math.random() * 4294967295)}`;
5404
+ H && d({
5223
5405
  editor: t,
5224
5406
  state: b,
5225
- range: _.range,
5226
- isActive: m.active
5227
- }) ? (E.active = !0, E.decorationId = m.decorationId ? m.decorationId : D, E.range = _.range, E.query = _.query, E.text = _.text) : E.active = !1;
5407
+ range: H.range,
5408
+ isActive: g.active
5409
+ }) ? (T.active = !0, T.decorationId = g.decorationId ? g.decorationId : N, T.range = H.range, T.query = H.query, T.text = H.text) : T.active = !1;
5228
5410
  } else
5229
- E.active = !1;
5230
- return E.active || (E.decorationId = null, E.range = { from: 0, to: 0 }, E.query = null, E.text = null), E;
5411
+ T.active = !1;
5412
+ return T.active || (T.decorationId = null, T.range = { from: 0, to: 0 }, T.query = null, T.text = null), T;
5231
5413
  }
5232
5414
  },
5233
5415
  props: {
5234
5416
  // Call the keydown hook if suggestion is active.
5235
- handleKeyDown(g, m) {
5417
+ handleKeyDown(y, g) {
5236
5418
  var k;
5237
- const { active: b, range: S } = y.getState(g.state);
5238
- return b && ((k = f == null ? void 0 : f.onKeyDown) === null || k === void 0 ? void 0 : k.call(f, { view: g, event: m, range: S })) || !1;
5419
+ const { active: b, range: M } = m.getState(y.state);
5420
+ return b && ((k = f == null ? void 0 : f.onKeyDown) === null || k === void 0 ? void 0 : k.call(f, { view: y, event: g, range: M })) || !1;
5239
5421
  },
5240
5422
  // Setup decorator on the currently active suggestion.
5241
- decorations(g) {
5242
- const { active: m, range: k, decorationId: b } = y.getState(g);
5243
- return m ? ut.create(g.doc, [
5244
- jt.inline(k.from, k.to, {
5423
+ decorations(y) {
5424
+ const { active: g, range: k, decorationId: b } = m.getState(y);
5425
+ return g ? ut.create(y.doc, [
5426
+ Ft.inline(k.from, k.to, {
5245
5427
  nodeName: i,
5246
5428
  class: a,
5247
5429
  "data-decoration-id": b
@@ -5250,9 +5432,9 @@ function Ai({ pluginKey: e = _o, editor: t, char: n = "@", allowSpaces: r = !1,
5250
5432
  }
5251
5433
  }
5252
5434
  });
5253
- return y;
5435
+ return m;
5254
5436
  }
5255
- const Ho = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Oi = L.create({
5437
+ const No = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Pi = L.create({
5256
5438
  name: "image",
5257
5439
  addOptions() {
5258
5440
  return {
@@ -5289,7 +5471,7 @@ const Ho = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Oi = L.cr
5289
5471
  ];
5290
5472
  },
5291
5473
  renderHTML({ HTMLAttributes: e }) {
5292
- return ["img", x(this.options.HTMLAttributes, e)];
5474
+ return ["img", A(this.options.HTMLAttributes, e)];
5293
5475
  },
5294
5476
  addCommands() {
5295
5477
  return {
@@ -5301,8 +5483,8 @@ const Ho = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Oi = L.cr
5301
5483
  },
5302
5484
  addInputRules() {
5303
5485
  return [
5304
- $e({
5305
- find: Ho,
5486
+ De({
5487
+ find: No,
5306
5488
  type: this.type,
5307
5489
  getAttributes: (e) => {
5308
5490
  const [, , t, n, r] = e;
@@ -5311,7 +5493,7 @@ const Ho = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Oi = L.cr
5311
5493
  })
5312
5494
  ];
5313
5495
  }
5314
- }), Li = L.create({
5496
+ }), Ii = L.create({
5315
5497
  name: "tableRow",
5316
5498
  addOptions() {
5317
5499
  return {
@@ -5326,7 +5508,7 @@ const Ho = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Oi = L.cr
5326
5508
  ];
5327
5509
  },
5328
5510
  renderHTML({ HTMLAttributes: e }) {
5329
- return ["tr", x(this.options.HTMLAttributes, e), 0];
5511
+ return ["tr", A(this.options.HTMLAttributes, e), 0];
5330
5512
  }
5331
5513
  });
5332
5514
  function be(e, t, n, r, s, o) {
@@ -5335,8 +5517,8 @@ function be(e, t, n, r, s, o) {
5335
5517
  for (let u = 0, d = 0; u < c.childCount; u += 1) {
5336
5518
  const { colspan: p, colwidth: h } = c.child(u).attrs;
5337
5519
  for (let f = 0; f < p; f += 1, d += 1) {
5338
- const y = s === d ? o : h && h[f], g = y ? `${y}px` : "";
5339
- i += y || r, y || (a = !1), l ? (l.style.width !== g && (l.style.width = g), l = l.nextSibling) : t.appendChild(document.createElement("col")).style.width = g;
5520
+ const m = s === d ? o : h && h[f], y = m ? `${m}px` : "";
5521
+ i += m || r, m || (a = !1), l ? (l.style.width !== y && (l.style.width = y), l = l.nextSibling) : t.appendChild(document.createElement("col")).style.width = y;
5340
5522
  }
5341
5523
  }
5342
5524
  for (; l; ) {
@@ -5345,7 +5527,7 @@ function be(e, t, n, r, s, o) {
5345
5527
  }
5346
5528
  a ? (n.style.width = `${i}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${i}px`);
5347
5529
  }
5348
- class Io {
5530
+ class Bo {
5349
5531
  constructor(t, n) {
5350
5532
  this.node = t, this.cellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), be(t, this.colgroup, this.table, n), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
5351
5533
  }
@@ -5356,16 +5538,16 @@ class Io {
5356
5538
  return t.type === "attributes" && (t.target === this.table || this.colgroup.contains(t.target));
5357
5539
  }
5358
5540
  }
5359
- function Po(e, t, n, r) {
5541
+ function jo(e, t, n, r) {
5360
5542
  let s = 0, o = !0;
5361
5543
  const i = [], a = e.firstChild;
5362
5544
  if (!a)
5363
5545
  return {};
5364
5546
  for (let d = 0, p = 0; d < a.childCount; d += 1) {
5365
5547
  const { colspan: h, colwidth: f } = a.child(d).attrs;
5366
- for (let y = 0; y < h; y += 1, p += 1) {
5367
- const g = n === p ? r : f && f[y], m = g ? `${g}px` : "";
5368
- s += g || t, g || (o = !1), i.push(["col", m ? { style: `width: ${m}` } : {}]);
5548
+ for (let m = 0; m < h; m += 1, p += 1) {
5549
+ const y = n === p ? r : f && f[m], g = y ? `${y}px` : "";
5550
+ s += y || t, y || (o = !1), i.push(["col", g ? { style: `width: ${g}` } : {}]);
5369
5551
  }
5370
5552
  }
5371
5553
  const l = o ? `${s}px` : "", c = o ? "" : `${s}px`;
@@ -5374,7 +5556,7 @@ function Po(e, t, n, r) {
5374
5556
  function ve(e, t) {
5375
5557
  return e.createAndFill();
5376
5558
  }
5377
- function No(e) {
5559
+ function Fo(e) {
5378
5560
  if (e.cached.tableNodeTypes)
5379
5561
  return e.cached.tableNodeTypes;
5380
5562
  const t = {};
@@ -5383,8 +5565,8 @@ function No(e) {
5383
5565
  r.spec.tableRole && (t[r.spec.tableRole] = r);
5384
5566
  }), e.cached.tableNodeTypes = t, t;
5385
5567
  }
5386
- function $o(e, t, n, r, s) {
5387
- const o = No(e), i = [], a = [];
5568
+ function zo(e, t, n, r, s) {
5569
+ const o = Fo(e), i = [], a = [];
5388
5570
  for (let c = 0; c < n; c += 1) {
5389
5571
  const u = ve(o.cell);
5390
5572
  if (u && a.push(u), r) {
@@ -5397,21 +5579,21 @@ function $o(e, t, n, r, s) {
5397
5579
  l.push(o.row.createChecked(null, r && c === 0 ? i : a));
5398
5580
  return o.table.createChecked(null, l);
5399
5581
  }
5400
- function Do(e) {
5582
+ function Vo(e) {
5401
5583
  return e instanceof we;
5402
5584
  }
5403
5585
  const at = ({ editor: e }) => {
5404
5586
  const { selection: t } = e.state;
5405
- if (!Do(t))
5587
+ if (!Vo(t))
5406
5588
  return !1;
5407
5589
  let n = 0;
5408
- const r = Ie(t.ranges[0].$from, (o) => o.type.name === "table");
5590
+ const r = Pe(t.ranges[0].$from, (o) => o.type.name === "table");
5409
5591
  return r == null || r.node.descendants((o) => {
5410
5592
  if (o.type.name === "table")
5411
5593
  return !1;
5412
5594
  ["tableCell", "tableHeader"].includes(o.type.name) && (n += 1);
5413
5595
  }), n === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
5414
- }, Ri = L.create({
5596
+ }, $i = L.create({
5415
5597
  name: "table",
5416
5598
  // @ts-ignore
5417
5599
  addOptions() {
@@ -5421,7 +5603,7 @@ const at = ({ editor: e }) => {
5421
5603
  handleWidth: 5,
5422
5604
  cellMinWidth: 25,
5423
5605
  // TODO: fix
5424
- View: Io,
5606
+ View: Bo,
5425
5607
  lastColumnResizable: !0,
5426
5608
  allowTableNodeSelection: !1
5427
5609
  };
@@ -5434,10 +5616,10 @@ const at = ({ editor: e }) => {
5434
5616
  return [{ tag: "table" }];
5435
5617
  },
5436
5618
  renderHTML({ node: e, HTMLAttributes: t }) {
5437
- const { colgroup: n, tableWidth: r, tableMinWidth: s } = Po(e, this.options.cellMinWidth);
5619
+ const { colgroup: n, tableWidth: r, tableMinWidth: s } = jo(e, this.options.cellMinWidth);
5438
5620
  return [
5439
5621
  "table",
5440
- x(this.options.HTMLAttributes, t, {
5622
+ A(this.options.HTMLAttributes, t, {
5441
5623
  style: r ? `width: ${r}` : `min-width: ${s}`
5442
5624
  }),
5443
5625
  n,
@@ -5447,30 +5629,30 @@ const at = ({ editor: e }) => {
5447
5629
  addCommands() {
5448
5630
  return {
5449
5631
  insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: r, dispatch: s, editor: o }) => {
5450
- const i = $o(o.schema, e, t, n);
5632
+ const i = zo(o.schema, e, t, n);
5451
5633
  if (s) {
5452
5634
  const a = r.selection.from + 1;
5453
- r.replaceSelectionWith(i).scrollIntoView().setSelection(N.near(r.doc.resolve(a)));
5635
+ r.replaceSelectionWith(i).scrollIntoView().setSelection(D.near(r.doc.resolve(a)));
5454
5636
  }
5455
5637
  return !0;
5456
5638
  },
5457
5639
  addColumnBefore: () => ({ state: e, dispatch: t }) => On(e, t),
5458
5640
  addColumnAfter: () => ({ state: e, dispatch: t }) => Ln(e, t),
5459
- deleteColumn: () => ({ state: e, dispatch: t }) => Rn(e, t),
5460
- addRowBefore: () => ({ state: e, dispatch: t }) => _n(e, t),
5461
- addRowAfter: () => ({ state: e, dispatch: t }) => Hn(e, t),
5462
- deleteRow: () => ({ state: e, dispatch: t }) => In(e, t),
5463
- deleteTable: () => ({ state: e, dispatch: t }) => Pn(e, t),
5641
+ deleteColumn: () => ({ state: e, dispatch: t }) => _n(e, t),
5642
+ addRowBefore: () => ({ state: e, dispatch: t }) => Hn(e, t),
5643
+ addRowAfter: () => ({ state: e, dispatch: t }) => Rn(e, t),
5644
+ deleteRow: () => ({ state: e, dispatch: t }) => Pn(e, t),
5645
+ deleteTable: () => ({ state: e, dispatch: t }) => In(e, t),
5464
5646
  mergeCells: () => ({ state: e, dispatch: t }) => Qt(e, t),
5465
5647
  splitCell: () => ({ state: e, dispatch: t }) => Zt(e, t),
5466
5648
  toggleHeaderColumn: () => ({ state: e, dispatch: t }) => te("column")(e, t),
5467
5649
  toggleHeaderRow: () => ({ state: e, dispatch: t }) => te("row")(e, t),
5468
- toggleHeaderCell: () => ({ state: e, dispatch: t }) => Nn(e, t),
5650
+ toggleHeaderCell: () => ({ state: e, dispatch: t }) => $n(e, t),
5469
5651
  mergeOrSplit: () => ({ state: e, dispatch: t }) => Qt(e, t) ? !0 : Zt(e, t),
5470
- setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => $n(e, t)(n, r),
5652
+ setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => Dn(e, t)(n, r),
5471
5653
  goToNextCell: () => ({ state: e, dispatch: t }) => ee(1)(e, t),
5472
5654
  goToPreviousCell: () => ({ state: e, dispatch: t }) => ee(-1)(e, t),
5473
- fixTables: () => ({ state: e, dispatch: t }) => (t && Dn(e), !0),
5655
+ fixTables: () => ({ state: e, dispatch: t }) => (t && Nn(e), !0),
5474
5656
  setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
5475
5657
  if (n) {
5476
5658
  const r = we.create(t.doc, e.anchorCell, e.headCell);
@@ -5512,10 +5694,10 @@ const at = ({ editor: e }) => {
5512
5694
  storage: e.storage
5513
5695
  };
5514
5696
  return {
5515
- tableRole: T(v(e, "tableRole", t))
5697
+ tableRole: E(v(e, "tableRole", t))
5516
5698
  };
5517
5699
  }
5518
- }), _i = L.create({
5700
+ }), Di = L.create({
5519
5701
  name: "tableCell",
5520
5702
  addOptions() {
5521
5703
  return {
@@ -5548,9 +5730,9 @@ const at = ({ editor: e }) => {
5548
5730
  ];
5549
5731
  },
5550
5732
  renderHTML({ HTMLAttributes: e }) {
5551
- return ["td", x(this.options.HTMLAttributes, e), 0];
5733
+ return ["td", A(this.options.HTMLAttributes, e), 0];
5552
5734
  }
5553
- }), Hi = L.create({
5735
+ }), Ni = L.create({
5554
5736
  name: "tableHeader",
5555
5737
  addOptions() {
5556
5738
  return {
@@ -5583,62 +5765,62 @@ const at = ({ editor: e }) => {
5583
5765
  ];
5584
5766
  },
5585
5767
  renderHTML({ HTMLAttributes: e }) {
5586
- return ["th", x(this.options.HTMLAttributes, e), 0];
5768
+ return ["th", A(this.options.HTMLAttributes, e), 0];
5587
5769
  }
5588
5770
  });
5589
5771
  export {
5590
- _i as $,
5591
- Mi as A,
5592
- qo as B,
5593
- ti as C,
5594
- Ei as D,
5595
- Ko as E,
5596
- ri as F,
5597
- vi as G,
5598
- si as H,
5599
- Xo as I,
5600
- Si as J,
5601
- ni as K,
5602
- hi as L,
5603
- Ci as M,
5604
- Jo as N,
5605
- ci as O,
5606
- wi as P,
5607
- xi as Q,
5608
- Yo as R,
5609
- Zo as S,
5610
- oi as T,
5611
- Qo as U,
5612
- Ai as V,
5613
- ao as W,
5614
- Oi as X,
5615
- Ri as Y,
5616
- Li as Z,
5617
- Hi as _,
5772
+ Di as $,
5773
+ Ti as A,
5774
+ Qo as B,
5775
+ oi as C,
5776
+ Li as D,
5777
+ Yo as E,
5778
+ li as F,
5779
+ Ei as G,
5780
+ ci as H,
5781
+ ni as I,
5782
+ Ci as J,
5783
+ ai as K,
5784
+ bi as L,
5785
+ _i as M,
5786
+ ti as N,
5787
+ fi as O,
5788
+ xi as P,
5789
+ Hi as Q,
5790
+ ei as R,
5791
+ si as S,
5792
+ di as T,
5793
+ ri as U,
5794
+ Ri as V,
5795
+ ho as W,
5796
+ Pi as X,
5797
+ $i as Y,
5798
+ Ii as Z,
5799
+ Ni as _,
5618
5800
  L as a,
5619
5801
  is as b,
5620
- Wo as c,
5621
- Go as d,
5622
- ei as e,
5623
- Vo as f,
5624
- R as g,
5625
- ii as h,
5802
+ Jo as c,
5803
+ Zo as d,
5804
+ ii as e,
5805
+ Go as f,
5806
+ _ as g,
5807
+ ui as h,
5626
5808
  ie as i,
5627
- ai as j,
5628
- li as k,
5629
- ui as l,
5630
- x as m,
5631
- $e as n,
5632
- di as o,
5633
- pi as p,
5634
- Wt as q,
5635
- fi as r,
5636
- mi as s,
5637
- Ut as t,
5638
- Uo as u,
5639
- bi as v,
5640
- Ti as w,
5641
- yi as x,
5642
- gi as y,
5643
- ki as z
5809
+ pi as j,
5810
+ hi as k,
5811
+ gi as l,
5812
+ A as m,
5813
+ De as n,
5814
+ mi as o,
5815
+ yi as p,
5816
+ Kt as q,
5817
+ vi as r,
5818
+ Mi as s,
5819
+ qt as t,
5820
+ Xo as u,
5821
+ wi as v,
5822
+ Oi as w,
5823
+ ki as x,
5824
+ Si as y,
5825
+ Ai as z
5644
5826
  };