Extends
Constructor
new ve.ce.HeadingNode(model, [config])
#
Hierarchy
ContentEditable heading node.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
model |
ve.dm.HeadingNode | 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
- Inherited from:
- Source:
Returns:
Node can be take the cursor
- Type
- boolean
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 |
- 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
getLength()
#
- Inherited from:
- Source:
- See:
getModel() → {ve.dm.Model}
#
Get the model the view observes.
- Inherited from:
- Source:
Returns:
Model the view observes
- Type
- ve.dm.Model
getModelHtmlDocument() → {HTMLDocument}
#
getOffset()
#
- Inherited from:
- Source:
- See:
getOuterLength()
#
- Inherited from:
- Source:
- See:
getParentNodeTypes()
#
- Inherited from:
- Source:
- See:
getRenderedContents() → {ve.ce.ContentBranchNode.HTMLElementWithUnicorn}
#
Get an HTML rendering of the contents.
If you are actually going to append the result to a DOM, you need to do this with #appendRenderedContents, which resolves the cloned nodes returned by this function back to their originals.
- Inherited from:
- Source:
Returns:
Wrapper containing rendered contents
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
getSlugAtOffset(offset) → {HTMLElement|null
}
#
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
getSuggestedParentNodeTypes()
#
- Inherited from:
- Source:
- See:
getTagName() → {string}
#
Get the HTML tag name.
Tag name is selected based on the model's level attribute.
- Source:
Returns:
HTML tag name
- Type
- string
Throws:
-
If level is invalid
- Type
- Error
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.
- Overrides:
- 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.
- Inherited from:
- Source:
Returns:
View is attached to the live DOM
- Type
- boolean
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.
- Inherited from:
- Source:
Returns:
Node supports multiline input
- Type
- boolean
isUnwrappable()
#
- Inherited from:
- Source:
- See:
isWrapped()
#
- Inherited from:
- Source:
- See:
onChildUpdate(transaction)
#
Handle childUpdate events.
Rendering is only done once per transaction. If a paragraph has multiple nodes in it then it's
possible to receive multiple childUpdate
events for a single transaction such as annotating
across them. State is tracked by storing and comparing the length of the surface model's complete
history.
This is used to automatically render contents.
Parameters:
Name | Type | Description |
---|---|---|
transaction |
ve.dm.Transaction |
- Inherited from:
- Source:
onClick(e)
#
Handle click events.
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Click event |
- Inherited from:
- Source:
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:
onUpdate()
#
Handle model update events.
If the level changed since last update the DOM wrapper will be replaced with an appropriate one.
- Source:
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
removeSlugs()
#
Remove all slugs in this branch
- Inherited from:
- Source:
renderContents() → {boolean}
#
Render contents.
- Inherited from:
- Source:
Returns:
Whether the contents have changed
- Type
- boolean
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.
- Inherited from:
- Source:
Returns:
Node can be split
- Type
- boolean
trapsCursor() → {boolean}
#
Check if the node traps cursor when active
- Inherited from:
- Source:
Returns:
Node traps cursor
- Type
- boolean
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:
Events
setup()
#
- Inherited from:
- Source:
teardown()
#
- Inherited from:
- Source: