mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-27 12:16:51 +00:00
Merge "Add icon option to ve.ui.TextInputWidget"
This commit is contained in:
commit
052cdb1d99
|
@ -268,6 +268,21 @@
|
|||
text-shadow: 0 1px 1px #fff;
|
||||
}
|
||||
|
||||
.ve-ui-textInputWidget-decorated input,
|
||||
.ve-ui-textInputWidget-decorated textarea {
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
||||
.ve-ui-textInputWidget-icon {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 2em;
|
||||
height: 100%;
|
||||
background-position: right center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
/* ve.ui.MenuWidget */
|
||||
|
||||
.ve-ui-menuWidget {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* @constructor
|
||||
* @param {Object} [config] Config options
|
||||
* @cfg {string} [placeholder] Placeholder text
|
||||
* @cfg {string} [icon] Symbolic name of icon
|
||||
*/
|
||||
ve.ui.TextInputWidget = function VeUiTextInputWidget( config ) {
|
||||
// Parent constructor
|
||||
|
@ -21,6 +22,17 @@ ve.ui.TextInputWidget = function VeUiTextInputWidget( config ) {
|
|||
|
||||
// Initialization
|
||||
this.$.addClass( 've-ui-textInputWidget' );
|
||||
if ( config.icon ) {
|
||||
this.$.addClass( 've-ui-textInputWidget-decorated' );
|
||||
this.$.append(
|
||||
$( '<span>' )
|
||||
.addClass( 've-ui-textInputWidget-icon ve-ui-icon-' + config.icon )
|
||||
.mousedown( ve.bind( function () {
|
||||
this.$input.focus();
|
||||
return false;
|
||||
}, this ) )
|
||||
);
|
||||
}
|
||||
if ( config.placeholder ) {
|
||||
this.$input.attr( 'placeholder', config.placeholder );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue