📉
slate
  • Introduction
  • Walkthroughs
    • Installing Slate
    • Adding Event Handlers
    • Defining Custom Block Nodes
    • Applying Custom Formatting
    • Using Plugins
    • Saving to a Database
    • Saving and Loading HTML Content
  • Guides
    • Changes
    • Data Model
    • Plugins
    • Rendering
    • Schemas
  • General
    • Plugins
    • Resources
    • Contributing
    • Changelog
    • FAQ
    • Glossary
  • Slate Core
    • Block
    • Change
    • Data
    • Decoration
    • Document
    • Inline
    • Mark
    • Node
    • Operation
    • Point
    • Range
    • Schema
    • Selection
    • Text
    • Value
    • setKeyGenerator
    • resetKeyGenerator
  • Slate React
    • Editor
    • Plugins
    • Custom Nodes
    • Core Plugins
    • cloneFragment
    • findDOMNode
    • findDOMRange
    • findNode
    • findRange
    • getEventRange
    • getEventTransfer
    • setEventTransfer
  • Other Packages
    • slate-html-serializer
    • slate-hyperscript
    • slate-plain-serializer
    • slate-prop-types
    • slate-simulator
Powered by GitBook
On this page
  • Properties
  • key
  • nodes
  • object
  • Computed Properties
  • text
  • Methods
  • filterDescendants
  • findDescendant
  • getAncestors
  • getBlocks
  • getBlocksAtRange
  • getBlocksByType
  • getChild
  • getClosest
  • getClosestBlock
  • getClosestInline
  • getClosestVoid
  • getCommonAncestor
  • getDepth
  • getDescendant
  • getFirstText
  • getFragmentAtRange
  • getFurthest
  • getFurthestAncestor
  • getFurthestBlock
  • getFurthestInline
  • getFurthestOnlyChildAncestor
  • getInlines
  • getInlinesAtRange
  • getInlinesByType
  • getLastText
  • getMarks
  • getMarksAtRange
  • getMarksByType
  • getNextBlock
  • getNextNode
  • getNextSibling
  • getNextText
  • getNode
  • getOffset
  • getParent
  • getPath
  • getPreviousBlock
  • getPreviousNode
  • getPreviousSibling
  • getPreviousText
  • getTextAtOffset
  • getTextDirection
  • getTexts
  • getTextsAtRange
  • hasChild
  • hasDescendant
  • hasNode

Was this helpful?

  1. Slate Core

Node

PreviousMarkNextOperation

Last updated 5 years ago

Was this helpful?

Node is not a publicly accessible module, but instead an interface that , and all implement.

Properties

key

String

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

Immutable.List

A list of child nodes. Defaults to a list with a single text node child.

object

String

An immutable string value of 'document', 'block', 'inline' or 'text' for easily separating this node from or nodes.

Computed Properties

text

String

Methods

filterDescendants

filterDescendants(iterator: Function) => List

Deeply filter the descendant nodes of a node by iterator.

findDescendant

findDescendant(iterator: Function) => Node|Void

Deeply find a descendant node by iterator.

getAncestors

getAncestors(path: List|Array) => List|Void getAncestors(key: String) => List|Void

Get the ancestors of a descendant by path or key.

getBlocks

getBlocks() => List

getBlocksAtRange

getBlocksAtRange(range: Range) => List

getBlocksByType

getBlocksByType(type: String) => List

getChild

getChild(path: List|Array) => Node|Void getChild(key: String) => Node|Void

Get a child by path or key.

getClosest

getClosest(path: List|Array, match: Function) => Node|Void getClosest(key: String, match: Function) => Node|Void

Get the closest parent node of a descendant node by path or key that matches a match function.

getClosestBlock

getClosestBlock(path: List|Array) => Node|Void getClosestBlock(key: String) => Node|Void

getClosestInline

getClosestInline(path: List|Array) => Node|Void getClosestInline(key: String) => Node|Void

getClosestVoid

getClosestVoid(path: List|Array) => Node|Void getClosestVoid(key: String) => Node|Void

Get the closest void parent of a descendant node by path or key.

getCommonAncestor

getCommonAncestor(path: List|Array) => Number getCommonAncestor(key: String) => Number

Get the lowest common ancestor of a descendant node by path or key.

getDepth

getDepth(path: List|Array) => Number getDepth(key: String) => Number

Get the depth of a descendant node by path or key.

getDescendant

getDescendant(path: List|Array) => Node|Void getDescendant(key: String) => Node|Void

Get a descendant node by path or key.

getFirstText

getFirstText() => Text|Void

Get the first child text node inside a node.

getFragmentAtRange

getFragmentAtRange(range: Range) => Document

Get a document fragment of the nodes in a range.

getFurthest

getFurthest(path: List|Array, iterator: Function) => Node|Null getFurthest(key: String, iterator: Function) => Node|Null

Get the furthest parent of a node by path or key that matches an iterator.

getFurthestAncestor

getFurthestAncestor(path: List|Array) => Node|Null getFurthestAncestor(key: String) => Node|Null

Get the furthest ancestor of a node by path or key.

getFurthestBlock

getFurthestBlock(path: List|Array) => Node|Null getFurthestBlock(key: String) => Node|Null

Get the furthest block parent of a node by path or key.

getFurthestInline

getFurthestInline(path: List|Array) => Node|Null getFurthestInline(key: String) => Node|Null

Get the furthest inline parent of a node by path or key.

getFurthestOnlyChildAncestor

getFurthestOnlyChildAncestor(path: List|Array) => Node|Null getFurthestOnlyChildAncestor(key: String) => Node|Null

Get the furthest ancestor of a node by path or key that has only one child.

getInlines

getInlines() => List

getInlinesAtRange

getInlinesAtRange(range: Range) => List

getInlinesByType

getInlinesByType(type: string) => List

getLastText

getLastText() => Node|Void

Get the last child text node inside a node.

getMarks

getMarks(range: Range) => Set

Get a set of all of the marks in a node.

getMarksAtRange

getMarksAtRange(range: Range) => Set

Get a set of all of the marks in a range.

getMarksByType

getMarksByType(type: String) => Set

Get a set of all of the marks by type.

getNextBlock

getNextBlock(path: List|Array) => Node|Void getNextBlock(key: String) => Node|Void

getNextNode

getNextNode(path: List|Array) => Node|Void getNextNode(key: String) => Node|Void

Get the next node in the tree of a descendant by path or key. This will not only check for siblings but instead move up the tree returning the next ancestor if no sibling is found.

getNextSibling

getNextSibling(path: List|Array) => Node|Void getNextSibling(key: String) => Node|Void

Get the next sibling of a descendant by path or key.

getNextText

getNextText(path: List|Array) => Node|Void getNextText(key: String) => Node|Void

getNode

getNode(path: List|Array) => Node|Void getNode(key: String) => Node|Void

Get a node in the tree by path or key.

getOffset

getOffset(path: List|Array) => Number getOffset(key: String) => Number

Get the text offset of a descendant in the tree by path or key.

getParent

getParent(path: List|Array) => Node|Void getParent(key: String) => Node|Void

Get the parent node of a descendant by path or key.

getPath

getPath(path: List|Array) => Node|Void getPath(key: String) => Node|Void

Get the path to a descendant by path or key.

getPreviousBlock

getPreviousBlock(path: List|Array) => Node|Void getPreviousBlock(key: String) => Node|Void

getPreviousNode

getPreviousNode(path: List|Array) => Node|Void getPreviousNode(key: String) => Node|Void

Get the previous node in the tree of a descendant by path or key. This will not only check for siblings but instead move up the tree returning the previous ancestor if no sibling is found.

getPreviousSibling

getPreviousSibling(path: List|Array) => Node|Void getPreviousSibling(key: String) => Node|Void

Get the previous sibling of a descendant by path or key.

getPreviousText

getPreviousText(path: List|Array) => Node|Void getPreviousText(key: String) => Node|Void

getTextAtOffset

getTextAtOffset(offset: Number) => Text || Void

getTextDirection

getTextDirection() => String

Get the direction of the text content in the node.

getTexts

getTexts(range: Range) => List

getTextsAtRange

getTextsAtRange(range: Range) => List

hasChild

hasChild(path: List|Array) => Boolean hasChild(key: String) => Boolean

Check whether the node has a child node by path or key.

hasDescendant

hasDescendant(path: List|Array) => Boolean hasDescendant(key: String) => Boolean

Check whether the node has a descendant node by path or key.

hasNode

hasNode(path: List|Array) => Boolean hasNode(key: String) => Boolean

Check whether a node exists in the tree by path or key.

A concatenated string of all of the descendant nodes of this node.

Get all of the bottom-most node descendants.

Get all of the bottom-most nodes in a range.

Get all of the bottom-most nodes by type.

Get the closest node to a descendant node by path or key.

Get the closest node to a descendant node by path or key.

Get all of the top-most nodes in a node.

Get all of the top-most nodes in a range.

Get all of the top-most nodes by type.

Get the next, bottom-most node after a descendant by path or key.

Get the next node after a descendant by path or key.

Get the previous, bottom-most node before a descendant by path or key.

Get the previous node before a descendant by path or key.

Get the node at an offset.

Get all of the nodes in a node.

Get all of the nodes in a range.

Document
Block
Inline
Inline
Text
Text
Block
Block
Block
Block
Inline
Inline
Inline
Inline
Block
Text
Block
Text
Text
Text
Text