CoreProviders
TypixEditorProvider
Context provider that makes the TypixEditor instance available
TypixEditorProvider creates a TypixEditor instance from the Lexical editor and provides it via React context. This is set up automatically by EditorRoot.
Import
import { TypixEditorProvider } from '@typix-editor/react';Usage
You typically don't need to use this directly. EditorRoot includes it automatically.
If you're building a custom editor root without EditorRoot, wrap your components in TypixEditorProvider inside a LexicalComposer:
import { LexicalComposer } from '@lexical/react/LexicalComposer';
import { TypixEditorProvider } from '@typix-editor/react';
function CustomEditorRoot({ children, config }) {
return (
<LexicalComposer initialConfig={config}>
<TypixEditorProvider>
{children}
</TypixEditorProvider>
</LexicalComposer>
);
}Props
| Prop | Type | Description |
|---|---|---|
children | ReactNode | Components that need access to the TypixEditor |
Context value
| Property | Type | Description |
|---|---|---|
editor | TypixEditor | The TypixEditor instance |
Related
useTypixEditor— Hook to consume this contextEditorRoot— Sets up this provider automatically