mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
Merge "Roundtrip media tag name in galleries"
This commit is contained in:
commit
a7b7f659c7
|
@ -176,16 +176,14 @@ ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc, converter
|
|||
thumbDiv = doc.createElement( 'div' ),
|
||||
container = doc.createElement( 'span' ),
|
||||
a = doc.createElement( 'a' ),
|
||||
img = doc.createElement( attributes.isError ? 'span' : ( attributes.mediaTag || 'img' ) ),
|
||||
img = doc.createElement( attributes.isError ? 'span' : attributes.mediaTag ),
|
||||
alt = attributes.altText,
|
||||
mwData = ve.copy( attributes.mw ) || {};
|
||||
|
||||
// FIXME: attributes.mediaTag and attributes.mediaClass aren't set after edit
|
||||
|
||||
li.classList.add( 'gallerybox' );
|
||||
thumbDiv.classList.add( 'thumb' );
|
||||
container.setAttribute( 'typeof', ve.dm.MWImageNode.static.getRdfa(
|
||||
( attributes.mediaClass || 'File' ), 'none', attributes.isError
|
||||
attributes.mediaClass, 'none', attributes.isError
|
||||
) );
|
||||
|
||||
if ( attributes.href !== null ) {
|
||||
|
@ -227,7 +225,6 @@ ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc, converter
|
|||
li.appendChild( captionWrapper.firstChild );
|
||||
}
|
||||
|
||||
// Meh, see the FIXME above about the mediaTag not being set
|
||||
if ( img.nodeName.toLowerCase() === 'img' ) {
|
||||
if ( attributes.altTextSame ) {
|
||||
img.setAttribute( 'alt', ve.dm.MWGalleryImageNode.static.textContentFromCaption( li ).trim() );
|
||||
|
|
|
@ -429,7 +429,9 @@ ve.ui.MWGalleryDialog.prototype.getSetupProcess = function ( data ) {
|
|||
errorText: image.getAttribute( 'errorText' ),
|
||||
imageClassAttr: image.getAttribute( 'imageClassAttr' ),
|
||||
imgWrapperClassAttr: image.getAttribute( 'imgWrapperClassAttr' ),
|
||||
mw: image.getAttribute( 'mw' )
|
||||
mw: image.getAttribute( 'mw' ),
|
||||
mediaClass: image.getAttribute( 'mediaClass' ),
|
||||
mediaTag: image.getAttribute( 'mediaTag' )
|
||||
} );
|
||||
}
|
||||
|
||||
|
@ -678,7 +680,9 @@ ve.ui.MWGalleryDialog.prototype.onRequestImagesSuccess = function ( response ) {
|
|||
isError: false,
|
||||
errorText: null,
|
||||
imageClassAttr: 'mw-file-element',
|
||||
mw: {}
|
||||
mw: {},
|
||||
mediaClass: 'File',
|
||||
mediaTag: 'img'
|
||||
}, config ) );
|
||||
delete this.selectedFilenames[ title ];
|
||||
}
|
||||
|
@ -1043,7 +1047,9 @@ ve.ui.MWGalleryDialog.prototype.insertOrUpdateNode = function () {
|
|||
errorText: galleryItem.errorText,
|
||||
imageClassAttr: galleryItem.imageClassAttr,
|
||||
imgWrapperClassAttr: galleryItem.imgWrapperClassAttr,
|
||||
mw: galleryItem.mw
|
||||
mw: galleryItem.mw,
|
||||
mediaClass: galleryItem.mediaClass,
|
||||
mediaTag: galleryItem.mediaTag
|
||||
};
|
||||
|
||||
return [
|
||||
|
|
|
@ -36,6 +36,8 @@ ve.ui.MWGalleryItemWidget = function VeUiMWGalleryItemWidget( imageInfo, config
|
|||
this.imageClassAttr = imageInfo.imageClassAttr;
|
||||
this.imgWrapperClassAttr = imageInfo.imgWrapperClassAttr;
|
||||
this.mw = imageInfo.mw;
|
||||
this.mediaClass = imageInfo.mediaClass;
|
||||
this.mediaTag = imageInfo.mediaTag;
|
||||
|
||||
// Configuration initialization
|
||||
config = config || {};
|
||||
|
|
Loading…
Reference in a new issue