| 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 { PlaceholderElement } from "@/components/plate/ui/media-placeholder-node"; |
| 18 | import { MediaUploadToast } from "@/components/plate/ui/media-upload-toast"; |
| 19 | import { VideoElement } from "@/components/plate/ui/media-video-node"; |
| 20 | import { PresentationImageElement } from "../custom-elements/presentation-image-element"; |
| 21 | |
| 22 | export const MediaKit = [ |
| 23 | ImagePlugin.configure({ |
| 24 | options: { disableUploadInsert: true }, |
| 25 | render: { |
| 26 | // afterEditable: MediaPreviewDialog, |
| 27 | node: PresentationImageElement, |
| 28 | }, |
| 29 | }), |
| 30 | MediaEmbedPlugin.withComponent(MediaEmbedElement), |
| 31 | VideoPlugin.withComponent(VideoElement), |
| 32 | AudioPlugin.withComponent(AudioElement), |
| 33 | FilePlugin.withComponent(FileElement), |
| 34 | PlaceholderPlugin.configure({ |
| 35 | options: { disableEmptyPlaceholder: true }, |
| 36 | render: { afterEditable: MediaUploadToast, node: PlaceholderElement }, |
| 37 | }), |
| 38 | CaptionPlugin.configure({ |
| 39 | options: { |
| 40 | query: { |
| 41 | allow: [KEYS.img, KEYS.video, KEYS.audio, KEYS.file, KEYS.mediaEmbed], |
| 42 | }, |
| 43 | }, |
| 44 | }), |
| 45 | ]; |
| 46 |