Expand all

ve.ce.TableNode

Extends

Constructor

new ve.ce.TableNode(model, [config]) #

ContentEditable table node.

Parameters:

Name Type Attributes Description
model ve.dm.TableNode

Model to observe

config Object optional

Configuration options

Source:
ContentEditable table node.

Methods

autoFocus() → {boolean} #

Check if the node can take the cursor when its surface is focused

Inherited from:
Source:

Returns:

Node can be take the cursor

Type
boolean
Check if the node can take the cursor when its surface is focused

canContainContent() #

canHaveChildren() #

canHaveChildrenNotContent() #

destroy() #

Release all memory.

Inherited from:
Source:
Release all memory.

detach() #

getActiveCellNode() → {ve.ce.TableNode|null} #

Get the active node in this table, if it has one

Source:

Returns:

The active cell node in this table

Type
ve.ce.TableNode | null
Get the active node in this table, if it has one

getCellNodeFromEvent(e) → {ve.ce.TableCellNode|null} #

Get a table cell node from a mouse event

Works around various issues with touch events and browser support.

Parameters:

Name Type Description
e jQuery.Event

Mouse event

Source:

Returns:

Table cell node

Type
ve.ce.TableCellNode | null

Get a table cell node from a mouse event

Works around various issues with touch events and browser support.

getCellNodeFromPoint(x, y) → {ve.ce.TableCellNode|null} #

Get the cell node from a point

Parameters:

Name Type Description
x number

X offset

y number

Y offset

Source:

Returns:

Table cell node, or null if none found

Type
ve.ce.TableCellNode | null
Get the cell node from a point

getCellNodesFromSelection(selection) → {Array.<ve.ce.TableCellNode>} #

Get a cell node from a single cell selection

Parameters:

Name Type Description
selection ve.dm.TableSelection

Single cell table selection

Source:

Returns:

Cell nodes

Type
Array.<ve.ce.TableCellNode>
Get a cell node from a single cell selection

getChildNodeTypes() #

getDomPosition(offset) → {ve.ce.NodeAndOffset} #

Get the DOM position (node and offset) corresponding to a position in this node

The node/offset have the same semantics as a DOM Selection focusNode/focusOffset

Parameters:

Name Type Description
offset number

The offset inside this node of the required position

Inherited from:
Source:

Returns:

The DOM position; guaranteed to be this node's final DOM node

Type
ve.ce.NodeAndOffset

Get the DOM position (node and offset) corresponding to a position in this node

The node/offset have the same semantics as a DOM Selection focusNode/focusOffset

getFirstSectionNode() → {ve.ce.TableSectionNode} #

Get the first section node of the table, skipping over any caption nodes

Source:

Returns:

First table section node

Type
ve.ce.TableSectionNode
Get the first section node of the table, skipping over any caption nodes

getLength() #

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} #

Get the model's HTML document

Inherited from:
Source:

Returns:

Model document

Type
HTMLDocument
Get the model's HTML document

getNearestCellNode(element) → {ve.ce.TableCellNode|null} #

Get the nearest cell node in this table to an element

If the nearest cell node is in another table, return null.

Parameters:

Name Type Description
element HTMLElement

Element target to find nearest cell node to

Source:

Returns:

Table cell node, or null if none found

Type
ve.ce.TableCellNode | null

Get the nearest cell node in this table to an element

If the nearest cell node is in another table, return null.

getOffset() #

getOuterLength() #

getParentNodeTypes() #

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.

getSlugAtOffset(offset) → {HTMLElement|null} #

Get a slug at an offset.

Parameters:

Name Type Description
offset number

Offset to get slug at

Inherited from:
Source:

Returns:

Type
HTMLElement | null
Get a slug at an offset.

getSuggestedParentNodeTypes() #

handlesOwnChildren() #

hasSignificantWhitespace() #

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.

isAlignable() #

isCellEditable() #

isCellable() #

isContent() #

isFocusable() #

If this is set to true it should implement:

setFocused( boolean val )
boolean isFocused()
Inherited from:
Source:
See:

If this is set to true it should implement:

setFocused( boolean val )
boolean isFocused()

isInternal() #

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.

isMetaData() #

isMultiline() → {boolean} #

Check if the node is supports multiline input.

Traverses upstream until a boolean value is found. If no value is found, reads the default from the surface.

Inherited from:
Source:

Returns:

Node supports multiline input

Type
boolean
Check if the node is supports multiline input.

isUnwrappable() #

isWrapped() #

onModelUpdate(transaction) #

Handles model update events.

Parameters:

Name Type Description
transaction ve.dm.Transaction
Inherited from:
Source:
Handles model update events.

onSetup() #

Handle setup event.

Overrides:
Source:
Handle setup event.

onSlugClick(slugNode) #

Handle slug click events

Parameters:

Name Type Description
slugNode HTMLElement

Slug node clicked

Inherited from:
Source:
Handle slug click events

onSplice(index, deleteCount, […modelNodes]) #

Handle splice events.

ve.ce.Node objects are generated from the inserted ve.dm.Node objects, producing a view that's a mirror of its model.

Parameters:

Name Type Attributes Description
index number

Index to remove and or insert nodes at

deleteCount number

Number of nodes to remove

modelNodes ve.dm.BranchNode optional
repeatable

Variadic list of nodes to insert

Inherited from:
Source:
Handle splice events.

onSurfaceActivation() #

Handle activation events from the surface

Source:
Handle activation events from the surface

onSurfaceModelSelect(selection) #

Handle select events from the surface model.

Parameters:

Name Type Description
selection ve.dm.Selection
Source:
Handle select events from the surface model.

onTableDblClick(e) #

Handle table double click events

Parameters:

Name Type Description
e jQuery.Event

Double click event

Source:
Handle table double click events

onTableMouseDown(e) #

Handle mouse down or touch start events

Parameters:

Name Type Description
e jQuery.Event

Mouse down or touch start event

Source:
Handle mouse down or touch start events

onTableMouseMove(e) #

Handle mouse/touch move events

Parameters:

Name Type Description
e jQuery.Event

Mouse/touch move event

Source:
Handle mouse/touch move events

onTableMouseUp(e) #

Handle mouse up or touch end events

Parameters:

Name Type Description
e jQuery.Event

Mouse up or touch end event

Source:
Handle mouse up or touch end events

onTeardown() #

Handle teardown event.

Overrides:
Source:
Handle teardown event.

removeEmptyLastChildOnEnter() → {boolean} #

Check if the node removes its empty last child on 'enter'.

Inherited from:
Source:

Returns:

Node removes empty last child on 'enter'

Type
boolean
Check if the node removes its empty last child on 'enter'.

removeSlugs() #

Remove all slugs in this branch

Inherited from:
Source:
Remove all slugs in this branch

setEditing(isEditing, noSelect) #

Set the editing state of the table

Parameters:

Name Type Description
isEditing boolean

The table is being edited

noSelect boolean

Don't change the selection

Source:
Set the editing state of the table

setLive(live) #

Set live state on child nodes.

Parameters:

Name Type Description
live boolean

New live state

Inherited from:
Source:
Set live state on child nodes.

setupBlockSlugs() #

Setup block slugs

Inherited from:
Source:
Setup block slugs

setupInlineSlugs() #

Setup inline slugs

Inherited from:
Source:
Setup inline slugs

setupSlugs(isBlock) #

Setup slugs where needed.

Existing slugs will be removed before new ones are added.

Parameters:

Name Type Description
isBlock boolean

Set up block slugs, otherwise setup inline slugs

Inherited from:
Source:
Setup slugs where needed.

shouldIgnoreChildren() #

splitOnEnter() → {boolean} #

Check if the node can be split.

Inherited from:
Source:

Returns:

Node can be split

Type
boolean
Check if the node can be split.

trapsCursor() → {boolean} #

Check if the node traps cursor when active

Inherited from:
Source:

Returns:

Node traps cursor

Type
boolean
Check if the node traps cursor when active

updateOverlay() #

Update the overlay positions

Source:
Update the overlay positions

updateTagName() #

Update the DOM wrapper.

WARNING: The contents, .data( 'view' ), the contentEditable property and any classes the wrapper already has will be moved to the new wrapper, but other attributes and any other information added using $.data() will be lost upon updating the wrapper. To retain information added to the wrapper, subscribe to the 'teardown' and 'setup' events, or override #initialize.

Inherited from:
Source:

Fires:

Update the DOM wrapper.

Events

setup() #

teardown() #