2012-07-19 00:11:26 +00:00
|
|
|
/**
|
|
|
|
* VisualEditor content editable TableSectionNode class.
|
2012-07-19 21:25:16 +00:00
|
|
|
*
|
2012-07-19 00:11:26 +00:00
|
|
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2012-06-08 05:00:50 +00:00
|
|
|
/**
|
|
|
|
* ContentEditable node for a table section.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @constructor
|
|
|
|
* @extends {ve.ce.BranchNode}
|
|
|
|
* @param model {ve.dm.TableSectionNode} Model to observe
|
|
|
|
*/
|
2012-08-07 01:50:44 +00:00
|
|
|
ve.ce.TableSectionNode = function ( model ) {
|
2012-06-08 05:00:50 +00:00
|
|
|
// Inheritance
|
|
|
|
ve.ce.BranchNode.call(
|
|
|
|
this, 'tableSection', model, ve.ce.BranchNode.getDomWrapper( model, 'style' )
|
|
|
|
);
|
|
|
|
|
|
|
|
// Events
|
|
|
|
this.model.addListenerMethod( this, 'update', 'onUpdate' );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Static Members */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Node rules.
|
|
|
|
*
|
|
|
|
* @see ve.ce.NodeFactory
|
|
|
|
* @static
|
|
|
|
* @member
|
|
|
|
*/
|
|
|
|
ve.ce.TableSectionNode.rules = {
|
|
|
|
'canBeSplit': false
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mapping of list item style values and DOM wrapper element types.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
* @member
|
|
|
|
*/
|
|
|
|
ve.ce.TableSectionNode.domWrapperElementTypes = {
|
2012-06-15 06:54:06 +00:00
|
|
|
'header': 'thead',
|
2012-06-08 05:00:50 +00:00
|
|
|
'body': 'tbody',
|
2012-06-15 06:54:06 +00:00
|
|
|
'footer': 'tfoot'
|
2012-06-08 05:00:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Responds to model update events.
|
|
|
|
*
|
|
|
|
* If the style changed since last update the DOM wrapper will be replaced with an appropriate one.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
*/
|
2012-08-07 01:50:44 +00:00
|
|
|
ve.ce.TableSectionNode.prototype.onUpdate = function () {
|
2012-06-08 05:00:50 +00:00
|
|
|
this.updateDomWrapper( 'style' );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ce.nodeFactory.register( 'tableSection', ve.ce.TableSectionNode );
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
ve.extendClass( ve.ce.TableSectionNode, ve.ce.BranchNode );
|