| 1 | "use client"; |
| 2 | |
| 3 | import { CaptionPlugin } from "@platejs/caption/react"; |
| 4 | import { |
| 5 | AudioPlugin, |
| 6 | FilePlugin, |
| 7 | ImagePlugin, |
| 8 | MediaEmbedPlugin, |
| 9 | PlaceholderPlugin, |
| 10 | VideoPlugin, |
| 11 | } from "@platejs/media/react"; |
| 12 | import { KEYS } from "platejs"; |
| 13 | |
| 14 | import { AudioElement } from "@/components/plate/ui/media-audio-node"; |
| 15 | import { MediaEmbedElement } from "@/components/plate/ui/media-embed-node"; |
| 16 | import { FileElement } from "@/components/plate/ui/media-file-node"; |
| 17 | import { ImageElement } from "@/components/plate/ui/media-image-node"; |
| 18 | import { PlaceholderElement } from "@/components/plate/ui/media-placeholder-node"; |
| 19 | import { MediaPreviewDialog } from "@/components/plate/ui/media-preview-dialog"; |
| 20 | import { MediaUploadToast } from "@/components/plate/ui/media-upload-toast"; |
| 21 | import { VideoElement } from "@/components/plate/ui/media-video-node"; |
| 22 | |
| 23 | export const MediaKit = [ |
| 24 | ImagePlugin.configure({ |
| 25 | options: { disableUploadInsert: true }, |
| 26 | render: { afterEditable: MediaPreviewDialog, node: ImageElement }, |
| 27 | }), |
| 28 | MediaEmbedPlugin.withComponent(MediaEmbedElement), |
| 29 | VideoPlugin.withComponent(VideoElement), |
| 30 | AudioPlugin.withComponent(AudioElement), |
| 31 | FilePlugin.withComponent(FileElement), |
| 32 | PlaceholderPlugin.configure({ |
| 33 | options: { disableEmptyPlaceholder: true }, |
| 34 | render: { afterEditable: MediaUploadToast, node: PlaceholderElement }, |
| 35 | }), |
| 36 | CaptionPlugin.configure({ |
| 37 | options: { |
| 38 | query: { |
| 39 | allow: [KEYS.img, KEYS.video, KEYS.audio, KEYS.file, KEYS.mediaEmbed], |
| 40 | }, |
| 41 | }, |
| 42 | }), |
| 43 | ]; |
| 44 |