Mooeypoo has uploaded a new change for review. https://gerrit.wikimedia.org/r/115939
Change subject: Add type 'none' to the media edit dialog ...................................................................... Add type 'none' to the media edit dialog Deal with wikitext images that have no specifying type and allow users to explicitly choose to set images for 'basic' (no type) in the media edit dialog. Also make sure frameless images are bound by thumbnail size rules. Change-Id: I6778705306f0dd6bb96afeb91383089a4ddab7ed --- M VisualEditor.php M modules/ve-mw/i18n/en.json M modules/ve-mw/i18n/qqq.json M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 4 files changed, 22 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/39/115939/1 diff --git a/VisualEditor.php b/VisualEditor.php index 323434f..3a5fcda 100644 --- a/VisualEditor.php +++ b/VisualEditor.php @@ -701,6 +701,7 @@ 'visualeditor-dialog-media-type-border', 'visualeditor-dialog-media-type-frame', 'visualeditor-dialog-media-type-frameless', + 'visualeditor-dialog-media-type-none', 'visualeditor-dialog-media-type-section', 'visualeditor-dialog-media-type-thumb', 'visualeditor-dialogbutton-media-tooltip', diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json index 847631f..581ef2c 100644 --- a/modules/ve-mw/i18n/en.json +++ b/modules/ve-mw/i18n/en.json @@ -58,6 +58,7 @@ "visualeditor-dialog-media-type-border": "Border", "visualeditor-dialog-media-type-frame": "Frame", "visualeditor-dialog-media-type-frameless": "Frameless", + "visualeditor-dialog-media-type-none": "Basic", "visualeditor-dialog-media-type-section": "Image type", "visualeditor-dialog-media-type-thumb": "Thumbnail", "visualeditor-dialog-meta-advancedsettings-label": "Advanced settings", diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json index c319c34..9aa3a4e 100644 --- a/modules/ve-mw/i18n/qqq.json +++ b/modules/ve-mw/i18n/qqq.json @@ -63,6 +63,7 @@ "visualeditor-dialog-media-type-border": "Label for the image type option for bordered image.", "visualeditor-dialog-media-type-frame": "Label for the image type option for framed image.", "visualeditor-dialog-media-type-frameless": "Label for the image type option for frameless.", + "visualeditor-dialog-media-type-none": "Label for the image type option for basic image.", "visualeditor-dialog-media-type-section": "Label for the image type sub-section.\n\nFollowed by the following buttons:\n* {{msg-mw|Visualeditor-dialog-media-type-thumb}}\n* {{msg-mw|Visualeditor-dialog-media-type-frame}}\n* {{msg-mw|Visualeditor-dialog-media-type-frameless}}\n* {{msg-mw|Visualeditor-dialog-media-type-border}}", "visualeditor-dialog-media-type-thumb": "Label for the image type option for thumbnail.", "visualeditor-dialog-meta-advancedsettings-label": "Title for the advanced settings dialog section.\n{{Identical|Advanced settings}}", diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js index 36eb437..16fd0bf 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js @@ -226,6 +226,10 @@ new OO.ui.ButtonOptionWidget( 'border', { '$': this.$, 'label': ve.msg( 'visualeditor-dialog-media-type-border' ) + } ), + new OO.ui.ButtonOptionWidget( 'none', { + '$': this.$, + 'label': ve.msg( 'visualeditor-dialog-media-type-none' ) } ) ] ); @@ -326,7 +330,13 @@ * sure size is limited. */ ve.ui.MWMediaEditDialog.prototype.onTypeChange = function () { - if ( this.typeInput.getSelectedItem().getData() === 'thumb' ) { + if ( + this.typeInput.getSelectedItem().getData() === 'thumb' || + // As per wikitext docs, both 'thumb' and 'frameless' have + // explicitly limited size, as opposed to the similar case + // of having no type specified + this.typeInput.getSelectedItem().getData() === 'frameless' + ) { // Tell the size widget to limit maxDimensions this.sizeWidget.setEnforcedMax( true ); } else { @@ -505,6 +515,11 @@ this.typeInput.selectItem( this.typeInput.getItemFromData( this.mediaNode.getAttribute( 'type' ) ) ); + } else { + // Explicitly show 'none' if no type was specified + this.typeInput.selectItem( + this.typeInput.getItemFromData( 'none' ) + ); } // Initialize size @@ -640,8 +655,10 @@ } attr = this.typeInput.getSelectedItem(); - if ( attr ) { + if ( attr && attr.getData() !== 'none' ) { attrs.type = attr.getData(); + } else { + attrs.type = null; } surfaceModel.change( ve.dm.Transaction.newFromAttributeChanges( doc, this.mediaNode.getOffset(), attrs ) -- To view, visit https://gerrit.wikimedia.org/r/115939 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6778705306f0dd6bb96afeb91383089a4ddab7ed Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Mooeypoo <mor...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits