Debian Codegraph @

extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js

raw symbols SCIP
1 /*!
2 * VisualEditor ContentEditable MWSyntaxHighlightNode class.
3 *
4 * @copyright VisualEditor Team and others
5 * @license The MIT License (MIT); see LICENSE.txt
6 */
7
8 /**
9 * ContentEditable MediaWiki syntax highlight node.
10 *
11 * @class
12 * @abstract
13 *
14 * @constructor
15 */
16 ve.ce.MWSyntaxHighlightNode = function VeCeMWSyntaxHighlightNode() {
17 };
18
19 /* Inheritance */
20
21 OO.initClass( ve.ce.MWSyntaxHighlightNode );
22
23 /* Static Properties */
24
25 ve.ce.MWSyntaxHighlightNode.static.name = 'mwSyntaxHighlight';
26
27 /* Methods */
28
29 // Inherits from ve.ce.GeneratedContentNode
30 ve.ce.MWSyntaxHighlightNode.prototype.generateContents = function () {
31 return mw.loader.using( 'ext.pygments' ).then(
32 // Parent method
33 () => ve.ce.MWExtensionNode.prototype.generateContents.apply( this, arguments )
34 );
35 };
36
37 // Inherits from ve.ce.BranchNode
38 ve.ce.MWSyntaxHighlightNode.prototype.onSetup = function () {
39 // Parent method
40 ve.ce.MWExtensionNode.prototype.onSetup.call( this );
41
42 // DOM changes
43 this.$element.addClass( 've-ce-mwSyntaxHighlightNode' );
44 };
45
46 // Inherits from ve.ce.FocusableNode
47 ve.ce.MWSyntaxHighlightNode.prototype.getBoundingRect = function () {
48 // HACK: Because nodes can overflow due to the pre tag, just use the
49 // first rect (of the wrapper div) for placing the context.
50 return this.rects[ 0 ];
51 };