Base node type for document nodes.
The following example shows how a new node type is defined.
class Todo extends TextBlock {}
Todo.schema = {
type: 'todo',
content: 'text',
done: { type: 'bool', default: false }
}
The following data types are supported:
string
bare metal string data typetext
a string that carries annotationsnumber
numeric valuesbool
boolean valuesid
a node id referencing another node in the document
Get the Document instance.
Document |
Whether this node has a parent.
parent
is a built-in property for implementing nested nodes.
Boolean |
DocumentNode | the parent node |
Get the root node.
The root node is the last ancestor returned
by a sequence of getParent()
calls.
DocumentNode |
Checks whether this node has children.
Boolean | default: false |
Get the index of a given child.
Number | default: -1 |
Get a child node at a given position.
DocumentNode | default: null |
Get the number of children nodes.
Number | default: 0 |
Boolean | true if node is a block node (e.g. Paragraph, Figure, List, Table) |
Boolean | true if node is a text node (e.g. Paragraph, Codebock) |
Boolean | true if node is an inline node (e.g. Citation) |
Declares a node to be treated as block-type node.
BlockNodes are considers the direct descendant of Container
nodes.
Declares a node to be treated as model/PropertyAnnotation.
Declares a node to be treated as model/ContainerAnnotation.
Declares a node to be treated as model/InlineNode.