2020-07-31 15:34:08 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor MediaWiki UserInterface back tool classes.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Back tool
|
|
|
|
*/
|
|
|
|
ve.ui.MWBackTool = function VeUiMwBackTool() {
|
|
|
|
// Parent constructor
|
|
|
|
ve.ui.MWBackTool.super.apply( this, arguments );
|
|
|
|
};
|
|
|
|
OO.inheritClass( ve.ui.MWBackTool, ve.ui.Tool );
|
|
|
|
ve.ui.MWBackTool.static.name = 'back';
|
|
|
|
ve.ui.MWBackTool.static.group = 'navigation';
|
|
|
|
ve.ui.MWBackTool.static.icon = 'close';
|
|
|
|
ve.ui.MWBackTool.static.title =
|
|
|
|
OO.ui.deferMsg( 'visualeditor-backbutton-tooltip' );
|
|
|
|
ve.ui.MWBackTool.static.commandName = 'back';
|
|
|
|
|
|
|
|
/** */
|
|
|
|
ve.ui.MWBackTool.prototype.onUpdateState = function () {
|
|
|
|
// Parent method
|
|
|
|
ve.ui.MWBackTool.super.prototype.onUpdateState.apply( this, arguments );
|
|
|
|
|
|
|
|
this.setActive( false );
|
|
|
|
this.setDisabled( false );
|
|
|
|
};
|
|
|
|
|
|
|
|
ve.ui.toolFactory.register( ve.ui.MWBackTool );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Back command
|
|
|
|
*/
|
|
|
|
ve.ui.MWBackCommand = function VeUiMWBackCommand() {
|
|
|
|
// Parent constructor
|
|
|
|
ve.ui.MWBackCommand.super.call( this, 'back' );
|
|
|
|
};
|
|
|
|
OO.inheritClass( ve.ui.MWBackCommand, ve.ui.Command );
|
|
|
|
ve.ui.MWBackCommand.prototype.execute = function () {
|
2021-03-29 20:05:29 +00:00
|
|
|
if ( this.toolbar instanceof ve.ui.TargetToolbar ) {
|
|
|
|
this.toolbar.target.tryTeardown();
|
|
|
|
}
|
2020-07-31 15:34:08 +00:00
|
|
|
};
|
|
|
|
ve.ui.commandRegistry.register( new ve.ui.MWBackCommand() );
|