mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "Add OO.ui.PopupTool"
This commit is contained in:
commit
e46a62e4fc
|
@ -123,6 +123,7 @@ $wgResourceModules += array(
|
|||
'oojs-ui/layouts/OO.ui.PagedOutlineLayout.js',
|
||||
'oojs-ui/layouts/OO.ui.PanelLayout.js',
|
||||
'oojs-ui/layouts/OO.ui.StackPanelLayout.js',
|
||||
'oojs-ui/tools/OO.ui.PopupTool.js',
|
||||
'oojs-ui/toolgroups/OO.ui.BarToolGroup.js',
|
||||
'oojs-ui/toolgroups/OO.ui.PopupToolGroup.js',
|
||||
'oojs-ui/toolgroups/OO.ui.ListToolGroup.js',
|
||||
|
@ -154,6 +155,7 @@ $wgResourceModules += array(
|
|||
'oojs-ui/styles/OO.ui.Frame.css',
|
||||
'oojs-ui/styles/OO.ui.Inspector.css',
|
||||
'oojs-ui/styles/OO.ui.Layout.css',
|
||||
'oojs-ui/styles/OO.ui.Tool.css',
|
||||
'oojs-ui/styles/OO.ui.Toolbar.css',
|
||||
'oojs-ui/styles/OO.ui.ToolGroup.css',
|
||||
'oojs-ui/styles/OO.ui.Widget.css',
|
||||
|
|
|
@ -32,6 +32,7 @@ $html = file_get_contents( $page );
|
|||
<link rel=stylesheet href="../../modules/oojs-ui/styles/OO.ui.Frame.css">
|
||||
<link rel=stylesheet href="../../modules/oojs-ui/styles/OO.ui.Inspector.css">
|
||||
<link rel=stylesheet href="../../modules/oojs-ui/styles/OO.ui.Layout.css">
|
||||
<link rel=stylesheet href="../../modules/oojs-ui/styles/OO.ui.Tool.css">
|
||||
<link rel=stylesheet href="../../modules/oojs-ui/styles/OO.ui.Toolbar.css">
|
||||
<link rel=stylesheet href="../../modules/oojs-ui/styles/OO.ui.ToolGroup.css">
|
||||
<link rel=stylesheet href="../../modules/oojs-ui/styles/OO.ui.Widget.css">
|
||||
|
@ -132,6 +133,7 @@ $html = file_get_contents( $page );
|
|||
<script src="../../modules/oojs-ui/layouts/OO.ui.PagedOutlineLayout.js"></script>
|
||||
<script src="../../modules/oojs-ui/layouts/OO.ui.PanelLayout.js"></script>
|
||||
<script src="../../modules/oojs-ui/layouts/OO.ui.StackPanelLayout.js"></script>
|
||||
<script src="../../modules/oojs-ui/tools/OO.ui.PopupTool.js"></script>
|
||||
<script src="../../modules/oojs-ui/toolgroups/OO.ui.BarToolGroup.js"></script>
|
||||
<script src="../../modules/oojs-ui/toolgroups/OO.ui.PopupToolGroup.js"></script>
|
||||
<script src="../../modules/oojs-ui/toolgroups/OO.ui.ListToolGroup.js"></script>
|
||||
|
|
18
modules/oojs-ui/styles/OO.ui.Tool.css
Normal file
18
modules/oojs-ui/styles/OO.ui.Tool.css
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*!
|
||||
* ObjectOriented UserInterface Tool styles.
|
||||
*
|
||||
* @copyright 2011-2013 OOJS Team and others; see AUTHORS.txt
|
||||
* @license The MIT License (MIT); see LICENSE.txt
|
||||
*/
|
||||
|
||||
/* OO.ui.PopupTool */
|
||||
|
||||
.oo-ui-popupTool .oo-ui-popupWidget {
|
||||
margin-left: 1.25em;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.oo-ui-popupTool .oo-ui-popupWidget-popup,
|
||||
.oo-ui-popupTool .oo-ui-popupWidget-tail {
|
||||
z-index: 4;
|
||||
}
|
65
modules/oojs-ui/tools/OO.ui.PopupTool.js
Normal file
65
modules/oojs-ui/tools/OO.ui.PopupTool.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*!
|
||||
* ObjectOriented UserInterface PopupTool class.
|
||||
*
|
||||
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
||||
* @license The MIT License (MIT); see LICENSE.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* UserInterface popup tool.
|
||||
*
|
||||
* @abstract
|
||||
* @class
|
||||
* @extends OO.ui.Tool
|
||||
* @mixins OO.ui.PopuppableElement
|
||||
*
|
||||
* @constructor
|
||||
* @param {OO.ui.Toolbar} toolbar
|
||||
* @param {Object} [config] Configuration options
|
||||
*/
|
||||
OO.ui.PopupTool = function OoUiPopupTool( toolbar, config ) {
|
||||
// Parent constructor
|
||||
OO.ui.Tool.call( this, toolbar, config );
|
||||
|
||||
// Mixin constructors
|
||||
OO.ui.PopuppableElement.call( this, config );
|
||||
|
||||
// Initialization
|
||||
this.$
|
||||
.addClass( 'oo-ui-popupTool' )
|
||||
.append( this.popup.$ );
|
||||
};
|
||||
|
||||
/* Inheritance */
|
||||
|
||||
OO.inheritClass( OO.ui.PopupTool, OO.ui.Tool );
|
||||
|
||||
OO.mixinClass( OO.ui.PopupTool, OO.ui.PopuppableElement );
|
||||
|
||||
/* Methods */
|
||||
|
||||
/**
|
||||
* Handle the tool being selected.
|
||||
*
|
||||
* @inheritdoc
|
||||
*/
|
||||
OO.ui.PopupTool.prototype.onSelect = function () {
|
||||
if ( !this.disabled ) {
|
||||
if ( this.popup.isVisible() ) {
|
||||
this.hidePopup();
|
||||
} else {
|
||||
this.showPopup();
|
||||
}
|
||||
}
|
||||
this.setActive( false );
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle the toolbar state being updated.
|
||||
*
|
||||
* @inheritdoc
|
||||
*/
|
||||
OO.ui.PopupTool.prototype.onUpdateState = function () {
|
||||
this.setActive( false );
|
||||
};
|
|
@ -77,6 +77,7 @@
|
|||
<script src="../../oojs-ui/layouts/OO.ui.PagedOutlineLayout.js"></script>
|
||||
<script src="../../oojs-ui/layouts/OO.ui.PanelLayout.js"></script>
|
||||
<script src="../../oojs-ui/layouts/OO.ui.StackPanelLayout.js"></script>
|
||||
<script src="../../oojs-ui/tools/OO.ui.PopupTool.js"></script>
|
||||
<script src="../../oojs-ui/toolgroups/OO.ui.BarToolGroup.js"></script>
|
||||
<script src="../../oojs-ui/toolgroups/OO.ui.PopupToolGroup.js"></script>
|
||||
<script src="../../oojs-ui/toolgroups/OO.ui.ListToolGroup.js"></script>
|
||||
|
|
Loading…
Reference in a new issue