Extends
Methods
compareTo(annotation) → {boolean}
#
Compare two annotations using #getComparableObject
Parameters:
Name | Type | Description |
---|---|---|
annotation |
ve.dm.Annotation | Other annotation to compare against |
- Inherited from:
- Source:
Returns:
Annotation is comparable
- Type
- boolean
compareToForSerialization(annotation) → {boolean}
#
FIXME T126039: Compare to another annotation for serialization
Compares two annotations using #getComparableObjectForSerialization, unless they are both generated annotations, in which case they must be identical.
Parameters:
Name | Type | Description |
---|---|---|
annotation |
ve.dm.Annotation | Annotation to compare to |
- Inherited from:
- Source:
Returns:
The other annotation is similar to this one
- Type
- boolean
FIXME T126039: Compare to another annotation for serialization
Compares two annotations using #getComparableObjectForSerialization, unless they are both generated annotations, in which case they must be identical.
describeAdded() → {Array}
#
Describe the addition of this annotation to some text
- Overrides:
- Source:
Returns:
Descriptions, list of strings or Node arrays
- Type
- Array
describeRemoved() → {Array}
#
Describe the removal of this annotation from some text
- Overrides:
- Source:
Returns:
Descriptions, list of strings or Node arrays
- Type
- Array
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 |
- Inherited from:
- Source:
Returns:
Value of attribute, or undefined if no such attribute exists
- Type
- any
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 |
- Inherited from:
- Source:
Returns:
Attributes
- Type
- Object
getClonedElement() → {Object}
#
Get a clone of the model's linear model element.
The attributes object will be deep-copied.
- Inherited from:
- Source:
Returns:
Cloned element object
- Type
- Object
getComparableHtmlAttributes() → {Object}
#
getComparableObject() → {Object}
#
Get an object containing comparable annotation properties.
This is used by the converter to merge adjacent annotations.
- Overrides:
- Source:
Returns:
An object containing a subset of the annotation's properties
- Type
- Object
getComparableObjectForSerialization() → {Object}
#
FIXME T126038: This method adds in HTML attributes so comparable objects aren't serialized together if they have different HTML attributes.
This method needs to be different from #getComparableObject which is still used for editing annotations.
- Inherited from:
- Source:
Returns:
An object containing a subset of the annotation's properties and HTML attributes
- Type
- Object
FIXME T126038: This method adds in HTML attributes so comparable objects aren't serialized together if they have different HTML attributes.
getDisplayTitle() → {string}
#
Get the display title for this link
Can be overridden by special link types.
Returns:
Display title
- Type
- string
Get the display title for this link
Can be overridden by special link types.
getElement() → {Object}
#
Get a reference to the linear model element.
- Inherited from:
- Source:
Returns:
Linear model element passed to the constructor, by reference
- Type
- Object
getFragment() → {string|null
}
#
null
}
#
Get the fragment / hash for the current href
Returns:
The fragment, or null if none is present
- Type
-
string
|
null
getHashObject() → {Object}
#
getHref() → {string}
#
Convenience wrapper for .getHref() on the current element.
- Source:
- See:
Returns:
Link href
- Type
- string
getOriginalDomElements(store) → {Array.<HTMLElement>}
#
Get the DOM element(s) this model was originally converted from, if any.
Parameters:
Name | Type | Description |
---|---|---|
store |
ve.dm.HashValueStore | Hash value store where the DOM elements are stored |
- Inherited from:
- Source:
Returns:
DOM elements this model was converted from, empty if not applicable
- Type
- Array.<HTMLElement>
getOriginalDomElementsHash() → {string|undefined
}
#
undefined
}
#
Get the DOM element(s) this model was originally converted from, if any.
- Inherited from:
- Source:
Returns:
Store hash of DOM elements this model was converted from
- Type
-
string
|
undefined
getStore() → {ve.dm.HashValueStore}
#
Get a reference to the hash-value store used by the element.
- Inherited from:
- Source:
Returns:
Hash-value store
- Type
- ve.dm.HashValueStore
getType() → {string}
#
Get the symbolic name of this model's type.
- Inherited from:
- Source:
Returns:
Type name
- Type
- string
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 |
- Inherited from:
- Source:
Returns:
Elements are of a comparable type
- Type
- boolean
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.
- Inherited from:
- Source:
Returns:
Whether this node is editable
- Type
- boolean
Check whether this node can be edited by a context item
The default implementation always returns true.
isGenerated() → {boolean}
#
Check if the annotation was generated by the converter
Used by compareToForSerialization to avoid merging generated annotations.
- Inherited from:
- Source:
Returns:
The annotation was generated
- Type
- boolean
Check if the annotation was generated by the converter
Used by compareToForSerialization to avoid merging generated annotations.
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.
- Inherited from:
- Source:
Returns:
Whether this node is inspectable
- Type
- boolean
getHref(dataElement) → {string}static
#
Get the link href from linear data. Helper function for toDomElements.
Subclasses can override this if they provide complex href computation.
Parameters:
Name | Type | Description |
---|---|---|
dataElement |
Object | Linear model element |
Returns:
Link href
- Type
- string