mediawiki-extensions-Visual.../modules/ve/ce/nodes/ve.ce.BreakNode.js
Catrope 625161e35c Add ve.dm.BreakNode to represent <br>
Change-Id: I3825199c3c8cbe3b50c01e03f39f20cef7c55a28
2012-08-09 14:50:25 -07:00

54 lines
980 B
JavaScript

/**
* VisualEditor content editable BreakNode class.
*
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* ContentEditable node for a line break.
*
* @class
* @constructor
* @extends {ve.ce.LeafNode}
* @param model {ve.dm.BreakNode} Model to observe
*/
ve.ce.BreakNode = function ( model ) {
// Inheritance
ve.ce.LeafNode.call( this, 'break', model, $( '<br>' ) );
// DOM Changes
this.$.addClass( 've-ce-BreakNode' );
};
/* Static Members */
/**
* Node rules.
*
* @see ve.ce.NodeFactory
* @static
* @member
*/
ve.ce.BreakNode.rules = {
'canBeSplit': false
};
/* Methods */
ve.ce.BreakNode.prototype.canHaveSlugBefore = function () {
return true;
};
ve.ce.BreakNode.prototype.canHaveSlugAfter = function () {
return true;
};
/* Registration */
ve.ce.nodeFactory.register( 'break', ve.ce.BreakNode );
/* Inheritance */
ve.extendClass( ve.ce.BreakNode, ve.ce.LeafNode );