mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-27 04:06:51 +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
|
||||
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(
|
||||
'newPage',
|
||||
{ '$$': menu$$, 'label': ve.msg( 'visualeditor-linkinspector-suggest-new-page' ) }
|
||||
|
|
Loading…
Reference in a new issue