reactjs-tiptap-editor 1.0.26 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/lib/{ActionMenuButton-B4KDkZ0z.js → ActionMenuButton-BhiGvRJ7.js} +1 -1
  2. package/lib/{ActionMenuButton-C3Cfeza9.cjs → ActionMenuButton-qUxkZlQg.cjs} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +27 -27
  5. package/lib/Blockquote.cjs +3 -3
  6. package/lib/Blockquote.js +251 -244
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +2 -2
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -2
  11. package/lib/Callout-B9uXfbP3.js +340 -0
  12. package/lib/Callout-C_TXsss3.cjs +1 -0
  13. package/lib/Callout.cjs +1 -1
  14. package/lib/Callout.js +8 -222
  15. package/lib/Clear.cjs +1 -1
  16. package/lib/Clear.js +2 -2
  17. package/lib/Code.cjs +1 -1
  18. package/lib/Code.js +2 -2
  19. package/lib/CodeBlock.cjs +1 -1
  20. package/lib/CodeBlock.js +2 -2
  21. package/lib/CodeView.cjs +1 -1
  22. package/lib/CodeView.js +2 -2
  23. package/lib/Color.cjs +1 -1
  24. package/lib/Color.js +3 -3
  25. package/lib/Column.cjs +1 -1
  26. package/lib/Column.js +2 -2
  27. package/lib/{Drawer-D7E9kTca.cjs → Drawer-D3B4lQJF.cjs} +1 -1
  28. package/lib/{Drawer-DA0FLHs9.js → Drawer-h401Yy6Y.js} +20 -20
  29. package/lib/Drawer.cjs +1 -1
  30. package/lib/Drawer.js +4 -4
  31. package/lib/Emoji.cjs +1 -1
  32. package/lib/Emoji.js +168 -135
  33. package/lib/Excalidraw.cjs +1 -1
  34. package/lib/Excalidraw.js +5 -5
  35. package/lib/ExportPdf.cjs +1 -1
  36. package/lib/ExportPdf.js +2 -2
  37. package/lib/ExportWord.cjs +1 -1
  38. package/lib/ExportWord.js +2 -2
  39. package/lib/FontFamily.cjs +1 -1
  40. package/lib/FontFamily.js +5 -5
  41. package/lib/FontSize.cjs +1 -1
  42. package/lib/FontSize.js +5 -5
  43. package/lib/FormatPainter.cjs +1 -1
  44. package/lib/FormatPainter.js +2 -2
  45. package/lib/Heading.cjs +1 -1
  46. package/lib/Heading.js +10 -10
  47. package/lib/Highlight.cjs +1 -1
  48. package/lib/Highlight.js +3 -3
  49. package/lib/History.cjs +2 -2
  50. package/lib/History.js +584 -531
  51. package/lib/HorizontalRule.cjs +1 -1
  52. package/lib/HorizontalRule.js +2 -2
  53. package/lib/{Iframe-DZ3r3QzK.js → Iframe-Dhn40BXx.js} +3 -3
  54. package/lib/{Iframe-OMVd0xa_.cjs → Iframe-bvGuzYwC.cjs} +1 -1
  55. package/lib/Iframe.cjs +1 -1
  56. package/lib/Iframe.js +3 -3
  57. package/lib/Image.cjs +1 -1
  58. package/lib/Image.js +9 -6
  59. package/lib/ImageGif.cjs +1 -1
  60. package/lib/ImageGif.js +19 -19
  61. package/lib/ImportWord.cjs +1 -1
  62. package/lib/ImportWord.js +15 -15
  63. package/lib/{Indent-kI4G-clX.js → Indent-BK9DvCL7.js} +2 -2
  64. package/lib/{Indent-QgCoonRk.cjs → Indent-IOByomps.cjs} +1 -1
  65. package/lib/Indent.cjs +1 -1
  66. package/lib/Indent.js +2 -2
  67. package/lib/Italic.cjs +1 -1
  68. package/lib/Italic.js +2 -2
  69. package/lib/{Katex-BPbXjcZQ.js → Katex-C_Ah9G9w.js} +7 -6
  70. package/lib/Katex-oLGrtLTf.cjs +4 -0
  71. package/lib/Katex.cjs +1 -1
  72. package/lib/Katex.js +3 -3
  73. package/lib/LineHeight.cjs +1 -1
  74. package/lib/LineHeight.js +4 -4
  75. package/lib/Link.cjs +1 -1
  76. package/lib/Link.js +2 -2
  77. package/lib/{LinkEditBlock-Z7RRurvx.cjs → LinkEditBlock-BojxdGTm.cjs} +2 -2
  78. package/lib/{LinkEditBlock-BYWwH2_x.js → LinkEditBlock-DRdKXffy.js} +39 -35
  79. package/lib/MarkdownPaste.cjs +1 -1
  80. package/lib/MarkdownPaste.js +1 -1
  81. package/lib/Mention.cjs +1 -1
  82. package/lib/Mention.js +4 -4
  83. package/lib/Mermaid.cjs +2 -2
  84. package/lib/Mermaid.js +62 -61
  85. package/lib/MoreMark.cjs +1 -1
  86. package/lib/MoreMark.js +5 -5
  87. package/lib/OrderedList.cjs +1 -1
  88. package/lib/OrderedList.js +2 -2
  89. package/lib/SearchAndReplace.cjs +1 -1
  90. package/lib/SearchAndReplace.js +8 -8
  91. package/lib/SlashCommand.cjs +1 -1
  92. package/lib/SlashCommand.js +7 -7
  93. package/lib/{SlashCommandNodeView-DPPmYEjC.cjs → SlashCommandNodeView-Dai-O3aD.cjs} +1 -1
  94. package/lib/{SlashCommandNodeView-C0l3Fb_3.js → SlashCommandNodeView-qwW9cuYt.js} +6 -6
  95. package/lib/Strike.cjs +1 -1
  96. package/lib/Strike.js +2 -2
  97. package/lib/{Table-DwseaFSD.js → Table-BKM8SvVj.js} +20 -20
  98. package/lib/{Table-D5G3rfwb.cjs → Table-CWI7tKme.cjs} +1 -1
  99. package/lib/Table.cjs +1 -1
  100. package/lib/Table.js +1 -1
  101. package/lib/TaskList.cjs +1 -1
  102. package/lib/TaskList.js +2 -2
  103. package/lib/TextAlign.cjs +1 -1
  104. package/lib/TextAlign.js +3 -3
  105. package/lib/TextDirection.cjs +1 -1
  106. package/lib/TextDirection.js +3 -3
  107. package/lib/TextUnderline.cjs +1 -1
  108. package/lib/TextUnderline.js +2 -2
  109. package/lib/{Twitter-q4ZGZL0i.cjs → Twitter-BfsPzA8_.cjs} +1 -1
  110. package/lib/{Twitter-DP26Lkn8.js → Twitter-CofLQ-zj.js} +9 -9
  111. package/lib/Twitter.cjs +1 -1
  112. package/lib/Twitter.js +3 -3
  113. package/lib/Video.cjs +1 -1
  114. package/lib/Video.js +5 -5
  115. package/lib/bubble.cjs +6 -6
  116. package/lib/bubble.js +2258 -2552
  117. package/lib/{clsx-DRbkQ4T7.cjs → clsx-DJURdKPs.cjs} +2 -2
  118. package/lib/{clsx-_bq4MQQ7.js → clsx-b_2OwHLk.js} +19 -19
  119. package/lib/{dropdown-menu-CURWpB9o.cjs → dropdown-menu-CEMxzgnU.cjs} +1 -1
  120. package/lib/{dropdown-menu-BKSX4gvT.js → dropdown-menu-CKAKsyqu.js} +1 -1
  121. package/lib/extensions/Column/Column.d.ts +10 -2
  122. package/lib/extensions/Image/Image.d.ts +13 -1
  123. package/lib/index-BJQ1G8B1.js +311 -0
  124. package/lib/index-BO82_0q8.cjs +1 -0
  125. package/lib/{index-DQy9iBzV.js → index-Bn_WPziX.js} +1 -1
  126. package/lib/{index-BpLw6ebr.cjs → index-CwbGrQFa.cjs} +1 -1
  127. package/lib/{index-DtyAGMbq.js → index-DKruDABV.js} +1 -1
  128. package/lib/{index-SEMQrdk2.cjs → index-DN-IR-K0.cjs} +1 -1
  129. package/lib/{index-C52cuQ_Y.js → index-DRcwHivm.js} +1415 -1350
  130. package/lib/index-DUeBQoIA.cjs +1 -0
  131. package/lib/{index-Dbm_Mans.js → index-DeoYYWEA.js} +1 -1
  132. package/lib/{index-CHVV5iY-.cjs → index-Dgs2thVL.cjs} +1 -1
  133. package/lib/{index-BaR0Brts.js → index-DjB2kNdz.js} +171 -166
  134. package/lib/{index-CJMI7Fjf.js → index-DuWMq-Qs.js} +1 -1
  135. package/lib/{index-BGfIcDCQ.cjs → index-EoGU7W4e.cjs} +1 -1
  136. package/lib/{index-CDw4Eszh.cjs → index-MDz4NZcT.cjs} +9 -9
  137. package/lib/{index-Dx-Dh7KS.js → index-n4kM0Ll-.js} +110 -105
  138. package/lib/{index-BgNKVyMW.cjs → index-qZURFC5Q.cjs} +1 -1
  139. package/lib/index.cjs +1 -1
  140. package/lib/index.js +12 -12
  141. package/lib/locale-bundle.cjs +1 -1
  142. package/lib/locale-bundle.js +1 -1
  143. package/lib/{popover-BB-ZDnqk.js → popover-Beieacfy.js} +1 -1
  144. package/lib/{popover-CrywEkBR.cjs → popover-Bl1kxRJX.cjs} +1 -1
  145. package/lib/{renderNodeView-5h3-p80E.cjs → renderNodeView-BIgT6Ghg.cjs} +1 -1
  146. package/lib/{renderNodeView-DoKZ4GYy.js → renderNodeView-Bi58v3DZ.js} +2 -2
  147. package/lib/{separator-BGO9AZp4.cjs → separator-DMLtkcoo.cjs} +1 -1
  148. package/lib/{separator-DuuOJRQd.js → separator-DfvK668q.js} +14 -14
  149. package/lib/style.css +1 -1
  150. package/lib/textarea-DV9Fw3y1.cjs +1 -0
  151. package/lib/textarea-GXaWJbm9.js +20 -0
  152. package/lib/theme.cjs +1 -1
  153. package/lib/theme.js +1 -1
  154. package/lib/{updatePosition-CFTYKYNJ.js → updatePosition-DY1jI7qb.js} +2 -2
  155. package/lib/{updatePosition-B1oRJE1x.cjs → updatePosition-D_D-TbEu.cjs} +1 -1
  156. package/package.json +62 -61
  157. package/lib/Katex-CUofhjB5.cjs +0 -4
  158. package/lib/index-BG0kQamI.js +0 -285
  159. package/lib/index-NsYff_Ni.cjs +0 -1
  160. package/lib/index-aujjnfSJ.cjs +0 -1
package/lib/History.js CHANGED
@@ -1,26 +1,26 @@
1
- import { O as L, x as ce, F as _, v as U, T as Y, u as Z, S as x, Q as J, R as de, E as P, U as ue, V as pe, W as fe, o as he, X as B } from "./index-Dx-Dh7KS.js";
2
- import { Plugin as A, PluginKey as S } from "@tiptap/pm/state";
3
- import { DecorationSet as O, Decoration as V } from "@tiptap/pm/view";
4
- import { k as me, D as ge, a as ve } from "./index-DQy9iBzV.js";
5
- import { jsx as R, Fragment as Q } from "react/jsx-runtime";
6
- import { u as $, e as q, A as ee, i as we } from "./index-C52cuQ_Y.js";
1
+ import { Q as F, x as de, F as B, v as W, T as j, u as U, S as R, R as Y, U as ue, E as C, V as pe, W as fe, X as he, o as me, Y as X, C as ge } from "./index-n4kM0Ll-.js";
2
+ import { Plugin as x, PluginKey as I } from "@tiptap/pm/state";
3
+ import { DecorationSet as P, Decoration as L } from "@tiptap/pm/view";
4
+ import { k as ve, D as ye, a as we } from "./index-Bn_WPziX.js";
5
+ import { jsx as z, Fragment as Z } from "react/jsx-runtime";
6
+ import { u as J, e as Q, A as $, i as Ce } from "./index-DRcwHivm.js";
7
7
  import "react";
8
8
  import "./theme.js";
9
- function ye(n = {}) {
10
- return new L({
9
+ function Ee(n = {}) {
10
+ return new F({
11
11
  view(e) {
12
- return new Ce(e, n);
12
+ return new Pe(e, n);
13
13
  }
14
14
  });
15
15
  }
16
- class Ce {
16
+ class Pe {
17
17
  constructor(e, t) {
18
- var o;
19
- this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (o = t.width) !== null && o !== void 0 ? o : 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((r) => {
18
+ var r;
19
+ this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (r = t.width) !== null && r !== void 0 ? r : 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((o) => {
20
20
  let i = (s) => {
21
- this[r](s);
21
+ this[o](s);
22
22
  };
23
- return e.dom.addEventListener(r, i), { name: r, handler: i };
23
+ return e.dom.addEventListener(o, i), { name: o, handler: i };
24
24
  });
25
25
  }
26
26
  destroy() {
@@ -33,33 +33,33 @@ class Ce {
33
33
  e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
34
34
  }
35
35
  updateOverlay() {
36
- let e = this.editorView.state.doc.resolve(this.cursorPos), t = !e.parent.inlineContent, o, r = this.editorView.dom, i = r.getBoundingClientRect(), s = i.width / r.offsetWidth, l = i.height / r.offsetHeight;
36
+ let e = this.editorView.state.doc.resolve(this.cursorPos), t = !e.parent.inlineContent, r, o = this.editorView.dom, i = o.getBoundingClientRect(), s = i.width / o.offsetWidth, l = i.height / o.offsetHeight;
37
37
  if (t) {
38
- let u = e.nodeBefore, p = e.nodeAfter;
39
- if (u || p) {
40
- let f = this.editorView.nodeDOM(this.cursorPos - (u ? u.nodeSize : 0));
38
+ let c = e.nodeBefore, p = e.nodeAfter;
39
+ if (c || p) {
40
+ let f = this.editorView.nodeDOM(this.cursorPos - (c ? c.nodeSize : 0));
41
41
  if (f) {
42
- let h = f.getBoundingClientRect(), v = u ? h.bottom : h.top;
43
- u && p && (v = (v + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
44
- let y = this.width / 2 * l;
45
- o = { left: h.left, right: h.right, top: v - y, bottom: v + y };
42
+ let g = f.getBoundingClientRect(), M = c ? g.bottom : g.top;
43
+ c && p && (M = (M + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
44
+ let b = this.width / 2 * l;
45
+ r = { left: g.left, right: g.right, top: M - b, bottom: M + b };
46
46
  }
47
47
  }
48
48
  }
49
- if (!o) {
50
- let u = this.editorView.coordsAtPos(this.cursorPos), p = this.width / 2 * s;
51
- o = { left: u.left - p, right: u.left + p, top: u.top, bottom: u.bottom };
49
+ if (!r) {
50
+ let c = this.editorView.coordsAtPos(this.cursorPos), p = this.width / 2 * s;
51
+ r = { left: c.left - p, right: c.left + p, top: c.top, bottom: c.bottom };
52
52
  }
53
53
  let a = this.editorView.dom.offsetParent;
54
54
  this.element || (this.element = a.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", t), this.element.classList.toggle("prosemirror-dropcursor-inline", !t);
55
- let c, d;
55
+ let d, u;
56
56
  if (!a || a == document.body && getComputedStyle(a).position == "static")
57
- c = -pageXOffset, d = -pageYOffset;
57
+ d = -pageXOffset, u = -pageYOffset;
58
58
  else {
59
- let u = a.getBoundingClientRect(), p = u.width / a.offsetWidth, f = u.height / a.offsetHeight;
60
- c = u.left - a.scrollLeft * p, d = u.top - a.scrollTop * f;
59
+ let c = a.getBoundingClientRect(), p = c.width / a.offsetWidth, f = c.height / a.offsetHeight;
60
+ d = c.left - a.scrollLeft * p, u = c.top - a.scrollTop * f;
61
61
  }
62
- this.element.style.left = (o.left - c) / s + "px", this.element.style.top = (o.top - d) / l + "px", this.element.style.width = (o.right - o.left) / s + "px", this.element.style.height = (o.bottom - o.top) / l + "px";
62
+ this.element.style.left = (r.left - d) / s + "px", this.element.style.top = (r.top - u) / l + "px", this.element.style.width = (r.right - r.left) / s + "px", this.element.style.height = (r.bottom - r.top) / l + "px";
63
63
  }
64
64
  scheduleRemoval(e) {
65
65
  clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
@@ -67,11 +67,11 @@ class Ce {
67
67
  dragover(e) {
68
68
  if (!this.editorView.editable)
69
69
  return;
70
- let t = this.editorView.posAtCoords({ left: e.clientX, top: e.clientY }), o = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), r = o && o.type.spec.disableDropCursor, i = typeof r == "function" ? r(this.editorView, t, e) : r;
70
+ let t = this.editorView.posAtCoords({ left: e.clientX, top: e.clientY }), r = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), o = r && r.type.spec.disableDropCursor, i = typeof o == "function" ? o(this.editorView, t, e) : o;
71
71
  if (t && !i) {
72
72
  let s = t.pos;
73
73
  if (this.editorView.dragging && this.editorView.dragging.slice) {
74
- let l = ce(this.editorView.state.doc, s, this.editorView.dragging.slice);
74
+ let l = de(this.editorView.state.doc, s, this.editorView.dragging.slice);
75
75
  l != null && (s = l);
76
76
  }
77
77
  this.setCursor(s), this.scheduleRemoval(5e3);
@@ -87,7 +87,7 @@ class Ce {
87
87
  this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
88
88
  }
89
89
  }
90
- class m extends x {
90
+ class h extends R {
91
91
  /**
92
92
  Create a gap cursor.
93
93
  */
@@ -95,14 +95,14 @@ class m extends x {
95
95
  super(e, e);
96
96
  }
97
97
  map(e, t) {
98
- let o = e.resolve(t.map(this.head));
99
- return m.valid(o) ? new m(o) : x.near(o);
98
+ let r = e.resolve(t.map(this.head));
99
+ return h.valid(r) ? new h(r) : R.near(r);
100
100
  }
101
101
  content() {
102
- return U.empty;
102
+ return W.empty;
103
103
  }
104
104
  eq(e) {
105
- return e instanceof m && e.head == this.head;
105
+ return e instanceof h && e.head == this.head;
106
106
  }
107
107
  toJSON() {
108
108
  return { type: "gapcursor", pos: this.head };
@@ -113,35 +113,35 @@ class m extends x {
113
113
  static fromJSON(e, t) {
114
114
  if (typeof t.pos != "number")
115
115
  throw new RangeError("Invalid input for GapCursor.fromJSON");
116
- return new m(e.resolve(t.pos));
116
+ return new h(e.resolve(t.pos));
117
117
  }
118
118
  /**
119
119
  @internal
120
120
  */
121
121
  getBookmark() {
122
- return new F(this.anchor);
122
+ return new V(this.anchor);
123
123
  }
124
124
  /**
125
125
  @internal
126
126
  */
127
127
  static valid(e) {
128
128
  let t = e.parent;
129
- if (t.inlineContent || !be(e) || !Pe(e))
129
+ if (t.inlineContent || !Me(e) || !be(e))
130
130
  return !1;
131
- let o = t.type.spec.allowGapCursor;
132
- if (o != null)
133
- return o;
134
- let r = t.contentMatchAt(e.index()).defaultType;
135
- return r && r.isTextblock;
131
+ let r = t.type.spec.allowGapCursor;
132
+ if (r != null)
133
+ return r;
134
+ let o = t.contentMatchAt(e.index()).defaultType;
135
+ return o && o.isTextblock;
136
136
  }
137
137
  /**
138
138
  @internal
139
139
  */
140
- static findGapCursorFrom(e, t, o = !1) {
140
+ static findGapCursorFrom(e, t, r = !1) {
141
141
  e: for (; ; ) {
142
- if (!o && m.valid(e))
142
+ if (!r && h.valid(e))
143
143
  return e;
144
- let r = e.pos, i = null;
144
+ let o = e.pos, i = null;
145
145
  for (let s = e.depth; ; s--) {
146
146
  let l = e.node(s);
147
147
  if (t > 0 ? e.indexAfter(s) < l.childCount : e.index(s) > 0) {
@@ -149,239 +149,239 @@ class m extends x {
149
149
  break;
150
150
  } else if (s == 0)
151
151
  return null;
152
- r += t;
153
- let a = e.doc.resolve(r);
154
- if (m.valid(a))
152
+ o += t;
153
+ let a = e.doc.resolve(o);
154
+ if (h.valid(a))
155
155
  return a;
156
156
  }
157
157
  for (; ; ) {
158
158
  let s = t > 0 ? i.firstChild : i.lastChild;
159
159
  if (!s) {
160
- if (i.isAtom && !i.isText && !Z.isSelectable(i)) {
161
- e = e.doc.resolve(r + i.nodeSize * t), o = !1;
160
+ if (i.isAtom && !i.isText && !U.isSelectable(i)) {
161
+ e = e.doc.resolve(o + i.nodeSize * t), r = !1;
162
162
  continue e;
163
163
  }
164
164
  break;
165
165
  }
166
- i = s, r += t;
167
- let l = e.doc.resolve(r);
168
- if (m.valid(l))
166
+ i = s, o += t;
167
+ let l = e.doc.resolve(o);
168
+ if (h.valid(l))
169
169
  return l;
170
170
  }
171
171
  return null;
172
172
  }
173
173
  }
174
174
  }
175
- m.prototype.visible = !1;
176
- m.findFrom = m.findGapCursorFrom;
177
- x.jsonID("gapcursor", m);
178
- class F {
175
+ h.prototype.visible = !1;
176
+ h.findFrom = h.findGapCursorFrom;
177
+ R.jsonID("gapcursor", h);
178
+ class V {
179
179
  constructor(e) {
180
180
  this.pos = e;
181
181
  }
182
182
  map(e) {
183
- return new F(e.map(this.pos));
183
+ return new V(e.map(this.pos));
184
184
  }
185
185
  resolve(e) {
186
186
  let t = e.resolve(this.pos);
187
- return m.valid(t) ? new m(t) : x.near(t);
187
+ return h.valid(t) ? new h(t) : R.near(t);
188
188
  }
189
189
  }
190
- function te(n) {
190
+ function q(n) {
191
191
  return n.isAtom || n.spec.isolating || n.spec.createGapCursor;
192
192
  }
193
- function be(n) {
193
+ function Me(n) {
194
194
  for (let e = n.depth; e >= 0; e--) {
195
- let t = n.index(e), o = n.node(e);
195
+ let t = n.index(e), r = n.node(e);
196
196
  if (t == 0) {
197
- if (o.type.spec.isolating)
197
+ if (r.type.spec.isolating)
198
198
  return !0;
199
199
  continue;
200
200
  }
201
- for (let r = o.child(t - 1); ; r = r.lastChild) {
202
- if (r.childCount == 0 && !r.inlineContent || te(r.type))
201
+ for (let o = r.child(t - 1); ; o = o.lastChild) {
202
+ if (o.childCount == 0 && !o.inlineContent || q(o.type))
203
203
  return !0;
204
- if (r.inlineContent)
204
+ if (o.inlineContent)
205
205
  return !1;
206
206
  }
207
207
  }
208
208
  return !0;
209
209
  }
210
- function Pe(n) {
210
+ function be(n) {
211
211
  for (let e = n.depth; e >= 0; e--) {
212
- let t = n.indexAfter(e), o = n.node(e);
213
- if (t == o.childCount) {
214
- if (o.type.spec.isolating)
212
+ let t = n.indexAfter(e), r = n.node(e);
213
+ if (t == r.childCount) {
214
+ if (r.type.spec.isolating)
215
215
  return !0;
216
216
  continue;
217
217
  }
218
- for (let r = o.child(t); ; r = r.firstChild) {
219
- if (r.childCount == 0 && !r.inlineContent || te(r.type))
218
+ for (let o = r.child(t); ; o = o.firstChild) {
219
+ if (o.childCount == 0 && !o.inlineContent || q(o.type))
220
220
  return !0;
221
- if (r.inlineContent)
221
+ if (o.inlineContent)
222
222
  return !1;
223
223
  }
224
224
  }
225
225
  return !0;
226
226
  }
227
- function Ee() {
228
- return new L({
227
+ function Ae() {
228
+ return new F({
229
229
  props: {
230
- decorations: Te,
230
+ decorations: Se,
231
231
  createSelectionBetween(n, e, t) {
232
- return e.pos == t.pos && m.valid(t) ? new m(t) : null;
232
+ return e.pos == t.pos && h.valid(t) ? new h(t) : null;
233
233
  },
234
- handleClick: Ae,
235
- handleKeyDown: Me,
236
- handleDOMEvents: { beforeinput: Se }
234
+ handleClick: xe,
235
+ handleKeyDown: Te,
236
+ handleDOMEvents: { beforeinput: Ie }
237
237
  }
238
238
  });
239
239
  }
240
- const Me = me({
241
- ArrowLeft: T("horiz", -1),
242
- ArrowRight: T("horiz", 1),
243
- ArrowUp: T("vert", -1),
244
- ArrowDown: T("vert", 1)
240
+ const Te = ve({
241
+ ArrowLeft: S("horiz", -1),
242
+ ArrowRight: S("horiz", 1),
243
+ ArrowUp: S("vert", -1),
244
+ ArrowDown: S("vert", 1)
245
245
  });
246
- function T(n, e) {
246
+ function S(n, e) {
247
247
  const t = n == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
248
- return function(o, r, i) {
249
- let s = o.selection, l = e > 0 ? s.$to : s.$from, a = s.empty;
250
- if (s instanceof Y) {
248
+ return function(r, o, i) {
249
+ let s = r.selection, l = e > 0 ? s.$to : s.$from, a = s.empty;
250
+ if (s instanceof j) {
251
251
  if (!i.endOfTextblock(t) || l.depth == 0)
252
252
  return !1;
253
- a = !1, l = o.doc.resolve(e > 0 ? l.after() : l.before());
253
+ a = !1, l = r.doc.resolve(e > 0 ? l.after() : l.before());
254
254
  }
255
- let c = m.findGapCursorFrom(l, e, a);
256
- return c ? (r && r(o.tr.setSelection(new m(c))), !0) : !1;
255
+ let d = h.findGapCursorFrom(l, e, a);
256
+ return d ? (o && o(r.tr.setSelection(new h(d))), !0) : !1;
257
257
  };
258
258
  }
259
- function Ae(n, e, t) {
259
+ function xe(n, e, t) {
260
260
  if (!n || !n.editable)
261
261
  return !1;
262
- let o = n.state.doc.resolve(e);
263
- if (!m.valid(o))
262
+ let r = n.state.doc.resolve(e);
263
+ if (!h.valid(r))
264
264
  return !1;
265
- let r = n.posAtCoords({ left: t.clientX, top: t.clientY });
266
- return r && r.inside > -1 && Z.isSelectable(n.state.doc.nodeAt(r.inside)) ? !1 : (n.dispatch(n.state.tr.setSelection(new m(o))), !0);
265
+ let o = n.posAtCoords({ left: t.clientX, top: t.clientY });
266
+ return o && o.inside > -1 && U.isSelectable(n.state.doc.nodeAt(o.inside)) ? !1 : (n.dispatch(n.state.tr.setSelection(new h(r))), !0);
267
267
  }
268
- function Se(n, e) {
269
- if (e.inputType != "insertCompositionText" || !(n.state.selection instanceof m))
268
+ function Ie(n, e) {
269
+ if (e.inputType != "insertCompositionText" || !(n.state.selection instanceof h))
270
270
  return !1;
271
- let { $from: t } = n.state.selection, o = t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);
272
- if (!o)
271
+ let { $from: t } = n.state.selection, r = t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);
272
+ if (!r)
273
273
  return !1;
274
- let r = _.empty;
275
- for (let s = o.length - 1; s >= 0; s--)
276
- r = _.from(o[s].createAndFill(null, r));
277
- let i = n.state.tr.replace(t.pos, t.pos, new U(r, 0, 0));
278
- return i.setSelection(Y.near(i.doc.resolve(t.pos + 1))), n.dispatch(i), !1;
274
+ let o = B.empty;
275
+ for (let s = r.length - 1; s >= 0; s--)
276
+ o = B.from(r[s].createAndFill(null, o));
277
+ let i = n.state.tr.replace(t.pos, t.pos, new W(o, 0, 0));
278
+ return i.setSelection(j.near(i.doc.resolve(t.pos + 1))), n.dispatch(i), !1;
279
279
  }
280
- function Te(n) {
281
- if (!(n.selection instanceof m))
280
+ function Se(n) {
281
+ if (!(n.selection instanceof h))
282
282
  return null;
283
283
  let e = document.createElement("div");
284
- return e.className = "ProseMirror-gapcursor", ge.create(n.doc, [ve.widget(n.selection.head, e, { key: "gapcursor" })]);
284
+ return e.className = "ProseMirror-gapcursor", ye.create(n.doc, [we.widget(n.selection.head, e, { key: "gapcursor" })]);
285
285
  }
286
- var D = 200, g = function() {
286
+ var D = 200, m = function() {
287
287
  };
288
- g.prototype.append = function(e) {
289
- return e.length ? (e = g.from(e), !this.length && e || e.length < D && this.leafAppend(e) || this.length < D && e.leafPrepend(this) || this.appendInner(e)) : this;
288
+ m.prototype.append = function(e) {
289
+ return e.length ? (e = m.from(e), !this.length && e || e.length < D && this.leafAppend(e) || this.length < D && e.leafPrepend(this) || this.appendInner(e)) : this;
290
290
  };
291
- g.prototype.prepend = function(e) {
292
- return e.length ? g.from(e).append(this) : this;
291
+ m.prototype.prepend = function(e) {
292
+ return e.length ? m.from(e).append(this) : this;
293
293
  };
294
- g.prototype.appendInner = function(e) {
295
- return new Ie(this, e);
294
+ m.prototype.appendInner = function(e) {
295
+ return new Oe(this, e);
296
296
  };
297
- g.prototype.slice = function(e, t) {
298
- return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? g.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
297
+ m.prototype.slice = function(e, t) {
298
+ return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? m.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
299
299
  };
300
- g.prototype.get = function(e) {
300
+ m.prototype.get = function(e) {
301
301
  if (!(e < 0 || e >= this.length))
302
302
  return this.getInner(e);
303
303
  };
304
- g.prototype.forEach = function(e, t, o) {
305
- t === void 0 && (t = 0), o === void 0 && (o = this.length), t <= o ? this.forEachInner(e, t, o, 0) : this.forEachInvertedInner(e, t, o, 0);
304
+ m.prototype.forEach = function(e, t, r) {
305
+ t === void 0 && (t = 0), r === void 0 && (r = this.length), t <= r ? this.forEachInner(e, t, r, 0) : this.forEachInvertedInner(e, t, r, 0);
306
306
  };
307
- g.prototype.map = function(e, t, o) {
308
- t === void 0 && (t = 0), o === void 0 && (o = this.length);
309
- var r = [];
307
+ m.prototype.map = function(e, t, r) {
308
+ t === void 0 && (t = 0), r === void 0 && (r = this.length);
309
+ var o = [];
310
310
  return this.forEach(function(i, s) {
311
- return r.push(e(i, s));
312
- }, t, o), r;
311
+ return o.push(e(i, s));
312
+ }, t, r), o;
313
313
  };
314
- g.from = function(e) {
315
- return e instanceof g ? e : e && e.length ? new ne(e) : g.empty;
314
+ m.from = function(e) {
315
+ return e instanceof m ? e : e && e.length ? new ee(e) : m.empty;
316
316
  };
317
- var ne = /* @__PURE__ */ (function(n) {
318
- function e(o) {
319
- n.call(this), this.values = o;
317
+ var ee = /* @__PURE__ */ (function(n) {
318
+ function e(r) {
319
+ n.call(this), this.values = r;
320
320
  }
321
321
  n && (e.__proto__ = n), e.prototype = Object.create(n && n.prototype), e.prototype.constructor = e;
322
322
  var t = { length: { configurable: !0 }, depth: { configurable: !0 } };
323
323
  return e.prototype.flatten = function() {
324
324
  return this.values;
325
- }, e.prototype.sliceInner = function(r, i) {
326
- return r == 0 && i == this.length ? this : new e(this.values.slice(r, i));
327
- }, e.prototype.getInner = function(r) {
328
- return this.values[r];
329
- }, e.prototype.forEachInner = function(r, i, s, l) {
325
+ }, e.prototype.sliceInner = function(o, i) {
326
+ return o == 0 && i == this.length ? this : new e(this.values.slice(o, i));
327
+ }, e.prototype.getInner = function(o) {
328
+ return this.values[o];
329
+ }, e.prototype.forEachInner = function(o, i, s, l) {
330
330
  for (var a = i; a < s; a++)
331
- if (r(this.values[a], l + a) === !1)
331
+ if (o(this.values[a], l + a) === !1)
332
332
  return !1;
333
- }, e.prototype.forEachInvertedInner = function(r, i, s, l) {
333
+ }, e.prototype.forEachInvertedInner = function(o, i, s, l) {
334
334
  for (var a = i - 1; a >= s; a--)
335
- if (r(this.values[a], l + a) === !1)
335
+ if (o(this.values[a], l + a) === !1)
336
336
  return !1;
337
- }, e.prototype.leafAppend = function(r) {
338
- if (this.length + r.length <= D)
339
- return new e(this.values.concat(r.flatten()));
340
- }, e.prototype.leafPrepend = function(r) {
341
- if (this.length + r.length <= D)
342
- return new e(r.flatten().concat(this.values));
337
+ }, e.prototype.leafAppend = function(o) {
338
+ if (this.length + o.length <= D)
339
+ return new e(this.values.concat(o.flatten()));
340
+ }, e.prototype.leafPrepend = function(o) {
341
+ if (this.length + o.length <= D)
342
+ return new e(o.flatten().concat(this.values));
343
343
  }, t.length.get = function() {
344
344
  return this.values.length;
345
345
  }, t.depth.get = function() {
346
346
  return 0;
347
347
  }, Object.defineProperties(e.prototype, t), e;
348
- })(g);
349
- g.empty = new ne([]);
350
- var Ie = /* @__PURE__ */ (function(n) {
351
- function e(t, o) {
352
- n.call(this), this.left = t, this.right = o, this.length = t.length + o.length, this.depth = Math.max(t.depth, o.depth) + 1;
348
+ })(m);
349
+ m.empty = new ee([]);
350
+ var Oe = /* @__PURE__ */ (function(n) {
351
+ function e(t, r) {
352
+ n.call(this), this.left = t, this.right = r, this.length = t.length + r.length, this.depth = Math.max(t.depth, r.depth) + 1;
353
353
  }
354
354
  return n && (e.__proto__ = n), e.prototype = Object.create(n && n.prototype), e.prototype.constructor = e, e.prototype.flatten = function() {
355
355
  return this.left.flatten().concat(this.right.flatten());
356
- }, e.prototype.getInner = function(o) {
357
- return o < this.left.length ? this.left.get(o) : this.right.get(o - this.left.length);
358
- }, e.prototype.forEachInner = function(o, r, i, s) {
356
+ }, e.prototype.getInner = function(r) {
357
+ return r < this.left.length ? this.left.get(r) : this.right.get(r - this.left.length);
358
+ }, e.prototype.forEachInner = function(r, o, i, s) {
359
359
  var l = this.left.length;
360
- if (r < l && this.left.forEachInner(o, r, Math.min(i, l), s) === !1 || i > l && this.right.forEachInner(o, Math.max(r - l, 0), Math.min(this.length, i) - l, s + l) === !1)
360
+ if (o < l && this.left.forEachInner(r, o, Math.min(i, l), s) === !1 || i > l && this.right.forEachInner(r, Math.max(o - l, 0), Math.min(this.length, i) - l, s + l) === !1)
361
361
  return !1;
362
- }, e.prototype.forEachInvertedInner = function(o, r, i, s) {
362
+ }, e.prototype.forEachInvertedInner = function(r, o, i, s) {
363
363
  var l = this.left.length;
364
- if (r > l && this.right.forEachInvertedInner(o, r - l, Math.max(i, l) - l, s + l) === !1 || i < l && this.left.forEachInvertedInner(o, Math.min(r, l), i, s) === !1)
364
+ if (o > l && this.right.forEachInvertedInner(r, o - l, Math.max(i, l) - l, s + l) === !1 || i < l && this.left.forEachInvertedInner(r, Math.min(o, l), i, s) === !1)
365
365
  return !1;
366
- }, e.prototype.sliceInner = function(o, r) {
367
- if (o == 0 && r == this.length)
366
+ }, e.prototype.sliceInner = function(r, o) {
367
+ if (r == 0 && o == this.length)
368
368
  return this;
369
369
  var i = this.left.length;
370
- return r <= i ? this.left.slice(o, r) : o >= i ? this.right.slice(o - i, r - i) : this.left.slice(o, i).append(this.right.slice(0, r - i));
371
- }, e.prototype.leafAppend = function(o) {
372
- var r = this.right.leafAppend(o);
373
- if (r)
374
- return new e(this.left, r);
375
- }, e.prototype.leafPrepend = function(o) {
376
- var r = this.left.leafPrepend(o);
377
- if (r)
378
- return new e(r, this.right);
379
- }, e.prototype.appendInner = function(o) {
380
- return this.left.depth >= Math.max(this.right.depth, o.depth) + 1 ? new e(this.left, new e(this.right, o)) : new e(this, o);
370
+ return o <= i ? this.left.slice(r, o) : r >= i ? this.right.slice(r - i, o - i) : this.left.slice(r, i).append(this.right.slice(0, o - i));
371
+ }, e.prototype.leafAppend = function(r) {
372
+ var o = this.right.leafAppend(r);
373
+ if (o)
374
+ return new e(this.left, o);
375
+ }, e.prototype.leafPrepend = function(r) {
376
+ var o = this.left.leafPrepend(r);
377
+ if (o)
378
+ return new e(o, this.right);
379
+ }, e.prototype.appendInner = function(r) {
380
+ return this.left.depth >= Math.max(this.right.depth, r.depth) + 1 ? new e(this.left, new e(this.right, r)) : new e(this, r);
381
381
  }, e;
382
- })(g);
383
- const xe = 500;
384
- class w {
382
+ })(m);
383
+ const Re = 500;
384
+ class v {
385
385
  constructor(e, t) {
386
386
  this.items = e, this.eventCount = t;
387
387
  }
@@ -390,49 +390,49 @@ class w {
390
390
  popEvent(e, t) {
391
391
  if (this.eventCount == 0)
392
392
  return null;
393
- let o = this.items.length;
394
- for (; ; o--)
395
- if (this.items.get(o - 1).selection) {
396
- --o;
393
+ let r = this.items.length;
394
+ for (; ; r--)
395
+ if (this.items.get(r - 1).selection) {
396
+ --r;
397
397
  break;
398
398
  }
399
- let r, i;
400
- t && (r = this.remapping(o, this.items.length), i = r.maps.length);
401
- let s = e.tr, l, a, c = [], d = [];
402
- return this.items.forEach((u, p) => {
403
- if (!u.step) {
404
- r || (r = this.remapping(o, p + 1), i = r.maps.length), i--, d.push(u);
399
+ let o, i;
400
+ t && (o = this.remapping(r, this.items.length), i = o.maps.length);
401
+ let s = e.tr, l, a, d = [], u = [];
402
+ return this.items.forEach((c, p) => {
403
+ if (!c.step) {
404
+ o || (o = this.remapping(r, p + 1), i = o.maps.length), i--, u.push(c);
405
405
  return;
406
406
  }
407
- if (r) {
408
- d.push(new C(u.map));
409
- let f = u.step.map(r.slice(i)), h;
410
- f && s.maybeStep(f).doc && (h = s.mapping.maps[s.mapping.maps.length - 1], c.push(new C(h, void 0, void 0, c.length + d.length))), i--, h && r.appendMap(h, i);
407
+ if (o) {
408
+ u.push(new y(c.map));
409
+ let f = c.step.map(o.slice(i)), g;
410
+ f && s.maybeStep(f).doc && (g = s.mapping.maps[s.mapping.maps.length - 1], d.push(new y(g, void 0, void 0, d.length + u.length))), i--, g && o.appendMap(g, i);
411
411
  } else
412
- s.maybeStep(u.step);
413
- if (u.selection)
414
- return l = r ? u.selection.map(r.slice(i)) : u.selection, a = new w(this.items.slice(0, o).append(d.reverse().concat(c)), this.eventCount - 1), !1;
412
+ s.maybeStep(c.step);
413
+ if (c.selection)
414
+ return l = o ? c.selection.map(o.slice(i)) : c.selection, a = new v(this.items.slice(0, r).append(u.reverse().concat(d)), this.eventCount - 1), !1;
415
415
  }, this.items.length, 0), { remaining: a, transform: s, selection: l };
416
416
  }
417
417
  // Create a new branch with the given transform added.
418
- addTransform(e, t, o, r) {
419
- let i = [], s = this.eventCount, l = this.items, a = !r && l.length ? l.get(l.length - 1) : null;
420
- for (let d = 0; d < e.steps.length; d++) {
421
- let u = e.steps[d].invert(e.docs[d]), p = new C(e.mapping.maps[d], u, t), f;
422
- (f = a && a.merge(p)) && (p = f, d ? i.pop() : l = l.slice(0, l.length - 1)), i.push(p), t && (s++, t = void 0), r || (a = p);
418
+ addTransform(e, t, r, o) {
419
+ let i = [], s = this.eventCount, l = this.items, a = !o && l.length ? l.get(l.length - 1) : null;
420
+ for (let u = 0; u < e.steps.length; u++) {
421
+ let c = e.steps[u].invert(e.docs[u]), p = new y(e.mapping.maps[u], c, t), f;
422
+ (f = a && a.merge(p)) && (p = f, u ? i.pop() : l = l.slice(0, l.length - 1)), i.push(p), t && (s++, t = void 0), o || (a = p);
423
423
  }
424
- let c = s - o.depth;
425
- return c > Re && (l = Oe(l, c), s -= c), new w(l.append(i), s);
424
+ let d = s - r.depth;
425
+ return d > De && (l = ze(l, d), s -= d), new v(l.append(i), s);
426
426
  }
427
427
  remapping(e, t) {
428
- let o = new de();
429
- return this.items.forEach((r, i) => {
430
- let s = r.mirrorOffset != null && i - r.mirrorOffset >= e ? o.maps.length - r.mirrorOffset : void 0;
431
- o.appendMap(r.map, s);
432
- }, e, t), o;
428
+ let r = new ue();
429
+ return this.items.forEach((o, i) => {
430
+ let s = o.mirrorOffset != null && i - o.mirrorOffset >= e ? r.maps.length - o.mirrorOffset : void 0;
431
+ r.appendMap(o.map, s);
432
+ }, e, t), r;
433
433
  }
434
434
  addMaps(e) {
435
- return this.eventCount == 0 ? this : new w(this.items.append(e.map((t) => new C(t))), this.eventCount);
435
+ return this.eventCount == 0 ? this : new v(this.items.append(e.map((t) => new y(t))), this.eventCount);
436
436
  }
437
437
  // When the collab module receives remote changes, the history has
438
438
  // to know about those, so that it can adjust the steps that were
@@ -441,28 +441,28 @@ class w {
441
441
  rebased(e, t) {
442
442
  if (!this.eventCount)
443
443
  return this;
444
- let o = [], r = Math.max(0, this.items.length - t), i = e.mapping, s = e.steps.length, l = this.eventCount;
444
+ let r = [], o = Math.max(0, this.items.length - t), i = e.mapping, s = e.steps.length, l = this.eventCount;
445
445
  this.items.forEach((p) => {
446
446
  p.selection && l--;
447
- }, r);
447
+ }, o);
448
448
  let a = t;
449
449
  this.items.forEach((p) => {
450
450
  let f = i.getMirror(--a);
451
451
  if (f == null)
452
452
  return;
453
453
  s = Math.min(s, f);
454
- let h = i.maps[f];
454
+ let g = i.maps[f];
455
455
  if (p.step) {
456
- let v = e.steps[f].invert(e.docs[f]), y = p.selection && p.selection.map(i.slice(a + 1, f));
457
- y && l++, o.push(new C(h, v, y));
456
+ let M = e.steps[f].invert(e.docs[f]), b = p.selection && p.selection.map(i.slice(a + 1, f));
457
+ b && l++, r.push(new y(g, M, b));
458
458
  } else
459
- o.push(new C(h));
460
- }, r);
461
- let c = [];
459
+ r.push(new y(g));
460
+ }, o);
461
+ let d = [];
462
462
  for (let p = t; p < s; p++)
463
- c.push(new C(i.maps[p]));
464
- let d = this.items.slice(0, r).append(c).append(o), u = new w(d, l);
465
- return u.emptyItemCount() > xe && (u = u.compress(this.items.length - o.length)), u;
463
+ d.push(new y(i.maps[p]));
464
+ let u = this.items.slice(0, o).append(d).append(r), c = new v(u, l);
465
+ return c.emptyItemCount() > Re && (c = c.compress(this.items.length - r.length)), c;
466
466
  }
467
467
  emptyItemCount() {
468
468
  let e = 0;
@@ -477,62 +477,62 @@ class w {
477
477
  // because `rebased` relies on a clean, untouched set of items in
478
478
  // order to associate old items with rebased steps.
479
479
  compress(e = this.items.length) {
480
- let t = this.remapping(0, e), o = t.maps.length, r = [], i = 0;
480
+ let t = this.remapping(0, e), r = t.maps.length, o = [], i = 0;
481
481
  return this.items.forEach((s, l) => {
482
482
  if (l >= e)
483
- r.push(s), s.selection && i++;
483
+ o.push(s), s.selection && i++;
484
484
  else if (s.step) {
485
- let a = s.step.map(t.slice(o)), c = a && a.getMap();
486
- if (o--, c && t.appendMap(c, o), a) {
487
- let d = s.selection && s.selection.map(t.slice(o));
488
- d && i++;
489
- let u = new C(c.invert(), a, d), p, f = r.length - 1;
490
- (p = r.length && r[f].merge(u)) ? r[f] = p : r.push(u);
485
+ let a = s.step.map(t.slice(r)), d = a && a.getMap();
486
+ if (r--, d && t.appendMap(d, r), a) {
487
+ let u = s.selection && s.selection.map(t.slice(r));
488
+ u && i++;
489
+ let c = new y(d.invert(), a, u), p, f = o.length - 1;
490
+ (p = o.length && o[f].merge(c)) ? o[f] = p : o.push(c);
491
491
  }
492
- } else s.map && o--;
493
- }, this.items.length, 0), new w(g.from(r.reverse()), i);
492
+ } else s.map && r--;
493
+ }, this.items.length, 0), new v(m.from(o.reverse()), i);
494
494
  }
495
495
  }
496
- w.empty = new w(g.empty, 0);
497
- function Oe(n, e) {
496
+ v.empty = new v(m.empty, 0);
497
+ function ze(n, e) {
498
498
  let t;
499
- return n.forEach((o, r) => {
500
- if (o.selection && e-- == 0)
501
- return t = r, !1;
499
+ return n.forEach((r, o) => {
500
+ if (r.selection && e-- == 0)
501
+ return t = o, !1;
502
502
  }), n.slice(t);
503
503
  }
504
- class C {
505
- constructor(e, t, o, r) {
506
- this.map = e, this.step = t, this.selection = o, this.mirrorOffset = r;
504
+ class y {
505
+ constructor(e, t, r, o) {
506
+ this.map = e, this.step = t, this.selection = r, this.mirrorOffset = o;
507
507
  }
508
508
  merge(e) {
509
509
  if (this.step && e.step && !e.selection) {
510
510
  let t = e.step.merge(this.step);
511
511
  if (t)
512
- return new C(t.getMap().invert(), t, this.selection);
512
+ return new y(t.getMap().invert(), t, this.selection);
513
513
  }
514
514
  }
515
515
  }
516
- class b {
517
- constructor(e, t, o, r, i) {
518
- this.done = e, this.undone = t, this.prevRanges = o, this.prevTime = r, this.prevComposition = i;
516
+ class w {
517
+ constructor(e, t, r, o, i) {
518
+ this.done = e, this.undone = t, this.prevRanges = r, this.prevTime = o, this.prevComposition = i;
519
519
  }
520
520
  }
521
- const Re = 20;
522
- function De(n, e, t, o) {
523
- let r = t.getMeta(E), i;
524
- if (r)
525
- return r.historyState;
526
- t.getMeta(ze) && (n = new b(n.done, n.undone, null, 0, -1));
521
+ const De = 20;
522
+ function ke(n, e, t, r) {
523
+ let o = t.getMeta(E), i;
524
+ if (o)
525
+ return o.historyState;
526
+ t.getMeta(Le) && (n = new w(n.done, n.undone, null, 0, -1));
527
527
  let s = t.getMeta("appendedTransaction");
528
528
  if (t.steps.length == 0)
529
529
  return n;
530
530
  if (s && s.getMeta(E))
531
- return s.getMeta(E).redo ? new b(n.done.addTransform(t, void 0, o, I(e)), n.undone, K(t.mapping.maps), n.prevTime, n.prevComposition) : new b(n.done, n.undone.addTransform(t, void 0, o, I(e)), null, n.prevTime, n.prevComposition);
531
+ return s.getMeta(E).redo ? new w(n.done.addTransform(t, void 0, r, O(e)), n.undone, _(t.mapping.maps), n.prevTime, n.prevComposition) : new w(n.done, n.undone.addTransform(t, void 0, r, O(e)), null, n.prevTime, n.prevComposition);
532
532
  if (t.getMeta("addToHistory") !== !1 && !(s && s.getMeta("addToHistory") === !1)) {
533
- let l = t.getMeta("composition"), a = n.prevTime == 0 || !s && n.prevComposition != l && (n.prevTime < (t.time || 0) - o.newGroupDelay || !Ne(t, n.prevRanges)), c = s ? k(n.prevRanges, t.mapping) : K(t.mapping.maps);
534
- return new b(n.done.addTransform(t, a ? e.selection.getBookmark() : void 0, o, I(e)), w.empty, c, t.time, l ?? n.prevComposition);
535
- } else return (i = t.getMeta("rebased")) ? new b(n.done.rebased(t, i), n.undone.rebased(t, i), k(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new b(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), k(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
533
+ let l = t.getMeta("composition"), a = n.prevTime == 0 || !s && n.prevComposition != l && (n.prevTime < (t.time || 0) - r.newGroupDelay || !Ne(t, n.prevRanges)), d = s ? k(n.prevRanges, t.mapping) : _(t.mapping.maps);
534
+ return new w(n.done.addTransform(t, a ? e.selection.getBookmark() : void 0, r, O(e)), v.empty, d, t.time, l ?? n.prevComposition);
535
+ } else return (i = t.getMeta("rebased")) ? new w(n.done.rebased(t, i), n.undone.rebased(t, i), k(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new w(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), k(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
536
536
  }
537
537
  function Ne(n, e) {
538
538
  if (!e)
@@ -540,87 +540,87 @@ function Ne(n, e) {
540
540
  if (!n.docChanged)
541
541
  return !0;
542
542
  let t = !1;
543
- return n.mapping.maps[0].forEach((o, r) => {
543
+ return n.mapping.maps[0].forEach((r, o) => {
544
544
  for (let i = 0; i < e.length; i += 2)
545
- o <= e[i + 1] && r >= e[i] && (t = !0);
545
+ r <= e[i + 1] && o >= e[i] && (t = !0);
546
546
  }), t;
547
547
  }
548
- function K(n) {
548
+ function _(n) {
549
549
  let e = [];
550
550
  for (let t = n.length - 1; t >= 0 && e.length == 0; t--)
551
- n[t].forEach((o, r, i, s) => e.push(i, s));
551
+ n[t].forEach((r, o, i, s) => e.push(i, s));
552
552
  return e;
553
553
  }
554
554
  function k(n, e) {
555
555
  if (!n)
556
556
  return null;
557
557
  let t = [];
558
- for (let o = 0; o < n.length; o += 2) {
559
- let r = e.map(n[o], 1), i = e.map(n[o + 1], -1);
560
- r <= i && t.push(r, i);
558
+ for (let r = 0; r < n.length; r += 2) {
559
+ let o = e.map(n[r], 1), i = e.map(n[r + 1], -1);
560
+ o <= i && t.push(o, i);
561
561
  }
562
562
  return t;
563
563
  }
564
- function ke(n, e, t) {
565
- let o = I(e), r = E.get(e).spec.config, i = (t ? n.undone : n.done).popEvent(e, o);
564
+ function Fe(n, e, t) {
565
+ let r = O(e), o = E.get(e).spec.config, i = (t ? n.undone : n.done).popEvent(e, r);
566
566
  if (!i)
567
567
  return null;
568
- let s = i.selection.resolve(i.transform.doc), l = (t ? n.done : n.undone).addTransform(i.transform, e.selection.getBookmark(), r, o), a = new b(t ? l : i.remaining, t ? i.remaining : l, null, 0, -1);
568
+ let s = i.selection.resolve(i.transform.doc), l = (t ? n.done : n.undone).addTransform(i.transform, e.selection.getBookmark(), o, r), a = new w(t ? l : i.remaining, t ? i.remaining : l, null, 0, -1);
569
569
  return i.transform.setSelection(s).setMeta(E, { redo: t, historyState: a });
570
570
  }
571
- let z = !1, H = null;
572
- function I(n) {
571
+ let N = !1, K = null;
572
+ function O(n) {
573
573
  let e = n.plugins;
574
- if (H != e) {
575
- z = !1, H = e;
574
+ if (K != e) {
575
+ N = !1, K = e;
576
576
  for (let t = 0; t < e.length; t++)
577
577
  if (e[t].spec.historyPreserveItems) {
578
- z = !0;
578
+ N = !0;
579
579
  break;
580
580
  }
581
581
  }
582
- return z;
582
+ return N;
583
583
  }
584
- const E = new J("history"), ze = new J("closeHistory");
585
- function Le(n = {}) {
584
+ const E = new Y("history"), Le = new Y("closeHistory");
585
+ function Ve(n = {}) {
586
586
  return n = {
587
587
  depth: n.depth || 100,
588
588
  newGroupDelay: n.newGroupDelay || 500
589
- }, new L({
589
+ }, new F({
590
590
  key: E,
591
591
  state: {
592
592
  init() {
593
- return new b(w.empty, w.empty, null, 0, -1);
593
+ return new w(v.empty, v.empty, null, 0, -1);
594
594
  },
595
- apply(e, t, o) {
596
- return De(t, o, e, n);
595
+ apply(e, t, r) {
596
+ return ke(t, r, e, n);
597
597
  }
598
598
  },
599
599
  config: n,
600
600
  props: {
601
601
  handleDOMEvents: {
602
602
  beforeinput(e, t) {
603
- let o = t.inputType, r = o == "historyUndo" ? re : o == "historyRedo" ? ie : null;
604
- return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
603
+ let r = t.inputType, o = r == "historyUndo" ? ne : r == "historyRedo" ? re : null;
604
+ return !o || !e.editable ? !1 : (t.preventDefault(), o(e.state, e.dispatch));
605
605
  }
606
606
  }
607
607
  }
608
608
  });
609
609
  }
610
- function oe(n, e) {
611
- return (t, o) => {
612
- let r = E.getState(t);
613
- if (!r || (n ? r.undone : r.done).eventCount == 0)
610
+ function te(n, e) {
611
+ return (t, r) => {
612
+ let o = E.getState(t);
613
+ if (!o || (n ? o.undone : o.done).eventCount == 0)
614
614
  return !1;
615
- if (o) {
616
- let i = ke(r, t, n);
617
- i && o(e ? i.scrollIntoView() : i);
615
+ if (r) {
616
+ let i = Fe(o, t, n);
617
+ i && r(e ? i.scrollIntoView() : i);
618
618
  }
619
619
  return !0;
620
620
  };
621
621
  }
622
- const re = oe(!1, !0), ie = oe(!0, !0);
623
- P.create({
622
+ const ne = te(!1, !0), re = te(!0, !0);
623
+ C.create({
624
624
  name: "characterCount",
625
625
  addOptions() {
626
626
  return {
@@ -641,8 +641,8 @@ P.create({
641
641
  this.storage.characters = (n) => {
642
642
  const e = (n == null ? void 0 : n.node) || this.editor.state.doc;
643
643
  if (((n == null ? void 0 : n.mode) || this.options.mode) === "textSize") {
644
- const o = e.textBetween(0, e.content.size, void 0, " ");
645
- return this.options.textCounter(o);
644
+ const r = e.textBetween(0, e.content.size, void 0, " ");
645
+ return this.options.textCounter(r);
646
646
  }
647
647
  return e.nodeSize;
648
648
  }, this.storage.words = (n) => {
@@ -653,44 +653,44 @@ P.create({
653
653
  addProseMirrorPlugins() {
654
654
  let n = !1;
655
655
  return [
656
- new A({
657
- key: new S("characterCount"),
658
- appendTransaction: (e, t, o) => {
656
+ new x({
657
+ key: new I("characterCount"),
658
+ appendTransaction: (e, t, r) => {
659
659
  if (n)
660
660
  return;
661
- const r = this.options.limit, i = this.options.autoTrim;
662
- if (r == null || r === 0 || i === !1) {
661
+ const o = this.options.limit, i = this.options.autoTrim;
662
+ if (o == null || o === 0 || i === !1) {
663
663
  n = !0;
664
664
  return;
665
665
  }
666
- const s = this.storage.characters({ node: o.doc });
667
- if (s > r) {
668
- const l = s - r, a = 0, c = l;
666
+ const s = this.storage.characters({ node: r.doc });
667
+ if (s > o) {
668
+ const l = s - o, a = 0, d = l;
669
669
  console.warn(
670
- `[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`
670
+ `[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`
671
671
  );
672
- const d = o.tr.deleteRange(a, c);
673
- return n = !0, d;
672
+ const u = r.tr.deleteRange(a, d);
673
+ return n = !0, u;
674
674
  }
675
675
  n = !0;
676
676
  },
677
677
  filterTransaction: (e, t) => {
678
- const o = this.options.limit;
679
- if (!e.docChanged || o === 0 || o === null || o === void 0)
678
+ const r = this.options.limit;
679
+ if (!e.docChanged || r === 0 || r === null || r === void 0)
680
680
  return !0;
681
- const r = this.storage.characters({ node: t.doc }), i = this.storage.characters({ node: e.doc });
682
- if (i <= o || r > o && i > o && i <= r)
681
+ const o = this.storage.characters({ node: t.doc }), i = this.storage.characters({ node: e.doc });
682
+ if (i <= r || o > r && i > r && i <= o)
683
683
  return !0;
684
- if (r > o && i > o && i > r || !e.getMeta("paste"))
684
+ if (o > r && i > r && i > o || !e.getMeta("paste"))
685
685
  return !1;
686
- const l = e.selection.$head.pos, a = i - o, c = l - a, d = l;
687
- return e.deleteRange(c, d), !(this.storage.characters({ node: e.doc }) > o);
686
+ const l = e.selection.$head.pos, a = i - r, d = l - a, u = l;
687
+ return e.deleteRange(d, u), !(this.storage.characters({ node: e.doc }) > r);
688
688
  }
689
689
  })
690
690
  ];
691
691
  }
692
692
  });
693
- P.create({
693
+ C.create({
694
694
  name: "dropCursor",
695
695
  addOptions() {
696
696
  return {
@@ -700,10 +700,10 @@ P.create({
700
700
  };
701
701
  },
702
702
  addProseMirrorPlugins() {
703
- return [ye(this.options)];
703
+ return [Ee(this.options)];
704
704
  }
705
705
  });
706
- P.create({
706
+ C.create({
707
707
  name: "focus",
708
708
  addOptions() {
709
709
  return {
@@ -713,43 +713,43 @@ P.create({
713
713
  },
714
714
  addProseMirrorPlugins() {
715
715
  return [
716
- new A({
717
- key: new S("focus"),
716
+ new x({
717
+ key: new I("focus"),
718
718
  props: {
719
719
  decorations: ({ doc: n, selection: e }) => {
720
- const { isEditable: t, isFocused: o } = this.editor, { anchor: r } = e, i = [];
721
- if (!t || !o)
722
- return O.create(n, []);
720
+ const { isEditable: t, isFocused: r } = this.editor, { anchor: o } = e, i = [];
721
+ if (!t || !r)
722
+ return P.create(n, []);
723
723
  let s = 0;
724
- this.options.mode === "deepest" && n.descendants((a, c) => {
724
+ this.options.mode === "deepest" && n.descendants((a, d) => {
725
725
  if (a.isText)
726
726
  return;
727
- if (!(r >= c && r <= c + a.nodeSize - 1))
727
+ if (!(o >= d && o <= d + a.nodeSize - 1))
728
728
  return !1;
729
729
  s += 1;
730
730
  });
731
731
  let l = 0;
732
- return n.descendants((a, c) => {
733
- if (a.isText || !(r >= c && r <= c + a.nodeSize - 1))
732
+ return n.descendants((a, d) => {
733
+ if (a.isText || !(o >= d && o <= d + a.nodeSize - 1))
734
734
  return !1;
735
735
  if (l += 1, this.options.mode === "deepest" && s - l > 0 || this.options.mode === "shallowest" && l > 1)
736
736
  return this.options.mode === "deepest";
737
737
  i.push(
738
- V.node(c, c + a.nodeSize, {
738
+ L.node(d, d + a.nodeSize, {
739
739
  class: this.options.className
740
740
  })
741
741
  );
742
- }), O.create(n, i);
742
+ }), P.create(n, i);
743
743
  }
744
744
  }
745
745
  })
746
746
  ];
747
747
  }
748
748
  });
749
- P.create({
749
+ C.create({
750
750
  name: "gapCursor",
751
751
  addProseMirrorPlugins() {
752
- return [Ee()];
752
+ return [Ae()];
753
753
  },
754
754
  extendNodeSchema(n) {
755
755
  var e;
@@ -759,221 +759,274 @@ P.create({
759
759
  storage: n.storage
760
760
  };
761
761
  return {
762
- allowGapCursor: (e = ue(pe(n, "allowGapCursor", t))) != null ? e : null
762
+ allowGapCursor: (e = pe(fe(n, "allowGapCursor", t))) != null ? e : null
763
763
  };
764
764
  }
765
765
  });
766
- var se = "placeholder", M = new S("tiptap__placeholder"), G = 200;
767
- function W(n) {
766
+ var oe = "placeholder", G = new I("tiptap__placeholder");
767
+ function ie(n) {
768
768
  const {
769
769
  editor: e,
770
770
  placeholder: t,
771
- dataAttribute: o,
772
- pos: r,
771
+ dataAttribute: r,
772
+ pos: o,
773
773
  node: i,
774
774
  isEmptyDoc: s,
775
775
  hasAnchor: l,
776
- classes: { emptyNode: a, emptyEditor: c }
777
- } = n, d = [a];
778
- return s && d.push(c), V.node(r, r + i.nodeSize, {
779
- class: d.join(" "),
780
- [o]: typeof t == "function" ? t({
776
+ classes: { emptyNode: a, emptyEditor: d }
777
+ } = n, u = [a];
778
+ return s && u.push(d), L.node(o, o + i.nodeSize, {
779
+ class: u.join(" "),
780
+ [r]: typeof t == "function" ? t({
781
781
  editor: e,
782
782
  node: i,
783
- pos: r,
783
+ pos: o,
784
784
  hasAnchor: l
785
785
  }) : t
786
786
  });
787
787
  }
788
- function X(n, e) {
788
+ function se(n, e) {
789
789
  return typeof n == "function" ? n(e) : n;
790
790
  }
791
- function Ve({
791
+ function le({
792
792
  editor: n,
793
793
  options: e,
794
794
  dataAttribute: t,
795
- doc: o,
796
- selection: r
795
+ doc: r,
796
+ selection: o,
797
+ from: i,
798
+ to: s
799
+ }) {
800
+ const { anchor: l } = o, a = [], d = n.isEmpty;
801
+ return r.nodesBetween(i, s, (u, c) => {
802
+ const p = l >= c && l <= c + u.nodeSize, f = !u.isLeaf && X(u);
803
+ return u.type.isTextblock && (p || !e.showOnlyCurrent) && f && a.push(
804
+ ie({
805
+ editor: n,
806
+ isEmptyDoc: d,
807
+ dataAttribute: t,
808
+ hasAnchor: p,
809
+ placeholder: e.placeholder,
810
+ classes: {
811
+ emptyEditor: e.emptyEditorClass,
812
+ emptyNode: se(e.emptyNodeClass, {
813
+ editor: n,
814
+ node: u,
815
+ pos: c,
816
+ hasAnchor: p
817
+ })
818
+ },
819
+ node: u,
820
+ pos: c
821
+ })
822
+ ), e.includeChildren;
823
+ }), a;
824
+ }
825
+ function ae({
826
+ editor: n,
827
+ options: e,
828
+ dataAttribute: t,
829
+ doc: r,
830
+ selection: o
797
831
  }) {
798
- var i, s;
799
832
  if (!(n.isEditable || !e.showOnlyWhenEditable))
800
833
  return null;
801
- const { anchor: a } = r, c = [], d = n.isEmpty;
834
+ const { anchor: s } = o, l = [], a = n.isEmpty;
802
835
  if (e.showOnlyCurrent && !e.includeChildren) {
803
- const p = o.resolve(a), f = p.depth > 0 ? p.node(1) : p.nodeAfter, h = p.depth > 0 ? p.before(1) : a;
804
- if (f && f.type.isTextblock && B(f)) {
805
- const v = a >= h && a <= h + f.nodeSize;
806
- c.push(
807
- W({
836
+ const u = r.resolve(s), c = u.depth > 0 ? u.node(1) : u.nodeAfter, p = u.depth > 0 ? u.before(1) : s;
837
+ if (c && c.type.isTextblock && X(c)) {
838
+ const f = s >= p && s <= p + c.nodeSize;
839
+ l.push(
840
+ ie({
808
841
  editor: n,
809
- isEmptyDoc: d,
842
+ isEmptyDoc: a,
810
843
  dataAttribute: t,
811
- hasAnchor: v,
844
+ hasAnchor: f,
812
845
  placeholder: e.placeholder,
813
846
  classes: {
814
847
  emptyEditor: e.emptyEditorClass,
815
- emptyNode: X(e.emptyNodeClass, {
848
+ emptyNode: se(e.emptyNodeClass, {
816
849
  editor: n,
817
- node: f,
818
- pos: h,
819
- hasAnchor: v
850
+ node: c,
851
+ pos: p,
852
+ hasAnchor: f
820
853
  })
821
854
  },
822
- node: f,
823
- pos: h
855
+ node: c,
856
+ pos: p
824
857
  })
825
858
  );
826
859
  }
827
- } else {
828
- const p = M.getState(n.state), f = (i = p == null ? void 0 : p.topPos) != null ? i : 0, h = (s = p == null ? void 0 : p.bottomPos) != null ? s : o.content.size;
829
- o.nodesBetween(f, h, (v, y) => {
830
- const N = a >= y && a <= y + v.nodeSize, ae = !v.isLeaf && B(v);
831
- return v.type.isTextblock && (N || !e.showOnlyCurrent) && ae && c.push(
832
- W({
833
- editor: n,
834
- isEmptyDoc: d,
835
- dataAttribute: t,
836
- hasAnchor: N,
837
- placeholder: e.placeholder,
838
- classes: {
839
- emptyEditor: e.emptyEditorClass,
840
- emptyNode: X(e.emptyNodeClass, {
841
- editor: n,
842
- node: v,
843
- pos: y,
844
- hasAnchor: N
845
- })
846
- },
847
- node: v,
848
- pos: y
849
- })
850
- ), e.includeChildren;
851
- });
860
+ } else
861
+ l.push(
862
+ ...le({
863
+ editor: n,
864
+ options: e,
865
+ dataAttribute: t,
866
+ doc: r,
867
+ selection: o,
868
+ from: 0,
869
+ to: r.content.size
870
+ })
871
+ );
872
+ return P.create(r, l);
873
+ }
874
+ function A(n, e) {
875
+ var t;
876
+ const r = n.resolve(e);
877
+ if (r.depth === 0) {
878
+ const s = (t = r.nodeAfter) != null ? t : r.nodeBefore;
879
+ if (!s)
880
+ return { from: e, to: e };
881
+ const l = r.nodeAfter ? e : e - s.nodeSize;
882
+ return { from: l, to: l + s.nodeSize };
852
883
  }
853
- return O.create(o, c);
884
+ const o = r.before(1), i = r.node(1);
885
+ return { from: o, to: o + i.nodeSize };
854
886
  }
855
- function Fe(n) {
856
- return n.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
887
+ function T(n, e) {
888
+ return {
889
+ from: Math.max(0, e.from - 1),
890
+ to: Math.min(n.content.size, e.to - 1)
891
+ };
892
+ }
893
+ function Be(n, e, t) {
894
+ const r = [];
895
+ return n.forEach((o, i) => {
896
+ const s = i, l = s + o.nodeSize, a = s + 1, d = l + 1;
897
+ a < t && d > e && r.push({ from: s, to: l });
898
+ }), r;
857
899
  }
858
900
  function _e(n) {
859
- const e = getComputedStyle(n), t = `${e.overflow} ${e.overflowY} ${e.overflowX}`;
860
- return /auto|scroll|overlay/.test(t);
901
+ if (n.length === 0)
902
+ return [];
903
+ const e = [...n].sort((r, o) => r.from - o.from), t = [{ ...e[0] }];
904
+ for (let r = 1; r < e.length; r += 1) {
905
+ const o = t[t.length - 1], i = e[r];
906
+ i.from <= o.to ? o.to = Math.max(o.to, i.to) : t.push({ ...i });
907
+ }
908
+ return t;
861
909
  }
862
- function Be(n) {
863
- let e = n;
864
- for (; e; ) {
865
- if (_e(e))
866
- return e;
867
- const t = e.parentElement;
868
- if (!t) {
869
- const o = e.getRootNode();
870
- if (o instanceof ShadowRoot) {
871
- e = o.host;
872
- continue;
873
- }
874
- return window;
875
- }
876
- e = t;
910
+ function Ke(n, e) {
911
+ const t = Be(n, e.from, e.to);
912
+ return t.push(T(n, A(n, e.from))), e.to > e.from ? t.push(
913
+ T(
914
+ n,
915
+ A(n, Math.min(e.to, n.content.size + 1) - 1)
916
+ )
917
+ ) : e.from < n.content.size + 1 && t.push(
918
+ T(
919
+ n,
920
+ A(n, Math.min(e.from + 1, n.content.size))
921
+ )
922
+ ), t;
923
+ }
924
+ function Ge(n, e, t) {
925
+ const r = [];
926
+ if (n.docChanged) {
927
+ const o = ge(n);
928
+ for (const i of o)
929
+ r.push(...Ke(t.doc, i.newRange));
877
930
  }
878
- return window;
931
+ return n.selectionSet && (r.push(
932
+ T(
933
+ t.doc,
934
+ A(t.doc, n.mapping.map(e.selection.anchor))
935
+ )
936
+ ), r.push(
937
+ T(
938
+ t.doc,
939
+ A(t.doc, t.selection.anchor)
940
+ )
941
+ )), _e(r);
879
942
  }
880
- function Ke(n) {
881
- return n === window ? { top: 0, bottom: window.innerHeight } : n.getBoundingClientRect();
943
+ function He(n, e, t) {
944
+ const r = Math.max(0, Math.min(n, t.content.size)), o = Math.max(r, Math.min(e, t.content.size));
945
+ return { from: r, to: o };
882
946
  }
883
- function He({
884
- view: n,
885
- scrollContainer: e
947
+ function We({
948
+ decorations: n,
949
+ ranges: e,
950
+ editor: t,
951
+ options: r,
952
+ dataAttribute: o,
953
+ doc: i,
954
+ selection: s
886
955
  }) {
887
- const t = n.dom.getBoundingClientRect();
888
- if (t.width <= 0 || t.height <= 0)
889
- return null;
890
- const o = e ? Ke(e) : { top: 0, bottom: window.innerHeight }, r = Math.max(t.top, o.top) - G, i = Math.min(t.bottom, o.bottom) + G;
891
- if (r >= i)
892
- return null;
893
- const s = t.left + 1, l = t.right - 1;
894
- if (s > l)
895
- return null;
896
- const c = getComputedStyle(n.dom).direction === "rtl" ? t.right - 2 : t.left + 2, d = Math.min(Math.max(c, s), l), u = Math.max(r + 2, t.top + 1), p = Math.min(i - 2, t.bottom - 1);
897
- if (u > p)
898
- return null;
899
- const f = n.posAtCoords({ left: d, top: u }), h = n.posAtCoords({ left: d, top: p });
900
- return !f || !h ? null : { top: f.pos, bottom: h.pos };
901
- }
902
- var Ge = {
903
- /**
904
- * Initialises the viewport state with no known positions.
905
- * @returns The initial viewport state.
906
- */
907
- init() {
908
- return { topPos: null, bottomPos: null };
909
- },
910
- /**
911
- * Updates the viewport state from incoming transactions.
912
- * @param tr - The transaction being applied.
913
- * @param prev - The previous viewport state.
914
- * @returns The next viewport state.
915
- */
916
- apply(n, e) {
917
- const t = n.getMeta(M);
918
- return t != null && t.positions ? { topPos: t.positions.top, bottomPos: t.positions.bottom } : n.docChanged ? {
919
- topPos: e.topPos !== null ? n.mapping.map(e.topPos) : null,
920
- bottomPos: e.bottomPos !== null ? n.mapping.map(e.bottomPos) : null
921
- } : e;
922
- }
923
- };
924
- function We(n) {
925
- const e = Be(n.dom), t = () => {
926
- const c = He({
927
- view: n,
928
- scrollContainer: e
956
+ let l = n;
957
+ for (const a of e) {
958
+ const { from: d, to: u } = He(a.from, a.to, i), c = l.find(d, u).filter((f) => f.from >= d && f.to <= u);
959
+ c.length && (l = l.remove(c));
960
+ const p = le({
961
+ editor: t,
962
+ options: r,
963
+ dataAttribute: o,
964
+ doc: i,
965
+ selection: s,
966
+ from: d,
967
+ to: u
929
968
  });
930
- if (c === null)
931
- return;
932
- const d = M.getState(n.state);
933
- if ((d == null ? void 0 : d.topPos) === c.top && (d == null ? void 0 : d.bottomPos) === c.bottom)
934
- return;
935
- const u = n.state.tr.setMeta(M, { positions: c });
936
- n.dispatch(u);
937
- };
938
- let o = null, r = 0;
939
- const i = 150, s = () => {
940
- o === null && (o = requestAnimationFrame(() => {
941
- o = null;
942
- const c = performance.now();
943
- c - r >= i ? (r = c, t()) : s();
944
- }));
945
- };
946
- e.addEventListener("scroll", s, { passive: !0 });
947
- const l = typeof ResizeObserver < "u" ? new ResizeObserver(s) : null;
948
- l == null || l.observe(n.dom);
949
- const a = typeof IntersectionObserver < "u" ? new IntersectionObserver(s) : null;
950
- return a == null || a.observe(n.dom), n.dom.addEventListener("focus", s), t(), {
951
- update(c, d) {
952
- n.state.doc.content.size !== d.doc.content.size && s();
969
+ p.length && (l = l.add(i, p));
970
+ }
971
+ return l;
972
+ }
973
+ function je({
974
+ editor: n,
975
+ options: e,
976
+ dataAttribute: t
977
+ }) {
978
+ return {
979
+ init(r, o) {
980
+ const i = ae({
981
+ editor: n,
982
+ options: e,
983
+ dataAttribute: t,
984
+ doc: o.doc,
985
+ selection: o.selection
986
+ });
987
+ return i ?? P.empty;
953
988
  },
954
- destroy: () => {
955
- o !== null && cancelAnimationFrame(o), e.removeEventListener("scroll", s), l == null || l.disconnect(), a == null || a.disconnect(), n.dom.removeEventListener("focus", s);
989
+ apply(r, o, i, s) {
990
+ if (!r.docChanged && !r.selectionSet)
991
+ return o;
992
+ const l = o.map(r.mapping, r.doc), a = Ge(r, i, s);
993
+ return We({
994
+ decorations: l,
995
+ ranges: a,
996
+ editor: n,
997
+ options: e,
998
+ dataAttribute: t,
999
+ doc: s.doc,
1000
+ selection: s.selection
1001
+ });
956
1002
  }
957
1003
  };
958
1004
  }
959
- function Xe({ editor: n, options: e }) {
960
- const t = e.dataAttribute ? `data-${Fe(e.dataAttribute)}` : `data-${se}`;
961
- return new A({
962
- key: M,
963
- state: Ge,
964
- view: We,
1005
+ function Ue(n) {
1006
+ return n.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
1007
+ }
1008
+ function Ye({ editor: n, options: e }) {
1009
+ const t = e.dataAttribute ? `data-${Ue(e.dataAttribute)}` : `data-${oe}`, r = e.showOnlyCurrent && !e.includeChildren;
1010
+ return new x({
1011
+ key: G,
1012
+ ...r ? {} : {
1013
+ state: je({ editor: n, options: e, dataAttribute: t })
1014
+ },
965
1015
  props: {
966
- decorations: ({ doc: o, selection: r }) => Ve({ editor: n, options: e, dataAttribute: t, doc: o, selection: r })
1016
+ decorations: r ? ({ doc: o, selection: i }) => ae({ editor: n, options: e, dataAttribute: t, doc: o, selection: i }) : (o) => {
1017
+ var i;
1018
+ return e.showOnlyWhenEditable && !n.isEditable ? P.empty : (i = G.getState(o)) != null ? i : P.empty;
1019
+ }
967
1020
  }
968
1021
  });
969
1022
  }
970
- P.create({
1023
+ C.create({
971
1024
  name: "placeholder",
972
1025
  addOptions() {
973
1026
  return {
974
1027
  emptyEditorClass: "is-editor-empty",
975
1028
  emptyNodeClass: "is-empty",
976
- dataAttribute: se,
1029
+ dataAttribute: oe,
977
1030
  placeholder: "Write something …",
978
1031
  showOnlyWhenEditable: !0,
979
1032
  showOnlyCurrent: !0,
@@ -981,17 +1034,17 @@ P.create({
981
1034
  };
982
1035
  },
983
1036
  addProseMirrorPlugins() {
984
- return [Xe({ editor: this.editor, options: this.options })];
1037
+ return [Ye({ editor: this.editor, options: this.options })];
985
1038
  }
986
1039
  });
987
- var je = `.ProseMirror:not(.ProseMirror-focused) *::selection {
1040
+ var Xe = `.ProseMirror:not(.ProseMirror-focused) *::selection {
988
1041
  background: transparent;
989
1042
  }
990
1043
 
991
1044
  .ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
992
1045
  background: transparent;
993
1046
  }`;
994
- P.create({
1047
+ C.create({
995
1048
  name: "selection",
996
1049
  addOptions() {
997
1050
  return {
@@ -1000,13 +1053,13 @@ P.create({
1000
1053
  },
1001
1054
  addProseMirrorPlugins() {
1002
1055
  const { editor: n, options: e } = this;
1003
- return n.options.injectCSS && typeof document < "u" && fe(je, n.options.injectNonce, "selection"), [
1004
- new A({
1005
- key: new S("selection"),
1056
+ return n.options.injectCSS && typeof document < "u" && he(Xe, n.options.injectNonce, "selection"), [
1057
+ new x({
1058
+ key: new I("selection"),
1006
1059
  props: {
1007
1060
  decorations(t) {
1008
- return t.selection.empty || n.isFocused || !n.isEditable || he(t.selection) || n.view.dragging ? null : O.create(t.doc, [
1009
- V.inline(t.selection.from, t.selection.to, {
1061
+ return t.selection.empty || n.isFocused || !n.isEditable || me(t.selection) || n.view.dragging ? null : P.create(t.doc, [
1062
+ L.inline(t.selection.from, t.selection.to, {
1010
1063
  class: e.className
1011
1064
  })
1012
1065
  ]);
@@ -1016,14 +1069,14 @@ P.create({
1016
1069
  ];
1017
1070
  }
1018
1071
  });
1019
- var Ue = "skipTrailingNode";
1020
- function j({
1072
+ var Ze = "skipTrailingNode";
1073
+ function H({
1021
1074
  types: n,
1022
1075
  node: e
1023
1076
  }) {
1024
1077
  return e && Array.isArray(n) && n.includes(e.type) || (e == null ? void 0 : e.type) === n;
1025
1078
  }
1026
- P.create({
1079
+ C.create({
1027
1080
  name: "trailingNode",
1028
1081
  addOptions() {
1029
1082
  return {
@@ -1033,32 +1086,32 @@ P.create({
1033
1086
  },
1034
1087
  addProseMirrorPlugins() {
1035
1088
  var n;
1036
- const e = new S(this.name), t = this.options.node || ((n = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : n.name) || "paragraph", o = Object.entries(this.editor.schema.nodes).map(([, r]) => r).filter((r) => (this.options.notAfter || []).concat(t).includes(r.name));
1089
+ const e = new I(this.name), t = this.options.node || ((n = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : n.name) || "paragraph", r = Object.entries(this.editor.schema.nodes).map(([, o]) => o).filter((o) => (this.options.notAfter || []).concat(t).includes(o.name));
1037
1090
  return [
1038
- new A({
1091
+ new x({
1039
1092
  key: e,
1040
- appendTransaction: (r, i, s) => {
1041
- const { doc: l, tr: a, schema: c } = s, d = e.getState(s), u = l.content.size, p = c.nodes[t];
1042
- if (!r.some((f) => f.getMeta(Ue)) && d)
1043
- return a.insert(u, p.create());
1093
+ appendTransaction: (o, i, s) => {
1094
+ const { doc: l, tr: a, schema: d } = s, u = e.getState(s), c = l.content.size, p = d.nodes[t];
1095
+ if (!o.some((f) => f.getMeta(Ze)) && u)
1096
+ return a.insert(c, p.create());
1044
1097
  },
1045
1098
  state: {
1046
- init: (r, i) => {
1099
+ init: (o, i) => {
1047
1100
  const s = i.tr.doc.lastChild;
1048
- return !j({ node: s, types: o });
1101
+ return !H({ node: s, types: r });
1049
1102
  },
1050
- apply: (r, i) => {
1051
- if (!r.docChanged || r.getMeta("__uniqueIDTransaction"))
1103
+ apply: (o, i) => {
1104
+ if (!o.docChanged || o.getMeta("__uniqueIDTransaction"))
1052
1105
  return i;
1053
- const s = r.doc.lastChild;
1054
- return !j({ node: s, types: o });
1106
+ const s = o.doc.lastChild;
1107
+ return !H({ node: s, types: r });
1055
1108
  }
1056
1109
  }
1057
1110
  })
1058
1111
  ];
1059
1112
  }
1060
1113
  });
1061
- var Ye = P.create({
1114
+ var Je = C.create({
1062
1115
  name: "undoRedo",
1063
1116
  addOptions() {
1064
1117
  return {
@@ -1068,12 +1121,12 @@ var Ye = P.create({
1068
1121
  },
1069
1122
  addCommands() {
1070
1123
  return {
1071
- undo: () => ({ state: n, dispatch: e }) => re(n, e),
1072
- redo: () => ({ state: n, dispatch: e }) => ie(n, e)
1124
+ undo: () => ({ state: n, dispatch: e }) => ne(n, e),
1125
+ redo: () => ({ state: n, dispatch: e }) => re(n, e)
1073
1126
  };
1074
1127
  },
1075
1128
  addProseMirrorPlugins() {
1076
- return [Le(this.options)];
1129
+ return [Ve(this.options)];
1077
1130
  },
1078
1131
  addKeyboardShortcuts() {
1079
1132
  return {
@@ -1086,55 +1139,55 @@ var Ye = P.create({
1086
1139
  };
1087
1140
  }
1088
1141
  });
1089
- function ot() {
1090
- var d;
1091
- const n = $(le.name), {
1142
+ function it() {
1143
+ var u;
1144
+ const n = J(ce.name), {
1092
1145
  icon: e = void 0,
1093
1146
  tooltip: t = void 0,
1094
- shortcutKeys: o = void 0,
1095
- tooltipOptions: r = {},
1147
+ shortcutKeys: r = void 0,
1148
+ tooltipOptions: o = {},
1096
1149
  action: i = void 0,
1097
1150
  isActive: s = void 0
1098
- } = ((d = n == null ? void 0 : n.componentProps) == null ? void 0 : d.undo) ?? {}, { disabled: l } = q(s), a = we[e], c = () => {
1151
+ } = ((u = n == null ? void 0 : n.componentProps) == null ? void 0 : u.undo) ?? {}, { disabled: l } = Q(s), a = Ce[e], d = () => {
1099
1152
  l || i && i();
1100
1153
  };
1101
- return !n || !a ? /* @__PURE__ */ R(Q, {}) : /* @__PURE__ */ R(
1102
- ee,
1154
+ return !n || !a ? /* @__PURE__ */ z(Z, {}) : /* @__PURE__ */ z(
1155
+ $,
1103
1156
  {
1104
- action: c,
1157
+ action: d,
1105
1158
  disabled: l,
1106
1159
  icon: e,
1107
- shortcutKeys: o,
1160
+ shortcutKeys: r,
1108
1161
  tooltip: t,
1109
- tooltipOptions: r
1162
+ tooltipOptions: o
1110
1163
  }
1111
1164
  );
1112
1165
  }
1113
- function rt() {
1114
- var c;
1115
- const n = $(le.name), {
1166
+ function st() {
1167
+ var d;
1168
+ const n = J(ce.name), {
1116
1169
  icon: e = void 0,
1117
1170
  tooltip: t = void 0,
1118
- shortcutKeys: o = void 0,
1119
- tooltipOptions: r = {},
1171
+ shortcutKeys: r = void 0,
1172
+ tooltipOptions: o = {},
1120
1173
  action: i = void 0,
1121
1174
  isActive: s = void 0
1122
- } = ((c = n == null ? void 0 : n.componentProps) == null ? void 0 : c.redo) ?? {}, { disabled: l } = q(s), a = () => {
1175
+ } = ((d = n == null ? void 0 : n.componentProps) == null ? void 0 : d.redo) ?? {}, { disabled: l } = Q(s), a = () => {
1123
1176
  l || i && i();
1124
1177
  };
1125
- return n ? /* @__PURE__ */ R(
1126
- ee,
1178
+ return n ? /* @__PURE__ */ z(
1179
+ $,
1127
1180
  {
1128
1181
  action: a,
1129
1182
  disabled: l,
1130
1183
  icon: e,
1131
- shortcutKeys: o,
1184
+ shortcutKeys: r,
1132
1185
  tooltip: t,
1133
- tooltipOptions: r
1186
+ tooltipOptions: o
1134
1187
  }
1135
- ) : /* @__PURE__ */ R(Q, {});
1188
+ ) : /* @__PURE__ */ z(Z, {});
1136
1189
  }
1137
- const le = /* @__PURE__ */ Ye.extend({
1190
+ const ce = /* @__PURE__ */ Je.extend({
1138
1191
  //@ts-expect-error
1139
1192
  addOptions() {
1140
1193
  var n;
@@ -1142,15 +1195,15 @@ const le = /* @__PURE__ */ Ye.extend({
1142
1195
  ...(n = this.parent) == null ? void 0 : n.call(this),
1143
1196
  depth: 100,
1144
1197
  newGroupDelay: 500,
1145
- button: ({ editor: e, t, extension: o }) => {
1146
- var r, i;
1198
+ button: ({ editor: e, t, extension: r }) => {
1199
+ var o, i;
1147
1200
  return {
1148
1201
  componentProps: {
1149
1202
  undo: {
1150
1203
  action: () => {
1151
1204
  e.chain().focus().undo().run();
1152
1205
  },
1153
- shortcutKeys: ((r = o.options.shortcutKeys) == null ? void 0 : r[0]) ?? ["mod", "Z"],
1206
+ shortcutKeys: ((o = r.options.shortcutKeys) == null ? void 0 : o[0]) ?? ["mod", "Z"],
1154
1207
  isActive: () => e.can().undo(),
1155
1208
  icon: "Undo2",
1156
1209
  tooltip: t("editor.undo.tooltip")
@@ -1159,7 +1212,7 @@ const le = /* @__PURE__ */ Ye.extend({
1159
1212
  action: () => {
1160
1213
  e.chain().focus().redo().run();
1161
1214
  },
1162
- shortcutKeys: ((i = o.options.shortcutKeys) == null ? void 0 : i[1]) ?? ["shift", "mod", "Z"],
1215
+ shortcutKeys: ((i = r.options.shortcutKeys) == null ? void 0 : i[1]) ?? ["shift", "mod", "Z"],
1163
1216
  isActive: () => e.can().redo(),
1164
1217
  icon: "Redo2",
1165
1218
  tooltip: t("editor.redo.tooltip")
@@ -1171,7 +1224,7 @@ const le = /* @__PURE__ */ Ye.extend({
1171
1224
  }
1172
1225
  });
1173
1226
  export {
1174
- le as History,
1175
- rt as RichTextRedo,
1176
- ot as RichTextUndo
1227
+ ce as History,
1228
+ st as RichTextRedo,
1229
+ it as RichTextUndo
1177
1230
  };