@tulip-systems/core 0.5.0 → 0.5.2

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 (252) hide show
  1. package/dist/components/client.d.mts +2 -2
  2. package/dist/components/client.mjs +2 -2
  3. package/dist/components/common/icons.d.mts +52 -52
  4. package/dist/components/common/status.d.mts +3 -3
  5. package/dist/components/editor/components/content.client.d.mts +2 -2
  6. package/dist/components/editor/components/editor.client.d.mts +3 -3
  7. package/dist/components/editor/components/editor.client.d.mts.map +1 -1
  8. package/dist/components/editor/components/{block-dropdown.mjs → menu-nodes.client.mjs} +7 -11
  9. package/dist/components/editor/components/menu-nodes.client.mjs.map +1 -0
  10. package/dist/components/editor/components/menu.client.d.mts +10 -0
  11. package/dist/components/editor/components/menu.client.d.mts.map +1 -0
  12. package/dist/components/editor/components/menu.client.mjs +166 -0
  13. package/dist/components/editor/components/menu.client.mjs.map +1 -0
  14. package/dist/components/editor/lib/extensions.d.mts +3 -0
  15. package/dist/components/editor/lib/extensions.d.mts.map +1 -1
  16. package/dist/components/editor/lib/extensions.mjs.map +1 -1
  17. package/dist/components/header/back-button.client.d.mts +2 -2
  18. package/dist/components/header/bottom-bar.client.d.mts +3 -3
  19. package/dist/components/header/breadcrumbs.client.d.mts +7 -7
  20. package/dist/components/header/header.client.d.mts +2 -2
  21. package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
  22. package/dist/components/header/top-bar.client.d.mts +4 -4
  23. package/dist/components/layouts/admin-content.client.d.mts +2 -2
  24. package/dist/components/layouts/admin-layout.d.mts +2 -2
  25. package/dist/components/layouts/admin-layout.d.mts.map +1 -1
  26. package/dist/components/layouts/admin-loading.d.mts +2 -2
  27. package/dist/components/layouts/empty-page.d.mts +4 -4
  28. package/dist/components/layouts/list-layout.d.mts +2 -2
  29. package/dist/components/layouts/not-found-page.d.mts +3 -3
  30. package/dist/components/layouts/providers.client.d.mts +2 -2
  31. package/dist/components/layouts/root-layout.server.d.mts +2 -2
  32. package/dist/components/layouts/root-layout.server.d.mts.map +1 -1
  33. package/dist/components/layouts/root-loading.d.mts +2 -2
  34. package/dist/components/layouts/tab-layout.d.mts +2 -2
  35. package/dist/components/lists/data-list.d.mts +5 -5
  36. package/dist/components/lists/data-stack.d.mts +8 -8
  37. package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
  38. package/dist/components/ui/accordion.d.mts +5 -5
  39. package/dist/components/ui/accordion.d.mts.map +1 -1
  40. package/dist/components/ui/alert-dialog.d.mts +12 -12
  41. package/dist/components/ui/alert-dialog.d.mts.map +1 -1
  42. package/dist/components/ui/alert.d.mts +4 -4
  43. package/dist/components/ui/alert.d.mts.map +1 -1
  44. package/dist/components/ui/aspect-ratio.d.mts +2 -2
  45. package/dist/components/ui/aspect-ratio.d.mts.map +1 -1
  46. package/dist/components/ui/avatar.client.d.mts +4 -4
  47. package/dist/components/ui/badge.d.mts +2 -2
  48. package/dist/components/ui/badge.d.mts.map +1 -1
  49. package/dist/components/ui/breadcrumb.d.mts +8 -8
  50. package/dist/components/ui/breadcrumb.d.mts.map +1 -1
  51. package/dist/components/ui/button.d.mts +2 -2
  52. package/dist/components/ui/button.d.mts.map +1 -1
  53. package/dist/components/ui/calendar.d.mts +3 -3
  54. package/dist/components/ui/calendar.d.mts.map +1 -1
  55. package/dist/components/ui/card.d.mts +7 -7
  56. package/dist/components/ui/card.d.mts.map +1 -1
  57. package/dist/components/ui/carousel.d.mts +6 -6
  58. package/dist/components/ui/carousel.d.mts.map +1 -1
  59. package/dist/components/ui/chart.client.d.mts +5 -5
  60. package/dist/components/ui/checkbox.d.mts +2 -2
  61. package/dist/components/ui/checkbox.d.mts.map +1 -1
  62. package/dist/components/ui/collapsible.client.d.mts +4 -4
  63. package/dist/components/ui/color-picker.client.d.mts +2 -2
  64. package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
  65. package/dist/components/ui/combobox.client.d.mts +2 -2
  66. package/dist/components/ui/command.d.mts +10 -10
  67. package/dist/components/ui/command.d.mts.map +1 -1
  68. package/dist/components/ui/context-menu.d.mts +16 -16
  69. package/dist/components/ui/context-menu.d.mts.map +1 -1
  70. package/dist/components/ui/date-picker.client.d.mts +2 -2
  71. package/dist/components/ui/dialog.client.d.mts +11 -11
  72. package/dist/components/ui/drawer.client.d.mts +11 -11
  73. package/dist/components/ui/dropdown-menu.d.mts +16 -16
  74. package/dist/components/ui/form.client.d.mts +7 -7
  75. package/dist/components/ui/hover-card.client.d.mts +4 -4
  76. package/dist/components/ui/input-recipient.d.mts +2 -2
  77. package/dist/components/ui/input.d.mts +2 -2
  78. package/dist/components/ui/label.d.mts +2 -2
  79. package/dist/components/ui/navigation-menu.d.mts +9 -9
  80. package/dist/components/ui/pagination.d.mts +8 -8
  81. package/dist/components/ui/popover.d.mts +5 -5
  82. package/dist/components/ui/progress.client.d.mts +2 -2
  83. package/dist/components/ui/radio-group.d.mts +3 -3
  84. package/dist/components/ui/resizable.client.d.mts +4 -4
  85. package/dist/components/ui/scroll-area.d.mts +3 -3
  86. package/dist/components/ui/select.client.d.mts +11 -11
  87. package/dist/components/ui/separator.d.mts +2 -2
  88. package/dist/components/ui/sheet.client.d.mts +9 -9
  89. package/dist/components/ui/sidebar.client.d.mts +24 -24
  90. package/dist/components/ui/skeleton.d.mts +2 -2
  91. package/dist/components/ui/slider.d.mts +2 -2
  92. package/dist/components/ui/sonner.client.d.mts +2 -2
  93. package/dist/components/ui/switch.d.mts +2 -2
  94. package/dist/components/ui/tabs.d.mts +5 -5
  95. package/dist/components/ui/textarea.d.mts +2 -2
  96. package/dist/components/ui/time-input.client.d.mts +2 -2
  97. package/dist/components/ui/toggle-group.client.d.mts +3 -3
  98. package/dist/components/ui/toggle.d.mts +2 -2
  99. package/dist/components/ui/tooltip.client.d.mts +5 -5
  100. package/dist/lib/hooks/use-action.d.mts +2 -2
  101. package/dist/lib/hooks/use-indicator.d.mts +2 -2
  102. package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
  103. package/dist/modules/auth/components/allowed.client.d.mts +2 -2
  104. package/dist/modules/auth/components/allowed.client.d.mts.map +1 -1
  105. package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
  106. package/dist/modules/auth/components/auth-layout.server.d.mts.map +1 -1
  107. package/dist/modules/auth/components/auth-loading.d.mts +2 -2
  108. package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
  109. package/dist/modules/auth/components/create-first-user-page.client.d.mts.map +1 -1
  110. package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
  111. package/dist/modules/auth/components/forget-password-page.client.d.mts.map +1 -1
  112. package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
  113. package/dist/modules/auth/components/guard-first-user.server.d.mts.map +1 -1
  114. package/dist/modules/auth/components/guard.server.d.mts +2 -2
  115. package/dist/modules/auth/components/guard.server.d.mts.map +1 -1
  116. package/dist/modules/auth/components/login-page.client.d.mts +2 -2
  117. package/dist/modules/auth/components/login-page.client.d.mts.map +1 -1
  118. package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
  119. package/dist/modules/auth/components/reset-password-page.client.d.mts.map +1 -1
  120. package/dist/modules/auth/components/update-password-command.d.mts +2 -2
  121. package/dist/modules/auth/components/update-password-command.d.mts.map +1 -1
  122. package/dist/modules/auth/db/schema.d.mts +73 -73
  123. package/dist/modules/auth/db/schema.d.mts.map +1 -1
  124. package/dist/modules/auth/hooks/use-permission.d.mts +2 -2
  125. package/dist/modules/auth/lib/validators.d.mts +2 -2
  126. package/dist/modules/auth/lib/validators.d.mts.map +1 -1
  127. package/dist/modules/commands/components/alert-dialog-command.client.d.mts +10 -10
  128. package/dist/modules/commands/components/alert-dialog-command.client.d.mts.map +1 -1
  129. package/dist/modules/commands/components/click-command.client.d.mts +2 -2
  130. package/dist/modules/commands/components/click-command.client.d.mts.map +1 -1
  131. package/dist/modules/commands/components/command-trigger.client.d.mts +6 -6
  132. package/dist/modules/commands/components/command-trigger.client.d.mts.map +1 -1
  133. package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
  134. package/dist/modules/commands/components/dialog-command.client.d.mts.map +1 -1
  135. package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
  136. package/dist/modules/commands/components/dropdown-command.client.d.mts.map +1 -1
  137. package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
  138. package/dist/modules/commands/components/empty-command.client.d.mts.map +1 -1
  139. package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -11
  140. package/dist/modules/commands/components/form-dialog-command.client.d.mts.map +1 -1
  141. package/dist/modules/commands/hooks/use-command-mutation.client.d.mts +2 -2
  142. package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
  143. package/dist/modules/commands/menus/context-menu.client.d.mts.map +1 -1
  144. package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
  145. package/dist/modules/commands/menus/dropdown-menu.client.d.mts.map +1 -1
  146. package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
  147. package/dist/modules/commands/menus/inline-menu.client.d.mts.map +1 -1
  148. package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
  149. package/dist/modules/commands/menus/responsive-menu.client.d.mts.map +1 -1
  150. package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
  151. package/dist/modules/commands/utils/archive-command.client.d.mts.map +1 -1
  152. package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
  153. package/dist/modules/commands/utils/delete-command.client.d.mts.map +1 -1
  154. package/dist/modules/config/db/helpers.d.mts +5 -5
  155. package/dist/modules/config/db/helpers.d.mts.map +1 -1
  156. package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
  157. package/dist/modules/data-tables/components/column-header.d.mts +2 -2
  158. package/dist/modules/data-tables/components/column-header.d.mts.map +1 -1
  159. package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
  160. package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
  161. package/dist/modules/data-tables/components/header.d.mts +4 -4
  162. package/dist/modules/data-tables/components/header.d.mts.map +1 -1
  163. package/dist/modules/data-tables/components/layout.d.mts +2 -2
  164. package/dist/modules/data-tables/components/layout.d.mts.map +1 -1
  165. package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
  166. package/dist/modules/data-tables/components/skeleton.d.mts +2 -2
  167. package/dist/modules/data-tables/components/skeleton.d.mts.map +1 -1
  168. package/dist/modules/data-tables/components/table.d.mts +7 -7
  169. package/dist/modules/data-tables/components/table.d.mts.map +1 -1
  170. package/dist/modules/data-tables/components/toolbar.d.mts +3 -3
  171. package/dist/modules/data-tables/components/toolbar.d.mts.map +1 -1
  172. package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
  173. package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
  174. package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
  175. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
  176. package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts +2 -2
  177. package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts +2 -2
  178. package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts +3 -3
  179. package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts +2 -2
  180. package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts +2 -2
  181. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
  182. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
  183. package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +2 -2
  184. package/dist/modules/inline-edit/components/combobox.client.d.mts +2 -2
  185. package/dist/modules/inline-edit/components/date-input.client.d.mts +2 -2
  186. package/dist/modules/inline-edit/components/date-picker.client.d.mts +2 -2
  187. package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts +2 -2
  188. package/dist/modules/inline-edit/components/editor.client.d.mts +2 -2
  189. package/dist/modules/inline-edit/components/input-recipient.client.d.mts +2 -2
  190. package/dist/modules/inline-edit/components/input-toggle.client.d.mts +2 -2
  191. package/dist/modules/inline-edit/components/input.client.d.mts +4 -4
  192. package/dist/modules/inline-edit/components/select.client.d.mts +6 -6
  193. package/dist/modules/inline-edit/components/switch.client.d.mts +2 -2
  194. package/dist/modules/inline-edit/components/toggle.client.d.mts +2 -2
  195. package/dist/modules/inline-edit/hooks/context.client.d.mts +2 -2
  196. package/dist/modules/inline-edit/lib/variants.d.mts +1 -1
  197. package/dist/modules/router/lib/query-client.server.d.mts +2 -2
  198. package/dist/modules/router/lib/query-client.server.d.mts.map +1 -1
  199. package/dist/modules/storage/components/dropzone-context.client.d.mts +2 -2
  200. package/dist/modules/storage/components/dropzone-context.client.d.mts.map +1 -1
  201. package/dist/modules/storage/components/dropzone.client.d.mts +5 -5
  202. package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
  203. package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
  204. package/dist/modules/storage/components/image-grid.client.d.mts.map +1 -1
  205. package/dist/modules/storage/components/upload-zone.client.d.mts +5 -3
  206. package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
  207. package/dist/modules/storage/components/upload-zone.client.mjs +6 -4
  208. package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
  209. package/dist/modules/storage/config/filters.d.mts +1 -0
  210. package/dist/modules/storage/config/filters.d.mts.map +1 -1
  211. package/dist/modules/storage/config/filters.mjs +2 -1
  212. package/dist/modules/storage/config/filters.mjs.map +1 -1
  213. package/dist/modules/storage/lib/helpers.d.mts +2 -2
  214. package/dist/modules/storage/lib/helpers.d.mts.map +1 -1
  215. package/dist/modules/storage/lib/helpers.mjs +1 -0
  216. package/dist/modules/storage/lib/helpers.mjs.map +1 -1
  217. package/dist/modules/storage/lib/router.server.d.mts +3205 -2227
  218. package/dist/modules/storage/lib/router.server.d.mts.map +1 -1
  219. package/dist/modules/storage/lib/router.server.mjs +1 -0
  220. package/dist/modules/storage/lib/router.server.mjs.map +1 -1
  221. package/dist/modules/storage/lib/schema.d.mts +122 -88
  222. package/dist/modules/storage/lib/schema.d.mts.map +1 -1
  223. package/dist/modules/storage/lib/schema.mjs +1 -0
  224. package/dist/modules/storage/lib/schema.mjs.map +1 -1
  225. package/dist/modules/storage/lib/service.server.d.mts +48 -21
  226. package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
  227. package/dist/modules/storage/lib/service.server.mjs +15 -8
  228. package/dist/modules/storage/lib/service.server.mjs.map +1 -1
  229. package/dist/modules/storage/lib/validators.d.mts +215 -134
  230. package/dist/modules/storage/lib/validators.d.mts.map +1 -1
  231. package/dist/modules/storage/lib/validators.mjs +14 -24
  232. package/dist/modules/storage/lib/validators.mjs.map +1 -1
  233. package/dist/storage.d.mts +2 -2
  234. package/dist/storage.mjs +2 -2
  235. package/package.json +3 -3
  236. package/src/components/editor/components/{block-dropdown.tsx → menu-nodes.client.tsx} +24 -29
  237. package/src/components/editor/components/menu.client.tsx +214 -0
  238. package/src/components/editor/lib/extensions.ts +3 -3
  239. package/src/components/entry.client.ts +1 -1
  240. package/src/modules/storage/components/upload-zone.client.tsx +5 -2
  241. package/src/modules/storage/config/filters.ts +1 -0
  242. package/src/modules/storage/lib/helpers.ts +3 -2
  243. package/src/modules/storage/lib/router.server.ts +6 -0
  244. package/src/modules/storage/lib/schema.ts +1 -0
  245. package/src/modules/storage/lib/service.server.ts +25 -4
  246. package/src/modules/storage/lib/validators.ts +20 -31
  247. package/dist/components/editor/components/block-dropdown.mjs.map +0 -1
  248. package/dist/components/editor/components/menu-fixed.client.d.mts +0 -7
  249. package/dist/components/editor/components/menu-fixed.client.d.mts.map +0 -1
  250. package/dist/components/editor/components/menu-fixed.client.mjs +0 -128
  251. package/dist/components/editor/components/menu-fixed.client.mjs.map +0 -1
  252. package/src/components/editor/components/menu-fixed.client.tsx +0 -165
@@ -38,26 +38,6 @@ export const updateNodeSchema = createUpdateSchema(nodes);
38
38
  export type UpdateNodeInput = z.input<typeof updateNodeSchema>;
39
39
  export type UpdateNodeSchema = z.infer<typeof updateNodeSchema>;
40
40
 
41
- /**
42
- * Create folder node
43
- */
44
- export const createFolderNodeSchema = createNodeSchema.omit({
45
- type: true,
46
- contentType: true,
47
- size: true,
48
- subtype: true,
49
- });
50
-
51
- export type CreateFolderNodeSchema = z.infer<typeof createFolderNodeSchema>;
52
-
53
- /**
54
- * Create file node
55
- */
56
- export const createFileNodeSchema = createNodeSchema.omit({
57
- type: true,
58
- });
59
- export type CreateFileNodeSchema = z.infer<typeof createFileNodeSchema>;
60
-
61
41
  /**
62
42
  * Select node
63
43
  */
@@ -78,22 +58,31 @@ export const nodesTableFiltersSchema = resolveFiltersSchema(nodesTableFilters)
78
58
  namespace: z.string(),
79
59
  parentId: z.string().nullable(),
80
60
  })
81
- .transform((input) => ({ ...input, isDeleted: input?.isDeleted ?? false }));
61
+ .transform((input) => ({
62
+ ...input,
63
+ hidden: input?.hidden ?? false,
64
+ isDeleted: input?.isDeleted ?? false,
65
+ }));
82
66
 
83
67
  export type NodesTableFilters = z.input<typeof nodesTableFiltersSchema>;
84
68
 
85
69
  /**
86
- * Upload file schema
70
+ * Create folder node
87
71
  */
88
- export const uploadFileSchema = z.object({
89
- name: z.string().min(1),
90
- namespace: z.string(),
91
- mode: nodeModeSchema.optional(),
92
- parentId: z.uuid().nullable(),
93
- size: z.number().optional().default(0),
94
- contentType: z.string().optional().default(""),
72
+ export const createFolderNodeSchema = createNodeSchema.omit({
73
+ type: true,
74
+ contentType: true,
75
+ size: true,
76
+ subtype: true,
95
77
  });
96
78
 
79
+ export type CreateFolderNodeSchema = z.infer<typeof createFolderNodeSchema>;
80
+
81
+ /**
82
+ * Upload file schema
83
+ */
84
+ export const uploadFileSchema = createNodeSchema.omit({ type: true });
85
+
97
86
  export type UploadFileSchema = z.infer<typeof uploadFileSchema>;
98
87
 
99
88
  /**
@@ -145,8 +134,8 @@ export const putObjectSchema = z.object({
145
134
  name: z.string().optional().default(""),
146
135
  variant: z.enum(imageVariants).optional().default("main"),
147
136
  body: z.any().optional(),
148
- contentType: z.string().optional().default(""),
149
- size: z.number().optional().default(0),
137
+ contentType: z.string().nullable().optional(),
138
+ size: z.number().nullable().optional(),
150
139
  });
151
140
 
152
141
  export type PutObjectInput = z.input<typeof putObjectSchema> & {
@@ -1 +0,0 @@
1
- {"version":3,"file":"block-dropdown.mjs","names":["Icon"],"sources":["../../../../src/components/editor/components/block-dropdown.tsx"],"sourcesContent":["import { Button } from \"@/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport { Separator } from \"@/components/ui/separator\";\nimport { Editor } from \"@tiptap/react\";\nimport {\n ChevronDown,\n Heading1Icon,\n Heading2Icon,\n Heading3Icon,\n Heading4Icon,\n Heading5Icon,\n ListIcon,\n ListOrderedIcon,\n TextIcon,\n} from \"lucide-react\";\nimport { useContext } from \"react\";\nimport { EditorExtensionsConfigResult } from \"../lib/extensions\";\nimport { EditorContext } from \"./editor.client\";\n\nconst blocks = [\n {\n label: \"Paragraaf\",\n icon: TextIcon,\n selected: (editor: Editor) => editor.isActive(\"paragraph\"),\n handler: (editor: Editor) => editor.commands.setParagraph(),\n hidden: (extensions: EditorExtensionsConfigResult) => !extensions.paragraph,\n },\n {\n label: \"Titel 1\",\n icon: Heading1Icon,\n selected: (editor: Editor) => editor.isActive(\"heading\", { level: 1 }),\n handler: (editor: Editor) => editor.commands.setHeading({ level: 1 }),\n hidden: (extensions: EditorExtensionsConfigResult) => !extensions.heading,\n },\n {\n label: \"Titel 2\",\n icon: Heading2Icon,\n selected: (editor: Editor) => editor.isActive(\"heading\", { level: 2 }),\n handler: (editor: Editor) => editor.commands.setHeading({ level: 2 }),\n hidden: (extensions: EditorExtensionsConfigResult) => !extensions.heading,\n },\n {\n label: \"Titel 3\",\n icon: Heading3Icon,\n selected: (editor: Editor) => editor.isActive(\"heading\", { level: 3 }),\n handler: (editor: Editor) => editor.commands.setHeading({ level: 3 }),\n hidden: (extensions: EditorExtensionsConfigResult) => !extensions.heading,\n },\n {\n label: \"Titel 4\",\n icon: Heading4Icon,\n selected: (editor: Editor) => editor.isActive(\"heading\", { level: 4 }),\n handler: (editor: Editor) => editor.commands.setHeading({ level: 4 }),\n hidden: (extensions: EditorExtensionsConfigResult) => !extensions.heading,\n },\n {\n label: \"Titel 5\",\n icon: Heading5Icon,\n selected: (editor: Editor) => editor.isActive(\"heading\", { level: 5 }),\n handler: (editor: Editor) => editor.commands.setHeading({ level: 5 }),\n hidden: (extensions: EditorExtensionsConfigResult) => !extensions.heading,\n },\n {\n label: \"Numbered List\",\n icon: ListOrderedIcon,\n selected: (editor: Editor) => editor.isActive(\"orderedList\"),\n handler: (editor: Editor) => editor.commands.toggleOrderedList(),\n hidden: (extensions: EditorExtensionsConfigResult) => !extensions.orderedList,\n },\n {\n label: \"Bulleted List\",\n icon: ListIcon,\n selected: (editor: Editor) => editor.isActive(\"bulletList\"),\n handler: (editor: Editor) => editor.commands.toggleBulletList(),\n hidden: (extensions: EditorExtensionsConfigResult) => !extensions.bulletList,\n },\n];\n\nexport function BlockDropdown() {\n const { editor, extensions } = useContext(EditorContext);\n\n const selectedBlock = blocks.find((block) => block.selected(editor));\n const Icon = selectedBlock?.icon;\n\n const filteredBlocks = blocks.filter((block) => !block.hidden(extensions));\n\n if (filteredBlocks.length === 0) return null;\n\n return (\n <>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" className=\"flex items-center gap-8 p-2\">\n <span className=\"flex items-center gap-2\">\n {Icon && <Icon className=\"size-3.5\" />}\n {selectedBlock?.label ?? \"Select a block\"}\n </span>\n\n <ChevronDown className=\"size-3.5\" />\n </Button>\n </DropdownMenuTrigger>\n\n <DropdownMenuContent>\n {filteredBlocks.map(({ label, icon: Icon, handler }, index) => (\n <DropdownMenuItem\n key={index}\n onClick={() => handler(editor)}\n className=\"flex items-center gap-2\"\n >\n {Icon && <Icon className=\"size-3.5\" />}\n {label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n\n <Separator orientation=\"vertical\" className=\"h-8\" />\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAwBA,MAAM,SAAS;CACb;EACE,OAAO;EACP,MAAM;EACN,WAAW,WAAmB,OAAO,SAAS,YAAY;EAC1D,UAAU,WAAmB,OAAO,SAAS,cAAc;EAC3D,SAAS,eAA6C,CAAC,WAAW;EACnE;CACD;EACE,OAAO;EACP,MAAM;EACN,WAAW,WAAmB,OAAO,SAAS,WAAW,EAAE,OAAO,GAAG,CAAC;EACtE,UAAU,WAAmB,OAAO,SAAS,WAAW,EAAE,OAAO,GAAG,CAAC;EACrE,SAAS,eAA6C,CAAC,WAAW;EACnE;CACD;EACE,OAAO;EACP,MAAM;EACN,WAAW,WAAmB,OAAO,SAAS,WAAW,EAAE,OAAO,GAAG,CAAC;EACtE,UAAU,WAAmB,OAAO,SAAS,WAAW,EAAE,OAAO,GAAG,CAAC;EACrE,SAAS,eAA6C,CAAC,WAAW;EACnE;CACD;EACE,OAAO;EACP,MAAM;EACN,WAAW,WAAmB,OAAO,SAAS,WAAW,EAAE,OAAO,GAAG,CAAC;EACtE,UAAU,WAAmB,OAAO,SAAS,WAAW,EAAE,OAAO,GAAG,CAAC;EACrE,SAAS,eAA6C,CAAC,WAAW;EACnE;CACD;EACE,OAAO;EACP,MAAM;EACN,WAAW,WAAmB,OAAO,SAAS,WAAW,EAAE,OAAO,GAAG,CAAC;EACtE,UAAU,WAAmB,OAAO,SAAS,WAAW,EAAE,OAAO,GAAG,CAAC;EACrE,SAAS,eAA6C,CAAC,WAAW;EACnE;CACD;EACE,OAAO;EACP,MAAM;EACN,WAAW,WAAmB,OAAO,SAAS,WAAW,EAAE,OAAO,GAAG,CAAC;EACtE,UAAU,WAAmB,OAAO,SAAS,WAAW,EAAE,OAAO,GAAG,CAAC;EACrE,SAAS,eAA6C,CAAC,WAAW;EACnE;CACD;EACE,OAAO;EACP,MAAM;EACN,WAAW,WAAmB,OAAO,SAAS,cAAc;EAC5D,UAAU,WAAmB,OAAO,SAAS,mBAAmB;EAChE,SAAS,eAA6C,CAAC,WAAW;EACnE;CACD;EACE,OAAO;EACP,MAAM;EACN,WAAW,WAAmB,OAAO,SAAS,aAAa;EAC3D,UAAU,WAAmB,OAAO,SAAS,kBAAkB;EAC/D,SAAS,eAA6C,CAAC,WAAW;EACnE;CACF;AAED,SAAgB,gBAAgB;CAC9B,MAAM,EAAE,QAAQ,eAAe,WAAW,cAAc;CAExD,MAAM,gBAAgB,OAAO,MAAM,UAAU,MAAM,SAAS,OAAO,CAAC;CACpE,MAAM,OAAO,eAAe;CAE5B,MAAM,iBAAiB,OAAO,QAAQ,UAAU,CAAC,MAAM,OAAO,WAAW,CAAC;AAE1E,KAAI,eAAe,WAAW,EAAG,QAAO;AAExC,QACE,4CACE,qBAAC,2BACC,oBAAC;EAAoB;YACnB,qBAAC;GAAO,SAAQ;GAAU,MAAK;GAAK,WAAU;cAC5C,qBAAC;IAAK,WAAU;eACb,QAAQ,oBAAC,QAAK,WAAU,aAAa,EACrC,eAAe,SAAS;KACpB,EAEP,oBAAC,eAAY,WAAU,aAAa;IAC7B;GACW,EAEtB,oBAAC,iCACE,eAAe,KAAK,EAAE,OAAO,MAAMA,QAAM,WAAW,UACnD,qBAAC;EAEC,eAAe,QAAQ,OAAO;EAC9B,WAAU;aAETA,UAAQ,oBAACA,UAAK,WAAU,aAAa,EACrC;IALI,MAMY,CACnB,GACkB,IACT,EAEf,oBAAC;EAAU,aAAY;EAAW,WAAU;GAAQ,IACnD"}
@@ -1,7 +0,0 @@
1
- import * as react_jsx_runtime222 from "react/jsx-runtime";
2
-
3
- //#region src/components/editor/components/menu-fixed.client.d.ts
4
- declare function EditorMenuFixed(): react_jsx_runtime222.JSX.Element;
5
- //#endregion
6
- export { EditorMenuFixed };
7
- //# sourceMappingURL=menu-fixed.client.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"menu-fixed.client.d.mts","names":[],"sources":["../../../../src/components/editor/components/menu-fixed.client.tsx"],"sourcesContent":[],"mappings":";;;iBAmBgB,eAAA,CAAA,GAAe,oBAAA,CAAA,GAAA,CAAA"}
@@ -1,128 +0,0 @@
1
- import { Button } from "../../ui/button.mjs";
2
- import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.mjs";
3
- import { Separator } from "../../ui/separator.mjs";
4
- import { EditorContext } from "./editor.client.mjs";
5
- import { ColorPicker } from "../../ui/color-picker.client.mjs";
6
- import { BlockDropdown } from "./block-dropdown.mjs";
7
- import { BaselineIcon, BoldIcon, EraserIcon, ItalicIcon, PaintBucketIcon, RedoIcon, StrikethroughIcon, UnderlineIcon, UndoIcon } from "lucide-react";
8
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
- import { useContext } from "react";
10
-
11
- //#region src/components/editor/components/menu-fixed.client.tsx
12
- function EditorMenuFixed() {
13
- const { editor, extensions } = useContext(EditorContext);
14
- return /* @__PURE__ */ jsxs("div", {
15
- className: "border-input bg-muted/30 z-10 flex items-center gap-3 overflow-auto border-b p-2",
16
- children: [
17
- extensions.undoRedo && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
18
- className: "flex items-center gap-1",
19
- children: [/* @__PURE__ */ jsx(Button, {
20
- onClick: () => editor.commands.undo(),
21
- disabled: !editor?.can().undo(),
22
- type: "button",
23
- "aria-label": "Undo",
24
- size: "icon",
25
- className: "p-2",
26
- variant: "outline",
27
- children: /* @__PURE__ */ jsx(UndoIcon, { className: "size-3.5" })
28
- }), /* @__PURE__ */ jsx(Button, {
29
- onClick: () => editor.commands.redo(),
30
- disabled: !editor?.can().redo(),
31
- type: "button",
32
- "aria-label": "Redo",
33
- size: "icon",
34
- className: "p-2",
35
- variant: "outline",
36
- children: /* @__PURE__ */ jsx(RedoIcon, { className: "size-3.5" })
37
- })]
38
- }), /* @__PURE__ */ jsx(Separator, {
39
- orientation: "vertical",
40
- className: "h-8"
41
- })] }),
42
- /* @__PURE__ */ jsx(BlockDropdown, {}),
43
- extensions.bold || extensions.italic || extensions.underline || extensions.strike ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
44
- className: "flex items-center gap-1",
45
- children: [
46
- extensions.bold && /* @__PURE__ */ jsx(Button, {
47
- type: "button",
48
- size: "icon",
49
- variant: editor?.isActive("bold") ? "secondary" : "outline",
50
- onClick: () => editor.chain().focus().toggleBold().run(),
51
- className: "border",
52
- children: /* @__PURE__ */ jsx(BoldIcon, { className: "h-3.5 w-3.5" })
53
- }),
54
- extensions.italic && /* @__PURE__ */ jsx(Button, {
55
- type: "button",
56
- size: "icon",
57
- variant: editor?.isActive("italic") ? "secondary" : "outline",
58
- onClick: () => editor.chain().focus().toggleItalic().run(),
59
- className: "border",
60
- children: /* @__PURE__ */ jsx(ItalicIcon, { className: "size-3.5" })
61
- }),
62
- extensions.underline && /* @__PURE__ */ jsx(Button, {
63
- type: "button",
64
- size: "icon",
65
- variant: editor?.isActive("underline") ? "secondary" : "outline",
66
- onClick: () => editor.chain().focus().toggleUnderline().run(),
67
- className: "border",
68
- children: /* @__PURE__ */ jsx(UnderlineIcon, { className: "size-3.5" })
69
- }),
70
- extensions.strike && /* @__PURE__ */ jsx(Button, {
71
- type: "button",
72
- size: "icon",
73
- variant: editor?.isActive("strike") ? "secondary" : "outline",
74
- onClick: () => editor.chain().focus().toggleStrike().run(),
75
- className: "border",
76
- children: /* @__PURE__ */ jsx(StrikethroughIcon, { className: "size-3.5" })
77
- })
78
- ]
79
- }), /* @__PURE__ */ jsx(Separator, {
80
- orientation: "vertical",
81
- className: "h-8"
82
- })] }) : null,
83
- extensions.color || extensions.highlight ? /* @__PURE__ */ jsxs("div", {
84
- className: "flex items-center gap-1",
85
- children: [
86
- extensions.color && /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
87
- asChild: true,
88
- children: /* @__PURE__ */ jsx(Button, {
89
- size: "icon",
90
- variant: "outline",
91
- children: /* @__PURE__ */ jsx(BaselineIcon, { className: "size-3.5" })
92
- })
93
- }), /* @__PURE__ */ jsx(PopoverContent, {
94
- className: "w-fit p-0",
95
- children: /* @__PURE__ */ jsx(ColorPicker, { onValueChange: (color) => editor.chain().focus().setColor(color).run() })
96
- })] }),
97
- extensions.highlight && /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
98
- asChild: true,
99
- children: /* @__PURE__ */ jsx(Button, {
100
- size: "icon",
101
- variant: "outline",
102
- disabled: !editor?.can().setHighlight(),
103
- children: /* @__PURE__ */ jsx(PaintBucketIcon, { className: "size-3.5" })
104
- })
105
- }), /* @__PURE__ */ jsx(PopoverContent, {
106
- className: "w-fit p-0",
107
- children: /* @__PURE__ */ jsx(ColorPicker, { onValueChange: (color) => editor.chain().focus().setHighlight({ color }).run() })
108
- })] }),
109
- /* @__PURE__ */ jsx(Button, {
110
- type: "button",
111
- size: "icon",
112
- variant: "outline",
113
- className: "border",
114
- onClick: () => {
115
- editor.commands.unsetColor();
116
- editor.commands.unsetHighlight();
117
- },
118
- children: /* @__PURE__ */ jsx(EraserIcon, { className: "h-4 w-4" })
119
- })
120
- ]
121
- }) : null
122
- ]
123
- });
124
- }
125
-
126
- //#endregion
127
- export { EditorMenuFixed };
128
- //# sourceMappingURL=menu-fixed.client.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"menu-fixed.client.mjs","names":[],"sources":["../../../../src/components/editor/components/menu-fixed.client.tsx"],"sourcesContent":["import { Button } from \"@/components/ui/button\";\nimport { ColorPicker } from \"@/components/ui/color-picker.client\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/ui/popover\";\nimport { Separator } from \"@/components/ui/separator\";\nimport {\n BaselineIcon,\n BoldIcon,\n EraserIcon,\n ItalicIcon,\n PaintBucketIcon,\n RedoIcon,\n StrikethroughIcon,\n UnderlineIcon,\n UndoIcon,\n} from \"lucide-react\";\nimport { useContext } from \"react\";\nimport { BlockDropdown } from \"./block-dropdown\";\nimport { EditorContext } from \"./editor.client\";\n\nexport function EditorMenuFixed() {\n const { editor, extensions } = useContext(EditorContext);\n\n return (\n <div className=\"border-input bg-muted/30 z-10 flex items-center gap-3 overflow-auto border-b p-2\">\n {extensions.undoRedo && (\n <>\n <div className=\"flex items-center gap-1\">\n <Button\n onClick={() => editor.commands.undo()}\n disabled={!editor?.can().undo()}\n type=\"button\"\n aria-label=\"Undo\"\n size=\"icon\"\n className=\"p-2\"\n variant=\"outline\"\n >\n <UndoIcon className=\"size-3.5\" />\n </Button>\n\n <Button\n onClick={() => editor.commands.redo()}\n disabled={!editor?.can().redo()}\n type=\"button\"\n aria-label=\"Redo\"\n size=\"icon\"\n className=\"p-2\"\n variant=\"outline\"\n >\n <RedoIcon className=\"size-3.5\" />\n </Button>\n </div>\n\n <Separator orientation=\"vertical\" className=\"h-8\" />\n </>\n )}\n\n <BlockDropdown />\n\n {extensions.bold || extensions.italic || extensions.underline || extensions.strike ? (\n <>\n <div className=\"flex items-center gap-1\">\n {extensions.bold && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"bold\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleBold().run()}\n className=\"border\"\n >\n <BoldIcon className=\"h-3.5 w-3.5\" />\n </Button>\n )}\n\n {extensions.italic && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"italic\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleItalic().run()}\n className=\"border\"\n >\n <ItalicIcon className=\"size-3.5\" />\n </Button>\n )}\n\n {extensions.underline && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"underline\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleUnderline().run()}\n className=\"border\"\n >\n <UnderlineIcon className=\"size-3.5\" />\n </Button>\n )}\n\n {extensions.strike && (\n <Button\n type=\"button\"\n size=\"icon\"\n variant={editor?.isActive(\"strike\") ? \"secondary\" : \"outline\"}\n onClick={() => editor.chain().focus().toggleStrike().run()}\n className=\"border\"\n >\n <StrikethroughIcon className=\"size-3.5\" />\n </Button>\n )}\n </div>\n\n <Separator orientation=\"vertical\" className=\"h-8\" />\n </>\n ) : null}\n\n {extensions.color || extensions.highlight ? (\n <div className=\"flex items-center gap-1\">\n {extensions.color && (\n <Popover>\n <PopoverTrigger asChild>\n <Button size=\"icon\" variant=\"outline\">\n <BaselineIcon className=\"size-3.5\" />\n </Button>\n </PopoverTrigger>\n\n <PopoverContent className=\"w-fit p-0\">\n <ColorPicker\n onValueChange={(color) => editor.chain().focus().setColor(color).run()}\n />\n </PopoverContent>\n </Popover>\n )}\n\n {extensions.highlight && (\n <Popover>\n <PopoverTrigger asChild>\n <Button size=\"icon\" variant=\"outline\" disabled={!editor?.can().setHighlight()}>\n <PaintBucketIcon className=\"size-3.5\" />\n </Button>\n </PopoverTrigger>\n\n <PopoverContent className=\"w-fit p-0\">\n <ColorPicker\n onValueChange={(color) => editor.chain().focus().setHighlight({ color }).run()}\n />\n </PopoverContent>\n </Popover>\n )}\n\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"outline\"\n className=\"border\"\n onClick={() => {\n editor.commands.unsetColor();\n editor.commands.unsetHighlight();\n }}\n >\n <EraserIcon className=\"h-4 w-4\" />\n </Button>\n </div>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAmBA,SAAgB,kBAAkB;CAChC,MAAM,EAAE,QAAQ,eAAe,WAAW,cAAc;AAExD,QACE,qBAAC;EAAI,WAAU;;GACZ,WAAW,YACV,4CACE,qBAAC;IAAI,WAAU;eACb,oBAAC;KACC,eAAe,OAAO,SAAS,MAAM;KACrC,UAAU,CAAC,QAAQ,KAAK,CAAC,MAAM;KAC/B,MAAK;KACL,cAAW;KACX,MAAK;KACL,WAAU;KACV,SAAQ;eAER,oBAAC,YAAS,WAAU,aAAa;MAC1B,EAET,oBAAC;KACC,eAAe,OAAO,SAAS,MAAM;KACrC,UAAU,CAAC,QAAQ,KAAK,CAAC,MAAM;KAC/B,MAAK;KACL,cAAW;KACX,MAAK;KACL,WAAU;KACV,SAAQ;eAER,oBAAC,YAAS,WAAU,aAAa;MAC1B;KACL,EAEN,oBAAC;IAAU,aAAY;IAAW,WAAU;KAAQ,IACnD;GAGL,oBAAC,kBAAgB;GAEhB,WAAW,QAAQ,WAAW,UAAU,WAAW,aAAa,WAAW,SAC1E,4CACE,qBAAC;IAAI,WAAU;;KACZ,WAAW,QACV,oBAAC;MACC,MAAK;MACL,MAAK;MACL,SAAS,QAAQ,SAAS,OAAO,GAAG,cAAc;MAClD,eAAe,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK;MACxD,WAAU;gBAEV,oBAAC,YAAS,WAAU,gBAAgB;OAC7B;KAGV,WAAW,UACV,oBAAC;MACC,MAAK;MACL,MAAK;MACL,SAAS,QAAQ,SAAS,SAAS,GAAG,cAAc;MACpD,eAAe,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK;MAC1D,WAAU;gBAEV,oBAAC,cAAW,WAAU,aAAa;OAC5B;KAGV,WAAW,aACV,oBAAC;MACC,MAAK;MACL,MAAK;MACL,SAAS,QAAQ,SAAS,YAAY,GAAG,cAAc;MACvD,eAAe,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK;MAC7D,WAAU;gBAEV,oBAAC,iBAAc,WAAU,aAAa;OAC/B;KAGV,WAAW,UACV,oBAAC;MACC,MAAK;MACL,MAAK;MACL,SAAS,QAAQ,SAAS,SAAS,GAAG,cAAc;MACpD,eAAe,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK;MAC1D,WAAU;gBAEV,oBAAC,qBAAkB,WAAU,aAAa;OACnC;;KAEP,EAEN,oBAAC;IAAU,aAAY;IAAW,WAAU;KAAQ,IACnD,GACD;GAEH,WAAW,SAAS,WAAW,YAC9B,qBAAC;IAAI,WAAU;;KACZ,WAAW,SACV,qBAAC,sBACC,oBAAC;MAAe;gBACd,oBAAC;OAAO,MAAK;OAAO,SAAQ;iBAC1B,oBAAC,gBAAa,WAAU,aAAa;QAC9B;OACM,EAEjB,oBAAC;MAAe,WAAU;gBACxB,oBAAC,eACC,gBAAgB,UAAU,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,MAAM,CAAC,KAAK,GACtE;OACa,IACT;KAGX,WAAW,aACV,qBAAC,sBACC,oBAAC;MAAe;gBACd,oBAAC;OAAO,MAAK;OAAO,SAAQ;OAAU,UAAU,CAAC,QAAQ,KAAK,CAAC,cAAc;iBAC3E,oBAAC,mBAAgB,WAAU,aAAa;QACjC;OACM,EAEjB,oBAAC;MAAe,WAAU;gBACxB,oBAAC,eACC,gBAAgB,UAAU,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,KAAK,GAC9E;OACa,IACT;KAGZ,oBAAC;MACC,MAAK;MACL,MAAK;MACL,SAAQ;MACR,WAAU;MACV,eAAe;AACb,cAAO,SAAS,YAAY;AAC5B,cAAO,SAAS,gBAAgB;;gBAGlC,oBAAC,cAAW,WAAU,YAAY;OAC3B;;KACL,GACJ;;GACA"}
@@ -1,165 +0,0 @@
1
- import { Button } from "@/components/ui/button";
2
- import { ColorPicker } from "@/components/ui/color-picker.client";
3
- import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
4
- import { Separator } from "@/components/ui/separator";
5
- import {
6
- BaselineIcon,
7
- BoldIcon,
8
- EraserIcon,
9
- ItalicIcon,
10
- PaintBucketIcon,
11
- RedoIcon,
12
- StrikethroughIcon,
13
- UnderlineIcon,
14
- UndoIcon,
15
- } from "lucide-react";
16
- import { useContext } from "react";
17
- import { BlockDropdown } from "./block-dropdown";
18
- import { EditorContext } from "./editor.client";
19
-
20
- export function EditorMenuFixed() {
21
- const { editor, extensions } = useContext(EditorContext);
22
-
23
- return (
24
- <div className="border-input bg-muted/30 z-10 flex items-center gap-3 overflow-auto border-b p-2">
25
- {extensions.undoRedo && (
26
- <>
27
- <div className="flex items-center gap-1">
28
- <Button
29
- onClick={() => editor.commands.undo()}
30
- disabled={!editor?.can().undo()}
31
- type="button"
32
- aria-label="Undo"
33
- size="icon"
34
- className="p-2"
35
- variant="outline"
36
- >
37
- <UndoIcon className="size-3.5" />
38
- </Button>
39
-
40
- <Button
41
- onClick={() => editor.commands.redo()}
42
- disabled={!editor?.can().redo()}
43
- type="button"
44
- aria-label="Redo"
45
- size="icon"
46
- className="p-2"
47
- variant="outline"
48
- >
49
- <RedoIcon className="size-3.5" />
50
- </Button>
51
- </div>
52
-
53
- <Separator orientation="vertical" className="h-8" />
54
- </>
55
- )}
56
-
57
- <BlockDropdown />
58
-
59
- {extensions.bold || extensions.italic || extensions.underline || extensions.strike ? (
60
- <>
61
- <div className="flex items-center gap-1">
62
- {extensions.bold && (
63
- <Button
64
- type="button"
65
- size="icon"
66
- variant={editor?.isActive("bold") ? "secondary" : "outline"}
67
- onClick={() => editor.chain().focus().toggleBold().run()}
68
- className="border"
69
- >
70
- <BoldIcon className="h-3.5 w-3.5" />
71
- </Button>
72
- )}
73
-
74
- {extensions.italic && (
75
- <Button
76
- type="button"
77
- size="icon"
78
- variant={editor?.isActive("italic") ? "secondary" : "outline"}
79
- onClick={() => editor.chain().focus().toggleItalic().run()}
80
- className="border"
81
- >
82
- <ItalicIcon className="size-3.5" />
83
- </Button>
84
- )}
85
-
86
- {extensions.underline && (
87
- <Button
88
- type="button"
89
- size="icon"
90
- variant={editor?.isActive("underline") ? "secondary" : "outline"}
91
- onClick={() => editor.chain().focus().toggleUnderline().run()}
92
- className="border"
93
- >
94
- <UnderlineIcon className="size-3.5" />
95
- </Button>
96
- )}
97
-
98
- {extensions.strike && (
99
- <Button
100
- type="button"
101
- size="icon"
102
- variant={editor?.isActive("strike") ? "secondary" : "outline"}
103
- onClick={() => editor.chain().focus().toggleStrike().run()}
104
- className="border"
105
- >
106
- <StrikethroughIcon className="size-3.5" />
107
- </Button>
108
- )}
109
- </div>
110
-
111
- <Separator orientation="vertical" className="h-8" />
112
- </>
113
- ) : null}
114
-
115
- {extensions.color || extensions.highlight ? (
116
- <div className="flex items-center gap-1">
117
- {extensions.color && (
118
- <Popover>
119
- <PopoverTrigger asChild>
120
- <Button size="icon" variant="outline">
121
- <BaselineIcon className="size-3.5" />
122
- </Button>
123
- </PopoverTrigger>
124
-
125
- <PopoverContent className="w-fit p-0">
126
- <ColorPicker
127
- onValueChange={(color) => editor.chain().focus().setColor(color).run()}
128
- />
129
- </PopoverContent>
130
- </Popover>
131
- )}
132
-
133
- {extensions.highlight && (
134
- <Popover>
135
- <PopoverTrigger asChild>
136
- <Button size="icon" variant="outline" disabled={!editor?.can().setHighlight()}>
137
- <PaintBucketIcon className="size-3.5" />
138
- </Button>
139
- </PopoverTrigger>
140
-
141
- <PopoverContent className="w-fit p-0">
142
- <ColorPicker
143
- onValueChange={(color) => editor.chain().focus().setHighlight({ color }).run()}
144
- />
145
- </PopoverContent>
146
- </Popover>
147
- )}
148
-
149
- <Button
150
- type="button"
151
- size="icon"
152
- variant="outline"
153
- className="border"
154
- onClick={() => {
155
- editor.commands.unsetColor();
156
- editor.commands.unsetHighlight();
157
- }}
158
- >
159
- <EraserIcon className="h-4 w-4" />
160
- </Button>
161
- </div>
162
- ) : null}
163
- </div>
164
- );
165
- }