Merge "Fix Gallery images always having |link=| and |alt=|"

This commit is contained in:
jenkins-bot 2023-11-28 20:17:32 +00:00 committed by Gerrit Code Review
commit 0ec1a7a2c0
2 changed files with 8 additions and 3 deletions

View file

@ -230,10 +230,11 @@ ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc, converter
while ( captionWrapper.firstChild ) {
li.appendChild( captionWrapper.firstChild );
}
var captionText = ve.dm.MWGalleryImageNode.static.textContentFromCaption( li ).trim();
if ( img.nodeName.toLowerCase() === 'img' ) {
if ( attributes.altTextSame ) {
img.setAttribute( 'alt', ve.dm.MWGalleryImageNode.static.textContentFromCaption( li ).trim() );
if ( attributes.altTextSame && captionText ) {
img.setAttribute( 'alt', captionText );
} else if ( typeof alt === 'string' ) {
img.setAttribute( 'alt', alt );
}

View file

@ -671,7 +671,11 @@ ve.ui.MWGalleryDialog.prototype.onRequestImagesSuccess = function ( response ) {
resource: title,
altText: null,
altTextSame: true,
href: null,
// TODO: support changing the link in the UI somewhere;
// for now, always link to the resource. Do it here when
// generating new results, so existing links from source
// will be preserved.
href: title,
src: '',
height: thumbUrls[ title ].height,
width: thumbUrls[ title ].width,