mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-16 10:59:56 +00:00
40 lines
831 B
JavaScript
40 lines
831 B
JavaScript
/**
|
|
* Creates an es.ListModel object.
|
|
*
|
|
* @class
|
|
* @constructor
|
|
* @extends {es.DocumentModelBranchNode}
|
|
* @param {Object} element Document data element of this node
|
|
* @param {es.ListItemModel[]} contents List of child nodes to initially add
|
|
*/
|
|
es.ListModel = function( element, contents ) {
|
|
// Inheritance
|
|
es.DocumentModelBranchNode.call( this, 'list', 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'],
|
|
'droppable': true
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
es.extendClass( es.ListModel, es.DocumentModelBranchNode );
|