mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi
synced 2024-11-28 00:01:10 +00:00
118dcdb405
Bug: T205231 Change-Id: Id175f839f0ac8714c44407c52145d4140cd8e343
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
/*!
|
|
* VisualEditor ContentEditable MWSyntaxHighlightNode class.
|
|
*
|
|
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* ContentEditable MediaWiki syntax highlight node.
|
|
*
|
|
* @class
|
|
* @abstract
|
|
*
|
|
* @constructor
|
|
*/
|
|
ve.ce.MWSyntaxHighlightNode = function VeCeMWSyntaxHighlightNode() {
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.initClass( ve.ce.MWSyntaxHighlightNode );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ce.MWSyntaxHighlightNode.static.name = 'mwSyntaxHighlight';
|
|
|
|
/* Methods */
|
|
|
|
// Inherits from ve.ce.GeneratedContentNode
|
|
ve.ce.MWSyntaxHighlightNode.prototype.generateContents = function () {
|
|
var node = this,
|
|
args = arguments;
|
|
// Parent method
|
|
return mw.loader.using( 'ext.pygments' ).then( function () {
|
|
return ve.ce.MWExtensionNode.prototype.generateContents.apply( node, args );
|
|
} );
|
|
};
|
|
|
|
// Inherits from ve.ce.BranchNode
|
|
ve.ce.MWSyntaxHighlightNode.prototype.onSetup = function () {
|
|
// Parent method
|
|
ve.ce.MWExtensionNode.prototype.onSetup.call( this );
|
|
|
|
// DOM changes
|
|
this.$element.addClass( 've-ce-mwSyntaxHighlightNode' );
|
|
};
|
|
|
|
// Inherits from ve.ce.FocusableNode
|
|
ve.ce.MWSyntaxHighlightNode.prototype.getBoundingRect = function () {
|
|
// HACK: Because nodes can overflow due to the pre tag, just use the
|
|
// first rect (of the wrapper div) for placing the context.
|
|
return this.rects[ 0 ];
|
|
};
|