Expand all

abstract ve.ce.Annotation

Extends

Constructor

new ve.ce.Annotation(model, [parentNode], [config])abstract #

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:
Generic ContentEditable annotation.

Properties

canBeActivestatic #

Annotations which can be active get a ve-ce-annotation-active class when focused.

Source:
Annotations which can be active get a ve-ce-annotation-active class when focused.

Methods

appendChild(childNode) #

Append a child node to the annotation

Parameters:

Name Type Description
childNode Node

Child node to append

Source:
Append a child node to the annotation

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
Check if the annotation can be active

destroy() #

Release all memory

Overrides:
Source:
Release all memory

getContentContainer() → {HTMLElement} #

Get the container into which annotation contents should be appended

Source:

Returns:

Content container

Type
HTMLElement
Get the container into which annotation contents should be appended

getModel() → {ve.dm.Model} #

Get the model the view observes.

Inherited from:
Source:

Returns:

Model the view observes

Type
ve.dm.Model
Get the model the view observes.

getModelHtmlDocument() → {HTMLDocument|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
Get an HTML document from the model, to use for URL resolution.

getParentNode() → {ve.ce.ContentBranchNode|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
Get the content branch node this annotation is rendered in, if any.

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
Get a resolved URL from a model attribute.

initialize() #

Initialize this.$element. This is called by the constructor and should be called every time this.$element is replaced.

Inherited from:
Source:
Initialize this.$element.

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
Check if the view is attached to the live DOM.

onSetup() #

Handle setup event.

Inherited from:
Source:
Handle setup event.

onTeardown() #

Handle teardown event.

Inherited from:
Source:
Handle teardown event.

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:

Set live state.

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
Get a plain text description.

Events

setup() #

teardown() #