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 ) {
|
||||
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 );
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue