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
This commit is contained in:
Thiemo Kreuz 2022-08-17 13:35:27 +02:00
parent e9560b58b9
commit e338a3c35d
2 changed files with 7 additions and 1 deletions

View file

@ -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' );
}

View file

@ -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 );
}
};
/**