Debian Codegraph @

extensions/VisualEditor/lib/ve/src/ce/nodes/ve.ce.HorizontalRuleNode.js

raw symbols SCIP
1 /*!
2 * VisualEditor ContentEditable HorizontalRuleNode class.
3 *
4 * @copyright See AUTHORS.txt
5 */
6
7 /**
8 * ContentEditable horizontal rule node.
9 *
10 * @class
11 * @extends ve.ce.LeafNode
12 * @mixes ve.ce.FocusableNode
13 *
14 * @constructor
15 * @param {ve.dm.HorizontalRuleNode} model Model to observe
16 * @param {Object} [config] Configuration options
17 */
18 ve.ce.HorizontalRuleNode = function VeCeHorizontalRuleNode() {
19 // Parent constructor
20 ve.ce.HorizontalRuleNode.super.apply( this, arguments );
21
22 // Wrap the <hr> in a div so the margins become focusable
23 // and the user has a click target of more than 2px
24 this.$element = $( '<div>' ).append( this.$element );
25
26 // Mixin constructors
27 ve.ce.FocusableNode.call( this );
28
29 // DOM changes
30 this.$element.addClass( 've-ce-horizontalRuleNode' );
31 };
32
33 /* Inheritance */
34
35 OO.inheritClass( ve.ce.HorizontalRuleNode, ve.ce.LeafNode );
36
37 OO.mixinClass( ve.ce.HorizontalRuleNode, ve.ce.FocusableNode );
38
39 /* Static Properties */
40
41 ve.ce.HorizontalRuleNode.static.name = 'horizontalRule';
42
43 ve.ce.HorizontalRuleNode.static.tagName = 'hr';
44
45 /* Registration */
46
47 ve.ce.nodeFactory.register( ve.ce.HorizontalRuleNode );