mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-05-24 02:09:17 +00:00
20 lines
464 B
JavaScript
20 lines
464 B
JavaScript
import React, { useState } from "react";
|
|
import { createEditor } from "slate";
|
|
import { Slate, Editable, withReact } from "slate-react";
|
|
|
|
const initialValue = [
|
|
{
|
|
type: "paragraph",
|
|
children: [{ text: "A line of text in a paragraph." }],
|
|
},
|
|
];
|
|
|
|
export default function RichEditor() {
|
|
const [editor] = useState(() => withReact(createEditor()));
|
|
return (
|
|
<Slate editor={editor} initialValue={initialValue}>
|
|
<Editable />
|
|
</Slate>
|
|
);
|
|
}
|