Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/187319

Change subject: Twiddle things
......................................................................

Twiddle things

Change-Id: Ia35f8cb30d7d3a00401575c11743ccadabc05b8e
---
M build/modules.json
M demos/pages/widgets.js
M src/widgets/TextInputWidget.js
3 files changed, 16 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/19/187319/1

diff --git a/build/modules.json b/build/modules.json
index 2e775c2..a122a01 100644
--- a/build/modules.json
+++ b/build/modules.json
@@ -77,7 +77,7 @@
                                "src/widgets/DropdownInputWidget.js",
                                "src/widgets/RadioInputWidget.js",
                                "src/widgets/TextInputWidget.js",
-                                       "src/widgets/ComboBoxWidget.js",
+                       "src/widgets/ComboBoxWidget.js",
                        "src/widgets/LabelWidget.js",
                        "src/widgets/OptionWidget.js",
                                "src/widgets/DecoratedOptionWidget.js",
diff --git a/demos/pages/widgets.js b/demos/pages/widgets.js
index 053c6a5..29f6403 100644
--- a/demos/pages/widgets.js
+++ b/demos/pages/widgets.js
@@ -440,7 +440,7 @@
                                ]
                        } ),
                        {
-                               label: 'DraggableGroupWidget (horizontal)',
+                               label: 'DraggableGroupWidget 
(horizontal)\u200E',
                                align: 'top'
                        }
                ),
@@ -470,7 +470,7 @@
                                ]
                        } ),
                        {
-                               label: 'DraggableGroupWidget (vertical)',
+                               label: 'DraggableGroupWidget (vertical)\u200E',
                                align: 'top'
                        }
                ),
@@ -493,7 +493,7 @@
                                ]
                        } ),
                        {
-                               label: 'ButtonGroupWidget (colors)',
+                               label: 'ButtonGroupWidget (colors)\u200E',
                                align: 'top'
                        }
                ),
@@ -542,7 +542,7 @@
                                ]
                        } ),
                        {
-                               label: 'ButtonSelectWidget (colors)',
+                               label: 'ButtonSelectWidget (colors)\u200E',
                                align: 'top'
                        }
                ),
@@ -735,7 +735,7 @@
                        } ),
                        {
                                align: 'top',
-                               label: 'ButtonInputWidget (type: submit)'
+                               label: 'ButtonInputWidget (type: submit)\u200E'
                        }
                ),
                new OO.ui.FieldLayout(
@@ -746,7 +746,7 @@
                        } ),
                        {
                                align: 'top',
-                               label: 'ButtonInputWidget (type: submit, using 
<input/>)'
+                               label: 'ButtonInputWidget (type: submit, using 
<input/>)\u200E'
                        }
                ),
                new OO.ui.FieldLayout(
@@ -808,7 +808,7 @@
                new OO.ui.FieldLayout(
                        new NumberLookupTextInputWidget(),
                        {
-                               label: 'LookupElement demo (try inputting an 
integer)',
+                               label: 'LookupElement (try inputting an 
integer)\u200E',
                                align: 'top'
                        }
                ),
diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js
index f3cc5cb..5d6ee94 100644
--- a/src/widgets/TextInputWidget.js
+++ b/src/widgets/TextInputWidget.js
@@ -18,12 +18,15 @@
  * @cfg {boolean} [multiline=false] Allow multiple lines of text
  * @cfg {boolean} [autosize=false] Automatically resize to fit content
  * @cfg {boolean} [maxRows=10] Maximum number of rows to make visible when 
autosizing
- * @cfg {RegExp|string} [validate] Regular expression (or symbolic name 
referencing
+ * @cfg {RegExp|string} [validate] Regular expression to validate against (or 
symbolic name referencing
  *  one, see #static-validationPatterns)
  */
 OO.ui.TextInputWidget = function OoUiTextInputWidget( config ) {
        // Configuration initialization
-       config = $.extend( { readOnly: false }, config );
+       config = $.extend( {
+               type: 'text',
+               maxRows: 10
+       }, config );
 
        // Parent constructor
        OO.ui.TextInputWidget.super.call( this, config );
@@ -37,7 +40,7 @@
        this.readOnly = false;
        this.multiline = !!config.multiline;
        this.autosize = !!config.autosize;
-       this.maxRows = config.maxRows !== undefined ? config.maxRows : 10;
+       this.maxRows = config.maxRows;
        this.validate = null;
 
        // Clone for resizing
@@ -63,7 +66,7 @@
        this.$element
                .addClass( 'oo-ui-textInputWidget' )
                .append( this.$icon, this.$indicator );
-       this.setReadOnly( config.readOnly );
+       this.setReadOnly( !!config.readOnly );
        if ( config.placeholder ) {
                this.$input.attr( 'placeholder', config.placeholder );
        }
@@ -265,8 +268,7 @@
  * @private
  */
 OO.ui.TextInputWidget.prototype.getInputElement = function ( config ) {
-       var type = config.type || 'text';
-       return config.multiline ? this.$( '<textarea>' ) : this.$( '<input 
type="' + type + '" />' );
+       return config.multiline ? this.$( '<textarea>' ) : this.$( '<input 
type="' + config.type + '" />' );
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/187319
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia35f8cb30d7d3a00401575c11743ccadabc05b8e
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Esanders <esand...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to