Dialogs: Go back or close when pressing escape

Decide based on the currently available actions.

Change-Id: Ida805efbf14071967bf2359788486028fb6c9a09
This commit is contained in:
Ed Sanders 2024-11-29 17:01:32 +00:00
parent 6a26905d87
commit 03b557f167
3 changed files with 33 additions and 0 deletions

View file

@ -173,6 +173,17 @@ ve.ui.MWMediaDialog.static.getImportRules = function () {
/* Methods */
/**
* @inheritdoc
*/
ve.ui.MWMediaDialog.prototype.getEscapeAction = function () {
const backOrClose = this.actions.get( { flags: [ 'back', 'close' ], visible: true } );
if ( backOrClose.length ) {
return backOrClose[ 0 ].getAction();
}
return null;
};
/**
* @inheritdoc
*/

View file

@ -876,6 +876,17 @@ ve.ui.MWSaveDialog.prototype.getTeardownProcess = function ( data ) {
} );
};
/**
* @inheritdoc
*/
ve.ui.MWSaveDialog.prototype.getEscapeAction = function () {
const backOrClose = this.actions.get( { flags: [ 'back', 'close' ], visible: true } );
if ( backOrClose.length ) {
return backOrClose[ 0 ].getAction();
}
return null;
};
/**
* @inheritdoc
*/

View file

@ -68,6 +68,17 @@ ve.ui.MWTransclusionDialog.static.isSmallScreen = function () {
/* Methods */
/**
* @inheritdoc
*/
ve.ui.MWTransclusionDialog.prototype.getEscapeAction = function () {
const backOrClose = this.actions.get( { flags: [ 'back', 'close' ], visible: true } );
if ( backOrClose.length ) {
return backOrClose[ 0 ].getAction();
}
return null;
};
/**
* Handle outline controls move events.
*