1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-24 09:13:24 +01:00
slate/docs/reference/models/document.md
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

66 lines
1.3 KiB
Markdown

# `Document`
```js
import { Document } from 'slate'
```
The top-level node in Slate.
Documents are made up of block nodes, inline nodes, and text nodes—just like in the DOM.
- [Properties](#properties)
- [`nodes`](#nodes)
- [Computed Properties](#computed-properties)
- [`kind`](#kind)
- [`length`](#length)
- [`text`](#text)
- [Static Methods](#static-methods)
- [`Document.create`](#documentcreate)
- [Node Methods](#node-methods)
## Properties
```js
Document({
nodes: Immutable.List<Node>,
})
```
### `nodes`
`Immutable.List`
A list of child nodes.
## Computed Properties
### `kind`
`String`
An immutable string value of `'document'` for easily separating this node from [`Block`](./block.dm), [`Inline`](./inline.md) or [`Text`](./text.md) nodes.
### `length`
`Number`
The sum of the lengths of all of the descendant [`Text`](./text.md) nodes of this node.
### `text`
`String`
A concatenated string of all of the descendant [`Text`](./text.md) nodes of this node.
## Static Methods
### `Document.create`
`Document.create(properties: Object) => Document`
Create a block from a plain Javascript object of `properties`.
## Node Methods
Documents implement the [`Node`](./node.md) interface. For information about all of the node methods, see the [`Node` reference](./node.md).