From 2b6e4ce53914209fb982ebff9c939b787a75b3b7 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Thu, 20 Aug 2015 15:40:54 +0100 Subject: [PATCH] Replace updatePreview with updateMwData No need to reimplement updatePreview, just override updateMwData instead. Change-Id: I606fb200c458aff979df660d3b7095bb52c5d012 --- modules/VisualEditor/ve.ui.MWMathInspector.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/VisualEditor/ve.ui.MWMathInspector.js b/modules/VisualEditor/ve.ui.MWMathInspector.js index 2c20971..d00644e 100644 --- a/modules/VisualEditor/ve.ui.MWMathInspector.js +++ b/modules/VisualEditor/ve.ui.MWMathInspector.js @@ -96,7 +96,7 @@ ve.ui.MWMathInspector.prototype.getSetupProcess = function ( data ) { return ve.ui.MWMathInspector.super.prototype.getSetupProcess.call( this, data ) .next( function () { var display = this.selectedNode.getAttribute( 'mw' ).attrs.display || 'default'; - this.displaySelect.selectItem( this.displaySelect.getItemFromData( display ) ); + this.displaySelect.selectItemByData( display ); this.displaySelect.on( 'choose', this.onChangeHandler ); this.idInput.on( 'change', this.onChangeHandler ); }, this ); @@ -116,18 +116,15 @@ ve.ui.MWMathInspector.prototype.getTeardownProcess = function ( data ) { /** * @inheritdoc */ -ve.ui.MWMathInspector.prototype.updatePreview = function () { - var mwData = ve.copy( this.selectedNode.getAttribute( 'mw' ) ), - display = this.displaySelect.getSelectedItem().getData(), +ve.ui.MWMathInspector.prototype.updateMwData = function ( mwData ) { + // Parent method + ve.ui.MWMathInspector.super.prototype.updateMwData.call( this, mwData ); + + var display = this.displaySelect.getSelectedItem().getData(), id = this.idInput.getValue(); - mwData.body.extsrc = this.input.getValue(); mwData.attrs.display = display !== 'default' ? display : undefined; mwData.attrs.id = id || undefined; - - if ( this.visible ) { - this.getFragment().changeAttributes( { mw: mwData } ); - } }; /* Registration */