mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
27 lines
No EOL
583 B
TypeScript
27 lines
No EOL
583 B
TypeScript
'use client';
|
|
|
|
import { Slate } from "slate-react";
|
|
import { useCustomSlateEditor } from "./useCustomSlateEditor";
|
|
import { CustomElement } from "./types";
|
|
|
|
interface CustomSlateEditorProps {
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
const initialValue: CustomElement[] = [
|
|
{
|
|
type: 'paragraph',
|
|
children: [{ text: '' }],
|
|
},
|
|
];
|
|
|
|
export const CustomSlateEditor = ({ children }: CustomSlateEditorProps) => {
|
|
const editor = useCustomSlateEditor();
|
|
|
|
return <Slate
|
|
editor={editor}
|
|
initialValue={initialValue}
|
|
>
|
|
{children}
|
|
</Slate>;
|
|
} |