返回 presentation-ai
dnd-kit.tsx
根目录 / src / components / plate / plugins / dnd-kit.tsx
1 "use client";
2
3 import { DndPlugin } from "@platejs/dnd";
4 import { PlaceholderPlugin } from "@platejs/media/react";
5
6 import { PlateDndOverlay } from "@/components/plate/plugins/plate-dnd-overlay";
7 import { BlockDraggable } from "@/components/plate/ui/block-draggable";
8
9 export const DndKit = [
10 DndPlugin.configure({
11 options: {
12 onDropFiles: ({ dragItem, editor, target }) => {
13 editor
14 .getTransforms(PlaceholderPlugin)
15 .insert.media(dragItem.files, { at: target, nextBlock: false });
16 },
17 },
18 render: {
19 aboveEditable: ({ children }) => (
20 <PlateDndOverlay>{children}</PlateDndOverlay>
21 ),
22 aboveNodes: BlockDraggable,
23 },
24 }),
25 ];
26
26 lines Plain Text