@gientech/modual 1.3.3 → 1.3.5

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 (308) hide show
  1. package/README.md +129 -129
  2. package/{dist/assets → assets}/database.svg +11 -11
  3. package/{src/modules/database/assets → assets}/database_add.svg +53 -53
  4. package/{dist/assets → assets}/database_connect.svg +66 -66
  5. package/{dist/assets → assets}/database_upload.svg +29 -29
  6. package/{dist/assets → assets}/defaultWeLogo.svg +14 -14
  7. package/{dist/assets/index-mPgEc8KC.js → assets/index-CDNF071H.js} +38 -38
  8. package/{dist/assets/index-XvC_4jDB.js → assets/index-Ce4td48i.js} +20 -20
  9. package/{dist/assets → assets}/mysql.svg +14 -14
  10. package/chat.js +654 -0
  11. package/database.js +20 -0
  12. package/{dist/databaseId.js → databaseId.js} +1 -1
  13. package/{dist/databaseTable.js → databaseTable.js} +1 -1
  14. package/{dist/modelManage.js → modelManage.js} +1 -1
  15. package/package.json +39 -83
  16. package/{dist/sensitive.js → sensitive.js} +1 -1
  17. package/{dist/streamFilesReader.js → streamFilesReader.js} +10 -10
  18. package/{dist/worker → worker}/pdf.worker.min.js +21 -21
  19. package/.editorconfig +0 -38
  20. package/.prettierignore +0 -16
  21. package/.prettierrc +0 -17
  22. package/USAGE.md +0 -191
  23. package/bash.exe.stackdump +0 -40
  24. package/components.json +0 -21
  25. package/dist/README.md +0 -129
  26. package/dist/assets/database_add.svg +0 -53
  27. package/dist/chat.js +0 -654
  28. package/dist/database.js +0 -20
  29. package/dist/package.json +0 -56
  30. package/doc_assets/2.png +0 -0
  31. package/doc_assets/demo.md +0 -27
  32. package/doc_assets/demos/dist-app/assets/index.Dh-ZAS9Z.css +0 -2
  33. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js +0 -23699
  34. package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js.map +0 -1
  35. package/doc_assets/demos/dist-app/index.html +0 -14
  36. package/doc_assets/demos/dist-app/vite.svg +0 -1
  37. package/doc_assets/images/1.png +0 -0
  38. package/doc_assets/images/3.png +0 -0
  39. package/doc_assets/images/component-screenshot.png +0 -1
  40. package/doc_assets/install.md +0 -5
  41. package/eslint.config.js +0 -92
  42. package/index.html +0 -13
  43. package/postcss.config.cjs +0 -19
  44. package/public/vite.svg +0 -1
  45. package/public/worker/pdf.worker.min.js +0 -22
  46. package/scripts/README.md +0 -133
  47. package/scripts/build-demo.js +0 -88
  48. package/scripts/demo-selector.js +0 -216
  49. package/scripts/dev-demo.js +0 -76
  50. package/scripts/preview-demo.js +0 -130
  51. package/scripts/run-demo.bat +0 -34
  52. package/src/assets/img/downArrow.png +0 -0
  53. package/src/assets/img/excel.png +0 -0
  54. package/src/assets/img/img.png +0 -0
  55. package/src/assets/img/pdf.png +0 -0
  56. package/src/assets/img/ppt.png +0 -0
  57. package/src/assets/img/txt.png +0 -0
  58. package/src/assets/img/word.png +0 -0
  59. package/src/assets/login/homeBg.png +0 -0
  60. package/src/assets/login/left.jpg +0 -0
  61. package/src/assets/login/logoImg.png +0 -0
  62. package/src/examples/LoginPage/index.tsx +0 -18
  63. package/src/examples/aaa/index.tsx +0 -3758
  64. package/src/examples/chat/components/DrawerGraphPreview.tsx +0 -78
  65. package/src/examples/chat/index.tsx +0 -190
  66. package/src/examples/gientechStreamFilesReader/index.tsx +0 -1016
  67. package/src/examples/ragDatabaseDataPage/index.tsx +0 -36
  68. package/src/examples/ragDatabaseIdPage/index.tsx +0 -44
  69. package/src/examples/ragDatabasePage/index.tsx +0 -36
  70. package/src/examples/ragModelManagePage/index.tsx +0 -37
  71. package/src/examples/ragSearchPage/index.tsx +0 -0
  72. package/src/examples/ragSensitiveWordsPage/index.tsx +0 -32
  73. package/src/examples/streamFiles/index.tsx +0 -384
  74. package/src/lib_enter.ts +0 -38
  75. package/src/main.tsx +0 -5
  76. package/src/main.tsx.backup +0 -5
  77. package/src/modules/chat/Conversations/Item.tsx +0 -167
  78. package/src/modules/chat/Conversations/List.tsx +0 -143
  79. package/src/modules/chat/Conversations/groupByTime.ts +0 -39
  80. package/src/modules/chat/Conversations/index.tsx +0 -212
  81. package/src/modules/chat/constants.tsx +0 -33
  82. package/src/modules/chat/data.txt +0 -82
  83. package/src/modules/chat/index.tsx +0 -1908
  84. package/src/modules/chat/types.ts +0 -17
  85. package/src/modules/database/CreateModal.tsx +0 -398
  86. package/src/modules/database/assets/Doris.png +0 -0
  87. package/src/modules/database/assets/PostgreSQL.png +0 -0
  88. package/src/modules/database/assets/SQLServer.png +0 -0
  89. package/src/modules/database/assets/database.svg +0 -11
  90. package/src/modules/database/assets/database_connect.svg +0 -66
  91. package/src/modules/database/assets/database_upload.svg +0 -29
  92. package/src/modules/database/assets/empty.png +0 -0
  93. package/src/modules/database/assets/mysql.svg +0 -14
  94. package/src/modules/database/index.tsx +0 -466
  95. package/src/modules/database/server.ts +0 -196
  96. package/src/modules/databaseId/CustomCom.tsx +0 -156
  97. package/src/modules/databaseId/EditConfig.tsx +0 -268
  98. package/src/modules/databaseId/UploadDrawer.tsx +0 -520
  99. package/src/modules/databaseId/assets/aiOptimize.svg +0 -10
  100. package/src/modules/databaseId/assets/empty.png +0 -0
  101. package/src/modules/databaseId/assets/template.svg +0 -6
  102. package/src/modules/databaseId/assets/upload.svg +0 -9
  103. package/src/modules/databaseId/assets/useTemp.svg +0 -6
  104. package/src/modules/databaseId/index.tsx +0 -734
  105. package/src/modules/databaseId/server.ts +0 -286
  106. package/src/modules/databaseId/style.css +0 -5
  107. package/src/modules/databaseTable/EditRowDrawer.tsx +0 -119
  108. package/src/modules/databaseTable/index.tsx +0 -357
  109. package/src/modules/databaseTable/server.ts +0 -180
  110. package/src/modules/headlessChat/constants.tsx +0 -32
  111. package/src/modules/headlessChat/index.tsx +0 -1065
  112. package/src/modules/headlessChat/types.ts +0 -23
  113. package/src/modules/login/components/Login/LoginBox/index.tsx +0 -102
  114. package/src/modules/login/components/Login/RegisterBox/index.tsx +0 -180
  115. package/src/modules/login/components/Login/index.tsx +0 -100
  116. package/src/modules/login/index.tsx +0 -106
  117. package/src/modules/login/style.css +0 -3
  118. package/src/modules/login/useServices.ts +0 -53
  119. package/src/modules/login/utils.ts +0 -42
  120. package/src/modules/modelManage/ConfigDrawer.tsx +0 -249
  121. package/src/modules/modelManage/assets/empty.png +0 -0
  122. package/src/modules/modelManage/const.ts +0 -50
  123. package/src/modules/modelManage/index.tsx +0 -439
  124. package/src/modules/modelManage/server.ts +0 -185
  125. package/src/modules/nodegraph/index.tsx +0 -1
  126. package/src/modules/search/assets/Icon-history.svg +0 -8
  127. package/src/modules/search/assets/answerAwartar.png +0 -0
  128. package/src/modules/search/assets/doc.png +0 -0
  129. package/src/modules/search/assets/genera.gif +0 -0
  130. package/src/modules/search/assets/icon-robot.svg +0 -9
  131. package/src/modules/search/assets/icon-search-bar.svg +0 -14
  132. package/src/modules/search/assets/icon-sub-title.svg +0 -3
  133. package/src/modules/search/assets/icon-title.svg +0 -9
  134. package/src/modules/search/assets/icon-zoomOut.svg +0 -9
  135. package/src/modules/search/assets/iconAi.svg +0 -9
  136. package/src/modules/search/assets/pdf.png +0 -0
  137. package/src/modules/search/assets/ppt.png +0 -0
  138. package/src/modules/search/assets/search.svg +0 -3
  139. package/src/modules/search/assets/selected.svg +0 -4
  140. package/src/modules/search/assets/txt.png +0 -0
  141. package/src/modules/search/assets/xls.png +0 -0
  142. package/src/modules/search/components/AssisSelect.tsx +0 -137
  143. package/src/modules/search/components/Editor/ChatViewEditor.tsx +0 -261
  144. package/src/modules/search/components/Editor/aichat.css +0 -1
  145. package/src/modules/search/components/Editor/constant.ts +0 -13
  146. package/src/modules/search/components/Editor/index.tsx +0 -113
  147. package/src/modules/search/components/Editor/plugins/autofomatRules.ts +0 -332
  148. package/src/modules/search/components/Editor/plugins/convertImgPlugins.tsx +0 -20
  149. package/src/modules/search/components/Editor/plugins/createIndexes.tsx +0 -38
  150. package/src/modules/search/components/Editor/plugins/displayer.ts +0 -298
  151. package/src/modules/search/components/Editor/plugins/imageClick.tsx +0 -32
  152. package/src/modules/search/components/Editor/plugins/myplugin.tsx +0 -98
  153. package/src/modules/search/components/Editor/ui/avatar.tsx +0 -19
  154. package/src/modules/search/components/Editor/ui/blockquote-element.tsx +0 -21
  155. package/src/modules/search/components/Editor/ui/button.tsx +0 -58
  156. package/src/modules/search/components/Editor/ui/calendar.tsx +0 -68
  157. package/src/modules/search/components/Editor/ui/caption.tsx +0 -46
  158. package/src/modules/search/components/Editor/ui/checkbox.tsx +0 -27
  159. package/src/modules/search/components/Editor/ui/code-block-combobox.tsx +0 -188
  160. package/src/modules/search/components/Editor/ui/code-block-element.css +0 -434
  161. package/src/modules/search/components/Editor/ui/code-block-element.tsx +0 -39
  162. package/src/modules/search/components/Editor/ui/code-leaf.tsx +0 -24
  163. package/src/modules/search/components/Editor/ui/code-line-element.tsx +0 -10
  164. package/src/modules/search/components/Editor/ui/code-syntax-leaf.tsx +0 -21
  165. package/src/modules/search/components/Editor/ui/column-element.tsx +0 -30
  166. package/src/modules/search/components/Editor/ui/column-group-element.tsx +0 -94
  167. package/src/modules/search/components/Editor/ui/command.tsx +0 -75
  168. package/src/modules/search/components/Editor/ui/comment-avatar.tsx +0 -22
  169. package/src/modules/search/components/Editor/ui/comment-create-form.tsx +0 -37
  170. package/src/modules/search/components/Editor/ui/comment-item.tsx +0 -74
  171. package/src/modules/search/components/Editor/ui/comment-leaf.tsx +0 -49
  172. package/src/modules/search/components/Editor/ui/comment-more-dropdown.tsx +0 -42
  173. package/src/modules/search/components/Editor/ui/comment-reply-items.tsx +0 -22
  174. package/src/modules/search/components/Editor/ui/comment-resolve-button.tsx +0 -32
  175. package/src/modules/search/components/Editor/ui/comment-value.tsx +0 -34
  176. package/src/modules/search/components/Editor/ui/comments-popover.tsx +0 -63
  177. package/src/modules/search/components/Editor/ui/date-element.tsx +0 -83
  178. package/src/modules/search/components/Editor/ui/dialog.tsx +0 -63
  179. package/src/modules/search/components/Editor/ui/draggable.tsx +0 -177
  180. package/src/modules/search/components/Editor/ui/dropdown-menu.tsx +0 -180
  181. package/src/modules/search/components/Editor/ui/emoji-input-element.tsx +0 -85
  182. package/src/modules/search/components/Editor/ui/excalidraw-element.tsx +0 -28
  183. package/src/modules/search/components/Editor/ui/fixed-toolbar-buttons.tsx +0 -76
  184. package/src/modules/search/components/Editor/ui/fixed-toolbar.tsx +0 -8
  185. package/src/modules/search/components/Editor/ui/floating-toolbar-buttons.tsx +0 -51
  186. package/src/modules/search/components/Editor/ui/floating-toolbar.tsx +0 -77
  187. package/src/modules/search/components/Editor/ui/heading-element.tsx +0 -48
  188. package/src/modules/search/components/Editor/ui/highlight-leaf.tsx +0 -17
  189. package/src/modules/search/components/Editor/ui/hr-element.tsx +0 -30
  190. package/src/modules/search/components/Editor/ui/icons.tsx +0 -267
  191. package/src/modules/search/components/Editor/ui/image-element.tsx +0 -74
  192. package/src/modules/search/components/Editor/ui/inline-combobox.tsx +0 -368
  193. package/src/modules/search/components/Editor/ui/input.tsx +0 -25
  194. package/src/modules/search/components/Editor/ui/insert-dropdown-menu.tsx +0 -218
  195. package/src/modules/search/components/Editor/ui/kbd-leaf.tsx +0 -20
  196. package/src/modules/search/components/Editor/ui/link-element.tsx +0 -29
  197. package/src/modules/search/components/Editor/ui/link-floating-toolbar.tsx +0 -161
  198. package/src/modules/search/components/Editor/ui/list-element.tsx +0 -30
  199. package/src/modules/search/components/Editor/ui/mark-toolbar-button.tsx +0 -24
  200. package/src/modules/search/components/Editor/ui/media-embed-element.tsx +0 -133
  201. package/src/modules/search/components/Editor/ui/media-popover.tsx +0 -97
  202. package/src/modules/search/components/Editor/ui/mention-element.tsx +0 -43
  203. package/src/modules/search/components/Editor/ui/mention-input-element.tsx +0 -141
  204. package/src/modules/search/components/Editor/ui/mode-dropdown-menu.tsx +0 -93
  205. package/src/modules/search/components/Editor/ui/more-dropdown-menu.tsx +0 -67
  206. package/src/modules/search/components/Editor/ui/paragraph-element.tsx +0 -4
  207. package/src/modules/search/components/Editor/ui/placeholder.tsx +0 -52
  208. package/src/modules/search/components/Editor/ui/popover.tsx +0 -32
  209. package/src/modules/search/components/Editor/ui/resizable.tsx +0 -66
  210. package/src/modules/search/components/Editor/ui/separator.tsx +0 -25
  211. package/src/modules/search/components/Editor/ui/style.less +0 -12
  212. package/src/modules/search/components/Editor/ui/table-cell-element.tsx +0 -143
  213. package/src/modules/search/components/Editor/ui/table-element.tsx +0 -243
  214. package/src/modules/search/components/Editor/ui/table-row-element.tsx +0 -22
  215. package/src/modules/search/components/Editor/ui/tableValue.tsx +0 -135
  216. package/src/modules/search/components/Editor/ui/todo-list-element.tsx +0 -43
  217. package/src/modules/search/components/Editor/ui/toggle-element.tsx +0 -31
  218. package/src/modules/search/components/Editor/ui/toolbar.tsx +0 -157
  219. package/src/modules/search/components/Editor/ui/tooltip.tsx +0 -65
  220. package/src/modules/search/components/Editor/ui/turn-into-dropdown-menu.tsx +0 -160
  221. package/src/modules/search/components/Editor/ui/with-draggables.tsx +0 -175
  222. package/src/modules/search/components/FileList.tsx +0 -287
  223. package/src/modules/search/components/ImageGroupView/index.tsx +0 -85
  224. package/src/modules/search/components/ResultContent.tsx +0 -232
  225. package/src/modules/search/components/SearchInput.tsx +0 -232
  226. package/src/modules/search/components/SearchLanding.tsx +0 -74
  227. package/src/modules/search/components/SearchView.tsx +0 -563
  228. package/src/modules/search/components/SimpleEditor.tsx +0 -158
  229. package/src/modules/search/components/SimpleFileList.tsx +0 -215
  230. package/src/modules/search/index.tsx +0 -10
  231. package/src/modules/search/reademe.md +0 -1
  232. package/src/modules/search/servers/apis.tsx +0 -19
  233. package/src/modules/search/servers/index.ts +0 -184
  234. package/src/modules/search/style.less +0 -503
  235. package/src/modules/search/type.ts +0 -22
  236. package/src/modules/search/utils.ts +0 -34
  237. package/src/modules/sensitive/index.tsx +0 -313
  238. package/src/modules/sensitive/server.ts +0 -122
  239. package/src/modules/streamFilesReader/GientechStreamReader.tsx +0 -1555
  240. package/src/modules/streamFilesReader/components/Header/Toolbar.tsx +0 -0
  241. package/src/modules/streamFilesReader/components/Header/index.tsx +0 -297
  242. package/src/modules/streamFilesReader/index.tsx +0 -3
  243. package/src/style.css +0 -6
  244. package/src/type.d.ts +0 -0
  245. package/src/utils/commonFn.tsx +0 -111
  246. package/src/utils/gientechCommon/components/AppError.tsx +0 -32
  247. package/src/utils/gientechCommon/components/AppLoading.tsx +0 -75
  248. package/src/utils/gientechCommon/components/DeleteModal.tsx +0 -75
  249. package/src/utils/gientechCommon/components/DisplayError.tsx +0 -33
  250. package/src/utils/gientechCommon/components/DisplayLoading.tsx +0 -38
  251. package/src/utils/gientechCommon/components/FeedBackModal.tsx +0 -310
  252. package/src/utils/gientechCommon/components/FileCardCommon.tsx +0 -82
  253. package/src/utils/gientechCommon/components/FileManager/index.tsx +0 -390
  254. package/src/utils/gientechCommon/components/FileManager/style.css +0 -5
  255. package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +0 -296
  256. package/src/utils/gientechCommon/components/Messages/ReferenceCard.tsx +0 -339
  257. package/src/utils/gientechCommon/components/Messages/RetriveItem.tsx +0 -245
  258. package/src/utils/gientechCommon/components/Messages/WebRetriveItem.tsx +0 -209
  259. package/src/utils/gientechCommon/components/Messages/defaultBot.png +0 -0
  260. package/src/utils/gientechCommon/components/Messages/defaultStyleSet.tsx +0 -148
  261. package/src/utils/gientechCommon/components/Messages/defaultWeLogo.svg +0 -14
  262. package/src/utils/gientechCommon/components/RenameModal.tsx +0 -86
  263. package/src/utils/gientechCommon/components/style.less +0 -11
  264. package/src/utils/gientechCommon/configs/commonConfig.ts +0 -2
  265. package/src/utils/gientechCommon/configs/senderConfig.ts +0 -0
  266. package/src/utils/gientechCommon/configs/stylesConfig.ts +0 -142
  267. package/src/utils/gientechCommon/hooks/AichatUseController.tsx +0 -345
  268. package/src/utils/gientechCommon/slate/converters/deserializers.ts +0 -763
  269. package/src/utils/gientechCommon/slate/converters/mockData.ts +0 -232
  270. package/src/utils/gientechCommon/slate/converters/slateConverters.ts +0 -258
  271. package/src/utils/gientechCommon/slate/richElements/index.tsx +0 -499
  272. package/src/utils/gientechCommon/utils/request.ts +0 -37
  273. package/src/utils/gientechCommon/utils/serverFn.ts +0 -172
  274. package/src/utils/index.tsx +0 -126
  275. package/src/utils/testconfigs/demologin/index.tsx +0 -32
  276. package/src/utils/testconfigs/index.ts +0 -53
  277. package/src/vite-env.d.ts +0 -11
  278. package/stats.html +0 -4949
  279. package/tailwind.config.js +0 -170
  280. package/tsconfig.app.json +0 -30
  281. package/tsconfig.app.tsbuildinfo +0 -11
  282. package/tsconfig.json +0 -13
  283. package/tsconfig.node.json +0 -22
  284. package/tsconfig.node.tsbuildinfo +0 -1
  285. package/vite.config.ts +0 -177
  286. package/workflows/release.yml +0 -60
  287. /package/{dist/assets → assets}/Doris.png +0 -0
  288. /package/{dist/assets → assets}/PostgreSQL.png +0 -0
  289. /package/{dist/assets → assets}/SQLServer.png +0 -0
  290. /package/{dist/assets → assets}/_commonjsHelpers-gnU0ypJ3.js +0 -0
  291. /package/{dist/assets → assets}/circle-alert-g2Y6zAjt.js +0 -0
  292. /package/{dist/assets → assets}/empty.png +0 -0
  293. /package/{dist/assets → assets}/index-CEK88UzR.js +0 -0
  294. /package/{dist/assets → assets}/index-CpW6Dhpp.js +0 -0
  295. /package/{dist/assets → assets}/plus-omCUN0e3.js +0 -0
  296. /package/{dist/assets → assets}/style.css +0 -0
  297. /package/{dist/assets → assets}/style2.css +0 -0
  298. /package/{dist/assets → assets}/style3.css +0 -0
  299. /package/{dist/assets → assets}/styled-components.browser.esm-DPkS13KC.js +0 -0
  300. /package/{dist/assets → assets}/x-vPcWt3fC.js +0 -0
  301. /package/{dist/chat.d.ts → chat.d.ts} +0 -0
  302. /package/{dist/database.d.ts → database.d.ts} +0 -0
  303. /package/{dist/databaseId.d.ts → databaseId.d.ts} +0 -0
  304. /package/{dist/databaseTable.d.ts → databaseTable.d.ts} +0 -0
  305. /package/{dist/modelManage.d.ts → modelManage.d.ts} +0 -0
  306. /package/{dist/sensitive.d.ts → sensitive.d.ts} +0 -0
  307. /package/{dist/streamFilesReader.d.ts → streamFilesReader.d.ts} +0 -0
  308. /package/{dist/vite.svg → vite.svg} +0 -0
@@ -1,93 +0,0 @@
1
- import React from 'react';
2
-
3
- import type { DropdownMenuProps } from '@radix-ui/react-dropdown-menu';
4
-
5
- import {
6
- focusEditor,
7
- useEditorReadOnly,
8
- useEditorRef,
9
- usePlateStore,
10
- } from '@udecode/plate-common/react';
11
-
12
- import { Icons } from './icons';
13
-
14
- import {
15
- DropdownMenu,
16
- DropdownMenuContent,
17
- DropdownMenuRadioGroup,
18
- DropdownMenuRadioItem,
19
- DropdownMenuTrigger,
20
- useOpenState,
21
- } from './dropdown-menu';
22
- import { ToolbarButton } from './toolbar';
23
-
24
- export function ModeDropdownMenu(props: DropdownMenuProps) {
25
- const editor = useEditorRef();
26
- const setReadOnly = usePlateStore().set.readOnly();
27
- const readOnly = useEditorReadOnly();
28
- const openState = useOpenState();
29
-
30
- let value = 'editing';
31
-
32
- if (readOnly) value = 'viewing';
33
-
34
- const item: any = {
35
- editing: (
36
- <>
37
- <Icons.editing className="mr-2 size-5" />
38
- <span className="hidden lg:inline">Editing</span>
39
- </>
40
- ),
41
- viewing: (
42
- <>
43
- <Icons.viewing className="mr-2 size-5" />
44
- <span className="hidden lg:inline">Viewing</span>
45
- </>
46
- ),
47
- };
48
-
49
- return (
50
- <DropdownMenu modal={false} {...openState} {...props}>
51
- <DropdownMenuTrigger asChild>
52
- <ToolbarButton
53
- className="min-w-[auto] lg:min-w-[130px]"
54
- isDropdown
55
- pressed={openState.open}
56
- tooltip="Editing mode"
57
- >
58
- {item[value]}
59
- </ToolbarButton>
60
- </DropdownMenuTrigger>
61
-
62
- <DropdownMenuContent align="start" className="min-w-[180px]">
63
- <DropdownMenuRadioGroup
64
- className="flex flex-col gap-0.5"
65
- onValueChange={(newValue) => {
66
- if (newValue !== 'viewing') {
67
- setReadOnly(false);
68
- }
69
- if (newValue === 'viewing') {
70
- setReadOnly(true);
71
-
72
- return;
73
- }
74
- if (newValue === 'editing') {
75
- focusEditor(editor);
76
-
77
- return;
78
- }
79
- }}
80
- value={value}
81
- >
82
- <DropdownMenuRadioItem value="editing">
83
- {item.editing}
84
- </DropdownMenuRadioItem>
85
-
86
- <DropdownMenuRadioItem value="viewing">
87
- {item.viewing}
88
- </DropdownMenuRadioItem>
89
- </DropdownMenuRadioGroup>
90
- </DropdownMenuContent>
91
- </DropdownMenu>
92
- );
93
- }
@@ -1,67 +0,0 @@
1
- import React from 'react';
2
-
3
- import type { DropdownMenuProps } from '@radix-ui/react-dropdown-menu';
4
-
5
- import {
6
- SubscriptPlugin,
7
- SuperscriptPlugin,
8
- } from '@udecode/plate-basic-marks/react';
9
- import { focusEditor, useEditorRef } from '@udecode/plate-common/react';
10
-
11
- import { Icons } from './icons';
12
-
13
- import {
14
- DropdownMenu,
15
- DropdownMenuContent,
16
- DropdownMenuItem,
17
- DropdownMenuTrigger,
18
- useOpenState,
19
- } from './dropdown-menu';
20
- import { ToolbarButton } from './toolbar';
21
-
22
- export function MoreDropdownMenu(props: DropdownMenuProps) {
23
- const editor = useEditorRef();
24
- const openState = useOpenState();
25
-
26
- return (
27
- <DropdownMenu modal={false} {...openState} {...props}>
28
- <DropdownMenuTrigger asChild>
29
- <ToolbarButton pressed={openState.open} tooltip="Insert">
30
- <Icons.more />
31
- </ToolbarButton>
32
- </DropdownMenuTrigger>
33
-
34
- <DropdownMenuContent
35
- align="start"
36
- className="flex max-h-[500px] min-w-[180px] flex-col gap-0.5 overflow-y-auto"
37
- >
38
- <DropdownMenuItem
39
- onSelect={() => {
40
- editor.tf.toggle.mark({
41
- clear: [SubscriptPlugin.key, SuperscriptPlugin.key],
42
- key: SuperscriptPlugin.key,
43
- });
44
- focusEditor(editor);
45
- }}
46
- >
47
- <Icons.superscript className="mr-2 size-5" />
48
- Superscript
49
- {/* (⌘+,) */}
50
- </DropdownMenuItem>
51
- <DropdownMenuItem
52
- onSelect={() => {
53
- editor.tf.toggle.mark({
54
- clear: [SuperscriptPlugin.key, SubscriptPlugin.key],
55
- key: SubscriptPlugin.key,
56
- });
57
- focusEditor(editor);
58
- }}
59
- >
60
- <Icons.subscript className="mr-2 size-5" />
61
- Subscript
62
- {/* (⌘+.) */}
63
- </DropdownMenuItem>
64
- </DropdownMenuContent>
65
- </DropdownMenu>
66
- );
67
- }
@@ -1,4 +0,0 @@
1
- import { withCn } from '@udecode/cn';
2
- import { PlateElement } from '@udecode/plate-common/react';
3
-
4
- export const ParagraphElement = withCn(PlateElement, 'm-0 px-0 py-1');
@@ -1,52 +0,0 @@
1
- import React from "react";
2
-
3
- import { cn } from "@udecode/cn";
4
- import { ParagraphPlugin } from "@udecode/plate-common/react";
5
- import {
6
- type PlaceholderProps,
7
- createNodeHOC,
8
- createNodesHOC,
9
- usePlaceholderState
10
- } from "@udecode/plate-common/react";
11
- import { HEADING_KEYS } from "@udecode/plate-heading";
12
-
13
- export const Placeholder = (props: PlaceholderProps) => {
14
- const { children, nodeProps, placeholder } = props;
15
-
16
- const { enabled } = usePlaceholderState(props);
17
-
18
- return React.Children.map(children, (child) => {
19
- return React.cloneElement(child, {
20
- className: child.props.className,
21
- nodeProps: {
22
- ...nodeProps,
23
- className: cn(
24
- enabled &&
25
- "before:absolute before:cursor-text before:opacity-30 before:content-[attr(placeholder)]"
26
- ),
27
- placeholder
28
- }
29
- });
30
- });
31
- };
32
-
33
- export const withPlaceholder = createNodeHOC(Placeholder);
34
-
35
- export const withPlaceholdersPrimitive = createNodesHOC(Placeholder);
36
-
37
- export const withPlaceholders = (components: any) =>
38
- withPlaceholdersPrimitive(components, [
39
- {
40
- hideOnBlur: true,
41
- key: ParagraphPlugin.key,
42
- placeholder: "",
43
- query: {
44
- maxLevel: 1
45
- }
46
- },
47
- {
48
- hideOnBlur: false,
49
- key: HEADING_KEYS.h1,
50
- placeholder: "Untitled"
51
- }
52
- ]);
@@ -1,32 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
-
5
- import * as PopoverPrimitive from '@radix-ui/react-popover';
6
- import { cn, withRef } from '@udecode/cn';
7
- import { cva } from 'class-variance-authority';
8
-
9
- export const Popover = PopoverPrimitive.Root;
10
-
11
- export const PopoverTrigger = PopoverPrimitive.Trigger;
12
-
13
- export const PopoverAnchor = PopoverPrimitive.Anchor;
14
-
15
- export const popoverVariants = cva(
16
- 'w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 print:hidden'
17
- );
18
-
19
- export const PopoverContent = withRef<typeof PopoverPrimitive.Content>(
20
- ({ align = 'center', className, sideOffset = 4, style, ...props }, ref) => (
21
- <PopoverPrimitive.Portal>
22
- <PopoverPrimitive.Content
23
- align={align}
24
- className={cn(popoverVariants(), className)}
25
- ref={ref}
26
- sideOffset={sideOffset}
27
- style={{ zIndex: 1000, ...style }}
28
- {...props}
29
- />
30
- </PopoverPrimitive.Portal>
31
- )
32
- );
@@ -1,66 +0,0 @@
1
- 'use client';
2
-
3
- import React from 'react';
4
-
5
- import { cn, withRef, withVariants } from '@udecode/cn';
6
- import {
7
- Resizable as ResizablePrimitive,
8
- ResizeHandle as ResizeHandlePrimitive,
9
- } from '@udecode/plate-resizable';
10
- import { cva } from 'class-variance-authority';
11
-
12
- export const mediaResizeHandleVariants = cva(
13
- cn(
14
- 'top-0 flex w-6 select-none flex-col justify-center',
15
- "after:flex after:h-16 after:w-[3px] after:rounded-[6px] after:bg-ring after:opacity-0 after:content-['_'] group-hover:after:opacity-100"
16
- ),
17
- {
18
- variants: {
19
- direction: {
20
- left: '-left-3 -ml-3 pl-3',
21
- right: '-right-3 -mr-3 items-end pr-3',
22
- },
23
- },
24
- }
25
- );
26
-
27
- const resizeHandleVariants = cva(cn('absolute z-40'), {
28
- variants: {
29
- direction: {
30
- bottom: 'w-full cursor-row-resize',
31
- left: 'h-full cursor-col-resize',
32
- right: 'h-full cursor-col-resize',
33
- top: 'w-full cursor-row-resize',
34
- },
35
- },
36
- });
37
-
38
- const ResizeHandleVariants = withVariants(
39
- ResizeHandlePrimitive,
40
- resizeHandleVariants,
41
- ['direction']
42
- );
43
-
44
- export const ResizeHandle = withRef<typeof ResizeHandlePrimitive>(
45
- (props, ref) => (
46
- <ResizeHandleVariants
47
- direction={props.options?.direction}
48
- ref={ref}
49
- {...props}
50
- />
51
- )
52
- );
53
-
54
- const resizableVariants = cva('', {
55
- variants: {
56
- align: {
57
- center: 'mx-auto',
58
- left: 'mr-auto',
59
- right: 'ml-auto',
60
- },
61
- },
62
- });
63
-
64
- export const Resizable = withVariants(ResizablePrimitive, resizableVariants, [
65
- 'align',
66
- ]);
@@ -1,25 +0,0 @@
1
- 'use client';
2
-
3
- import * as SeparatorPrimitive from '@radix-ui/react-separator';
4
- import { withProps, withVariants } from '@udecode/cn';
5
- import { cva } from 'class-variance-authority';
6
-
7
- const separatorVariants = cva('shrink-0 bg-border', {
8
- defaultVariants: {
9
- orientation: 'horizontal',
10
- },
11
- variants: {
12
- orientation: {
13
- horizontal: 'h-px w-full',
14
- vertical: 'h-full w-px',
15
- },
16
- },
17
- });
18
-
19
- export const Separator = withVariants(
20
- withProps(SeparatorPrimitive.Root, {
21
- decorative: true,
22
- orientation: 'horizontal',
23
- }),
24
- separatorVariants
25
- );
@@ -1,12 +0,0 @@
1
- #plateTableValue {
2
- th,
3
- td {
4
- border: 1px solid #e5e7eb !important;
5
- }
6
- tbody tr:first-child {
7
- background-color: #f0f0f0;
8
- }
9
- table {
10
- width: calc(100% - 3px) !important;
11
- }
12
- }
@@ -1,143 +0,0 @@
1
- import React from 'react';
2
-
3
- import { cn, withProps, withRef } from '@udecode/cn';
4
- import { PlateElement } from '@udecode/plate-common/react';
5
- import {
6
- useTableCellElement,
7
- useTableCellElementResizable,
8
- useTableCellElementResizableState,
9
- useTableCellElementState,
10
- } from '@udecode/plate-table/react';
11
-
12
- import { ResizeHandle } from './resizable';
13
-
14
- export const TableCellElement = withRef<
15
- typeof PlateElement,
16
- {
17
- hideBorder?: boolean;
18
- isHeader?: boolean;
19
- }
20
- >(({ children, className, hideBorder, isHeader, style, ...props }, ref) => {
21
- const { element } = props;
22
-
23
- const {
24
- borders,
25
- colIndex,
26
- colSpan,
27
- hovered,
28
- hoveredLeft,
29
- isSelectingCell,
30
- readOnly,
31
- rowIndex,
32
- rowSize,
33
- selected,
34
- } = useTableCellElementState();
35
- const { props: cellProps } = useTableCellElement({ element: props.element });
36
- const resizableState = useTableCellElementResizableState({
37
- colIndex,
38
- colSpan,
39
- rowIndex,
40
- });
41
-
42
- const { bottomProps, hiddenLeft, leftProps, rightProps } =
43
- useTableCellElementResizable(resizableState);
44
-
45
- const Cell = isHeader ? 'th' : 'td';
46
-
47
- return (
48
- <PlateElement
49
- asChild
50
- className={cn(
51
- 'relative h-full overflow-visible border-none bg-background p-0',
52
- hideBorder && 'before:border-none',
53
- element.background ? 'bg-[--cellBackground]' : 'bg-background',
54
- !hideBorder &&
55
- cn(
56
- isHeader && 'text-left [&_>_*]:m-0',
57
- 'before:size-full',
58
- selected && 'before:z-10 before:bg-muted',
59
- "before:absolute before:box-border before:select-none before:content-['']",
60
- borders &&
61
- cn(
62
- borders.bottom?.size &&
63
- `before:border-b before:border-b-border`,
64
- borders.right?.size && `before:border-r before:border-r-border`,
65
- borders.left?.size && `before:border-l before:border-l-border`,
66
- borders.top?.size && `before:border-t before:border-t-border`
67
- )
68
- ),
69
- className
70
- )}
71
- ref={ref}
72
- {...cellProps}
73
- {...props}
74
- style={
75
- {
76
- '--cellBackground': element.background,
77
- ...style,
78
- } as React.CSSProperties
79
- }
80
- >
81
- <Cell>
82
- <div
83
- className="relative z-20 box-border h-full px-3 py-2"
84
- style={{
85
- minHeight: rowSize,
86
- }}
87
- >
88
- {children}
89
- </div>
90
-
91
- {!isSelectingCell && (
92
- <div
93
- className="group absolute top-0 size-full select-none"
94
- contentEditable={false}
95
- suppressContentEditableWarning={true}
96
- >
97
- {!readOnly && (
98
- <>
99
- <ResizeHandle
100
- {...rightProps}
101
- className="-top-3 right-[-5px] w-[10px]"
102
- />
103
- <ResizeHandle
104
- {...bottomProps}
105
- className="bottom-[-5px] h-[10px]"
106
- />
107
- {!hiddenLeft && (
108
- <ResizeHandle
109
- {...leftProps}
110
- className="-top-3 left-[-5px] w-[10px]"
111
- />
112
- )}
113
-
114
- {hovered && (
115
- <div
116
- className={cn(
117
- 'absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring',
118
- 'right-[-1.5px]'
119
- )}
120
- />
121
- )}
122
- {hoveredLeft && (
123
- <div
124
- className={cn(
125
- 'absolute -top-3 z-30 h-[calc(100%_+_12px)] w-1 bg-ring',
126
- 'left-[-1.5px]'
127
- )}
128
- />
129
- )}
130
- </>
131
- )}
132
- </div>
133
- )}
134
- </Cell>
135
- </PlateElement>
136
- );
137
- });
138
-
139
- TableCellElement.displayName = 'TableCellElement';
140
-
141
- export const TableCellHeaderElement = withProps(TableCellElement, {
142
- isHeader: true,
143
- });