Merge "Autofocus template input field on dialog open"

This commit is contained in:
jenkins-bot 2022-07-07 13:18:53 +00:00 committed by Gerrit Code Review
commit fd86b7f38d
3 changed files with 9 additions and 5 deletions

View file

@ -457,9 +457,11 @@ ve.ui.MWTemplateDialog.prototype.getSetupProcess = function ( data ) {
promise = this.transclusionModel.addPart( template );
} else {
// Open the dialog to add a new template, always starting with a placeholder
promise = this.transclusionModel.addPart(
new ve.dm.MWTemplatePlaceholderModel( this.transclusionModel )
);
var placeholderPage = new ve.dm.MWTemplatePlaceholderModel( this.transclusionModel );
promise = this.transclusionModel.addPart( placeholderPage );
promise.then( function () {
dialog.bookletLayout.setPage( placeholderPage.getId() );
} );
this.canGoBack = true;
}
} else {

View file

@ -500,9 +500,10 @@ ve.ui.MWTransclusionDialog.prototype.resetDialog = function () {
var target = this;
this.transclusionModel.reset();
this.bookletLayout.clearPages();
this.transclusionModel
.addPart( new ve.dm.MWTemplatePlaceholderModel( this.transclusionModel ), 0 )
var placeholderPage = new ve.dm.MWTemplatePlaceholderModel( this.transclusionModel );
this.transclusionModel.addPart( placeholderPage )
.done( function () {
target.bookletLayout.focusPart( placeholderPage.getId() );
target.autoExpandSidebar();
} );
};

View file

@ -313,6 +313,7 @@ ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.removePages = function ( pages
nextSelectionCandidate || prevSelectionCandidate
);
}
this.focus();
};
/**