@kopexa/tiptap 17.6.18 → 17.7.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 (428) hide show
  1. package/dist/index.d.mts +691 -24
  2. package/dist/index.d.ts +691 -24
  3. package/dist/index.js +1081 -668
  4. package/dist/index.mjs +7686 -112
  5. package/package.json +57 -52
  6. package/dist/chunk-2SI7MRAE.mjs +0 -64
  7. package/dist/chunk-2U5CQUZH.mjs +0 -91
  8. package/dist/chunk-2UDCL55K.mjs +0 -55
  9. package/dist/chunk-2V6VOAPI.mjs +0 -139
  10. package/dist/chunk-2Z2QVW67.mjs +0 -1
  11. package/dist/chunk-32SUXCAQ.mjs +0 -115
  12. package/dist/chunk-33QD5PYJ.mjs +0 -63
  13. package/dist/chunk-3VRQUYYW.mjs +0 -169
  14. package/dist/chunk-42HKGCOO.mjs +0 -129
  15. package/dist/chunk-4ALV4UA5.mjs +0 -1
  16. package/dist/chunk-4CDZ547I.mjs +0 -185
  17. package/dist/chunk-4HO7BWDC.mjs +0 -89
  18. package/dist/chunk-4JRYQZ4A.mjs +0 -174
  19. package/dist/chunk-552JLRNB.mjs +0 -35
  20. package/dist/chunk-5SMDMQDF.mjs +0 -34
  21. package/dist/chunk-6552DQWB.mjs +0 -416
  22. package/dist/chunk-7FDDRVUE.mjs +0 -143
  23. package/dist/chunk-7VGROP26.mjs +0 -262
  24. package/dist/chunk-7VW67NVL.mjs +0 -80
  25. package/dist/chunk-AAV7ZNBP.mjs +0 -83
  26. package/dist/chunk-ATRHILCH.mjs +0 -1
  27. package/dist/chunk-B7WJOQ3X.mjs +0 -103
  28. package/dist/chunk-BEV5U2DK.mjs +0 -131
  29. package/dist/chunk-BXHPO3T7.mjs +0 -152
  30. package/dist/chunk-BXJYNSWQ.mjs +0 -30
  31. package/dist/chunk-C5RQWJKE.mjs +0 -155
  32. package/dist/chunk-CNVACBGT.mjs +0 -51
  33. package/dist/chunk-DQK6PA4U.mjs +0 -276
  34. package/dist/chunk-DSBJFMHK.mjs +0 -38
  35. package/dist/chunk-DT7ML2P4.mjs +0 -42
  36. package/dist/chunk-DZLGLP7R.mjs +0 -99
  37. package/dist/chunk-EAAQE5ZV.mjs +0 -283
  38. package/dist/chunk-EHY2NAW7.mjs +0 -120
  39. package/dist/chunk-EIIWU5FR.mjs +0 -61
  40. package/dist/chunk-ERPGWXFK.mjs +0 -163
  41. package/dist/chunk-F73FCUD5.mjs +0 -1
  42. package/dist/chunk-FRJX2F4T.mjs +0 -55
  43. package/dist/chunk-GYIYX2JH.mjs +0 -73
  44. package/dist/chunk-H6LC4LDQ.mjs +0 -63
  45. package/dist/chunk-H7MS2UMO.mjs +0 -168
  46. package/dist/chunk-HLLA2HRV.mjs +0 -1
  47. package/dist/chunk-HTJ2RXOG.mjs +0 -32
  48. package/dist/chunk-IFXRPGIJ.mjs +0 -98
  49. package/dist/chunk-IOB3REX6.mjs +0 -173
  50. package/dist/chunk-IQERE7KP.mjs +0 -115
  51. package/dist/chunk-JCV5SEKN.mjs +0 -65
  52. package/dist/chunk-JVSH5T4B.mjs +0 -72
  53. package/dist/chunk-KK4K43WM.mjs +0 -59
  54. package/dist/chunk-KR42JAVB.mjs +0 -60
  55. package/dist/chunk-KYLBKQ2E.mjs +0 -203
  56. package/dist/chunk-L5RDMV3H.mjs +0 -216
  57. package/dist/chunk-LNVWG34E.mjs +0 -165
  58. package/dist/chunk-LVNUU67N.mjs +0 -1
  59. package/dist/chunk-MNTOOEHA.mjs +0 -1
  60. package/dist/chunk-N3JE67CS.mjs +0 -81
  61. package/dist/chunk-N4CT5RNC.mjs +0 -123
  62. package/dist/chunk-OEVR5N7X.mjs +0 -65
  63. package/dist/chunk-P55PLOHR.mjs +0 -34
  64. package/dist/chunk-Q5FK7SFY.mjs +0 -75
  65. package/dist/chunk-Q7DFJ5NI.mjs +0 -153
  66. package/dist/chunk-QIELBKP3.mjs +0 -104
  67. package/dist/chunk-R2GM4A3T.mjs +0 -71
  68. package/dist/chunk-REJEJXOZ.mjs +0 -10
  69. package/dist/chunk-RFWNKE7D.mjs +0 -238
  70. package/dist/chunk-TAM3VMJT.mjs +0 -80
  71. package/dist/chunk-TDFS3DCZ.mjs +0 -79
  72. package/dist/chunk-TLM5ALHZ.mjs +0 -1
  73. package/dist/chunk-TZQQ6C2Q.mjs +0 -101
  74. package/dist/chunk-U5XAL46P.mjs +0 -39
  75. package/dist/chunk-UJ4BNZ63.mjs +0 -178
  76. package/dist/chunk-UVHVCION.mjs +0 -168
  77. package/dist/chunk-V6TAZMQN.mjs +0 -105
  78. package/dist/chunk-VF3G2URZ.mjs +0 -83
  79. package/dist/chunk-VRQ6OSAZ.mjs +0 -76
  80. package/dist/chunk-VTKJPVNM.mjs +0 -148
  81. package/dist/chunk-VX3HSJ76.mjs +0 -73
  82. package/dist/chunk-W2FLOOJ6.mjs +0 -75
  83. package/dist/chunk-XGAABDMW.mjs +0 -159
  84. package/dist/chunk-Y2KSWMG5.mjs +0 -1
  85. package/dist/chunk-YJAHZXLG.mjs +0 -92
  86. package/dist/chunk-Z365KVQY.mjs +0 -34
  87. package/dist/chunk-ZVTJ6XD7.mjs +0 -88
  88. package/dist/chunk-ZZ4OU46C.mjs +0 -131
  89. package/dist/context/editor-context.d.mts +0 -10
  90. package/dist/context/editor-context.d.ts +0 -10
  91. package/dist/context/editor-context.js +0 -34
  92. package/dist/context/editor-context.mjs +0 -9
  93. package/dist/context/editor-file-context.d.mts +0 -70
  94. package/dist/context/editor-file-context.d.ts +0 -70
  95. package/dist/context/editor-file-context.js +0 -96
  96. package/dist/context/editor-file-context.mjs +0 -12
  97. package/dist/extensions/callout/callout-settings.d.mts +0 -13
  98. package/dist/extensions/callout/callout-settings.d.ts +0 -13
  99. package/dist/extensions/callout/callout-settings.js +0 -206
  100. package/dist/extensions/callout/callout-settings.mjs +0 -9
  101. package/dist/extensions/callout/callout-view.d.mts +0 -12
  102. package/dist/extensions/callout/callout-view.d.ts +0 -12
  103. package/dist/extensions/callout/callout-view.js +0 -273
  104. package/dist/extensions/callout/callout-view.mjs +0 -12
  105. package/dist/extensions/callout/index.d.mts +0 -44
  106. package/dist/extensions/callout/index.d.ts +0 -44
  107. package/dist/extensions/callout/index.js +0 -380
  108. package/dist/extensions/callout/index.mjs +0 -13
  109. package/dist/extensions/callout/messages.d.mts +0 -59
  110. package/dist/extensions/callout/messages.d.ts +0 -59
  111. package/dist/extensions/callout/messages.js +0 -88
  112. package/dist/extensions/callout/messages.mjs +0 -7
  113. package/dist/extensions/image/image-view.d.mts +0 -15
  114. package/dist/extensions/image/image-view.d.ts +0 -15
  115. package/dist/extensions/image/image-view.js +0 -255
  116. package/dist/extensions/image/image-view.mjs +0 -12
  117. package/dist/extensions/image/index.d.mts +0 -29
  118. package/dist/extensions/image/index.d.ts +0 -29
  119. package/dist/extensions/image/index.js +0 -282
  120. package/dist/extensions/image/index.mjs +0 -16
  121. package/dist/extensions/image/messages.d.mts +0 -28
  122. package/dist/extensions/image/messages.d.ts +0 -28
  123. package/dist/extensions/image/messages.js +0 -57
  124. package/dist/extensions/image/messages.mjs +0 -7
  125. package/dist/extensions/image-upload/image-upload-view.d.mts +0 -12
  126. package/dist/extensions/image-upload/image-upload-view.d.ts +0 -12
  127. package/dist/extensions/image-upload/image-upload-view.js +0 -338
  128. package/dist/extensions/image-upload/image-upload-view.mjs +0 -12
  129. package/dist/extensions/image-upload/index.d.mts +0 -46
  130. package/dist/extensions/image-upload/index.d.ts +0 -46
  131. package/dist/extensions/image-upload/index.js +0 -414
  132. package/dist/extensions/image-upload/index.mjs +0 -16
  133. package/dist/extensions/image-upload/messages.d.mts +0 -32
  134. package/dist/extensions/image-upload/messages.d.ts +0 -32
  135. package/dist/extensions/image-upload/messages.js +0 -61
  136. package/dist/extensions/image-upload/messages.mjs +0 -7
  137. package/dist/extensions/link/index.d.mts +0 -6
  138. package/dist/extensions/link/index.d.ts +0 -6
  139. package/dist/extensions/link/index.js +0 -94
  140. package/dist/extensions/link/index.mjs +0 -7
  141. package/dist/extensions/math/index.d.mts +0 -38
  142. package/dist/extensions/math/index.d.ts +0 -38
  143. package/dist/extensions/math/index.js +0 -544
  144. package/dist/extensions/math/index.mjs +0 -17
  145. package/dist/extensions/math/inline-math-view.d.mts +0 -12
  146. package/dist/extensions/math/inline-math-view.d.ts +0 -12
  147. package/dist/extensions/math/inline-math-view.js +0 -232
  148. package/dist/extensions/math/inline-math-view.mjs +0 -11
  149. package/dist/extensions/math/inline-math.d.mts +0 -32
  150. package/dist/extensions/math/inline-math.d.ts +0 -32
  151. package/dist/extensions/math/inline-math.js +0 -304
  152. package/dist/extensions/math/inline-math.mjs +0 -12
  153. package/dist/extensions/math/math-block-view.d.mts +0 -11
  154. package/dist/extensions/math/math-block-view.d.ts +0 -11
  155. package/dist/extensions/math/math-block-view.js +0 -248
  156. package/dist/extensions/math/math-block-view.mjs +0 -11
  157. package/dist/extensions/math/messages.d.mts +0 -49
  158. package/dist/extensions/math/messages.d.ts +0 -49
  159. package/dist/extensions/math/messages.js +0 -78
  160. package/dist/extensions/math/messages.mjs +0 -7
  161. package/dist/extensions/selection/index.d.mts +0 -5
  162. package/dist/extensions/selection/index.d.ts +0 -5
  163. package/dist/extensions/selection/index.js +0 -62
  164. package/dist/extensions/selection/index.mjs +0 -7
  165. package/dist/extensions/toc/index.d.mts +0 -53
  166. package/dist/extensions/toc/index.d.ts +0 -53
  167. package/dist/extensions/toc/index.js +0 -501
  168. package/dist/extensions/toc/index.mjs +0 -13
  169. package/dist/extensions/toc/messages.d.mts +0 -74
  170. package/dist/extensions/toc/messages.d.ts +0 -74
  171. package/dist/extensions/toc/messages.js +0 -103
  172. package/dist/extensions/toc/messages.mjs +0 -7
  173. package/dist/extensions/toc/toc-settings.d.mts +0 -13
  174. package/dist/extensions/toc/toc-settings.d.ts +0 -13
  175. package/dist/extensions/toc/toc-settings.js +0 -283
  176. package/dist/extensions/toc/toc-settings.mjs +0 -9
  177. package/dist/extensions/toc/toc-view.d.mts +0 -12
  178. package/dist/extensions/toc/toc-view.d.ts +0 -12
  179. package/dist/extensions/toc/toc-view.js +0 -411
  180. package/dist/extensions/toc/toc-view.mjs +0 -12
  181. package/dist/extensions/trailing-node/index.d.mts +0 -9
  182. package/dist/extensions/trailing-node/index.d.ts +0 -9
  183. package/dist/extensions/trailing-node/index.js +0 -86
  184. package/dist/extensions/trailing-node/index.mjs +0 -7
  185. package/dist/extensions/ui-state/index.d.mts +0 -34
  186. package/dist/extensions/ui-state/index.d.ts +0 -34
  187. package/dist/extensions/ui-state/index.js +0 -84
  188. package/dist/extensions/ui-state/index.mjs +0 -9
  189. package/dist/extensions/variable/extract-variables.d.mts +0 -16
  190. package/dist/extensions/variable/extract-variables.d.ts +0 -16
  191. package/dist/extensions/variable/extract-variables.js +0 -58
  192. package/dist/extensions/variable/extract-variables.mjs +0 -7
  193. package/dist/extensions/variable/index.d.mts +0 -38
  194. package/dist/extensions/variable/index.d.ts +0 -38
  195. package/dist/extensions/variable/index.js +0 -190
  196. package/dist/extensions/variable/index.mjs +0 -11
  197. package/dist/extensions/variable/messages.d.mts +0 -69
  198. package/dist/extensions/variable/messages.d.ts +0 -69
  199. package/dist/extensions/variable/messages.js +0 -98
  200. package/dist/extensions/variable/messages.mjs +0 -7
  201. package/dist/extensions/variable/variable-context.d.mts +0 -56
  202. package/dist/extensions/variable/variable-context.d.ts +0 -56
  203. package/dist/extensions/variable/variable-context.js +0 -70
  204. package/dist/extensions/variable/variable-context.mjs +0 -12
  205. package/dist/extensions/variable/variable-filler-dialog.d.mts +0 -43
  206. package/dist/extensions/variable/variable-filler-dialog.d.ts +0 -43
  207. package/dist/extensions/variable/variable-filler-dialog.js +0 -207
  208. package/dist/extensions/variable/variable-filler-dialog.mjs +0 -9
  209. package/dist/extensions/variable/variable-suggestion.d.mts +0 -31
  210. package/dist/extensions/variable/variable-suggestion.d.ts +0 -31
  211. package/dist/extensions/variable/variable-suggestion.js +0 -615
  212. package/dist/extensions/variable/variable-suggestion.mjs +0 -14
  213. package/dist/extensions/variable/variable-view.d.mts +0 -13
  214. package/dist/extensions/variable/variable-view.d.ts +0 -13
  215. package/dist/extensions/variable/variable-view.js +0 -110
  216. package/dist/extensions/variable/variable-view.mjs +0 -11
  217. package/dist/hooks/use-create-editor.d.mts +0 -46
  218. package/dist/hooks/use-create-editor.d.ts +0 -46
  219. package/dist/hooks/use-create-editor.js +0 -2726
  220. package/dist/hooks/use-create-editor.mjs +0 -37
  221. package/dist/hooks/use-cursor-visibility.d.mts +0 -37
  222. package/dist/hooks/use-cursor-visibility.d.ts +0 -37
  223. package/dist/hooks/use-cursor-visibility.js +0 -140
  224. package/dist/hooks/use-cursor-visibility.mjs +0 -8
  225. package/dist/hooks/use-floating-element.d.mts +0 -43
  226. package/dist/hooks/use-floating-element.d.ts +0 -43
  227. package/dist/hooks/use-floating-element.js +0 -88
  228. package/dist/hooks/use-floating-element.mjs +0 -8
  229. package/dist/hooks/use-floating-toolbar-visibility.d.mts +0 -32
  230. package/dist/hooks/use-floating-toolbar-visibility.d.ts +0 -32
  231. package/dist/hooks/use-floating-toolbar-visibility.js +0 -115
  232. package/dist/hooks/use-floating-toolbar-visibility.mjs +0 -13
  233. package/dist/hooks/use-menu-navigation.d.mts +0 -55
  234. package/dist/hooks/use-menu-navigation.d.ts +0 -55
  235. package/dist/hooks/use-menu-navigation.js +0 -163
  236. package/dist/hooks/use-menu-navigation.mjs +0 -8
  237. package/dist/hooks/use-tiptap-editor.d.mts +0 -20
  238. package/dist/hooks/use-tiptap-editor.d.ts +0 -20
  239. package/dist/hooks/use-tiptap-editor.js +0 -58
  240. package/dist/hooks/use-tiptap-editor.mjs +0 -8
  241. package/dist/hooks/use-ui-editor-state.d.mts +0 -7
  242. package/dist/hooks/use-ui-editor-state.d.ts +0 -7
  243. package/dist/hooks/use-ui-editor-state.js +0 -107
  244. package/dist/hooks/use-ui-editor-state.mjs +0 -11
  245. package/dist/hooks/use-window-size.d.mts +0 -12
  246. package/dist/hooks/use-window-size.d.ts +0 -12
  247. package/dist/hooks/use-window-size.js +0 -75
  248. package/dist/hooks/use-window-size.mjs +0 -7
  249. package/dist/presets/basic/editor-header.d.mts +0 -23
  250. package/dist/presets/basic/editor-header.d.ts +0 -23
  251. package/dist/presets/basic/editor-header.js +0 -2750
  252. package/dist/presets/basic/editor-header.mjs +0 -43
  253. package/dist/presets/basic/index.d.mts +0 -38
  254. package/dist/presets/basic/index.d.ts +0 -38
  255. package/dist/presets/basic/index.js +0 -6891
  256. package/dist/presets/basic/index.mjs +0 -85
  257. package/dist/ui/blockquote-button/blockquote-button.d.mts +0 -20
  258. package/dist/ui/blockquote-button/blockquote-button.d.ts +0 -20
  259. package/dist/ui/blockquote-button/blockquote-button.js +0 -247
  260. package/dist/ui/blockquote-button/blockquote-button.mjs +0 -9
  261. package/dist/ui/blockquote-button/index.d.mts +0 -6
  262. package/dist/ui/blockquote-button/index.d.ts +0 -6
  263. package/dist/ui/blockquote-button/index.js +0 -259
  264. package/dist/ui/blockquote-button/index.mjs +0 -21
  265. package/dist/ui/blockquote-button/use-blockquote.d.mts +0 -85
  266. package/dist/ui/blockquote-button/use-blockquote.d.ts +0 -85
  267. package/dist/ui/blockquote-button/use-blockquote.js +0 -192
  268. package/dist/ui/blockquote-button/use-blockquote.mjs +0 -17
  269. package/dist/ui/bubble-menu/index.d.mts +0 -13
  270. package/dist/ui/bubble-menu/index.d.ts +0 -13
  271. package/dist/ui/bubble-menu/index.js +0 -673
  272. package/dist/ui/bubble-menu/index.mjs +0 -16
  273. package/dist/ui/codeblock-button/code-block-button.d.mts +0 -20
  274. package/dist/ui/codeblock-button/code-block-button.d.ts +0 -20
  275. package/dist/ui/codeblock-button/code-block-button.js +0 -237
  276. package/dist/ui/codeblock-button/code-block-button.mjs +0 -9
  277. package/dist/ui/codeblock-button/index.d.mts +0 -6
  278. package/dist/ui/codeblock-button/index.d.ts +0 -6
  279. package/dist/ui/codeblock-button/index.js +0 -249
  280. package/dist/ui/codeblock-button/index.mjs +0 -21
  281. package/dist/ui/codeblock-button/use-code-block.d.mts +0 -92
  282. package/dist/ui/codeblock-button/use-code-block.d.ts +0 -92
  283. package/dist/ui/codeblock-button/use-code-block.js +0 -192
  284. package/dist/ui/codeblock-button/use-code-block.mjs +0 -17
  285. package/dist/ui/color-highlight-button/color-highlight-button.d.mts +0 -25
  286. package/dist/ui/color-highlight-button/color-highlight-button.d.ts +0 -25
  287. package/dist/ui/color-highlight-button/color-highlight-button.js +0 -266
  288. package/dist/ui/color-highlight-button/color-highlight-button.mjs +0 -9
  289. package/dist/ui/color-highlight-button/index.d.mts +0 -6
  290. package/dist/ui/color-highlight-button/index.d.ts +0 -6
  291. package/dist/ui/color-highlight-button/index.js +0 -342
  292. package/dist/ui/color-highlight-button/index.mjs +0 -27
  293. package/dist/ui/color-highlight-button/use-color-highlight.d.mts +0 -64
  294. package/dist/ui/color-highlight-button/use-color-highlight.d.ts +0 -64
  295. package/dist/ui/color-highlight-button/use-color-highlight.js +0 -247
  296. package/dist/ui/color-highlight-button/use-color-highlight.mjs +0 -23
  297. package/dist/ui/color-highlight-popover/color-highlight-popover.d.mts +0 -29
  298. package/dist/ui/color-highlight-popover/color-highlight-popover.d.ts +0 -29
  299. package/dist/ui/color-highlight-popover/color-highlight-popover.js +0 -590
  300. package/dist/ui/color-highlight-popover/color-highlight-popover.mjs +0 -17
  301. package/dist/ui/color-highlight-popover/index.d.mts +0 -6
  302. package/dist/ui/color-highlight-popover/index.d.ts +0 -6
  303. package/dist/ui/color-highlight-popover/index.js +0 -591
  304. package/dist/ui/color-highlight-popover/index.mjs +0 -17
  305. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.d.mts +0 -30
  306. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.d.ts +0 -30
  307. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.js +0 -171
  308. package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.mjs +0 -10
  309. package/dist/ui/heading-button/index.d.mts +0 -45
  310. package/dist/ui/heading-button/index.d.ts +0 -45
  311. package/dist/ui/heading-button/index.js +0 -222
  312. package/dist/ui/heading-button/index.mjs +0 -16
  313. package/dist/ui/heading-button/utils.d.mts +0 -17
  314. package/dist/ui/heading-button/utils.d.ts +0 -17
  315. package/dist/ui/heading-button/utils.js +0 -92
  316. package/dist/ui/heading-button/utils.mjs +0 -19
  317. package/dist/ui/heading-dropdown-menu/index.d.mts +0 -14
  318. package/dist/ui/heading-dropdown-menu/index.d.ts +0 -14
  319. package/dist/ui/heading-dropdown-menu/index.js +0 -308
  320. package/dist/ui/heading-dropdown-menu/index.mjs +0 -10
  321. package/dist/ui/link-bubble/index.d.mts +0 -13
  322. package/dist/ui/link-bubble/index.d.ts +0 -13
  323. package/dist/ui/link-bubble/index.js +0 -183
  324. package/dist/ui/link-bubble/index.mjs +0 -10
  325. package/dist/ui/link-popover/index.d.mts +0 -7
  326. package/dist/ui/link-popover/index.d.ts +0 -7
  327. package/dist/ui/link-popover/index.js +0 -512
  328. package/dist/ui/link-popover/index.mjs +0 -30
  329. package/dist/ui/link-popover/link-popover.d.mts +0 -85
  330. package/dist/ui/link-popover/link-popover.d.ts +0 -85
  331. package/dist/ui/link-popover/link-popover.js +0 -498
  332. package/dist/ui/link-popover/link-popover.mjs +0 -16
  333. package/dist/ui/link-popover/use-link-popover.d.mts +0 -123
  334. package/dist/ui/link-popover/use-link-popover.d.ts +0 -123
  335. package/dist/ui/link-popover/use-link-popover.js +0 -259
  336. package/dist/ui/link-popover/use-link-popover.mjs +0 -20
  337. package/dist/ui/list-button/index.d.mts +0 -50
  338. package/dist/ui/list-button/index.d.ts +0 -50
  339. package/dist/ui/list-button/index.js +0 -232
  340. package/dist/ui/list-button/index.mjs +0 -24
  341. package/dist/ui/list-dropdown-menu/index.d.mts +0 -45
  342. package/dist/ui/list-dropdown-menu/index.d.ts +0 -45
  343. package/dist/ui/list-dropdown-menu/index.js +0 -361
  344. package/dist/ui/list-dropdown-menu/index.mjs +0 -21
  345. package/dist/ui/mark-button/index.d.mts +0 -59
  346. package/dist/ui/mark-button/index.d.ts +0 -59
  347. package/dist/ui/mark-button/index.js +0 -217
  348. package/dist/ui/mark-button/index.mjs +0 -26
  349. package/dist/ui/reset-all-formatting-button/index.d.mts +0 -7
  350. package/dist/ui/reset-all-formatting-button/index.d.ts +0 -7
  351. package/dist/ui/reset-all-formatting-button/index.js +0 -286
  352. package/dist/ui/reset-all-formatting-button/index.mjs +0 -26
  353. package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.d.mts +0 -30
  354. package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.d.ts +0 -30
  355. package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.js +0 -271
  356. package/dist/ui/reset-all-formatting-button/reset-all-formatting-button.mjs +0 -12
  357. package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.d.mts +0 -103
  358. package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.d.ts +0 -103
  359. package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.js +0 -211
  360. package/dist/ui/reset-all-formatting-button/use-reset-all-formatting.mjs +0 -21
  361. package/dist/ui/slash-dropdown-menu/index.d.mts +0 -10
  362. package/dist/ui/slash-dropdown-menu/index.d.ts +0 -10
  363. package/dist/ui/slash-dropdown-menu/index.js +0 -1056
  364. package/dist/ui/slash-dropdown-menu/index.mjs +0 -19
  365. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.d.mts +0 -16
  366. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.d.ts +0 -16
  367. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.js +0 -1053
  368. package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.mjs +0 -16
  369. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.d.mts +0 -162
  370. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.d.ts +0 -162
  371. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.js +0 -457
  372. package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.mjs +0 -10
  373. package/dist/ui/suggestion-menu/index.d.mts +0 -10
  374. package/dist/ui/suggestion-menu/index.d.ts +0 -10
  375. package/dist/ui/suggestion-menu/index.js +0 -489
  376. package/dist/ui/suggestion-menu/index.mjs +0 -17
  377. package/dist/ui/suggestion-menu/suggestion-menu-types.d.mts +0 -89
  378. package/dist/ui/suggestion-menu/suggestion-menu-types.d.ts +0 -89
  379. package/dist/ui/suggestion-menu/suggestion-menu-types.js +0 -19
  380. package/dist/ui/suggestion-menu/suggestion-menu-types.mjs +0 -1
  381. package/dist/ui/suggestion-menu/suggestion-menu-utils.d.mts +0 -27
  382. package/dist/ui/suggestion-menu/suggestion-menu-utils.d.ts +0 -27
  383. package/dist/ui/suggestion-menu/suggestion-menu-utils.js +0 -75
  384. package/dist/ui/suggestion-menu/suggestion-menu-utils.mjs +0 -9
  385. package/dist/ui/suggestion-menu/suggestion-menu.d.mts +0 -15
  386. package/dist/ui/suggestion-menu/suggestion-menu.d.ts +0 -15
  387. package/dist/ui/suggestion-menu/suggestion-menu.js +0 -453
  388. package/dist/ui/suggestion-menu/suggestion-menu.mjs +0 -12
  389. package/dist/ui/table-button/index.d.mts +0 -15
  390. package/dist/ui/table-button/index.d.ts +0 -15
  391. package/dist/ui/table-button/index.js +0 -202
  392. package/dist/ui/table-button/index.mjs +0 -9
  393. package/dist/ui/table-button/use-table.d.mts +0 -51
  394. package/dist/ui/table-button/use-table.d.ts +0 -51
  395. package/dist/ui/table-button/use-table.js +0 -146
  396. package/dist/ui/table-button/use-table.mjs +0 -14
  397. package/dist/ui/text-align-button/index.d.mts +0 -6
  398. package/dist/ui/text-align-button/index.d.ts +0 -6
  399. package/dist/ui/text-align-button/index.js +0 -235
  400. package/dist/ui/text-align-button/index.mjs +0 -29
  401. package/dist/ui/text-align-button/text-align-button.d.mts +0 -20
  402. package/dist/ui/text-align-button/text-align-button.d.ts +0 -20
  403. package/dist/ui/text-align-button/text-align-button.js +0 -215
  404. package/dist/ui/text-align-button/text-align-button.mjs +0 -9
  405. package/dist/ui/text-align-button/use-text-align.d.mts +0 -106
  406. package/dist/ui/text-align-button/use-text-align.d.ts +0 -106
  407. package/dist/ui/text-align-button/use-text-align.js +0 -169
  408. package/dist/ui/text-align-button/use-text-align.mjs +0 -24
  409. package/dist/ui/undo-redo-button/index.d.mts +0 -6
  410. package/dist/ui/undo-redo-button/index.d.ts +0 -6
  411. package/dist/ui/undo-redo-button/index.js +0 -202
  412. package/dist/ui/undo-redo-button/index.mjs +0 -25
  413. package/dist/ui/undo-redo-button/undo-redo-button.d.mts +0 -23
  414. package/dist/ui/undo-redo-button/undo-redo-button.d.ts +0 -23
  415. package/dist/ui/undo-redo-button/undo-redo-button.js +0 -187
  416. package/dist/ui/undo-redo-button/undo-redo-button.mjs +0 -10
  417. package/dist/ui/undo-redo-button/use-undo-redo.d.mts +0 -95
  418. package/dist/ui/undo-redo-button/use-undo-redo.d.ts +0 -95
  419. package/dist/ui/undo-redo-button/use-undo-redo.js +0 -146
  420. package/dist/ui/undo-redo-button/use-undo-redo.mjs +0 -21
  421. package/dist/utils/index.d.mts +0 -38
  422. package/dist/utils/index.d.ts +0 -38
  423. package/dist/utils/index.js +0 -128
  424. package/dist/utils/index.mjs +0 -15
  425. package/dist/utils/safe-parse.d.mts +0 -14
  426. package/dist/utils/safe-parse.d.ts +0 -14
  427. package/dist/utils/safe-parse.js +0 -203
  428. package/dist/utils/safe-parse.mjs +0 -8
@@ -1,1053 +0,0 @@
1
- "use client";
2
- "use strict";
3
- "use client";
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
-
32
- // src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
33
- var slash_dropdown_menu_exports = {};
34
- __export(slash_dropdown_menu_exports, {
35
- SlashDropdownMenu: () => SlashDropdownMenu
36
- });
37
- module.exports = __toCommonJS(slash_dropdown_menu_exports);
38
- var import_button = require("@kopexa/button");
39
- var import_editor_utils3 = require("@kopexa/editor-utils");
40
- var import_separator = require("@kopexa/separator");
41
- var import_theme = require("@kopexa/theme");
42
- var React5 = __toESM(require("react"));
43
-
44
- // src/ui/suggestion-menu/suggestion-menu.tsx
45
- var import_react4 = require("@floating-ui/react");
46
- var import_state = require("@tiptap/pm/state");
47
- var import_suggestion = require("@tiptap/suggestion");
48
- var React3 = __toESM(require("react"));
49
-
50
- // src/hooks/use-floating-element.ts
51
- var import_react = require("@floating-ui/react");
52
- var React = __toESM(require("react"));
53
- function useFloatingElement(show, referencePos, zIndex, options) {
54
- const { dismissOptions, ...floatingOptions } = options || {};
55
- const { refs, update, context, floatingStyles } = (0, import_react.useFloating)({
56
- open: show,
57
- ...floatingOptions
58
- });
59
- const { isMounted, styles } = (0, import_react.useTransitionStyles)(context);
60
- const dismiss = (0, import_react.useDismiss)(context, dismissOptions);
61
- const { getReferenceProps, getFloatingProps } = (0, import_react.useInteractions)([dismiss]);
62
- React.useEffect(() => {
63
- update();
64
- }, [referencePos, update]);
65
- React.useEffect(() => {
66
- if (referencePos === null) {
67
- return;
68
- }
69
- refs.setReference({
70
- getBoundingClientRect: () => referencePos
71
- });
72
- }, [referencePos, refs]);
73
- return React.useMemo(
74
- () => ({
75
- isMounted,
76
- ref: refs.setFloating,
77
- style: {
78
- ...styles,
79
- ...floatingStyles,
80
- zIndex
81
- },
82
- update,
83
- getFloatingProps,
84
- getReferenceProps
85
- }),
86
- [
87
- floatingStyles,
88
- isMounted,
89
- refs.setFloating,
90
- styles,
91
- update,
92
- zIndex,
93
- getFloatingProps,
94
- getReferenceProps
95
- ]
96
- );
97
- }
98
-
99
- // src/hooks/use-menu-navigation.ts
100
- var React2 = __toESM(require("react"));
101
- function useMenuNavigation({
102
- editor,
103
- containerRef,
104
- query,
105
- items,
106
- onSelect,
107
- onClose,
108
- orientation = "vertical",
109
- autoSelectFirstItem = true
110
- }) {
111
- const [selectedIndex, setSelectedIndex] = React2.useState(
112
- autoSelectFirstItem ? 0 : -1
113
- );
114
- React2.useEffect(() => {
115
- const handleKeyboardNavigation = (event) => {
116
- if (!items.length) return false;
117
- const moveNext = () => setSelectedIndex((currentIndex) => {
118
- if (currentIndex === -1) return 0;
119
- return (currentIndex + 1) % items.length;
120
- });
121
- const movePrev = () => setSelectedIndex((currentIndex) => {
122
- if (currentIndex === -1) return items.length - 1;
123
- return (currentIndex - 1 + items.length) % items.length;
124
- });
125
- switch (event.key) {
126
- case "ArrowUp": {
127
- if (orientation === "horizontal") return false;
128
- event.preventDefault();
129
- movePrev();
130
- return true;
131
- }
132
- case "ArrowDown": {
133
- if (orientation === "horizontal") return false;
134
- event.preventDefault();
135
- moveNext();
136
- return true;
137
- }
138
- case "ArrowLeft": {
139
- if (orientation === "vertical") return false;
140
- event.preventDefault();
141
- movePrev();
142
- return true;
143
- }
144
- case "ArrowRight": {
145
- if (orientation === "vertical") return false;
146
- event.preventDefault();
147
- moveNext();
148
- return true;
149
- }
150
- case "Tab": {
151
- event.preventDefault();
152
- if (event.shiftKey) {
153
- movePrev();
154
- } else {
155
- moveNext();
156
- }
157
- return true;
158
- }
159
- case "Home": {
160
- event.preventDefault();
161
- setSelectedIndex(0);
162
- return true;
163
- }
164
- case "End": {
165
- event.preventDefault();
166
- setSelectedIndex(items.length - 1);
167
- return true;
168
- }
169
- case "Enter": {
170
- if (event.isComposing) return false;
171
- event.preventDefault();
172
- if (selectedIndex !== -1 && items[selectedIndex]) {
173
- onSelect == null ? void 0 : onSelect(items[selectedIndex]);
174
- }
175
- return true;
176
- }
177
- case "Escape": {
178
- event.preventDefault();
179
- onClose == null ? void 0 : onClose();
180
- return true;
181
- }
182
- default:
183
- return false;
184
- }
185
- };
186
- let targetElement = null;
187
- if (editor) {
188
- targetElement = editor.view.dom;
189
- } else if (containerRef == null ? void 0 : containerRef.current) {
190
- targetElement = containerRef.current;
191
- }
192
- if (targetElement) {
193
- targetElement.addEventListener("keydown", handleKeyboardNavigation, true);
194
- return () => {
195
- targetElement == null ? void 0 : targetElement.removeEventListener(
196
- "keydown",
197
- handleKeyboardNavigation,
198
- true
199
- );
200
- };
201
- }
202
- return void 0;
203
- }, [
204
- editor,
205
- containerRef,
206
- items,
207
- selectedIndex,
208
- onSelect,
209
- onClose,
210
- orientation
211
- ]);
212
- React2.useEffect(() => {
213
- if (query) {
214
- setSelectedIndex(autoSelectFirstItem ? 0 : -1);
215
- }
216
- }, [query, autoSelectFirstItem]);
217
- return {
218
- selectedIndex: items.length ? selectedIndex : void 0,
219
- setSelectedIndex
220
- };
221
- }
222
-
223
- // src/hooks/use-tiptap-editor.ts
224
- var import_react2 = require("@tiptap/react");
225
- var import_react3 = require("react");
226
- function useTiptapEditor(providedEditor) {
227
- const { editor: coreEditor } = (0, import_react2.useCurrentEditor)();
228
- const mainEditor = (0, import_react3.useMemo)(
229
- () => providedEditor || coreEditor,
230
- [providedEditor, coreEditor]
231
- );
232
- const editorState = (0, import_react2.useEditorState)({
233
- editor: mainEditor,
234
- selector(context) {
235
- if (!context.editor) {
236
- return {
237
- editor: null,
238
- editorState: void 0,
239
- canCommand: void 0
240
- };
241
- }
242
- return {
243
- editor: context.editor,
244
- editorState: context.editor.state,
245
- canCommand: context.editor.can
246
- };
247
- }
248
- });
249
- return editorState || { editor: null };
250
- }
251
-
252
- // src/ui/suggestion-menu/suggestion-menu-utils.ts
253
- function calculateStartPosition(cursorPosition, previousNode, triggerChar) {
254
- if (!(previousNode == null ? void 0 : previousNode.text) || !triggerChar) {
255
- return cursorPosition;
256
- }
257
- const commandText = previousNode.text;
258
- const triggerCharIndex = commandText.lastIndexOf(triggerChar);
259
- if (triggerCharIndex === -1) {
260
- return cursorPosition;
261
- }
262
- const textLength = commandText.substring(triggerCharIndex).length;
263
- return cursorPosition - textLength;
264
- }
265
- function filterSuggestionItems(items, query) {
266
- const normalizedQuery = query.trim().toLowerCase();
267
- if (!normalizedQuery) {
268
- return items;
269
- }
270
- return items.filter((item) => {
271
- var _a, _b;
272
- if (item.title.toLowerCase().includes(normalizedQuery)) {
273
- return true;
274
- }
275
- if ((_a = item.subtext) == null ? void 0 : _a.toLowerCase().includes(normalizedQuery)) {
276
- return true;
277
- }
278
- if ((_b = item.keywords) == null ? void 0 : _b.some(
279
- (keyword) => keyword.toLowerCase().includes(normalizedQuery)
280
- )) {
281
- return true;
282
- }
283
- return false;
284
- }).sort((a, b) => {
285
- const aTitle = a.title.toLowerCase();
286
- const bTitle = b.title.toLowerCase();
287
- if (aTitle === normalizedQuery && bTitle !== normalizedQuery) return -1;
288
- if (bTitle === normalizedQuery && aTitle !== normalizedQuery) return 1;
289
- if (aTitle.startsWith(normalizedQuery) && !bTitle.startsWith(normalizedQuery))
290
- return -1;
291
- if (bTitle.startsWith(normalizedQuery) && !aTitle.startsWith(normalizedQuery))
292
- return 1;
293
- return 0;
294
- });
295
- }
296
-
297
- // src/ui/suggestion-menu/suggestion-menu.tsx
298
- var import_jsx_runtime = require("react/jsx-runtime");
299
- var SuggestionMenu = ({
300
- editor: providedEditor,
301
- floatingOptions,
302
- selector = "tiptap-suggestion-menu",
303
- children,
304
- maxHeight = 384,
305
- pluginKey = import_suggestion.SuggestionPluginKey,
306
- ...internalSuggestionProps
307
- }) => {
308
- const { editor } = useTiptapEditor(providedEditor);
309
- const [show, setShow] = React3.useState(false);
310
- const [internalClientRect, setInternalClientRect] = React3.useState(null);
311
- const [internalCommand, setInternalCommand] = React3.useState(null);
312
- const [internalItems, setInternalItems] = React3.useState(
313
- []
314
- );
315
- const [internalQuery, setInternalQuery] = React3.useState("");
316
- const [, setInternalRange] = React3.useState(null);
317
- const { ref, style, getFloatingProps, isMounted } = useFloatingElement(
318
- show,
319
- internalClientRect,
320
- 1e3,
321
- {
322
- placement: "bottom-start",
323
- middleware: [
324
- (0, import_react4.offset)(10),
325
- (0, import_react4.flip)({
326
- mainAxis: true,
327
- crossAxis: false
328
- }),
329
- (0, import_react4.shift)(),
330
- (0, import_react4.size)({
331
- apply({ availableHeight, elements }) {
332
- if (elements.floating) {
333
- const maxHeightValue = maxHeight ? Math.min(maxHeight, availableHeight) : availableHeight;
334
- elements.floating.style.setProperty(
335
- "--suggestion-menu-max-height",
336
- `${maxHeightValue}px`
337
- );
338
- }
339
- }
340
- })
341
- ],
342
- onOpenChange(open) {
343
- if (!open) {
344
- setShow(false);
345
- }
346
- },
347
- ...floatingOptions
348
- }
349
- );
350
- const internalSuggestionPropsRef = React3.useRef(internalSuggestionProps);
351
- React3.useEffect(() => {
352
- internalSuggestionPropsRef.current = internalSuggestionProps;
353
- }, [internalSuggestionProps]);
354
- const closePopup = React3.useCallback(() => {
355
- setShow(false);
356
- }, []);
357
- React3.useEffect(() => {
358
- if (!editor || editor.isDestroyed) {
359
- return;
360
- }
361
- const existingPlugin = editor.state.plugins.find(
362
- (plugin) => plugin.spec.key === pluginKey
363
- );
364
- if (existingPlugin) {
365
- editor.unregisterPlugin(pluginKey);
366
- }
367
- const suggestion = (0, import_suggestion.Suggestion)({
368
- pluginKey: pluginKey instanceof import_state.PluginKey ? pluginKey : new import_state.PluginKey(pluginKey),
369
- editor,
370
- command({ editor: editor2, range, props }) {
371
- var _a, _b;
372
- if (!range) {
373
- return;
374
- }
375
- const { view, state } = editor2;
376
- const { selection } = state;
377
- const isMention = editor2.extensionManager.extensions.some(
378
- (extension) => {
379
- var _a2, _b2;
380
- const name = extension.name;
381
- return name === "mention" && ((_b2 = (_a2 = extension.options) == null ? void 0 : _a2.suggestion) == null ? void 0 : _b2.char) === internalSuggestionPropsRef.current.char;
382
- }
383
- );
384
- if (!isMention) {
385
- const cursorPosition = selection.$from.pos;
386
- const previousNode = (_a = selection.$head) == null ? void 0 : _a.nodeBefore;
387
- const startPosition = previousNode ? calculateStartPosition(
388
- cursorPosition,
389
- previousNode,
390
- internalSuggestionPropsRef.current.char
391
- ) : selection.$from.start();
392
- const transaction = state.tr.deleteRange(
393
- startPosition,
394
- cursorPosition
395
- );
396
- view.dispatch(transaction);
397
- }
398
- const nodeAfter = view.state.selection.$to.nodeAfter;
399
- const overrideSpace = (_b = nodeAfter == null ? void 0 : nodeAfter.text) == null ? void 0 : _b.startsWith(" ");
400
- const rangeToUse = { ...range };
401
- if (overrideSpace) {
402
- rangeToUse.to += 1;
403
- }
404
- props.onSelect({ editor: editor2, range: rangeToUse, context: props.context });
405
- },
406
- render: () => {
407
- return {
408
- onStart: (props) => {
409
- var _a, _b;
410
- setInternalCommand(() => props.command);
411
- setInternalItems(props.items);
412
- setInternalQuery(props.query);
413
- setInternalRange(props.range);
414
- setInternalClientRect((_b = (_a = props.clientRect) == null ? void 0 : _a.call(props)) != null ? _b : null);
415
- setShow(true);
416
- },
417
- onUpdate: (props) => {
418
- var _a, _b;
419
- setInternalCommand(() => props.command);
420
- setInternalItems(props.items);
421
- setInternalQuery(props.query);
422
- setInternalRange(props.range);
423
- setInternalClientRect((_b = (_a = props.clientRect) == null ? void 0 : _a.call(props)) != null ? _b : null);
424
- },
425
- onKeyDown: (props) => {
426
- if (props.event.key === "Escape") {
427
- closePopup();
428
- return true;
429
- }
430
- return false;
431
- },
432
- onExit: () => {
433
- setInternalCommand(null);
434
- setInternalItems([]);
435
- setInternalQuery("");
436
- setInternalRange(null);
437
- setInternalClientRect(null);
438
- setShow(false);
439
- }
440
- };
441
- },
442
- ...internalSuggestionPropsRef.current
443
- });
444
- editor.registerPlugin(suggestion);
445
- return () => {
446
- if (!editor.isDestroyed) {
447
- editor.unregisterPlugin(pluginKey);
448
- }
449
- };
450
- }, [editor, pluginKey, closePopup]);
451
- const onSelect = React3.useCallback(
452
- (item) => {
453
- closePopup();
454
- if (internalCommand) {
455
- internalCommand(item);
456
- }
457
- },
458
- [closePopup, internalCommand]
459
- );
460
- const { selectedIndex } = useMenuNavigation({
461
- editor,
462
- query: internalQuery,
463
- items: internalItems,
464
- onSelect
465
- });
466
- if (!isMounted || !show || !editor) {
467
- return null;
468
- }
469
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
470
- "div",
471
- {
472
- ref,
473
- style,
474
- ...getFloatingProps(),
475
- "data-selector": selector,
476
- className: "tiptap-suggestion-menu",
477
- role: "listbox",
478
- "aria-label": "Suggestions",
479
- onPointerDown: (e) => e.preventDefault(),
480
- children: children({
481
- items: internalItems,
482
- selectedIndex,
483
- onSelect
484
- })
485
- }
486
- ) });
487
- };
488
-
489
- // src/ui/slash-dropdown-menu/use-slash-dropdown-menu.ts
490
- var import_editor_utils2 = require("@kopexa/editor-utils");
491
- var import_icons2 = require("@kopexa/icons");
492
- var React4 = __toESM(require("react"));
493
-
494
- // src/ui/table-button/use-table.ts
495
- var import_editor_utils = require("@kopexa/editor-utils");
496
- var import_icons = require("@kopexa/icons");
497
- var import_react5 = require("@tiptap/react");
498
- var import_react6 = require("react");
499
- function canToggle(editor) {
500
- if (!editor || !editor.isEditable) return false;
501
- if (!(0, import_editor_utils.isNodeInSchema)("table", editor) || (0, import_editor_utils.isNodeTypeSelected)(editor, ["image"])) {
502
- return false;
503
- }
504
- try {
505
- return editor.can().insertTable({ rows: 3, cols: 3, withHeaderRow: true });
506
- } catch {
507
- return false;
508
- }
509
- }
510
- function toggleTable(editor, config) {
511
- var _a;
512
- if (!editor || !editor.isEditable) return false;
513
- if (!canToggle(editor)) return false;
514
- try {
515
- return editor.chain().focus().insertTable({
516
- rows: (config == null ? void 0 : config.rows) || 3,
517
- cols: (config == null ? void 0 : config.cols) || 3,
518
- withHeaderRow: (_a = config == null ? void 0 : config.withHeaderRow) != null ? _a : true
519
- }).run();
520
- } catch {
521
- return false;
522
- }
523
- }
524
-
525
- // src/ui/slash-dropdown-menu/use-slash-dropdown-menu.ts
526
- var texts = {
527
- // AI
528
- continue_writing: {
529
- title: "Continue Writing",
530
- subtext: "Continue writing from the current position",
531
- keywords: ["continue", "write", "continue writing", "ai"],
532
- badge: import_icons2.AiSparklesIcon,
533
- group: "AI"
534
- },
535
- ai_ask_button: {
536
- title: "Ask AI",
537
- subtext: "Ask AI to generate content",
538
- keywords: ["ai", "ask", "generate"],
539
- badge: import_icons2.AiSparklesIcon,
540
- group: "AI"
541
- },
542
- // Style
543
- text: {
544
- title: "Text",
545
- subtext: "Regular text paragraph",
546
- keywords: ["p", "paragraph", "text"],
547
- badge: import_icons2.TypeIcon,
548
- group: "Style"
549
- },
550
- heading_1: {
551
- title: "Heading 1",
552
- subtext: "Top-level heading",
553
- keywords: ["h", "heading1", "h1"],
554
- badge: import_icons2.HeadingOneIcon,
555
- group: "Style"
556
- },
557
- heading_2: {
558
- title: "Heading 2",
559
- subtext: "Key section heading",
560
- keywords: ["h2", "heading2", "subheading"],
561
- badge: import_icons2.HeadingTwoIcon,
562
- group: "Style"
563
- },
564
- heading_3: {
565
- title: "Heading 3",
566
- subtext: "Subsection and group heading",
567
- keywords: ["h3", "heading3", "subheading"],
568
- badge: import_icons2.HeadingThreeIcon,
569
- group: "Style"
570
- },
571
- bullet_list: {
572
- title: "Bullet List",
573
- subtext: "List with unordered items",
574
- keywords: ["ul", "li", "list", "bulletlist", "bullet list"],
575
- badge: import_icons2.ListIcon,
576
- group: "Style"
577
- },
578
- ordered_list: {
579
- title: "Numbered List",
580
- subtext: "List with ordered items",
581
- keywords: ["ol", "li", "list", "numberedlist", "numbered list"],
582
- badge: import_icons2.ListOrderedIcon,
583
- group: "Style"
584
- },
585
- task_list: {
586
- title: "To-do list",
587
- subtext: "List with tasks",
588
- keywords: ["tasklist", "task list", "todo", "checklist"],
589
- badge: import_icons2.ListTodoIcon,
590
- group: "Style"
591
- },
592
- quote: {
593
- title: "Blockquote",
594
- subtext: "Blockquote block",
595
- keywords: ["quote", "blockquote"],
596
- badge: import_icons2.BlockquoteIcon,
597
- group: "Style"
598
- },
599
- code_block: {
600
- title: "Code Block",
601
- subtext: "Code block with syntax highlighting",
602
- keywords: ["code", "pre"],
603
- badge: import_icons2.CodeBlockIcon,
604
- group: "Style"
605
- },
606
- // Insert
607
- // mention: {
608
- // title: "Mention",
609
- // subtext: "Mention a user or item",
610
- // keywords: ["mention", "user", "item", "tag"],
611
- // badge: AtSignIcon,
612
- // group: "Insert",
613
- // },
614
- // emoji: {
615
- // title: "Emoji",
616
- // subtext: "Insert an emoji",
617
- // keywords: ["emoji", "emoticon", "smiley"],
618
- // badge: SmilePlusIcon,
619
- // group: "Insert",
620
- // },
621
- control: {
622
- title: "Control",
623
- subtext: "Insert a control block",
624
- keywords: ["control"],
625
- badge: import_icons2.ControlsIcon,
626
- group: "Insert"
627
- },
628
- divider: {
629
- title: "Separator",
630
- subtext: "Horizontal line to separate content",
631
- keywords: ["hr", "horizontalRule", "line", "separator"],
632
- badge: import_icons2.MinusIcon,
633
- group: "Insert"
634
- },
635
- table: {
636
- title: "Table",
637
- subtext: "Insert a table",
638
- keywords: ["table", "grid", "spreadsheet"],
639
- badge: import_icons2.TableIcon,
640
- group: "Insert"
641
- },
642
- table_of_contents: {
643
- title: "Table of Contents",
644
- subtext: "Auto-generated list of headings",
645
- keywords: ["toc", "table of contents", "index", "navigation", "headings"],
646
- badge: import_icons2.TableOfContentsIcon,
647
- group: "Insert"
648
- },
649
- callout: {
650
- title: "Callout",
651
- subtext: "Highlighted block for important information",
652
- keywords: ["callout", "info", "warning", "alert", "note", "tip"],
653
- badge: import_icons2.InfoIcon,
654
- group: "Insert"
655
- },
656
- callout_warning: {
657
- title: "Warning",
658
- subtext: "Warning callout block",
659
- keywords: ["warning", "caution", "attention"],
660
- badge: import_icons2.AlertIcon,
661
- group: "Insert"
662
- },
663
- math: {
664
- title: "Formula",
665
- subtext: "LaTeX math formula block",
666
- keywords: ["math", "latex", "formula", "equation", "katex"],
667
- badge: import_icons2.TypeIcon,
668
- group: "Insert"
669
- },
670
- // Upload
671
- image: {
672
- title: "Image",
673
- subtext: "Resizable image with caption",
674
- keywords: [
675
- "image",
676
- "imageUpload",
677
- "upload",
678
- "img",
679
- "picture",
680
- "media",
681
- "url"
682
- ],
683
- badge: import_icons2.ImageIcon,
684
- group: "Upload"
685
- }
686
- };
687
- var getItemImplementations = () => {
688
- return {
689
- // AI
690
- continue_writing: {
691
- check: (editor) => {
692
- const { hasContent } = (0, import_editor_utils2.hasContentAbove)(editor);
693
- const extensionsReady = (0, import_editor_utils2.isExtensionAvailable)(editor, [
694
- "ai",
695
- "aiAdvanced"
696
- ]);
697
- return extensionsReady && hasContent;
698
- },
699
- action: ({ editor }) => {
700
- const editorChain = editor.chain().focus();
701
- const nodeSelectionPosition = (0, import_editor_utils2.findSelectionPosition)({ editor });
702
- if (nodeSelectionPosition !== null) {
703
- editorChain.setNodeSelection(nodeSelectionPosition);
704
- }
705
- editorChain.run();
706
- editor.chain().focus().aiGenerationShow().run();
707
- requestAnimationFrame(() => {
708
- const { hasContent, content } = (0, import_editor_utils2.hasContentAbove)(editor);
709
- const snippet = content.length > 500 ? `...${content.slice(-500)}` : content;
710
- const prompt = hasContent ? `Context: ${snippet}
711
-
712
- Continue writing from where the text above ends. Write ONLY ONE SENTENCE. DONT REPEAT THE TEXT.` : "Start writing a new paragraph. Write ONLY ONE SENTENCE.";
713
- editor.chain().focus().aiTextPrompt({
714
- stream: true,
715
- format: "rich-text",
716
- text: prompt
717
- }).run();
718
- });
719
- }
720
- },
721
- ai_ask_button: {
722
- check: (editor) => (0, import_editor_utils2.isExtensionAvailable)(editor, ["ai", "aiAdvanced"]),
723
- action: ({ editor }) => {
724
- const editorChain = editor.chain().focus();
725
- const nodeSelectionPosition = (0, import_editor_utils2.findSelectionPosition)({ editor });
726
- if (nodeSelectionPosition !== null) {
727
- editorChain.setNodeSelection(nodeSelectionPosition);
728
- }
729
- editorChain.run();
730
- editor.chain().focus().aiGenerationShow().run();
731
- }
732
- },
733
- // Style
734
- text: {
735
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("paragraph", editor),
736
- action: ({ editor }) => {
737
- editor.chain().focus().setParagraph().run();
738
- }
739
- },
740
- heading_1: {
741
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("heading", editor),
742
- action: ({ editor }) => {
743
- editor.chain().focus().toggleHeading({ level: 1 }).run();
744
- }
745
- },
746
- heading_2: {
747
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("heading", editor),
748
- action: ({ editor }) => {
749
- editor.chain().focus().toggleHeading({ level: 2 }).run();
750
- }
751
- },
752
- heading_3: {
753
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("heading", editor),
754
- action: ({ editor }) => {
755
- editor.chain().focus().toggleHeading({ level: 3 }).run();
756
- }
757
- },
758
- bullet_list: {
759
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("bulletList", editor),
760
- action: ({ editor }) => {
761
- editor.chain().focus().toggleBulletList().run();
762
- }
763
- },
764
- ordered_list: {
765
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("orderedList", editor),
766
- action: ({ editor }) => {
767
- editor.chain().focus().toggleOrderedList().run();
768
- }
769
- },
770
- task_list: {
771
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("taskList", editor),
772
- action: ({ editor }) => {
773
- editor.chain().focus().toggleTaskList().run();
774
- }
775
- },
776
- quote: {
777
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("blockquote", editor),
778
- action: ({ editor }) => {
779
- editor.chain().focus().toggleBlockquote().run();
780
- }
781
- },
782
- code_block: {
783
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("codeBlock", editor),
784
- action: ({ editor }) => {
785
- editor.chain().focus().toggleNode("codeBlock", "paragraph").run();
786
- }
787
- },
788
- // Insert
789
- // mention: {
790
- // check: (editor: Editor) =>
791
- // isExtensionAvailable(editor, ["mention", "mentionAdvanced"]),
792
- // action: ({ editor }: { editor: Editor }) => addMentionTrigger(editor),
793
- // },
794
- // emoji: {
795
- // check: (editor: Editor) =>
796
- // isExtensionAvailable(editor, ["emoji", "emojiPicker"]),
797
- // action: ({ editor }: { editor: Editor }) => addEmojiTrigger(editor),
798
- // },
799
- divider: {
800
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("horizontalRule", editor),
801
- action: ({ editor }) => {
802
- editor.chain().focus().setHorizontalRule().run();
803
- }
804
- },
805
- table: {
806
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("table", editor),
807
- action: ({ editor }) => toggleTable(editor, { rows: 3, cols: 3, withHeaderRow: true })
808
- },
809
- control: {
810
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("controlBlock", editor),
811
- action: ({ editor }) => {
812
- try {
813
- return editor.chain().focus().insertControlBlock().run();
814
- } catch (e) {
815
- console.error(e);
816
- }
817
- }
818
- },
819
- table_of_contents: {
820
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("tableOfContentsNode", editor),
821
- action: ({ editor }) => {
822
- editor.chain().focus().insertTableOfContents().run();
823
- }
824
- },
825
- callout: {
826
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("calloutNode", editor),
827
- action: ({ editor }) => {
828
- editor.chain().focus().insertCallout("info").run();
829
- }
830
- },
831
- callout_warning: {
832
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("calloutNode", editor),
833
- action: ({ editor }) => {
834
- editor.chain().focus().insertCallout("warning").run();
835
- }
836
- },
837
- math: {
838
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("mathBlock", editor),
839
- action: ({ editor }) => {
840
- editor.chain().focus().insertMathBlock().run();
841
- }
842
- },
843
- // Upload
844
- image: {
845
- check: (editor) => (0, import_editor_utils2.isNodeInSchema)("imageUpload", editor),
846
- action: ({ editor }) => {
847
- editor.chain().focus().setImageUpload().run();
848
- }
849
- }
850
- };
851
- };
852
- function organizeItemsByGroups(items, showGroups) {
853
- if (!showGroups) {
854
- return items.map((item) => ({ ...item, group: "" }));
855
- }
856
- const groups = {};
857
- items.forEach((item) => {
858
- const groupLabel = item.group || "";
859
- if (!groups[groupLabel]) {
860
- groups[groupLabel] = [];
861
- }
862
- groups[groupLabel].push(item);
863
- });
864
- const organizedItems = [];
865
- Object.entries(groups).forEach(([, groupItems]) => {
866
- organizedItems.push(...groupItems);
867
- });
868
- return organizedItems;
869
- }
870
- function useSlashDropdownMenu(config) {
871
- const getSlashMenuItems = React4.useCallback(
872
- (editor) => {
873
- const items = [];
874
- const enabledItems = (config == null ? void 0 : config.enabledItems) || Object.keys(texts);
875
- const showGroups = (config == null ? void 0 : config.showGroups) !== false;
876
- const itemImplementations = getItemImplementations();
877
- enabledItems.forEach((itemType) => {
878
- var _a;
879
- const itemImpl = itemImplementations[itemType];
880
- const itemText = texts[itemType];
881
- if (itemImpl && itemText && itemImpl.check(editor)) {
882
- const item = {
883
- onSelect: ({ editor: editor2 }) => itemImpl.action({ editor: editor2 }),
884
- ...itemText
885
- };
886
- if ((_a = config == null ? void 0 : config.itemGroups) == null ? void 0 : _a[itemType]) {
887
- item.group = config.itemGroups[itemType];
888
- } else if (!showGroups) {
889
- item.group = "";
890
- }
891
- items.push(item);
892
- }
893
- });
894
- if (config == null ? void 0 : config.customItems) {
895
- items.push(...config.customItems);
896
- }
897
- return organizeItemsByGroups(items, showGroups);
898
- },
899
- [config]
900
- );
901
- return {
902
- getSlashMenuItems,
903
- config
904
- };
905
- }
906
-
907
- // src/ui/slash-dropdown-menu/slash-dropdown-menu.tsx
908
- var import_jsx_runtime2 = require("react/jsx-runtime");
909
- var SlashDropdownMenu = (props) => {
910
- const { config, ...restProps } = props;
911
- const { getSlashMenuItems } = useSlashDropdownMenu(config);
912
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
913
- SuggestionMenu,
914
- {
915
- char: "/",
916
- pluginKey: "slashDropdownMenu",
917
- decorationClass: "tiptap-slash-decoration",
918
- decorationContent: "Filter...",
919
- selector: "tiptap-slash-dropdown-menu",
920
- items: ({ query, editor }) => filterSuggestionItems(getSlashMenuItems(editor), query),
921
- ...restProps,
922
- children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(List, { ...props2, config })
923
- }
924
- );
925
- };
926
- var Item = (props) => {
927
- const { item, isSelected, onSelect } = props;
928
- const itemRef = React5.useRef(null);
929
- React5.useEffect(() => {
930
- const selector = document.querySelector(
931
- '[data-selector="tiptap-slash-dropdown-menu"]'
932
- );
933
- if (!itemRef.current || !isSelected || !selector) return;
934
- const overflow = (0, import_editor_utils3.getElementOverflowPosition)(itemRef.current, selector);
935
- if (overflow === "top") {
936
- itemRef.current.scrollIntoView(true);
937
- } else if (overflow === "bottom") {
938
- itemRef.current.scrollIntoView(false);
939
- }
940
- }, [isSelected]);
941
- const BadgeIcon = item.badge;
942
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
943
- import_button.Button,
944
- {
945
- ref: itemRef,
946
- variant: "ghost",
947
- color: "default",
948
- startContent: BadgeIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BadgeIcon, {}),
949
- "data-active-state": isSelected ? "on" : "off",
950
- onClick: onSelect,
951
- fullWidth: true,
952
- spacing: "start",
953
- children: item.title
954
- }
955
- );
956
- };
957
- var List = ({
958
- items,
959
- selectedIndex,
960
- onSelect,
961
- config
962
- }) => {
963
- const styles = (0, import_theme.slashDropdownMenu)();
964
- const renderedItems = React5.useMemo(() => {
965
- const rendered = [];
966
- const showGroups = (config == null ? void 0 : config.showGroups) !== false;
967
- if (!showGroups) {
968
- items.forEach((item, index) => {
969
- rendered.push(
970
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
971
- Item,
972
- {
973
- item,
974
- isSelected: index === selectedIndex,
975
- onSelect: () => onSelect(item)
976
- },
977
- `item-${index}-${item.title}`
978
- )
979
- );
980
- });
981
- return rendered;
982
- }
983
- const groups = {};
984
- items.forEach((item, index) => {
985
- const groupLabel = item.group || "";
986
- if (!groups[groupLabel]) {
987
- groups[groupLabel] = { items: [], indices: [] };
988
- }
989
- groups[groupLabel].items.push(item);
990
- groups[groupLabel].indices.push(index);
991
- });
992
- Object.entries(groups).forEach(([groupLabel, groupData], groupIndex) => {
993
- if (groupIndex > 0) {
994
- rendered.push(
995
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
996
- import_separator.Separator,
997
- {
998
- orientation: "horizontal"
999
- },
1000
- `separator-${groupIndex.toString()}`
1001
- )
1002
- );
1003
- }
1004
- const groupItems = groupData.items.map((item, itemIndex) => {
1005
- const originalIndex = groupData.indices[itemIndex];
1006
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1007
- Item,
1008
- {
1009
- item,
1010
- isSelected: originalIndex === selectedIndex,
1011
- onSelect: () => onSelect(item)
1012
- },
1013
- `item-${originalIndex}-${item.title}`
1014
- );
1015
- });
1016
- if (groupLabel) {
1017
- rendered.push(
1018
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1019
- "div",
1020
- {
1021
- className: styles.cardItemGroup(),
1022
- children: [
1023
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.cardGroupLabel(), children: groupLabel }),
1024
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.cardGroup(), children: groupItems })
1025
- ]
1026
- },
1027
- `group-${groupIndex}-${groupLabel}`
1028
- )
1029
- );
1030
- } else {
1031
- rendered.push(...groupItems);
1032
- }
1033
- });
1034
- return rendered;
1035
- }, [items, selectedIndex, onSelect, config == null ? void 0 : config.showGroups, styles]);
1036
- if (!renderedItems.length) {
1037
- return null;
1038
- }
1039
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1040
- "div",
1041
- {
1042
- className: styles.card(),
1043
- style: {
1044
- maxHeight: "var(--suggestion-menu-max-height)"
1045
- },
1046
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.body(), children: renderedItems })
1047
- }
1048
- );
1049
- };
1050
- // Annotate the CommonJS export names for ESM import in node:
1051
- 0 && (module.exports = {
1052
- SlashDropdownMenu
1053
- });