diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWLinkTargetInputWidget.js b/modules/ve-mw/ui/widgets/ve.ui.MWLinkTargetInputWidget.js index 60df37282c..9da7fb12e8 100644 --- a/modules/ve-mw/ui/widgets/ve.ui.MWLinkTargetInputWidget.js +++ b/modules/ve-mw/ui/widgets/ve.ui.MWLinkTargetInputWidget.js @@ -142,16 +142,20 @@ ve.ui.MWLinkTargetInputWidget.prototype.getLookupMenuItemsFromData = function ( matchingPages = [], disambigPages = [], redirectPages = [], - titleObj = mw.Title.newFromText( this.value ); + titleObj = mw.Title.newFromText( this.value ), + linkCacheUpdate = {}; for ( index in data ) { matchingPage = data[index]; + linkCacheUpdate[matchingPage.title] = { missing: false, redirect: false, disambiguation: false }; existingPages.push( matchingPage.title ); if ( matchingPage.redirect !== undefined ) { redirectPages.push( matchingPage.title ); + linkCacheUpdate[matchingPage.title].redirect = true; } else if ( matchingPage.pageprops !== undefined && matchingPage.pageprops.disambiguation !== undefined ) { disambigPages.push( matchingPage.title ); + linkCacheUpdate[matchingPage.title].disambiguation = true; } else { matchingPages.push( matchingPage.title ); } @@ -164,6 +168,12 @@ ve.ui.MWLinkTargetInputWidget.prototype.getLookupMenuItemsFromData = function ( titleObj && ve.indexOf( titleObj.getPrefixedText(), existingPages ) !== -1 ); + if ( !pageExists ) { + linkCacheUpdate[this.value] = { missing: true, redirect: false, disambiguation: false }; + } + + ve.init.platform.linkCache.set( linkCacheUpdate ); + // External link if ( ve.init.platform.getExternalLinkUrlProtocolsRegExp().test( this.value ) ) { items.push( new OO.ui.MenuSectionItemWidget(