Constructor
new ve.dm.InternalList(doc)
#
DataModel meta item.
Parameters:
Name | Type | Description |
---|---|---|
doc |
ve.dm.Document | Document model |
- Mixes in:
- Source:
Methods
addNode(groupName, key, index, node)
#
Add a node.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Item group |
key |
string | Item name |
index |
number | Item index |
node |
ve.dm.Node | Item node |
- Source:
clone([doc]) → {ve.dm.InternalList}
#
Clone this internal list.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
doc |
ve.dm.Document |
optional |
The new list's document. Defaults to this list's document. |
- Source:
Returns:
Clone of this internal
- Type
- ve.dm.InternalList
convertToData(converter, doc) → {Array}
#
Converts stored item HTML into linear data.
Each item is an InternalItem, and they are wrapped in an InternalList. If there are no items an empty array is returned.
Stored HTML is deleted after conversion.
Parameters:
Name | Type | Description |
---|---|---|
converter |
ve.dm.Converter | |
doc |
HTMLDocument | Document to create nodes in |
- Source:
Returns:
Linear model data
- Type
- Array
getDocument() → {ve.dm.Document}
#
getIndexPosition(groupName, key) → {number}
#
Get position of a key within a group
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Name of the group |
key |
string | Name of the key |
- Source:
Returns:
Position within the key ordering for that group
- Type
- number
getItemHtmlQueue() → {Object}
#
Gets all the item's HTML strings
- Source:
Returns:
Name-indexed object containing HTMLElements
- Type
- Object
getItemInsertion(groupName, key, data) → {Object}
#
Generate a transaction for inserting a new internal item node
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Item group |
key |
string | Item key |
data |
Array | Linear model data |
- Source:
Returns:
Object containing the transaction (or null if none required) and the new item's index within the list
- Type
- Object
getItemNode(index) → {ve.dm.InternalItemNode}
#
Get the item node from a specific index.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | Item index |
- Source:
Returns:
Item node
getItemNodeCount() → {number}
#
Get the number it internal items in the internal list.
- Source:
Returns:
- Type
- number
getKeyIndex(groupName, key) → {number|undefined
}
#
undefined
}
#
Get the internal item index of a group key if it already exists
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Item group |
key |
string | Item name |
- Source:
Returns:
The index of the group key, or undefined if it doesn't exist yet
- Type
-
number
|
undefined
getListNode() → {ve.dm.InternalListNode}
#
Get the list node
- Source:
Returns:
List node
getNextUniqueNumber() → {number}
#
Get the next number in a monotonically increasing series.
- Source:
Returns:
One higher than the return value of the previous call, or 0 on the first call
- Type
- number
getNodeGroup(groupName) → {Object|undefined
}
#
undefined
}
#
Get the node group object for a specified group name.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Name of the group |
- Source:
Returns:
Node group object, containing nodes and key order array
- Type
-
Object
|
undefined
getNodeGroups() → {Object.<string, Object>}
#
Get all node groups.
- Source:
Returns:
Node groups, keyed by group name
getUniqueListKey(groupName, oldListKey, prefix) → {string}
#
Get a unique list key for a given group.
The returned list key is added to the list of unique list keys used in this group so that it won't be allocated again. It will also be associated to oldListKey so that if the same oldListKey is passed in again later, the previously allocated name will be returned.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Name of the group |
oldListKey |
string | Current list key to associate the generated list key with |
prefix |
string | Prefix to distinguish generated keys from non-generated ones |
- Source:
Returns:
Generated unique list key, or existing unique key associated with oldListKey
- Type
- string
markGroupAsChanged(groupName)
#
Mark a node group as having been changed since the last transaction.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Name of group which has changed |
- Source:
merge(list, commonLength) → {Object}
#
Merge another internal list into this one.
This function updates the state of this list, and returns a mapping from indexes in list to indexes in this, as well as a set of ranges that should be copied from list's linear model into this list's linear model by the caller.
Parameters:
Name | Type | Description |
---|---|---|
list |
ve.dm.InternalList | Internal list to merge into this list |
commonLength |
number | The number of elements, counted from the beginning, that the lists have in common |
- Source:
Returns:
'mapping' is an object mapping indexes in list to indexes in this; newItemRanges is an array of ranges of internal nodes in list's document that should be copied into our document
- Type
- Object
onTransact()
#
Handle document transaction events
- Source:
Fires:
queueItemHtml(groupName, key, html) → {Object}
#
Queues up an item's html for parsing later.
If an item with the specified group and key already exists it will be ignored, unless the data already stored is an empty string.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Item group |
key |
string | Item key |
html |
string | Item contents |
- Source:
Returns:
Object containing index of the item in the index-value store (and also its index in the internal list node), and a flag indicating if it is a new item.
- Type
- Object
removeNode(groupName, key, index, node)
#
Remove a node.
Parameters:
Name | Type | Description |
---|---|---|
groupName |
string | Item group |
key |
string | Item name |
index |
number | Item index |
node |
ve.dm.Node | Item node |
- Source:
sortGroupIndexes(group)
#
Sort the indexOrder array within a group object.
Items are sorted by the start offset of their firstNode, unless that node has the 'placeholder' attribute, in which case it moved to the end of the list, where it should be ignored.
Parameters:
Name | Type | Description |
---|---|---|
group |
Object |
- Source: