From cd3cbf1f9b552013c6d13ce4d6d6e26a245b677a Mon Sep 17 00:00:00 2001 From: Moriel Schottlender Date: Mon, 9 Jun 2014 19:35:20 -0400 Subject: [PATCH] Initialize 'default' size properly in media edit dialog Make sure that image model and media edit dialog initialize the default size properties according to the scalable correctly. Also make sure that on creation of a new node or edit of existing node's properties follow on whether the image is set to default size or custom size. Depends on the ve-core change: Ia6bb041bfc050a48d8c40bbff4b73ed2893085e2 Bug: 66149 Change-Id: I6f60fba28e11a111bb40a100148ed1f12d518890 --- modules/ve-mw/dm/models/ve.dm.MWImageModel.js | 7 +++---- modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js | 4 ---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js index e378fc1467..aecd2b4748 100644 --- a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js +++ b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js @@ -285,13 +285,12 @@ ve.dm.MWImageModel.prototype.getUpdatedAttributes = function () { origAttrs = this.getOriginalImageAttributes(); // Adjust default dimensions if size is set to default - // FIXME modifying this.scalable shouldn't be done in a getter and shouldn't be needed (bug 66149) if ( this.scalable.isDefault() && this.scalable.getDefaultDimensions() ) { - this.scalable.setCurrentDimensions( this.scalable.getDefaultDimensions() ); + currentDimensions = this.scalable.getDefaultDimensions(); + } else { + currentDimensions = this.getCurrentDimensions(); } - currentDimensions = this.getCurrentDimensions(); - attrs = { 'type': this.getType(), 'width': currentDimensions.width, diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js index ddc095dd97..0191efbe33 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js @@ -4,7 +4,6 @@ * @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ -/*global mw */ /** * Dialog for editing MediaWiki media objects. @@ -304,9 +303,6 @@ ve.ui.MWMediaEditDialog.prototype.initialize = function () { this.$sizeWidgetElements ] ); - // Get wiki default thumbnail size - this.defaultThumbSize = mw.config.get( 'wgVisualEditorConfig' ).defaultUserOptions.defaultthumbsize; - // Events this.positionCheckbox.connect( this, { 'change': 'onPositionCheckboxChange' } ); this.borderCheckbox.connect( this, { 'change': 'onBorderCheckboxChange' } );