mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Merge "Autofocus template input field on dialog open"
This commit is contained in:
commit
fd86b7f38d
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
} );
|
||||
};
|
||||
|
|
|
@ -313,6 +313,7 @@ ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.removePages = function ( pages
|
|||
nextSelectionCandidate || prevSelectionCandidate
|
||||
);
|
||||
}
|
||||
this.focus();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue