mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
a52d7ff65a
* Switched a lot of classes from es-* to ve-ui-* * Removed all the DOM structure left over from the old sandbox demo * Got rid of transparent backgrounds * Added menu font-size rule to stand-alone target * Moved some rules around that were in the wrong places * Got rid of some unused/unneeded methods in the mw target (attach and detach surface methods) * Added active class to context icon with shallower shadow effect so it doesn't break your spacial perception when you click on it * Renamed the iframe and iframe wrapper elements so it's easier to see where they came from * Removed unused CSS rules * Fixed some uses of prop( 'class', … ) to addClass Change-Id: I54a660ca0baf0baa4463faca7a1edcf648130b6b
62 lines
1.2 KiB
JavaScript
62 lines
1.2 KiB
JavaScript
/**
|
|
* VisualEditor user interface ButtonTool class.
|
|
*
|
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Creates an ve.ui.ButtonTool object.
|
|
*
|
|
* @class
|
|
* @constructor
|
|
* @param {ve.ui.Toolbar} toolbar
|
|
* @param {String} name
|
|
*/
|
|
ve.ui.ButtonTool = function ( toolbar, name, title ) {
|
|
// Inheritance
|
|
ve.ui.Tool.call( this, toolbar, name, title );
|
|
|
|
if ( !name ) {
|
|
return;
|
|
}
|
|
|
|
// Properties
|
|
this.$.addClass( 've-ui-toolbarButtonTool ve-ui-toolbarButtonTool-' + name );
|
|
|
|
// Events
|
|
var tool = this;
|
|
tool.$.on( {
|
|
'mousedown': function ( e ) {
|
|
if ( e.which === 1 ) {
|
|
e.preventDefault();
|
|
return false;
|
|
}
|
|
},
|
|
'mouseup': function ( e ) {
|
|
if ( e.which === 1 ) {
|
|
tool.onClick( e );
|
|
}
|
|
}
|
|
} );
|
|
};
|
|
|
|
/* Methods */
|
|
|
|
ve.ui.ButtonTool.prototype.onClick = function () {
|
|
throw new Error( 'ButtonTool.onClick not implemented in this subclass:' + this.constructor );
|
|
};
|
|
|
|
ve.ui.ButtonTool.prototype.updateEnabled = function () {
|
|
if ( this.enabled ) {
|
|
this.$.removeClass( 've-ui-toolbarButtonTool-disabled' );
|
|
} else {
|
|
this.$.addClass( 've-ui-toolbarButtonTool-disabled' );
|
|
}
|
|
};
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
ve.extendClass( ve.ui.ButtonTool, ve.ui.Tool );
|