mediawiki-extensions-Syntax.../modules/VisualEditor/ve.ce.MWSyntaxHighlightNode.js
Ed Sanders b403b58682 Add VisualEditor support
Most functionality is provided by MWExtensionNode & MWLiveExtensionInspector.

Bug: T45126
Bug: T60388
Bug: T69515
Change-Id: If502a8bd2199b6ceb824e02fdfd13c81c39b53b4
2015-06-24 22:43:42 +01:00

56 lines
1.4 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
* @extends ve.ce.MWBlockExtensionNode
*
* @constructor
* @param {ve.dm.MWSyntaxHighlightNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve.ce.MWSyntaxHighlightNode = function VeCeMWSyntaxHighlightNode() {
// Parent constructor
ve.ce.MWSyntaxHighlightNode.super.apply( this, arguments );
};
/* Inheritance */
OO.inheritClass( ve.ce.MWSyntaxHighlightNode, ve.ce.MWBlockExtensionNode );
/* Static Properties */
ve.ce.MWSyntaxHighlightNode.static.name = 'mwSyntaxHighlight';
ve.ce.MWSyntaxHighlightNode.static.primaryCommandName = 'syntaxhighlight';
/* Methods */
/** */
ve.ce.MWSyntaxHighlightNode.prototype.generateContents = function () {
if ( !this.getModel().isLanguageSupported() ) {
return $.Deferred().reject().promise();
}
// Parent method
return ve.ce.MWSyntaxHighlightNode.super.prototype.generateContents.apply( this, arguments );
};
/** */
ve.ce.MWSyntaxHighlightNode.prototype.onSetup = function () {
// Parent method
ve.ce.MWSyntaxHighlightNode.super.prototype.onSetup.call( this );
// DOM changes
this.$element.addClass( 've-ce-mwSyntaxHighlightNode' );
};
/* Registration */
ve.ce.nodeFactory.register( ve.ce.MWSyntaxHighlightNode );