From e338a3c35dd65d54d92ec8636dbe0a46f7318cca Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Wed, 17 Aug 2022 13:35:27 +0200 Subject: [PATCH] Enable template editor toolbar deeper in the stack We can do this more in-place instead of reaching into the structure from the outside. Change-Id: I1beb5f7dcfef027f811a3bb4d2a2ef323e2535e3 --- modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js | 1 - .../ui/layouts/ve.ui.MWTwoPaneTransclusionDialogLayout.js | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js index 2eb1643f68..305bbfcb3a 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js @@ -174,7 +174,6 @@ ve.ui.MWTransclusionDialog.prototype.onReplacePart = function ( removed, added ) if ( parts.length === 0 ) { this.addPart( new ve.dm.MWTemplatePlaceholderModel( this.transclusionModel ) ); } else if ( parts.length > 1 ) { - this.bookletLayout.getOutlineControls().toggle( true ); this.$element.removeClass( 've-ui-mwTransclusionDialog-single-transclusion' ); } diff --git a/modules/ve-mw/ui/layouts/ve.ui.MWTwoPaneTransclusionDialogLayout.js b/modules/ve-mw/ui/layouts/ve.ui.MWTwoPaneTransclusionDialogLayout.js index bf24f335b7..a13624c32e 100644 --- a/modules/ve-mw/ui/layouts/ve.ui.MWTwoPaneTransclusionDialogLayout.js +++ b/modules/ve-mw/ui/layouts/ve.ui.MWTwoPaneTransclusionDialogLayout.js @@ -84,10 +84,17 @@ ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.onReplacePart = function ( rem this.sidebar.onReplacePart( removed, added, newPosition ); var keys = Object.keys( this.pages ), + isMultiPart = keys.length > 1, isLastPlaceholder = keys.length === 1 && this.pages[ keys[ 0 ] ] instanceof ve.ui.MWTemplatePlaceholderPage; + // TODO: In other cases this is disabled rather than hidden. See T311303 this.outlineControlsWidget.removeButton.toggle( !isLastPlaceholder ); + + if ( isMultiPart ) { + // Warning, this is intentionally never turned off again + this.outlineControlsWidget.toggle( true ); + } }; /**