1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-23 16:55:23 +01:00
Somasundaram Ayyappan b5880e607f Doc fixes (#102)
* replace block api refs with inline

* fix inline link refs in static method sections

* link fixes in few more files
2016-07-17 14:00:31 -07:00

2.3 KiB

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,
  isVoid: Boolean,
  key: String,
  nodes: Immutable.List<Node>,
  type: String
})

data

Immutable.Map

Arbitrary data associated with the node. Defaults to an empty Map.

isVoid

Boolean

Whether the node is a "void" node, meaning that it has no child content (eg. images, videos, etc.). Defaults to false.

Note that even though a node may be "void", it will still contain a single, empty Text node for consistency across other operations. However, when rendered by Slate that single Text node will not be visible.

key

String

A unique identifier for the node.

nodes

Immutable.List

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

type

String

The custom type of the node (eg. blockquote or list-item).

Computed Properties

kind

String

An immutable string value of 'block' for easily separating this node from Inline or Text nodes.

length

Number

The sum of the lengths of all of the descendant Text nodes of this node.

text

String

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

Static Methods

Block.create

Block.create(properties: Object) => Block

Create a block from a plain Javascript object of properties.

Block.createList

Block.createList(array: Array) => List

Create a list of block nodes from a plain Javascript array.

Node Methods

Blocks implement the Node interface. For information about all of the node methods, see the Node reference.