@tulip-systems/core 0.5.0 → 0.5.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.
- package/dist/components/client.d.mts +2 -2
- package/dist/components/client.mjs +2 -2
- package/dist/components/common/icons.d.mts +52 -52
- package/dist/components/common/icons.d.mts.map +1 -1
- package/dist/components/common/status.d.mts +3 -3
- package/dist/components/common/status.d.mts.map +1 -1
- package/dist/components/editor/components/content.client.d.mts +2 -2
- package/dist/components/editor/components/editor.client.d.mts +5 -5
- package/dist/components/editor/components/editor.client.d.mts.map +1 -1
- package/dist/components/editor/components/{block-dropdown.mjs → menu-nodes.client.mjs} +7 -11
- package/dist/components/editor/components/menu-nodes.client.mjs.map +1 -0
- package/dist/components/editor/components/menu.client.d.mts +10 -0
- package/dist/components/editor/components/menu.client.d.mts.map +1 -0
- package/dist/components/editor/components/menu.client.mjs +166 -0
- package/dist/components/editor/components/menu.client.mjs.map +1 -0
- package/dist/components/editor/lib/extensions.d.mts +3 -0
- package/dist/components/editor/lib/extensions.d.mts.map +1 -1
- package/dist/components/editor/lib/extensions.mjs.map +1 -1
- package/dist/components/header/back-button.client.d.mts +2 -2
- package/dist/components/header/bottom-bar.client.d.mts +3 -3
- package/dist/components/header/breadcrumbs.client.d.mts +7 -7
- package/dist/components/header/header.client.d.mts +2 -2
- package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
- package/dist/components/header/top-bar.client.d.mts +4 -4
- package/dist/components/layouts/admin-content.client.d.mts +2 -2
- package/dist/components/layouts/admin-layout.d.mts +2 -2
- package/dist/components/layouts/admin-layout.d.mts.map +1 -1
- package/dist/components/layouts/admin-loading.d.mts +2 -2
- package/dist/components/layouts/admin-loading.d.mts.map +1 -1
- package/dist/components/layouts/empty-page.d.mts +4 -4
- package/dist/components/layouts/empty-page.d.mts.map +1 -1
- package/dist/components/layouts/list-layout.d.mts +2 -2
- package/dist/components/layouts/list-layout.d.mts.map +1 -1
- package/dist/components/layouts/not-found-page.d.mts +3 -3
- package/dist/components/layouts/not-found-page.d.mts.map +1 -1
- package/dist/components/layouts/providers.client.d.mts +2 -2
- package/dist/components/layouts/root-layout.server.d.mts +2 -2
- package/dist/components/layouts/root-layout.server.d.mts.map +1 -1
- package/dist/components/layouts/root-loading.d.mts +2 -2
- package/dist/components/layouts/root-loading.d.mts.map +1 -1
- package/dist/components/layouts/tab-layout.d.mts +2 -2
- package/dist/components/layouts/tab-layout.d.mts.map +1 -1
- package/dist/components/lists/data-list.d.mts +5 -5
- package/dist/components/lists/data-list.d.mts.map +1 -1
- package/dist/components/lists/data-stack.d.mts +8 -8
- package/dist/components/lists/data-stack.d.mts.map +1 -1
- package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
- package/dist/components/ui/accordion.d.mts +5 -5
- package/dist/components/ui/alert-dialog.d.mts +12 -12
- package/dist/components/ui/alert.d.mts +6 -6
- package/dist/components/ui/aspect-ratio.d.mts +2 -2
- package/dist/components/ui/avatar.client.d.mts +4 -4
- package/dist/components/ui/badge.d.mts +4 -4
- package/dist/components/ui/breadcrumb.d.mts +8 -8
- package/dist/components/ui/breadcrumb.d.mts.map +1 -1
- package/dist/components/ui/button.d.mts +5 -5
- package/dist/components/ui/button.d.mts.map +1 -1
- package/dist/components/ui/calendar.d.mts +3 -3
- package/dist/components/ui/calendar.d.mts.map +1 -1
- package/dist/components/ui/card.d.mts +7 -7
- package/dist/components/ui/card.d.mts.map +1 -1
- package/dist/components/ui/carousel.d.mts +6 -6
- package/dist/components/ui/carousel.d.mts.map +1 -1
- package/dist/components/ui/chart.client.d.mts +5 -5
- package/dist/components/ui/checkbox.d.mts +2 -2
- package/dist/components/ui/checkbox.d.mts.map +1 -1
- package/dist/components/ui/collapsible.client.d.mts +4 -4
- package/dist/components/ui/color-picker.client.d.mts +2 -2
- package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
- package/dist/components/ui/combobox.client.d.mts +2 -2
- package/dist/components/ui/command.d.mts +10 -10
- package/dist/components/ui/command.d.mts.map +1 -1
- package/dist/components/ui/context-menu.d.mts +16 -16
- package/dist/components/ui/date-picker.client.d.mts +2 -2
- package/dist/components/ui/dialog.client.d.mts +11 -11
- package/dist/components/ui/drawer.client.d.mts +11 -11
- package/dist/components/ui/dropdown-menu.d.mts +16 -16
- package/dist/components/ui/form.client.d.mts +7 -7
- package/dist/components/ui/hover-card.client.d.mts +4 -4
- package/dist/components/ui/input-recipient.d.mts +2 -2
- package/dist/components/ui/input.d.mts +2 -2
- package/dist/components/ui/label.d.mts +2 -2
- package/dist/components/ui/navigation-menu.d.mts +11 -11
- package/dist/components/ui/pagination.d.mts +8 -8
- package/dist/components/ui/popover.d.mts +5 -5
- package/dist/components/ui/progress.client.d.mts +2 -2
- package/dist/components/ui/radio-group.d.mts +3 -3
- package/dist/components/ui/resizable.client.d.mts +4 -4
- package/dist/components/ui/scroll-area.d.mts +3 -3
- package/dist/components/ui/select.client.d.mts +11 -11
- package/dist/components/ui/separator.d.mts +2 -2
- package/dist/components/ui/sheet.client.d.mts +9 -9
- package/dist/components/ui/sidebar.client.d.mts +24 -24
- package/dist/components/ui/skeleton.d.mts +2 -2
- package/dist/components/ui/slider.d.mts +2 -2
- package/dist/components/ui/sonner.client.d.mts +2 -2
- package/dist/components/ui/switch.d.mts +2 -2
- package/dist/components/ui/tabs.d.mts +5 -5
- package/dist/components/ui/textarea.d.mts +2 -2
- package/dist/components/ui/time-input.client.d.mts +2 -2
- package/dist/components/ui/toggle-group.client.d.mts +3 -3
- package/dist/components/ui/toggle.d.mts +2 -2
- package/dist/components/ui/tooltip.client.d.mts +5 -5
- package/dist/lib/hooks/use-action.d.mts +2 -2
- package/dist/lib/hooks/use-indicator.d.mts +2 -2
- package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
- package/dist/modules/auth/components/allowed.client.d.mts +2 -2
- package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
- package/dist/modules/auth/components/auth-layout.server.d.mts.map +1 -1
- package/dist/modules/auth/components/auth-loading.d.mts +2 -2
- package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
- package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
- package/dist/modules/auth/components/guard-first-user.server.d.mts.map +1 -1
- package/dist/modules/auth/components/guard.server.d.mts +2 -2
- package/dist/modules/auth/components/guard.server.d.mts.map +1 -1
- package/dist/modules/auth/components/login-page.client.d.mts +2 -2
- package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/update-password-command.d.mts +2 -2
- package/dist/modules/auth/db/schema.d.mts +73 -73
- package/dist/modules/auth/handler/client.client.d.mts +2 -2
- package/dist/modules/auth/hooks/use-permission.d.mts +2 -2
- package/dist/modules/auth/lib/validators.d.mts +2 -2
- package/dist/modules/auth/lib/validators.d.mts.map +1 -1
- package/dist/modules/commands/components/alert-dialog-command.client.d.mts +10 -10
- package/dist/modules/commands/components/alert-dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/click-command.client.d.mts +2 -2
- package/dist/modules/commands/components/click-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/command-trigger.client.d.mts +6 -6
- package/dist/modules/commands/components/command-trigger.client.d.mts.map +1 -1
- package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
- package/dist/modules/commands/components/dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
- package/dist/modules/commands/components/dropdown-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
- package/dist/modules/commands/components/empty-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -11
- package/dist/modules/commands/components/form-dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/hooks/use-command-mutation.client.d.mts +2 -2
- package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
- package/dist/modules/commands/menus/context-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/dropdown-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/inline-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/responsive-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
- package/dist/modules/commands/utils/archive-command.client.d.mts.map +1 -1
- package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
- package/dist/modules/commands/utils/delete-command.client.d.mts.map +1 -1
- package/dist/modules/config/db/helpers.d.mts +5 -5
- package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
- package/dist/modules/data-tables/components/cell/common.client.d.mts.map +1 -1
- package/dist/modules/data-tables/components/column-header.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/combobox.client.d.mts.map +1 -1
- package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/slider.client.d.mts.map +1 -1
- package/dist/modules/data-tables/components/header.d.mts +4 -4
- package/dist/modules/data-tables/components/layout.d.mts +2 -2
- package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
- package/dist/modules/data-tables/components/search-input.client.d.mts.map +1 -1
- package/dist/modules/data-tables/components/skeleton.d.mts +2 -2
- package/dist/modules/data-tables/components/table.d.mts +7 -7
- package/dist/modules/data-tables/components/toolbar.d.mts +3 -3
- package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
- package/dist/modules/data-tables/hooks/use-context.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/data-table/components/table.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts +3 -3
- package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/combobox.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/combobox.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/date-input.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/date-input.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/date-picker.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/date-picker.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/editor.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/editor.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input-recipient.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/input-recipient.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input-toggle.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/input-toggle.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input.client.d.mts +4 -4
- package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/select.client.d.mts +6 -6
- package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/switch.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/switch.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/toggle.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/toggle.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/hooks/context.client.d.mts +2 -2
- package/dist/modules/inline-edit/hooks/context.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/lib/variants.d.mts +1 -1
- package/dist/modules/router/lib/query-client.server.d.mts +2 -2
- package/dist/modules/router/lib/query-client.server.d.mts.map +1 -1
- package/dist/modules/storage/components/dropzone.client.d.mts +5 -5
- package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
- package/dist/modules/storage/components/image-grid.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts +2 -2
- package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
- package/dist/modules/storage/lib/router.server.d.mts +1768 -1768
- package/dist/modules/storage/lib/router.server.d.mts.map +1 -1
- package/dist/modules/storage/lib/router.server.mjs +1 -0
- package/dist/modules/storage/lib/router.server.mjs.map +1 -1
- package/dist/modules/storage/lib/schema.d.mts +88 -88
- package/dist/modules/storage/lib/service.server.d.mts +21 -21
- package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
- package/dist/modules/storage/lib/service.server.mjs +6 -5
- package/dist/modules/storage/lib/service.server.mjs.map +1 -1
- package/dist/modules/storage/lib/validators.d.mts +78 -78
- package/dist/modules/storage/lib/validators.d.mts.map +1 -1
- package/package.json +1 -1
- package/src/components/editor/components/{block-dropdown.tsx → menu-nodes.client.tsx} +24 -29
- package/src/components/editor/components/menu.client.tsx +214 -0
- package/src/components/editor/lib/extensions.ts +3 -3
- package/src/components/entry.client.ts +1 -1
- package/src/modules/storage/lib/router.server.ts +6 -0
- package/src/modules/storage/lib/service.server.ts +15 -2
- package/dist/components/editor/components/block-dropdown.mjs.map +0 -1
- package/dist/components/editor/components/menu-fixed.client.d.mts +0 -7
- package/dist/components/editor/components/menu-fixed.client.d.mts.map +0 -1
- package/dist/components/editor/components/menu-fixed.client.mjs +0 -128
- package/dist/components/editor/components/menu-fixed.client.mjs.map +0 -1
- package/src/components/editor/components/menu-fixed.client.tsx +0 -165
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
DropdownMenuItem,
|
|
6
6
|
DropdownMenuTrigger,
|
|
7
7
|
} from "@/components/ui/dropdown-menu";
|
|
8
|
-
import { Separator } from "@/components/ui/separator";
|
|
9
8
|
import { Editor } from "@tiptap/react";
|
|
10
9
|
import {
|
|
11
10
|
ChevronDown,
|
|
@@ -81,7 +80,7 @@ const blocks = [
|
|
|
81
80
|
},
|
|
82
81
|
];
|
|
83
82
|
|
|
84
|
-
export function
|
|
83
|
+
export function EditorMenuNodes() {
|
|
85
84
|
const { editor, extensions } = useContext(EditorContext);
|
|
86
85
|
|
|
87
86
|
const selectedBlock = blocks.find((block) => block.selected(editor));
|
|
@@ -92,34 +91,30 @@ export function BlockDropdown() {
|
|
|
92
91
|
if (filteredBlocks.length === 0) return null;
|
|
93
92
|
|
|
94
93
|
return (
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
<
|
|
98
|
-
<
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
</span>
|
|
94
|
+
<DropdownMenu>
|
|
95
|
+
<DropdownMenuTrigger asChild>
|
|
96
|
+
<Button variant="outline" size="sm" className="flex items-center gap-8 p-2">
|
|
97
|
+
<span className="flex items-center gap-2">
|
|
98
|
+
{Icon && <Icon className="size-3.5" />}
|
|
99
|
+
{selectedBlock?.label ?? "Select a block"}
|
|
100
|
+
</span>
|
|
103
101
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
<ChevronDown className="size-3.5" />
|
|
103
|
+
</Button>
|
|
104
|
+
</DropdownMenuTrigger>
|
|
107
105
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
<Separator orientation="vertical" className="h-8" />
|
|
123
|
-
</>
|
|
106
|
+
<DropdownMenuContent>
|
|
107
|
+
{filteredBlocks.map(({ label, icon: Icon, handler }, index) => (
|
|
108
|
+
<DropdownMenuItem
|
|
109
|
+
key={index}
|
|
110
|
+
onClick={() => handler(editor)}
|
|
111
|
+
className="flex items-center gap-2"
|
|
112
|
+
>
|
|
113
|
+
{Icon && <Icon className="size-3.5" />}
|
|
114
|
+
{label}
|
|
115
|
+
</DropdownMenuItem>
|
|
116
|
+
))}
|
|
117
|
+
</DropdownMenuContent>
|
|
118
|
+
</DropdownMenu>
|
|
124
119
|
);
|
|
125
120
|
}
|
|
@@ -0,0 +1,214 @@
|
|
|
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 { cn } from "@/lib/entry";
|
|
5
|
+
import { BubbleMenu } from "@tiptap/react/menus";
|
|
6
|
+
import {
|
|
7
|
+
BaselineIcon,
|
|
8
|
+
BoldIcon,
|
|
9
|
+
EraserIcon,
|
|
10
|
+
ItalicIcon,
|
|
11
|
+
PaintBucketIcon,
|
|
12
|
+
RedoIcon,
|
|
13
|
+
StrikethroughIcon,
|
|
14
|
+
UnderlineIcon,
|
|
15
|
+
UndoIcon,
|
|
16
|
+
} from "lucide-react";
|
|
17
|
+
import { ComponentProps, PropsWithChildren, useContext } from "react";
|
|
18
|
+
import { EditorContext } from "./editor.client";
|
|
19
|
+
import { EditorMenuNodes } from "./menu-nodes.client";
|
|
20
|
+
|
|
21
|
+
export function EditorMenuFixed(props: React.ComponentProps<"div">) {
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
{...props}
|
|
25
|
+
className={cn("border-input bg-muted/30 z-10 overflow-auto border-b p-2", props.className)}
|
|
26
|
+
>
|
|
27
|
+
<EditorMenuContent>
|
|
28
|
+
<EditorMenuUndoRedo />
|
|
29
|
+
<EditorMenuNodes />
|
|
30
|
+
<EditorMenuMarks />
|
|
31
|
+
<EditorMenuColor />
|
|
32
|
+
</EditorMenuContent>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function EditorMenuBubble(props: ComponentProps<typeof BubbleMenu>) {
|
|
38
|
+
const { editor } = useContext(EditorContext);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<BubbleMenu
|
|
42
|
+
{...props}
|
|
43
|
+
editor={editor}
|
|
44
|
+
options={{ ...props.options, strategy: "fixed" }}
|
|
45
|
+
className={cn("border-input bg-muted z-10 rounded-lg border p-2", props.className)}
|
|
46
|
+
>
|
|
47
|
+
<EditorMenuContent>
|
|
48
|
+
<EditorMenuMarks />
|
|
49
|
+
</EditorMenuContent>
|
|
50
|
+
</BubbleMenu>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function EditorMenuContent(props: PropsWithChildren) {
|
|
55
|
+
return <div className="flex items-center gap-6">{props.children}</div>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Editor menu undo/redo
|
|
60
|
+
*/
|
|
61
|
+
function EditorMenuUndoRedo() {
|
|
62
|
+
const { editor, extensions } = useContext(EditorContext);
|
|
63
|
+
|
|
64
|
+
if (!extensions.undoRedo) return null;
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div className="flex items-center gap-1">
|
|
68
|
+
<Button
|
|
69
|
+
onClick={() => editor.commands.undo()}
|
|
70
|
+
disabled={!editor?.can().undo()}
|
|
71
|
+
type="button"
|
|
72
|
+
aria-label="Undo"
|
|
73
|
+
size="icon"
|
|
74
|
+
className="p-2"
|
|
75
|
+
variant="outline"
|
|
76
|
+
>
|
|
77
|
+
<UndoIcon className="size-3.5" />
|
|
78
|
+
</Button>
|
|
79
|
+
|
|
80
|
+
<Button
|
|
81
|
+
onClick={() => editor.commands.redo()}
|
|
82
|
+
disabled={!editor?.can().redo()}
|
|
83
|
+
type="button"
|
|
84
|
+
aria-label="Redo"
|
|
85
|
+
size="icon"
|
|
86
|
+
className="p-2"
|
|
87
|
+
variant="outline"
|
|
88
|
+
>
|
|
89
|
+
<RedoIcon className="size-3.5" />
|
|
90
|
+
</Button>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Editor menu marks
|
|
97
|
+
*/
|
|
98
|
+
function EditorMenuMarks() {
|
|
99
|
+
const { editor, extensions } = useContext(EditorContext);
|
|
100
|
+
|
|
101
|
+
if (!extensions.bold && !extensions.italic && !extensions.underline && !extensions.strike) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div className="flex items-center gap-1">
|
|
107
|
+
{extensions.bold && (
|
|
108
|
+
<Button
|
|
109
|
+
type="button"
|
|
110
|
+
size="icon"
|
|
111
|
+
variant={editor?.isActive("bold") ? "secondary" : "outline"}
|
|
112
|
+
onClick={() => editor.chain().focus().toggleBold().run()}
|
|
113
|
+
className="border"
|
|
114
|
+
>
|
|
115
|
+
<BoldIcon className="h-3.5 w-3.5" />
|
|
116
|
+
</Button>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{extensions.italic && (
|
|
120
|
+
<Button
|
|
121
|
+
type="button"
|
|
122
|
+
size="icon"
|
|
123
|
+
variant={editor?.isActive("italic") ? "secondary" : "outline"}
|
|
124
|
+
onClick={() => editor.chain().focus().toggleItalic().run()}
|
|
125
|
+
className="border"
|
|
126
|
+
>
|
|
127
|
+
<ItalicIcon className="size-3.5" />
|
|
128
|
+
</Button>
|
|
129
|
+
)}
|
|
130
|
+
|
|
131
|
+
{extensions.underline && (
|
|
132
|
+
<Button
|
|
133
|
+
type="button"
|
|
134
|
+
size="icon"
|
|
135
|
+
variant={editor?.isActive("underline") ? "secondary" : "outline"}
|
|
136
|
+
onClick={() => editor.chain().focus().toggleUnderline().run()}
|
|
137
|
+
className="border"
|
|
138
|
+
>
|
|
139
|
+
<UnderlineIcon className="size-3.5" />
|
|
140
|
+
</Button>
|
|
141
|
+
)}
|
|
142
|
+
|
|
143
|
+
{extensions.strike && (
|
|
144
|
+
<Button
|
|
145
|
+
type="button"
|
|
146
|
+
size="icon"
|
|
147
|
+
variant={editor?.isActive("strike") ? "secondary" : "outline"}
|
|
148
|
+
onClick={() => editor.chain().focus().toggleStrike().run()}
|
|
149
|
+
className="border"
|
|
150
|
+
>
|
|
151
|
+
<StrikethroughIcon className="size-3.5" />
|
|
152
|
+
</Button>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Editor menu alignment
|
|
160
|
+
*/
|
|
161
|
+
function EditorMenuColor() {
|
|
162
|
+
const { editor, extensions } = useContext(EditorContext);
|
|
163
|
+
|
|
164
|
+
if (!extensions.color && !extensions.highlight) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<div className="flex items-center gap-1">
|
|
170
|
+
{extensions.color && (
|
|
171
|
+
<Popover>
|
|
172
|
+
<PopoverTrigger asChild>
|
|
173
|
+
<Button size="icon" variant="outline">
|
|
174
|
+
<BaselineIcon className="size-3.5" />
|
|
175
|
+
</Button>
|
|
176
|
+
</PopoverTrigger>
|
|
177
|
+
|
|
178
|
+
<PopoverContent className="w-fit p-0">
|
|
179
|
+
<ColorPicker onValueChange={(color) => editor.chain().focus().setColor(color).run()} />
|
|
180
|
+
</PopoverContent>
|
|
181
|
+
</Popover>
|
|
182
|
+
)}
|
|
183
|
+
|
|
184
|
+
{extensions.highlight && (
|
|
185
|
+
<Popover>
|
|
186
|
+
<PopoverTrigger asChild>
|
|
187
|
+
<Button size="icon" variant="outline" disabled={!editor?.can().setHighlight()}>
|
|
188
|
+
<PaintBucketIcon className="size-3.5" />
|
|
189
|
+
</Button>
|
|
190
|
+
</PopoverTrigger>
|
|
191
|
+
|
|
192
|
+
<PopoverContent className="w-fit p-0">
|
|
193
|
+
<ColorPicker
|
|
194
|
+
onValueChange={(color) => editor.chain().focus().setHighlight({ color }).run()}
|
|
195
|
+
/>
|
|
196
|
+
</PopoverContent>
|
|
197
|
+
</Popover>
|
|
198
|
+
)}
|
|
199
|
+
|
|
200
|
+
<Button
|
|
201
|
+
type="button"
|
|
202
|
+
size="icon"
|
|
203
|
+
variant="outline"
|
|
204
|
+
className="border"
|
|
205
|
+
onClick={() => {
|
|
206
|
+
editor.commands.unsetColor();
|
|
207
|
+
editor.commands.unsetHighlight();
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
<EraserIcon className="h-4 w-4" />
|
|
211
|
+
</Button>
|
|
212
|
+
</div>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
@@ -48,9 +48,9 @@ export type EditorExtensionsConfig = {
|
|
|
48
48
|
paragraph: Partial<ParagraphOptions> | boolean;
|
|
49
49
|
text: Partial<TextStyleOptions> | boolean;
|
|
50
50
|
image: Partial<ImageOptions> | boolean;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Marks
|
|
53
|
+
*/
|
|
54
54
|
bold: Partial<BoldOptions> | boolean;
|
|
55
55
|
italic: Partial<ItalicOptions> | boolean;
|
|
56
56
|
link: Partial<LinkOptions> | boolean;
|
|
@@ -141,6 +141,12 @@ export function createDriveBaseProcedures() {
|
|
|
141
141
|
/**
|
|
142
142
|
* Validate
|
|
143
143
|
*/
|
|
144
|
+
if (node?.readonly) {
|
|
145
|
+
throw new ServerError("BAD_REQUEST", {
|
|
146
|
+
message: "Deze node is alleen leesbaar en kan niet worden gewijzigd",
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
144
150
|
if (input.parentId && !parent)
|
|
145
151
|
throw new ServerError("BAD_REQUEST", { message: "Parent not found" });
|
|
146
152
|
if (!node) throw new ServerError("BAD_REQUEST", { message: "Node not found" });
|
|
@@ -105,7 +105,6 @@ export class StorageService<TSchema extends TDatabaseSchema> {
|
|
|
105
105
|
ContentLength: input.size,
|
|
106
106
|
Metadata: {
|
|
107
107
|
nodeId: input.id,
|
|
108
|
-
filename: input.name,
|
|
109
108
|
},
|
|
110
109
|
});
|
|
111
110
|
}
|
|
@@ -411,6 +410,15 @@ export class StorageService<TSchema extends TDatabaseSchema> {
|
|
|
411
410
|
* Update a node
|
|
412
411
|
*/
|
|
413
412
|
async updateNode(input: { id: string; data: UpdateNodeSchema }) {
|
|
413
|
+
const [node] = await this.#db
|
|
414
|
+
.select({ readonly: nodes.readonly })
|
|
415
|
+
.from(nodes)
|
|
416
|
+
.where(eq(nodes.id, input.id));
|
|
417
|
+
|
|
418
|
+
if (node?.readonly) {
|
|
419
|
+
throw new ServerError("BAD_REQUEST", { message: "Node is readonly" });
|
|
420
|
+
}
|
|
421
|
+
|
|
414
422
|
const [result] = await this.#db
|
|
415
423
|
.update(nodes)
|
|
416
424
|
.set(input.data)
|
|
@@ -431,10 +439,15 @@ export class StorageService<TSchema extends TDatabaseSchema> {
|
|
|
431
439
|
*/
|
|
432
440
|
async deleteNodes(input: BulkActionSchema) {
|
|
433
441
|
const items = await this.#db
|
|
434
|
-
.select({ id: nodes.id, type: nodes.type })
|
|
442
|
+
.select({ id: nodes.id, type: nodes.type, readonly: nodes.readonly })
|
|
435
443
|
.from(nodes)
|
|
436
444
|
.where(inArray(nodes.id, input.ids));
|
|
437
445
|
|
|
446
|
+
// Check if the nodes are readonly
|
|
447
|
+
if (items.some((item) => item.readonly)) {
|
|
448
|
+
throw new ServerError("BAD_REQUEST", { message: "Nodes are readonly" });
|
|
449
|
+
}
|
|
450
|
+
|
|
438
451
|
// Split the nodes into folders and files
|
|
439
452
|
const folders = items.filter(isFolder).map((folder) => folder.id);
|
|
440
453
|
const files = items.filter(isFile).map((file) => file.id);
|
|
@@ -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,SA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ACE,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 <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