mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 19:26:46 +00:00
Merge "Restore selection after closing save dialog"
This commit is contained in:
commit
8a2b73f78f
|
@ -1177,6 +1177,7 @@ ve.init.mw.ViewPageTarget.prototype.showSaveDialog = function () {
|
|||
this.surface.getDialogs().getWindow( 'mwSave' ).then( function ( win ) {
|
||||
var currentWindow = this.surface.getContext().getInspectors().getCurrentWindow(),
|
||||
target = this;
|
||||
this.origSelection = this.surface.getModel().getSelection();
|
||||
|
||||
// Make sure any open inspectors are closed
|
||||
if ( currentWindow ) {
|
||||
|
@ -1232,6 +1233,7 @@ ve.init.mw.ViewPageTarget.prototype.onSaveDialogClose = function () {
|
|||
} else {
|
||||
clear();
|
||||
}
|
||||
this.surface.getModel().setSelection( this.origSelection );
|
||||
this.emit( 'saveWorkflowEnd' );
|
||||
};
|
||||
|
||||
|
|
|
@ -177,12 +177,7 @@ ve.ui.MWSaveDialog.prototype.swapPanel = function ( panel ) {
|
|||
// HACK: FF needs *another* defer
|
||||
setTimeout( function () {
|
||||
// FIXME we need to add features to OO.ui.TextInputWidget so we don't need to access .$input
|
||||
var $textarea = dialog.editSummaryInput.$input;
|
||||
$textarea[0].focus();
|
||||
// If message has be pre-filled (e.g. section edit), move cursor to end
|
||||
if ( $textarea.val() !== '' ) {
|
||||
ve.selectEnd( $textarea[0] );
|
||||
}
|
||||
ve.selectEnd( dialog.editSummaryInput.$input[0] );
|
||||
} );
|
||||
break;
|
||||
case 'conflict':
|
||||
|
@ -476,16 +471,6 @@ ve.ui.MWSaveDialog.prototype.getSetupProcess = function ( data ) {
|
|||
}, this );
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWSaveDialog.prototype.getReadyProcess = function ( data ) {
|
||||
return ve.ui.MWSaveDialog.super.prototype.getReadyProcess.call( this, data )
|
||||
.next( function () {
|
||||
this.editSummaryInput.focus();
|
||||
}, this );
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue