Mooeypoo has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348164 )

Change subject: TagMultiselectWidget: Allow preset InputWidget
......................................................................

TagMultiselectWidget: Allow preset InputWidget

Allow the user of the widget to add their own input widget.
The input widget is assumed to have a working this.$input
for all event handling.

Change-Id: Ib1fdfdff8b0d8865178de032a43dfa297b27ebb4
---
M demos/pages/widgets.js
M src/widgets/TagMultiselectWidget.js
2 files changed, 22 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/64/348164/1

diff --git a/demos/pages/widgets.js b/demos/pages/widgets.js
index 3081ec4..6009ee1 100644
--- a/demos/pages/widgets.js
+++ b/demos/pages/widgets.js
@@ -1373,6 +1373,17 @@
                                        }
                                ),
                                new OO.ui.FieldLayout(
+                                       new OO.ui.TagMultiselectWidget( {
+                                               allowArbitrary: true,
+                                               inputPosition: 'outline',
+                                               inputWidget: new 
OO.ui.SearchInputWidget()
+                                       } ),
+                                       {
+                                               label: 'TagMultiselectWidget 
(inputwidget: OO.ui.SearchInputWidget, outline input)',
+                                               align: 'top'
+                                       }
+                               ),
+                               new OO.ui.FieldLayout(
                                        new OO.ui.PopupTagMultiselectWidget( {
                                                allowArbitrary: true,
                                                icon: 'tag',
diff --git a/src/widgets/TagMultiselectWidget.js 
b/src/widgets/TagMultiselectWidget.js
index 1aafda5..1d3230c 100644
--- a/src/widgets/TagMultiselectWidget.js
+++ b/src/widgets/TagMultiselectWidget.js
@@ -31,6 +31,9 @@
  * @constructor
  * @param {Object} config Configuration object
  * @cfg {Object} [input] Configuration options for the input widget
+ * @cfg {OO.ui.InputWidget} [inputWidget] An optional input widget. If given, 
it will
+ *  replace the input widget used in the TagMultiselectWidget. If not given,
+ *  TagMultiselectWidget creates its own.
  * @cfg {boolean} [inputPosition='inline'] Position of the input. Options are:
  *     - inline: The input is invisible, but exists inside the tag list, so
  *             the user types into the tag groups to add tags.
@@ -124,10 +127,14 @@
                .append( this.$handle );
 
        if ( this.hasInput ) {
-               this.input = new OO.ui.TextInputWidget( $.extend( {
-                       placeholder: config.placeholder,
-                       classes: [ 'oo-ui-tagMultiselectWidget-input' ]
-               }, config.input ) );
+               if ( config.inputWidget ) {
+                       this.input = config.inputWidget;
+               } else {
+                       this.input = new OO.ui.TextInputWidget( $.extend( {
+                               placeholder: config.placeholder,
+                               classes: [ 'oo-ui-tagMultiselectWidget-input' ]
+                       }, config.input ) );
+               }
                this.input.setDisabled( this.isDisabled() );
 
                inputEvents = {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1fdfdff8b0d8865178de032a43dfa297b27ebb4
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>

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

Reply via email to