Plate Utils

API reference for @udecode/plate-utils.

@udecode/plate-utils contains utility functions for Plate.

Hooks

useEditorString

Returnsstring

    The concatenated text content of all text nodes in the editor.

useMarkToolbarButtonState

Generates the state for a mark toolbar button.

Parameters

Collapse all

    The type of the node to check for active marks.

    Type or types of the node to clear when the mark is applied.

Returnsobject

Collapse all

    Whether the nodeType mark is active in the current selection.

    The type of the node.

    The type or types to clear when toggling this mark.

useMarkToolbarButton

Generates the props for a mark toolbar button using the state created by useMarkToolbarButtonState.

Parameters

Collapse all

    The state for the mark toolbar button generated by useMarkToolbarButtonState.

Returnsobject

Collapse all

usePlaceholderState

Generates the state for a placeholder in an editor.

Parameters

Collapse all

    If true, hide the placeholder when the editor is not focused.

    • Default: true

    If defined, the placeholder shows only if the node matches the query.

    The element in which the placeholder is to be displayed.

Returnsobject

Collapse all

    Whether the placeholder should be displayed.

useRemoveNodeButton

Generates props for a button that removes a node from the editor when clicked.

Parameters

Collapse all

    The node element to be removed.

Returnsobject

Collapse all