From ded8c4091596a6c4b4f43027fa0ce9fbfb4d88d8 Mon Sep 17 00:00:00 2001 From: Adam Wight Date: Mon, 3 May 2021 12:40:02 +0200 Subject: [PATCH] Optional feature makes the transclusion dialog bigger When $wgVisualEditorTransclusionDialogInlineDescriptions is set to true, the template dialog will use a larger format. Bug: T273971 Change-Id: Iad3c3f4d65125c83e35414ce15f793f6a1b192ef --- .../ui/dialogs/ve.ui.MWTransclusionDialog.js | 27 +++++++++++++++++++ .../dialogs/ve.ui.MWTransclusionDialog.css | 8 ++++++ 2 files changed, 35 insertions(+) diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js index 20f39aa501..c8191d2ecc 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js @@ -20,6 +20,12 @@ ve.ui.MWTransclusionDialog = function VeUiMWTransclusionDialog( config ) { // Properties this.mode = null; + + // Temporary override while feature flag is in place. + this.isBigger = mw.config.get( 'wgVisualEditorConfig' ).transclusionDialogInlineDescriptions; + if ( this.isBigger ) { + this.$element.addClass( 've-ui-mwTransclusionDialog-bigger' ); + } }; /* Inheritance */ @@ -385,6 +391,27 @@ ve.ui.MWTransclusionDialog.prototype.getSetupProcess = function ( data ) { }, this ); }; +/** + * @inheritdoc + * + * Temporary override to increase dialog size when a feature flag is enabled. + */ +ve.ui.MWTransclusionDialog.prototype.getSizeProperties = function () { + var size = this.getSize(); + + if ( this.isBigger ) { + // Note that the base class makes an assumption that `width` is in raw + // pixels, but no such assumption is made about the height. + if ( size === 'medium' ) { + return { width: 560, height: '90%' }; + } else if ( size === 'large' ) { + return { width: 800, height: '90%' }; + } + } + + return ve.ui.MWTransclusionDialog.super.prototype.getSizeProperties.call( this ); +}; + /* Registration */ ve.ui.windowFactory.register( ve.ui.MWTransclusionDialog ); diff --git a/modules/ve-mw/ui/styles/dialogs/ve.ui.MWTransclusionDialog.css b/modules/ve-mw/ui/styles/dialogs/ve.ui.MWTransclusionDialog.css index a653d52e82..cccfa6eac8 100644 --- a/modules/ve-mw/ui/styles/dialogs/ve.ui.MWTransclusionDialog.css +++ b/modules/ve-mw/ui/styles/dialogs/ve.ui.MWTransclusionDialog.css @@ -69,3 +69,11 @@ -moz-transition: all 250ms ease-in-out; transition: all 250ms ease-in-out; } + +.ve-ui-mwTransclusionDialog-bigger .oo-ui-menuLayout > .oo-ui-menuLayout-menu { + width: 240px; +} + +.ve-ui-mwTransclusionDialog-bigger .oo-ui-menuLayout > .oo-ui-menuLayout-content { + left: 240px; +}