mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Fix template editor showing more than one new sidebar
Bug: T274544 Bug: T286715 Change-Id: I9fe8b53a73b1862eca2d99afb02aa3d532d61918
This commit is contained in:
parent
766b220f5a
commit
8ab2ec25ea
|
@ -470,6 +470,11 @@ ve.ui.MWTemplateDialog.prototype.getSetupProcess = function ( data ) {
|
|||
this.bookletLayout.autoFocus = false;
|
||||
|
||||
if ( this.isNewSidebar ) {
|
||||
// FIXME: This is created at the wrong time. That's why we run into the situation
|
||||
// where an old instance exists. Should be in initialize().
|
||||
if ( this.pocSidebar ) {
|
||||
this.pocSidebar.$element.remove();
|
||||
}
|
||||
this.pocSidebar = new ve.ui.MWTransclusionOutlineContainerWidget(
|
||||
this.transclusionModel,
|
||||
this.bookletLayout
|
||||
|
@ -530,12 +535,17 @@ ve.ui.MWTemplateDialog.prototype.getSetupProcess = function ( data ) {
|
|||
dialog.$body.append( dialog.bookletLayout.$element );
|
||||
if ( dialog.pocSidebar ) {
|
||||
// TODO: bookletLayout will be deprecated.
|
||||
dialog.bookletLayout.outlinePanel.$element.prepend( $( '<div>' )
|
||||
.addClass( 've-ui-mwTemplateDialog-pocSidebar-debug-container' )
|
||||
.append(
|
||||
dialog.pocSidebar.$element,
|
||||
dialog.bookletLayout.outlineSelectWidget.$element
|
||||
) );
|
||||
var $debugContainer = dialog.bookletLayout.outlinePanel.$element
|
||||
.children( '.ve-ui-mwTemplateDialog-pocSidebar-debug-container' );
|
||||
if ( !$debugContainer.length ) {
|
||||
$debugContainer = $( '<div>' )
|
||||
.addClass( 've-ui-mwTemplateDialog-pocSidebar-debug-container' )
|
||||
.prependTo( dialog.bookletLayout.outlinePanel.$element );
|
||||
}
|
||||
$debugContainer.append(
|
||||
dialog.pocSidebar.$element,
|
||||
dialog.bookletLayout.outlineSelectWidget.$element
|
||||
);
|
||||
}
|
||||
|
||||
dialog.bookletLayout.autoFocus = true;
|
||||
|
|
Loading…
Reference in a new issue