/*!
- * OOUI v0.28.2
+ * OOUI v0.29.5
* https://www.mediawiki.org/wiki/OOUI
*
* Copyright 2011–2018 OOUI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2018-09-11T23:05:15Z
+ * Date: 2018-11-08T22:38:07Z
*/
( function ( OO ) {
*
* @private
* @param {jQuery.Event} e Mouse down event
+ * @return {undefined/boolean} False to prevent default if event is handled
*/
OO.ui.Toolbar.prototype.onPointerDown = function ( e ) {
var $closestWidgetToEvent = $( e.target ).closest( '.oo-ui-widget' ),
*
* @param {string|Function} title Title text or a function that returns text
* @chainable
+ * @return {OO.ui.Tool} The tool, for chaining
*/
OO.ui.Tool.prototype.setTitle = function ( title ) {
this.title = OO.ui.resolveMsg( title );
this.exclude = config.exclude || [];
this.promote = config.promote || [];
this.demote = config.demote || [];
- this.onCapturedMouseKeyUpHandler = this.onCapturedMouseKeyUp.bind( this );
+ this.onDocumentMouseKeyUpHandler = this.onDocumentMouseKeyUp.bind( this );
// Events
this.$group.on( {
*
* @protected
* @param {jQuery.Event} e Mouse down or key down event
+ * @return {undefined/boolean} False to prevent default if event is handled
*/
OO.ui.ToolGroup.prototype.onMouseKeyDown = function ( e ) {
if (
this.pressed = this.findTargetTool( e );
if ( this.pressed ) {
this.pressed.setActive( true );
- this.getElementDocument().addEventListener( 'mouseup', this.onCapturedMouseKeyUpHandler, true );
- this.getElementDocument().addEventListener( 'keyup', this.onCapturedMouseKeyUpHandler, true );
+ this.getElementDocument().addEventListener( 'mouseup', this.onDocumentMouseKeyUpHandler, true );
+ this.getElementDocument().addEventListener( 'keyup', this.onDocumentMouseKeyUpHandler, true );
return false;
}
}
};
/**
- * Handle captured mouse up and key up events.
+ * Handle document mouse up and key up events.
*
* @protected
* @param {MouseEvent|KeyboardEvent} e Mouse up or key up event
*/
-OO.ui.ToolGroup.prototype.onCapturedMouseKeyUp = function ( e ) {
- this.getElementDocument().removeEventListener( 'mouseup', this.onCapturedMouseKeyUpHandler, true );
- this.getElementDocument().removeEventListener( 'keyup', this.onCapturedMouseKeyUpHandler, true );
+OO.ui.ToolGroup.prototype.onDocumentMouseKeyUp = function ( e ) {
+ this.getElementDocument().removeEventListener( 'mouseup', this.onDocumentMouseKeyUpHandler, true );
+ this.getElementDocument().removeEventListener( 'keyup', this.onDocumentMouseKeyUpHandler, true );
// onMouseKeyUp may be called a second time, depending on where the mouse is when the button is
// released, but since `this.pressed` will no longer be true, the second call will be ignored.
this.onMouseKeyUp( e );
};
+// Deprecated alias since 0.28.3
+OO.ui.ToolGroup.prototype.onCapturedMouseKeyUp = function () {
+ OO.ui.warnDeprecation( 'onCapturedMouseKeyUp is deprecated, use onDocumentMouseKeyUp instead' );
+ this.onDocumentMouseKeyUp.apply( this, arguments );
+};
+
/**
* Handle mouse up and key up events.
*
this.popup.connect( this, { toggle: 'onPopupToggle' } );
// Initialization
+ this.popup.setAutoFlip( false );
this.popup.setPosition( toolGroup.getToolbar().position === 'bottom' ? 'above' : 'below' );
this.$element.addClass( 'oo-ui-popupTool' );
this.popup.$element.addClass( 'oo-ui-popupTool-popup' );
/**
* PopupToolGroup is an abstract base class used by both {@link OO.ui.MenuToolGroup MenuToolGroup}
- * and {@link OO.ui.ListToolGroup ListToolGroup} to provide a popup--an overlaid menu or list of tools with an
- * optional icon and label. This class can be used for other base classes that also use this functionality.
+ * and {@link OO.ui.ListToolGroup ListToolGroup} to provide a popup (an overlaid menu or list of tools with an
+ * optional icon and label). This class can be used for other base classes that also use this functionality.
*
* @abstract
* @class
// Properties
this.active = false;
this.dragging = false;
- this.onBlurHandler = this.onBlur.bind( this );
+ // Don't conflict with parent method of the same name
+ this.onPopupDocumentMouseKeyUpHandler = this.onPopupDocumentMouseKeyUp.bind( this );
this.$handle = $( '<span>' );
// Mixin constructors
};
/**
- * Handle focus being lost.
- *
- * The event is actually generated from a mouseup/keyup, so it is not a normal blur event object.
+ * Handle document mouse up and key up events.
*
* @protected
* @param {MouseEvent|KeyboardEvent} e Mouse up or key up event
*/
-OO.ui.PopupToolGroup.prototype.onBlur = function ( e ) {
+OO.ui.PopupToolGroup.prototype.onPopupDocumentMouseKeyUp = function ( e ) {
var $target = $( e.target );
// Only deactivate when clicking outside the dropdown element
if ( $target.closest( '.oo-ui-popupToolGroup' )[ 0 ] === this.$element[ 0 ] ) {
this.setActive( false );
};
+// Deprecated alias since 0.28.3
+OO.ui.PopupToolGroup.prototype.onBlur = function () {
+ OO.ui.warnDeprecation( 'onBlur is deprecated, use onPopupDocumentMouseKeyUp instead' );
+ this.onPopupDocumentMouseKeyUp.apply( this, arguments );
+};
+
/**
* @inheritdoc
*/
*
* @protected
* @param {jQuery.Event} e Mouse up or key up event
+ * @return {undefined/boolean} False to prevent default if event is handled
*/
OO.ui.PopupToolGroup.prototype.onHandleMouseKeyUp = function ( e ) {
if (
*
* @protected
* @param {jQuery.Event} e Mouse down or key down event
+ * @return {undefined/boolean} False to prevent default if event is handled
*/
OO.ui.PopupToolGroup.prototype.onHandleMouseKeyDown = function ( e ) {
var $focusable;
if ( this.active !== value ) {
this.active = value;
if ( value ) {
- this.getElementDocument().addEventListener( 'mouseup', this.onBlurHandler, true );
- this.getElementDocument().addEventListener( 'keyup', this.onBlurHandler, true );
+ this.getElementDocument().addEventListener( 'mouseup', this.onPopupDocumentMouseKeyUpHandler, true );
+ this.getElementDocument().addEventListener( 'keyup', this.onPopupDocumentMouseKeyUpHandler, true );
this.$clippable.css( 'left', '' );
this.$element.addClass( 'oo-ui-popupToolGroup-active' );
} );
}
} else {
- this.getElementDocument().removeEventListener( 'mouseup', this.onBlurHandler, true );
- this.getElementDocument().removeEventListener( 'keyup', this.onBlurHandler, true );
+ this.getElementDocument().removeEventListener( 'mouseup', this.onPopupDocumentMouseKeyUpHandler, true );
+ this.getElementDocument().removeEventListener( 'keyup', this.onPopupDocumentMouseKeyUpHandler, true );
this.$element.removeClass( 'oo-ui-popupToolGroup-active' );
this.$group.removeClass( 'oo-ui-popupToolGroup-active-tools' );
this.togglePositioning( false );