mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
39 lines
815 B
JavaScript
39 lines
815 B
JavaScript
/**
|
|
* Creates an ve.dm.TableNode object.
|
|
*
|
|
* @class
|
|
* @constructor
|
|
* @extends {ve.dm.BranchNode}
|
|
* @param {Object} element Document data element of this node
|
|
* @param {ve.dm.TableCellNode[]} contents List of child nodes to initially add
|
|
*/
|
|
ve.dm.TableNode = function( element, contents ) {
|
|
// Inheritance
|
|
ve.dm.BranchNode.call( this, 'table', element, contents );
|
|
};
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Creates a table view for this model.
|
|
*
|
|
* @method
|
|
* @returns {ve.ce.TableNode}
|
|
*/
|
|
ve.dm.TableNode.prototype.createView = function() {
|
|
return new ve.ce.TableNode( this );
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.dm.DocumentNode.nodeModels.table = ve.dm.TableNode;
|
|
|
|
ve.dm.DocumentNode.nodeRules.table = {
|
|
'parents': null,
|
|
'children': ['tableRow']
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.extendClass( ve.dm.TableNode, ve.dm.BranchNode );
|