mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 03:08:42 +00:00
Merge "Fix media embeds which don't link to the file page"
This commit is contained in:
commit
416323bdca
|
@ -83,12 +83,14 @@ ve.dm.MWBlockImageNode.static.toDataElement = function ( domElements, converter
|
|||
width = img.getAttribute( 'width' );
|
||||
height = img.getAttribute( 'height' );
|
||||
|
||||
// Convert absolute URLs to relative if the href refers to a page on this wiki.
|
||||
// Otherwise Parsoid generates |link= options for copy-pasted images (T193253).
|
||||
href = imgWrapper.getAttribute( 'href' );
|
||||
targetData = ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref( href, converter.getTargetHtmlDocument() );
|
||||
if ( targetData.isInternal ) {
|
||||
href = './' + targetData.title;
|
||||
if ( href ) {
|
||||
// Convert absolute URLs to relative if the href refers to a page on this wiki.
|
||||
// Otherwise Parsoid generates |link= options for copy-pasted images (T193253).
|
||||
targetData = ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref( href, converter.getTargetHtmlDocument() );
|
||||
if ( targetData.isInternal ) {
|
||||
href = './' + targetData.title;
|
||||
}
|
||||
}
|
||||
// Ensure that resource and href are identical if they refer to the same page.
|
||||
// https://www.mediawiki.org/w/?diff=931265&oldid=prev
|
||||
|
|
|
@ -64,12 +64,14 @@ ve.dm.MWInlineImageNode.static.toDataElement = function ( domElements, converter
|
|||
width = img.getAttribute( 'width' ),
|
||||
height = img.getAttribute( 'height' );
|
||||
|
||||
// Convert absolute URLs to relative if the href refers to a page on this wiki.
|
||||
// Otherwise Parsoid generates |link= options for copy-pasted images (T193253).
|
||||
href = imgWrapper.getAttribute( 'href' );
|
||||
targetData = ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref( href, converter.getTargetHtmlDocument() );
|
||||
if ( targetData.isInternal ) {
|
||||
href = './' + targetData.title;
|
||||
if ( href ) {
|
||||
// Convert absolute URLs to relative if the href refers to a page on this wiki.
|
||||
// Otherwise Parsoid generates |link= options for copy-pasted images (T193253).
|
||||
targetData = ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref( href, converter.getTargetHtmlDocument() );
|
||||
if ( targetData.isInternal ) {
|
||||
href = './' + targetData.title;
|
||||
}
|
||||
}
|
||||
// Ensure that resource and href are identical if they refer to the same page.
|
||||
// https://www.mediawiki.org/w/?diff=931265&oldid=prev
|
||||
|
|
Loading…
Reference in a new issue