mediawiki-extensions-Syntax.../modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js
Ed Sanders 0f10206cf2 Use dialog for editing block level syntax highlights
Maintain the inspector for inline snippets (which are editable
but still not creatable).

Bug: T112617
Bug: T57934
Change-Id: I76e36590363d36c0d3db4ec28ce81c4860d9b467
2015-10-20 15:16:11 +01:00

113 lines
3 KiB
JavaScript

/*!
* VisualEditor UserInterface MWSyntaxHighlightDialog class.
*
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* MediaWiki syntax highlight dialog.
*
* @class
* @extends ve.ui.MWExtensionDialog
* @mixins ve.ui.MWSyntaxHighlightWindow
*
* @constructor
* @param {Object} [config] Configuration options
*/
ve.ui.MWSyntaxHighlightDialog = function VeUiMWSyntaxHighlightDialog() {
// Parent constructor
ve.ui.MWSyntaxHighlightDialog.super.apply( this, arguments );
// Mixin constructor
ve.ui.MWSyntaxHighlightWindow.call( this );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWSyntaxHighlightDialog, ve.ui.MWExtensionDialog );
OO.mixinClass( ve.ui.MWSyntaxHighlightDialog, ve.ui.MWSyntaxHighlightWindow );
/* Static properties */
ve.ui.MWSyntaxHighlightDialog.static.name = 'syntaxhighlightDialog';
ve.ui.MWSyntaxHighlightDialog.static.size = 'larger';
ve.ui.MWSyntaxHighlightDialog.static.modelClasses = [ ve.dm.MWBlockSyntaxHighlightNode ];
/* Methods */
/**
* @inheritdoc
*/
ve.ui.MWSyntaxHighlightDialog.prototype.initialize = function () {
// Parent method
ve.ui.MWSyntaxHighlightDialog.super.prototype.initialize.call( this );
// Mixin method
ve.ui.MWSyntaxHighlightWindow.prototype.initialize.call( this );
this.languageField.setAlignment( 'left' );
this.contentLayout = new OO.ui.PanelLayout( {
scrollable: true,
padded: true,
expanded: false,
content: [
this.languageField,
this.codeField,
this.showLinesField
]
} );
// Initialization
this.$content.addClass( 've-ui-mwSyntaxHighlightDialog-content' );
this.$body.append( this.contentLayout.$element );
};
/**
* @inheritdoc
*/
ve.ui.MWSyntaxHighlightDialog.prototype.getReadyProcess = function ( data ) {
// Parent process
var process = ve.ui.MWSyntaxHighlightDialog.super.prototype.getReadyProcess.call( this, data );
// Mixin process
return ve.ui.MWSyntaxHighlightWindow.prototype.getReadyProcess.call( this, data, process );
};
/**
* @inheritdoc
*/
ve.ui.MWSyntaxHighlightDialog.prototype.getSetupProcess = function ( data ) {
// Parent process
var process = ve.ui.MWSyntaxHighlightDialog.super.prototype.getSetupProcess.call( this, data );
// Mixin process
return ve.ui.MWSyntaxHighlightWindow.prototype.getSetupProcess.call( this, data, process );
};
/**
* @inheritdoc
*/
ve.ui.MWSyntaxHighlightDialog.prototype.getTeardownProcess = function ( data ) {
// Parent process
var process = ve.ui.MWSyntaxHighlightDialog.super.prototype.getTeardownProcess.call( this, data );
// Mixin process
return ve.ui.MWSyntaxHighlightWindow.prototype.getTeardownProcess.call( this, data, process );
};
/**
* @inheritdoc
*/
ve.ui.MWSyntaxHighlightDialog.prototype.updateMwData = function () {
// Parent method
ve.ui.MWSyntaxHighlightDialog.super.prototype.updateMwData.apply( this, arguments );
// Mixin method
ve.ui.MWSyntaxHighlightWindow.prototype.updateMwData.apply( this, arguments );
};
/* Registration */
ve.ui.windowFactory.register( ve.ui.MWSyntaxHighlightDialog );