reactjs-tiptap-editor 0.3.31 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/README.md +8 -2
  2. package/lib/{ActionMenuButton-BCgqJsST.cjs → ActionMenuButton-CYdM1xx5.cjs} +1 -1
  3. package/lib/{ActionMenuButton-D97K0UWT.js → ActionMenuButton-DKRF6oa0.js} +1 -1
  4. package/lib/Attachment.cjs +2 -2
  5. package/lib/Attachment.d.cts +39 -43
  6. package/lib/Attachment.d.ts +39 -43
  7. package/lib/Attachment.js +7 -6
  8. package/lib/BaseKit.cjs +3 -0
  9. package/lib/BaseKit.d.cts +481 -0
  10. package/lib/BaseKit.d.ts +481 -0
  11. package/lib/BaseKit.js +132 -0
  12. package/lib/Blockquote.cjs +5 -1
  13. package/lib/Blockquote.d.cts +39 -43
  14. package/lib/Blockquote.d.ts +39 -43
  15. package/lib/Blockquote.js +33 -17
  16. package/lib/Bold.cjs +1 -1
  17. package/lib/Bold.d.cts +39 -43
  18. package/lib/Bold.d.ts +39 -43
  19. package/lib/Bold.js +23 -16
  20. package/lib/BulletList.cjs +1 -1
  21. package/lib/BulletList.d.cts +40 -44
  22. package/lib/BulletList.d.ts +40 -44
  23. package/lib/BulletList.js +11 -57
  24. package/lib/Clear.cjs +1 -1
  25. package/lib/Clear.d.cts +39 -43
  26. package/lib/Clear.d.ts +39 -43
  27. package/lib/Clear.js +4 -2
  28. package/lib/Code.cjs +1 -1
  29. package/lib/Code.d.cts +39 -43
  30. package/lib/Code.d.ts +39 -43
  31. package/lib/Code.js +29 -25
  32. package/lib/CodeBlock.cjs +2 -2
  33. package/lib/CodeBlock.d.cts +39 -43
  34. package/lib/CodeBlock.d.ts +39 -43
  35. package/lib/CodeBlock.js +3 -3
  36. package/lib/CodeView.cjs +1 -1
  37. package/lib/CodeView.d.cts +39 -43
  38. package/lib/CodeView.d.ts +39 -43
  39. package/lib/CodeView.js +3 -2
  40. package/lib/Color.cjs +1 -1
  41. package/lib/Color.d.cts +40 -44
  42. package/lib/Color.d.ts +40 -44
  43. package/lib/Color.js +42 -74
  44. package/lib/Document.cjs +1 -1
  45. package/lib/Document.d.cts +39 -43
  46. package/lib/Document.d.ts +39 -43
  47. package/lib/Document.js +4 -8
  48. package/lib/{Drawer-BHkje8ys.js → Drawer-CaAfmqNo.js} +37 -35
  49. package/lib/{Drawer-5Q_-WRhc.cjs → Drawer-CdvCMSzN.cjs} +1 -1
  50. package/lib/Drawer.cjs +1 -1
  51. package/lib/Drawer.d.cts +39 -43
  52. package/lib/Drawer.d.ts +39 -43
  53. package/lib/Drawer.js +4 -4
  54. package/lib/Emoji.cjs +1 -1
  55. package/lib/Emoji.d.cts +42 -44
  56. package/lib/Emoji.d.ts +42 -44
  57. package/lib/Emoji.js +19793 -182
  58. package/lib/{Excalidraw-GUVW-IqC.cjs → Excalidraw-BbMQhNvs.cjs} +1 -1
  59. package/lib/{Excalidraw-CG498239.js → Excalidraw-CVWz2Vyn.js} +20 -20
  60. package/lib/Excalidraw.cjs +1 -1
  61. package/lib/Excalidraw.d.cts +39 -43
  62. package/lib/Excalidraw.d.ts +39 -43
  63. package/lib/Excalidraw.js +3 -3
  64. package/lib/ExportPdf.cjs +1 -1
  65. package/lib/ExportPdf.d.cts +39 -43
  66. package/lib/ExportPdf.d.ts +39 -43
  67. package/lib/ExportPdf.js +4 -2
  68. package/lib/ExportWord.cjs +1 -1
  69. package/lib/ExportWord.d.cts +39 -43
  70. package/lib/ExportWord.d.ts +39 -43
  71. package/lib/ExportWord.js +22 -51
  72. package/lib/FontFamily.cjs +1 -1
  73. package/lib/FontFamily.d.cts +40 -44
  74. package/lib/FontFamily.d.ts +40 -44
  75. package/lib/FontFamily.js +44 -73
  76. package/lib/FontSize.cjs +1 -1
  77. package/lib/FontSize.d.cts +39 -43
  78. package/lib/FontSize.d.ts +39 -43
  79. package/lib/FontSize.js +7 -5
  80. package/lib/FormatPainter.cjs +1 -1
  81. package/lib/FormatPainter.d.cts +39 -43
  82. package/lib/FormatPainter.d.ts +39 -43
  83. package/lib/FormatPainter.js +4 -2
  84. package/lib/Heading.cjs +1 -1
  85. package/lib/Heading.d.cts +39 -43
  86. package/lib/Heading.d.ts +39 -43
  87. package/lib/Heading.js +71 -60
  88. package/lib/Highlight.cjs +1 -1
  89. package/lib/Highlight.d.cts +39 -43
  90. package/lib/Highlight.d.ts +39 -43
  91. package/lib/Highlight.js +5 -4
  92. package/lib/History.cjs +1 -1
  93. package/lib/History.d.cts +41 -45
  94. package/lib/History.d.ts +41 -45
  95. package/lib/History.js +39 -403
  96. package/lib/HorizontalRule.cjs +1 -1
  97. package/lib/HorizontalRule.d.cts +39 -43
  98. package/lib/HorizontalRule.d.ts +39 -43
  99. package/lib/HorizontalRule.js +16 -65
  100. package/lib/Iframe.cjs +1 -1
  101. package/lib/Iframe.d.cts +39 -43
  102. package/lib/Iframe.d.ts +39 -43
  103. package/lib/Iframe.js +4 -4
  104. package/lib/Image.cjs +1 -1
  105. package/lib/Image.d.cts +39 -43
  106. package/lib/Image.d.ts +39 -43
  107. package/lib/Image.js +3 -3
  108. package/lib/ImageGif.cjs +1 -1
  109. package/lib/ImageGif.d.cts +39 -43
  110. package/lib/ImageGif.d.ts +39 -43
  111. package/lib/ImageGif.js +5 -5
  112. package/lib/ImportWord.cjs +72 -72
  113. package/lib/ImportWord.d.cts +39 -43
  114. package/lib/ImportWord.d.ts +39 -43
  115. package/lib/ImportWord.js +5652 -5615
  116. package/lib/Indent.cjs +1 -1
  117. package/lib/Indent.d.cts +39 -43
  118. package/lib/Indent.d.ts +39 -43
  119. package/lib/Indent.js +4 -2
  120. package/lib/Italic.cjs +1 -1
  121. package/lib/Italic.d.cts +39 -43
  122. package/lib/Italic.d.ts +39 -43
  123. package/lib/Italic.js +20 -14
  124. package/lib/Katex.cjs +1 -1
  125. package/lib/Katex.d.cts +39 -43
  126. package/lib/Katex.d.ts +39 -43
  127. package/lib/Katex.js +12 -12
  128. package/lib/LineHeight.cjs +1 -1
  129. package/lib/LineHeight.d.cts +39 -43
  130. package/lib/LineHeight.d.ts +39 -43
  131. package/lib/LineHeight.js +5 -3
  132. package/lib/Link.cjs +1 -1
  133. package/lib/Link.d.cts +39 -43
  134. package/lib/Link.d.ts +39 -43
  135. package/lib/Link.js +4 -4
  136. package/lib/ListItem.cjs +1 -1
  137. package/lib/ListItem.d.cts +44 -44
  138. package/lib/ListItem.d.ts +44 -44
  139. package/lib/ListItem.js +4 -30
  140. package/lib/Mention.cjs +1 -1
  141. package/lib/Mention.d.cts +39 -43
  142. package/lib/Mention.d.ts +39 -43
  143. package/lib/Mention.js +161 -132
  144. package/lib/Mermaid.cjs +2 -2
  145. package/lib/Mermaid.d.cts +39 -43
  146. package/lib/Mermaid.d.ts +39 -43
  147. package/lib/Mermaid.js +50 -48
  148. package/lib/MoreMark.cjs +1 -1
  149. package/lib/MoreMark.d.cts +39 -43
  150. package/lib/MoreMark.d.ts +39 -43
  151. package/lib/MoreMark.js +5 -3
  152. package/lib/MultiColumn.cjs +1 -1
  153. package/lib/MultiColumn.d.cts +39 -43
  154. package/lib/MultiColumn.d.ts +39 -43
  155. package/lib/MultiColumn.js +2 -2
  156. package/lib/OrderedList.cjs +1 -1
  157. package/lib/OrderedList.d.cts +40 -44
  158. package/lib/OrderedList.d.ts +40 -44
  159. package/lib/OrderedList.js +11 -75
  160. package/lib/RichTextEditor-CxvwGvQG.cjs +142 -0
  161. package/lib/RichTextEditor-DGcKEUGr.js +22166 -0
  162. package/lib/SearchAndReplace.cjs +1 -1
  163. package/lib/SearchAndReplace.d.cts +52 -126
  164. package/lib/SearchAndReplace.d.ts +52 -126
  165. package/lib/SearchAndReplace.js +204 -192
  166. package/lib/Selection.cjs +1 -1
  167. package/lib/Selection.d.cts +39 -43
  168. package/lib/Selection.d.ts +39 -43
  169. package/lib/Selection.js +1 -1
  170. package/lib/SlashCommand.cjs +1 -1
  171. package/lib/SlashCommand.d.cts +39 -43
  172. package/lib/SlashCommand.d.ts +39 -43
  173. package/lib/SlashCommand.js +177 -222
  174. package/lib/Strike.cjs +1 -1
  175. package/lib/Strike.d.cts +39 -43
  176. package/lib/Strike.d.ts +39 -43
  177. package/lib/Strike.js +20 -14
  178. package/lib/SubAndSuperScript.cjs +1 -1
  179. package/lib/SubAndSuperScript.d.cts +39 -43
  180. package/lib/SubAndSuperScript.d.ts +39 -43
  181. package/lib/SubAndSuperScript.js +5 -3
  182. package/lib/Table.cjs +8 -10
  183. package/lib/Table.d.cts +42 -46
  184. package/lib/Table.d.ts +42 -46
  185. package/lib/Table.js +382 -2022
  186. package/lib/TableOfContent.cjs +1 -1
  187. package/lib/TableOfContent.d.cts +39 -43
  188. package/lib/TableOfContent.d.ts +39 -43
  189. package/lib/TableOfContent.js +5 -5
  190. package/lib/TaskList.cjs +1 -1
  191. package/lib/TaskList.d.cts +41 -45
  192. package/lib/TaskList.d.ts +41 -45
  193. package/lib/TaskList.js +12 -154
  194. package/lib/TextAlign.cjs +1 -1
  195. package/lib/TextAlign.d.cts +39 -43
  196. package/lib/TextAlign.d.ts +39 -43
  197. package/lib/TextAlign.js +11 -9
  198. package/lib/TextBubble.cjs +1 -1
  199. package/lib/TextBubble.d.cts +39 -43
  200. package/lib/TextBubble.d.ts +39 -43
  201. package/lib/TextBubble.js +5 -3
  202. package/lib/TextDirection.cjs +1 -1
  203. package/lib/TextDirection.d.cts +39 -43
  204. package/lib/TextDirection.d.ts +39 -43
  205. package/lib/TextDirection.js +2 -3
  206. package/lib/TextUnderline.cjs +1 -1
  207. package/lib/TextUnderline.d.cts +39 -43
  208. package/lib/TextUnderline.d.ts +39 -43
  209. package/lib/TextUnderline.js +40 -12
  210. package/lib/TrailingNode.cjs +1 -1
  211. package/lib/TrailingNode.d.cts +39 -43
  212. package/lib/TrailingNode.d.ts +39 -43
  213. package/lib/TrailingNode.js +1 -1
  214. package/lib/Twitter-BFULyqdR.js +1628 -0
  215. package/lib/Twitter-Cutpkh3h.cjs +1 -0
  216. package/lib/Twitter.cjs +1 -1
  217. package/lib/Twitter.d.cts +39 -43
  218. package/lib/Twitter.d.ts +39 -43
  219. package/lib/Twitter.js +3 -3
  220. package/lib/Video.cjs +1 -1
  221. package/lib/Video.d.cts +39 -43
  222. package/lib/Video.d.ts +39 -43
  223. package/lib/Video.js +3 -3
  224. package/lib/bubble-extra.cjs +2 -2
  225. package/lib/bubble-extra.d.cts +39 -43
  226. package/lib/bubble-extra.d.ts +39 -43
  227. package/lib/bubble-extra.js +200 -192
  228. package/lib/dom-dataset-_6-diIRQ.cjs +33 -0
  229. package/lib/dom-dataset-lYeH6gfI.js +2361 -0
  230. package/lib/index-5iBZLua9.cjs +12 -0
  231. package/lib/index-6D1J-A-o.cjs +1 -0
  232. package/lib/index-B96Cclrj.cjs +3 -0
  233. package/lib/index-BBz7Nmv9.js +55 -0
  234. package/lib/index-BeCTd5v2.cjs +1 -0
  235. package/lib/index-ByurDDMv.js +237 -0
  236. package/lib/index-CUogRI7j.cjs +1 -0
  237. package/lib/index-Ch6dBBad.js +709 -0
  238. package/lib/index-DF2Lp4HZ.cjs +100 -0
  239. package/lib/{index-LUL9mqY4.js → index-D_L6n8O8.js} +4 -4
  240. package/lib/index-Dbvi-Bvh.cjs +1 -0
  241. package/lib/index-DpCrt7xs.cjs +1 -0
  242. package/lib/index-DsAX1Vq8.cjs +1 -0
  243. package/lib/index-Dy4DlW9o.js +12 -0
  244. package/lib/index-J3jHHZ4d.js +200 -0
  245. package/lib/{index-CsK90iVd.js → index-LmrOdnen.js} +302 -389
  246. package/lib/index-VvXaaKe3.js +898 -0
  247. package/lib/index-kbO3iWqL.js +13432 -0
  248. package/lib/index.cjs +1 -2
  249. package/lib/index.d.cts +40 -243
  250. package/lib/index.d.ts +40 -243
  251. package/lib/index.js +2 -588
  252. package/lib/jsx-runtime-CT7Pcg-t.js +13 -0
  253. package/lib/jsx-runtime-C_NLcKys.cjs +1 -0
  254. package/lib/locale-bundle.cjs +1 -1
  255. package/lib/locale-bundle.d.cts +39 -43
  256. package/lib/locale-bundle.d.ts +39 -43
  257. package/lib/locale-bundle.js +1 -1
  258. package/lib/style.css +1 -1
  259. package/lib/{textarea-DdH64g04.cjs → textarea-DFo_aXnj.cjs} +1 -1
  260. package/lib/{textarea-CktfkXNe.js → textarea-aPtytkDx.js} +1 -1
  261. package/package.json +76 -70
  262. package/lib/RichTextEditor-DWlLqTl9.cjs +0 -140
  263. package/lib/RichTextEditor-KP2Rgcqe.js +0 -12751
  264. package/lib/Twitter-99ivY5qv.js +0 -1744
  265. package/lib/Twitter-BvfvUtNT.cjs +0 -17
  266. package/lib/dom-dataset-Byuf1YmW.cjs +0 -33
  267. package/lib/dom-dataset-Di3tIRrR.js +0 -1031
  268. package/lib/index-BI-IcZcN.cjs +0 -1
  269. package/lib/index-ByRfqzMr.cjs +0 -89
  270. package/lib/index-C1fzuXpN.js +0 -46
  271. package/lib/index-CbQQFj2T.js +0 -133
  272. package/lib/index-DI9T3iLd.js +0 -12354
  273. package/lib/index-D_A0TBRA.cjs +0 -1
  274. package/lib/index-DclQSrIx.cjs +0 -1
  275. package/lib/index-Z4b9rzn-.cjs +0 -1
package/lib/index.js CHANGED
@@ -1,590 +1,4 @@
1
- import { useRef as O, useState as S, useEffect as B } from "react";
2
- import { a6 as z, a7 as N } from "./RichTextEditor-KP2Rgcqe.js";
3
- import { a8 as ve } from "./RichTextEditor-KP2Rgcqe.js";
4
- import { B as ke } from "./dom-dataset-Di3tIRrR.js";
5
- import { E as f, P as p, a as w, s as L, D as C, b, u as R, F as k, S as P, T as M, g as T, v as y, x as D, y as V, N as x, m as A, z as H } from "./index-DI9T3iLd.js";
6
- import { ListItem as F } from "./ListItem.js";
7
- import { T as I } from "./index-C1fzuXpN.js";
8
- import { Document as K } from "./Document.js";
9
- import { Selection as W } from "./Selection.js";
10
- import { TextBubble as G } from "./TextBubble.js";
11
- import { TrailingNode as J } from "./TrailingNode.js";
12
- import { n as m } from "./index-CsK90iVd.js";
13
- function ye() {
14
- var l;
15
- const t = O({ editor: null }), [e, o] = S(!1), [s, r] = S(null);
16
- return B(() => {
17
- var i;
18
- (i = t.current) != null && i.editor && (o(!0), r(t.current.editor));
19
- }, [t, (l = t.current) == null ? void 0 : l.editor]), { isReady: e, editor: s, editorRef: t };
20
- }
21
- const X = f.create({
22
- name: "characterCount",
23
- addOptions() {
24
- return {
25
- limit: null,
26
- mode: "textSize",
27
- textCounter: (t) => t.length,
28
- wordCounter: (t) => t.split(" ").filter((e) => e !== "").length
29
- };
30
- },
31
- addStorage() {
32
- return {
33
- characters: () => 0,
34
- words: () => 0
35
- };
36
- },
37
- onBeforeCreate() {
38
- this.storage.characters = (t) => {
39
- const e = (t == null ? void 0 : t.node) || this.editor.state.doc;
40
- if (((t == null ? void 0 : t.mode) || this.options.mode) === "textSize") {
41
- const s = e.textBetween(0, e.content.size, void 0, " ");
42
- return this.options.textCounter(s);
43
- }
44
- return e.nodeSize;
45
- }, this.storage.words = (t) => {
46
- const e = (t == null ? void 0 : t.node) || this.editor.state.doc, o = e.textBetween(0, e.content.size, " ", " ");
47
- return this.options.wordCounter(o);
48
- };
49
- },
50
- addProseMirrorPlugins() {
51
- let t = !1;
52
- return [
53
- new p({
54
- key: new w("characterCount"),
55
- appendTransaction: (e, o, s) => {
56
- if (t)
57
- return;
58
- const r = this.options.limit;
59
- if (r == null || r === 0) {
60
- t = !0;
61
- return;
62
- }
63
- const l = this.storage.characters({ node: s.doc });
64
- if (l > r) {
65
- const i = l - r, n = 0, a = i;
66
- console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);
67
- const c = s.tr.deleteRange(n, a);
68
- return t = !0, c;
69
- }
70
- t = !0;
71
- },
72
- filterTransaction: (e, o) => {
73
- const s = this.options.limit;
74
- if (!e.docChanged || s === 0 || s === null || s === void 0)
75
- return !0;
76
- const r = this.storage.characters({ node: o.doc }), l = this.storage.characters({ node: e.doc });
77
- if (l <= s || r > s && l > s && l <= r)
78
- return !0;
79
- if (r > s && l > s && l > r || !e.getMeta("paste"))
80
- return !1;
81
- const n = e.selection.$head.pos, a = l - s, c = n - a, d = n;
82
- return e.deleteRange(c, d), !(this.storage.characters({ node: e.doc }) > s);
83
- }
84
- })
85
- ];
86
- }
87
- });
88
- function Y(t = {}) {
89
- return new p({
90
- view(e) {
91
- return new j(e, t);
92
- }
93
- });
94
- }
95
- class j {
96
- constructor(e, o) {
97
- var s;
98
- this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (s = o.width) !== null && s !== void 0 ? s : 1, this.color = o.color === !1 ? void 0 : o.color || "black", this.class = o.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((r) => {
99
- let l = (i) => {
100
- this[r](i);
101
- };
102
- return e.dom.addEventListener(r, l), { name: r, handler: l };
103
- });
104
- }
105
- destroy() {
106
- this.handlers.forEach(({ name: e, handler: o }) => this.editorView.dom.removeEventListener(e, o));
107
- }
108
- update(e, o) {
109
- this.cursorPos != null && o.doc != e.state.doc && (this.cursorPos > e.state.doc.content.size ? this.setCursor(null) : this.updateOverlay());
110
- }
111
- setCursor(e) {
112
- e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
113
- }
114
- updateOverlay() {
115
- let e = this.editorView.state.doc.resolve(this.cursorPos), o = !e.parent.inlineContent, s;
116
- if (o) {
117
- let n = e.nodeBefore, a = e.nodeAfter;
118
- if (n || a) {
119
- let c = this.editorView.nodeDOM(this.cursorPos - (n ? n.nodeSize : 0));
120
- if (c) {
121
- let d = c.getBoundingClientRect(), h = n ? d.bottom : d.top;
122
- n && a && (h = (h + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2), s = { left: d.left, right: d.right, top: h - this.width / 2, bottom: h + this.width / 2 };
123
- }
124
- }
125
- }
126
- if (!s) {
127
- let n = this.editorView.coordsAtPos(this.cursorPos);
128
- s = { left: n.left - this.width / 2, right: n.left + this.width / 2, top: n.top, bottom: n.bottom };
129
- }
130
- let r = this.editorView.dom.offsetParent;
131
- this.element || (this.element = r.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", o), this.element.classList.toggle("prosemirror-dropcursor-inline", !o);
132
- let l, i;
133
- if (!r || r == document.body && getComputedStyle(r).position == "static")
134
- l = -pageXOffset, i = -pageYOffset;
135
- else {
136
- let n = r.getBoundingClientRect();
137
- l = n.left - r.scrollLeft, i = n.top - r.scrollTop;
138
- }
139
- this.element.style.left = s.left - l + "px", this.element.style.top = s.top - i + "px", this.element.style.width = s.right - s.left + "px", this.element.style.height = s.bottom - s.top + "px";
140
- }
141
- scheduleRemoval(e) {
142
- clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
143
- }
144
- dragover(e) {
145
- if (!this.editorView.editable)
146
- return;
147
- let o = this.editorView.posAtCoords({ left: e.clientX, top: e.clientY }), s = o && o.inside >= 0 && this.editorView.state.doc.nodeAt(o.inside), r = s && s.type.spec.disableDropCursor, l = typeof r == "function" ? r(this.editorView, o, e) : r;
148
- if (o && !l) {
149
- let i = o.pos;
150
- if (this.editorView.dragging && this.editorView.dragging.slice) {
151
- let n = L(this.editorView.state.doc, i, this.editorView.dragging.slice);
152
- n != null && (i = n);
153
- }
154
- this.setCursor(i), this.scheduleRemoval(5e3);
155
- }
156
- }
157
- dragend() {
158
- this.scheduleRemoval(20);
159
- }
160
- drop() {
161
- this.scheduleRemoval(20);
162
- }
163
- dragleave(e) {
164
- (e.target == this.editorView.dom || !this.editorView.dom.contains(e.relatedTarget)) && this.setCursor(null);
165
- }
166
- }
167
- const q = f.create({
168
- name: "dropCursor",
169
- addOptions() {
170
- return {
171
- color: "currentColor",
172
- width: 1,
173
- class: void 0
174
- };
175
- },
176
- addProseMirrorPlugins() {
177
- return [
178
- Y(this.options)
179
- ];
180
- }
181
- }), U = f.create({
182
- name: "focus",
183
- addOptions() {
184
- return {
185
- className: "has-focus",
186
- mode: "all"
187
- };
188
- },
189
- addProseMirrorPlugins() {
190
- return [
191
- new p({
192
- key: new w("focus"),
193
- props: {
194
- decorations: ({ doc: t, selection: e }) => {
195
- const { isEditable: o, isFocused: s } = this.editor, { anchor: r } = e, l = [];
196
- if (!o || !s)
197
- return C.create(t, []);
198
- let i = 0;
199
- this.options.mode === "deepest" && t.descendants((a, c) => {
200
- if (a.isText)
201
- return;
202
- if (!(r >= c && r <= c + a.nodeSize - 1))
203
- return !1;
204
- i += 1;
205
- });
206
- let n = 0;
207
- return t.descendants((a, c) => {
208
- if (a.isText || !(r >= c && r <= c + a.nodeSize - 1))
209
- return !1;
210
- if (n += 1, this.options.mode === "deepest" && i - n > 0 || this.options.mode === "shallowest" && n > 1)
211
- return this.options.mode === "deepest";
212
- l.push(b.node(c, c + a.nodeSize, {
213
- class: this.options.className
214
- }));
215
- }), C.create(t, l);
216
- }
217
- }
218
- })
219
- ];
220
- }
221
- });
222
- class u extends y {
223
- /**
224
- Create a gap cursor.
225
- */
226
- constructor(e) {
227
- super(e, e);
228
- }
229
- map(e, o) {
230
- let s = e.resolve(o.map(this.head));
231
- return u.valid(s) ? new u(s) : y.near(s);
232
- }
233
- content() {
234
- return P.empty;
235
- }
236
- eq(e) {
237
- return e instanceof u && e.head == this.head;
238
- }
239
- toJSON() {
240
- return { type: "gapcursor", pos: this.head };
241
- }
242
- /**
243
- @internal
244
- */
245
- static fromJSON(e, o) {
246
- if (typeof o.pos != "number")
247
- throw new RangeError("Invalid input for GapCursor.fromJSON");
248
- return new u(e.resolve(o.pos));
249
- }
250
- /**
251
- @internal
252
- */
253
- getBookmark() {
254
- return new v(this.anchor);
255
- }
256
- /**
257
- @internal
258
- */
259
- static valid(e) {
260
- let o = e.parent;
261
- if (o.isTextblock || !Q(e) || !Z(e))
262
- return !1;
263
- let s = o.type.spec.allowGapCursor;
264
- if (s != null)
265
- return s;
266
- let r = o.contentMatchAt(e.index()).defaultType;
267
- return r && r.isTextblock;
268
- }
269
- /**
270
- @internal
271
- */
272
- static findGapCursorFrom(e, o, s = !1) {
273
- e: for (; ; ) {
274
- if (!s && u.valid(e))
275
- return e;
276
- let r = e.pos, l = null;
277
- for (let i = e.depth; ; i--) {
278
- let n = e.node(i);
279
- if (o > 0 ? e.indexAfter(i) < n.childCount : e.index(i) > 0) {
280
- l = n.child(o > 0 ? e.indexAfter(i) : e.index(i) - 1);
281
- break;
282
- } else if (i == 0)
283
- return null;
284
- r += o;
285
- let a = e.doc.resolve(r);
286
- if (u.valid(a))
287
- return a;
288
- }
289
- for (; ; ) {
290
- let i = o > 0 ? l.firstChild : l.lastChild;
291
- if (!i) {
292
- if (l.isAtom && !l.isText && !T.isSelectable(l)) {
293
- e = e.doc.resolve(r + l.nodeSize * o), s = !1;
294
- continue e;
295
- }
296
- break;
297
- }
298
- l = i, r += o;
299
- let n = e.doc.resolve(r);
300
- if (u.valid(n))
301
- return n;
302
- }
303
- return null;
304
- }
305
- }
306
- }
307
- u.prototype.visible = !1;
308
- u.findFrom = u.findGapCursorFrom;
309
- y.jsonID("gapcursor", u);
310
- class v {
311
- constructor(e) {
312
- this.pos = e;
313
- }
314
- map(e) {
315
- return new v(e.map(this.pos));
316
- }
317
- resolve(e) {
318
- let o = e.resolve(this.pos);
319
- return u.valid(o) ? new u(o) : y.near(o);
320
- }
321
- }
322
- function Q(t) {
323
- for (let e = t.depth; e >= 0; e--) {
324
- let o = t.index(e), s = t.node(e);
325
- if (o == 0) {
326
- if (s.type.spec.isolating)
327
- return !0;
328
- continue;
329
- }
330
- for (let r = s.child(o - 1); ; r = r.lastChild) {
331
- if (r.childCount == 0 && !r.inlineContent || r.isAtom || r.type.spec.isolating)
332
- return !0;
333
- if (r.inlineContent)
334
- return !1;
335
- }
336
- }
337
- return !0;
338
- }
339
- function Z(t) {
340
- for (let e = t.depth; e >= 0; e--) {
341
- let o = t.indexAfter(e), s = t.node(e);
342
- if (o == s.childCount) {
343
- if (s.type.spec.isolating)
344
- return !0;
345
- continue;
346
- }
347
- for (let r = s.child(o); ; r = r.firstChild) {
348
- if (r.childCount == 0 && !r.inlineContent || r.isAtom || r.type.spec.isolating)
349
- return !0;
350
- if (r.inlineContent)
351
- return !1;
352
- }
353
- }
354
- return !0;
355
- }
356
- function $() {
357
- return new p({
358
- props: {
359
- decorations: re,
360
- createSelectionBetween(t, e, o) {
361
- return e.pos == o.pos && u.valid(o) ? new u(o) : null;
362
- },
363
- handleClick: ee,
364
- handleKeyDown: _,
365
- handleDOMEvents: { beforeinput: te }
366
- }
367
- });
368
- }
369
- const _ = R({
370
- ArrowLeft: g("horiz", -1),
371
- ArrowRight: g("horiz", 1),
372
- ArrowUp: g("vert", -1),
373
- ArrowDown: g("vert", 1)
374
- });
375
- function g(t, e) {
376
- const o = t == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
377
- return function(s, r, l) {
378
- let i = s.selection, n = e > 0 ? i.$to : i.$from, a = i.empty;
379
- if (i instanceof M) {
380
- if (!l.endOfTextblock(o) || n.depth == 0)
381
- return !1;
382
- a = !1, n = s.doc.resolve(e > 0 ? n.after() : n.before());
383
- }
384
- let c = u.findGapCursorFrom(n, e, a);
385
- return c ? (r && r(s.tr.setSelection(new u(c))), !0) : !1;
386
- };
387
- }
388
- function ee(t, e, o) {
389
- if (!t || !t.editable)
390
- return !1;
391
- let s = t.state.doc.resolve(e);
392
- if (!u.valid(s))
393
- return !1;
394
- let r = t.posAtCoords({ left: o.clientX, top: o.clientY });
395
- return r && r.inside > -1 && T.isSelectable(t.state.doc.nodeAt(r.inside)) ? !1 : (t.dispatch(t.state.tr.setSelection(new u(s))), !0);
396
- }
397
- function te(t, e) {
398
- if (e.inputType != "insertCompositionText" || !(t.state.selection instanceof u))
399
- return !1;
400
- let { $from: o } = t.state.selection, s = o.parent.contentMatchAt(o.index()).findWrapping(t.state.schema.nodes.text);
401
- if (!s)
402
- return !1;
403
- let r = k.empty;
404
- for (let i = s.length - 1; i >= 0; i--)
405
- r = k.from(s[i].createAndFill(null, r));
406
- let l = t.state.tr.replace(o.pos, o.pos, new P(r, 0, 0));
407
- return l.setSelection(M.near(l.doc.resolve(o.pos + 1))), t.dispatch(l), !1;
408
- }
409
- function re(t) {
410
- if (!(t.selection instanceof u))
411
- return null;
412
- let e = document.createElement("div");
413
- return e.className = "ProseMirror-gapcursor", C.create(t.doc, [b.widget(t.selection.head, e, { key: "gapcursor" })]);
414
- }
415
- const oe = f.create({
416
- name: "gapCursor",
417
- addProseMirrorPlugins() {
418
- return [
419
- $()
420
- ];
421
- },
422
- extendNodeSchema(t) {
423
- var e;
424
- const o = {
425
- name: t.name,
426
- options: t.options,
427
- storage: t.storage
428
- };
429
- return {
430
- allowGapCursor: (e = D(V(t, "allowGapCursor", o))) !== null && e !== void 0 ? e : null
431
- };
432
- }
433
- }), se = x.create({
434
- name: "hardBreak",
435
- addOptions() {
436
- return {
437
- keepMarks: !0,
438
- HTMLAttributes: {}
439
- };
440
- },
441
- inline: !0,
442
- group: "inline",
443
- selectable: !1,
444
- linebreakReplacement: !0,
445
- parseHTML() {
446
- return [
447
- { tag: "br" }
448
- ];
449
- },
450
- renderHTML({ HTMLAttributes: t }) {
451
- return ["br", A(this.options.HTMLAttributes, t)];
452
- },
453
- renderText() {
454
- return `
455
- `;
456
- },
457
- addCommands() {
458
- return {
459
- setHardBreak: () => ({ commands: t, chain: e, state: o, editor: s }) => t.first([
460
- () => t.exitCode(),
461
- () => t.command(() => {
462
- const { selection: r, storedMarks: l } = o;
463
- if (r.$from.parent.type.spec.isolating)
464
- return !1;
465
- const { keepMarks: i } = this.options, { splittableMarks: n } = s.extensionManager, a = l || r.$to.parentOffset && r.$from.marks();
466
- return e().insertContent({ type: this.name }).command(({ tr: c, dispatch: d }) => {
467
- if (d && a && i) {
468
- const h = a.filter((E) => n.includes(E.type.name));
469
- c.ensureMarks(h);
470
- }
471
- return !0;
472
- }).run();
473
- })
474
- ])
475
- };
476
- },
477
- addKeyboardShortcuts() {
478
- return {
479
- "Mod-Enter": () => this.editor.commands.setHardBreak(),
480
- "Shift-Enter": () => this.editor.commands.setHardBreak()
481
- };
482
- }
483
- }), ie = x.create({
484
- name: "paragraph",
485
- priority: 1e3,
486
- addOptions() {
487
- return {
488
- HTMLAttributes: {}
489
- };
490
- },
491
- group: "block",
492
- content: "inline*",
493
- parseHTML() {
494
- return [
495
- { tag: "p" }
496
- ];
497
- },
498
- renderHTML({ HTMLAttributes: t }) {
499
- return ["p", A(this.options.HTMLAttributes, t), 0];
500
- },
501
- addCommands() {
502
- return {
503
- setParagraph: () => ({ commands: t }) => t.setNode(this.name)
504
- };
505
- },
506
- addKeyboardShortcuts() {
507
- return {
508
- "Mod-Alt-0": () => this.editor.commands.setParagraph()
509
- };
510
- }
511
- }), ne = f.create({
512
- name: "placeholder",
513
- addOptions() {
514
- return {
515
- emptyEditorClass: "is-editor-empty",
516
- emptyNodeClass: "is-empty",
517
- placeholder: "Write something …",
518
- showOnlyWhenEditable: !0,
519
- showOnlyCurrent: !0,
520
- includeChildren: !1
521
- };
522
- },
523
- addProseMirrorPlugins() {
524
- return [
525
- new p({
526
- key: new w("placeholder"),
527
- props: {
528
- decorations: ({ doc: t, selection: e }) => {
529
- const o = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: s } = e, r = [];
530
- if (!o)
531
- return null;
532
- const l = this.editor.isEmpty;
533
- return t.descendants((i, n) => {
534
- const a = s >= n && s <= n + i.nodeSize, c = !i.isLeaf && H(i);
535
- if ((a || !this.options.showOnlyCurrent) && c) {
536
- const d = [this.options.emptyNodeClass];
537
- l && d.push(this.options.emptyEditorClass);
538
- const h = b.node(n, n + i.nodeSize, {
539
- class: d.join(" "),
540
- "data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
541
- editor: this.editor,
542
- node: i,
543
- pos: n,
544
- hasAnchor: a
545
- }) : this.options.placeholder
546
- });
547
- r.push(h);
548
- }
549
- return this.options.includeChildren;
550
- }), C.create(t, r);
551
- }
552
- }
553
- })
554
- ];
555
- }
556
- }), le = x.create({
557
- name: "text",
558
- group: "inline"
559
- }), we = /* @__PURE__ */ f.create({
560
- name: "base-kit",
561
- addExtensions() {
562
- const t = [];
563
- return this.options.document !== !1 && t.push(K.configure()), this.options.placeholder !== !1 && t.push(
564
- ne.configure({
565
- placeholder: ({ node: e, pos: o, editor: s }) => {
566
- var r, l, i, n, a;
567
- return ((r = e == null ? void 0 : e.type) == null ? void 0 : r.name) === "columns" || ((l = e == null ? void 0 : e.content) == null ? void 0 : l.size) !== 0 ? "" : ((i = e == null ? void 0 : e.type) == null ? void 0 : i.name) === "heading" ? `${m.t(`editor.heading.h${e.attrs.level}.tooltip`)}` : ((n = e == null ? void 0 : e.type) == null ? void 0 : n.name) === "codeBlock" || ((a = e == null ? void 0 : e.type) == null ? void 0 : a.name) === "table" ? "" : s.extensionManager.extensions.some((c) => c.name === "slashCommand") ? m.t("editor.slash") : o === 0 ? m.t("editor.content") : m.t("editor.content");
568
- },
569
- ...this.options.placeholder
570
- })
571
- ), this.options.focus !== !1 && t.push(
572
- U.configure({
573
- className: "focus",
574
- ...this.options.focus
575
- })
576
- ), this.options.text !== !1 && t.push(le.configure()), this.options.textBubble !== !1 && t.push(G.configure()), this.options.gapcursor !== !1 && t.push(oe.configure()), this.options.dropcursor !== !1 && t.push(
577
- q.configure({
578
- ...this.options.dropcursor,
579
- width: 2,
580
- class: "ProseMirror-dropcursor border-black"
581
- })
582
- ), this.options.characterCount !== !1 && t.push(X.configure(this.options.characterCount)), this.options.paragraph !== !1 && t.push(ie.configure(this.options.paragraph)), this.options.hardBreak !== !1 && t.push(se.configure(this.options.hardBreak)), this.options.listItem !== !1 && t.push(F.configure(this.options.listItem)), this.options.textStyle !== !1 && t.push(I.configure(this.options.textStyle)), this.options.trailingNode !== !1 && t.push(J.configure(this.options.trailingNode)), this.options.selection !== !1 && t.push(W), this.options.multiColumn !== !1 && t.push(z, N), t;
583
- }
584
- });
1
+ import { R as f } from "./RichTextEditor-DGcKEUGr.js";
585
2
  export {
586
- we as BaseKit,
587
- ke as BubbleMenu,
588
- ve as default,
589
- ye as useEditorState
3
+ f as default
590
4
  };
@@ -0,0 +1,13 @@
1
+ var s = (n, r) => {
2
+ if (n === "slot")
3
+ return 0;
4
+ if (n instanceof Function)
5
+ return n(r);
6
+ const { children: e, ...o } = r ?? {};
7
+ if (n === "svg")
8
+ throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
9
+ return [n, o, e];
10
+ };
11
+ export {
12
+ s as h
13
+ };
@@ -0,0 +1 @@
1
+ "use strict";var t=(n,r)=>{if(n==="slot")return 0;if(n instanceof Function)return n(r);const{children:e,...s}=r??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,s,e]};exports.h=t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D_A0TBRA.cjs");exports.en=e.locale$1;exports.fi=e.locale$6;exports.hu_HU=e.locale$2;exports.locale=e.locale;exports.pt_BR=e.locale$5;exports.vi=e.locale$3;exports.zh_CN=e.locale$4;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-6D1J-A-o.cjs");exports.en=e.locale$1;exports.fi=e.locale$6;exports.hu_HU=e.locale$2;exports.locale=e.locale;exports.pt_BR=e.locale$5;exports.vi=e.locale$3;exports.zh_CN=e.locale$4;