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
package/lib/CodeView.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-DF2Lp4HZ.cjs"),c=require("./RichTextEditor-CxvwGvQG.cjs"),s=i.Extension.create({name:"codeView",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:o}){return{component:c.ActionButton,componentProps:{action:()=>{t.commands.toggleCodeView()},isActive:()=>t.storage.codeView.isActive||!1,disabled:!1,icon:"CodeView",tooltip:o("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}}}}},addStorage(){return{isActive:!1,originalContent:""}},addCommands(){return{toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const o=e.getHTML();e.storage.codeView.originalContent=o;const n=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${n}</div>`)}return e.storage.codeView.isActive=!t,!0}}}});exports.CodeView=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-RfTlOzIr.cjs"),n=require("react/jsx-runtime"),v=require("./toggle-D41PzQLJ.cjs");require("react");require("./index-DV5kbgRU.cjs");const r=require("./useButtonProps-C6Vpn190.cjs");function w(){const e=r.useButtonProps(a.name),{icon:t=void 0,tooltip:o=void 0,shortcutKeys:i=void 0,tooltipOptions:d={},action:s=void 0,isActive:u=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:l,disabled:c,update:p}=r.useToggleActive(u),g=()=>{c||s&&(s(),p())};return e?n.jsx(v.ActionButton,{action:g,dataState:l,disabled:c,icon:t,shortcutKeys:i,tooltip:o,tooltipOptions:d}):n.jsx(n.Fragment,{})}const a=m.Extension.create({name:"codeView",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:o}){return{componentProps:{action:()=>{t.commands.toggleCodeView()},isActive:()=>t.storage.codeView.isActive,disabled:!1,icon:"Html",tooltip:o("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}}}}},addStorage(){return{isActive:!1,originalContent:""}},addCommands(){return{toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const o=e.getHTML();e.storage.codeView.originalContent=o;const i=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${i}</div>`)}return e.storage.codeView.isActive=!t,!0}}}});exports.CodeView=a;exports.RichTextCodeView=w;
@@ -1,5 +1,6 @@
1
1
  import { Editor } from '@tiptap/react';
2
2
  import { Extension } from '@tiptap/core';
3
+ import { JSX } from 'react/jsx-runtime';
3
4
 
4
5
  /**
5
6
  * Represents the ButtonView function.
@@ -56,7 +57,7 @@ declare interface ButtonViewReturnComponentSlots {
56
57
 
57
58
  export declare const CodeView: Extension<CodeViewOptions, any>;
58
59
 
59
- export declare interface CodeViewOptions extends GeneralOptions<CodeViewOptions> {
60
+ declare interface CodeViewOptions extends GeneralOptions<CodeViewOptions> {
60
61
  isCodeViewMode?: boolean;
61
62
  }
62
63
 
@@ -76,6 +77,8 @@ declare interface GeneralOptions<T> {
76
77
  shortcutKeys?: string[] | string[][];
77
78
  }
78
79
 
80
+ export declare function RichTextCodeView(): JSX.Element;
81
+
79
82
  export { }
80
83
 
81
84
 
@@ -109,11 +112,22 @@ declare module '@tiptap/core' {
109
112
  }
110
113
 
111
114
 
115
+ declare module '@tiptap/core' {
116
+ interface Storage {
117
+ color: ColorStorage;
118
+ }
119
+ }
120
+
121
+
112
122
  declare module '@tiptap/core' {
113
123
  interface Commands<ReturnType> {
114
- drawer: {
115
- setDrawer: (options: any, replace?: any) => ReturnType;
116
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
124
+ columns: {
125
+ insertColumns: (attrs?: {
126
+ cols: number;
127
+ }) => ReturnType;
128
+ addColBefore: () => ReturnType;
129
+ addColAfter: () => ReturnType;
130
+ deleteCol: () => ReturnType;
117
131
  };
118
132
  }
119
133
  }
@@ -121,8 +135,9 @@ declare module '@tiptap/core' {
121
135
 
122
136
  declare module '@tiptap/core' {
123
137
  interface Commands<ReturnType> {
124
- excalidraw: {
125
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
138
+ drawer: {
139
+ setDrawer: (options: any, replace?: any) => ReturnType;
140
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
126
141
  };
127
142
  }
128
143
  }
@@ -140,7 +155,16 @@ declare module '@tiptap/core' {
140
155
  declare module '@tiptap/core' {
141
156
  interface Commands<ReturnType> {
142
157
  exportWord: {
143
- exportToWord: () => ReturnType;
158
+ exportToWord: (docState: any) => ReturnType;
159
+ };
160
+ }
161
+ }
162
+
163
+
164
+ declare module '@tiptap/core' {
165
+ interface Commands<ReturnType> {
166
+ excalidraw: {
167
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
144
168
  };
145
169
  }
146
170
  }
@@ -165,10 +189,8 @@ declare module '@tiptap/core' {
165
189
 
166
190
 
167
191
  declare module '@tiptap/core' {
168
- interface Commands<ReturnType> {
169
- painter: {
170
- setPainter: (marks: Mark[]) => ReturnType;
171
- };
192
+ interface Storage {
193
+ highlight: HighlightStorage;
172
194
  }
173
195
  }
174
196
 
@@ -208,22 +230,6 @@ declare module '@tiptap/core' {
208
230
  }
209
231
 
210
232
 
211
- declare module '@tiptap/core' {
212
- interface Commands<ReturnType> {
213
- indent: {
214
- /**
215
- * Set the indent attribute
216
- */
217
- indent: () => ReturnType;
218
- /**
219
- * Set the outdent attribute
220
- */
221
- outdent: () => ReturnType;
222
- };
223
- }
224
- }
225
-
226
-
227
233
  declare module '@tiptap/core' {
228
234
  interface Commands<ReturnType> {
229
235
  imageGifUpload: {
@@ -246,8 +252,15 @@ declare module '@tiptap/core' {
246
252
 
247
253
  declare module '@tiptap/core' {
248
254
  interface Commands<ReturnType> {
249
- katex: {
250
- setKatex: (arg?: IKatexAttrs) => ReturnType;
255
+ indent: {
256
+ /**
257
+ * Set the indent attribute
258
+ */
259
+ indent: () => ReturnType;
260
+ /**
261
+ * Set the outdent attribute
262
+ */
263
+ outdent: () => ReturnType;
251
264
  };
252
265
  }
253
266
  }
@@ -255,9 +268,8 @@ declare module '@tiptap/core' {
255
268
 
256
269
  declare module '@tiptap/core' {
257
270
  interface Commands<ReturnType> {
258
- lineHeight: {
259
- setLineHeight: (lineHeight: string) => ReturnType;
260
- unsetLineHeight: () => ReturnType;
271
+ katex: {
272
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
261
273
  };
262
274
  }
263
275
  }
@@ -273,20 +285,6 @@ declare module '@tiptap/core' {
273
285
  }
274
286
 
275
287
 
276
- declare module '@tiptap/core' {
277
- interface Commands<ReturnType> {
278
- columns: {
279
- insertColumns: (attrs?: {
280
- cols: number;
281
- }) => ReturnType;
282
- addColBefore: () => ReturnType;
283
- addColAfter: () => ReturnType;
284
- deleteCol: () => ReturnType;
285
- };
286
- }
287
- }
288
-
289
-
290
288
  declare module '@tiptap/core' {
291
289
  interface Commands<ReturnType> {
292
290
  search: {
@@ -310,16 +308,6 @@ declare module '@tiptap/core' {
310
308
  }
311
309
 
312
310
 
313
- declare module '@tiptap/core' {
314
- interface Commands<ReturnType> {
315
- tableOfContents: {
316
- setTableOfContents: () => ReturnType;
317
- removeTableOfContents: () => ReturnType;
318
- };
319
- }
320
- }
321
-
322
-
323
311
  declare module '@tiptap/core' {
324
312
  interface Commands<ReturnType> {
325
313
  twitter: {
package/lib/CodeView.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Editor } from '@tiptap/react';
2
2
  import { Extension } from '@tiptap/core';
3
+ import { JSX } from 'react/jsx-runtime';
3
4
 
4
5
  /**
5
6
  * Represents the ButtonView function.
@@ -56,7 +57,7 @@ declare interface ButtonViewReturnComponentSlots {
56
57
 
57
58
  export declare const CodeView: Extension<CodeViewOptions, any>;
58
59
 
59
- export declare interface CodeViewOptions extends GeneralOptions<CodeViewOptions> {
60
+ declare interface CodeViewOptions extends GeneralOptions<CodeViewOptions> {
60
61
  isCodeViewMode?: boolean;
61
62
  }
62
63
 
@@ -76,6 +77,8 @@ declare interface GeneralOptions<T> {
76
77
  shortcutKeys?: string[] | string[][];
77
78
  }
78
79
 
80
+ export declare function RichTextCodeView(): JSX.Element;
81
+
79
82
  export { }
80
83
 
81
84
 
@@ -109,11 +112,22 @@ declare module '@tiptap/core' {
109
112
  }
110
113
 
111
114
 
115
+ declare module '@tiptap/core' {
116
+ interface Storage {
117
+ color: ColorStorage;
118
+ }
119
+ }
120
+
121
+
112
122
  declare module '@tiptap/core' {
113
123
  interface Commands<ReturnType> {
114
- drawer: {
115
- setDrawer: (options: any, replace?: any) => ReturnType;
116
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
124
+ columns: {
125
+ insertColumns: (attrs?: {
126
+ cols: number;
127
+ }) => ReturnType;
128
+ addColBefore: () => ReturnType;
129
+ addColAfter: () => ReturnType;
130
+ deleteCol: () => ReturnType;
117
131
  };
118
132
  }
119
133
  }
@@ -121,8 +135,9 @@ declare module '@tiptap/core' {
121
135
 
122
136
  declare module '@tiptap/core' {
123
137
  interface Commands<ReturnType> {
124
- excalidraw: {
125
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
138
+ drawer: {
139
+ setDrawer: (options: any, replace?: any) => ReturnType;
140
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
126
141
  };
127
142
  }
128
143
  }
@@ -140,7 +155,16 @@ declare module '@tiptap/core' {
140
155
  declare module '@tiptap/core' {
141
156
  interface Commands<ReturnType> {
142
157
  exportWord: {
143
- exportToWord: () => ReturnType;
158
+ exportToWord: (docState: any) => ReturnType;
159
+ };
160
+ }
161
+ }
162
+
163
+
164
+ declare module '@tiptap/core' {
165
+ interface Commands<ReturnType> {
166
+ excalidraw: {
167
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
144
168
  };
145
169
  }
146
170
  }
@@ -165,10 +189,8 @@ declare module '@tiptap/core' {
165
189
 
166
190
 
167
191
  declare module '@tiptap/core' {
168
- interface Commands<ReturnType> {
169
- painter: {
170
- setPainter: (marks: Mark[]) => ReturnType;
171
- };
192
+ interface Storage {
193
+ highlight: HighlightStorage;
172
194
  }
173
195
  }
174
196
 
@@ -208,22 +230,6 @@ declare module '@tiptap/core' {
208
230
  }
209
231
 
210
232
 
211
- declare module '@tiptap/core' {
212
- interface Commands<ReturnType> {
213
- indent: {
214
- /**
215
- * Set the indent attribute
216
- */
217
- indent: () => ReturnType;
218
- /**
219
- * Set the outdent attribute
220
- */
221
- outdent: () => ReturnType;
222
- };
223
- }
224
- }
225
-
226
-
227
233
  declare module '@tiptap/core' {
228
234
  interface Commands<ReturnType> {
229
235
  imageGifUpload: {
@@ -246,8 +252,15 @@ declare module '@tiptap/core' {
246
252
 
247
253
  declare module '@tiptap/core' {
248
254
  interface Commands<ReturnType> {
249
- katex: {
250
- setKatex: (arg?: IKatexAttrs) => ReturnType;
255
+ indent: {
256
+ /**
257
+ * Set the indent attribute
258
+ */
259
+ indent: () => ReturnType;
260
+ /**
261
+ * Set the outdent attribute
262
+ */
263
+ outdent: () => ReturnType;
251
264
  };
252
265
  }
253
266
  }
@@ -255,9 +268,8 @@ declare module '@tiptap/core' {
255
268
 
256
269
  declare module '@tiptap/core' {
257
270
  interface Commands<ReturnType> {
258
- lineHeight: {
259
- setLineHeight: (lineHeight: string) => ReturnType;
260
- unsetLineHeight: () => ReturnType;
271
+ katex: {
272
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
261
273
  };
262
274
  }
263
275
  }
@@ -273,20 +285,6 @@ declare module '@tiptap/core' {
273
285
  }
274
286
 
275
287
 
276
- declare module '@tiptap/core' {
277
- interface Commands<ReturnType> {
278
- columns: {
279
- insertColumns: (attrs?: {
280
- cols: number;
281
- }) => ReturnType;
282
- addColBefore: () => ReturnType;
283
- addColAfter: () => ReturnType;
284
- deleteCol: () => ReturnType;
285
- };
286
- }
287
- }
288
-
289
-
290
288
  declare module '@tiptap/core' {
291
289
  interface Commands<ReturnType> {
292
290
  search: {
@@ -310,16 +308,6 @@ declare module '@tiptap/core' {
310
308
  }
311
309
 
312
310
 
313
- declare module '@tiptap/core' {
314
- interface Commands<ReturnType> {
315
- tableOfContents: {
316
- setTableOfContents: () => ReturnType;
317
- removeTableOfContents: () => ReturnType;
318
- };
319
- }
320
- }
321
-
322
-
323
311
  declare module '@tiptap/core' {
324
312
  interface Commands<ReturnType> {
325
313
  twitter: {
package/lib/CodeView.js CHANGED
@@ -1,22 +1,49 @@
1
- import { E as i } from "./index-kbO3iWqL.js";
2
- import { A as s } from "./RichTextEditor-DGcKEUGr.js";
3
- const r = /* @__PURE__ */ i.create({
1
+ import { E as l } from "./index-DnWWK9F_.js";
2
+ import { jsx as c, Fragment as g } from "react/jsx-runtime";
3
+ import { A as u } from "./toggle-Cdp4IT2U.js";
4
+ import "react";
5
+ import "./index-BPfVXs5_.js";
6
+ import { u as v, a as w } from "./useButtonProps-BsEd4zYM.js";
7
+ function H() {
8
+ const t = v(C.name), {
9
+ icon: e = void 0,
10
+ tooltip: o = void 0,
11
+ shortcutKeys: i = void 0,
12
+ tooltipOptions: a = {},
13
+ action: n = void 0,
14
+ isActive: r = void 0
15
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: p, disabled: s, update: d } = w(r), m = () => {
16
+ s || n && (n(), d());
17
+ };
18
+ return t ? /* @__PURE__ */ c(
19
+ u,
20
+ {
21
+ action: m,
22
+ dataState: p,
23
+ disabled: s,
24
+ icon: e,
25
+ shortcutKeys: i,
26
+ tooltip: o,
27
+ tooltipOptions: a
28
+ }
29
+ ) : /* @__PURE__ */ c(g, {});
30
+ }
31
+ const C = /* @__PURE__ */ l.create({
4
32
  name: "codeView",
5
33
  //@ts-expect-error
6
34
  addOptions() {
7
- var e;
35
+ var t;
8
36
  return {
9
- ...(e = this.parent) == null ? void 0 : e.call(this),
10
- button({ editor: t, t: o }) {
37
+ ...(t = this.parent) == null ? void 0 : t.call(this),
38
+ button({ editor: e, t: o }) {
11
39
  return {
12
- component: s,
13
40
  componentProps: {
14
41
  action: () => {
15
- t.commands.toggleCodeView();
42
+ e.commands.toggleCodeView();
16
43
  },
17
- isActive: () => t.storage.codeView.isActive || !1,
44
+ isActive: () => e.storage.codeView.isActive,
18
45
  disabled: !1,
19
- icon: "CodeView",
46
+ icon: "Html",
20
47
  tooltip: o("editor.codeView.tooltip") || "View HTML Code",
21
48
  customClass: "tiptap-code-view-button"
22
49
  }
@@ -32,23 +59,24 @@ const r = /* @__PURE__ */ i.create({
32
59
  },
33
60
  addCommands() {
34
61
  return {
35
- toggleCodeView: () => ({ editor: e }) => {
36
- const t = e.storage.codeView.isActive;
37
- if (t)
38
- e.commands.setContent(e.getText());
62
+ toggleCodeView: () => ({ editor: t }) => {
63
+ const e = t.storage.codeView.isActive;
64
+ if (e)
65
+ t.commands.setContent(t.getText());
39
66
  else {
40
- const o = e.getHTML();
41
- e.storage.codeView.originalContent = o;
42
- const n = o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
43
- e.commands.setContent(
44
- `<div class="tiptap-code-view-wrapper">${n}</div>`
67
+ const o = t.getHTML();
68
+ t.storage.codeView.originalContent = o;
69
+ const i = o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
70
+ t.commands.setContent(
71
+ `<div class="tiptap-code-view-wrapper">${i}</div>`
45
72
  );
46
73
  }
47
- return e.storage.codeView.isActive = !t, !0;
74
+ return t.storage.codeView.isActive = !e, !0;
48
75
  }
49
76
  };
50
77
  }
51
78
  });
52
79
  export {
53
- r as CodeView
80
+ C as CodeView,
81
+ H as RichTextCodeView
54
82
  };
package/lib/Color.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-BeCTd5v2.cjs"),e=require("react/jsx-runtime"),r=require("react"),o=require("./RichTextEditor-CxvwGvQG.cjs");function x({fill:t}){return e.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 240 240",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:e.jsx("g",{transform:"translate(0.000000, 0.500000)",children:e.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[e.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",id:"矩形",fill:t||"#DF2A3F",fillRule:"evenodd"}),e.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",id:"路径-21",fill:"currentColor",fillRule:"nonzero"}),e.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",id:"路径-22",fill:"currentColor",fillRule:"nonzero"})]})})})})}function h(t){const[i,a]=r.useState(void 0);function c(l){var d;(d=t.action)==null||d.call(t,l)}function n(){var l;(l=t.action)==null||l.call(t,i)}const u=r.useCallback(o.debounce(l=>{a(l)},350),[]);return e.jsxs("div",{className:"richtext-flex richtext-items-center richtext-h-[32px]",children:[e.jsx(o.ActionButton,{tooltip:t==null?void 0:t.tooltip,disabled:t==null?void 0:t.disabled,action:n,tooltipOptions:t==null?void 0:t.tooltipOptions,children:e.jsx("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-text-sm",children:e.jsx(x,{fill:i||t.initialDisplayedColor})})}),e.jsx(o.ColorPicker,{selectedColor:i,setSelectedColor:u,onChange:c,disabled:t==null?void 0:t.disabled,colors:t==null?void 0:t.colors,defaultColor:t==null?void 0:t.defaultColor,children:e.jsx(o.Button,{variant:"ghost",size:"icon",className:"r!ichtext-h-[32px] !richtext-w-3",disabled:t==null?void 0:t.disabled,children:e.jsx(o.IconComponent,{className:"!richtext-w-3 !richtext-h-3 richtext-text-zinc-500",name:"MenuDown"})})})]})}const C=s.Color.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:i,t:a,extension:c}){return{component:h,componentProps:{colors:c.options.colors,defaultColor:c.options.defaultColor,action:n=>{n===void 0&&i.chain().focus().unsetColor().run(),typeof n=="string"&&i.chain().focus().setColor(n).run()},isActive:()=>{const{color:n}=i.getAttributes("textStyle");return n&&i.isActive({color:n})||!1},editor:i,disabled:!1,tooltip:a("editor.color.tooltip")}}}}}});exports.Color=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-N--9MohJ.cjs"),t=require("react/jsx-runtime"),h=require("react"),g=require("./toggle-D41PzQLJ.cjs"),v=require("./separator-DRIrVZ2N.cjs");require("./index-DV5kbgRU.cjs");const j=require("./Icon-DUpv2cI6.cjs"),d=require("./useButtonProps-C6Vpn190.cjs");function m({fill:e}){return t.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 240 240",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:t.jsx("g",{transform:"translate(0.000000, 0.500000)",children:t.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[t.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",fill:typeof e=="string"?e:"#000",fillRule:"evenodd"}),t.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",fill:"currentColor",fillRule:"nonzero"}),t.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",fill:"currentColor",fillRule:"nonzero"})]})})})})}function L(){const e=d.useButtonProps(x.name),{tooltip:o=void 0,isActive:s=void 0,defaultColor:r=void 0,colors:n,action:i}=(e==null?void 0:e.componentProps)??{},{disabled:l,dataState:c}=d.useActive(s),[C,u]=h.useState(r);h.useEffect(()=>{u(c)},[c]);function f(a){l||i&&(i==null||i(a),u(a))}return e?t.jsx("div",{className:"richtext-flex richtext-h-[32px] richtext-items-center",children:t.jsx(v.ColorPicker,{colors:n,disabled:l,onChange:f,value:C,children:t.jsx(g.ActionButton,{disabled:l,tooltip:o,children:t.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[t.jsx(m,{fill:c}),t.jsx(j.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})})}):t.jsx(t.Fragment,{})}const x=p.Color.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:o,t:s,extension:r}){return{componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:n=>{if(typeof n=="string"){o.storage.color.currentColor=n,o.chain().focus().setColor(n).run();return}o.chain().focus().unsetColor().run()},isActive:()=>{const{color:n}=o.getAttributes("textStyle");return n},disabled:!1,shortcutKeys:r.options.shortcutKeys??["⇧","alt","C"],tooltip:s("editor.color.tooltip")}}}}},addKeyboardShortcuts(){var e;return{...(e=this.parent)==null?void 0:e.call(this),"Alt-Shift-c":()=>{const o=this.storage.currentColor||this.options.defaultColor;if(!o){const{color:r}=this.editor.getAttributes("textStyle");return r?this.editor.chain().focus().unsetColor().run():!1}return this.editor.isActive("textStyle",{color:o})?this.editor.chain().focus().unsetColor().run():this.editor.chain().focus().setColor(o).run()}}}});exports.Color=x;exports.RichTextColor=L;
package/lib/Color.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ColorOptions as ColorOptions_2 } from '@tiptap/extension-text-style';
2
2
  import { Editor } from '@tiptap/react';
3
3
  import { Extension } from '@tiptap/core';
4
+ import { JSX } from 'react/jsx-runtime';
4
5
 
5
6
  /**
6
7
  * Represents the ButtonView function.
@@ -68,6 +69,10 @@ export declare interface ColorOptions extends ColorOptions_2, GeneralOptions<Col
68
69
  defaultColor?: string;
69
70
  }
70
71
 
72
+ export declare interface ColorStorage {
73
+ currentColor?: string;
74
+ }
75
+
71
76
  /**
72
77
  * Represents the general options for Tiptap extensions.
73
78
  */
@@ -84,6 +89,8 @@ declare interface GeneralOptions<T> {
84
89
  shortcutKeys?: string[] | string[][];
85
90
  }
86
91
 
92
+ export declare function RichTextColor(): JSX.Element;
93
+
87
94
  export { }
88
95
 
89
96
 
@@ -117,11 +124,22 @@ declare module '@tiptap/core' {
117
124
  }
118
125
 
119
126
 
127
+ declare module '@tiptap/core' {
128
+ interface Storage {
129
+ color: ColorStorage;
130
+ }
131
+ }
132
+
133
+
120
134
  declare module '@tiptap/core' {
121
135
  interface Commands<ReturnType> {
122
- drawer: {
123
- setDrawer: (options: any, replace?: any) => ReturnType;
124
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
136
+ columns: {
137
+ insertColumns: (attrs?: {
138
+ cols: number;
139
+ }) => ReturnType;
140
+ addColBefore: () => ReturnType;
141
+ addColAfter: () => ReturnType;
142
+ deleteCol: () => ReturnType;
125
143
  };
126
144
  }
127
145
  }
@@ -129,8 +147,9 @@ declare module '@tiptap/core' {
129
147
 
130
148
  declare module '@tiptap/core' {
131
149
  interface Commands<ReturnType> {
132
- excalidraw: {
133
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
150
+ drawer: {
151
+ setDrawer: (options: any, replace?: any) => ReturnType;
152
+ setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
134
153
  };
135
154
  }
136
155
  }
@@ -148,7 +167,16 @@ declare module '@tiptap/core' {
148
167
  declare module '@tiptap/core' {
149
168
  interface Commands<ReturnType> {
150
169
  exportWord: {
151
- exportToWord: () => ReturnType;
170
+ exportToWord: (docState: any) => ReturnType;
171
+ };
172
+ }
173
+ }
174
+
175
+
176
+ declare module '@tiptap/core' {
177
+ interface Commands<ReturnType> {
178
+ excalidraw: {
179
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
152
180
  };
153
181
  }
154
182
  }
@@ -173,10 +201,8 @@ declare module '@tiptap/core' {
173
201
 
174
202
 
175
203
  declare module '@tiptap/core' {
176
- interface Commands<ReturnType> {
177
- painter: {
178
- setPainter: (marks: Mark[]) => ReturnType;
179
- };
204
+ interface Storage {
205
+ highlight: HighlightStorage;
180
206
  }
181
207
  }
182
208
 
@@ -216,22 +242,6 @@ declare module '@tiptap/core' {
216
242
  }
217
243
 
218
244
 
219
- declare module '@tiptap/core' {
220
- interface Commands<ReturnType> {
221
- indent: {
222
- /**
223
- * Set the indent attribute
224
- */
225
- indent: () => ReturnType;
226
- /**
227
- * Set the outdent attribute
228
- */
229
- outdent: () => ReturnType;
230
- };
231
- }
232
- }
233
-
234
-
235
245
  declare module '@tiptap/core' {
236
246
  interface Commands<ReturnType> {
237
247
  imageGifUpload: {
@@ -254,8 +264,15 @@ declare module '@tiptap/core' {
254
264
 
255
265
  declare module '@tiptap/core' {
256
266
  interface Commands<ReturnType> {
257
- katex: {
258
- setKatex: (arg?: IKatexAttrs) => ReturnType;
267
+ indent: {
268
+ /**
269
+ * Set the indent attribute
270
+ */
271
+ indent: () => ReturnType;
272
+ /**
273
+ * Set the outdent attribute
274
+ */
275
+ outdent: () => ReturnType;
259
276
  };
260
277
  }
261
278
  }
@@ -263,9 +280,8 @@ declare module '@tiptap/core' {
263
280
 
264
281
  declare module '@tiptap/core' {
265
282
  interface Commands<ReturnType> {
266
- lineHeight: {
267
- setLineHeight: (lineHeight: string) => ReturnType;
268
- unsetLineHeight: () => ReturnType;
283
+ katex: {
284
+ setKatex: (arg?: IKatexAttrs) => ReturnType;
269
285
  };
270
286
  }
271
287
  }
@@ -281,20 +297,6 @@ declare module '@tiptap/core' {
281
297
  }
282
298
 
283
299
 
284
- declare module '@tiptap/core' {
285
- interface Commands<ReturnType> {
286
- columns: {
287
- insertColumns: (attrs?: {
288
- cols: number;
289
- }) => ReturnType;
290
- addColBefore: () => ReturnType;
291
- addColAfter: () => ReturnType;
292
- deleteCol: () => ReturnType;
293
- };
294
- }
295
- }
296
-
297
-
298
300
  declare module '@tiptap/core' {
299
301
  interface Commands<ReturnType> {
300
302
  search: {
@@ -318,16 +320,6 @@ declare module '@tiptap/core' {
318
320
  }
319
321
 
320
322
 
321
- declare module '@tiptap/core' {
322
- interface Commands<ReturnType> {
323
- tableOfContents: {
324
- setTableOfContents: () => ReturnType;
325
- removeTableOfContents: () => ReturnType;
326
- };
327
- }
328
- }
329
-
330
-
331
323
  declare module '@tiptap/core' {
332
324
  interface Commands<ReturnType> {
333
325
  twitter: {