mediawiki-extensions-Syntax.../modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js
Ed Sanders cd421a4b1d build: Update eslint-config-wikimedia to 0.28.0
Change-Id: Ia565bd4d314b7b512a46c4bb2af74784d5c2edc1
2024-06-06 16:33:02 +01:00

52 lines
1.3 KiB
JavaScript

/*!
* VisualEditor ContentEditable MWSyntaxHighlightNode class.
*
* @copyright VisualEditor Team and others
* @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 () {
return mw.loader.using( 'ext.pygments' ).then(
// Parent method
() => ve.ce.MWExtensionNode.prototype.generateContents.apply( this, arguments )
);
};
// 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 ];
};