mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Support programmatic tool titles
Just override OO.ui.Tool.prototype.getTitle. The default implementation uses the same static property as before. Change-Id: I80fd95142cafac0e136cfe3031c16c371625b469
This commit is contained in:
parent
230d88d182
commit
53d620e389
|
@ -197,6 +197,17 @@ OO.ui.Tool.prototype.setActive = function ( state ) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the tool title.
|
||||
*
|
||||
* @method
|
||||
* @returns {string} [title] Title text
|
||||
*/
|
||||
OO.ui.Tool.prototype.getTitle = function () {
|
||||
var key = this.constructor.static.titleMessage;
|
||||
return typeof key === 'string' ? OO.ui.msg( key ) : '';
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the tool's symbolic name.
|
||||
*
|
||||
|
@ -213,10 +224,9 @@ OO.ui.Tool.prototype.getName = function () {
|
|||
* @method
|
||||
*/
|
||||
OO.ui.Tool.prototype.updateLabel = function () {
|
||||
var titleMessage = this.constructor.static.titleMessage,
|
||||
var title = this.getTitle(),
|
||||
labelTooltips = this.toolGroup.constructor.static.labelTooltips,
|
||||
accelTooltips = this.toolGroup.constructor.static.accelTooltips,
|
||||
title = titleMessage ? OO.ui.msg( titleMessage ) : '',
|
||||
accel = this.toolbar.getToolAccelerator( this.constructor.static.name ),
|
||||
tooltipParts = [];
|
||||
|
||||
|
|
Loading…
Reference in a new issue