Block
import { Block } from 'slate'A block node in a Slate Document. Block nodes implement the Node interface.
Block nodes may contain nested block nodes, inline nodes, and text nodes—just like in the DOM. They always contain at least one text node child.
Properties
Block({
data: Data,
key: String,
nodes: Immutable.List<Node>,
type: String
})data
dataImmutable.Map
Arbitrary data associated with the node. Defaults to an empty Map.
key
keyString
A unique identifier for the node.
object
objectString
An immutable string value of 'block' for easily separating this node from Inline or Text nodes.
nodes
nodesImmutable.List
A list of child nodes. Defaults to a list with a single text node child.
type
typeString
The custom type of the node (eg. blockquote or list-item).
Computed Properties
text
textString
A concatenated string of all of the descendant Text nodes of this node.
Static Methods
Block.create
Block.createBlock.create(properties: Object) => Block
Create a block from a plain JavaScript object of properties.
Block.createList
Block.createListBlock.createList(array: Array) => List
Create a list of block nodes from a plain JavaScript array.
Block.fromJSON
Block.fromJSONBlock.fromJSON(object: Object) => Block
Create a block from a JSON object.
Block.isBlock
Block.isBlockBlock.isBlock(maybeBlock: Any) => Boolean
Returns a boolean if the passed in argument is a Block.
Node Methods
Blocks implement the Node interface. For information about all of the node methods, see the Node reference.
Instance Methods
toJSON
toJSONtoJSON() => Object
Returns a JSON representation of the block.
Last updated