DocumentNode
Class defined in model/DocumentNode.js#29 inherits from

Base node type for document nodes.

Example

The following example shows how a new node type is defined.

    class Todo extends TextBlock {}
    Todo.define({
      type: 'todo',
      content: 'text',
      done: { type: 'bool', default: false }
    })

The following data types are supported:

- `string` bare metal string data type
- `text` a string that carries annotations
- `number` numeric values
- `bool` boolean values
- `id` a node id referencing another node in the document

new DocumentNode()
Constructor defined in model/DocumentNode.js#35
this.getDocument()
Method defined in model/DocumentNode.js#50

Get the Document instance.

Returns

Document |

this.hasParent()
Method defined in model/DocumentNode.js#61

Whether this node has a parent.

`parent` is a built-in property for implementing nested nodes.

Returns

Boolean |

this.getParent()
Method defined in model/DocumentNode.js#68
Returns

DocumentNode | the parent node

this.hasChildren()
Method defined in model/DocumentNode.js#77

Checks whether this node has children.

Returns

Boolean | default: false

this.getChildIndex()
Method defined in model/DocumentNode.js#86

Get the index of a given child.

Returns

Number | default: -1

this.getChildAt()
Method defined in model/DocumentNode.js#95

Get a child node at a given position.

Returns

DocumentNode | default: null

this.getChildCount()
Method defined in model/DocumentNode.js#104

Get the number of children nodes.

Returns

Number | default: 0

this.getRoot()
Method defined in model/DocumentNode.js#116

Get the root node.

The root node is the last ancestor returned by a sequence of `getParent()` calls.

Returns

DocumentNode |

this.isBlock()
Method defined in model/DocumentNode.js#190
Returns

Boolean | true if node is a block node (e.g. Paragraph, Figure, List, Table)

this.isText()
Method defined in model/DocumentNode.js#197
Returns

Boolean | true if node is a text node (e.g. Paragraph, Codebock)

this.isPropertyAnnotation()
Method defined in model/DocumentNode.js#204
Returns

Boolean | true if node is an annotation node (e.g. Strong)

this.isInline()
Method defined in model/DocumentNode.js#211
Returns

Boolean | true if node is an inline node (e.g. Citation)

this.isContainerAnnotation()
Method defined in model/DocumentNode.js#218
Returns

Boolean | true if node is a container annotation (e.g. multiparagraph comment)

isBlock
Property defined in model/DocumentNode.js#230

Declares a node to be treated as block-type node.

BlockNodes are considers the direct descendant of `Container` nodes.

isText
Property defined in model/DocumentNode.js#237

Declares a node to be treated as text-ish node.

isPropertyAnnotation
Property defined in model/DocumentNode.js#244

Declares a node to be treated as model/PropertyAnnotation.

isContainerAnnotation
Property defined in model/DocumentNode.js#251

Declares a node to be treated as model/ContainerAnnotation.

isInline
Property defined in model/DocumentNode.js#258

Declares a node to be treated as model/InlineNode.