reactjs-tiptap-editor 0.4.2 → 1.0.1

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 +27 -39
  5. package/lib/Attachment.d.ts +27 -39
  6. package/lib/Attachment.js +129 -99
  7. package/lib/Blockquote.cjs +3 -3
  8. package/lib/Blockquote.d.cts +27 -39
  9. package/lib/Blockquote.d.ts +27 -39
  10. package/lib/Blockquote.js +50 -22
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +27 -39
  13. package/lib/Bold.d.ts +27 -39
  14. package/lib/Bold.js +48 -20
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +27 -39
  17. package/lib/BulletList.d.ts +27 -39
  18. package/lib/BulletList.js +38 -9
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +27 -39
  21. package/lib/Clear.d.ts +27 -39
  22. package/lib/Clear.js +32 -6
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +27 -39
  25. package/lib/Code.d.ts +27 -39
  26. package/lib/Code.js +53 -25
  27. package/lib/CodeBlock.cjs +35 -35
  28. package/lib/CodeBlock.d.cts +27 -39
  29. package/lib/CodeBlock.d.ts +27 -39
  30. package/lib/CodeBlock.js +605 -590
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +28 -40
  33. package/lib/CodeView.d.ts +28 -40
  34. package/lib/CodeView.js +49 -21
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +31 -39
  37. package/lib/Color.d.ts +31 -39
  38. package/lib/Color.js +123 -79
  39. package/lib/Column.cjs +1 -0
  40. package/lib/{Document.d.cts → Column.d.cts} +33 -42
  41. package/lib/{Document.d.ts → Column.d.ts} +33 -42
  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 +27 -39
  47. package/lib/Drawer.d.ts +27 -39
  48. package/lib/Drawer.js +6 -5
  49. package/lib/Emoji.cjs +1 -1
  50. package/lib/Emoji.d.cts +27 -44
  51. package/lib/Emoji.d.ts +27 -44
  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 +27 -39
  57. package/lib/Excalidraw.d.ts +27 -39
  58. package/lib/Excalidraw.js +6 -4
  59. package/lib/ExportPdf.cjs +5 -5
  60. package/lib/ExportPdf.d.cts +27 -39
  61. package/lib/ExportPdf.d.ts +27 -39
  62. package/lib/ExportPdf.js +60 -32
  63. package/lib/ExportWord.cjs +1 -1
  64. package/lib/ExportWord.d.cts +28 -40
  65. package/lib/ExportWord.d.ts +28 -40
  66. package/lib/ExportWord.js +84 -21
  67. package/lib/FontFamily.cjs +1 -1
  68. package/lib/FontFamily.d.cts +41 -42
  69. package/lib/FontFamily.d.ts +41 -42
  70. package/lib/FontFamily.js +72 -74
  71. package/lib/FontSize.cjs +1 -1
  72. package/lib/FontSize.d.cts +38 -42
  73. package/lib/FontSize.d.ts +38 -42
  74. package/lib/FontSize.js +72 -64
  75. package/lib/Heading.cjs +1 -1
  76. package/lib/Heading.d.cts +41 -39
  77. package/lib/Heading.d.ts +41 -39
  78. package/lib/Heading.js +91 -73
  79. package/lib/Highlight.cjs +1 -1
  80. package/lib/Highlight.d.cts +31 -39
  81. package/lib/Highlight.d.ts +31 -39
  82. package/lib/Highlight.js +150 -19
  83. package/lib/History.cjs +1 -1
  84. package/lib/History.d.cts +29 -39
  85. package/lib/History.d.ts +29 -39
  86. package/lib/History.js +976 -53
  87. package/lib/HorizontalRule.cjs +1 -1
  88. package/lib/HorizontalRule.d.cts +27 -39
  89. package/lib/HorizontalRule.d.ts +27 -39
  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 +26 -45
  97. package/lib/Iframe.d.ts +26 -45
  98. package/lib/Iframe.js +6 -4
  99. package/lib/Image.cjs +1 -1
  100. package/lib/Image.d.cts +27 -40
  101. package/lib/Image.d.ts +27 -40
  102. package/lib/Image.js +848 -5
  103. package/lib/ImageGif.cjs +1 -1
  104. package/lib/ImageGif.d.cts +28 -42
  105. package/lib/ImageGif.d.ts +28 -42
  106. package/lib/ImageGif.js +424 -5
  107. package/lib/ImportWord.cjs +48 -48
  108. package/lib/ImportWord.d.cts +28 -40
  109. package/lib/ImportWord.d.ts +28 -40
  110. package/lib/ImportWord.js +2759 -2751
  111. package/lib/Indent.cjs +1 -1
  112. package/lib/Indent.d.cts +27 -39
  113. package/lib/Indent.d.ts +27 -39
  114. package/lib/Indent.js +97 -27
  115. package/lib/Italic.cjs +1 -1
  116. package/lib/Italic.d.cts +27 -39
  117. package/lib/Italic.d.ts +27 -39
  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 +27 -39
  123. package/lib/Katex.d.ts +27 -39
  124. package/lib/Katex.js +5 -196
  125. package/lib/LineHeight.cjs +1 -1
  126. package/lib/LineHeight.d.cts +29 -45
  127. package/lib/LineHeight.d.ts +29 -45
  128. package/lib/LineHeight.js +71 -112
  129. package/lib/Link.cjs +1 -1
  130. package/lib/Link.d.cts +28 -42
  131. package/lib/Link.d.ts +28 -42
  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 +24 -39
  137. package/lib/Mention.d.ts +24 -39
  138. package/lib/Mention.js +112 -124
  139. package/lib/Mermaid.cjs +2 -2
  140. package/lib/Mermaid.d.cts +27 -39
  141. package/lib/Mermaid.d.ts +27 -39
  142. package/lib/Mermaid.js +177 -165
  143. package/lib/MoreMark.cjs +1 -1
  144. package/lib/MoreMark.d.cts +42 -41
  145. package/lib/MoreMark.d.ts +42 -41
  146. package/lib/MoreMark.js +125 -55
  147. package/lib/OrderedList.cjs +1 -1
  148. package/lib/OrderedList.d.cts +27 -39
  149. package/lib/OrderedList.d.ts +27 -39
  150. package/lib/OrderedList.js +37 -9
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +27 -42
  153. package/lib/SearchAndReplace.d.ts +27 -42
  154. package/lib/SearchAndReplace.js +221 -197
  155. package/lib/SlashCommand.cjs +1 -1
  156. package/lib/SlashCommand.d.cts +39 -46
  157. package/lib/SlashCommand.d.ts +39 -46
  158. package/lib/SlashCommand.js +235 -249
  159. package/lib/Strike.cjs +1 -1
  160. package/lib/Strike.d.cts +27 -39
  161. package/lib/Strike.d.ts +27 -39
  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 +28 -42
  167. package/lib/Table.d.ts +28 -42
  168. package/lib/Table.js +3 -558
  169. package/lib/TaskList.cjs +1 -1
  170. package/lib/TaskList.d.cts +27 -39
  171. package/lib/TaskList.d.ts +27 -39
  172. package/lib/TaskList.js +38 -10
  173. package/lib/TextAlign.cjs +1 -1
  174. package/lib/TextAlign.d.cts +40 -39
  175. package/lib/TextAlign.d.ts +40 -39
  176. package/lib/TextAlign.js +108 -101
  177. package/lib/TextDirection.cjs +1 -1
  178. package/lib/TextDirection.d.cts +56 -39
  179. package/lib/TextDirection.d.ts +56 -39
  180. package/lib/TextDirection.js +105 -112
  181. package/lib/TextUnderline.cjs +1 -1
  182. package/lib/TextUnderline.d.cts +27 -39
  183. package/lib/TextUnderline.d.ts +27 -39
  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 +27 -39
  189. package/lib/Twitter.d.ts +27 -39
  190. package/lib/Twitter.js +5 -4
  191. package/lib/Video.cjs +1 -1
  192. package/lib/Video.d.cts +27 -39
  193. package/lib/Video.d.ts +27 -39
  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} +53 -54
  199. package/lib/{bubble-extra.d.ts → bubble.d.ts} +53 -54
  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 +29 -280
  235. package/lib/index.d.ts +29 -280
  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 +5405 -57
  245. package/lib/locale-bundle.d.ts +5405 -57
  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
package/lib/Mermaid.js CHANGED
@@ -1,118 +1,129 @@
1
- import { q as G, m as X } from "./index-kbO3iWqL.js";
2
- import { t as Z, u as Y, A as J, v as K, w as Q, x as tt, B as et, y as rt, z as q, E as it, F as at } from "./RichTextEditor-DGcKEUGr.js";
3
- import { N as st, R as nt } from "./dom-dataset-lYeH6gfI.js";
4
- import { jsxs as H, jsx as o } from "react/jsx-runtime";
5
- import { useState as m, useRef as ot, useCallback as y, useEffect as R, useMemo as F } from "react";
6
- import { s as lt, i as ct } from "./shortId-WJVkrvml.js";
7
- import { T as dt } from "./textarea-aPtytkDx.js";
8
- import { I as V, i as ht, j as W } from "./index-LmrOdnen.js";
9
- const j = `graph TB
10
- a-->b`, ut = ({ editor: e, upload: t, tooltipOptions: a }) => {
11
- const [r, g] = m(j), [_, N] = m(""), [p, I] = m(!1), M = ot(null), [n, S] = m(null), z = y(
1
+ import { q as G, m as U } from "./index-DnWWK9F_.js";
2
+ import { a as q, c as X } from "./throttle-CdwDrFpn.js";
3
+ import { N as Z, R as Y } from "./index-DzcKxutn.js";
4
+ import { jsxs as C, jsx as n, Fragment as J } from "react/jsx-runtime";
5
+ import { useState as m, useRef as K, useCallback as A, useEffect as H, useMemo as P } from "react";
6
+ import { s as Q, i as tt } from "./shortId-WJVkrvml.js";
7
+ import { A as et } from "./toggle-Cdp4IT2U.js";
8
+ import { D as rt, a as it, b as at, c as st, d as nt } from "./dialog-PtQivpHS.js";
9
+ import { T as ot } from "./textarea-DUUM1jZd.js";
10
+ import { I as V, m as W, n as lt } from "./index-DYkucCoF.js";
11
+ import { u as ct, a as dt, i as ut } from "./useButtonProps-BsEd4zYM.js";
12
+ import { a as ht } from "./index-BPfVXs5_.js";
13
+ import { d as mt } from "./file-BLas99n7.js";
14
+ import { B as gt } from "./button-DXMsXUEn.js";
15
+ const pt = `graph TB
16
+ a-->b`;
17
+ function Rt() {
18
+ const e = ht(), t = ct(vt.name), {
19
+ tooltipOptions: i = {},
20
+ isActive: s = void 0,
21
+ upload: w
22
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { editorDisabled: T } = dt(s), [c, S] = m(pt), [D, y] = m(""), [o, _] = m(!1), L = K(null), [d, B] = m(null), [g, O] = m(!0), k = A(
12
23
  (l) => {
13
- l && import("mermaid").then((f) => {
14
- S(f.default);
15
- });
24
+ l && import("mermaid").then((u) => {
25
+ B(u.default);
26
+ }).finally(() => O(!1));
16
27
  },
17
28
  []
18
- ), A = async (l) => {
29
+ ), I = async (l) => {
19
30
  try {
20
- const { svg: f } = await n.render("mermaid-svg", l);
21
- N(f);
31
+ const { svg: u } = await d.render("mermaid-svg", l);
32
+ y(u);
22
33
  } catch {
23
- N("");
34
+ y("");
24
35
  }
25
- }, B = () => {
26
- n.initialize({
36
+ }, E = () => {
37
+ d.initialize({
27
38
  darkMode: !1,
28
39
  startOnLoad: !1,
29
40
  // fontFamily:'',
30
41
  fontSize: 12,
31
42
  theme: "base"
32
- }), A(r);
43
+ }), I(c);
33
44
  };
34
- return R(() => {
35
- n && p && B();
36
- }, [n, p]), R(() => {
37
- n && p && A(r);
38
- }, [n && r]), /* @__PURE__ */ H(
39
- Z,
45
+ return H(() => {
46
+ !g && d && o && E();
47
+ }, [d, o]), H(() => {
48
+ !g && d && o && I(c);
49
+ }, [d && c]), /* @__PURE__ */ C(
50
+ rt,
40
51
  {
41
- onOpenChange: I,
42
- open: p,
52
+ onOpenChange: _,
53
+ open: o,
43
54
  children: [
44
- /* @__PURE__ */ o(Y, { asChild: !0, children: /* @__PURE__ */ o(
45
- J,
55
+ /* @__PURE__ */ n(it, { asChild: !0, children: /* @__PURE__ */ n(
56
+ et,
46
57
  {
47
- action: () => I(!0),
58
+ disabled: T,
48
59
  icon: "Mermaid",
49
60
  tooltip: "Mermaid",
50
- tooltipOptions: a
61
+ tooltipOptions: i,
62
+ action: () => {
63
+ T || _(!0);
64
+ }
51
65
  }
52
66
  ) }),
53
- /* @__PURE__ */ H(K, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
54
- /* @__PURE__ */ o(Q, { children: "Mermaid" }),
55
- /* @__PURE__ */ o(
67
+ /* @__PURE__ */ C(at, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
68
+ /* @__PURE__ */ n(st, { children: "Mermaid" }),
69
+ /* @__PURE__ */ n(
56
70
  "div",
57
71
  {
58
- ref: z,
72
+ ref: k,
59
73
  style: { height: "100%", border: "1px solid hsl(var(--border))" },
60
- children: /* @__PURE__ */ H("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
61
- /* @__PURE__ */ o(
62
- dt,
74
+ children: g ? /* @__PURE__ */ n("p", { children: "Loading..." }) : /* @__PURE__ */ n(J, { children: /* @__PURE__ */ C("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
75
+ /* @__PURE__ */ n(
76
+ ot,
63
77
  {
64
78
  autoFocus: !0,
65
79
  className: "richtext-flex-1",
66
- defaultValue: j,
67
- onChange: (l) => g(l.target.value),
80
+ onChange: (l) => S(l.target.value),
68
81
  placeholder: "Text",
69
82
  required: !0,
70
83
  rows: 10,
71
- value: r,
84
+ value: c,
72
85
  style: {
73
86
  color: "hsl(var(--richtext-foreground))"
74
87
  }
75
88
  }
76
89
  ),
77
- /* @__PURE__ */ o(
90
+ /* @__PURE__ */ n(
78
91
  "div",
79
92
  {
80
93
  className: "richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",
81
- dangerouslySetInnerHTML: { __html: _ },
82
- ref: M,
94
+ dangerouslySetInnerHTML: { __html: D },
95
+ ref: L,
83
96
  style: { height: "100%", borderWidth: 1, minHeight: 500, background: "#fff" }
84
97
  }
85
98
  )
86
- ] })
99
+ ] }) })
87
100
  }
88
101
  ),
89
- /* @__PURE__ */ o(tt, { children: /* @__PURE__ */ o(
90
- et,
102
+ /* @__PURE__ */ n(nt, { children: /* @__PURE__ */ n(
103
+ gt,
91
104
  {
105
+ disabled: !d,
92
106
  onClick: async () => {
93
- if (r !== "") {
94
- if (r) {
95
- const l = M.current.querySelector("svg"), { width: f, height: L } = l.getBoundingClientRect(), E = `mermaid-${lt()}.svg`;
96
- let x = ct(l.outerHTML);
97
- if (t) {
98
- console.log({
99
- src: x
100
- });
101
- const T = rt(x, E);
102
- x = await t(T);
107
+ if (c !== "") {
108
+ if (c) {
109
+ const l = L.current.querySelector("svg"), { width: u, height: R } = l.getBoundingClientRect(), N = `mermaid-${Q()}.svg`;
110
+ let M = tt(l.outerHTML);
111
+ if (w) {
112
+ const r = mt(M, N);
113
+ M = await w(r);
103
114
  }
104
115
  e == null || e.chain().focus().setMermaid(
105
116
  {
106
117
  type: "mermaid",
107
- src: x,
108
- alt: encodeURIComponent(r),
109
- width: f,
110
- height: L
118
+ src: M,
119
+ alt: encodeURIComponent(c),
120
+ width: u,
121
+ height: R
111
122
  },
112
- !!r
123
+ !!c
113
124
  ).run();
114
125
  }
115
- I(!1);
126
+ _(!1);
116
127
  }
117
128
  },
118
129
  type: "button",
@@ -123,143 +134,144 @@ a-->b`, ut = ({ editor: e, upload: t, tooltipOptions: a }) => {
123
134
  ]
124
135
  }
125
136
  );
126
- }, C = {
137
+ }
138
+ const z = {
127
139
  TOP_LEFT: "tl",
128
140
  TOP_RIGHT: "tr",
129
141
  BOTTOM_LEFT: "bl",
130
142
  BOTTOM_RIGHT: "br"
131
143
  };
132
- function mt({ editor: e, node: t, updateAttributes: a, getPos: r, selected: g }) {
133
- const [_, N] = m({
144
+ function ft({ editor: e, node: t, updateAttributes: i, getPos: s, selected: w }) {
145
+ const [T, c] = m({
134
146
  width: V,
135
147
  height: V
136
- }), [p, I] = m({
148
+ }), [S, D] = m({
137
149
  width: 0,
138
150
  height: 0
139
- }), [M] = m([
140
- C.TOP_LEFT,
141
- C.TOP_RIGHT,
142
- C.BOTTOM_LEFT,
143
- C.BOTTOM_RIGHT
144
- ]), [n, S] = m(!1), [z, A] = m({
151
+ }), [y] = m([
152
+ z.TOP_LEFT,
153
+ z.TOP_RIGHT,
154
+ z.BOTTOM_LEFT,
155
+ z.BOTTOM_RIGHT
156
+ ]), [o, _] = m(!1), [L, d] = m({
145
157
  x: 0,
146
158
  y: 0,
147
159
  w: 0,
148
160
  h: 0,
149
161
  dir: ""
150
- }), { align: B } = t == null ? void 0 : t.attrs, b = F(() => {
151
- const { src: i, alt: d, width: h, height: w } = t == null ? void 0 : t.attrs, v = G(h) ? `${h}px` : h, s = G(w) ? `${w}px` : w;
162
+ }), { align: B } = t == null ? void 0 : t.attrs, g = P(() => {
163
+ const { src: r, alt: p, width: f, height: b } = t == null ? void 0 : t.attrs, x = G(f) ? `${f}px` : f, a = G(b) ? `${b}px` : b;
152
164
  return {
153
- src: i || void 0,
154
- alt: d || void 0,
165
+ src: r || void 0,
166
+ alt: p || void 0,
155
167
  style: {
156
- width: v || void 0,
157
- height: s || void 0
168
+ width: x || void 0,
169
+ height: a || void 0
158
170
  }
159
171
  };
160
- }, [t == null ? void 0 : t.attrs]), l = F(() => {
172
+ }, [t == null ? void 0 : t.attrs]), O = P(() => {
161
173
  const {
162
- style: { width: i }
163
- } = b;
164
- return { width: i === "100%" ? i : void 0 };
165
- }, [b]);
166
- function f(i) {
167
- I({
168
- width: i.target.width,
169
- height: i.target.height
174
+ style: { width: r }
175
+ } = g;
176
+ return { width: r === "100%" ? r : void 0 };
177
+ }, [g]);
178
+ function k(r) {
179
+ D({
180
+ width: r.target.width,
181
+ height: r.target.height
170
182
  });
171
183
  }
172
- function L() {
173
- e.commands.setNodeSelection(r());
184
+ function I() {
185
+ e.commands.setNodeSelection(s());
174
186
  }
175
- const E = y(
187
+ const E = A(
176
188
  q(() => {
177
- const { width: i } = getComputedStyle(e.view.dom);
178
- N((d) => ({
179
- ...d,
180
- width: Number.parseInt(i, 10)
189
+ const { width: r } = getComputedStyle(e.view.dom);
190
+ c((p) => ({
191
+ ...p,
192
+ width: Number.parseInt(r, 10)
181
193
  }));
182
194
  }, W),
183
195
  [e]
184
196
  );
185
- function x(i, d) {
186
- i.preventDefault(), i.stopPropagation();
187
- const h = p.width, w = p.height, v = h / w;
188
- let s = Number(t.attrs.width), u = Number(t.attrs.height);
189
- const c = _.width;
190
- s && !u ? (s = s > c ? c : s, u = Math.round(s / v)) : u && !s ? (s = Math.round(u * v), s = s > c ? c : s) : !s && !u ? (s = h > c ? c : h, u = Math.round(s / v)) : s = s > c ? c : s, S(!0), A({
191
- x: i.clientX,
192
- y: i.clientY,
193
- w: s,
194
- h: u,
195
- dir: d
197
+ function F(r, p) {
198
+ r.preventDefault(), r.stopPropagation();
199
+ const f = S.width, b = S.height, x = f / b;
200
+ let a = Number(t.attrs.width), v = Number(t.attrs.height);
201
+ const h = T.width;
202
+ a && !v ? (a = a > h ? h : a, v = Math.round(a / x)) : v && !a ? (a = Math.round(v * x), a = a > h ? h : a) : !a && !v ? (a = f > h ? h : f, v = Math.round(a / x)) : a = a > h ? h : a, _(!0), d({
203
+ x: r.clientX,
204
+ y: r.clientY,
205
+ w: a,
206
+ h: v,
207
+ dir: p
196
208
  });
197
209
  }
198
- const T = y(
199
- q((i) => {
200
- if (i.preventDefault(), i.stopPropagation(), !n)
210
+ const l = A(
211
+ q((r) => {
212
+ if (r.preventDefault(), r.stopPropagation(), !o)
201
213
  return;
202
- const { x: d, w: h, dir: w } = z, v = (i.clientX - d) * (/l/.test(w) ? -1 : 1), { width: s, height: u } = t == null ? void 0 : t.attrs, c = s / u, $ = it(h + v, ht, _.width), U = Math.round($ / c);
203
- a({
214
+ const { x: p, w: f, dir: b } = L, x = (r.clientX - p) * (/l/.test(b) ? -1 : 1), { width: a, height: v } = t == null ? void 0 : t.attrs, h = a / v, $ = ut(f + x, lt, T.width), j = Math.round($ / h);
215
+ i({
204
216
  width: $,
205
- height: U
217
+ height: j
206
218
  });
207
219
  }, W),
208
- [n, z, _, a, t == null ? void 0 : t.attrs]
209
- ), O = y(
210
- (i) => {
211
- i.preventDefault(), i.stopPropagation(), n && (A({
220
+ [o, L, T, i, t == null ? void 0 : t.attrs]
221
+ ), u = A(
222
+ (r) => {
223
+ r.preventDefault(), r.stopPropagation(), o && (d({
212
224
  x: 0,
213
225
  y: 0,
214
226
  w: 0,
215
227
  h: 0,
216
228
  dir: ""
217
- }), S(!1), L());
229
+ }), _(!1), I());
218
230
  },
219
- [n, L]
220
- ), P = y(() => {
221
- document == null || document.addEventListener("mousemove", T, !0), document == null || document.addEventListener("mouseup", O, !0);
222
- }, [T, O]), D = y(() => {
223
- document == null || document.removeEventListener("mousemove", T, !0), document == null || document.removeEventListener("mouseup", O, !0);
224
- }, [T, O]);
225
- R(() => (n ? P() : D(), () => {
226
- D();
227
- }), [n, P, D]);
228
- const k = F(() => new ResizeObserver(() => E()), [E]);
229
- return R(() => (k.observe(e.view.dom), () => {
230
- k.disconnect();
231
- }), [e.view.dom, k]), /* @__PURE__ */ o(
232
- st,
231
+ [o, I]
232
+ ), R = A(() => {
233
+ document == null || document.addEventListener("mousemove", l, !0), document == null || document.addEventListener("mouseup", u, !0);
234
+ }, [l, u]), N = A(() => {
235
+ document == null || document.removeEventListener("mousemove", l, !0), document == null || document.removeEventListener("mouseup", u, !0);
236
+ }, [l, u]);
237
+ H(() => (o ? R() : N(), () => {
238
+ N();
239
+ }), [o, R, N]);
240
+ const M = P(() => new ResizeObserver(() => E()), [E]);
241
+ return H(() => (M.observe(e.view.dom), () => {
242
+ M.disconnect();
243
+ }), [e.view.dom, M]), /* @__PURE__ */ n(
244
+ Z,
233
245
  {
234
246
  className: "image-view",
235
- style: { ...l, width: "100%", textAlign: B },
236
- children: /* @__PURE__ */ H(
247
+ style: { ...O, width: "100%", textAlign: B },
248
+ children: /* @__PURE__ */ C(
237
249
  "div",
238
250
  {
239
251
  "data-drag-handle": !0,
240
252
  draggable: "true",
241
- style: { ...l, background: "#fff" },
242
- className: `image-view__body ${g ? "image-view__body--focused" : ""} ${n ? "image-view__body--resizing" : ""}`,
253
+ style: { ...O, background: "#fff" },
254
+ className: `image-view__body ${w ? "image-view__body--focused" : ""} ${o ? "image-view__body--resizing" : ""}`,
243
255
  children: [
244
- /* @__PURE__ */ o(
256
+ /* @__PURE__ */ n(
245
257
  "img",
246
258
  {
247
- alt: b.alt,
259
+ alt: g.alt,
248
260
  className: "image-view__body__image block",
249
261
  height: "auto",
250
- onClick: L,
251
- onLoad: f,
252
- src: b.src,
253
- style: b.style
262
+ onClick: I,
263
+ onLoad: k,
264
+ src: g.src,
265
+ style: g.style
254
266
  }
255
267
  ),
256
- e.view.editable && (g || n) && /* @__PURE__ */ o("div", { className: "image-resizer", children: M == null ? void 0 : M.map((i) => /* @__PURE__ */ o(
268
+ e.view.editable && (w || o) && /* @__PURE__ */ n("div", { className: "image-resizer", children: y == null ? void 0 : y.map((r) => /* @__PURE__ */ n(
257
269
  "span",
258
270
  {
259
- className: `image-resizer__handler image-resizer__handler--${i}`,
260
- onMouseDown: (d) => x(d, i)
271
+ className: `image-resizer__handler image-resizer__handler--${r}`,
272
+ onMouseDown: (p) => F(p, r)
261
273
  },
262
- `image-dir-${i}`
274
+ `image-dir-${r}`
263
275
  )) })
264
276
  ]
265
277
  }
@@ -267,7 +279,7 @@ function mt({ editor: e, node: t, updateAttributes: a, getPos: r, selected: g })
267
279
  }
268
280
  );
269
281
  }
270
- const Tt = /* @__PURE__ */ at.extend({
282
+ const vt = /* @__PURE__ */ X.extend({
271
283
  name: "mermaid",
272
284
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
273
285
  //@ts-expect-error
@@ -285,18 +297,17 @@ const Tt = /* @__PURE__ */ at.extend({
285
297
  HTMLAttributes: {
286
298
  class: "mermaid"
287
299
  },
288
- button: ({ editor: t, t: a, extension: r }) => {
289
- var g;
300
+ button: ({ editor: t, t: i, extension: s }) => {
301
+ var w;
290
302
  return {
291
- component: ut,
292
303
  componentProps: {
293
304
  action: () => !0,
294
305
  isActive: () => !1,
295
306
  disabled: !1,
296
307
  editor: t,
297
308
  icon: "Mermaid",
298
- tooltip: a("editor.mermaid.tooltip"),
299
- upload: (g = r == null ? void 0 : r.options) == null ? void 0 : g.upload
309
+ tooltip: i("editor.mermaid.tooltip"),
310
+ upload: (w = s == null ? void 0 : s.options) == null ? void 0 : w.upload
300
311
  }
301
312
  };
302
313
  }
@@ -309,8 +320,8 @@ const Tt = /* @__PURE__ */ at.extend({
309
320
  width: {
310
321
  default: null,
311
322
  parseHTML: (t) => {
312
- const a = t.querySelector("img"), r = a == null ? void 0 : a.getAttribute("width");
313
- return r ? Number.parseInt(r, 10) : 320;
323
+ const i = t.querySelector("img"), s = i == null ? void 0 : i.getAttribute("width");
324
+ return s ? Number.parseInt(s, 10) : 320;
314
325
  },
315
326
  renderHTML: (t) => ({
316
327
  width: t.width
@@ -319,8 +330,8 @@ const Tt = /* @__PURE__ */ at.extend({
319
330
  height: {
320
331
  default: null,
321
332
  parseHTML: (t) => {
322
- const a = t.querySelector("img"), r = a == null ? void 0 : a.getAttribute("height");
323
- return r ? Number.parseInt(r, 10) : 212;
333
+ const i = t.querySelector("img"), s = i == null ? void 0 : i.getAttribute("height");
334
+ return s ? Number.parseInt(s, 10) : 212;
324
335
  },
325
336
  renderHTML: (t) => ({
326
337
  height: t.height
@@ -336,15 +347,15 @@ const Tt = /* @__PURE__ */ at.extend({
336
347
  };
337
348
  },
338
349
  addNodeView() {
339
- return nt(mt);
350
+ return Y(ft);
340
351
  },
341
352
  // @ts-ignore
342
353
  addCommands() {
343
354
  return {
344
- setMermaid: (e, t) => ({ commands: a, editor: r }) => t ? a.insertContent({
355
+ setMermaid: (e, t) => ({ commands: i, editor: s }) => t ? i.insertContent({
345
356
  type: this.name,
346
357
  attrs: e
347
- }) : a.insertContentAt(r.state.selection.anchor, {
358
+ }) : i.insertContentAt(s.state.selection.anchor, {
348
359
  type: this.name,
349
360
  attrs: e
350
361
  }),
@@ -362,7 +373,7 @@ const Tt = /* @__PURE__ */ at.extend({
362
373
  },
363
374
  [
364
375
  "img",
365
- X(
376
+ U(
366
377
  // @ts-ignore
367
378
  this.options.HTMLAttributes,
368
379
  e
@@ -375,12 +386,12 @@ const Tt = /* @__PURE__ */ at.extend({
375
386
  {
376
387
  tag: "div[class=imageMermaid]",
377
388
  getAttrs: (e) => {
378
- const t = e.querySelector("img"), a = t == null ? void 0 : t.getAttribute("width"), r = t == null ? void 0 : t.getAttribute("height");
389
+ const t = e.querySelector("img"), i = t == null ? void 0 : t.getAttribute("width"), s = t == null ? void 0 : t.getAttribute("height");
379
390
  return {
380
391
  src: t == null ? void 0 : t.getAttribute("src"),
381
392
  alt: t == null ? void 0 : t.getAttribute("alt"),
382
- width: a ? Number.parseInt(a, 10) : null,
383
- height: r ? Number.parseInt(r, 10) : null,
393
+ width: i ? Number.parseInt(i, 10) : null,
394
+ height: s ? Number.parseInt(s, 10) : null,
384
395
  align: (t == null ? void 0 : t.getAttribute("align")) || e.style.textAlign || null
385
396
  };
386
397
  }
@@ -389,5 +400,6 @@ const Tt = /* @__PURE__ */ at.extend({
389
400
  }
390
401
  });
391
402
  export {
392
- Tt as Mermaid
403
+ vt as Mermaid,
404
+ Rt as RichTextMermaid
393
405
  };
package/lib/MoreMark.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-DF2Lp4HZ.cjs"),d=require("./index-CUogRI7j.cjs"),c=require("react/jsx-runtime"),m=require("react"),s=require("./RichTextEditor-CxvwGvQG.cjs");function g(t){var n;const i=m.useMemo(()=>{var r;const e=(r=t==null?void 0:t.items)==null?void 0:r.find(u=>u.isActive());return e&&!e.default?{...e,icon:e!=null&&e.icon?e==null?void 0:e.icon:t==null?void 0:t.icon}:{title:t.tooltip,icon:t.icon,isActive:()=>!1}},[t]);return c.jsxs(s.DropdownMenu,{children:[c.jsx(s.DropdownMenuTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:c.jsx(s.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:t==null?void 0:t.disabled,icon:t==null?void 0:t.icon,tooltip:t==null?void 0:t.tooltip,children:c.jsx(s.MenuDown,{className:"richtext-size-3 richtext-text-gray-500"})})}),c.jsx(s.DropdownMenuContent,{className:"w-full",children:(n=t==null?void 0:t.items)==null?void 0:n.map((e,o)=>c.jsxs(s.DropdownMenuCheckboxItem,{checked:i.title===e.title,className:"richtext-flex richtext-items-center richtext-gap-3",onClick:e.action,children:[c.jsx(s.IconComponent,{name:e==null?void 0:e.icon}),c.jsx("span",{className:"richtext-ml-1",children:e.title}),!!(e!=null&&e.shortcutKeys)&&c.jsx("span",{className:"richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",children:s.getShortcutKeys(e.shortcutKeys)})]},`more-mark-${o}`))})]})}const f=b.Extension.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:i,extension:n,t:e}){var l,h;const o=n.options.subscript,r=n.options.superscript,u={action:()=>i.commands.toggleSubscript(),isActive:()=>i.isActive("subscript")||!1,disabled:!i.can().toggleSubscript(),icon:"Subscript",title:e("editor.subscript.tooltip"),shortcutKeys:((l=n.options.shortcutKeys)==null?void 0:l[0])??["mod","."]},x={action:()=>i.commands.toggleSuperscript(),isActive:()=>i.isActive("superscript")||!1,disabled:!i.can().toggleSuperscript(),icon:"Superscript",title:e("editor.superscript.tooltip"),shortcutKeys:((h=n.options.shortcutKeys)==null?void 0:h[1])??["mod",","]},a=[];return o!==!1&&a.push(u),r!==!1&&a.push(x),{component:g,componentProps:{icon:"Type",tooltip:e("editor.moremark"),disabled:!i.isEditable,items:a}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(d.Subscript.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(d.Superscript.configure(this.options.superscript)),t}});exports.MoreMark=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-RfTlOzIr.cjs"),r=require("react/jsx-runtime"),M=require("react"),x=require("./toggle-D41PzQLJ.cjs");require("./index-DV5kbgRU.cjs");const f=require("./Icon-DUpv2cI6.cjs"),S=require("./icons-CqHjeW5T.cjs"),h=require("./useButtonProps-C6Vpn190.cjs"),p=require("./dropdown-menu-CdSm4emp.cjs");var k=c.Mark.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",c.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),A=c.Mark.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",c.mergeAttributes(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});function v(){const t=h.useButtonProps(b.name),{icon:s=void 0,tooltip:n=void 0,items:i=[],isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{disabled:u,dataState:o}=h.useActive(l),d=M.useMemo(()=>(o==null?void 0:o.title)||"",[o]);return t?r.jsxs(p.DropdownMenu,{children:[r.jsx(p.DropdownMenuTrigger,{asChild:!0,disabled:u,children:r.jsx(x.ActionButton,{customClass:"!richtext-w-12 richtext-h-12",disabled:u,icon:s,tooltip:n,children:r.jsx(S.MenuDown,{className:"richtext-size-3 richtext-text-gray-500"})})}),r.jsx(p.DropdownMenuContent,{className:"w-full",children:i==null?void 0:i.map((e,a)=>r.jsxs(p.DropdownMenuCheckboxItem,{checked:d===e.title,className:"richtext-flex richtext-items-center richtext-gap-3",onClick:e.action,children:[r.jsx(f.IconComponent,{name:e==null?void 0:e.icon}),r.jsx("span",{className:"richtext-ml-1",children:e.title}),!!(e!=null&&e.shortcutKeys)&&r.jsx("span",{className:"richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60",children:h.getShortcutKeys(e.shortcutKeys)})]},`more-mark-${a}`))})]}):r.jsx(r.Fragment,{})}const b=c.Extension.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:s,extension:n,t:i}){var a,g;const l=n.options.subscript,u=n.options.superscript,o={action:()=>s.commands.toggleSubscript(),isActive:()=>s.isActive("subscript")||!1,disabled:!s.can().toggleSubscript(),icon:"Subscript",title:i("editor.subscript.tooltip"),shortcutKeys:((a=n.options.shortcutKeys)==null?void 0:a[0])??["mod","."]},d={action:()=>s.commands.toggleSuperscript(),isActive:()=>s.isActive("superscript")||!1,disabled:!s.can().toggleSuperscript(),icon:"Superscript",title:i("editor.superscript.tooltip"),shortcutKeys:((g=n.options.shortcutKeys)==null?void 0:g[1])??["mod",","]},e=[];return l!==!1&&e.push(o),u!==!1&&e.push(d),{componentProps:{icon:"Type",tooltip:i("editor.moremark"),disabled:!s.isEditable,items:e,isActive:()=>e==null?void 0:e.find(m=>m.isActive())}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(k.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(A.configure(this.options.superscript)),t}});exports.MoreMark=b;exports.RichTextMoreMark=v;