Extends
Constructor
new ve.ce.DivNode(model, [config])
#
ContentEditable div node.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
model |
ve.dm.DivNode | Model to observe |
|
config |
Object |
optional |
Configuration options |
- Source:
Methods
autoFocus() → {boolean}
#
Check if the node can take the cursor when its surface is focused
Returns:
Node can be take the cursor
- Type
- boolean
- Inherited from:
- Source:
canContainContent()
#
- Inherited from:
- Source:
- See:
canHaveChildren()
#
- Inherited from:
- Source:
- See:
canHaveChildrenNotContent()
#
- Inherited from:
- Source:
- See:
destroy()
#
Release all memory.
- Inherited from:
- Source:
detach()
#
- Inherited from:
- Source:
getChildNodeTypes()
#
- Inherited from:
- Source:
- See:
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 |
Returns:
The DOM position; guaranteed to be this node's final DOM node
- Type
- ve.ce.NodeAndOffset
- Inherited from:
- Source:
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
getLength()
#
- Inherited from:
- Source:
- See:
getModel() → {ve.dm.Model}
#
Get the model the view observes.
Returns:
Model the view observes
- Type
- ve.dm.Model
- Inherited from:
- Source:
getModelHtmlDocument() → {HTMLDocument}
#
getOffset()
#
- Inherited from:
- Source:
- See:
getOuterLength()
#
- Inherited from:
- Source:
- See:
getParentNodeTypes()
#
- Inherited from:
- Source:
- See:
getResolvedAttribute(key) → {string}
#
Get a resolved URL from a model attribute.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string | Attribute name whose value is a URL |
Returns:
URL resolved according to the document's base
- Type
- string
- Inherited from:
- Source:
getSlugAtOffset(offset) → {HTMLElement|null}
#
null}
#
Get a slug at an offset.
Parameters:
| Name | Type | Description |
|---|---|---|
offset |
number | Offset to get slug at |
Returns:
- Type
-
HTMLElement
|
null
- Inherited from:
- Source:
getSuggestedParentNodeTypes()
#
- Inherited from:
- Source:
- See:
handlesOwnChildren()
#
- Inherited from:
- Source:
- See:
hasSignificantWhitespace()
#
- Inherited from:
- Source:
- See:
initialize()
#
Initialize this.$element. This is called by the constructor and should be called every time this.$element is replaced.
- Inherited from:
- Source:
isAlignable()
#
- Inherited from:
- Source:
- See:
isCellEditable()
#
- Inherited from:
- Source:
- See:
isCellable()
#
- Inherited from:
- Source:
- See:
isContent()
#
- Inherited from:
- Source:
- See:
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()
#
- Inherited from:
- Source:
- See:
isLive() → {boolean}
#
Check if the view is attached to the live DOM.
Returns:
View is attached to the live DOM
- Type
- boolean
- Inherited from:
- Source:
isMetaData()
#
- Inherited from:
- Source:
- See:
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.
Returns:
Node supports multiline input
- Type
- boolean
- Inherited from:
- Source:
isUnwrappable()
#
- Inherited from:
- Source:
- See:
isWrapped()
#
- Inherited from:
- Source:
- See:
onModelUpdate(transaction)
#
Handles model update events.
Parameters:
| Name | Type | Description |
|---|---|---|
transaction |
ve.dm.Transaction |
- Inherited from:
- Source:
onSetup()
#
Handle setup event.
- Inherited from:
- Source:
onSlugClick(slugNode)
#
Handle slug click events
Parameters:
| Name | Type | Description |
|---|---|---|
slugNode |
HTMLElement | Slug node clicked |
- Inherited from:
- Source:
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:
onTeardown()
#
Handle teardown event.
- Inherited from:
- Source:
removeEmptyLastChildOnEnter() → {boolean}
#
Check if the node removes its empty last child on 'enter'.
Returns:
Node removes empty last child on 'enter'
- Type
- boolean
- Inherited from:
- Source:
removeSlugs()
#
Remove all slugs in this branch
- Inherited from:
- Source:
setLive(live)
#
Set live state on child nodes.
Parameters:
| Name | Type | Description |
|---|---|---|
live |
boolean | New live state |
- Inherited from:
- Source:
setupBlockSlugs()
#
Setup block slugs
- Inherited from:
- Source:
setupInlineSlugs()
#
Setup inline slugs
- Inherited from:
- Source:
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:
shouldIgnoreChildren()
#
- Inherited from:
- Source:
- See:
splitOnEnter() → {boolean}
#
Check if the node can be split.
Returns:
Node can be split
- Type
- boolean
- Inherited from:
- Source:
trapsCursor() → {boolean}
#
Check if the node traps cursor when active
Returns:
Node traps cursor
- Type
- boolean
- Inherited from:
- Source:
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.
Fires:
- Inherited from:
- Source:
Events
setup()
#
- Inherited from:
- Source:
teardown()
#
- Inherited from:
- Source: