返回 presentation-ai
ai-chat-editor.tsx
根目录 / src / components / plate / ui / ai-chat-editor.tsx
1 "use client";
2
3 import * as React from "react";
4
5 import { useAIChatEditor } from "@platejs/ai/react";
6 import { usePlateEditor } from "platejs/react";
7
8 import { BaseEditorKit } from "@/components/plate/editor-base-kit";
9
10 import { EditorStatic } from "./editor-static";
11
12 export const AIChatEditor = React.memo(function AIChatEditor({
13 content,
14 }: {
15 content: string;
16 }) {
17 const aiEditor = usePlateEditor({
18 plugins: BaseEditorKit,
19 });
20
21 const value = useAIChatEditor(aiEditor, content);
22
23 return <EditorStatic variant="aiChat" editor={aiEditor} value={value} />;
24 });
25
25 lines Plain Text