Node
Node is not a publicly accessible module, but instead an interface that Document, Block and Inline all implement.
Properties
key
keyString
A short-lived, unique identifier for the node.
By default, keys are not meant to be long-lived unique identifiers for nodes that you might store in a database, or elsewhere. They are meant purely to identify a node inside of a single Slate instance. For that reason, they are simply auto-incrementing strings. (eg. '0', '1', '2', ...)
If you want to make your keys uniqueness long-lived, you'll need to supply your own key generating function via the setKeyGenerator util.
nodes
nodesImmutable.List
A list of child nodes. Defaults to a list with a single text node child.
object
objectString
An immutable string value of 'document', 'block', 'inline' or 'text' for easily separating this node from Inline or Text nodes.
Computed Properties
text
textString
A concatenated string of all of the descendant Text nodes of this node.
Methods
filterDescendants
filterDescendantsfilterDescendants(iterator: Function) => List
Deeply filter the descendant nodes of a node by iterator.
findDescendant
findDescendantfindDescendant(iterator: Function) => Node || Void
Deeply find a descendant node by iterator.
getBlocksAtRange
getBlocksAtRangegetBlocksAtRange(range: Range) => List
Get all of the bottom-most Block nodes in a range.
getBlocks
getBlocksgetBlocks() => List
Get all of the bottom-most Block node descendants.
getCharactersAtRange
getCharactersAtRangegetCharactersAtRange(range: Range) => List
Get a list of all of the Characters in a range.
getChild
getChildgetChild(key: String || Node) => Node || Void
Get a child by key.
getClosestBlock
getClosestBlockgetClosestBlock(key: String || Node) => Node || Void
Get the closest Block node to a descendant node by key.
getClosestInline
getClosestInlinegetClosestInline(key: String || Node) => Node || Void
Get the closest Inline node to a descendant node by key.
getClosest
getClosestgetClosest(key: String || Node, match: Function) => Node || Void
Get the closest parent node of a descendant node by key that matches a match function.
getDepth
getDepthgetDepth(key: String || Node) => Number
Get the depth of a descendant node by key.
getDescendant
getDescendantgetDescendant(key: String || Node) => Node || Void
Get a descendant node by key.
getFirstText
getFirstTextgetFirstText() => Node || Void
Get the first child text node inside a node.
getFragmentAtRange
getFragmentAtRangegetFragmentAtRange(range: Range) => Document
Get a document fragment of the nodes in a range.
getFurthest
getFurthestgetFurthest(key: String, iterator: Function) => Node || Null
Get the furthest parent of a node by key that matches an iterator.
getFurthestAncestor
getFurthestAncestorgetFurthestAncestor(key: String) => Node || Null
Get the furthest ancestor of a node by key.
getFurthestBlock
getFurthestBlockgetFurthestBlock(key: String) => Node || Null
Get the furthest block parent of a node by key.
getFurthestInline
getFurthestInlinegetFurthestInline(key: String) => Node || Null
Get the furthest inline parent of a node by key.
getFurthestOnlyChildAncestor
getFurthestOnlyChildAncestorgetFurthestOnlyChildAncestor(key: String) => Node || Null
Get the furthest ancestor of a node by key that has only one child.
getInlinesAtRange
getInlinesAtRangegetInlinesAtRange(range: Range) => List
Get all of the top-most Inline nodes in a range.
getLastText
getLastTextgetLastText() => Node || Void
Get the last child text node inside a node.
getMarksAtRange
getMarksAtRangegetMarksAtRange(range: Range) => Set
Get a set of all of the marks in a range.
getNextBlock
getNextBlockgetNextBlock(key: String || Node) => Node || Void
Get the next, bottom-most Block node after a descendant by key.
getNextSibling
getNextSiblinggetNextSibling(key: String || Node) => Node || Void
Get the next sibling of a descendant by key.
getNextText
getNextTextgetNextText(key: String || Node) => Node || Void
Get the next Text node after a descendant by key.
getParent
getParentgetParent(key: String || Node) => Node || Void
Get the parent node of a descendant by key.
getPreviousBlock
getPreviousBlockgetPreviousBlock(key: String || Node) => Node || Void
Get the previous, bottom-most Block node before a descendant by key.
getPreviousSibling
getPreviousSiblinggetPreviousSibling(key: String || Node) => Node || Void
Get the previous sibling of a descendant by key.
getPreviousText
getPreviousTextgetPreviousText(key: String || Node) => Node || Void
Get the previous Text node before a descendant by key.
getTextAtOffset
getTextAtOffsetgetTextAtOffset(offset: Number) => Text || Void
Get the Text node at an offset.
getTextsAtRange
getTextsAtRangegetTextsAtRange(range: Range) => List
Get all of the Text nodes in a range.
hasChild
hasChildhasChild(key: String || Node) => Boolean
Check whether the node has a child node by key.
hasDescendant
hasDescendanthasDescendant(key: String || Node) => Boolean
Check whether the node has a descendant node by key.
Last updated