mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 09:26:37 +00:00
Take only the last part of a URL query in media search widget
Quick fix to the problem that searching for the file name or page title currently returns the image, but searching for the URL does not. Bug: T121354 Change-Id: I13e665226e5dc15ba626126dc4806ce8f4e0040b
This commit is contained in:
parent
9939a68db2
commit
7ec7acf108
|
@ -199,7 +199,12 @@ ve.ui.MWMediaSearchWidget.prototype.processQueueResults = function ( items ) {
|
||||||
* @return {string} Query value
|
* @return {string} Query value
|
||||||
*/
|
*/
|
||||||
ve.ui.MWMediaSearchWidget.prototype.getQueryValue = function () {
|
ve.ui.MWMediaSearchWidget.prototype.getQueryValue = function () {
|
||||||
return this.query.getValue().trim();
|
var queryValue = this.query.getValue().trim();
|
||||||
|
|
||||||
|
if ( queryValue.match( ve.init.platform.getExternalLinkUrlProtocolsRegExp() ) ) {
|
||||||
|
queryValue = queryValue.match( /.+\/([^\/]+)/ )[ 1 ];
|
||||||
|
}
|
||||||
|
return queryValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue