Extends
Constructor
new ve.ce.Annotation(model, [parentNode], [config])abstract
#
Hierarchy
Children
Generic ContentEditable annotation.
This is an abstract class, annotations should extend this and call this constructor from their constructor. You should not instantiate this class directly.
Subclasses of ve.dm
.Annotation should have a corresponding subclass here that controls rendering.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
model |
ve.dm.Annotation | Model to observe |
|
parentNode |
ve.ce.ContentBranchNode |
optional |
Node rendering this annotation |
config |
Object |
optional |
Configuration options |
- Source:
Properties
canBeActivestatic
#
Annotations which can be active get a ve-ce-annotation-active class when focused.
- Source:
Methods
appendChild(childNode)
#
Append a child node to the annotation
Parameters:
Name | Type | Description |
---|---|---|
childNode |
Node | Child node to append |
- Source:
appendTo(node)
#
Append the completed annotation to a parent node
#attachContents should have been called first
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | Parent node |
- Source:
Append the completed annotation to a parent node
#attachContents should have been called first
attachContents()
#
Attach completed contents to the annotation as descendant nodes, if not already attached
No further contents should be appended into the content container after calling this
- Source:
Attach completed contents to the annotation as descendant nodes, if not already attached
No further contents should be appended into the content container after calling this
canBeActive() → {boolean}
#
Check if the annotation can be active
- Source:
Returns:
- Type
- boolean
destroy()
#
Release all memory
- Overrides:
- Source:
getContentContainer() → {HTMLElement}
#
Get the container into which annotation contents should be appended
- Source:
Returns:
Content container
- Type
- HTMLElement
getModel() → {ve.dm.Model}
#
Get the model the view observes.
- Inherited from:
- Source:
Returns:
Model the view observes
- Type
- ve.dm.Model
getModelHtmlDocument() → {HTMLDocument|null
}
#
null
}
#
Get an HTML document from the model, to use for URL resolution.
The default implementation returns null; subclasses should override this if they can provide a resolution document.
- Overrides:
- Source:
- See:
Returns:
HTML document to use for resolution, or null if not available
- Type
-
HTMLDocument
|
null
getParentNode() → {ve.ce.ContentBranchNode|null
}
#
null
}
#
Get the content branch node this annotation is rendered in, if any.
- Source:
Returns:
Content branch node or null if none
- Type
-
ve.ce.ContentBranchNode
|
null
getResolvedAttribute(key) → {string}
#
Get a resolved URL from a model attribute.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Attribute name whose value is a URL |
- Inherited from:
- Source:
Returns:
URL resolved according to the document's base
- Type
- string
initialize()
#
Initialize this.$element. This is called by the constructor and should be called every time this.$element is replaced.
- Inherited from:
- Source:
isLive() → {boolean}
#
Check if the view is attached to the live DOM.
- Inherited from:
- Source:
Returns:
View is attached to the live DOM
- Type
- boolean
onSetup()
#
Handle setup event.
- Inherited from:
- Source:
onTeardown()
#
Handle teardown event.
- Inherited from:
- Source:
setLive(live)
#
Set live state.
Parameters:
Name | Type | Description |
---|---|---|
live |
boolean | The view has been attached to the live DOM (use false on detach) |
- Inherited from:
- Source:
Fires:
getDescription(annotation) → {string}static
#
Get a plain text description.
Parameters:
Name | Type | Description |
---|---|---|
annotation |
ve.dm.Annotation | Annotation model |
- Source:
Returns:
Description of annotation
- Type
- string
Events
setup()
#
- Inherited from:
- Source:
teardown()
#
- Inherited from:
- Source: