Trevor Parscal has uploaded a new change for review. https://gerrit.wikimedia.org/r/117305
Change subject: Make parameter search widget case insensitive ...................................................................... Make parameter search widget case insensitive Also ignore pipe and bracket characters, since they are not allowed in parameter names. Change-Id: If7378826f103d0b7f8d24edcdc83419879a0c1fe --- M modules/ve-mw/ui/widgets/ve.ui.MWParameterSearchWidget.js 1 file changed, 10 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/05/117305/1 diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWParameterSearchWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWParameterSearchWidget.js index 0d42c6a..920253f 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWParameterSearchWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWParameterSearchWidget.js @@ -96,7 +96,10 @@ description = spec.getParameterDescription( name ); this.index.push( { - 'text': [ name, label, aliases.join( ' ' ), description ].join( ' ' ), + // Query information + 'text': [ label, description ].join( ' ' ).toLowerCase(), + 'names': [ name ].concat( aliases ).join( '|' ).toLowerCase(), + // Display information 'name': name, 'label': label, 'aliases': aliases, @@ -114,17 +117,19 @@ * @method */ ve.ui.MWParameterSearchWidget.prototype.addResults = function () { - var i, len, item, + var i, len, item, textMatch, nameMatch, exactMatch = false, - value = this.query.getValue().trim(), + value = this.query.getValue().trim().replace( /[\|\{\}]/g, '' ), query = value.toLowerCase(), items = []; for ( i = 0, len = this.index.length; i < len; i++ ) { item = this.index[i]; - if ( item.text.indexOf( query ) >= 0 ) { + textMatch = item.text.indexOf( query ) >= 0; + nameMatch = item.names.indexOf( query ) >= 0; + if ( textMatch || nameMatch ) { items.push( new ve.ui.MWParameterResultWidget( item, { '$': this.$ } ) ); - if ( item.name === value || ve.indexOf( value, item.aliases ) !== -1 ) { + if ( nameMatch ) { exactMatch = true; } } -- To view, visit https://gerrit.wikimedia.org/r/117305 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If7378826f103d0b7f8d24edcdc83419879a0c1fe Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Trevor Parscal <tpars...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits