Slate React
This sub-library contains the React-specific logic for Slate.
React components for rendering Slate editors
RenderElementProps are passed to the renderElement handler.
RenderLeafProps are passed to the renderLeaf handler.
The main Slate editor.
By default, the Editable component comes with a set of event handlers that handle typical rich-text editing behaviors (for example, it implements its own onCopy, onPaste, onDrop, and onKeyDown handlers).
In some cases you may want to extend or override Slate's default behavior, which can be done by passing your own event handler(s) to the Editable component.
Your custom event handler can control whether or not Slate should execute its own event handling for a given event after your handler runs depending on the return value of your event handler as described below.
The default element renderer.
The default custom leaf renderer.
Slate(editor: ReactEditor, value: Node[], children: React.ReactNode, onChange: (value: Node[]) => void, [key: string]: any)
A wrapper around the provider to handle onChange events, because the editor is a mutable singleton so it won't ever register as "changed" otherwise.
React hooks for Slate editors
Get the current focused state of the editor.
Get the current readOnly state of the editor.
Get the current selected state of an element.
Get the current editor object from the React context. Re-renders the context whenever changes occur in the editor.
Get the current editor object from the React context. A version of useSlate that does not re-render the context. Previously called useEditor.
A React and DOM-specific version of the Editor interface. All about translating between the DOM and Slate.
Find a key for a Slate node.
Find the path of Slate node.
Check if the editor is focused.
Check if the editor is in read-only mode.
Blur the editor.
Focus the editor.
Deselect the editor.
Check if a DOM node is within the editor.
Insert data from a DataTransfer into the editor.
Sets data from the currently selected fragment on a DataTransfer.
Find the native DOM element from a Slate node.
Find a native DOM selection point from a Slate point.
Find a native DOM range from a Slate range.
Find a Slate node from a native DOM element.
Get the target range from a DOM event.
Find a Slate point from a DOM selection's domNode and domOffset.
Find a Slate range from a DOM range or selection.
React-specific plugins for Slate editors
Adds React and DOM specific behaviors to the editor.
Private convenience modules