mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-04 18:58:37 +00:00
5badd4fcd4
We have to move the activation logic from a ve.ui.Command to the ve.ui.Tool, as the Command is unable to refer to the Target. Previous attempt:4984c5ffbb
reverted infb32aa4978
. Bug: T279313 Change-Id: I3cb74aa5123b67a6c63b8e07ea7f93a6d4a07d4f
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
/*!
|
|
* 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.prototype.onUpdateState = function () {
|
|
// Parent method
|
|
ve.ui.MWBackTool.super.prototype.onUpdateState.apply( this, arguments );
|
|
|
|
this.setActive( false );
|
|
this.setDisabled( false );
|
|
};
|
|
|
|
ve.ui.MWBackTool.prototype.onSelect = function () {
|
|
// Parent method
|
|
ve.ui.MWBackTool.super.prototype.onSelect.apply( this, arguments );
|
|
|
|
if ( this.toolbar instanceof ve.ui.TargetToolbar ) {
|
|
this.toolbar.target.tryTeardown();
|
|
}
|
|
};
|
|
|
|
ve.ui.toolFactory.register( ve.ui.MWBackTool );
|