jenkins-bot has submitted this change and it was merged. Change subject: Get item data from change event in select widget items ......................................................................
Get item data from change event in select widget items Fix a bug in MediaEditDialog that resulted from sync issues when the 'select' event is fired for OO.ui.ButtonSelectWidget widgets. Use the details of the selected item given from the event rather than checking the state of the widget with getSelectedItem(). Change-Id: Ifbbf722ff374e10b680a6b55ab99f5fc86480c40 --- M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 1 file changed, 8 insertions(+), 11 deletions(-) Approvals: Trevor Parscal: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js index f92d4ed..a9a77ed 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js @@ -375,9 +375,10 @@ /** * Handle type change, particularly to and from 'thumb' to make * sure size is limited. + * @param {OO.ui.ButtonOptionWidget} item Selected item */ -ve.ui.MWMediaEditDialog.prototype.onTypeChange = function () { - var selectedType = this.typeInput.getSelectedItem() ? this.typeInput.getSelectedItem().getData() : '', +ve.ui.MWMediaEditDialog.prototype.onTypeChange = function ( item ) { + var selectedType = item ? item.getData() : '', thumbOrFrameless = selectedType === 'thumb' || selectedType === 'frameless'; // As per wikitext docs, both 'thumb' and 'frameless' have @@ -494,21 +495,17 @@ /** * Respond to sizeSelectWidget change + * @param {OO.ui.ButtonOptionWidget} item Selected item */ -ve.ui.MWMediaEditDialog.prototype.onSizeSelectWidgetSelect = function () { - if ( - this.sizeSelectWidget.getSelectedItem() && - this.sizeSelectWidget.getSelectedItem().getData() === 'default' - ) { +ve.ui.MWMediaEditDialog.prototype.onSizeSelectWidgetSelect = function ( item ) { + var currentItem = item ? item.getData() : ''; + if ( currentItem === 'default' ) { // Reset so placeholders appear this.sizeWidget.setCurrentDimensions( { 'width': 0, 'height': 0 } ); - } else if ( - this.sizeSelectWidget.getSelectedItem() && - this.sizeSelectWidget.getSelectedItem().getData() === 'full' - ) { + } else if ( currentItem === 'full' ) { if ( this.typeInput.getSelectedItem() && ( -- To view, visit https://gerrit.wikimedia.org/r/117245 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifbbf722ff374e10b680a6b55ab99f5fc86480c40 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Mooeypoo <mor...@gmail.com> Gerrit-Reviewer: Trevor Parscal <tpars...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits