Expand all

ve.ce

Namespace for all VisualEditor ContentEditable classes, static methods and static properties.

Classes

AbbreviationAnnotation
ContentEditable abbreviation annotation.
ActiveNode

Active nodes are editable sections that are nested inside uneditable sections.

AlienBlockNode
ContentEditable alien block node.
AlienInlineNode
ContentEditable alien inline node.
AlienNode
ContentEditable alien node.
AlienTableCellNode
ContentEditable alien table cell node.
AlignableNode
ContentEditable Alignable node.
Annotation
Generic ContentEditable annotation.
AnnotationFactory
ContentEditable annotation factory.
ArticleNode
ContentEditable article node.
BidiAnnotation
ContentEditable bi-di annotation.
BigAnnotation
ContentEditable big annotation.
BlockImageCaptionNode
ContentEditable block image caption item node.
BlockImageNode
ContentEditable block image node.
BlockquoteNode
ContentEditable Blockquote node.
BoldAnnotation
ContentEditable bold annotation.
BranchNode
ContentEditable branch node.
BreakNode
ContentEditable break node.
CenterNode
ContentEditable center node.
CheckListItemNode
ContentEditable list item node.
CheckListNode
ContentEditable list node.
ClassAttributeNode
ContentEditable class-attribute node.
CodeAnnotation
ContentEditable code annotation.
CodeSampleAnnotation
ContentEditable code sample annotation.
CommentAnnotation
ContentEditable comment annotation.
CommentNode
ContentEditable comment node.
ContentBranchNode
ContentEditable content branch node.
ContentEditableNode
A ContentEditableNode maintains its own contentEditable property
DatetimeAnnotation
ContentEditable datetime annotation.
DefinitionAnnotation
ContentEditable definition annotation.
DefinitionListItemNode
ContentEditable definition list item node.
DefinitionListNode
ContentEditable definition list node.
DeleteAnnotation
ContentEditable delete annotation.
DivNode
ContentEditable div node.
Document
ContentEditable document.
DocumentNode
ContentEditable document node.
FocusableNode
ContentEditable focusable node.
FontAnnotation
ContentEditable font annotation.
GeneratedContentNode
ContentEditable generated content node.
HeadingNode
ContentEditable heading node.
HighlightAnnotation
ContentEditable highlight annotation.
HorizontalRuleNode
ContentEditable horizontal rule node.
ImageNode
ContentEditable image node.
ImportedDataAnnotation
ContentEditable imported data (paste/drag and drop) annotation.
InlineImageNode
ContentEditable inline image node.
InsertAnnotation
ContentEditable insert annotation.
InternalItemNode
ContentEditable internal item node.
InternalListNode
ContentEditable internal list node.
ItalicAnnotation
ContentEditable italic annotation.
KeyDownHandler
Key down handler.
KeyDownHandlerFactory
Key down handler factory.
LanguageAnnotation
ContentEditable language annotation.
LeafNode
ContentEditable leaf node.
LinearArrowKeyDownHandler
Arrow key down handler for linear selections.
LinearDeleteKeyDownHandler
Delete key down handler for linear selections.
LinearEnterKeyDownHandler
Enter key down handler for linear selections.
LinearEscapeKeyDownHandler
Escape key down handler for linear selections.
LinearSelection
LinearTabKeyDownHandler
Tab key down handler for linear selections.
LinkAnnotation
ContentEditable link annotation.
ListItemNode
ContentEditable list item node.
ListNode
ContentEditable list node.
MetaItem
ContentEditable meta item node.
NailedAnnotation
ContentEditable nailed annotation.
Node
Generic ContentEditable node.
NodeFactory
ContentEditable node factory.
NullSelection
ParagraphNode
ContentEditable paragraph node.
PreformattedNode
ContentEditable preformatted node.
QuotationAnnotation
ContentEditable quotation annotation.
RangeState
ContentEditable range state (a snapshot of CE selection/content state)
ResizableNode
ContentEditable resizable node.
SectionNode
ContentEditable section node.
Selection
SmallAnnotation
ContentEditable small annotation.
SpanAnnotation
ContentEditable span annotation.
StrikethroughAnnotation
ContentEditable strikethrough annotation.
SubscriptAnnotation
ContentEditable subscript annotation.
SuperscriptAnnotation
ContentEditable superscript annotation.
Surface
ContentEditable surface.
SurfaceObserver
ContentEditable surface observer.
TableArrowKeyDownHandler
Arrow key down handler for table selections.
TableCaptionNode
ContentEditable table caption node.
TableCellNode
ContentEditable table cell node.
TableCellableNode
ContentEditable node which can behave as a table cell
TableDeleteKeyDownHandler
Delete key down handler for table selections.
TableNode
ContentEditable table node.
TableRowNode
ContentEditable table row node.
TableSectionNode
ContentEditable table section node.
TableSelection
TextNode
ContentEditable text node.
TextState
Annotated text content state (a snapshot of node content)
TextStateChunk
Uniformly annotated chunk of text content
TextStyleAnnotation
ContentEditable text style annotation.
UnderlineAnnotation
ContentEditable underline annotation.
UnrenderedNode

ContentEditable unrendered node

Used for nodes which aren't children of attachedRoot

Can be linked to any type of model node.

UserInputAnnotation
ContentEditable user input annotation.
VariableAnnotation
ContentEditable variable annotation.
View
Generic base class for CE views.

Properties

minImgDataUristatic #

Data URI for minimal GIF image. This is the smallest technically-valid 1x1px transparent GIF it's possible to create.

Source:
Data URI for minimal GIF image.

Methods

ClipboardHandler(surface)static #

Clipboard handler

Handles copy and paste events on the surface.

Parameters:

Name Type Description
surface ve.ce.Surface
Source:

Clipboard handler

Handles copy and paste events on the surface.

DragDropHandler(surface)static #

Drag and drop handler

Parameters:

Name Type Description
surface ve.ce.Surface
Source:
Drag and drop handler

SelectionManager(surface)static #

Selection manager

Handles rendering of fake selections on the surface:

  • The deactivated selection stands in the user's native selection when the native selection is moved elsewhere (e.g. an inspector, or a dropdown menu).
  • In a multi-user environment, other users' selections from the surface synchronizer are rendered here.
  • Other tools can manually render fake selections, e.g. the FindAndReplaceDialog can highlight matched text, by calling #drawSelections directly.

Parameters:

Name Type Description
surface ve.ce.Surface
Source:

Selection manager

Handles rendering of fake selections on the surface:

  • The deactivated selection stands in the user's native selection when the native selection is moved elsewhere (e.g.

getDomHash(element) → {string}static #

Gets a hash of a DOM element's structure.

In the returned string text nodes are represented as "#" and elements are represented as "" and "" where "type" is their element name. This effectively generates an HTML serialization without any attributes or text contents. This can be used to observe structural changes.

Parameters:

Name Type Description
element HTMLElement

DOM element to get hash of

Source:

Returns:

Hash of DOM element

Type
string
Gets a hash of a DOM element's structure.

getDomText(element) → {string}static #

Gets the plain text of a DOM element (that is a node canContainContent === true)

In the returned string only the contents of text nodes are included, and the contents of non-editable elements are excluded (but replaced with the appropriate number of snowman characters so the offsets match up with the linear model).

Parameters:

Name Type Description
element HTMLElement

DOM element to get text of

Source:

Returns:

Plain text of DOM element

Type
string

Gets the plain text of a DOM element (that is a node canContainContent === true)

In the returned string only the contents of text nodes are included, and the contents of non-editable elements are excluded (but replaced with the appropriate number of snowman characters so the offsets match up with the linear model).

getOffset(domNode, domOffset) → {number}static #

Gets the linear offset from a given DOM node and offset within it.

Parameters:

Name Type Description
domNode HTMLElement

DOM node

domOffset number

DOM offset within the DOM node

Source:

Returns:

Linear model offset

Type
number

Throws:

  • domOffset is out of bounds

    Type
    Error
  • domNode has no ancestor with a .data( 'view' )

    Type
    Error
  • domNode is not in document

    Type
    Error
Gets the linear offset from a given DOM node and offset within it.

getOffsetOfSlug(element) → {number}static #

Gets the linear offset of a given slug

Parameters:

Name Type Description
element HTMLElement

Slug DOM element

Source:

Returns:

Linear model offset

Type
number

Throws:

Gets the linear offset of a given slug

isAfterAnnotationBoundary(node, offset) → {boolean}static #

Test whether the DOM position lies straight after annotation boundaries

"Straight after" means that in document order, there are annotation open/close tags immediately before the position, and there are none immediately after.

This is important for cursors: the DM position is ambiguous with respect to annotation boundaries, and the browser does not fully distinguish this position from the preceding position immediately before the annotation boundaries (e.g. 'a|<b>c' and 'a<b>|c'), but the two positions behave differently for insertions (in this case, whether the text appears bolded or not).

In Chromium, cursor focus normalizes to the earliest (in document order) of equivalent positions, at least in reasonably-styled non-BIDI text. But in Firefox, the user can cursor/click into either the earliest or the latest equivalent position: the cursor lands in the closest (in document order) to the click location (for mouse actions) or cursor start location (for cursoring).

Parameters:

Name Type Description
node Node

Position node

offset number

Position offset

Source:

Returns:

Whether this is the end-most of multiple cursor-equivalent positions

Type
boolean

Test whether the DOM position lies straight after annotation boundaries

"Straight after" means that in document order, there are annotation open/close tags immediately before the position, and there are none immediately after.

isAnnotationElement(element) → {boolean}static #

Check whether a given DOM element is an inline annotation

Parameters:

Name Type Description
element Node

The element

Source:

Returns:

Whether the element is an inline annotation

Type
boolean
Check whether a given DOM element is an inline annotation

isShortcutKey(e) → {boolean}static #

Check if keyboard shortcut modifier key is pressed.

Parameters:

Name Type Description
e jQuery.Event

Key press event

Source:

Returns:

Modifier key is pressed

Type
boolean
Check if keyboard shortcut modifier key is pressed.

nailedAnnotationAt(node) → {Node|null}static #

Find the closest nailed annotation in which a node lies

Parameters:

Name Type Description
node Node | null

The node to test

Source:

Returns:

The closest nailed annotation within which the node lies (possibly the node itself)

Type
Node | null
Find the closest nailed annotation in which a node lies

nextCursorOffset(node) → {ve.ce.NodeAndOffset}static #

Get the first cursor offset immediately after a node.

Parameters:

Name Type Description
node Node

DOM node

Source:

Returns:

Type
ve.ce.NodeAndOffset
Get the first cursor offset immediately after a node.

previousCursorOffset(node) → {ve.ce.NodeAndOffset}static #

Get the first cursor offset immediately before a node.

Parameters:

Name Type Description
node Node

DOM node

Source:

Returns:

Type
ve.ce.NodeAndOffset
Get the first cursor offset immediately before a node.

veRangeFromSelection(selection) → {ve.Range|null}static #

Find the DM range of a DOM selection

Parameters:

Name Type Description
selection Object

DOM-selection-like object

Properties:
Name Type Description
anchorNode Node
anchorOffset number
focusNode Node
focusOffset number
Source:

Returns:

DM range, or null if nothing in the CE document is selected

Type
ve.Range | null
Find the DM range of a DOM selection

Type Definitions

ClipboardData #

Type:

Properties:

Name Type Description
clipboardKey string | undefined

Clipboard key, if present

$clipboardHtml jQuery | undefined

Clipboard html, if used to extract the clipboard key

slice ve.dm.DocumentSlice | undefined

Relevant slice of this document, if the key points to it

Source:

NodeAndOffset #