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