Merge "Restore selection after closing save dialog"

This commit is contained in:
jenkins-bot 2014-11-12 18:29:44 +00:00 committed by Gerrit Code Review
commit 8a2b73f78f
2 changed files with 3 additions and 16 deletions

View file

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

View file

@ -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
*/