mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
MWLinkTargetInputWidget: Normalise value before matching
Don't suggest a "new page" (redlink) for values that are strictly different but the same as a suggestion according to mw.Title (e.g. input "foo" with an existing "Foo" page should not suggest a redlink to inexistant page "foo"). Bug: 48476 Change-Id: I66f5fc56554984af58d6223dc6cd76b3ab9940bd
This commit is contained in:
parent
22bbba249e
commit
70694b2bbf
|
@ -115,7 +115,11 @@ ve.ui.MWLinkTargetInputWidget.prototype.getLookupMenuItemsFromData = function (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal link
|
// Internal link
|
||||||
if ( !pageExists && ( !matchingPages || matchingPages.indexOf( this.value ) === -1 ) ) {
|
if ( !pageExists && ( !matchingPages ||
|
||||||
|
// Run value through mw.Title to avoid treating a match as a mismatch where
|
||||||
|
// normalisation would make them matching (bug 48476)
|
||||||
|
matchingPages.indexOf( new mw.Title( this.value ).toString() ) === -1
|
||||||
|
) ) {
|
||||||
items.push( new ve.ui.MenuSectionItemWidget(
|
items.push( new ve.ui.MenuSectionItemWidget(
|
||||||
'newPage',
|
'newPage',
|
||||||
{ '$$': menu$$, 'label': ve.msg( 'visualeditor-linkinspector-suggest-new-page' ) }
|
{ '$$': menu$$, 'label': ve.msg( 'visualeditor-linkinspector-suggest-new-page' ) }
|
||||||
|
|
Loading…
Reference in a new issue