Page MenuHomeWickedGov Phorge

ve.ce.SectionNode.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

ve.ce.SectionNode.js

/*!
* VisualEditor ContentEditable SectionNode class.
*
* @copyright See AUTHORS.txt
*/
/**
* ContentEditable section node.
*
* @class
* @extends ve.ce.BranchNode
* @mixes ve.ce.ActiveNode
* @constructor
* @param {ve.dm.SectionNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve.ce.SectionNode = function VeCeSectionNode() {
// Parent constructor
ve.ce.SectionNode.super.apply( this, arguments );
// Events
this.model.connect( this, { update: 'onUpdate' } );
// Mixin constructors
ve.ce.ActiveNode.call( this );
// DOM changes
this.$element.addClass( 've-ce-sectionNode' );
};
/* Inheritance */
OO.inheritClass( ve.ce.SectionNode, ve.ce.BranchNode );
OO.mixinClass( ve.ce.SectionNode, ve.ce.ActiveNode );
/* Static Properties */
ve.ce.SectionNode.static.name = 'section';
/* Methods */
/**
* Get the HTML tag name.
*
* Tag name is selected based on the model's style attribute.
*
* @return {string} HTML tag name
*/
ve.ce.SectionNode.prototype.getTagName = function () {
const style = this.model.getAttribute( 'style' );
if ( this.model.constructor.static.matchTagNames.indexOf( style ) === -1 ) {
throw new Error( 'Invalid style' );
}
return style;
};
/**
* Handle model update events.
*
* If the style changed since last update the DOM wrapper will be replaced with an appropriate one.
*/
ve.ce.SectionNode.prototype.onUpdate = function () {
this.updateTagName();
};
/* Registration */
ve.ce.nodeFactory.register( ve.ce.SectionNode );

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 21, 14:04 (1 d, 3 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
3b/b8/8c96ec9c220338d4047e6fb15031
Default Alt Text
ve.ce.SectionNode.js (1 KB)

Event Timeline