mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 06:46:26 +00:00
39 lines
789 B
JavaScript
39 lines
789 B
JavaScript
/**
|
|
* Creates an es.ListModel object.
|
|
*
|
|
* @class
|
|
* @constructor
|
|
* @extends {es.DocumentModelNode}
|
|
* @param {Object} element Document data element of this node
|
|
* @param {es.DocumentModelNode[]} contents List of child nodes to initially add
|
|
*/
|
|
es.ListModel = function( element, contents ) {
|
|
// Inheritance
|
|
es.DocumentModelNode.call( this, element, contents );
|
|
};
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Creates a list view for this model.
|
|
*
|
|
* @method
|
|
* @returns {es.ListView}
|
|
*/
|
|
es.ListModel.prototype.createView = function() {
|
|
return new es.ListView( this );
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
es.DocumentModel.nodeModels.list = es.ListModel;
|
|
|
|
es.DocumentModel.nodeRules.list = {
|
|
'parents': null,
|
|
'children': ['listItem']
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
es.extendClass( es.ListModel, es.DocumentModelNode );
|