Constructor
new ve.Document(documentNode)
#
Children
Generic document.
Parameters:
Name | Type | Description |
---|---|---|
documentNode |
ve.BranchNode | Document node |
- Mixes in:
- Source:
Methods
getBranchNodeFromOffset(offset) → {ve.Node|null
}
#
null
}
#
Get a node at an offset.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | Offset to get node at |
- Source:
Returns:
Node at offset
- Type
-
ve.Node
|
null
getCoveredSiblingGroups(range) → {Array}
#
Get groups of sibling nodes covered by the given range.
Parameters:
Name | Type | Description |
---|---|---|
range |
ve.Range |
- Source:
Returns:
Array of objects. Each object has the following keys:
- nodes: Array of sibling nodes covered by a part of range
- parent: Parent of all of these nodes
- grandparent: parent's parent
- Type
- Array
getDocumentNode() → {ve.BranchNode}
#
nodeAttached(node)
#
Callback when a node is attached with ve.Node#setDocument
The node and all its children are guaranteed to be attached
Parameters:
Name | Type | Description |
---|---|---|
node |
ve.Node | The node attached |
- Source:
Fires:
Callback when a node is attached with ve.Node#setDocument
The node and all its children are guaranteed to be attached
nodeDetached(node)
#
Callback when a node is attached with ve.Node#setDocument
The node and all its children are guaranteed to be attached
Parameters:
Name | Type | Description |
---|---|---|
node |
ve.Node | The node detached |
- Source:
Fires:
Callback when a node is attached with ve.Node#setDocument
The node and all its children are guaranteed to be attached
rangeInsideOneLeafNode(range) → {boolean}
#
Test whether a range lies within a single leaf node.
Parameters:
Name | Type | Description |
---|---|---|
range |
ve.Range | The range to test |
- Source:
Returns:
Whether the range lies within a single node
- Type
- boolean
selectNodes(range, [mode]) → {Array}
#
Gets a list of nodes and the ranges within them that a selection of the document covers.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
range |
ve.Range | Range within document to select nodes |
||
mode |
string |
optional |
'leaves' | Type of selection to perform:
|
- Source:
Returns:
List of objects describing nodes in the selection and the ranges therein:
node
: Reference to a ve.Noderange
: ve.Range, missing if the entire node is coveredindex
: Index of the node in its parent, missing if node has no parentindexInNode
: If range is a zero-length range between two children of node, this is set to the index of the child following range (or tonode.children.length + 1
if range is between the last child and the end). If range is a zero-length range inside an empty non-content branch node, this is 0. Missing in all other cases.nodeRange
: Range covering the inside of the entire node, not including wrappernodeOuterRange
: Range covering the entire node, including wrapperparentOuterRange
: Outer range of node's parent. Missing if there is no parent or if indexInNode is set.
- Type
- Array
Throws:
Events
nodeAttached(node)
#
A node has been attached with ve.Node#setDocument . Its descendants are guaranteed to be attached too (and the event is emitted for descendants first, and for siblings in their order in the children list)
Parameters:
Name | Type | Description |
---|---|---|
node |
ve.Node | The node that has been attached |
- Source:
nodeDetached(node)
#
A node has been detached with ve.Node#setDocument . Its descendants are guaranteed to be detached too (and the event is emitted for descendants first, and for siblings in their order in the children list)
Parameters:
Name | Type | Description |
---|---|---|
node |
ve.Node | The node that has been detached |
- Source: