Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/82054
Change subject: Offer the typed text as a link suggestion if the page is valid
......................................................................
Offer the typed text as a link suggestion if the page is valid
Currently we only offer the normalised page title from the server
so 'iPhone' only suggests 'IPhone'. With this fix we offer the typed
text as the first suggestion if it matches via mw.Title, so 'iPhone'
suggests ['iPhone', 'IPhone', ...]
Bug: 50452
Change-Id: I05cc0cd19537cbfa682d7aac0f9640decea282b5
---
M modules/ve-mw/ui/widgets/ve.ui.MWLinkTargetInputWidget.js
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/54/82054/1
diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWLinkTargetInputWidget.js
b/modules/ve-mw/ui/widgets/ve.ui.MWLinkTargetInputWidget.js
index 31044b2..dfe7f60 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWLinkTargetInputWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWLinkTargetInputWidget.js
@@ -105,8 +105,9 @@
matchingPages = data,
// If not found, run value through mw.Title to avoid treating a
match as a
// mismatch where normalisation would make them matching (bug
48476)
+ pageExistsExact = ve.indexOf( this.value, matchingPages ) !==
-1,
pageExists =
- ve.indexOf( this.value, matchingPages ) !== -1 ||
+ pageExistsExact ||
ve.indexOf( new mw.Title( this.value
).getPrefixedText(), matchingPages ) !== -1;
// External link
@@ -148,6 +149,10 @@
'matchingPages',
{ '$$': menu$$, 'label': ve.msg(
'visualeditor-linkinspector-suggest-matching-page' ) }
) );
+ // Offer the exact text as a suggestion if the page exists
+ if ( pageExists && !pageExistsExact ) {
+ matchingPages.unshift( this.value );
+ }
for ( i = 0, len = matchingPages.length; i < len; i++ ) {
items.push( new ve.ui.MenuItemWidget(
this.getInternalLinkAnnotationFromTitle(
matchingPages[i] ),
--
To view, visit https://gerrit.wikimedia.org/r/82054
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I05cc0cd19537cbfa682d7aac0f9640decea282b5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits