Tchanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/315561

Change subject: Take only the last part of a URL query in media search widget
......................................................................

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
---
M modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/61/315561/1

diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
index 59cde6d..21dfef1 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
@@ -202,6 +202,10 @@
 ve.ui.MWMediaSearchWidget.prototype.onQueryChange = function ( value ) {
        var trimmed = value.trim();
 
+       if ( trimmed.match( 
ve.init.platform.getExternalLinkUrlProtocolsRegExp() ) ) {
+               trimmed = trimmed.match( /.+\/([^\/]+)/ )[ 1 ];
+               this.query.setValue( trimmed );
+       }
        if ( trimmed === this.searchValue ) {
                return;
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I13e665226e5dc15ba626126dc4806ce8f4e0040b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Tchanders <thalia.e.c...@googlemail.com>

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

Reply via email to