2012-05-04 18:56:32 +00:00
|
|
|
/**
|
|
|
|
* ContentEditable node for a definition list item.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-05-04 18:56:32 +00:00
|
|
|
* @class
|
|
|
|
* @constructor
|
|
|
|
* @extends {ve.ce.BranchNode}
|
|
|
|
* @param model {ve.dm.DefinitionListItemNode} Model to observe
|
|
|
|
*/
|
|
|
|
ve.ce.DefinitionListItemNode = function( model ) {
|
|
|
|
// Inheritance
|
2012-05-05 00:50:54 +00:00
|
|
|
ve.ce.BranchNode.call(
|
|
|
|
this, 'definitionListItem', model, ve.ce.BranchNode.getDomWrapper( model, 'style' )
|
|
|
|
);
|
2012-05-04 18:56:32 +00:00
|
|
|
|
|
|
|
// Events
|
|
|
|
this.model.addListenerMethod( this, 'update', 'onUpdate' );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Static Members */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Node rules.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-05-04 18:56:32 +00:00
|
|
|
* @see ve.ce.NodeFactory
|
|
|
|
* @static
|
|
|
|
* @member
|
|
|
|
*/
|
|
|
|
ve.ce.DefinitionListItemNode.rules = {
|
|
|
|
'canBeSplit': false
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mapping of list item style values and DOM wrapper element types.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-05-04 18:56:32 +00:00
|
|
|
* @static
|
|
|
|
* @member
|
|
|
|
*/
|
|
|
|
ve.ce.DefinitionListItemNode.domWrapperElementTypes = {
|
|
|
|
'definition': 'dd',
|
|
|
|
'term': 'dt'
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Responds to model update events.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-05-04 18:56:32 +00:00
|
|
|
* If the style changed since last update the DOM wrapper will be replaced with an appropriate one.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-05-04 18:56:32 +00:00
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
ve.ce.DefinitionListItemNode.prototype.onUpdate = function() {
|
2012-05-04 20:31:14 +00:00
|
|
|
this.updateDomWrapper( 'style' );
|
2012-05-04 18:56:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
2012-05-31 22:20:58 +00:00
|
|
|
ve.ce.nodeFactory.register( 'definitionListItem', ve.ce.DefinitionListItemNode );
|
2012-05-04 18:56:32 +00:00
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
ve.extendClass( ve.ce.DefinitionListItemNode, ve.ce.BranchNode );
|