Mooeypoo has uploaded a new change for review. https://gerrit.wikimedia.org/r/105225
Change subject: [WIP] Adding position setting to media edit dialog ...................................................................... [WIP] Adding position setting to media edit dialog This adds an image position/alignment to the media edit dialog. Change-Id: I15fbd1ed0998a9093fa039b76624395d661af05b --- M VisualEditor.i18n.php 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 5 files changed, 57 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/25/105225/1 diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php index 0875c2e..62ee178 100644 --- a/VisualEditor.i18n.php +++ b/VisualEditor.i18n.php @@ -135,6 +135,11 @@ 'visualeditor-dialog-beta-welcome-content' => 'This is our new, easier way to edit. It\'s still in beta, which means you might find parts of the page you can\'t edit, or encounter issues that need to be fixed. We encourage you to review your changes, and we welcome reports about any issues you might encounter in using VisualEditor (click the "{{int:visualeditor-help-tool}}" button to submit feedback). You can keep using the wikitext editor by clicking the "$1" tab instead – unsaved changes will be lost.', 'visualeditor-dialog-beta-welcome-title' => '{{GENDER:$1|Welcome}} to VisualEditor', 'visualeditor-dialog-media-content-section' => 'Caption', + 'visualeditor-dialog-media-position-section' => 'Position', + 'visualeditor-dialog-media-position-left' => 'Left', + 'visualeditor-dialog-media-position-right' => 'Right', + 'visualeditor-dialog-media-position-center' => 'Center', + 'visualeditor-dialog-media-position-none' => 'None', 'visualeditor-dialog-media-insert-button' => 'Insert media', 'visualeditor-dialog-media-insert-title' => 'Insert media', 'visualeditor-dialog-media-title' => 'Media settings', @@ -462,6 +467,11 @@ * $1 - username or empty string, for GENDER support', 'visualeditor-dialog-media-content-section' => 'Label for the image content sub-section. {{Identical|Caption}}', + 'visualeditor-dialog-media-position-section' => 'Label for the image position sub-section.', + 'visualeditor-dialog-media-position-left' => 'Label for the image position option for aligning to left.', + 'visualeditor-dialog-media-position-right' => 'Label for the image position option for aligning to right.', + 'visualeditor-dialog-media-position-center' => 'Label for the image position option for aligning to center.', + 'visualeditor-dialog-media-position-none' => 'Label for the image position option for no alignment.', 'visualeditor-dialog-media-size-section' => 'Label for the image size sub-section.', 'visualeditor-dialog-media-size-width' => 'Label for the image width.', 'visualeditor-dialog-media-size-height' => 'Label for the image height.', diff --git a/VisualEditor.php b/VisualEditor.php index 8c06d41..11cb874 100644 --- a/VisualEditor.php +++ b/VisualEditor.php @@ -616,6 +616,11 @@ 'visualeditor-dialog-beta-welcome-content', 'visualeditor-dialog-beta-welcome-title', 'visualeditor-dialog-media-content-section', + 'visualeditor-dialog-media-position-section', + 'visualeditor-dialog-media-position-left', + 'visualeditor-dialog-media-position-right', + 'visualeditor-dialog-media-position-center', + 'visualeditor-dialog-media-position-none', 'visualeditor-dialog-media-insert-button', 'visualeditor-dialog-media-insert-title', 'visualeditor-dialog-media-title', diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json index 5e76be1..2f54425 100644 --- a/modules/ve-mw/i18n/en.json +++ b/modules/ve-mw/i18n/en.json @@ -38,6 +38,11 @@ "visualeditor-dialog-beta-welcome-content": "This is our new, easier way to edit. It's still in beta, which means you might find parts of the page you can't edit, or encounter issues that need to be fixed. We encourage you to review your changes, and we welcome reports about any issues you might encounter in using VisualEditor (click the \"{{int:visualeditor-help-tool}}\" button to submit feedback). You can keep using the wikitext editor by clicking the \"$1\" tab instead – unsaved changes will be lost.", "visualeditor-dialog-beta-welcome-title": "{{GENDER:$1|Welcome}} to VisualEditor", "visualeditor-dialog-media-content-section": "Caption", + "visualeditor-dialog-media-position-section": "Position", + "visualeditor-dialog-media-position-left": "Left", + "visualeditor-dialog-media-position-right": "Right", + "visualeditor-dialog-media-position-center": "Center", + "visualeditor-dialog-media-position-none": "None", "visualeditor-dialog-media-insert-button": "Insert media", "visualeditor-dialog-media-insert-title": "Insert media", "visualeditor-dialog-media-title": "Media settings", diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json index 0c26c0d..fee3602 100644 --- a/modules/ve-mw/i18n/qqq.json +++ b/modules/ve-mw/i18n/qqq.json @@ -41,6 +41,11 @@ "visualeditor-dialog-beta-welcome-content": "Text explaining VisualEditor is in beta.\n\nRefers to {{msg-mw|Visualeditor-help-tool}}.\n\nParameters:\n* $1 - {{msg-mw|Edit}}", "visualeditor-dialog-beta-welcome-title": "Title of the beta welcome dialog. Parameters:\n* $1 - username or empty string, for GENDER support", "visualeditor-dialog-media-content-section": "Label for the image content sub-section.\n{{Identical|Caption}}", + "visualeditor-dialog-media-position-section": "Label for the image position sub-section.", + "visualeditor-dialog-media-position-left": "Label for the image position option for aligning to left.", + "visualeditor-dialog-media-position-right": "Label for the image position option for aligning to right.", + "visualeditor-dialog-media-position-center": "Label for the image position option for aligning to center.", + "visualeditor-dialog-media-position-none": "Label for the image position option for no alignment.", "visualeditor-dialog-media-insert-button": "Used as label for the button.\n{{Identical|Insert media}}", "visualeditor-dialog-media-insert-title": "Media insert dialog title text.\n{{Identical|Insert media}}", "visualeditor-dialog-media-title": "Title for the editing dialog to set how a media item is displayed on the page", diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js index 31310c5..e523ef8 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js @@ -130,6 +130,24 @@ 'icon': 'parameter' } ); + // Position + this.fieldsets.position = new OO.ui.FieldsetLayout( { + '$': this.$, + 'label': ve.msg( 'visualeditor-dialog-media-position-section' ), + 'icon': 'parameter' + } ); + this.inputs.position = new OO.ui.SelectWidget( { + '$': this.$ + } ); + this.inputs.position.addItems( [ + new OO.ui.OptionWidget( 'left', { 'label': ve.msg( 'visualeditor-dialog-media-position-left' ) } ), + new OO.ui.OptionWidget( 'right', { 'label': ve.msg( 'visualeditor-dialog-media-position-right' ) } ), + new OO.ui.OptionWidget( 'center', { 'label': ve.msg( 'visualeditor-dialog-media-position-center' ) } ), + new OO.ui.OptionWidget( 'none', { 'label': ve.msg( 'visualeditor-dialog-media-position-none' ) } ) + ], 0 ); + // Build position fieldset + this.fieldsets.position.$element.append( this.inputs.position.$element ); + // Size this.fieldsets.size = new OO.ui.FieldsetLayout( { '$': this.$, @@ -193,7 +211,10 @@ // Initialization this.generalSettingsPage.$element.append( this.fieldsets.caption.$element ); - this.advancedSettingsPage.$element.append( this.fieldsets.size.$element ); + this.advancedSettingsPage.$element.append( [ + this.fieldsets.position.$element, + this.fieldsets.size.$element + ] ); this.$body.append( this.bookletLayout.$element ); this.$foot.append( this.applyButton.$element ); @@ -324,6 +345,12 @@ this.inputs.size.width.setValue( attrs.width ); this.inputs.size.height.setValue( attrs.height ); + // Set initial position + if ( attrs.align !== undefined ) { + this.inputs.position.selectItem( + this.inputs.position.getItemFromData( attrs.align ) + ); + } // Initialization this.fieldsets.caption.$element.append( this.captionSurface.$element ); this.captionSurface.initialize(); @@ -367,6 +394,10 @@ if ( attr ) { attrs.width = attr; } + attr = this.inputs.position.getSelectedItem(); + if ( attr ) { + attrs.align = attr.getData(); + } surfaceModel.change( ve.dm.Transaction.newFromAttributeChanges( doc, this.mediaNode.getOffset(), attrs ) ); -- To view, visit https://gerrit.wikimedia.org/r/105225 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I15fbd1ed0998a9093fa039b76624395d661af05b 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