UNPKG

mui-tiptap

Version:

A Material-UI (MUI) styled WYSIWYG rich text editor, using Tiptap

10 lines (9 loc) 405 B
import { createContext, useContext } from "react"; export const RichTextEditorContext = createContext(undefined); export function useRichTextEditorContext() { const editor = useContext(RichTextEditorContext); if (editor === undefined) { throw new Error("Tiptap editor not found in component context. Be sure to use <RichTextEditorProvider editor={editor} />!"); } return editor; }