Path
arrays are 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.Path.ancestors(path: Path, options: { reverse?: boolean } = {}) => Path[]
reverse: true
option is passed, they are reversed.Path.common(path: Path, another: Path) => Path
Path.compare(path: Path, another: Path) => -1 | 0 | 1
0
result if one is directly above or below the other. If you want exact matching, use [[Path.equals]] instead.Path.levels(path: Path, options?) => Path[]
Path.ancestors
, but includes the path itself.reverse: true
option is passed, they are reversed.{reverse?: boolean}
Path.next(path: Path) => Path
Path
is valid in the document.Path.parent(path: Path) => Path
path
argument is equal to []
, throws an error.Path.previous(path: Path) => Path
[1, 0]
, the previous path would be [1, -1]
which is illegal and will throw an error).Path.relative(path: Path, ancestor: Path) => Path
ancestor
argument to the path
argument. If the ancestor
path is not actually an ancestor or equal to the path
argument, throws an error.Path.endsAfter(path: Path, another: Path) => boolean
Path.endsAt(path: Path, another: Path) => boolean
Path.endsBefore(path: Path, another: Path) => boolean
Path.equals(path: Path, another: Path) => boolean
Path.hasPrevious(path: Path) => boolean
Path.isAfter(path: Path, another: Path) => boolean
Path.isAncestor(path: Path, another: Path) => boolean
Path.isBefore(path: Path, another: Path) => boolean
Path.isChild(path: Path, another: Path) => boolean
Path.isCommon(path: Path, another: Path) => boolean
Path.isDescendant(path: Path, another: Path) => boolean
Path.isParent(path: Path, another: Path) => boolean
Path.isPath(value: any) => value is Path
Path
interface.Path.isSibling(path: Path, another: Path) => boolean
Path.transform(path: Path, operation: Operation, options?) => Path | null
{ affinity?: 'forward' | 'backward' | null }