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.
The default element renderer.
The default custom leaf renderer.
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