Text

API reference for text nodes in Slate.

Text objects represent the nodes that contain the actual text content of a Slate document along with any formatting properties. They are always leaf nodes in the document tree as they cannot contain any children.

Text

Find the corresponding documentation in the Slate docs.

decorations

Gets the leaves for a text node given decorations.

Parameters

Collapse all

    The text node to get leaves from.

    Array of decorated ranges to apply.

Returns

    Returns an array of text nodes with the decorations applied.

equals

Checks if two text nodes are equal.

Parameters

Collapse all

    First text node to compare.

    Second text node to compare.

Returns

    Returns true if the text nodes are equal, false otherwise.

isText

Checks if a value implements the Text interface.

Parameters

Collapse all

    The value to check.

Returns

    Returns true if the value is a text node, false otherwise.

isTextList

Checks if a value is a list of Text objects.

Parameters

Collapse all

    The value to check.

Returns

    Returns true if the value is an array of text nodes, false otherwise.

isTextProps

Checks if some props are a partial of Text.

Parameters

Collapse all

    The props to check.

Returns

    Returns true if the props match a partial text node structure, false otherwise.

matches

Checks if a text matches set of properties.

Note: this is for matching custom properties, and it does not ensure that the text property of two nodes are equal.

Parameters

Collapse all

    The text node to check.

    The properties to match against.

Returns

    Returns true if the text node matches the properties, false otherwise.

Types

TText

The base text node type that contains the actual text content and any formatting properties.

Attributes

Collapse all

    The text content of the node.

    Additional formatting properties.

DecoratedRange

Represents a range with decorations applied.

TextEqualsOptions

Options for comparing text nodes.

Attributes

Collapse all

    If true, the text content is not compared. Used to check if sibling text nodes can be merged.

TextOf<N>

A utility type to get all the text node types from a root node type.

MarksOf<N>

A utility type to get all the mark types from a root node type.