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
@@ -1,305 +1,289 @@
1
- import { b as H, a as A } from "./dom-dataset-lYeH6gfI.js";
2
- import { E as S, a as O } from "./index-kbO3iWqL.js";
3
- import { S as B } from "./index-J3jHHZ4d.js";
4
- import { jsx as f, jsxs as k } from "react/jsx-runtime";
5
- import { forwardRef as $, useState as L, useRef as v, useImperativeHandle as D, useEffect as z, Fragment as V } from "react";
6
- import { d as P, f as T, O as U, Q as M, U as q, V as K, W as G } from "./RichTextEditor-DGcKEUGr.js";
7
- import { u as j, n as d } from "./index-LmrOdnen.js";
8
- function F(t, c) {
9
- var p, y;
10
- const [n, i] = L(0), [e, o] = L(0), l = v(null), { t: m } = j(), u = v([]);
11
- D(c, () => ({
12
- onKeyDown: h
13
- })), z(() => {
14
- if (!l.current)
1
+ import { E as A } from "./index-DnWWK9F_.js";
2
+ import { PluginKey as $ } from "@tiptap/pm/state";
3
+ import { a as D } from "./index-DzcKxutn.js";
4
+ import { S as O, u as b } from "./updatePosition-BPmcE0YD.js";
5
+ import { jsx as h, jsxs as w, Fragment as V } from "react/jsx-runtime";
6
+ import { forwardRef as B, useState as C, useRef as v, useImperativeHandle as P, useEffect as N, Fragment as z } from "react";
7
+ import { c as T } from "./index-BPfVXs5_.js";
8
+ import { I as F } from "./Icon-jKs8Hr6p.js";
9
+ import { o as G, x as U, h as q, E as K, u as y } from "./index-DYkucCoF.js";
10
+ import { a as M } from "./store-DX599H5W.js";
11
+ const j = G([]);
12
+ function R() {
13
+ const [t, n] = U(j);
14
+ return [t, n];
15
+ }
16
+ const W = {
17
+ setOpen: (t, n) => {
18
+ q(K.UPLOAD_VIDEO(t), n);
19
+ }
20
+ };
21
+ function _({ t }) {
22
+ const n = [
23
+ {
24
+ name: "format",
25
+ title: t("editor.slash.format"),
26
+ commands: []
27
+ },
28
+ {
29
+ name: "insert",
30
+ title: t("editor.slash.insert"),
31
+ commands: []
32
+ }
33
+ ];
34
+ return [1, 2, 3, 4, 5, 6].forEach((e) => {
35
+ n[0].commands.push({
36
+ name: `heading${e}`,
37
+ label: t(`editor.heading.h${e}.tooltip`),
38
+ aliases: [`h${e}`, "bt", `bt${e}`],
39
+ iconName: `Heading${e}`,
40
+ action: ({ editor: i, range: l }) => {
41
+ i.chain().focus().deleteRange(l).setHeading({ level: e }).run();
42
+ }
43
+ });
44
+ }), n[0].commands.push({
45
+ name: "bulletList",
46
+ label: t("editor.bulletlist.tooltip"),
47
+ aliases: ["ul", "yxlb"],
48
+ iconName: "List",
49
+ action: ({ editor: e, range: i }) => {
50
+ e.chain().focus().deleteRange(i).toggleBulletList().run();
51
+ }
52
+ }), n[0].commands.push({
53
+ name: "numberedList",
54
+ label: t("editor.orderedlist.tooltip"),
55
+ aliases: ["ol", "yxlb"],
56
+ iconName: "ListOrdered",
57
+ action: ({ editor: e, range: i }) => {
58
+ e.chain().focus().deleteRange(i).toggleOrderedList().run();
59
+ }
60
+ }), n[0].commands.push({
61
+ name: "taskList",
62
+ label: t("editor.tasklist.tooltip"),
63
+ iconName: "ListTodo",
64
+ description: "Task list with todo items",
65
+ aliases: ["todo"],
66
+ action: ({ editor: e, range: i }) => {
67
+ e.chain().focus().deleteRange(i).toggleTaskList().run();
68
+ }
69
+ }), n[0].commands.push({
70
+ name: "blockquote",
71
+ label: t("editor.blockquote.tooltip"),
72
+ description: "插入引入格式",
73
+ aliases: ["yr"],
74
+ iconName: "TextQuote",
75
+ action: ({ editor: e, range: i }) => {
76
+ e.chain().focus().deleteRange(i).setBlockquote().run();
77
+ }
78
+ }), n[0].commands.push({
79
+ name: "codeBlock",
80
+ label: t("editor.codeblock.tooltip"),
81
+ iconName: "Code2",
82
+ description: "Code block with syntax highlighting",
83
+ shouldBeHidden: (e) => e.isActive("columns"),
84
+ action: ({ editor: e, range: i }) => {
85
+ e.chain().focus().deleteRange(i).setCodeBlock().run();
86
+ }
87
+ }), n[1].commands.push({
88
+ name: "image",
89
+ label: t("editor.image.tooltip"),
90
+ iconName: "ImageUp",
91
+ description: "Insert a image",
92
+ aliases: ["image", "tp", "tupian"],
93
+ shouldBeHidden: (e) => e.isActive("columns"),
94
+ action: ({ editor: e, range: i }) => {
95
+ e.chain().focus().deleteRange(i).run(), M.setOpen(e.id, !0);
96
+ }
97
+ }), n[1].commands.push({
98
+ name: "video",
99
+ label: t("editor.video.tooltip"),
100
+ iconName: "Video",
101
+ description: "Insert a video",
102
+ aliases: ["video", "sp", "shipin"],
103
+ shouldBeHidden: (e) => e.isActive("columns"),
104
+ action: ({ editor: e, range: i }) => {
105
+ e.chain().focus().deleteRange(i).run(), W.setOpen(e.id, !0);
106
+ }
107
+ }), n[1].commands.push({
108
+ name: "table",
109
+ label: t("editor.table.tooltip"),
110
+ iconName: "Table",
111
+ description: "Insert a table",
112
+ aliases: ["table", "bg", "biaoge", "biao"],
113
+ shouldBeHidden: (e) => e.isActive("columns"),
114
+ action: ({ editor: e, range: i }) => {
115
+ e.chain().focus().deleteRange(i).insertTable({ rows: 3, cols: 3, withHeaderRow: !1 }).run();
116
+ }
117
+ }), n[1].commands.push({
118
+ name: "horizontalRule",
119
+ label: t("editor.horizontalrule.tooltip"),
120
+ iconName: "Minus",
121
+ description: "Insert a horizontal divider",
122
+ aliases: ["hr", "fgx", "fg"],
123
+ action: ({ editor: e, range: i }) => {
124
+ e.chain().focus().deleteRange(i).setHorizontalRule().run();
125
+ }
126
+ }), n[1].commands.push({
127
+ name: "columns",
128
+ label: t("editor.columns.tooltip"),
129
+ iconName: "Columns2",
130
+ description: "Add two column content",
131
+ action: ({ editor: e }) => {
132
+ e.chain().focus().insertColumns({ cols: 2 }).run();
133
+ }
134
+ }), n;
135
+ }
136
+ function J(t, n) {
137
+ return t.map((l) => ({
138
+ ...l,
139
+ commands: l.commands.filter((s) => {
140
+ const u = s.label.toLowerCase().trim(), m = n.toLowerCase().trim();
141
+ if (s.aliases) {
142
+ const x = s.aliases.map((d) => d.toLowerCase().trim()), a = u.match(m), f = x.some((d) => d.match(m));
143
+ return a || f;
144
+ }
145
+ return u.match(m);
146
+ })
147
+ })).filter((l) => l.commands.length > 0);
148
+ }
149
+ function X(t, n) {
150
+ const [e] = R(), [i, l] = C(0), [s, u] = C(0), m = v(null), { t: x } = y(), a = J(e, t.query), f = v([]);
151
+ P(n, () => ({
152
+ onKeyDown: d
153
+ })), N(() => {
154
+ if (!m.current)
15
155
  return;
16
- const r = e * 1e3 + n, a = u.current[r];
17
- a && a.scrollIntoView({
156
+ const r = s * 1e3 + i, o = f.current[r];
157
+ o && o.scrollIntoView({
18
158
  behavior: "smooth",
19
159
  block: "nearest"
20
160
  });
21
- }, [n, e]);
22
- function h({ event: r }) {
23
- return r.key === "ArrowUp" ? (x(), !0) : r.key === "ArrowDown" ? (g(), !0) : r.key === "Enter" ? (C(), !0) : !1;
161
+ }, [i, s]);
162
+ function d({ event: r }) {
163
+ return r.key === "ArrowUp" ? (k(), !0) : r.key === "ArrowDown" ? (I(), !0) : r.key === "Enter" ? (L(), !0) : !1;
24
164
  }
25
- function x() {
26
- var s;
27
- if (t.items.length === 0)
165
+ function k() {
166
+ var c;
167
+ if (a.length === 0)
28
168
  return !1;
29
- let r = n - 1, a = e;
30
- r < 0 && (a = e - 1, r = ((s = t.items[a]) == null ? void 0 : s.commands.length) - 1 || 0), a < 0 && (a = t.items.length - 1, r = t.items[a].commands.length - 1), i(r), o(a);
169
+ let r = i - 1, o = s;
170
+ r < 0 && (o = s - 1, r = ((c = a[o]) == null ? void 0 : c.commands.length) - 1 || 0), o < 0 && (o = a.length - 1, r = a[o].commands.length - 1), l(r), u(o);
31
171
  }
32
- function g() {
33
- if (t.items.length === 0)
172
+ function I() {
173
+ if (a.length === 0)
34
174
  return !1;
35
- const r = t.items[e].commands;
36
- let a = n + 1, s = e;
37
- r.length - 1 < a && (a = 0, s = e + 1), t.items.length - 1 < s && (s = 0), i(a), o(s);
175
+ const r = a[s].commands;
176
+ let o = i + 1, c = s;
177
+ r.length - 1 < o && (o = 0, c = s + 1), a.length - 1 < c && (c = 0), l(o), u(c);
38
178
  }
39
- function C() {
40
- if (t.items.length === 0 || e === -1 || n === -1)
179
+ function L() {
180
+ if (a.length === 0 || s === -1 || i === -1)
41
181
  return !1;
42
- b(e, n);
182
+ g(s, i);
43
183
  }
44
- function b(r, a) {
45
- const s = t.items[r].commands[a];
46
- t.command(s), t != null && t.onClose && (t == null || t.onClose());
184
+ function g(r, o) {
185
+ const c = a[r].commands[o];
186
+ t == null || t.command(c);
47
187
  }
48
- function R(r, a) {
49
- b(r, a);
188
+ function S(r, o) {
189
+ g(r, o);
50
190
  }
51
- function E(r, a, s) {
52
- u.current[r * 1e3 + a] = s;
191
+ function E(r, o, c) {
192
+ f.current[r * 1e3 + o] = c;
53
193
  }
54
- return /* @__PURE__ */ f(
194
+ return /* @__PURE__ */ h(
55
195
  "div",
56
196
  {
57
- className: "richtext-max-h-[min(80vh,24rem)] richtext-flex-wrap richtext-overflow-auto richtext-rounded-lg !richtext-border !richtext-border-neutral-200 !richtext-bg-white richtext-p-1 !richtext-text-black richtext-shadow-sm dark:!richtext-border-neutral-800 dark:!richtext-bg-black",
58
- ref: l,
59
- children: (p = t == null ? void 0 : t.items) != null && p.length ? /* @__PURE__ */ f("div", { className: "richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5", children: (y = t == null ? void 0 : t.items) == null ? void 0 : y.map((r, a) => /* @__PURE__ */ k(V, { children: [
60
- /* @__PURE__ */ f("div", { className: "richtext-col-[1/-1] richtext-mx-2 richtext-mt-2 richtext-select-none richtext-text-[0.65rem] richtext-font-semibold richtext-uppercase richtext-tracking-wider !richtext-text-neutral-500 first:richtext-mt-0.5", children: r.title }),
61
- r.commands.map((s, w) => /* @__PURE__ */ k(
197
+ className: "richtext-max-h-[min(80vh,24rem)] richtext-flex-wrap richtext-overflow-y-auto richtext-overflow-x-hidden richtext-rounded-md !richtext-border !richtext-border-solid !richtext-border-[hsl(var(--richtext-border))] richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none",
198
+ ref: m,
199
+ children: a != null && a.length ? /* @__PURE__ */ h("div", { className: "richtext-grid richtext-min-w-48 richtext-grid-cols-1 richtext-gap-0.5", children: a == null ? void 0 : a.map((r, o) => /* @__PURE__ */ w(z, { children: [
200
+ /* @__PURE__ */ h("div", { className: "richtext-col-[1/-1] richtext-mx-2 richtext-mt-2 richtext-select-none richtext-text-[0.65rem] richtext-font-semibold richtext-uppercase richtext-tracking-wider !richtext-text-neutral-500 first:richtext-mt-0.5", children: r.title }),
201
+ r.commands.map((c, p) => /* @__PURE__ */ w(
62
202
  "button",
63
203
  {
64
- onClick: () => R(a, w),
65
- ref: (I) => E(a, w, I),
66
- className: P("richtext-flex richtext-items-center richtext-gap-3 richtext-px-2 richtext-py-1.5 richtext-text-sm !richtext-text-neutral-800 dark:!richtext-text-neutral-200 richtext-text-left richtext-w-full richtext-rounded-sm !richtext-outline-none !richtext-border-none richtext-transition-colors !richtext-bg-transparent hover:!richtext-bg-accent ", {
67
- "slash-command-active": e === a && n === w
204
+ onClick: () => S(o, p),
205
+ ref: (H) => E(o, p, H),
206
+ className: T("richtext-flex richtext-items-center richtext-gap-3 richtext-px-2 richtext-py-1.5 richtext-text-sm !richtext-text-neutral-800 dark:!richtext-text-neutral-200 richtext-text-left richtext-w-full richtext-rounded-sm !richtext-outline-none !richtext-border-none richtext-transition-colors !richtext-bg-transparent hover:!richtext-bg-accent ", {
207
+ "bg-item-active": s === o && i === p
68
208
  }),
69
209
  children: [
70
- s.iconUrl && /* @__PURE__ */ f(
210
+ c.iconUrl && /* @__PURE__ */ h(
71
211
  "img",
72
212
  {
73
213
  alt: "",
74
214
  className: "richtext-size-6",
75
- src: s.iconUrl
215
+ src: c.iconUrl
76
216
  }
77
217
  ),
78
- s.iconName && /* @__PURE__ */ f(
79
- T,
218
+ c.iconName && /* @__PURE__ */ h(
219
+ F,
80
220
  {
81
221
  className: "!richtext-mr-1 !richtext-text-lg",
82
- name: s.iconName
222
+ name: c.iconName
83
223
  }
84
224
  ),
85
- s.label
225
+ c.label
86
226
  ]
87
227
  },
88
- `command-${w}`
228
+ `command-${p}`
89
229
  ))
90
- ] }, `slash-${r.title}`)) }) : /* @__PURE__ */ f("div", { className: "richtext-p-3", children: /* @__PURE__ */ f("span", { className: "richtext-text-xs richtext-text-gray-800 dark:richtext-text-gray-100", children: m("editor.slash.empty") }) })
230
+ ] }, `slash-${r.title}`)) }) : /* @__PURE__ */ h("div", { className: "richtext-p-3", children: /* @__PURE__ */ h("span", { className: "richtext-text-xs richtext-text-gray-800 dark:richtext-text-gray-100", children: x("editor.slash.empty") }) })
91
231
  }
92
232
  );
93
233
  }
94
- const Q = $(F), W = {
95
- setOpen: (t, c) => {
96
- U(M.UPLOAD_VIDEO(t), c);
97
- }
98
- };
99
- function _(t, c) {
100
- const n = [
101
- {
102
- name: "format",
103
- title: d.t("editor.slash.format"),
104
- commands: []
105
- },
106
- {
107
- name: "insert",
108
- title: d.t("editor.slash.insert"),
109
- commands: []
234
+ const Y = B(X);
235
+ function ce({ commandList: t }) {
236
+ const [, n] = R(), { t: e } = y();
237
+ return N(() => {
238
+ if (!(t != null && t.length)) {
239
+ const i = _({ t: e });
240
+ n(i);
241
+ return;
110
242
  }
111
- ];
112
- return t.forEach((i) => {
113
- i.name.toLowerCase() === "heading" && i.options.levels.forEach((e) => {
114
- n[0].commands.push({
115
- name: `heading${e}`,
116
- //@ts-expect-error
117
- label: d.t(`editor.heading.h${e}.tooltip`),
118
- aliases: [`h${e}`, "bt", `bt${e}`],
119
- iconName: `Heading${e}`,
120
- action: ({ editor: o, range: l }) => {
121
- o.chain().focus().deleteRange(l).setHeading({ level: e }).run();
122
- }
123
- });
124
- }), i.name.toLowerCase() === "bulletlist" && n[0].commands.push({
125
- name: "bulletList",
126
- label: d.t("editor.bulletlist.tooltip"),
127
- aliases: ["ul", "yxlb"],
128
- iconName: "List",
129
- action: ({ editor: e, range: o }) => {
130
- e.chain().focus().deleteRange(o).toggleBulletList().run();
131
- }
132
- }), i.name.toLowerCase() === "orderedlist" && n[0].commands.push({
133
- name: "numberedList",
134
- label: d.t("editor.orderedlist.tooltip"),
135
- aliases: ["ol", "yxlb"],
136
- iconName: "ListOrdered",
137
- action: ({ editor: e, range: o }) => {
138
- e.chain().focus().deleteRange(o).toggleOrderedList().run();
139
- }
140
- }), i.name.toLowerCase() === "tasklist" && n[0].commands.push({
141
- name: "taskList",
142
- label: d.t("editor.tasklist.tooltip"),
143
- iconName: "ListTodo",
144
- description: "Task list with todo items",
145
- aliases: ["todo"],
146
- action: ({ editor: e, range: o }) => {
147
- e.chain().focus().deleteRange(o).toggleTaskList().run();
148
- }
149
- }), i.name.toLowerCase() === "blockquote" && n[0].commands.push({
150
- name: "blockquote",
151
- label: d.t("editor.blockquote.tooltip"),
152
- description: "插入引入格式",
153
- aliases: ["yr"],
154
- iconName: "TextQuote",
155
- action: ({ editor: e, range: o }) => {
156
- e.chain().focus().deleteRange(o).setBlockquote().run();
157
- }
158
- }), i.name.toLowerCase() === "codeblock" && n[0].commands.push({
159
- name: "codeBlock",
160
- label: d.t("editor.codeblock.tooltip"),
161
- iconName: "Code2",
162
- description: "Code block with syntax highlighting",
163
- shouldBeHidden: (e) => e.isActive("columns"),
164
- action: ({ editor: e, range: o }) => {
165
- e.chain().focus().deleteRange(o).setCodeBlock().run();
166
- }
167
- }), i.name.toLowerCase() === q.name && n[1].commands.push({
168
- name: "image",
169
- label: d.t("editor.image.tooltip"),
170
- iconName: "ImageUp",
171
- description: "Insert a image",
172
- aliases: ["image", "tp", "tupian"],
173
- shouldBeHidden: (e) => e.isActive("columns"),
174
- action: ({ editor: e, range: o }) => {
175
- e.chain().focus().deleteRange(o).run(), K.setOpen(e.id, !0);
176
- }
177
- }), i.name.toLowerCase() === G.name && n[1].commands.push({
178
- name: "video",
179
- label: d.t("editor.video.tooltip"),
180
- iconName: "Video",
181
- description: "Insert a video",
182
- aliases: ["video", "sp", "shipin"],
183
- shouldBeHidden: (e) => e.isActive("columns"),
184
- action: ({ editor: e, range: o }) => {
185
- e.chain().focus().deleteRange(o).run(), W.setOpen(e.id, !0);
186
- }
187
- }), i.name.toLowerCase() === "table" && n[1].commands.push({
188
- name: "table",
189
- label: d.t("editor.table.tooltip"),
190
- iconName: "Table",
191
- description: "Insert a table",
192
- aliases: ["table", "bg", "biaoge", "biao"],
193
- shouldBeHidden: (e) => e.isActive("columns"),
194
- action: ({ editor: e, range: o }) => {
195
- e.chain().focus().deleteRange(o).insertTable({ rows: 3, cols: 3, withHeaderRow: !1 }).run();
196
- }
197
- }), i.name.toLowerCase() === "horizontalrule" && n[1].commands.push({
198
- name: "horizontalRule",
199
- label: d.t("editor.horizontalrule.tooltip"),
200
- iconName: "Minus",
201
- description: "Insert a horizontal divider",
202
- aliases: ["hr", "fgx", "fg"],
203
- action: ({ editor: e, range: o }) => {
204
- e.chain().focus().deleteRange(o).setHorizontalRule().run();
205
- }
206
- }), i.name.toLowerCase() === "columns" && n[1].commands.push({
207
- name: "columns",
208
- label: d.t("editor.columns.tooltip"),
209
- iconName: "Columns2",
210
- description: "Add two column content",
211
- action: ({ editor: e }) => {
212
- e.chain().focus().insertColumns({ cols: 2 }).run();
213
- }
214
- }), c == null || c(i, n);
215
- }), n;
243
+ n(t);
244
+ }, [e, t]), /* @__PURE__ */ h(V, {});
216
245
  }
217
- const N = "slashCommand", ie = /* @__PURE__ */ S.create({
218
- name: N,
246
+ const le = /* @__PURE__ */ A.create({
247
+ name: "richtextSlashCommand",
219
248
  priority: 200,
220
249
  addProseMirrorPlugins() {
221
250
  return [
222
- B({
251
+ O({
223
252
  editor: this.editor,
224
253
  char: "/",
225
254
  allowSpaces: !0,
226
255
  startOfLine: !0,
227
- pluginKey: new O(N),
228
- allow: ({ state: t, range: c }) => {
229
- var h, x, g;
230
- const n = t.doc.resolve(c.from), i = n.depth === 1, e = n.parent.type.name === "paragraph", o = ((h = n.parent.textContent) == null ? void 0 : h.charAt(0)) === "/", l = this.editor.isActive("column"), m = (g = n.parent.textContent) == null ? void 0 : g.slice(
231
- Math.max(0, (x = n.parent.textContent) == null ? void 0 : x.indexOf("/"))
232
- ), u = !(m != null && m.endsWith(" "));
233
- return (i && e && o || l && e && o) && u;
256
+ pluginKey: new $(`richtextCustomPlugin${this.name}`),
257
+ allow: ({ state: t, range: n }) => {
258
+ var a, f, d;
259
+ const e = t.doc.resolve(n.from), i = e.depth === 1, l = e.parent.type.name === "paragraph", s = ((a = e.parent.textContent) == null ? void 0 : a.charAt(0)) === "/", u = this.editor.isActive("column"), m = (d = e.parent.textContent) == null ? void 0 : d.slice(
260
+ Math.max(0, (f = e.parent.textContent) == null ? void 0 : f.indexOf("/"))
261
+ ), x = !(m != null && m.endsWith(" "));
262
+ return (i && l && s || u && l && s) && x;
234
263
  },
235
- command: ({ editor: t, range: c, props: n }) => {
264
+ command: ({ editor: t, range: n, props: e }) => {
236
265
  const { view: i } = t;
237
- n.action({ editor: t, range: c }), i.focus();
266
+ e.action({ editor: t, range: n }), i.focus();
238
267
  },
239
- items: ({ query: t, editor: c }) => _(c.extensionManager.extensions, this.options.renderGroupItem).map((l) => ({
240
- ...l,
241
- commands: l.commands.filter((m) => {
242
- const u = m.label.toLowerCase().trim(), h = t.toLowerCase().trim();
243
- if (m.aliases) {
244
- const x = m.aliases.map((b) => b.toLowerCase().trim()), g = u.match(h), C = x.some((b) => b.match(h));
245
- return g || C;
246
- }
247
- return u.match(h);
248
- }).filter(
249
- (m) => m.shouldBeHidden ? !m.shouldBeHidden(this.editor) : !0
250
- )
251
- })).filter((l) => l.commands.length > 0).map((l) => ({
252
- ...l,
253
- commands: l.commands.map((m) => ({
254
- ...m,
255
- isEnabled: !0
256
- }))
257
- })),
258
268
  render: () => {
259
269
  let t;
260
- function c(i) {
261
- if (!t || !t.element)
262
- return;
263
- H({
264
- getBoundingClientRect() {
265
- return i;
266
- }
267
- }, t.element, {
268
- placement: "bottom-start"
269
- }).then((o) => {
270
- Object.assign(t.element.style, {
271
- left: `${o.x}px`,
272
- top: `${o.y}px`,
273
- position: o.strategy === "fixed" ? "fixed" : "absolute"
274
- });
275
- });
276
- }
277
- const n = () => {
278
- t && (document.body.contains(t.element) && document.body.removeChild(t.element), t.destroy());
279
- };
280
270
  return {
281
- onStart: (i) => {
282
- n(), t = new A(Q, {
283
- props: {
284
- ...i,
285
- onClose: n
286
- },
287
- editor: i.editor
288
- }), document.body.appendChild(t.element), c(i.clientRect());
271
+ onStart: (n) => {
272
+ n.clientRect && (t = new D(Y, {
273
+ props: n,
274
+ editor: n.editor
275
+ }), t.element.style.position = "absolute", document.body.appendChild(t.element), b(n.editor, t.element));
289
276
  },
290
- onUpdate(i) {
291
- t.updateProps(i), c(i.clientRect());
277
+ onUpdate(n) {
278
+ t.updateProps(n), n.clientRect && b(n.editor, t.element);
292
279
  },
293
- onKeyDown(i) {
280
+ onKeyDown(n) {
294
281
  var e;
295
- return i.event.key === "Escape" ? (document.body.removeChild(t.element), t.destroy(), !0) : (e = t.ref) == null ? void 0 : e.onKeyDown(i);
282
+ return n.event.key === "Escape" ? (t.destroy(), t.element.remove(), !0) : (e = t.ref) == null ? void 0 : e.onKeyDown(n);
283
+ },
284
+ onExit() {
285
+ t.destroy(), t.element.remove();
296
286
  }
297
- // onExit() {
298
- // if (document.body.contains(component.element)) {
299
- // document.body.removeChild(component.element);
300
- // }
301
- // component.destroy();
302
- // },
303
287
  };
304
288
  }
305
289
  })
@@ -319,6 +303,8 @@ const N = "slashCommand", ie = /* @__PURE__ */ S.create({
319
303
  }
320
304
  });
321
305
  export {
322
- ie as SlashCommand,
323
- ie as default
306
+ le as SlashCommand,
307
+ ce as SlashCommandList,
308
+ _ as renderCommandListDefault,
309
+ J as useFilterCommandList
324
310
  };
package/lib/Strike.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-DF2Lp4HZ.cjs"),i=require("./RichTextEditor-CxvwGvQG.cjs");var o=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,a=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,u=r.Mark.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",r.mergeAttributes(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[r.markInputRule({find:o,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:a,type:this.type})]}});const d=u.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:s,extension:n})=>({component:i.ActionButton,componentProps:{action:()=>e.commands.toggleStrike(),isActive:()=>e.isActive("strike")||!1,disabled:!1,icon:"Strikethrough",shortcutKeys:n.options.shortcutKeys??["shift","mod","S"],tooltip:s("editor.strike.tooltip")}})}}});exports.Strike=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-RfTlOzIr.cjs"),n=require("react/jsx-runtime"),m=require("./toggle-D41PzQLJ.cjs");require("react");require("./index-DV5kbgRU.cjs");const u=require("./useButtonProps-C6Vpn190.cjs");var h=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,S=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,f=r.Mark.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",r.mergeAttributes(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[r.markInputRule({find:h,type:this.type})]},addPasteRules(){return[r.markPasteRule({find:S,type:this.type})]}});function v(){const t=u.useButtonProps(d.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:o=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:a,update:k}=u.useToggleActive(l),g=()=>{a||o&&(o(),k())};return t?n.jsx(m.ActionButton,{action:g,dataState:p,disabled:a,icon:e,shortcutKeys:s,tooltip:i,tooltipOptions:c}):n.jsx(n.Fragment,{})}const d=f.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:s})=>({componentProps:{action:()=>e.commands.toggleStrike(),isActive:()=>e.isActive("strike")||!1,disabled:!1,icon:"Strikethrough",shortcutKeys:s.options.shortcutKeys??["shift","mod","S"],tooltip:i("editor.strike.tooltip")}})}}});exports.RichTextStrike=v;exports.Strike=d;