Mooeypoo has uploaded a new change for review. https://gerrit.wikimedia.org/r/105247
Change subject: [WIP] Add image type change to media edit dialog ...................................................................... [WIP] Add image type change to media edit dialog Adding a type change to the media edit dialog. Change-Id: I9c855e6381d970b5f08460822366f6333af24f82 --- M VisualEditor.i18n.php M VisualEditor.php M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js M modules/ve-mw/i18n/en.json M modules/ve-mw/i18n/qqq.json M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 6 files changed, 74 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/47/105247/1 diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php index 0875c2e..cb04907 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-type-section' => 'Image type', + 'visualeditor-dialog-media-type-thumb' => 'Thumbnail', + 'visualeditor-dialog-media-type-frameless' => 'Frameless', + 'visualeditor-dialog-media-type-frame' => 'Frame', + 'visualeditor-dialog-media-type-border' => 'Border', '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-type-section' => 'Label for the image type sub-section.', + 'visualeditor-dialog-media-type-thumb' => 'Label for the image type option for thumbnail.', + 'visualeditor-dialog-media-type-frameless' => 'Label for the image type option for frameless.', + 'visualeditor-dialog-media-type-frame' => 'Label for the image type option for framed image.', + 'visualeditor-dialog-media-type-border' => 'Label for the image type option for bordered image.', '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..e816e3a 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-type-section', + 'visualeditor-dialog-media-type-thumb', + 'visualeditor-dialog-media-type-frameless', + 'visualeditor-dialog-media-type-frame', + 'visualeditor-dialog-media-type-border', 'visualeditor-dialog-media-insert-button', 'visualeditor-dialog-media-insert-title', 'visualeditor-dialog-media-title', diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js index 81ca27a..f86f677 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js @@ -121,7 +121,10 @@ var model, view, type = this.model.getAttribute( 'type' ); - this.captionVisible = type !== 'none' && type !== 'frameless' && this.model.children.length === 1; + this.captionVisible = type !== 'none' && + type !== 'frameless' && + type !== 'border' && + this.model.children.length === 1; if ( this.captionVisible ) { // Only create a caption if we need it diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json index 5e76be1..3e7705f 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-type-section": "Image type", + "visualeditor-dialog-media-type-thumb": "Thumbnail", + "visualeditor-dialog-media-type-frameless": "Frameless", + "visualeditor-dialog-media-type-frame": "Frame", + "visualeditor-dialog-media-type-border": "Border", "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..d0b2355 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-type-section": "Label for the image type sub-section.", + "visualeditor-dialog-media-type-thumb": "Label for the image type option for thumbnail.", + "visualeditor-dialog-media-type-frameless": "Label for the image type option for frameless.", + "visualeditor-dialog-media-type-frame": "Label for the image type option for framed image.", + "visualeditor-dialog-media-type-border": "Label for the image type option for bordered image.", "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..290a2c3 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js @@ -130,6 +130,36 @@ 'icon': 'parameter' } ); + // Type + this.fieldsets.type = new OO.ui.FieldsetLayout( { + '$': this.$, + 'label': ve.msg( 'visualeditor-dialog-media-type-section' ), + 'icon': 'parameter' + } ); + + this.inputs.type = new OO.ui.SelectWidget( { + '$': this.$ + } ); + this.inputs.type.addItems( [ + // TODO: Inline images require a bit of further work, will be coming soon + new OO.ui.OptionWidget( 'thumb', { + 'label': ve.msg( 'visualeditor-dialog-media-type-thumb' ) + } ), + new OO.ui.OptionWidget( 'frameless', { + 'label': ve.msg( 'visualeditor-dialog-media-type-frameless' ) + } ), + new OO.ui.OptionWidget( 'frame', { + 'label': ve.msg( 'visualeditor-dialog-media-type-frame' ) + } ), + new OO.ui.OptionWidget( 'border', { + 'label': ve.msg( 'visualeditor-dialog-media-type-border' ) + } ) + ] ); + + // Build type fieldset + this.fieldsets.type.$element + .append( this.inputs.type.$element ); + // Size this.fieldsets.size = new OO.ui.FieldsetLayout( { '$': this.$, @@ -193,7 +223,10 @@ // Initialization this.generalSettingsPage.$element.append( this.fieldsets.caption.$element ); - this.advancedSettingsPage.$element.append( this.fieldsets.size.$element ); + this.advancedSettingsPage.$element.append( [ + this.fieldsets.type.$element, + this.fieldsets.size.$element + ] ); this.$body.append( this.bookletLayout.$element ); this.$foot.append( this.applyButton.$element ); @@ -324,6 +357,13 @@ this.inputs.size.width.setValue( attrs.width ); this.inputs.size.height.setValue( attrs.height ); + // Set image type + if ( attrs.type !== undefined ) { + this.inputs.type.selectItem( + this.inputs.type.getItemFromData( attrs.type ) + ); + } + // Initialization this.fieldsets.caption.$element.append( this.captionSurface.$element ); this.captionSurface.initialize(); @@ -367,6 +407,10 @@ if ( attr ) { attrs.width = attr; } + attr = this.inputs.type.getSelectedItem(); + if ( attr ) { + attrs.type = attr.getData(); + } surfaceModel.change( ve.dm.Transaction.newFromAttributeChanges( doc, this.mediaNode.getOffset(), attrs ) ); -- To view, visit https://gerrit.wikimedia.org/r/105247 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9c855e6381d970b5f08460822366f6333af24f82 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