Extends
Constructor
new ve.dm.TableRowNode([element], [children])
#
DataModel table row node.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
element |
Object |
optional |
Reference to element in linear model |
children |
Array.<ve.dm.Node> |
optional |
Properties
getStore
#
Get a reference to the hash-value store used by the element.
- Inherited from:
- Source:
Methods
adjustLength(adjustment)
#
Adjust the length.
This should only be called after a relevant change to the document data. Calling this method will not change the document data.
Parameters:
| Name | Type | Description |
|---|---|---|
adjustment |
number | Amount to adjust length by |
Throws:
-
Invalid adjustment error if resulting length is less than 0
- Type
- Error
- Inherited from:
- Source:
canBeMergedWith(node) → {boolean}
#
Check if the node can be merged with another.
For two nodes to be mergeable, the two nodes must either be the same node or:
- Are comparable according to #compareForMerging (by default, have the same type)
- Have the same depth
- Have similar ancestry (each node upstream must have the same type)
Parameters:
| Name | Type | Description |
|---|---|---|
node |
ve.dm.Node | Node to consider merging with |
Returns:
Nodes can be merged
- Type
- boolean
- Inherited from:
- Source:
canContainContent()
#
- Inherited from:
- Source:
- See:
canHaveChildren()
#
- Inherited from:
- Source:
- See:
canHaveChildrenNotContent()
#
- Inherited from:
- Source:
- See:
canHaveSlugAfter() → {boolean}
#
Check if the node can have a slug after it.
Returns:
Whether the node can have a slug after it
- Type
- boolean
- Inherited from:
- Source:
canHaveSlugBefore() → {boolean}
#
Check if the node can have a slug before it.
Returns:
Whether the node can have a slug before it
- Type
- boolean
- Inherited from:
- Source:
compareAttributes(attributes) → {boolean}
#
Check if specific attributes match those in the node
Parameters:
| Name | Type | Description |
|---|---|---|
attributes |
Object | Node attributes to match |
Returns:
Attributes sepcified match those in the node
- Type
- boolean
- Inherited from:
- Source:
compareForMerging(otherNode) → {boolean}
#
Compare with another node for merging (see #canBeMergedWidth)
The default implementation just compares node types.
Parameters:
| Name | Type | Description |
|---|---|---|
otherNode |
ve.dm.Node | Other node to compare with |
Returns:
Nodes are comparable
- Type
- boolean
- Inherited from:
- Source:
Compare with another node for merging (see #canBeMergedWidth)
The default implementation just compares node types.
findMatchingAncestor(type, [attributes]) → {ve.dm.Node|null}
#
null}
#
Find the first ancestor with matching type and attribute values.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
type |
string | Node type to match |
|
attributes |
Object |
optional |
Node attributes to match |
Returns:
Ancestor with matching type and attribute values
- Type
-
ve.dm.Node
|
null
- Inherited from:
- Source:
getAnnotationRanges() → {Array.<ve.dm.LinearData.AnnotationRange>}
#
Get all annotations and the ranges they cover
Result is cached until the next document transaction.
Returns:
Contiguous annotation ranges, ordered by start then end
- Inherited from:
- Source:
Get all annotations and the ranges they cover
Result is cached until the next document transaction.
getAttribute(key) → {any}
#
Get the value of an attribute.
Return value is by reference if array or object.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | Name of attribute to get |
Returns:
Value of attribute, or undefined if no such attribute exists
- Type
- any
- Inherited from:
- Source:
getAttributes([prefix]) → {Object}
#
Get a copy of all attributes.
Values are by reference if array or object, similar to using the getAttribute method.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
prefix |
string |
optional |
Only return attributes with this prefix, and remove the prefix from them |
Returns:
Attributes
- Type
- Object
- Inherited from:
- Source:
getChildNodeTypes()
#
- Inherited from:
- Source:
- See:
getClonedElement(preserveGenerated, resetAttributes) → {Object}
#
Parameters:
| Name | Type | Description |
|---|---|---|
preserveGenerated |
boolean | Preserve internal.generated property of element |
resetAttributes |
boolean | Reset attributes for an empty clone, as defined in #static-resetForClone |
Returns:
Cloned element object
- Type
- Object
getElement() → {Object}
#
Get a reference to the linear model element.
Returns:
Linear model element passed to the constructor, by reference
- Type
- Object
- Inherited from:
- Source:
getHashObject() → {Object}
#
getLength()
#
- Inherited from:
- Source:
- See:
getOffset()
#
- Inherited from:
- Source:
- See:
getOriginalDomElements() → {Array.<HTMLElement>}
#
Get the DOM element(s) this model was originally converted from, if any.
Returns:
DOM elements this model was converted from, empty if not applicable
- Type
- Array.<HTMLElement>
- Inherited from:
- Source:
getOriginalDomElementsHash() → {string|undefined}
#
undefined}
#
Get the DOM element(s) this model was originally converted from, if any.
Returns:
Store hash of DOM elements this model was converted from
- Type
-
string
|
undefined
- Inherited from:
- Source:
getParentNodeTypes()
#
- Inherited from:
- Source:
- See:
getSuggestedParentNodeTypes()
#
- Inherited from:
- Source:
- See:
getType() → {string}
#
Get the symbolic name of this model's type.
Returns:
Type name
- Type
- string
- Inherited from:
- Source:
handlesOwnChildren()
#
- Inherited from:
- Source:
- See:
hasMatchingAncestor(type, [attributes]) → {boolean}
#
Check if the node has an ancestor with matching type and attribute values.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
type |
string | Node type to match |
|
attributes |
Object |
optional |
Node attributes to match |
Returns:
Node has an ancestor with matching type and attribute values
- Type
- boolean
- Inherited from:
- Source:
hasSignificantWhitespace()
#
- Inherited from:
- Source:
- See:
hasSlugAtOffset(offset) → {boolean}
#
Check in the branch node has a slug at a particular offset
Parameters:
| Name | Type | Description |
|---|---|---|
offset |
number | Offset to check for a slug at |
Returns:
There is a slug at the offset
- Type
- boolean
- Inherited from:
- Source:
isAlignable()
#
- Inherited from:
- Source:
- See:
isCellEditable()
#
- Inherited from:
- Source:
- See:
isCellable()
#
- Inherited from:
- Source:
- See:
isContent()
#
- Inherited from:
- Source:
- See:
isDiffComparable(other) → {boolean}
#
Check if this element is of the same type as another element for the purposes of diffing.
Elements which aren't of the same type will always be shown as removal and an insertion, whereas comarable elements will be shown as an attribute change.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Object | Another element |
Returns:
Elements are of a comparable type
- Type
- boolean
- Inherited from:
- Source:
isDiffedAsDocument()
#
- Inherited from:
- Source:
- See:
isDiffedAsLeaf()
#
- Inherited from:
- Source:
- See:
isDiffedAsList()
#
- Inherited from:
- Source:
- See:
isEditable() → {boolean}
#
Check whether this node can be edited by a context item
The default implementation always returns true. If your node type is uneditable in certain cases, you should override this function.
Returns:
Whether this node is editable
- Type
- boolean
- Inherited from:
- Source:
Check whether this node can be edited by a context item
The default implementation always returns true.
isFocusable()
#
- Inherited from:
- Source:
- See:
isInspectable() → {boolean}
#
Check whether this node can be inspected by a context item.
The default implementation always returns true. If your node type is uninspectable in certain cases, you should override this function.
Returns:
Whether this node is inspectable
- Type
- boolean
- Inherited from:
- Source:
isInternal()
#
- Inherited from:
- Source:
- See:
isMetaData()
#
- Inherited from:
- Source:
- See:
isSurfaceable() → {boolean}
#
Check if the node can be the root of a branch exposed in a ve.ce.Surface
Returns:
Node can be the root of a surfaced branch
- Type
- boolean
- Inherited from:
- Source:
isUnwrappable()
#
- Inherited from:
- Source:
- See:
isWrapped()
#
- Inherited from:
- Source:
- See:
matches(type, [attributes]) → {boolean}
#
Check if the node matches type and attribute values.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
type |
string | Node type to match |
|
attributes |
Object |
optional |
Node attributes to match |
Returns:
Node matches type and attribute values
- Type
- boolean
- Inherited from:
- Source:
onCellAttributeChange(cell)
#
onSplice(index, deleteCount, […nodes])
#
Handle splicing of child nodes
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
index |
number | ||
deleteCount |
number | ||
nodes |
ve.dm.Node |
optional repeatable |
pop() → {ve.dm.BranchNode|undefined}
#
undefined}
#
Remove a child node from the end of the list.
Returns:
Removed childModel
- Type
-
ve.dm.BranchNode
|
undefined
- Inherited from:
- Source:
push(childModel) → {number}
#
Add a child node to the end of the list.
Parameters:
| Name | Type | Description |
|---|---|---|
childModel |
ve.dm.BranchNode | Item to add |
Returns:
New number of children
- Type
- number
- Inherited from:
- Source:
setLength(length)
#
Set the inner length of the node.
This should only be called after a relevant change to the document data. Calling this method will not change the document data.
Parameters:
| Name | Type | Description |
|---|---|---|
length |
number | Length of content |
Fires:
Throws:
-
Invalid content length error if length is less than 0
- Type
- Error
- Inherited from:
- Source:
setupBlockSlugs()
#
Setup a sparse array of booleans indicating where to place slugs
TODO: The function name is misleading: in ContentBranchNodes it sets up inline slugs
- Inherited from:
- Source:
Setup a sparse array of booleans indicating where to place slugs
TODO: The function name is misleading: in ContentBranchNodes it sets up inline slugs
shift() → {ve.dm.BranchNode|undefined}
#
undefined}
#
Remove a child node from the beginning of the list.
Returns:
Removed childModel
- Type
-
ve.dm.BranchNode
|
undefined
- Inherited from:
- Source:
shouldIgnoreChildren()
#
- Inherited from:
- Source:
- See:
splice(index, deleteCount, […nodes]) → {Array.<ve.dm.BranchNode>}
#
Add and/or remove child nodes at an offset.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
index |
number | Index to remove and or insert nodes at |
|
deleteCount |
number | Number of nodes to remove |
|
nodes |
ve.dm.BranchNode |
optional repeatable |
Variadic list of nodes to insert |
Returns:
Removed nodes
- Type
- Array.<ve.dm.BranchNode>
Fires:
- Inherited from:
- Source:
suppressSlugType() → {string|null}
#
null}
#
A string identifier used to suppress slugs
If sequential nodes have the same non-null suppressSlugType, then no slug is shown, e.g. two floated images can return 'float' to suppress the slug between them.
Returns:
Type
- Type
-
string
|
null
- Inherited from:
- Source:
A string identifier used to suppress slugs
If sequential nodes have the same non-null suppressSlugType, then no slug is shown, e.g.
unshift(childModel) → {number}
#
Add a child node to the beginning of the list.
Parameters:
| Name | Type | Description |
|---|---|---|
childModel |
ve.dm.BranchNode | Item to add |
Returns:
New number of children
- Type
- number
- Inherited from:
- Source:
createData([options]) → {Array.<ve.dm.LinearData.Item>}static
#
Creates data that can be inserted into the model to create a new table row.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
optional |
Creation options Properties:
|
Returns:
Model data for a new table row
- Type
- Array.<ve.dm.LinearData.Item>
Events
attributeChange(key, oldValue, newValue)
#
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | |
oldValue |
any | |
newValue |
any |
- Inherited from:
- Source:
lengthChange(diff)
#
Parameters:
| Name | Type | Description |
|---|---|---|
diff |
number |
- Inherited from:
- Source:
splice(index, deleteCount, […nodes])
#
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
index |
number | ||
deleteCount |
number | ||
nodes |
ve.dm.BranchNode |
optional repeatable |
- Inherited from:
- Source:
- See:
update()
#
- Inherited from:
- Source: