From 0f10206cf2ad59dde4cdc85f5690c474275fe2f0 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Mon, 19 Oct 2015 23:27:16 +0100 Subject: [PATCH] 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 --- extension.json | 4 + .../ve.ui.MWSyntaxHighlightDialog.css | 19 +++ .../ve.ui.MWSyntaxHighlightDialog.js | 112 +++++++++++++++ .../ve.ui.MWSyntaxHighlightDialogTool.js | 37 +++++ .../ve.ui.MWSyntaxHighlightInspector.js | 125 +++++------------ .../ve.ui.MWSyntaxHighlightInspectorTool.js | 15 +- .../ve.ui.MWSyntaxHighlightWindow.js | 128 ++++++++++++++++++ 7 files changed, 343 insertions(+), 97 deletions(-) create mode 100644 modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.css create mode 100644 modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js create mode 100644 modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialogTool.js create mode 100644 modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightWindow.js diff --git a/extension.json b/extension.json index a98d9ae2..670ae1e7 100644 --- a/extension.json +++ b/extension.json @@ -47,11 +47,15 @@ "scripts": [ "ve-syntaxhighlight/ve.dm.MWSyntaxHighlightNode.js", "ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js", + "ve-syntaxhighlight/ve.ui.MWSyntaxHighlightWindow.js", + "ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js", + "ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialogTool.js", "ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js", "ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js" ], "styles": [ "ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.css", + "ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.css", "ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.css" ], "dependencies": [ diff --git a/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.css b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.css new file mode 100644 index 00000000..faa2f89d --- /dev/null +++ b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.css @@ -0,0 +1,19 @@ +/*! + * VisualEditor UserInterface MWSyntaxHighlightDialog styles. + * + * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +.ve-ui-mwSyntaxHighlightDialog-content .ve-ui-mwExtensionWindow-input { + max-width: none; +} + +.ve-ui-mwSyntaxHighlightDialog-content .ve-ui-mwExtensionWindow-input textarea { + font-family: monospace, Courier; + min-height: 40em; +} + +.ve-ui-mwSyntaxHighlightDialog-content .ve-ui-mwSyntaxHighlightWindow-languageField { + max-width: 30em; +} diff --git a/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js new file mode 100644 index 00000000..ee9e9a1f --- /dev/null +++ b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js @@ -0,0 +1,112 @@ +/*! + * 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 ); diff --git a/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialogTool.js b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialogTool.js new file mode 100644 index 00000000..5d94515d --- /dev/null +++ b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialogTool.js @@ -0,0 +1,37 @@ +/*! + * VisualEditor UserInterface MWSyntaxHighlightDialogTool class. + * + * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +/*global ve, OO */ + +/** + * MediaWiki UserInterface syntax highlight tool. + * + * @class + * @extends ve.ui.DialogTool + * @constructor + * @param {OO.ui.ToolGroup} toolGroup + * @param {Object} [config] Configuration options + */ +ve.ui.MWSyntaxHighlightDialogTool = function VeUiMWSyntaxHighlightDialogTool() { + ve.ui.MWSyntaxHighlightDialogTool.super.apply( this, arguments ); +}; +OO.inheritClass( ve.ui.MWSyntaxHighlightDialogTool, ve.ui.DialogTool ); +ve.ui.MWSyntaxHighlightDialogTool.static.name = 'syntaxhighlightDialog'; +ve.ui.MWSyntaxHighlightDialogTool.static.group = 'object'; +ve.ui.MWSyntaxHighlightDialogTool.static.icon = 'alienextension'; +ve.ui.MWSyntaxHighlightDialogTool.static.title = OO.ui.deferMsg( + 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title' ); +ve.ui.MWSyntaxHighlightDialogTool.static.modelClasses = [ ve.dm.MWBlockSyntaxHighlightNode ]; +ve.ui.MWSyntaxHighlightDialogTool.static.commandName = 'syntaxhighlightDialog'; +ve.ui.toolFactory.register( ve.ui.MWSyntaxHighlightDialogTool ); + +ve.ui.commandRegistry.register( + new ve.ui.Command( + 'syntaxhighlightDialog', 'window', 'open', + { args: [ 'syntaxhighlightDialog' ], supportedSelections: [ 'linear' ] } + ) +); diff --git a/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js index a3ab6d81..8e271433 100644 --- a/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js +++ b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js @@ -10,6 +10,7 @@ * * @class * @extends ve.ui.MWLiveExtensionInspector + * @mixins ve.ui.MWSyntaxHighlightWindow * * @constructor * @param {Object} [config] Configuration options @@ -17,25 +18,22 @@ ve.ui.MWSyntaxHighlightInspector = function VeUiMWSyntaxHighlightInspector() { // Parent constructor ve.ui.MWSyntaxHighlightInspector.super.apply( this, arguments ); + + // Mixin constructor + ve.ui.MWSyntaxHighlightWindow.call( this ); }; /* Inheritance */ OO.inheritClass( ve.ui.MWSyntaxHighlightInspector, ve.ui.MWLiveExtensionInspector ); +OO.mixinClass( ve.ui.MWSyntaxHighlightInspector, ve.ui.MWSyntaxHighlightWindow ); + /* Static properties */ -ve.ui.MWSyntaxHighlightInspector.static.name = 'syntaxhighlight'; +ve.ui.MWSyntaxHighlightInspector.static.name = 'syntaxhighlightInspector'; -ve.ui.MWSyntaxHighlightInspector.static.icon = 'alienextension'; - -ve.ui.MWSyntaxHighlightInspector.static.size = 'large'; - -ve.ui.MWSyntaxHighlightInspector.static.title = OO.ui.deferMsg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title' ); - -ve.ui.MWSyntaxHighlightInspector.static.modelClasses = [ ve.dm.MWBlockSyntaxHighlightNode, ve.dm.MWInlineSyntaxHighlightNode ]; - -ve.ui.MWSyntaxHighlightInspector.static.dir = 'ltr'; +ve.ui.MWSyntaxHighlightInspector.static.modelClasses = [ ve.dm.MWInlineSyntaxHighlightNode ]; /* Methods */ @@ -43,118 +41,65 @@ ve.ui.MWSyntaxHighlightInspector.static.dir = 'ltr'; * @inheritdoc */ ve.ui.MWSyntaxHighlightInspector.prototype.initialize = function () { - var languageField, codeField, showLinesField, - noneMsg = ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-none' ); // Parent method ve.ui.MWSyntaxHighlightInspector.super.prototype.initialize.call( this ); - this.language = new OO.ui.ComboBoxWidget( { - menu: { - filterFromInput: true, - items: $.map( ve.dm.MWSyntaxHighlightNode.static.getLanguages(), function ( lang ) { - return new OO.ui.MenuOptionWidget( { data: lang, label: lang || noneMsg } ); - } ) - }, - input: { validate: function ( input ) { - return ve.dm.MWSyntaxHighlightNode.static.isLanguageSupported( input ); - } } - } ); - this.language.getInput().connect( this, { change: 'onLanguageInputChange' } ); - - this.showLinesCheckbox = new OO.ui.CheckboxInputWidget(); - - languageField = new OO.ui.FieldLayout( this.language, { - align: 'top', - label: ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-language' ) - } ); - codeField = new OO.ui.FieldLayout( this.input, { - align: 'top', - label: ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-code' ) - } ); - showLinesField = new OO.ui.FieldLayout( this.showLinesCheckbox, { - align: 'inline', - label: ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-showlines' ) - } ); + // Mixin method + ve.ui.MWSyntaxHighlightWindow.prototype.initialize.call( this ); // Initialization this.$content.addClass( 've-ui-mwSyntaxHighlightInspector-content' ); this.form.$element.prepend( - languageField.$element, - codeField.$element, - showLinesField.$element + this.languageField.$element, + this.codeField.$element, + this.showLinesField.$element ); }; -/** - * Handle input change events - * - * @param {string} value New value - */ -ve.ui.MWSyntaxHighlightInspector.prototype.onLanguageInputChange = function () { - var inspector = this; - this.language.getInput().isValid().done( function ( valid ) { - inspector.getActions().setAbilities( { done: valid } ); - } ); -}; - /** * @inheritdoc */ ve.ui.MWSyntaxHighlightInspector.prototype.getReadyProcess = function ( data ) { - return ve.ui.MWSyntaxHighlightInspector.super.prototype.getReadyProcess.call( this, data ) - .next( function () { - this.language.getMenu().toggle( false ); - if ( !this.language.getInput().getValue() ) { - this.language.getInput().focus(); - } else { - this.input.focus(); - } - }, this ); + // Parent process + var process = ve.ui.MWSyntaxHighlightInspector.super.prototype.getReadyProcess.call( this, data ); + // Mixin process + return ve.ui.MWSyntaxHighlightWindow.prototype.getReadyProcess.call( this, data, process ); }; /** * @inheritdoc */ ve.ui.MWSyntaxHighlightInspector.prototype.getSetupProcess = function ( data ) { - return ve.ui.MWSyntaxHighlightInspector.super.prototype.getSetupProcess.call( this, data ) - .next( function () { - var attrs = this.selectedNode.getAttribute( 'mw' ).attrs, - language = attrs.lang || '', - showLines = attrs.line !== undefined; - - this.language.input.setValue( language ); - this.language.input.on( 'change', this.onChangeHandler ); - - this.showLinesCheckbox.setSelected( showLines ); - this.showLinesCheckbox.on( 'change', this.onChangeHandler ); - }, this ); + // Parent process + var process = ve.ui.MWSyntaxHighlightInspector.super.prototype.getSetupProcess.call( this, data ); + // Mixin process + return ve.ui.MWSyntaxHighlightWindow.prototype.getSetupProcess.call( this, data, process ).next( function () { + this.language.input.on( 'change', this.onChangeHandler ); + this.showLinesCheckbox.on( 'change', this.onChangeHandler ); + }, this ); }; /** * @inheritdoc */ ve.ui.MWSyntaxHighlightInspector.prototype.getTeardownProcess = function ( data ) { - return ve.ui.MWSyntaxHighlightInspector.super.prototype.getTeardownProcess.call( this, data ) - .first( function () { - this.language.input.off( 'change', this.onChangeHandler ); - this.showLinesCheckbox.off( 'change', this.onChangeHandler ); - }, this ); + // Parent process + var process = ve.ui.MWSyntaxHighlightInspector.super.prototype.getTeardownProcess.call( this, data ); + // Mixin process + return ve.ui.MWSyntaxHighlightWindow.prototype.getTeardownProcess.call( this, data, process ).first( function () { + this.language.input.off( 'change', this.onChangeHandler ); + this.showLinesCheckbox.off( 'change', this.onChangeHandler ); + }, this ); }; /** * @inheritdoc */ -ve.ui.MWSyntaxHighlightInspector.prototype.updateMwData = function ( mwData ) { - var language, showLines; - +ve.ui.MWSyntaxHighlightInspector.prototype.updateMwData = function () { // Parent method - ve.ui.MWSyntaxHighlightInspector.super.prototype.updateMwData.call( this, mwData ); - - language = this.language.input.getValue(); - showLines = this.showLinesCheckbox.isSelected(); - - mwData.attrs.lang = language || undefined; - mwData.attrs.line = showLines ? '1' : undefined; + ve.ui.MWSyntaxHighlightInspector.super.prototype.updateMwData.apply( this, arguments ); + // Mixin method + ve.ui.MWSyntaxHighlightWindow.prototype.updateMwData.apply( this, arguments ); }; /* Registration */ diff --git a/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js index 1192976b..ef3eb644 100644 --- a/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js +++ b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js @@ -16,22 +16,23 @@ * @param {OO.ui.ToolGroup} toolGroup * @param {Object} [config] Configuration options */ -ve.ui.MWSyntaxHighlightInspectorTool = function VeUiMWSyntaxHighlightInspectorTool( toolGroup, config ) { - ve.ui.InspectorTool.call( this, toolGroup, config ); +ve.ui.MWSyntaxHighlightInspectorTool = function VeUiMWSyntaxHighlightInspectorTool() { + ve.ui.MWSyntaxHighlightInspectorTool.super.apply( this, arguments ); }; OO.inheritClass( ve.ui.MWSyntaxHighlightInspectorTool, ve.ui.InspectorTool ); -ve.ui.MWSyntaxHighlightInspectorTool.static.name = 'syntaxhighlight'; +ve.ui.MWSyntaxHighlightInspectorTool.static.name = 'syntaxhighlightInspector'; ve.ui.MWSyntaxHighlightInspectorTool.static.group = 'object'; ve.ui.MWSyntaxHighlightInspectorTool.static.icon = 'alienextension'; ve.ui.MWSyntaxHighlightInspectorTool.static.title = OO.ui.deferMsg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title' ); -ve.ui.MWSyntaxHighlightInspectorTool.static.modelClasses = [ ve.dm.MWBlockSyntaxHighlightNode, ve.dm.MWInlineSyntaxHighlightNode ]; -ve.ui.MWSyntaxHighlightInspectorTool.static.commandName = 'syntaxhighlight'; +ve.ui.MWSyntaxHighlightInspectorTool.static.modelClasses = [ ve.dm.MWInlineSyntaxHighlightNode ]; +ve.ui.MWSyntaxHighlightInspectorTool.static.commandName = 'syntaxhighlightInspector'; +ve.ui.MWSyntaxHighlightInspectorTool.static.autoAddToCatchall = false; ve.ui.toolFactory.register( ve.ui.MWSyntaxHighlightInspectorTool ); ve.ui.commandRegistry.register( new ve.ui.Command( - 'syntaxhighlight', 'window', 'open', - { args: [ 'syntaxhighlight' ], supportedSelections: [ 'linear' ] } + 'syntaxhighlightInspector', 'window', 'open', + { args: [ 'syntaxhighlightInspector' ], supportedSelections: [ 'linear' ] } ) ); diff --git a/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightWindow.js b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightWindow.js new file mode 100644 index 00000000..adeb115b --- /dev/null +++ b/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightWindow.js @@ -0,0 +1,128 @@ +/*! + * VisualEditor UserInterface MWSyntaxHighlightWindow class. + * + * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +/** + * MediaWiki syntax highlight window. + * + * @class + * @abstract + * + * @constructor + */ +ve.ui.MWSyntaxHighlightWindow = function VeUiMWSyntaxHighlightWindow() { +}; + +/* Inheritance */ + +OO.initClass( ve.ui.MWSyntaxHighlightWindow ); + +/* Static properties */ + +ve.ui.MWSyntaxHighlightWindow.static.icon = 'alienextension'; + +ve.ui.MWSyntaxHighlightWindow.static.title = OO.ui.deferMsg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title' ); + +ve.ui.MWSyntaxHighlightWindow.static.dir = 'ltr'; + +/* Methods */ + +/** + * @inheritdoc + */ +ve.ui.MWSyntaxHighlightWindow.prototype.initialize = function () { + var noneMsg = ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-none' ); + + this.language = new OO.ui.ComboBoxWidget( { + menu: { + filterFromInput: true, + items: $.map( ve.dm.MWSyntaxHighlightNode.static.getLanguages(), function ( lang ) { + return new OO.ui.MenuOptionWidget( { data: lang, label: lang || noneMsg } ); + } ) + }, + input: { validate: function ( input ) { + return ve.dm.MWSyntaxHighlightNode.static.isLanguageSupported( input ); + } } + } ); + this.language.getInput().connect( this, { change: 'onLanguageInputChange' } ); + + this.showLinesCheckbox = new OO.ui.CheckboxInputWidget(); + + this.languageField = new OO.ui.FieldLayout( this.language, { + classes: [ 've-ui-mwSyntaxHighlightWindow-languageField' ], + align: 'top', + label: ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-language' ) + } ); + this.codeField = new OO.ui.FieldLayout( this.input, { + align: 'top', + label: ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-code' ) + } ); + this.showLinesField = new OO.ui.FieldLayout( this.showLinesCheckbox, { + align: 'inline', + label: ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-showlines' ) + } ); +}; + +/** + * Handle input change events + * + * @param {string} value New value + */ +ve.ui.MWSyntaxHighlightWindow.prototype.onLanguageInputChange = function () { + var inspector = this; + this.language.getInput().isValid().done( function ( valid ) { + inspector.getActions().setAbilities( { done: valid } ); + } ); +}; + +/** + * @inheritdoc OO.ui.Window + */ +ve.ui.MWSyntaxHighlightWindow.prototype.getReadyProcess = function ( data, process ) { + return process.next( function () { + this.language.getMenu().toggle( false ); + if ( !this.language.getInput().getValue() ) { + this.language.getInput().focus(); + } else { + this.input.focus(); + } + }, this ); +}; + +/** + * @inheritdoc OO.ui.Window + */ +ve.ui.MWSyntaxHighlightWindow.prototype.getSetupProcess = function ( data, process ) { + return process.next( function () { + var attrs = this.selectedNode ? this.selectedNode.getAttribute( 'mw' ).attrs : {}, + language = attrs.lang || '', + showLines = attrs.line !== undefined; + + this.language.input.setValue( language ); + + this.showLinesCheckbox.setSelected( showLines ); + }, this ); +}; + +/** + * @inheritdoc OO.ui.Window + */ +ve.ui.MWSyntaxHighlightWindow.prototype.getTeardownProcess = function ( data, process ) { + return process; +}; + +/** + * @inheritdoc ve.ui.MWExtensionWindow + */ +ve.ui.MWSyntaxHighlightWindow.prototype.updateMwData = function ( mwData ) { + var language, showLines; + + language = this.language.input.getValue(); + showLines = this.showLinesCheckbox.isSelected(); + + mwData.attrs.lang = language || undefined; + mwData.attrs.line = showLines ? '1' : undefined; +};