mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-30 00:55:00 +00:00
40 lines
828 B
JavaScript
40 lines
828 B
JavaScript
/**
|
|
* Creates an es.HeadingModel object.
|
|
*
|
|
* @class
|
|
* @constructor
|
|
* @extends {es.DocumentModelLeafNode}
|
|
* @param {Object} element Document data element of this node
|
|
* @param {Integer} length Length of document data element
|
|
*/
|
|
es.HeadingModel = function( element, length ) {
|
|
// Inheritance
|
|
es.DocumentModelLeafNode.call( this, 'heading', element, length );
|
|
};
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Creates a heading view for this model.
|
|
*
|
|
* @method
|
|
* @returns {es.ParagraphView}
|
|
*/
|
|
es.HeadingModel.prototype.createView = function() {
|
|
return new es.HeadingView( this );
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
es.DocumentModel.nodeModels.heading = es.HeadingModel;
|
|
|
|
es.DocumentModel.nodeRules.heading = {
|
|
'parents': null,
|
|
'children': [],
|
|
'droppable': true
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
es.extendClass( es.HeadingModel, es.DocumentModelLeafNode );
|