mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 16:44:51 +00:00
ec912dc2d1
ve.ui.Widget.css * Adjust menu up a few pixels to match other uses of ve.ui.MenuWidget (the format drop down) ve.ui.LinkInspector.js * Moved the form value initialization to a timeout that fires well after the animation of the inspector - this is only important because the first element has a menu that pops up and the menu was rendering in the wrong location ve.ui.Frame.js * Added reference to frame within this.$$ by passing it to get$$ ve.ui.Inspector.js * Removed auto-focus on open from inspector base class - this will be done in a more specific and controlled way instead ve.ui.js * Added optional frame argument to get$$ so that it's easy to get the frame from any $$ that's bound to an iframe document ve.ui.Window.js * Removed duplicate static member assignments * Added auto-focus on the window's frame before calling onOpen * Added auto-blur of anything focused within the iframe after calling onClose ve.ui.MWLinkTargetInputWidget.js * Auto-highlight the selected item when populating a menu so that pressing enter always keeps the currently selected item selected ve.ui.TextInputMenuWidget.js * Take the frame's position into account when positioning a menu below an input Change-Id: I334f7db29af6b821bcfc8dc3c0ccba2636d4d9b1
58 lines
1.2 KiB
JavaScript
58 lines
1.2 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface TextInputMenuWidget class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Creates an ve.ui.TextInputMenuWidget object.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.MenuWidget
|
|
*
|
|
* @constructor
|
|
* @param {ve.ui.TextInputWidget} input Text input widget to provide menu for
|
|
* @param {Object} [config] Config options
|
|
*/
|
|
ve.ui.TextInputMenuWidget = function VeUiTextInputMenuWidget( input, config ) {
|
|
// Parent constructor
|
|
ve.ui.MenuWidget.call( this, config );
|
|
|
|
// Properties
|
|
this.input = input;
|
|
|
|
// Initialization
|
|
this.$.addClass( 've-ui-textInputMenuWidget' );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.inheritClass( ve.ui.TextInputMenuWidget, ve.ui.MenuWidget );
|
|
|
|
/**
|
|
* Shows the menu.
|
|
*
|
|
* @method
|
|
* @chainable
|
|
*/
|
|
ve.ui.TextInputMenuWidget.prototype.show = function () {
|
|
var dim, offset,
|
|
$input = this.input.$input;
|
|
|
|
// Call parent method
|
|
ve.ui.MenuWidget.prototype.show.call( this );
|
|
|
|
// Position under input
|
|
dim = $input.offset();
|
|
dim.top += $input.outerHeight( true );
|
|
if ( this.input.$$.frame ) {
|
|
offset = this.input.$$.frame.$.offset();
|
|
dim.left += offset.left;
|
|
dim.top += offset.top;
|
|
}
|
|
this.$.css( dim );
|
|
|
|
return this;
|
|
};
|