InternalLink: Add special case for fragment with no title

Bug: T218581
Change-Id: I11e2de90e582d184a3f8cdd65dfc0858571aa397
This commit is contained in:
Ed Sanders 2019-04-09 14:43:24 +01:00
parent 2fc64107f4
commit dbd692b5ed

View file

@ -173,6 +173,12 @@ ve.dm.MWInternalLinkAnnotation.static.getHref = function ( dataElement ) {
}
} ).join( '' );
}
if ( encodedTitle.slice( 0, 1 ) === '#' ) {
// Special case: For a newly created link to a #fragment with
// no explicit title use the current title as prefix (T218581)
// TODO: Pass a 'doc' param to getPageName
encodedTitle = ve.init.target.getPageName() + encodedTitle;
}
return './' + encodedTitle;
};