Path
API reference for paths in Slate.
A Path is a list of indexes that describe a node's exact position in a Slate node tree. Although they are usually relative to the root Editor
object, they can be relative to any Node
object.
type Path = number[];
PathApi
operationCanTransformPath
Check if an operation can affect paths (used as an optimization for dirty-path updates during normalization).
transform
Transform a path by an operation.
ancestors
Get a list of ancestor paths for a given path.
child
Get a path to a child at the given index.
common
Get the common ancestor path of two paths.
compare
Compare a path to another, returning an integer indicating whether the path was before, at, or after the other.
endsAfter
Check if a path ends after one of the indexes in another.
endsAt
Check if a path ends at one of the indexes in another.
endsBefore
Check if a path ends before one of the indexes in another.
equals
Check if a path is exactly equal to another.
firstChild
Get a path to the first child of a path.
hasPrevious
Check if the path of a previous sibling node exists.
isAfter
Check if a path is after another.
isAncestor
Check if a path is an ancestor of another.
isBefore
Check if a path is before another.
isChild
Check if a path is a child of another.
isCommon
Check if a path is equal to or an ancestor of another.
isDescendant
Check if a path is a descendant of another.
isParent
Check if a path is the parent of another.
isPath
Check if a value implements the Path
interface.
isSibling
Check if a path is a sibling of another.
lastIndex
Get the last index of a path.
levels
Get a list of paths at every level down to a path.
next
Get the path to the next sibling node.
parent
Get the path to the parent node.
previous
Get the path to the previous sibling node.
relative
Get a path relative to an ancestor.
Types
Path
An array of numbers representing the indexes to traverse to reach a specific node in the document tree.