2018-09-24 13:25:28 +00:00
|
|
|
/*!
|
|
|
|
* 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';
|
|
|
|
|
2019-07-31 15:41:15 +00:00
|
|
|
ve.ce.MWBlockSyntaxHighlightNode.static.getDescription = function ( model ) {
|
|
|
|
return ve.getProp( model.getAttribute( 'mw' ), 'attrs', 'lang' );
|
|
|
|
};
|
|
|
|
|
2018-09-24 13:25:28 +00:00
|
|
|
/* Registration */
|
|
|
|
|
2021-01-25 15:11:17 +00:00
|
|
|
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();
|
|
|
|
};
|
|
|
|
|
2018-09-24 13:25:28 +00:00
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWBlockSyntaxHighlightNode );
|