mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Merge "Get rid of Category: prefix when looking up categories from the API"
This commit is contained in:
commit
e3f439d5fe
|
@ -56,11 +56,17 @@ OO.mixinClass( ve.ui.MWCategoryInputWidget, OO.ui.mixin.LookupElement );
|
|||
* @inheritdoc
|
||||
*/
|
||||
ve.ui.MWCategoryInputWidget.prototype.getLookupRequest = function () {
|
||||
var title = mw.Title.newFromText( this.value );
|
||||
if ( title && title.getNamespaceId() === mw.config.get( 'wgNamespaceIds' ).category ) {
|
||||
title = title.getMainText();
|
||||
} else {
|
||||
title = this.value;
|
||||
}
|
||||
return new mw.Api().get( {
|
||||
action: 'query',
|
||||
generator: 'allcategories',
|
||||
gacmin: 1,
|
||||
gacprefix: this.value,
|
||||
gacprefix: title,
|
||||
prop: 'categoryinfo',
|
||||
redirects: ''
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue