@kaitify/react 0.0.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/docs/.vitepress/cache/deps/_metadata.json +52 -0
  4. package/docs/.vitepress/cache/deps/chunk-Q2AYPHVK.js +9719 -0
  5. package/docs/.vitepress/cache/deps/chunk-Q2AYPHVK.js.map +7 -0
  6. package/docs/.vitepress/cache/deps/chunk-QAXAIFA7.js +12705 -0
  7. package/docs/.vitepress/cache/deps/chunk-QAXAIFA7.js.map +7 -0
  8. package/docs/.vitepress/cache/deps/package.json +3 -0
  9. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4505 -0
  10. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
  11. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +583 -0
  12. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
  13. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1145 -0
  14. package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
  15. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1665 -0
  16. package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
  17. package/docs/.vitepress/cache/deps/vitepress___minisearch.js +1813 -0
  18. package/docs/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
  19. package/docs/.vitepress/cache/deps/vue.js +343 -0
  20. package/docs/.vitepress/cache/deps/vue.js.map +7 -0
  21. package/docs/.vitepress/config.ts +185 -0
  22. package/docs/.vitepress/global.d.ts +1 -0
  23. package/docs/.vitepress/theme/index.ts +6 -0
  24. package/docs/.vitepress/theme/style.less +17 -0
  25. package/docs/.vitepress/tsconfig.json +12 -0
  26. package/docs/changelog.md +10 -0
  27. package/docs/guide/bubble.md +71 -0
  28. package/docs/guide/checkbox.md +38 -0
  29. package/docs/guide/divider.md +41 -0
  30. package/docs/guide/icon.md +34 -0
  31. package/docs/guide/install.md +70 -0
  32. package/docs/guide/introduction.md +28 -0
  33. package/docs/guide/locale.md +67 -0
  34. package/docs/guide/menu.md +112 -0
  35. package/docs/guide/quick-start.md +76 -0
  36. package/docs/guide/shortcut.md +77 -0
  37. package/docs/guide/tabs.md +42 -0
  38. package/docs/guide/wrapper.md +303 -0
  39. package/docs/index.md +41 -0
  40. package/docs/menus/built-in/align-center.md +29 -0
  41. package/docs/menus/built-in/align-justify.md +29 -0
  42. package/docs/menus/built-in/align-left.md +29 -0
  43. package/docs/menus/built-in/align-right.md +29 -0
  44. package/docs/menus/built-in/attachment.md +41 -0
  45. package/docs/menus/built-in/back-color.md +33 -0
  46. package/docs/menus/built-in/blockquote.md +29 -0
  47. package/docs/menus/built-in/bold.md +29 -0
  48. package/docs/menus/built-in/clear-format.md +29 -0
  49. package/docs/menus/built-in/code-block-languages.md +37 -0
  50. package/docs/menus/built-in/code-block.md +29 -0
  51. package/docs/menus/built-in/code.md +29 -0
  52. package/docs/menus/built-in/color.md +33 -0
  53. package/docs/menus/built-in/decrease-indent.md +29 -0
  54. package/docs/menus/built-in/emoji.md +35 -0
  55. package/docs/menus/built-in/font-family.md +44 -0
  56. package/docs/menus/built-in/font-size.md +44 -0
  57. package/docs/menus/built-in/full-screen.md +39 -0
  58. package/docs/menus/built-in/heading.md +66 -0
  59. package/docs/menus/built-in/horizontal.md +29 -0
  60. package/docs/menus/built-in/image.md +41 -0
  61. package/docs/menus/built-in/increase-indent.md +29 -0
  62. package/docs/menus/built-in/italic.md +29 -0
  63. package/docs/menus/built-in/line-height.md +44 -0
  64. package/docs/menus/built-in/link-unset.md +29 -0
  65. package/docs/menus/built-in/link.md +29 -0
  66. package/docs/menus/built-in/math.md +29 -0
  67. package/docs/menus/built-in/ordered-list.md +29 -0
  68. package/docs/menus/built-in/redo.md +25 -0
  69. package/docs/menus/built-in/strikethrough.md +29 -0
  70. package/docs/menus/built-in/subscript.md +29 -0
  71. package/docs/menus/built-in/superscript.md +29 -0
  72. package/docs/menus/built-in/table-add-column.md +33 -0
  73. package/docs/menus/built-in/table-add-row.md +33 -0
  74. package/docs/menus/built-in/table-delete-column.md +29 -0
  75. package/docs/menus/built-in/table-delete-row.md +29 -0
  76. package/docs/menus/built-in/table-merge-cell.md +33 -0
  77. package/docs/menus/built-in/table-unset.md +29 -0
  78. package/docs/menus/built-in/table.md +37 -0
  79. package/docs/menus/built-in/task.md +29 -0
  80. package/docs/menus/built-in/underline.md +29 -0
  81. package/docs/menus/built-in/undo.md +25 -0
  82. package/docs/menus/built-in/unordered-list.md +29 -0
  83. package/docs/menus/built-in/video-controls.md +29 -0
  84. package/docs/menus/built-in/video-loop.md +29 -0
  85. package/docs/menus/built-in/video-muted.md +29 -0
  86. package/docs/menus/built-in/video.md +41 -0
  87. package/docs/menus/built-in/wrap-down.md +33 -0
  88. package/docs/menus/built-in/wrap-up.md +33 -0
  89. package/docs/menus/introduction.md +27 -0
  90. package/examples/App.tsx +179 -0
  91. package/examples/main.tsx +9 -0
  92. package/examples/style.less +21 -0
  93. package/index.html +13 -0
  94. package/lib/core/button/button.d.ts +5 -0
  95. package/lib/core/button/index.d.ts +3 -0
  96. package/lib/core/button/props.d.ts +38 -0
  97. package/lib/core/checkbox/checkbox.d.ts +5 -0
  98. package/lib/core/checkbox/index.d.ts +3 -0
  99. package/lib/core/checkbox/props.d.ts +21 -0
  100. package/lib/core/divider/divider.d.ts +4 -0
  101. package/lib/core/divider/index.d.ts +2 -0
  102. package/lib/core/icon/icon.d.ts +5 -0
  103. package/lib/core/icon/index.d.ts +3 -0
  104. package/lib/core/icon/props.d.ts +22 -0
  105. package/lib/core/popover/index.d.ts +3 -0
  106. package/lib/core/popover/popover.d.ts +7 -0
  107. package/lib/core/popover/props.d.ts +94 -0
  108. package/lib/core/tabs/index.d.ts +3 -0
  109. package/lib/core/tabs/props.d.ts +21 -0
  110. package/lib/core/tabs/tabs.d.ts +2 -0
  111. package/lib/core/teleport/index.d.ts +3 -0
  112. package/lib/core/teleport/props.d.ts +11 -0
  113. package/lib/core/teleport/teleport.d.ts +5 -0
  114. package/lib/editor/bubble/bubble.d.ts +6 -0
  115. package/lib/editor/bubble/index.d.ts +3 -0
  116. package/lib/editor/bubble/props.d.ts +63 -0
  117. package/lib/editor/menu/built-in/align-center/align-center.d.ts +2 -0
  118. package/lib/editor/menu/built-in/align-center/index.d.ts +3 -0
  119. package/lib/editor/menu/built-in/align-center/props.d.ts +10 -0
  120. package/lib/editor/menu/built-in/align-justify/align-justify.d.ts +2 -0
  121. package/lib/editor/menu/built-in/align-justify/index.d.ts +3 -0
  122. package/lib/editor/menu/built-in/align-justify/props.d.ts +10 -0
  123. package/lib/editor/menu/built-in/align-left/align-left.d.ts +2 -0
  124. package/lib/editor/menu/built-in/align-left/index.d.ts +3 -0
  125. package/lib/editor/menu/built-in/align-left/props.d.ts +10 -0
  126. package/lib/editor/menu/built-in/align-right/align-right.d.ts +2 -0
  127. package/lib/editor/menu/built-in/align-right/index.d.ts +3 -0
  128. package/lib/editor/menu/built-in/align-right/props.d.ts +10 -0
  129. package/lib/editor/menu/built-in/attachment/attachment.d.ts +2 -0
  130. package/lib/editor/menu/built-in/attachment/index.d.ts +3 -0
  131. package/lib/editor/menu/built-in/attachment/props.d.ts +26 -0
  132. package/lib/editor/menu/built-in/back-color/back-color.d.ts +2 -0
  133. package/lib/editor/menu/built-in/back-color/index.d.ts +3 -0
  134. package/lib/editor/menu/built-in/back-color/props.d.ts +15 -0
  135. package/lib/editor/menu/built-in/blockquote/blockquote.d.ts +2 -0
  136. package/lib/editor/menu/built-in/blockquote/index.d.ts +3 -0
  137. package/lib/editor/menu/built-in/blockquote/props.d.ts +10 -0
  138. package/lib/editor/menu/built-in/bold/bold.d.ts +2 -0
  139. package/lib/editor/menu/built-in/bold/index.d.ts +3 -0
  140. package/lib/editor/menu/built-in/bold/props.d.ts +10 -0
  141. package/lib/editor/menu/built-in/clear-format/clear-format.d.ts +2 -0
  142. package/lib/editor/menu/built-in/clear-format/index.d.ts +3 -0
  143. package/lib/editor/menu/built-in/clear-format/props.d.ts +10 -0
  144. package/lib/editor/menu/built-in/code/code.d.ts +2 -0
  145. package/lib/editor/menu/built-in/code/index.d.ts +3 -0
  146. package/lib/editor/menu/built-in/code/props.d.ts +10 -0
  147. package/lib/editor/menu/built-in/code-block/code-block-languages.d.ts +2 -0
  148. package/lib/editor/menu/built-in/code-block/code-block.d.ts +2 -0
  149. package/lib/editor/menu/built-in/code-block/index.d.ts +4 -0
  150. package/lib/editor/menu/built-in/code-block/props.d.ts +32 -0
  151. package/lib/editor/menu/built-in/color/color.d.ts +2 -0
  152. package/lib/editor/menu/built-in/color/index.d.ts +3 -0
  153. package/lib/editor/menu/built-in/color/props.d.ts +15 -0
  154. package/lib/editor/menu/built-in/decrease-indent/decrease-indent.d.ts +2 -0
  155. package/lib/editor/menu/built-in/decrease-indent/index.d.ts +3 -0
  156. package/lib/editor/menu/built-in/decrease-indent/props.d.ts +10 -0
  157. package/lib/editor/menu/built-in/emoji/emoji.d.ts +2 -0
  158. package/lib/editor/menu/built-in/emoji/index.d.ts +3 -0
  159. package/lib/editor/menu/built-in/emoji/props.d.ts +15 -0
  160. package/lib/editor/menu/built-in/font-family/font-family.d.ts +2 -0
  161. package/lib/editor/menu/built-in/font-family/index.d.ts +3 -0
  162. package/lib/editor/menu/built-in/font-family/props.d.ts +21 -0
  163. package/lib/editor/menu/built-in/font-size/font-size.d.ts +2 -0
  164. package/lib/editor/menu/built-in/font-size/index.d.ts +3 -0
  165. package/lib/editor/menu/built-in/font-size/props.d.ts +21 -0
  166. package/lib/editor/menu/built-in/full-screen/full-screen.d.ts +2 -0
  167. package/lib/editor/menu/built-in/full-screen/index.d.ts +3 -0
  168. package/lib/editor/menu/built-in/full-screen/props.d.ts +18 -0
  169. package/lib/editor/menu/built-in/heading/heading.d.ts +2 -0
  170. package/lib/editor/menu/built-in/heading/index.d.ts +3 -0
  171. package/lib/editor/menu/built-in/heading/props.d.ts +21 -0
  172. package/lib/editor/menu/built-in/horizontal/horizontal.d.ts +2 -0
  173. package/lib/editor/menu/built-in/horizontal/index.d.ts +3 -0
  174. package/lib/editor/menu/built-in/horizontal/props.d.ts +10 -0
  175. package/lib/editor/menu/built-in/image/image.d.ts +2 -0
  176. package/lib/editor/menu/built-in/image/index.d.ts +3 -0
  177. package/lib/editor/menu/built-in/image/props.d.ts +26 -0
  178. package/lib/editor/menu/built-in/increase-indent/increase-indent.d.ts +2 -0
  179. package/lib/editor/menu/built-in/increase-indent/index.d.ts +3 -0
  180. package/lib/editor/menu/built-in/increase-indent/props.d.ts +10 -0
  181. package/lib/editor/menu/built-in/index.d.ts +38 -0
  182. package/lib/editor/menu/built-in/italic/index.d.ts +3 -0
  183. package/lib/editor/menu/built-in/italic/italic.d.ts +2 -0
  184. package/lib/editor/menu/built-in/italic/props.d.ts +10 -0
  185. package/lib/editor/menu/built-in/line-height/index.d.ts +3 -0
  186. package/lib/editor/menu/built-in/line-height/line-height.d.ts +2 -0
  187. package/lib/editor/menu/built-in/line-height/props.d.ts +21 -0
  188. package/lib/editor/menu/built-in/link/index.d.ts +4 -0
  189. package/lib/editor/menu/built-in/link/link-unset.d.ts +2 -0
  190. package/lib/editor/menu/built-in/link/link.d.ts +2 -0
  191. package/lib/editor/menu/built-in/link/props.d.ts +21 -0
  192. package/lib/editor/menu/built-in/math/index.d.ts +3 -0
  193. package/lib/editor/menu/built-in/math/math.d.ts +2 -0
  194. package/lib/editor/menu/built-in/math/props.d.ts +11 -0
  195. package/lib/editor/menu/built-in/ordered-list/index.d.ts +3 -0
  196. package/lib/editor/menu/built-in/ordered-list/ordered-list.d.ts +2 -0
  197. package/lib/editor/menu/built-in/ordered-list/props.d.ts +11 -0
  198. package/lib/editor/menu/built-in/redo/index.d.ts +3 -0
  199. package/lib/editor/menu/built-in/redo/props.d.ts +6 -0
  200. package/lib/editor/menu/built-in/redo/redo.d.ts +2 -0
  201. package/lib/editor/menu/built-in/strikethrough/index.d.ts +3 -0
  202. package/lib/editor/menu/built-in/strikethrough/props.d.ts +10 -0
  203. package/lib/editor/menu/built-in/strikethrough/strikethrough.d.ts +2 -0
  204. package/lib/editor/menu/built-in/subscript/index.d.ts +3 -0
  205. package/lib/editor/menu/built-in/subscript/props.d.ts +10 -0
  206. package/lib/editor/menu/built-in/subscript/subscript.d.ts +2 -0
  207. package/lib/editor/menu/built-in/superscript/index.d.ts +3 -0
  208. package/lib/editor/menu/built-in/superscript/props.d.ts +10 -0
  209. package/lib/editor/menu/built-in/superscript/superscript.d.ts +2 -0
  210. package/lib/editor/menu/built-in/table/index.d.ts +9 -0
  211. package/lib/editor/menu/built-in/table/props.d.ts +97 -0
  212. package/lib/editor/menu/built-in/table/table-add-column.d.ts +2 -0
  213. package/lib/editor/menu/built-in/table/table-add-row.d.ts +2 -0
  214. package/lib/editor/menu/built-in/table/table-delete-column.d.ts +2 -0
  215. package/lib/editor/menu/built-in/table/table-delete-row.d.ts +2 -0
  216. package/lib/editor/menu/built-in/table/table-merge-cell.d.ts +2 -0
  217. package/lib/editor/menu/built-in/table/table-unset.d.ts +2 -0
  218. package/lib/editor/menu/built-in/table/table.d.ts +2 -0
  219. package/lib/editor/menu/built-in/task/index.d.ts +3 -0
  220. package/lib/editor/menu/built-in/task/props.d.ts +10 -0
  221. package/lib/editor/menu/built-in/task/task.d.ts +2 -0
  222. package/lib/editor/menu/built-in/underline/index.d.ts +3 -0
  223. package/lib/editor/menu/built-in/underline/props.d.ts +10 -0
  224. package/lib/editor/menu/built-in/underline/underline.d.ts +2 -0
  225. package/lib/editor/menu/built-in/undo/index.d.ts +3 -0
  226. package/lib/editor/menu/built-in/undo/props.d.ts +6 -0
  227. package/lib/editor/menu/built-in/undo/undo.d.ts +2 -0
  228. package/lib/editor/menu/built-in/unordered-list/index.d.ts +3 -0
  229. package/lib/editor/menu/built-in/unordered-list/props.d.ts +11 -0
  230. package/lib/editor/menu/built-in/unordered-list/unordered-list.d.ts +2 -0
  231. package/lib/editor/menu/built-in/video/index.d.ts +6 -0
  232. package/lib/editor/menu/built-in/video/props.d.ts +56 -0
  233. package/lib/editor/menu/built-in/video/video-controls.d.ts +2 -0
  234. package/lib/editor/menu/built-in/video/video-loop.d.ts +2 -0
  235. package/lib/editor/menu/built-in/video/video-muted.d.ts +2 -0
  236. package/lib/editor/menu/built-in/video/video.d.ts +2 -0
  237. package/lib/editor/menu/built-in/wrap-down/index.d.ts +3 -0
  238. package/lib/editor/menu/built-in/wrap-down/props.d.ts +15 -0
  239. package/lib/editor/menu/built-in/wrap-down/wrap-down.d.ts +2 -0
  240. package/lib/editor/menu/built-in/wrap-up/index.d.ts +3 -0
  241. package/lib/editor/menu/built-in/wrap-up/props.d.ts +15 -0
  242. package/lib/editor/menu/built-in/wrap-up/wrap-up.d.ts +2 -0
  243. package/lib/editor/menu/index.d.ts +4 -0
  244. package/lib/editor/menu/menu.d.ts +6 -0
  245. package/lib/editor/menu/props.d.ts +89 -0
  246. package/lib/editor/wrapper/index.d.ts +3 -0
  247. package/lib/editor/wrapper/props.d.ts +206 -0
  248. package/lib/editor/wrapper/render.d.ts +18 -0
  249. package/lib/editor/wrapper/wrapper.d.ts +6 -0
  250. package/lib/hooks/index.d.ts +1 -0
  251. package/lib/hooks/use-editor.d.ts +32 -0
  252. package/lib/index.d.ts +9 -0
  253. package/lib/kaitify-react.es.js +47868 -0
  254. package/lib/kaitify-react.umd.js +30 -0
  255. package/lib/locale/en-us.d.ts +31 -0
  256. package/lib/locale/index.d.ts +2 -0
  257. package/lib/locale/ja-jp.d.ts +31 -0
  258. package/lib/locale/ko-kr.d.ts +31 -0
  259. package/package.json +56 -0
  260. package/src/core/button/button.tsx +29 -0
  261. package/src/core/button/index.ts +3 -0
  262. package/src/core/button/props.ts +39 -0
  263. package/src/core/button/style.module.less +57 -0
  264. package/src/core/checkbox/checkbox.tsx +39 -0
  265. package/src/core/checkbox/index.ts +3 -0
  266. package/src/core/checkbox/props.ts +21 -0
  267. package/src/core/checkbox/style.module.less +99 -0
  268. package/src/core/divider/divider.tsx +17 -0
  269. package/src/core/divider/index.ts +2 -0
  270. package/src/core/divider/style.module.less +12 -0
  271. package/src/core/icon/icon.tsx +14 -0
  272. package/src/core/icon/index.ts +3 -0
  273. package/src/core/icon/props.ts +23 -0
  274. package/src/core/icon/style.module.less +19 -0
  275. package/src/core/popover/index.ts +3 -0
  276. package/src/core/popover/popover.tsx +286 -0
  277. package/src/core/popover/props.ts +97 -0
  278. package/src/core/popover/style.module.less +247 -0
  279. package/src/core/tabs/index.ts +3 -0
  280. package/src/core/tabs/props.ts +19 -0
  281. package/src/core/tabs/style.module.less +62 -0
  282. package/src/core/tabs/tabs.tsx +35 -0
  283. package/src/core/teleport/index.ts +3 -0
  284. package/src/core/teleport/props.ts +12 -0
  285. package/src/core/teleport/teleport.tsx +23 -0
  286. package/src/editor/bubble/bubble.tsx +244 -0
  287. package/src/editor/bubble/index.ts +3 -0
  288. package/src/editor/bubble/props.ts +65 -0
  289. package/src/editor/bubble/style.module.less +33 -0
  290. package/src/editor/menu/built-in/align-center/align-center.tsx +37 -0
  291. package/src/editor/menu/built-in/align-center/index.ts +3 -0
  292. package/src/editor/menu/built-in/align-center/props.ts +10 -0
  293. package/src/editor/menu/built-in/align-justify/align-justify.tsx +37 -0
  294. package/src/editor/menu/built-in/align-justify/index.ts +3 -0
  295. package/src/editor/menu/built-in/align-justify/props.ts +10 -0
  296. package/src/editor/menu/built-in/align-left/align-left.tsx +37 -0
  297. package/src/editor/menu/built-in/align-left/index.ts +3 -0
  298. package/src/editor/menu/built-in/align-left/props.ts +10 -0
  299. package/src/editor/menu/built-in/align-right/align-right.tsx +37 -0
  300. package/src/editor/menu/built-in/align-right/index.ts +3 -0
  301. package/src/editor/menu/built-in/align-right/props.ts +10 -0
  302. package/src/editor/menu/built-in/attachment/attachment.tsx +190 -0
  303. package/src/editor/menu/built-in/attachment/index.ts +3 -0
  304. package/src/editor/menu/built-in/attachment/props.ts +27 -0
  305. package/src/editor/menu/built-in/attachment/style.module.less +138 -0
  306. package/src/editor/menu/built-in/back-color/back-color.tsx +97 -0
  307. package/src/editor/menu/built-in/back-color/index.ts +3 -0
  308. package/src/editor/menu/built-in/back-color/props.ts +16 -0
  309. package/src/editor/menu/built-in/back-color/style.module.less +62 -0
  310. package/src/editor/menu/built-in/blockquote/blockquote.tsx +36 -0
  311. package/src/editor/menu/built-in/blockquote/index.ts +3 -0
  312. package/src/editor/menu/built-in/blockquote/props.ts +10 -0
  313. package/src/editor/menu/built-in/bold/bold.tsx +45 -0
  314. package/src/editor/menu/built-in/bold/index.ts +3 -0
  315. package/src/editor/menu/built-in/bold/props.ts +10 -0
  316. package/src/editor/menu/built-in/clear-format/clear-format.tsx +28 -0
  317. package/src/editor/menu/built-in/clear-format/index.ts +3 -0
  318. package/src/editor/menu/built-in/clear-format/props.ts +10 -0
  319. package/src/editor/menu/built-in/code/code.tsx +49 -0
  320. package/src/editor/menu/built-in/code/index.ts +3 -0
  321. package/src/editor/menu/built-in/code/props.ts +10 -0
  322. package/src/editor/menu/built-in/code-block/code-block-languages.tsx +73 -0
  323. package/src/editor/menu/built-in/code-block/code-block.tsx +36 -0
  324. package/src/editor/menu/built-in/code-block/index.ts +4 -0
  325. package/src/editor/menu/built-in/code-block/props.ts +32 -0
  326. package/src/editor/menu/built-in/color/color.tsx +96 -0
  327. package/src/editor/menu/built-in/color/index.ts +3 -0
  328. package/src/editor/menu/built-in/color/props.ts +16 -0
  329. package/src/editor/menu/built-in/color/style.module.less +62 -0
  330. package/src/editor/menu/built-in/decrease-indent/decrease-indent.tsx +31 -0
  331. package/src/editor/menu/built-in/decrease-indent/index.ts +3 -0
  332. package/src/editor/menu/built-in/decrease-indent/props.ts +10 -0
  333. package/src/editor/menu/built-in/emoji/emoji.tsx +143 -0
  334. package/src/editor/menu/built-in/emoji/index.ts +3 -0
  335. package/src/editor/menu/built-in/emoji/props.ts +16 -0
  336. package/src/editor/menu/built-in/emoji/style.module.less +26 -0
  337. package/src/editor/menu/built-in/font-family/font-family.tsx +99 -0
  338. package/src/editor/menu/built-in/font-family/index.ts +3 -0
  339. package/src/editor/menu/built-in/font-family/props.ts +20 -0
  340. package/src/editor/menu/built-in/font-size/font-size.tsx +110 -0
  341. package/src/editor/menu/built-in/font-size/index.ts +3 -0
  342. package/src/editor/menu/built-in/font-size/props.ts +20 -0
  343. package/src/editor/menu/built-in/full-screen/full-screen.tsx +66 -0
  344. package/src/editor/menu/built-in/full-screen/index.ts +3 -0
  345. package/src/editor/menu/built-in/full-screen/props.ts +18 -0
  346. package/src/editor/menu/built-in/heading/heading.tsx +101 -0
  347. package/src/editor/menu/built-in/heading/index.ts +3 -0
  348. package/src/editor/menu/built-in/heading/props.ts +20 -0
  349. package/src/editor/menu/built-in/horizontal/horizontal.tsx +40 -0
  350. package/src/editor/menu/built-in/horizontal/index.ts +3 -0
  351. package/src/editor/menu/built-in/horizontal/props.ts +10 -0
  352. package/src/editor/menu/built-in/image/image.tsx +189 -0
  353. package/src/editor/menu/built-in/image/index.ts +3 -0
  354. package/src/editor/menu/built-in/image/props.ts +27 -0
  355. package/src/editor/menu/built-in/image/style.module.less +138 -0
  356. package/src/editor/menu/built-in/increase-indent/increase-indent.tsx +31 -0
  357. package/src/editor/menu/built-in/increase-indent/index.ts +3 -0
  358. package/src/editor/menu/built-in/increase-indent/props.ts +10 -0
  359. package/src/editor/menu/built-in/index.ts +38 -0
  360. package/src/editor/menu/built-in/italic/index.ts +3 -0
  361. package/src/editor/menu/built-in/italic/italic.tsx +45 -0
  362. package/src/editor/menu/built-in/italic/props.ts +10 -0
  363. package/src/editor/menu/built-in/line-height/index.ts +3 -0
  364. package/src/editor/menu/built-in/line-height/line-height.tsx +81 -0
  365. package/src/editor/menu/built-in/line-height/props.ts +20 -0
  366. package/src/editor/menu/built-in/link/index.ts +4 -0
  367. package/src/editor/menu/built-in/link/link-unset.tsx +30 -0
  368. package/src/editor/menu/built-in/link/link.tsx +147 -0
  369. package/src/editor/menu/built-in/link/props.ts +23 -0
  370. package/src/editor/menu/built-in/link/style.module.less +51 -0
  371. package/src/editor/menu/built-in/math/index.ts +3 -0
  372. package/src/editor/menu/built-in/math/math.tsx +98 -0
  373. package/src/editor/menu/built-in/math/props.ts +12 -0
  374. package/src/editor/menu/built-in/math/style.module.less +54 -0
  375. package/src/editor/menu/built-in/ordered-list/index.ts +3 -0
  376. package/src/editor/menu/built-in/ordered-list/ordered-list.tsx +85 -0
  377. package/src/editor/menu/built-in/ordered-list/props.ts +12 -0
  378. package/src/editor/menu/built-in/ordered-list/style.module.less +16 -0
  379. package/src/editor/menu/built-in/redo/index.ts +3 -0
  380. package/src/editor/menu/built-in/redo/props.ts +6 -0
  381. package/src/editor/menu/built-in/redo/redo.tsx +30 -0
  382. package/src/editor/menu/built-in/strikethrough/index.ts +3 -0
  383. package/src/editor/menu/built-in/strikethrough/props.ts +10 -0
  384. package/src/editor/menu/built-in/strikethrough/strikethrough.tsx +45 -0
  385. package/src/editor/menu/built-in/subscript/index.ts +3 -0
  386. package/src/editor/menu/built-in/subscript/props.ts +10 -0
  387. package/src/editor/menu/built-in/subscript/subscript.tsx +45 -0
  388. package/src/editor/menu/built-in/superscript/index.ts +3 -0
  389. package/src/editor/menu/built-in/superscript/props.ts +10 -0
  390. package/src/editor/menu/built-in/superscript/superscript.tsx +45 -0
  391. package/src/editor/menu/built-in/table/index.ts +9 -0
  392. package/src/editor/menu/built-in/table/props.ts +105 -0
  393. package/src/editor/menu/built-in/table/style.module.less +63 -0
  394. package/src/editor/menu/built-in/table/table-add-column.tsx +31 -0
  395. package/src/editor/menu/built-in/table/table-add-row.tsx +31 -0
  396. package/src/editor/menu/built-in/table/table-delete-column.tsx +31 -0
  397. package/src/editor/menu/built-in/table/table-delete-row.tsx +31 -0
  398. package/src/editor/menu/built-in/table/table-merge-cell.tsx +34 -0
  399. package/src/editor/menu/built-in/table/table-unset.tsx +31 -0
  400. package/src/editor/menu/built-in/table/table.tsx +144 -0
  401. package/src/editor/menu/built-in/task/index.ts +3 -0
  402. package/src/editor/menu/built-in/task/props.ts +10 -0
  403. package/src/editor/menu/built-in/task/task.tsx +36 -0
  404. package/src/editor/menu/built-in/underline/index.ts +3 -0
  405. package/src/editor/menu/built-in/underline/props.ts +10 -0
  406. package/src/editor/menu/built-in/underline/underline.tsx +46 -0
  407. package/src/editor/menu/built-in/undo/index.ts +3 -0
  408. package/src/editor/menu/built-in/undo/props.ts +6 -0
  409. package/src/editor/menu/built-in/undo/undo.tsx +31 -0
  410. package/src/editor/menu/built-in/unordered-list/index.ts +3 -0
  411. package/src/editor/menu/built-in/unordered-list/props.ts +12 -0
  412. package/src/editor/menu/built-in/unordered-list/style.module.less +16 -0
  413. package/src/editor/menu/built-in/unordered-list/unordered-list.tsx +85 -0
  414. package/src/editor/menu/built-in/video/index.ts +6 -0
  415. package/src/editor/menu/built-in/video/props.ts +60 -0
  416. package/src/editor/menu/built-in/video/style.module.less +92 -0
  417. package/src/editor/menu/built-in/video/video-controls.tsx +44 -0
  418. package/src/editor/menu/built-in/video/video-loop.tsx +47 -0
  419. package/src/editor/menu/built-in/video/video-muted.tsx +48 -0
  420. package/src/editor/menu/built-in/video/video.tsx +138 -0
  421. package/src/editor/menu/built-in/wrap-down/index.ts +3 -0
  422. package/src/editor/menu/built-in/wrap-down/props.ts +16 -0
  423. package/src/editor/menu/built-in/wrap-down/wrap-down.tsx +49 -0
  424. package/src/editor/menu/built-in/wrap-up/index.ts +3 -0
  425. package/src/editor/menu/built-in/wrap-up/props.ts +16 -0
  426. package/src/editor/menu/built-in/wrap-up/wrap-up.tsx +52 -0
  427. package/src/editor/menu/index.ts +4 -0
  428. package/src/editor/menu/menu.tsx +176 -0
  429. package/src/editor/menu/props.ts +90 -0
  430. package/src/editor/menu/style.module.less +80 -0
  431. package/src/editor/wrapper/index.ts +3 -0
  432. package/src/editor/wrapper/props.ts +209 -0
  433. package/src/editor/wrapper/render.ts +79 -0
  434. package/src/editor/wrapper/style.module.less +10 -0
  435. package/src/editor/wrapper/wrapper.tsx +220 -0
  436. package/src/hooks/index.ts +1 -0
  437. package/src/hooks/use-editor.ts +47 -0
  438. package/src/iconfont/iconfont.css +247 -0
  439. package/src/iconfont/iconfont.ttf +0 -0
  440. package/src/iconfont/iconfont.woff +0 -0
  441. package/src/index.ts +20 -0
  442. package/src/locale/en-us.ts +30 -0
  443. package/src/locale/index.ts +18 -0
  444. package/src/locale/ja-jp.ts +30 -0
  445. package/src/locale/ko-kr.ts +30 -0
  446. package/src/var.less +19 -0
  447. package/tsconfig.json +32 -0
  448. package/tsconfig.node.json +11 -0
  449. package/vite-env.d.ts +5 -0
  450. package/vite.config.ts +58 -0
@@ -0,0 +1,10 @@
1
+ export type ClearFormatMenuPropsType = {
2
+ /**
3
+ * 是否禁用
4
+ */
5
+ disabled?: boolean
6
+ /**
7
+ * 快捷键设置
8
+ */
9
+ shortcut?: (e: KeyboardEvent) => boolean
10
+ }
@@ -0,0 +1,49 @@
1
+ import { useMemo } from 'react'
2
+ import { useEditor } from '@/hooks'
3
+ import { Icon } from '@/core/icon'
4
+ import Menu from '../../menu'
5
+ import { CodeMenuPropsType } from './props'
6
+
7
+ export default function CodeMenu(props: CodeMenuPropsType) {
8
+ const { state } = useEditor()
9
+
10
+ //是否激活
11
+ const isActive = useMemo(() => {
12
+ return state.editor.value?.commands.allCode?.() ?? false
13
+ }, [state.editor])
14
+
15
+ //是否禁用
16
+ const isDisabled = useMemo(() => {
17
+ if (!state.editor.value?.selection.focused()) {
18
+ return true
19
+ }
20
+ if (state.editor.value.commands.hasAttachment?.()) {
21
+ return true
22
+ }
23
+ if (state.editor.value.commands.hasMath?.()) {
24
+ return true
25
+ }
26
+ if (state.editor.value.commands.hasLink?.()) {
27
+ return true
28
+ }
29
+ if (state.editor.value.commands.hasCodeBlock?.()) {
30
+ return true
31
+ }
32
+ return props.disabled ?? false
33
+ }, [state.editor, props.disabled])
34
+
35
+ //方法
36
+ const onOperate = () => {
37
+ if (isActive) {
38
+ state.editor.value?.commands.unsetCode?.()
39
+ } else {
40
+ state.editor.value?.commands.setCode?.()
41
+ }
42
+ }
43
+
44
+ return (
45
+ <Menu disabled={isDisabled} active={isActive} onOperate={onOperate} shortcut={props.shortcut}>
46
+ <Icon name='kaitify-icon-code' />
47
+ </Menu>
48
+ )
49
+ }
@@ -0,0 +1,3 @@
1
+ import CodeMenu from './code'
2
+ export * from './props'
3
+ export { CodeMenu }
@@ -0,0 +1,10 @@
1
+ export type CodeMenuPropsType = {
2
+ /**
3
+ * 是否禁用
4
+ */
5
+ disabled?: boolean
6
+ /**
7
+ * 快捷键设置
8
+ */
9
+ shortcut?: (e: KeyboardEvent) => boolean
10
+ }
@@ -0,0 +1,73 @@
1
+ import { useCallback, useMemo, useRef } from 'react'
2
+ import { HljsLanguages, HljsLanguageType } from '@kaitify/core'
3
+ import { useEditor } from '@/hooks'
4
+ import { MenuDataType, MenuRefType } from '../../props'
5
+ import Menu from '../../menu'
6
+ import { CodeBlockLanguagesMenuPropsType } from './props'
7
+
8
+ export default function CodeBlockLanguagesMenu({ languages = [...HljsLanguages], ...props }: CodeBlockLanguagesMenuPropsType) {
9
+ const { state, t } = useEditor()
10
+ //菜单组件实例
11
+ const menuRef = useRef<MenuRefType | null>(null)
12
+ //选项
13
+ const options = useMemo<MenuDataType[]>(() => {
14
+ return [
15
+ {
16
+ label: t('自动识别'),
17
+ value: ''
18
+ },
19
+ ...languages.map(item => {
20
+ return {
21
+ label: item.charAt(0).toLocaleUpperCase() + item.slice(1),
22
+ value: item
23
+ }
24
+ })
25
+ ]
26
+ }, [languages])
27
+
28
+ //是否禁用
29
+ const isDisabled = useMemo(() => {
30
+ if (!state.editor.value?.selection.focused()) {
31
+ return true
32
+ }
33
+ if (!state.editor.value.commands.getCodeBlock?.()) {
34
+ return true
35
+ }
36
+ return props.disabled ?? false
37
+ }, [state.editor, props.disabled])
38
+ //选项是否激活
39
+ const isActive = useCallback(
40
+ (item: MenuDataType) => {
41
+ if (!state.editor.value?.selection.focused()) {
42
+ return false
43
+ }
44
+ const codeBlockNode = state.editor.value.commands.getCodeBlock?.()
45
+ if (!codeBlockNode) {
46
+ return false
47
+ }
48
+ if (item.value == '') {
49
+ return !codeBlockNode.hasMarks() || !codeBlockNode.marks!['kaitify-hljs']
50
+ }
51
+ return codeBlockNode.marks!['kaitify-hljs'] === item.value
52
+ },
53
+ [state.editor]
54
+ )
55
+ //选择的值
56
+ const selectedData = useMemo<MenuDataType | undefined>(() => {
57
+ if (!state.editor.value?.selection.focused()) {
58
+ return options[0]
59
+ }
60
+ return options.find(item => isActive(item)) ?? options[0]
61
+ }, [state.editor, options])
62
+
63
+ //选择选项
64
+ const onSelect = (item: MenuDataType) => {
65
+ state.editor.value?.commands.updateCodeBlockLanguage?.(item.value as HljsLanguageType)
66
+ }
67
+
68
+ return (
69
+ <Menu ref={menuRef} disabled={isDisabled} active={false} popover data={options} itemActive={isActive} onSelect={onSelect} shortcut={props.shortcut} popoverProps={{ width: props.popoverProps?.width, maxHeight: props.popoverProps?.maxHeight ?? 240, minWidth: props.popoverProps?.minWidth ?? 80, animation: props.popoverProps?.animation, arrow: props.popoverProps?.arrow, placement: props.popoverProps?.placement, trigger: props.popoverProps?.trigger, zIndex: props.popoverProps?.zIndex }}>
70
+ {selectedData?.label ?? ''}
71
+ </Menu>
72
+ )
73
+ }
@@ -0,0 +1,36 @@
1
+ import { useMemo } from 'react'
2
+ import { useEditor } from '@/hooks'
3
+ import { Icon } from '@/core/icon'
4
+ import Menu from '../../menu'
5
+ import { CodeBlockMenuPropsType } from './props'
6
+
7
+ export default function CodeBlockMenu(props: CodeBlockMenuPropsType) {
8
+ const { state } = useEditor()
9
+
10
+ //是否激活
11
+ const isActive = useMemo(() => {
12
+ return state.editor.value?.commands.allCodeBlock?.() ?? false
13
+ }, [state.editor])
14
+ //是否禁用
15
+ const isDisabled = useMemo(() => {
16
+ if (!state.editor.value?.selection.focused()) {
17
+ return true
18
+ }
19
+ return props.disabled ?? false
20
+ }, [state.editor, props.disabled])
21
+
22
+ //方法
23
+ const onOperate = () => {
24
+ if (isActive) {
25
+ state.editor.value?.commands.unsetCodeBlock?.()
26
+ } else {
27
+ state.editor.value?.commands.setCodeBlock?.()
28
+ }
29
+ }
30
+
31
+ return (
32
+ <Menu disabled={isDisabled} active={isActive} onOperate={onOperate} shortcut={props.shortcut}>
33
+ <Icon name='kaitify-icon-code-block' />
34
+ </Menu>
35
+ )
36
+ }
@@ -0,0 +1,4 @@
1
+ import CodeBlockMenu from './code-block'
2
+ import CodeBlockLanguagesMenu from './code-block-languages'
3
+ export * from './props'
4
+ export { CodeBlockMenu, CodeBlockLanguagesMenu }
@@ -0,0 +1,32 @@
1
+ import { HljsLanguageType } from '@kaitify/core'
2
+ import { MenuDataType, MenuPropsType } from '@/editor/menu/props'
3
+
4
+ export type CodeBlockMenuPropsType = {
5
+ /**
6
+ * 是否禁用
7
+ */
8
+ disabled?: boolean
9
+ /**
10
+ * 快捷键设置
11
+ */
12
+ shortcut?: (e: KeyboardEvent) => boolean
13
+ }
14
+
15
+ export type CodeBlockLanguagesMenuPropsType = {
16
+ /**
17
+ * 是否禁用
18
+ */
19
+ disabled?: boolean
20
+ /**
21
+ * 语言列表
22
+ */
23
+ languages?: HljsLanguageType[]
24
+ /**
25
+ * 浮层属性
26
+ */
27
+ popoverProps?: Omit<NonNullable<MenuPropsType['popoverProps']>, 'onShow' | 'onShowing' | 'onShown' | 'onHide' | 'onHiding' | 'onHidden'>
28
+ /**
29
+ * 快捷键设置
30
+ */
31
+ shortcut?: { [key: MenuDataType['value']]: (e: KeyboardEvent) => boolean }
32
+ }
@@ -0,0 +1,96 @@
1
+ import { useCallback, useMemo, useRef } from 'react'
2
+ import classNames from 'classnames'
3
+ import { useEditor } from '@/hooks'
4
+ import { Icon } from '@/core/icon'
5
+ import { Button } from '@/core/button'
6
+ import { MenuRefType } from '../../props'
7
+ import Menu from '../../menu'
8
+ import { ColorMenuPropsType } from './props'
9
+ import styles from './style.module.less'
10
+
11
+ const defaultColors: string[] = ['#000000', '#505050', '#808080', '#BBBBBB', '#CCCCCC', '#EEEEEE', '#F7F7F7', '#FFFFFF', '#EC1A0A', '#FF9900', '#FFFF00', '#07C160', '#00FFFF', '#0B73DE', '#9C00FF', '#FF00FF', '#F7C6CE', '#FFE7CE', '#FFEFC6', '#D6EFD6', '#CEDEE7', '#CEE7F7', '#D6D6E7', '#E7D6DE', '#E79C9C', '#FFC69C', '#FFE79C', '#B5D6A5', '#A5C6CE', '#9CC6EF', '#B5A5D6', '#D6A5BD', '#e45649', '#F7AD6B', '#FFD663', '#94BD7B', '#73A5AD', '#6BADDE', '#8C7BC6', '#C67BA5', '#CE0000', '#E79439', '#EFC631', '#50a14f', '#4A7B8C', '#03A8F3', '#634AA5', '#A54A7B', '#9C0000', '#B56308', '#BD9400', '#397B21', '#104A5A', '#085294', '#311873', '#731842', '#630000', '#7B3900', '#986801', '#295218', '#083139', '#003163', '#21104A', '#4A1031']
12
+
13
+ export default function ColorMenu({ colors = defaultColors, ...props }: ColorMenuPropsType) {
14
+ const { state, t, dark } = useEditor()
15
+
16
+ //菜单组件实例
17
+ const menuRef = useRef<MenuRefType | null>(null)
18
+ //是否禁用
19
+ const isDisabled = useMemo(() => {
20
+ if (!state.editor.value?.selection.focused()) {
21
+ return true
22
+ }
23
+ if (!state.editor.value.selection.collapsed() && !state.editor.value.getFocusNodesBySelection('text').length) {
24
+ return true
25
+ }
26
+ if (state.editor.value.selection.collapsed() && (!!state.editor.value.commands.getAttachment?.() || !!state.editor.value.commands.getMath?.())) {
27
+ return true
28
+ }
29
+ if (!!state.editor.value.commands.getCodeBlock?.()) {
30
+ return true
31
+ }
32
+ return props.disabled ?? false
33
+ }, [state.editor, props.disabled])
34
+
35
+ //颜色是否激活
36
+ const isActive = useCallback(
37
+ (item: string) => {
38
+ return state.editor.value?.commands.isColor?.(item) ?? false
39
+ },
40
+ [state.editor]
41
+ )
42
+
43
+ //设置颜色
44
+ const setColor = (val: string) => {
45
+ if (isActive(val)) {
46
+ return
47
+ }
48
+ state.editor.value?.commands.setColor?.(val)
49
+ menuRef.current?.hidePopover()
50
+ }
51
+ //移除颜色
52
+ const unsetColor = () => {
53
+ state.editor.value?.commands.removeTextStyle?.(['color'])
54
+ menuRef.current?.hidePopover()
55
+ }
56
+
57
+ return (
58
+ <Menu
59
+ ref={menuRef}
60
+ disabled={isDisabled}
61
+ active={false}
62
+ popover
63
+ popoverProps={{ width: props.popoverProps?.width, maxHeight: props.popoverProps?.maxHeight, minWidth: props.popoverProps?.minWidth, animation: props.popoverProps?.animation, arrow: props.popoverProps?.arrow, placement: props.popoverProps?.placement, trigger: props.popoverProps?.trigger, zIndex: props.popoverProps?.zIndex }}
64
+ customPopover={
65
+ <>
66
+ <div
67
+ className={classNames(styles['kaitify-colors-panel'], {
68
+ [styles['kaitify-dark']]: dark
69
+ })}
70
+ >
71
+ <div className={styles['kaitify-colors-header']}>
72
+ <Button onClick={unsetColor} block large>
73
+ <Icon name='kaitify-icon-remove' />
74
+ <span className={styles['kaitify-colors-header-text']}>{t('默认颜色')}</span>
75
+ </Button>
76
+ </div>
77
+ <div className={styles['kaitify-colors-content']}>
78
+ {colors.map(item => (
79
+ <div
80
+ key={item}
81
+ className={classNames(styles['kaitify-colors-el'], {
82
+ [styles['kaitify-color-el-active']]: isActive(item)
83
+ })}
84
+ >
85
+ <div style={{ background: item }} onClick={() => setColor(item)}></div>
86
+ </div>
87
+ ))}
88
+ </div>
89
+ </div>
90
+ </>
91
+ }
92
+ >
93
+ <Icon name='kaitify-icon-font-color' />
94
+ </Menu>
95
+ )
96
+ }
@@ -0,0 +1,3 @@
1
+ import ColorMenu from './color'
2
+ export * from './props'
3
+ export { ColorMenu }
@@ -0,0 +1,16 @@
1
+ import { MenuPropsType } from '@/editor/menu/props'
2
+
3
+ export type ColorMenuPropsType = {
4
+ /**
5
+ * 是否禁用
6
+ */
7
+ disabled?: boolean
8
+ /**
9
+ * 颜色数组
10
+ */
11
+ colors?: string[]
12
+ /**
13
+ * 浮层属性
14
+ */
15
+ popoverProps?: Omit<NonNullable<MenuPropsType['popoverProps']>, 'onShow' | 'onShowing' | 'onShown' | 'onHide' | 'onHiding' | 'onHidden'>
16
+ }
@@ -0,0 +1,62 @@
1
+ .kaitify-colors-panel {
2
+ display: block;
3
+ width: 100%;
4
+ padding: @small-padding;
5
+
6
+ .kaitify-colors-header {
7
+ display: block;
8
+ width: 100%;
9
+ padding-bottom: @small-padding;
10
+ margin-bottom: @margin;
11
+ border-bottom: 1px solid @border-color;
12
+
13
+ .kaitify-colors-header-text {
14
+ margin-left: 10px;
15
+ }
16
+ }
17
+
18
+ .kaitify-colors-content {
19
+ display: grid;
20
+ width: 100%;
21
+ grid-template-columns: repeat(8, 1fr);
22
+ gap: 2px;
23
+
24
+ .kaitify-colors-el {
25
+ padding: 2px;
26
+ border: 1px solid transparent;
27
+ border-radius: 1px;
28
+
29
+ &.kaitify-color-el-active {
30
+ border-color: @theme;
31
+ }
32
+
33
+ & > div {
34
+ display: block;
35
+ width: 16px;
36
+ height: 16px;
37
+ border: 1px solid @border-color;
38
+ border-radius: 1px;
39
+ transition: all 300ms;
40
+
41
+ &:hover {
42
+ cursor: pointer;
43
+ transform: scale(1.2);
44
+ }
45
+ }
46
+ }
47
+ }
48
+
49
+ &.kaitify-dark {
50
+ .kaitify-colors-header {
51
+ border-bottom-color: @border-color-dark;
52
+ }
53
+
54
+ .kaitify-colors-content {
55
+ .kaitify-colors-el {
56
+ & > div {
57
+ border-color: @border-color-dark;
58
+ }
59
+ }
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,31 @@
1
+ import { useMemo } from 'react'
2
+ import { useEditor } from '@/hooks'
3
+ import { Icon } from '@/core/icon'
4
+ import Menu from '../../menu'
5
+ import { DecreaseIndentMenuPropsType } from './props'
6
+
7
+ export default function DecreaseIndentMenu(props: DecreaseIndentMenuPropsType) {
8
+ const { state } = useEditor()
9
+
10
+ //是否禁用
11
+ const isDisabled = useMemo(() => {
12
+ if (!state.editor.value?.selection.focused()) {
13
+ return true
14
+ }
15
+ if (!state.editor.value.commands.canUseIndent?.()) {
16
+ return true
17
+ }
18
+ return props.disabled ?? false
19
+ }, [state.editor, props.disabled])
20
+
21
+ //方法
22
+ const onOperate = () => {
23
+ state.editor.value?.commands.setDecreaseIndent?.()
24
+ }
25
+
26
+ return (
27
+ <Menu disabled={isDisabled} active={false} onOperate={onOperate} shortcut={props.shortcut}>
28
+ <Icon name='kaitify-icon-indent-decrease' />
29
+ </Menu>
30
+ )
31
+ }
@@ -0,0 +1,3 @@
1
+ import DecreaseIndentMenu from './decrease-indent'
2
+ export * from './props'
3
+ export { DecreaseIndentMenu }
@@ -0,0 +1,10 @@
1
+ export type DecreaseIndentMenuPropsType = {
2
+ /**
3
+ * 是否禁用
4
+ */
5
+ disabled?: boolean
6
+ /**
7
+ * 快捷键设置
8
+ */
9
+ shortcut?: (e: KeyboardEvent) => boolean
10
+ }
@@ -0,0 +1,143 @@
1
+ import { useMemo, useRef } from 'react'
2
+ import { Icon } from '@/core/icon'
3
+ import { useEditor } from '@/hooks'
4
+ import { MenuRefType } from '../../props'
5
+ import Menu from '../../menu'
6
+ import { EmojiMenuPropsType } from './props'
7
+ import styles from './style.module.less'
8
+
9
+ /**
10
+ * ['😀', '😃', '😄', '😁', '😆', '😅', '😂', '🤣', '😊', '😇', '😉', '😍', '😘', '😗', '😚', '🥰', '😋', '😜', '🤪', '🤨', '😭', '😢', '😔', '😞', '😰', '😱', '😨', '😳', '😡', '😠', '🤬', '👍', '👎', '👏', '🙌', '👐', '🤝', '✌', '🤞', '🤘', '❤️', '💕', '💖', '💗', '💘', '💔', '❣', '🖤', '💙', '💚', '🍏', '🍎', '🍌', '🍉', '🍇', '🍓', '🍒', '🍑', '🍕', '🍔', '🍟', '🌭', '🍗', '🍞', '🚗', '🚕', '🚙', '🚌', '🚑', '🚓', '🚚', '🚲', '🚜', '🚂', '✈️', '🚀', '🎉', '🎊', '🎁', '🔥', '🌈', '⭐', '💡', '⏰', '📅', '📌', '🎶', '🎵']
11
+ */
12
+ const defaultEmoji: string[] = [
13
+ '\u{1F600}',
14
+ '\u{1F603}',
15
+ '\u{1F604}',
16
+ '\u{1F601}',
17
+ '\u{1F606}',
18
+ '\u{1F605}',
19
+ '\u{1F602}',
20
+ '\u{1F923}',
21
+ '\u{1F60A}',
22
+ '\u{1F607}',
23
+ '\u{1F609}',
24
+ '\u{1F60D}',
25
+ '\u{1F618}',
26
+ '\u{1F617}',
27
+ '\u{1F61A}',
28
+ '\u{1F970}',
29
+ '\u{1F60B}',
30
+ '\u{1F61C}',
31
+ '\u{1F92A}',
32
+ '\u{1F928}',
33
+ '\u{1F62D}',
34
+ '\u{1F622}',
35
+ '\u{1F614}',
36
+ '\u{1F61E}',
37
+ '\u{1F630}',
38
+ '\u{1F631}',
39
+ '\u{1F628}',
40
+ '\u{1F633}',
41
+ '\u{1F621}',
42
+ '\u{1F620}',
43
+ '\u{1F92C}',
44
+ '\u{1F44D}',
45
+ '\u{1F44E}',
46
+ '\u{1F44F}',
47
+ '\u{1F64C}',
48
+ '\u{1F450}',
49
+ '\u{1F91D}',
50
+ '\u{270C}',
51
+ '\u{1F91E}',
52
+ '\u{1F918}',
53
+ '\u{2764}\u{FE0F}',
54
+ '\u{1F495}',
55
+ '\u{1F496}',
56
+ '\u{1F497}',
57
+ '\u{1F498}',
58
+ '\u{1F494}',
59
+ '\u{2763}',
60
+ '\u{1F5A4}',
61
+ '\u{1F499}',
62
+ '\u{1F49A}',
63
+ '\u{1F34F}',
64
+ '\u{1F34E}',
65
+ '\u{1F34C}',
66
+ '\u{1F349}',
67
+ '\u{1F347}',
68
+ '\u{1F353}',
69
+ '\u{1F352}',
70
+ '\u{1F351}',
71
+ '\u{1F355}',
72
+ '\u{1F354}',
73
+ '\u{1F35F}',
74
+ '\u{1F32D}',
75
+ '\u{1F357}',
76
+ '\u{1F35E}',
77
+ '\u{1F697}',
78
+ '\u{1F695}',
79
+ '\u{1F699}',
80
+ '\u{1F68C}',
81
+ '\u{1F691}',
82
+ '\u{1F693}',
83
+ '\u{1F69A}',
84
+ '\u{1F6B2}',
85
+ '\u{1F69C}',
86
+ '\u{1F682}',
87
+ '\u{2708}\u{FE0F}',
88
+ '\u{1F680}',
89
+ '\u{1F389}',
90
+ '\u{1F38A}',
91
+ '\u{1F381}',
92
+ '\u{1F525}',
93
+ '\u{1F308}',
94
+ '\u{2B50}',
95
+ '\u{1F4A1}',
96
+ '\u{23F0}',
97
+ '\u{1F4C5}',
98
+ '\u{1F4CC}',
99
+ '\u{1F3B6}',
100
+ '\u{1F3B5}'
101
+ ]
102
+
103
+ export default function EmojiMenu({ data = defaultEmoji, ...props }: EmojiMenuPropsType) {
104
+ const { state } = useEditor()
105
+
106
+ //菜单组件实例
107
+ const menuRef = useRef<MenuRefType | null>(null)
108
+ //是否禁用
109
+ const isDisabled = useMemo(() => {
110
+ if (!state.editor.value?.selection.focused()) {
111
+ return true
112
+ }
113
+ return props.disabled ?? false
114
+ }, [state.editor, props.disabled])
115
+
116
+ //插入标签
117
+ const setEmoji = (val: string) => {
118
+ state.editor.value?.insertText(val)
119
+ state.editor.value?.updateView()
120
+ menuRef.current?.hidePopover()
121
+ }
122
+
123
+ return (
124
+ <Menu
125
+ ref={menuRef}
126
+ disabled={isDisabled}
127
+ active={false}
128
+ popover
129
+ popoverProps={{ width: props.popoverProps?.width, maxHeight: props.popoverProps?.maxHeight, minWidth: props.popoverProps?.minWidth, animation: props.popoverProps?.animation, arrow: props.popoverProps?.arrow, placement: props.popoverProps?.placement, trigger: props.popoverProps?.trigger, zIndex: props.popoverProps?.zIndex }}
130
+ customPopover={
131
+ <div className={styles['kaitify-emoji-panel']}>
132
+ {data.map((item, index) => (
133
+ <div key={index} className={styles['kaitify-emoji-el']}>
134
+ <div onClick={() => setEmoji(item)}>{item}</div>
135
+ </div>
136
+ ))}
137
+ </div>
138
+ }
139
+ >
140
+ <Icon name='kaitify-icon-emoji' />
141
+ </Menu>
142
+ )
143
+ }
@@ -0,0 +1,3 @@
1
+ import EmojiMenu from './emoji'
2
+ export * from './props'
3
+ export { EmojiMenu }
@@ -0,0 +1,16 @@
1
+ import { MenuPropsType } from '@/editor/menu/props'
2
+
3
+ export type EmojiMenuPropsType = {
4
+ /**
5
+ * 是否禁用
6
+ */
7
+ disabled?: boolean
8
+ /**
9
+ * 表情数组
10
+ */
11
+ data?: string[]
12
+ /**
13
+ * 浮层属性
14
+ */
15
+ popoverProps?: Omit<NonNullable<MenuPropsType['popoverProps']>, 'onShow' | 'onShowing' | 'onShown' | 'onHide' | 'onHiding' | 'onHidden'>
16
+ }
@@ -0,0 +1,26 @@
1
+ .kaitify-emoji-panel {
2
+ display: grid;
3
+ grid-template-columns: repeat(10, 1fr);
4
+ gap: 2px;
5
+ width: 100%;
6
+ padding: @small-padding;
7
+
8
+ .kaitify-emoji-el {
9
+ padding: 2px;
10
+
11
+ & > div {
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ font-size: 18px;
16
+ width: 20px;
17
+ height: 20px;
18
+ transition: all 300ms;
19
+
20
+ &:hover {
21
+ cursor: pointer;
22
+ transform: scale(1.2);
23
+ }
24
+ }
25
+ }
26
+ }