import { createContext, useContext } from "react";
import { ReactEditor } from "../plugin/react-editor";
export const EditorContext = createContext<ReactEditor | null>(null);
export const useSlateStatic = () => {
const editor = useContext(EditorContext);
if (!editor) {
throw new Error(
`The \`useSlateStatic\` hook must be used inside the <Slate> component's context.`
);
}
return editor;
};