From 6d60cb41bc2d02840f599fb62c07589d4c27ead0 Mon Sep 17 00:00:00 2001 From: petarpetkovic Date: Fri, 24 Nov 2017 15:14:15 +0100 Subject: [PATCH] Allow disabling exact input query in results in mw.widget.TitleWidget * Add configuration option to mw.widget.TitleWidget, to make addition of exact input query to the results optional. Change-Id: Ic7a3aaf38a3827917e4d349cc6b828f37cc64b67 --- resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js index 83a261258d..5670ce42df 100644 --- a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js +++ b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js @@ -23,6 +23,7 @@ * @cfg {boolean} [showImages] Show page images * @cfg {boolean} [showDescriptions] Show page descriptions * @cfg {boolean} [showMissing=true] Show missing pages + * @cfg {boolean} [addQueryInput=true] Add exact user's input query to results * @cfg {boolean} [excludeCurrentPage] Exclude the current page from suggestions * @cfg {boolean} [validateTitle=true] Whether the input must be a valid title (if set to true, * the widget will marks itself red for invalid inputs, including an empty query). @@ -46,6 +47,7 @@ this.showImages = !!config.showImages; this.showDescriptions = !!config.showDescriptions; this.showMissing = config.showMissing !== false; + this.addQueryInput = config.addQueryInput !== false; this.excludeCurrentPage = !!config.excludeCurrentPage; this.validateTitle = config.validateTitle !== undefined ? config.validateTitle : true; this.cache = config.cache; @@ -296,7 +298,7 @@ } // Offer the exact text as a suggestion if the page exists - if ( pageExists && !pageExistsExact ) { + if ( this.addQueryInput && pageExists && !pageExistsExact ) { titles.unshift( this.getQueryValue() ); } -- 2.20.1