Plate Utils
API reference for @udecode/plate-utils.
@udecode/plate-utils
contains utility functions for Plate.
Components
<PlateElement>
Generic component for rendering an element.
- Default:
'div'
The CSS class to apply to the component.
Additional props to pass to the component.
The editor instance. Also available using useEditorRef
hook.
The element node. Also available using useElement
hook.
The path of the element in the editor tree. Also available using usePath
hook.
Attributes of the element to be spread on the top-level element.
Necessary for rendering the node children.
Get HTML attributes from Slate element. An alternative to PlatePlugin.props
.
The component type to render as.
If true, merges its props onto its immediate child.
<PlateLeaf>
Generic component for rendering a leaf.
- Default:
'span'
The CSS class to apply to the component.
The editor context.
Additional props to pass to the component.
Necessary for rendering the node children.
The leaf node.
The text node.
Attributes of the leaf to be spread on the top-level element.
Get HTML attributes from Slate leaf. An alternative to PlatePlugin.props
.
The component type to render as.
If true, merges its props onto its immediate child.
Hooks
useEditorString
useMarkToolbarButtonState
Generates the state for a mark toolbar button.
useMarkToolbarButton
Generates the props for a mark toolbar button using the state created by useMarkToolbarButtonState
.
usePlaceholderState
Generates the state for a placeholder in an editor.
useRemoveNodeButton
Generates props for a button that removes a node from the editor when clicked.