Document
Last updated
import { Document } from 'slate'The top-level node in Slate's document model.
Documents are made up of block nodes, inline nodes, and text nodes—just like in the DOM. Note that direct descendants of a document node have to be block nodes.
In some places, you'll see mention of "fragments", which are also Document objects, just that aren't attached to the main Value. For example, when cutting-and-pasting a selection of content, that content will be referred to as a document "fragment".
Document({
nodes: Immutable.List<Node>,
})dataImmutable.Map
Arbitrary data associated with the document. Defaults to an empty Map.
objectString
An immutable string value of 'document' for easily separating this node from Block, Inline or Text nodes.
nodesImmutable.List
A list of child nodes.
textString
A concatenated string of all of the descendant Text nodes of this node.
Document.createDocument.create(properties: Object) => Document
Create a document from a plain JavaScript object of properties.
Document.fromJSONDocument.fromJSON(object: Object) => Document
Create a document from a JSON object.
Document.isDocumentDocument.isDocument(maybeDocument: Any) => Boolean
Returns a boolean if the passed in argument is a Document.
Documents implement the Node interface. For information about all of the node methods, see the Node reference.
toJSONtoJSON() => Object
Returns a JSON representation of the document.
Last updated