reactjs-tiptap-editor 0.4.1 → 1.0.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 (338) hide show
  1. package/lib/ActionMenuButton-BKOg7hkq.js +38 -0
  2. package/lib/ActionMenuButton-DLQyd_gx.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.d.cts +43 -55
  5. package/lib/Attachment.d.ts +43 -55
  6. package/lib/Attachment.js +129 -99
  7. package/lib/Blockquote.cjs +3 -3
  8. package/lib/Blockquote.d.cts +43 -55
  9. package/lib/Blockquote.d.ts +43 -55
  10. package/lib/Blockquote.js +50 -22
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +43 -55
  13. package/lib/Bold.d.ts +43 -55
  14. package/lib/Bold.js +48 -20
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +43 -55
  17. package/lib/BulletList.d.ts +43 -55
  18. package/lib/BulletList.js +38 -9
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +43 -55
  21. package/lib/Clear.d.ts +43 -55
  22. package/lib/Clear.js +32 -6
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +43 -55
  25. package/lib/Code.d.ts +43 -55
  26. package/lib/Code.js +53 -25
  27. package/lib/CodeBlock.cjs +35 -35
  28. package/lib/CodeBlock.d.cts +43 -55
  29. package/lib/CodeBlock.d.ts +43 -55
  30. package/lib/CodeBlock.js +605 -590
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +44 -56
  33. package/lib/CodeView.d.ts +44 -56
  34. package/lib/CodeView.js +49 -21
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +47 -55
  37. package/lib/Color.d.ts +47 -55
  38. package/lib/Color.js +123 -79
  39. package/lib/Column.cjs +1 -0
  40. package/lib/{Document.d.cts → Column.d.cts} +49 -58
  41. package/lib/{Document.d.ts → Column.d.ts} +49 -58
  42. package/lib/Column.js +217 -0
  43. package/lib/{Drawer-CaAfmqNo.js → Drawer-DZ5jvmrX.js} +404 -394
  44. package/lib/Drawer-SRhwOc6T.cjs +1 -0
  45. package/lib/Drawer.cjs +1 -1
  46. package/lib/Drawer.d.cts +43 -55
  47. package/lib/Drawer.d.ts +43 -55
  48. package/lib/Drawer.js +6 -5
  49. package/lib/Emoji.cjs +1 -1
  50. package/lib/Emoji.d.cts +43 -60
  51. package/lib/Emoji.d.ts +43 -60
  52. package/lib/Emoji.js +377 -392
  53. package/lib/Excalidraw-DwBRXEtC.js +345 -0
  54. package/lib/Excalidraw-ZN3DQvDC.cjs +1 -0
  55. package/lib/Excalidraw.cjs +1 -1
  56. package/lib/Excalidraw.d.cts +43 -55
  57. package/lib/Excalidraw.d.ts +43 -55
  58. package/lib/Excalidraw.js +6 -4
  59. package/lib/ExportPdf.cjs +5 -5
  60. package/lib/ExportPdf.d.cts +43 -55
  61. package/lib/ExportPdf.d.ts +43 -55
  62. package/lib/ExportPdf.js +60 -32
  63. package/lib/ExportWord.cjs +1 -1
  64. package/lib/ExportWord.d.cts +44 -56
  65. package/lib/ExportWord.d.ts +44 -56
  66. package/lib/ExportWord.js +84 -21
  67. package/lib/FontFamily.cjs +1 -1
  68. package/lib/FontFamily.d.cts +57 -58
  69. package/lib/FontFamily.d.ts +57 -58
  70. package/lib/FontFamily.js +72 -74
  71. package/lib/FontSize.cjs +1 -1
  72. package/lib/FontSize.d.cts +54 -58
  73. package/lib/FontSize.d.ts +54 -58
  74. package/lib/FontSize.js +72 -64
  75. package/lib/Heading.cjs +1 -1
  76. package/lib/Heading.d.cts +57 -55
  77. package/lib/Heading.d.ts +57 -55
  78. package/lib/Heading.js +91 -73
  79. package/lib/Highlight.cjs +1 -1
  80. package/lib/Highlight.d.cts +47 -55
  81. package/lib/Highlight.d.ts +47 -55
  82. package/lib/Highlight.js +152 -21
  83. package/lib/History.cjs +1 -1
  84. package/lib/History.d.cts +45 -55
  85. package/lib/History.d.ts +45 -55
  86. package/lib/History.js +976 -53
  87. package/lib/HorizontalRule.cjs +1 -1
  88. package/lib/HorizontalRule.d.cts +43 -55
  89. package/lib/HorizontalRule.d.ts +43 -55
  90. package/lib/HorizontalRule.js +97 -17
  91. package/lib/Icon-DUpv2cI6.cjs +1 -0
  92. package/lib/Icon-jKs8Hr6p.js +11 -0
  93. package/lib/Iframe-CmXkEqOd.js +431 -0
  94. package/lib/Iframe-Cvca2G7X.cjs +1 -0
  95. package/lib/Iframe.cjs +1 -1
  96. package/lib/Iframe.d.cts +42 -61
  97. package/lib/Iframe.d.ts +42 -61
  98. package/lib/Iframe.js +6 -4
  99. package/lib/Image.cjs +1 -1
  100. package/lib/Image.d.cts +43 -56
  101. package/lib/Image.d.ts +43 -56
  102. package/lib/Image.js +848 -5
  103. package/lib/ImageGif.cjs +1 -1
  104. package/lib/ImageGif.d.cts +44 -58
  105. package/lib/ImageGif.d.ts +44 -58
  106. package/lib/ImageGif.js +424 -5
  107. package/lib/ImportWord.cjs +48 -48
  108. package/lib/ImportWord.d.cts +44 -56
  109. package/lib/ImportWord.d.ts +44 -56
  110. package/lib/ImportWord.js +2596 -2588
  111. package/lib/Indent.cjs +1 -1
  112. package/lib/Indent.d.cts +43 -55
  113. package/lib/Indent.d.ts +43 -55
  114. package/lib/Indent.js +97 -27
  115. package/lib/Italic.cjs +1 -1
  116. package/lib/Italic.d.cts +43 -55
  117. package/lib/Italic.d.ts +43 -55
  118. package/lib/Italic.js +47 -19
  119. package/lib/Katex-DsYXsjSS.js +2740 -0
  120. package/lib/Katex-XfrNne6U.cjs +4 -0
  121. package/lib/Katex.cjs +1 -1
  122. package/lib/Katex.d.cts +43 -55
  123. package/lib/Katex.d.ts +43 -55
  124. package/lib/Katex.js +5 -196
  125. package/lib/LineHeight.cjs +1 -1
  126. package/lib/LineHeight.d.cts +45 -61
  127. package/lib/LineHeight.d.ts +45 -61
  128. package/lib/LineHeight.js +71 -112
  129. package/lib/Link.cjs +1 -1
  130. package/lib/Link.d.cts +44 -58
  131. package/lib/Link.d.ts +44 -58
  132. package/lib/Link.js +3 -3
  133. package/lib/LinkEditBlock-BZenZq-Z.cjs +5 -0
  134. package/lib/LinkEditBlock-CB8yIffE.js +1241 -0
  135. package/lib/Mention.cjs +1 -1
  136. package/lib/Mention.d.cts +40 -55
  137. package/lib/Mention.d.ts +40 -55
  138. package/lib/Mention.js +114 -130
  139. package/lib/Mermaid.cjs +2 -2
  140. package/lib/Mermaid.d.cts +43 -55
  141. package/lib/Mermaid.d.ts +43 -55
  142. package/lib/Mermaid.js +177 -165
  143. package/lib/MoreMark.cjs +1 -1
  144. package/lib/MoreMark.d.cts +58 -57
  145. package/lib/MoreMark.d.ts +58 -57
  146. package/lib/MoreMark.js +125 -55
  147. package/lib/OrderedList.cjs +1 -1
  148. package/lib/OrderedList.d.cts +43 -55
  149. package/lib/OrderedList.d.ts +43 -55
  150. package/lib/OrderedList.js +37 -9
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +43 -58
  153. package/lib/SearchAndReplace.d.ts +43 -58
  154. package/lib/SearchAndReplace.js +221 -197
  155. package/lib/SlashCommand.cjs +1 -1
  156. package/lib/SlashCommand.d.cts +55 -62
  157. package/lib/SlashCommand.d.ts +55 -62
  158. package/lib/SlashCommand.js +235 -249
  159. package/lib/Strike.cjs +1 -1
  160. package/lib/Strike.d.cts +43 -55
  161. package/lib/Strike.d.ts +43 -55
  162. package/lib/Strike.js +39 -11
  163. package/lib/Table-B1j1Ebmh.cjs +9 -0
  164. package/lib/Table-Db8TcQX8.js +1984 -0
  165. package/lib/Table.cjs +1 -9
  166. package/lib/Table.d.cts +44 -58
  167. package/lib/Table.d.ts +44 -58
  168. package/lib/Table.js +3 -558
  169. package/lib/TaskList.cjs +1 -1
  170. package/lib/TaskList.d.cts +43 -55
  171. package/lib/TaskList.d.ts +43 -55
  172. package/lib/TaskList.js +38 -10
  173. package/lib/TextAlign.cjs +1 -1
  174. package/lib/TextAlign.d.cts +56 -55
  175. package/lib/TextAlign.d.ts +56 -55
  176. package/lib/TextAlign.js +108 -101
  177. package/lib/TextDirection.cjs +1 -1
  178. package/lib/TextDirection.d.cts +72 -55
  179. package/lib/TextDirection.d.ts +72 -55
  180. package/lib/TextDirection.js +105 -112
  181. package/lib/TextUnderline.cjs +1 -1
  182. package/lib/TextUnderline.d.cts +43 -55
  183. package/lib/TextUnderline.d.ts +43 -55
  184. package/lib/TextUnderline.js +46 -18
  185. package/lib/{Twitter-BFULyqdR.js → Twitter-CXmmjz9R.js} +536 -498
  186. package/lib/Twitter-CtVTIWJW.cjs +1 -0
  187. package/lib/Twitter.cjs +1 -1
  188. package/lib/Twitter.d.cts +43 -55
  189. package/lib/Twitter.d.ts +43 -55
  190. package/lib/Twitter.js +5 -4
  191. package/lib/Video.cjs +1 -1
  192. package/lib/Video.d.cts +43 -55
  193. package/lib/Video.d.ts +43 -55
  194. package/lib/Video.js +261 -4
  195. package/lib/_commonjsHelpers-BItOPCY9.js +28 -0
  196. package/lib/_commonjsHelpers-BTDuMlIz.cjs +1 -0
  197. package/lib/bubble.cjs +2 -0
  198. package/lib/{bubble-extra.d.cts → bubble.d.cts} +69 -70
  199. package/lib/{bubble-extra.d.ts → bubble.d.ts} +69 -70
  200. package/lib/bubble.js +1925 -0
  201. package/lib/button-B12K7BJ4.cjs +1 -0
  202. package/lib/button-DXMsXUEn.js +43 -0
  203. package/lib/clsx-C11secjj.cjs +1 -0
  204. package/lib/clsx-OuTLNxxd.js +16 -0
  205. package/lib/delete-node-CosiBes5.cjs +1 -0
  206. package/lib/delete-node-IyVmiRbI.js +22 -0
  207. package/lib/dialog-CaCS-W5S.cjs +1 -0
  208. package/lib/dialog-PtQivpHS.js +100 -0
  209. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  210. package/lib/dom-dataset-CIEeltF6.js +47 -0
  211. package/lib/dropdown-menu-BPp2Z_U-.js +136 -0
  212. package/lib/dropdown-menu-CdSm4emp.cjs +1 -0
  213. package/lib/file-BLas99n7.js +43 -0
  214. package/lib/file-i7e4nQY2.cjs +1 -0
  215. package/lib/floating-ui.dom-U1vPFQ5f.js +1151 -0
  216. package/lib/floating-ui.dom-VCrc58uF.cjs +1 -0
  217. package/lib/icons-Cllpys39.js +362 -0
  218. package/lib/icons-CqHjeW5T.cjs +1 -0
  219. package/lib/index-BH4bc3jN.cjs +33 -0
  220. package/lib/index-BPfVXs5_.js +2380 -0
  221. package/lib/index-Bnmd0WvY.js +1631 -0
  222. package/lib/{index-Ch6dBBad.js → index-CBce_TWY.js} +40 -42
  223. package/lib/{index-5iBZLua9.cjs → index-D-5U8dY8.cjs} +8 -8
  224. package/lib/{index-ByurDDMv.js → index-D2TUfKkC.js} +2 -2
  225. package/lib/index-DV5kbgRU.cjs +1 -0
  226. package/lib/{index-LmrOdnen.js → index-DYkucCoF.js} +396 -495
  227. package/lib/index-Dfmm6FTT.cjs +1 -0
  228. package/lib/index-DnWWK9F_.js +6374 -0
  229. package/lib/index-DzcKxutn.js +632 -0
  230. package/lib/index-DzvuNTxo.cjs +4 -0
  231. package/lib/{index-BeCTd5v2.cjs → index-N--9MohJ.cjs} +1 -1
  232. package/lib/index-RfTlOzIr.cjs +22 -0
  233. package/lib/index.cjs +132 -1
  234. package/lib/index.d.cts +45 -296
  235. package/lib/index.d.ts +45 -296
  236. package/lib/index.js +243 -2
  237. package/lib/input-_ECRfn3Y.cjs +1 -0
  238. package/lib/input-wJ9PDEzZ.js +21 -0
  239. package/lib/isNumber-ClPupm7P.cjs +1 -0
  240. package/lib/isNumber-fpLGS0AZ.js +15 -0
  241. package/lib/label-BkgAe7IY.cjs +1 -0
  242. package/lib/label-CGdLYWv7.js +19 -0
  243. package/lib/locale-bundle.cjs +1 -1
  244. package/lib/locale-bundle.d.cts +5421 -73
  245. package/lib/locale-bundle.d.ts +5421 -73
  246. package/lib/locale-bundle.js +9 -7
  247. package/lib/popover-BgmUNMHj.cjs +1 -0
  248. package/lib/popover-CAuEW0Mr.js +23 -0
  249. package/lib/separator-CuBW_w98.js +328 -0
  250. package/lib/separator-DRIrVZ2N.cjs +1 -0
  251. package/lib/store-DX599H5W.js +10 -0
  252. package/lib/store-WStcMOiW.cjs +1 -0
  253. package/lib/style.css +1 -1
  254. package/lib/switch-CnLJ7Y-b.cjs +1 -0
  255. package/lib/switch-Coix_FA1.js +27 -0
  256. package/lib/tabs-B5mVSN1I.js +46 -0
  257. package/lib/tabs-BoLCMcCI.cjs +1 -0
  258. package/lib/textarea-B-6zTKQz.cjs +1 -0
  259. package/lib/{textarea-aPtytkDx.js → textarea-DUUM1jZd.js} +1 -1
  260. package/lib/theme-B7aAsK_T.js +15 -0
  261. package/lib/theme-D8_cxGqB.cjs +1 -0
  262. package/lib/throttle-CdwDrFpn.js +249 -0
  263. package/lib/throttle-qX7Yjtsg.cjs +1 -0
  264. package/lib/toggle-Cdp4IT2U.js +85 -0
  265. package/lib/toggle-D41PzQLJ.cjs +1 -0
  266. package/lib/tooltip-BuEiE96N.cjs +1 -0
  267. package/lib/tooltip-CopwsU8q.js +23 -0
  268. package/lib/updatePosition-8Sdem5jb.cjs +1 -0
  269. package/lib/updatePosition-BPmcE0YD.js +215 -0
  270. package/lib/use-toast-Bz3QCOtE.cjs +1 -0
  271. package/lib/use-toast-Crf7-q5H.js +98 -0
  272. package/lib/useButtonProps-BsEd4zYM.js +141 -0
  273. package/lib/useButtonProps-C6Vpn190.cjs +1 -0
  274. package/package.json +22 -105
  275. package/lib/ActionMenuButton-CYdM1xx5.cjs +0 -1
  276. package/lib/ActionMenuButton-DKRF6oa0.js +0 -33
  277. package/lib/BaseKit.cjs +0 -3
  278. package/lib/BaseKit.d.cts +0 -481
  279. package/lib/BaseKit.d.ts +0 -481
  280. package/lib/BaseKit.js +0 -132
  281. package/lib/Document.cjs +0 -1
  282. package/lib/Document.js +0 -9
  283. package/lib/Drawer-CdvCMSzN.cjs +0 -1
  284. package/lib/Excalidraw-BbMQhNvs.cjs +0 -1
  285. package/lib/Excalidraw-CVWz2Vyn.js +0 -290
  286. package/lib/FormatPainter.cjs +0 -1
  287. package/lib/FormatPainter.d.cts +0 -372
  288. package/lib/FormatPainter.d.ts +0 -372
  289. package/lib/FormatPainter.js +0 -76
  290. package/lib/ListItem.cjs +0 -1
  291. package/lib/ListItem.d.cts +0 -290
  292. package/lib/ListItem.d.ts +0 -290
  293. package/lib/ListItem.js +0 -7
  294. package/lib/MultiColumn.cjs +0 -1
  295. package/lib/MultiColumn.d.cts +0 -294
  296. package/lib/MultiColumn.d.ts +0 -294
  297. package/lib/MultiColumn.js +0 -8
  298. package/lib/RichTextEditor-CxvwGvQG.cjs +0 -142
  299. package/lib/RichTextEditor-DGcKEUGr.js +0 -22166
  300. package/lib/Selection.cjs +0 -1
  301. package/lib/Selection.d.cts +0 -289
  302. package/lib/Selection.d.ts +0 -289
  303. package/lib/Selection.js +0 -25
  304. package/lib/SubAndSuperScript.cjs +0 -1
  305. package/lib/SubAndSuperScript.d.cts +0 -377
  306. package/lib/SubAndSuperScript.d.ts +0 -377
  307. package/lib/SubAndSuperScript.js +0 -43
  308. package/lib/TableOfContent.cjs +0 -1
  309. package/lib/TableOfContent.d.cts +0 -291
  310. package/lib/TableOfContent.d.ts +0 -291
  311. package/lib/TableOfContent.js +0 -185
  312. package/lib/TextBubble.cjs +0 -1
  313. package/lib/TextBubble.d.cts +0 -362
  314. package/lib/TextBubble.d.ts +0 -362
  315. package/lib/TextBubble.js +0 -133
  316. package/lib/TrailingNode.cjs +0 -1
  317. package/lib/TrailingNode.d.cts +0 -297
  318. package/lib/TrailingNode.d.ts +0 -297
  319. package/lib/TrailingNode.js +0 -41
  320. package/lib/Twitter-Cutpkh3h.cjs +0 -1
  321. package/lib/bubble-extra.cjs +0 -2
  322. package/lib/bubble-extra.js +0 -631
  323. package/lib/dom-dataset-_6-diIRQ.cjs +0 -33
  324. package/lib/dom-dataset-lYeH6gfI.js +0 -2361
  325. package/lib/index-6D1J-A-o.cjs +0 -1
  326. package/lib/index-B96Cclrj.cjs +0 -3
  327. package/lib/index-BBz7Nmv9.js +0 -55
  328. package/lib/index-CUogRI7j.cjs +0 -1
  329. package/lib/index-DF2Lp4HZ.cjs +0 -100
  330. package/lib/index-D_L6n8O8.js +0 -76
  331. package/lib/index-Dbvi-Bvh.cjs +0 -1
  332. package/lib/index-DpCrt7xs.cjs +0 -1
  333. package/lib/index-DsAX1Vq8.cjs +0 -1
  334. package/lib/index-Dy4DlW9o.js +0 -12
  335. package/lib/index-J3jHHZ4d.js +0 -200
  336. package/lib/index-VvXaaKe3.js +0 -898
  337. package/lib/index-kbO3iWqL.js +0 -13432
  338. package/lib/textarea-DFo_aXnj.cjs +0 -1
@@ -0,0 +1,98 @@
1
+ import * as c from "react";
2
+ const d = 1, f = 1e6;
3
+ let T = 0;
4
+ function p() {
5
+ return T = (T + 1) % Number.MAX_SAFE_INTEGER, T.toString();
6
+ }
7
+ const a = /* @__PURE__ */ new Map();
8
+ function S(t) {
9
+ if (a.has(t))
10
+ return;
11
+ const s = setTimeout(() => {
12
+ a.delete(t), n({
13
+ type: "REMOVE_TOAST",
14
+ toastId: t
15
+ });
16
+ }, f);
17
+ a.set(t, s);
18
+ }
19
+ function A(t, s) {
20
+ switch (s.type) {
21
+ case "ADD_TOAST":
22
+ return {
23
+ ...t,
24
+ toasts: [s.toast, ...t.toasts].slice(0, d)
25
+ };
26
+ case "UPDATE_TOAST":
27
+ return {
28
+ ...t,
29
+ toasts: t.toasts.map(
30
+ (e) => e.id === s.toast.id ? { ...e, ...s.toast } : e
31
+ )
32
+ };
33
+ case "DISMISS_TOAST": {
34
+ const { toastId: e } = s;
35
+ return e ? S(e) : t.toasts.forEach((o) => {
36
+ S(o.id);
37
+ }), {
38
+ ...t,
39
+ toasts: t.toasts.map(
40
+ (o) => o.id === e || e === void 0 ? {
41
+ ...o,
42
+ open: !1
43
+ } : o
44
+ )
45
+ };
46
+ }
47
+ case "REMOVE_TOAST":
48
+ return s.toastId === void 0 ? {
49
+ ...t,
50
+ toasts: []
51
+ } : {
52
+ ...t,
53
+ toasts: t.toasts.filter((e) => e.id !== s.toastId)
54
+ };
55
+ }
56
+ }
57
+ const r = [];
58
+ let u = { toasts: [] };
59
+ function n(t) {
60
+ u = A(u, t), r.forEach((s) => {
61
+ s(u);
62
+ });
63
+ }
64
+ function O({ ...t }) {
65
+ const s = p(), e = (i) => n({
66
+ type: "UPDATE_TOAST",
67
+ toast: { ...i, id: s }
68
+ }), o = () => n({ type: "DISMISS_TOAST", toastId: s });
69
+ return n({
70
+ type: "ADD_TOAST",
71
+ toast: {
72
+ ...t,
73
+ id: s,
74
+ open: !0,
75
+ onOpenChange: (i) => {
76
+ i || o();
77
+ }
78
+ }
79
+ }), {
80
+ id: s,
81
+ dismiss: o,
82
+ update: e
83
+ };
84
+ }
85
+ function E() {
86
+ const [t, s] = c.useState(u);
87
+ return c.useEffect(() => (r.push(s), () => {
88
+ const e = r.indexOf(s);
89
+ e > -1 && r.splice(e, 1);
90
+ }), [t]), {
91
+ ...t,
92
+ toast: O,
93
+ dismiss: (e) => n({ type: "DISMISS_TOAST", toastId: e })
94
+ };
95
+ }
96
+ export {
97
+ E as u
98
+ };
@@ -0,0 +1,141 @@
1
+ import { c as D } from "./clsx-OuTLNxxd.js";
2
+ import { useState as x, useEffect as C, useMemo as d } from "react";
3
+ import { e as V, a as b } from "./index-BPfVXs5_.js";
4
+ import { u as E } from "./index-DYkucCoF.js";
5
+ let y;
6
+ function g() {
7
+ return y === void 0 && (y = navigator.platform.includes("Mac")), y;
8
+ }
9
+ function j(t) {
10
+ return `${t}`.toLowerCase() === "mod" ? g() ? "⌘" : "Ctrl" : `${t}`.toLowerCase() === "alt" ? g() ? "⌥" : "Alt" : `${t}`.toLowerCase() === "shift" ? g() ? "⇧" : "Shift" : t;
11
+ }
12
+ function W(t) {
13
+ return t.map(j).join(" ");
14
+ }
15
+ const S = (t) => typeof t == "boolean" ? `${t}` : t === 0 ? "0" : t, h = D, _ = (t, e) => (n) => {
16
+ var o;
17
+ if ((e == null ? void 0 : e.variants) == null) return h(t, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
18
+ const { variants: r, defaultVariants: u } = e, i = Object.keys(r).map((a) => {
19
+ const l = n == null ? void 0 : n[a], m = u == null ? void 0 : u[a];
20
+ if (l === null) return null;
21
+ const f = S(l) || S(m);
22
+ return r[a][f];
23
+ }), s = n && Object.entries(n).reduce((a, l) => {
24
+ let [m, f] = l;
25
+ return f === void 0 || (a[m] = f), a;
26
+ }, {}), c = e == null || (o = e.compoundVariants) === null || o === void 0 ? void 0 : o.reduce((a, l) => {
27
+ let { class: m, className: f, ...M } = l;
28
+ return Object.entries(M).every((U) => {
29
+ let [N, v] = U;
30
+ return Array.isArray(v) ? v.includes({
31
+ ...u,
32
+ ...s
33
+ }[N]) : {
34
+ ...u,
35
+ ...s
36
+ }[N] === v;
37
+ }) ? [
38
+ ...a,
39
+ m,
40
+ f
41
+ ] : a;
42
+ }, []);
43
+ return h(t, i, c, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
44
+ }, p = () => !1;
45
+ function z(t = p) {
46
+ const e = V(), [n, o] = x(() => {
47
+ const s = t();
48
+ return typeof s == "boolean" ? !s : s;
49
+ }), r = b();
50
+ C(() => {
51
+ if (!r || !t) return;
52
+ const s = () => {
53
+ const c = t();
54
+ o(typeof c == "boolean" ? !c : c);
55
+ };
56
+ return s(), r.on("selectionUpdate", s), r.on("transaction", s), () => {
57
+ r.off("selectionUpdate", s), r.off("transaction", s);
58
+ };
59
+ }, [r, t]);
60
+ const u = d(() => !e || !r ? !0 : typeof n == "boolean" ? n : !1, [e, r, n]), i = d(() => !e || !r, [e, r]);
61
+ return {
62
+ disabled: u,
63
+ // can not action, opacity < 1
64
+ dataState: n,
65
+ // true => show background, false => no background
66
+ editorDisabled: i
67
+ };
68
+ }
69
+ function B(t = p) {
70
+ const e = V(), [n, o] = x({}), [r, u] = x(t()), i = b();
71
+ C(() => {
72
+ if (!i || !t) return;
73
+ const a = () => {
74
+ u(t());
75
+ };
76
+ return a(), i.on("selectionUpdate", a), () => {
77
+ i.off("selectionUpdate", a);
78
+ };
79
+ }, [n, i, t]);
80
+ const s = d(() => !e || !i, [e, i]), c = d(() => !e || !i, [e, i]);
81
+ return {
82
+ disabled: s,
83
+ // can not action, opacity < 1
84
+ dataState: r,
85
+ // true => show background, false => no background
86
+ editorDisabled: c,
87
+ update: () => o({})
88
+ // force update
89
+ };
90
+ }
91
+ function O(t) {
92
+ const e = b();
93
+ return d(() => e ? e.extensionManager.extensions.find((o) => o.name === t) : null, [e, t]);
94
+ }
95
+ function I(t, e, n) {
96
+ return t < e ? e : t > n ? n : t;
97
+ }
98
+ const P = (t) => typeof t == "number", $ = (t) => typeof t == "string", L = (t) => typeof t == "function";
99
+ function R(t, e = "px") {
100
+ if (!t)
101
+ return t;
102
+ const n = P(t) ? String(t) : t, o = Number.parseFloat(n), r = n.match(/[%a-z]+$/i), u = r ? r[0] : e;
103
+ return Number.isNaN(o) ? t : o + u;
104
+ }
105
+ function k(t, e) {
106
+ if (!t)
107
+ return !1;
108
+ const { extensions: n = [] } = (t == null ? void 0 : t.extensionManager) ?? {};
109
+ return !!n.find((r) => r.name === e);
110
+ }
111
+ function q(t) {
112
+ return t.map((e) => $(e) ? { value: e, name: e } : e);
113
+ }
114
+ function A(t) {
115
+ const e = b(), n = O(t), { t: o } = E();
116
+ return d(() => {
117
+ if (!e || !n)
118
+ return null;
119
+ const {
120
+ button: r
121
+ } = n.options;
122
+ return !r || !L(r) ? null : r({
123
+ editor: e,
124
+ extension: n,
125
+ t: o
126
+ });
127
+ }, [e, n, o]);
128
+ }
129
+ export {
130
+ B as a,
131
+ z as b,
132
+ _ as c,
133
+ O as d,
134
+ q as e,
135
+ R as f,
136
+ W as g,
137
+ j as h,
138
+ I as i,
139
+ k as j,
140
+ A as u
141
+ };
@@ -0,0 +1 @@
1
+ "use strict";const U=require("./clsx-C11secjj.cjs"),c=require("react"),m=require("./index-DV5kbgRU.cjs"),D=require("./index-Dfmm6FTT.cjs");let y;function g(){return y===void 0&&(y=navigator.platform.includes("Mac")),y}function h(t){return`${t}`.toLowerCase()==="mod"?g()?"⌘":"Ctrl":`${t}`.toLowerCase()==="alt"?g()?"⌥":"Alt":`${t}`.toLowerCase()==="shift"?g()?"⇧":"Shift":t}function O(t){return t.map(h).join(" ")}const S=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,E=U.clsx,P=(t,n)=>e=>{var o;if((n==null?void 0:n.variants)==null)return E(t,e==null?void 0:e.class,e==null?void 0:e.className);const{variants:s,defaultVariants:i}=n,a=Object.keys(s).map(u=>{const f=e==null?void 0:e[u],b=i==null?void 0:i[u];if(f===null)return null;const d=S(f)||S(b);return s[u][d]}),r=e&&Object.entries(e).reduce((u,f)=>{let[b,d]=f;return d===void 0||(u[b]=d),u},{}),l=n==null||(o=n.compoundVariants)===null||o===void 0?void 0:o.reduce((u,f)=>{let{class:b,className:d,...C}=f;return Object.entries(C).every(V=>{let[x,v]=V;return Array.isArray(v)?v.includes({...i,...r}[x]):{...i,...r}[x]===v})?[...u,b,d]:u},[]);return E(t,a,l,e==null?void 0:e.class,e==null?void 0:e.className)},M=()=>!1;function $(t=M){const n=m.useEditableEditor(),[e,o]=c.useState(()=>{const r=t();return typeof r=="boolean"?!r:r}),s=m.useEditorInstance();c.useEffect(()=>{if(!s||!t)return;const r=()=>{const l=t();o(typeof l=="boolean"?!l:l)};return r(),s.on("selectionUpdate",r),s.on("transaction",r),()=>{s.off("selectionUpdate",r),s.off("transaction",r)}},[s,t]);const i=c.useMemo(()=>!n||!s?!0:typeof e=="boolean"?e:!1,[n,s,e]),a=c.useMemo(()=>!n||!s,[n,s]);return{disabled:i,dataState:e,editorDisabled:a}}function p(t=M){const n=m.useEditableEditor(),[e,o]=c.useState({}),[s,i]=c.useState(t()),a=m.useEditorInstance();c.useEffect(()=>{if(!a||!t)return;const u=()=>{i(t())};return u(),a.on("selectionUpdate",u),()=>{a.off("selectionUpdate",u)}},[e,a,t]);const r=c.useMemo(()=>!n||!a,[n,a]),l=c.useMemo(()=>!n||!a,[n,a]);return{disabled:r,dataState:s,editorDisabled:l,update:()=>o({})}}function N(t){const n=m.useEditorInstance();return c.useMemo(()=>n?n.extensionManager.extensions.find(o=>o.name===t):null,[n,t])}function K(t,n,e){return t<n?n:t>e?e:t}const j=t=>typeof t=="number",q=t=>typeof t=="string",I=t=>typeof t=="function";function L(t,n="px"){if(!t)return t;const e=j(t)?String(t):t,o=Number.parseFloat(e),s=e.match(/[%a-z]+$/i),i=s?s[0]:n;return Number.isNaN(o)?t:o+i}function w(t,n){if(!t)return!1;const{extensions:e=[]}=(t==null?void 0:t.extensionManager)??{};return!!e.find(s=>s.name===n)}function T(t){return t.map(n=>q(n)?{value:n,name:n}:n)}function W(t){const n=m.useEditorInstance(),e=N(t),{t:o}=D.useLocale();return c.useMemo(()=>{if(!n||!e)return null;const{button:s}=e.options;return!s||!I(s)?null:s({editor:n,extension:e,t:o})},[n,e,o])}exports.clamp=K;exports.cva=P;exports.ensureNameValueOptions=T;exports.getCssUnitWithDefault=L;exports.getShortcutKey=h;exports.getShortcutKeys=O;exports.hasExtension=w;exports.useActive=$;exports.useButtonProps=W;exports.useExtension=N;exports.useToggleActive=p;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactjs-tiptap-editor",
3
3
  "type": "module",
4
- "version": "0.4.1",
4
+ "version": "1.0.0",
5
5
  "packageManager": "pnpm@8.15.9",
6
6
  "description": "A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React",
7
7
  "license": "MIT",
@@ -31,6 +31,11 @@
31
31
  "main": "./lib/index.cjs",
32
32
  "module": "./lib/index.js",
33
33
  "types": "./lib/index.d.ts",
34
+ "pnpm": {
35
+ "overrides": {
36
+ "prosemirror-view": "1.41.1"
37
+ }
38
+ },
34
39
  "exports": {
35
40
  ".": {
36
41
  "require": {
@@ -52,14 +57,14 @@
52
57
  "default": "./lib/locale-bundle.js"
53
58
  }
54
59
  },
55
- "./bubble-extra": {
60
+ "./bubble": {
56
61
  "require": {
57
- "types": "./lib/bubble-extra.d.cts",
58
- "default": "./lib/bubble-extra.cjs"
62
+ "types": "./lib/bubble.d.cts",
63
+ "default": "./lib/bubble.cjs"
59
64
  },
60
65
  "import": {
61
- "types": "./lib/bubble-extra.d.ts",
62
- "default": "./lib/bubble-extra.js"
66
+ "types": "./lib/bubble.d.ts",
67
+ "default": "./lib/bubble.js"
63
68
  }
64
69
  },
65
70
  "./style.css": {
@@ -169,16 +174,6 @@
169
174
  "default": "./lib/Color.js"
170
175
  }
171
176
  },
172
- "./document": {
173
- "require": {
174
- "types": "./lib/Document.d.cts",
175
- "default": "./lib/Document.cjs"
176
- },
177
- "import": {
178
- "types": "./lib/Document.d.ts",
179
- "default": "./lib/Document.js"
180
- }
181
- },
182
177
  "./drawer": {
183
178
  "require": {
184
179
  "types": "./lib/Drawer.d.cts",
@@ -249,16 +244,6 @@
249
244
  "default": "./lib/FontSize.js"
250
245
  }
251
246
  },
252
- "./formatpainter": {
253
- "require": {
254
- "types": "./lib/FormatPainter.d.cts",
255
- "default": "./lib/FormatPainter.cjs"
256
- },
257
- "import": {
258
- "types": "./lib/FormatPainter.d.ts",
259
- "default": "./lib/FormatPainter.js"
260
- }
261
- },
262
247
  "./heading": {
263
248
  "require": {
264
249
  "types": "./lib/Heading.d.cts",
@@ -429,14 +414,14 @@
429
414
  "default": "./lib/MoreMark.js"
430
415
  }
431
416
  },
432
- "./multicolumn": {
417
+ "./column": {
433
418
  "require": {
434
- "types": "./lib/MultiColumn.d.cts",
435
- "default": "./lib/MultiColumn.cjs"
419
+ "types": "./lib/Column.d.cts",
420
+ "default": "./lib/Column.cjs"
436
421
  },
437
422
  "import": {
438
- "types": "./lib/MultiColumn.d.ts",
439
- "default": "./lib/MultiColumn.js"
423
+ "types": "./lib/Column.d.ts",
424
+ "default": "./lib/Column.js"
440
425
  }
441
426
  },
442
427
  "./orderedlist": {
@@ -459,16 +444,6 @@
459
444
  "default": "./lib/SearchAndReplace.js"
460
445
  }
461
446
  },
462
- "./selection": {
463
- "require": {
464
- "types": "./lib/Selection.d.cts",
465
- "default": "./lib/Selection.cjs"
466
- },
467
- "import": {
468
- "types": "./lib/Selection.d.ts",
469
- "default": "./lib/Selection.js"
470
- }
471
- },
472
447
  "./slashcommand": {
473
448
  "require": {
474
449
  "types": "./lib/SlashCommand.d.cts",
@@ -489,16 +464,6 @@
489
464
  "default": "./lib/Strike.js"
490
465
  }
491
466
  },
492
- "./subandsuperscript": {
493
- "require": {
494
- "types": "./lib/SubAndSuperScript.d.cts",
495
- "default": "./lib/SubAndSuperScript.cjs"
496
- },
497
- "import": {
498
- "types": "./lib/SubAndSuperScript.d.ts",
499
- "default": "./lib/SubAndSuperScript.js"
500
- }
501
- },
502
467
  "./table": {
503
468
  "require": {
504
469
  "types": "./lib/Table.d.cts",
@@ -509,16 +474,6 @@
509
474
  "default": "./lib/Table.js"
510
475
  }
511
476
  },
512
- "./tableofcontent": {
513
- "require": {
514
- "types": "./lib/TableOfContent.d.cts",
515
- "default": "./lib/TableOfContent.cjs"
516
- },
517
- "import": {
518
- "types": "./lib/TableOfContent.d.ts",
519
- "default": "./lib/TableOfContent.js"
520
- }
521
- },
522
477
  "./tasklist": {
523
478
  "require": {
524
479
  "types": "./lib/TaskList.d.cts",
@@ -539,16 +494,6 @@
539
494
  "default": "./lib/TextAlign.js"
540
495
  }
541
496
  },
542
- "./textbubble": {
543
- "require": {
544
- "types": "./lib/TextBubble.d.cts",
545
- "default": "./lib/TextBubble.cjs"
546
- },
547
- "import": {
548
- "types": "./lib/TextBubble.d.ts",
549
- "default": "./lib/TextBubble.js"
550
- }
551
- },
552
497
  "./textdirection": {
553
498
  "require": {
554
499
  "types": "./lib/TextDirection.d.cts",
@@ -569,16 +514,6 @@
569
514
  "default": "./lib/TextUnderline.js"
570
515
  }
571
516
  },
572
- "./trailingnode": {
573
- "require": {
574
- "types": "./lib/TrailingNode.d.cts",
575
- "default": "./lib/TrailingNode.cjs"
576
- },
577
- "import": {
578
- "types": "./lib/TrailingNode.d.ts",
579
- "default": "./lib/TrailingNode.js"
580
- }
581
- },
582
517
  "./twitter": {
583
518
  "require": {
584
519
  "types": "./lib/Twitter.d.cts",
@@ -612,9 +547,6 @@
612
547
  "./lib/*",
613
548
  "./*"
614
549
  ],
615
- "./base-kit": [
616
- "./lib/BaseKit.d.ts"
617
- ],
618
550
  "./attachment": [
619
551
  "./lib/Attachment.d.ts"
620
552
  ],
@@ -666,9 +598,6 @@
666
598
  "./fontsize": [
667
599
  "./lib/FontSize.d.ts"
668
600
  ],
669
- "./formatpainter": [
670
- "./lib/FormatPainter.d.ts"
671
- ],
672
601
  "./heading": [
673
602
  "./lib/Heading.d.ts"
674
603
  ],
@@ -720,8 +649,8 @@
720
649
  "./moremark": [
721
650
  "./lib/MoreMark.d.ts"
722
651
  ],
723
- "./multicolumn": [
724
- "./lib/MultiColumn.d.ts"
652
+ "./column": [
653
+ "./lib/Column.d.ts"
725
654
  ],
726
655
  "./orderedlist": [
727
656
  "./lib/OrderedList.d.ts"
@@ -729,42 +658,27 @@
729
658
  "./searchandreplace": [
730
659
  "./lib/SearchAndReplace.d.ts"
731
660
  ],
732
- "./selection": [
733
- "./lib/Selection.d.ts"
734
- ],
735
661
  "./slashcommand": [
736
662
  "./lib/SlashCommand.d.ts"
737
663
  ],
738
664
  "./strike": [
739
665
  "./lib/Strike.d.ts"
740
666
  ],
741
- "./subandsuperscript": [
742
- "./lib/SubAndSuperScript.d.ts"
743
- ],
744
667
  "./table": [
745
668
  "./lib/Table.d.ts"
746
669
  ],
747
- "./tableofcontent": [
748
- "./lib/TableOfContent.d.ts"
749
- ],
750
670
  "./tasklist": [
751
671
  "./lib/TaskList.d.ts"
752
672
  ],
753
673
  "./textalign": [
754
674
  "./lib/TextAlign.d.ts"
755
675
  ],
756
- "./textbubble": [
757
- "./lib/TextBubble.d.ts"
758
- ],
759
676
  "./textdirection": [
760
677
  "./lib/TextDirection.d.ts"
761
678
  ],
762
679
  "./textunderline": [
763
680
  "./lib/TextUnderline.d.ts"
764
681
  ],
765
- "./trailingnode": [
766
- "./lib/TrailingNode.d.ts"
767
- ],
768
682
  "./twitter": [
769
683
  "./lib/Twitter.d.ts"
770
684
  ],
@@ -805,6 +719,7 @@
805
719
  "dependencies": {
806
720
  "@excalidraw/excalidraw": "^0.18.0",
807
721
  "@floating-ui/dom": "^1.7.4",
722
+ "@hocuspocus/provider": "^3.4.0",
808
723
  "@radix-ui/react-checkbox": "^1.3.3",
809
724
  "@radix-ui/react-dialog": "^1.1.15",
810
725
  "@radix-ui/react-dropdown-menu": "^2.1.16",
@@ -825,6 +740,7 @@
825
740
  "@tiptap/extension-bullet-list": "^3.11.1",
826
741
  "@tiptap/extension-code": "^3.11.1",
827
742
  "@tiptap/extension-collaboration": "^3.12.0",
743
+ "@tiptap/extension-collaboration-caret": "^3.12.0",
828
744
  "@tiptap/extension-document": "^3.11.1",
829
745
  "@tiptap/extension-drag-handle": "^3.12.0",
830
746
  "@tiptap/extension-drag-handle-react": "^3.12.0",
@@ -860,6 +776,7 @@
860
776
  "class-variance-authority": "^0.7.1",
861
777
  "clsx": "^2.1.1",
862
778
  "deep-equal": "^2.2.3",
779
+ "docx": "^9.5.1",
863
780
  "easydrawer": "^0.0.15",
864
781
  "frimousse": "^0.3.0",
865
782
  "katex": "^0.16.25",
@@ -872,7 +789,7 @@
872
789
  "react-colorful": "^5.6.1",
873
790
  "react-image-crop": "^11.0.10",
874
791
  "react-tweet": "^3.2.2",
875
- "reactjs-signal": "^1.1.3",
792
+ "reactjs-signal": "^2.0.1",
876
793
  "scroll-into-view-if-needed": "^3.1.0",
877
794
  "svg64": "^2.0.0",
878
795
  "y-protocols": "^1.0.6",
@@ -1 +0,0 @@
1
- "use strict";const e=require("react/jsx-runtime"),r=require("react"),a=require("@radix-ui/react-slot"),i=require("./RichTextEditor-CxvwGvQG.cjs"),d=r.forwardRef(({asChild:n,...t},h)=>{var x;const c=i.icons[t.icon],l=n?a.Slot:i.Button;return e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(l,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",disabled:t==null?void 0:t.disabled,ref:h,variant:"ghost",...t,children:e.jsxs("div",{className:"richtext-flex richtext-h-full richtext-items-center richtext-font-normal",children:[(t==null?void 0:t.title)&&e.jsx("div",{className:"richtext-grow richtext-truncate richtext-text-left richtext-text-sm",children:t==null?void 0:t.title}),c&&e.jsx(c,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),e.jsx(i.TooltipContent,{...t.tooltipOptions,children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[(t==null?void 0:t.tooltip)&&e.jsx("div",{children:t==null?void 0:t.tooltip}),e.jsx("div",{className:"richtext-flex",children:!!((x=t==null?void 0:t.shortcutKeys)!=null&&x.length)&&e.jsx("span",{children:i.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=d;
@@ -1,33 +0,0 @@
1
- import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
- import n from "react";
3
- import { Slot as a } from "@radix-ui/react-slot";
4
- import { i as d, T as r, a as m, B as f, b as u, g as o } from "./RichTextEditor-DGcKEUGr.js";
5
- const T = n.forwardRef(
6
- ({ asChild: l, ...t }, x) => {
7
- var h;
8
- const c = d[t.icon];
9
- return /* @__PURE__ */ i(r, { children: [
10
- /* @__PURE__ */ e(m, { asChild: !0, children: /* @__PURE__ */ e(
11
- l ? a : f,
12
- {
13
- className: "richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",
14
- disabled: t == null ? void 0 : t.disabled,
15
- ref: x,
16
- variant: "ghost",
17
- ...t,
18
- children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-h-full richtext-items-center richtext-font-normal", children: [
19
- (t == null ? void 0 : t.title) && /* @__PURE__ */ e("div", { className: "richtext-grow richtext-truncate richtext-text-left richtext-text-sm", children: t == null ? void 0 : t.title }),
20
- c && /* @__PURE__ */ e(c, { className: "richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500" })
21
- ] })
22
- }
23
- ) }),
24
- /* @__PURE__ */ e(u, { ...t.tooltipOptions, children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
25
- (t == null ? void 0 : t.tooltip) && /* @__PURE__ */ e("div", { children: t == null ? void 0 : t.tooltip }),
26
- /* @__PURE__ */ e("div", { className: "richtext-flex", children: !!((h = t == null ? void 0 : t.shortcutKeys) != null && h.length) && /* @__PURE__ */ e("span", { children: o(t == null ? void 0 : t.shortcutKeys) }) })
27
- ] }) })
28
- ] });
29
- }
30
- );
31
- export {
32
- T as A
33
- };
package/lib/BaseKit.cjs DELETED
@@ -1,3 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-DF2Lp4HZ.cjs"),x=require("./index-B96Cclrj.cjs"),M=require("./index-Dbvi-Bvh.cjs"),m=require("./index-5iBZLua9.cjs"),b=require("./index-BeCTd5v2.cjs"),i=require("./index-DsAX1Vq8.cjs"),g=require("./RichTextEditor-CxvwGvQG.cjs"),y=require("./TextBubble.cjs"),h=require("./index-6D1J-A-o.cjs");var T=n.Node3.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",n.mergeAttributes(this.options.HTMLAttributes,t)]},renderText(){return`
2
- `},renderMarkdown:()=>`
3
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:r,state:s,editor:e})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:f}=s;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:u}=this.options,{splittableMarks:p}=e.extensionManager,a=f||o.$to.parentOffset&&o.$from.marks();return r().insertContent({type:this.name}).command(({tr:c,dispatch:l})=>{if(l&&a&&u){const d=a.filter(k=>p.includes(k.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),B=n.Node3.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",n.mergeAttributes(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,r)=>{const s=t.tokens||[];return s.length===1&&s[0].type==="image"?r.parseChildren([s[0]]):r.createNode("paragraph",void 0,r.parseInline(s))},renderMarkdown:(t,r)=>!t||!Array.isArray(t.content)?"":r.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),C=n.Node3.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});const A=n.Extension.create({name:"base-kit",addExtensions(){var r,s;const t=[];return this.options.placeholder!==!1&&t.push(i.Placeholder.configure({placeholder:({node:e,pos:o,editor:f})=>{var u,p,a,c,l;return((u=e==null?void 0:e.type)==null?void 0:u.name)==="columns"||((p=e==null?void 0:e.content)==null?void 0:p.size)!==0?"":((a=e==null?void 0:e.type)==null?void 0:a.name)==="heading"?`${h.localeActions.t(`editor.heading.h${e.attrs.level}.tooltip`)}`:((c=e==null?void 0:e.type)==null?void 0:c.name)==="codeBlock"||((l=e==null?void 0:e.type)==null?void 0:l.name)==="table"?"":f.extensionManager.extensions.some(d=>d.name==="slashCommand")?h.localeActions.t("editor.slash"):h.localeActions.t("editor.content")},...this.options.placeholder})),this.options.focus!==!1&&t.push(i.Focus.configure({className:"focus",...this.options.focus})),this.options.textBubble!==!1&&t.push(y.TextBubble.configure()),this.options.characterCount!==!1&&t.push(i.CharacterCount.configure(this.options.characterCount)),this.options.textStyle!==!1&&t.push(b.TextStyle.configure(this.options.textStyle)),this.options.selection!==!1&&t.push(i.Selection),this.options.multiColumn!==!1&&t.push(g.Column,g.MultiColumn),this.options.document!==!1&&t.push(x.Document.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(i.Dropcursor.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(i.Gapcursor.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(T.configure(this.options.hardBreak)),this.options.horizontalRule!==!1&&t.push(M.HorizontalRule.configure(this.options.horizontalRule)),this.options.listItem!==!1&&t.push(m.ListItem.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(m.ListKeymap.configure((r=this.options)==null?void 0:r.listKeymap)),this.options.paragraph!==!1&&t.push(B.configure(this.options.paragraph)),this.options.text!==!1&&t.push(C.configure(this.options.text)),this.options.trailingNode!==!1&&t.push(i.TrailingNode.configure((s=this.options)==null?void 0:s.trailingNode)),t}});exports.BaseKit=A;