mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 08:34:54 +00:00
Merge "In LinkTargetInputWidget, put existence status into LinkCache"
This commit is contained in:
commit
f79d099490
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue