mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
Merge "Fix Gallery images always having |link=| and |alt=|"
This commit is contained in:
commit
0ec1a7a2c0
|
@ -230,10 +230,11 @@ ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc, converter
|
||||||
while ( captionWrapper.firstChild ) {
|
while ( captionWrapper.firstChild ) {
|
||||||
li.appendChild( captionWrapper.firstChild );
|
li.appendChild( captionWrapper.firstChild );
|
||||||
}
|
}
|
||||||
|
var captionText = ve.dm.MWGalleryImageNode.static.textContentFromCaption( li ).trim();
|
||||||
|
|
||||||
if ( img.nodeName.toLowerCase() === 'img' ) {
|
if ( img.nodeName.toLowerCase() === 'img' ) {
|
||||||
if ( attributes.altTextSame ) {
|
if ( attributes.altTextSame && captionText ) {
|
||||||
img.setAttribute( 'alt', ve.dm.MWGalleryImageNode.static.textContentFromCaption( li ).trim() );
|
img.setAttribute( 'alt', captionText );
|
||||||
} else if ( typeof alt === 'string' ) {
|
} else if ( typeof alt === 'string' ) {
|
||||||
img.setAttribute( 'alt', alt );
|
img.setAttribute( 'alt', alt );
|
||||||
}
|
}
|
||||||
|
|
|
@ -671,7 +671,11 @@ ve.ui.MWGalleryDialog.prototype.onRequestImagesSuccess = function ( response ) {
|
||||||
resource: title,
|
resource: title,
|
||||||
altText: null,
|
altText: null,
|
||||||
altTextSame: true,
|
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: '',
|
src: '',
|
||||||
height: thumbUrls[ title ].height,
|
height: thumbUrls[ title ].height,
|
||||||
width: thumbUrls[ title ].width,
|
width: thumbUrls[ title ].width,
|
||||||
|
|
Loading…
Reference in a new issue