mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi
synced 2024-12-11 22:16:25 +00:00
173491fa6f
Bug: T272864 Change-Id: Ifb8a36bb0f7fee93711c07ebc4efa8c0da244469
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
/*!
|
|
* VisualEditor ContentEditable MWBlockSyntaxHighlightNode class.
|
|
*
|
|
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* ContentEditable MediaWiki block syntax highlight node.
|
|
*
|
|
* @class
|
|
*
|
|
* @constructor
|
|
*/
|
|
ve.ce.MWBlockSyntaxHighlightNode = function VeCeMWBlockSyntaxHighlightNode() {
|
|
// Parent method
|
|
ve.ce.MWBlockExtensionNode.super.apply( this, arguments );
|
|
|
|
// Mixin method
|
|
ve.ce.MWSyntaxHighlightNode.call( this );
|
|
};
|
|
|
|
OO.inheritClass( ve.ce.MWBlockSyntaxHighlightNode, ve.ce.MWBlockExtensionNode );
|
|
|
|
OO.mixinClass( ve.ce.MWBlockSyntaxHighlightNode, ve.ce.MWSyntaxHighlightNode );
|
|
|
|
ve.ce.MWBlockSyntaxHighlightNode.static.name = 'mwBlockSyntaxHighlight';
|
|
|
|
ve.ce.MWBlockSyntaxHighlightNode.static.primaryCommandName = 'syntaxhighlightDialog';
|
|
|
|
ve.ce.MWBlockSyntaxHighlightNode.static.getDescription = function ( model ) {
|
|
return ve.getProp( model.getAttribute( 'mw' ), 'attrs', 'lang' );
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ce.MWBlockSyntaxHighlightNode.prototype.getFocusableElement = function () {
|
|
// Container div is 100% width, so overlaps floatables. Just highlight
|
|
// the inner <pre> (T272864).
|
|
return this.$element.find( 'pre' ).first();
|
|
};
|
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWBlockSyntaxHighlightNode );
|