mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "(bug 49837) Handle correctly figure tags with typeof="mw:Image""
This commit is contained in:
commit
5cc6faaa1f
|
@ -34,8 +34,13 @@ ve.dm.MWBlockImageNode.static.handlesOwnChildren = true;
|
|||
|
||||
ve.dm.MWBlockImageNode.static.childNodeTypes = [ 'mwImageCaption' ];
|
||||
|
||||
// Match typeof="mw:Image/Thumb" and typeof="mw:Image/Frame"
|
||||
ve.dm.MWBlockImageNode.static.matchRdfaTypes = [ /^mw:Image\/(Thumb|Frame)$/ ];
|
||||
ve.dm.MWBlockImageNode.static.matchTagNames = [ 'figure' ];
|
||||
|
||||
ve.dm.MWBlockImageNode.static.matchRdfaTypes = [
|
||||
'mw:Image',
|
||||
'mw:Image/Thumb',
|
||||
'mw:Image/Frame'
|
||||
];
|
||||
|
||||
ve.dm.MWBlockImageNode.static.toDataElement = function ( domElements, converter ) {
|
||||
var $figure = $( domElements[0] ),
|
||||
|
@ -64,6 +69,9 @@ ve.dm.MWBlockImageNode.static.toDataElement = function ( domElements, converter
|
|||
case 'mw:Image/Frame':
|
||||
attributes.type = 'frame';
|
||||
break;
|
||||
case 'mw:Image':
|
||||
attributes.type = 'none';
|
||||
break;
|
||||
}
|
||||
|
||||
// Horizontal alignment
|
||||
|
@ -109,10 +117,16 @@ ve.dm.MWBlockImageNode.static.toDomElements = function ( data, doc, converter )
|
|||
wrapper = doc.createElement( 'div' );
|
||||
|
||||
// Type
|
||||
if ( dataElement.attributes.type === 'thumb' ) {
|
||||
figure.setAttribute( 'typeof', 'mw:Image/Thumb' );
|
||||
} else {
|
||||
figure.setAttribute( 'typeof', 'mw:Image/Frame' );
|
||||
switch ( dataElement.attributes.type ) {
|
||||
case 'thumb':
|
||||
figure.setAttribute( 'typeof', 'mw:Image/Thumb' );
|
||||
break;
|
||||
case 'frame':
|
||||
figure.setAttribute( 'typeof', 'mw:Image/Frame' );
|
||||
break;
|
||||
case 'none':
|
||||
figure.setAttribute( 'typeof', 'mw:Image' );
|
||||
break;
|
||||
}
|
||||
|
||||
// Default-size
|
||||
|
|
|
@ -32,7 +32,7 @@ ve.dm.MWInlineImageNode.static.storeHtmlAttributes = {
|
|||
'blacklist': [ 'typeof', 'class', 'src', 'resource', 'width', 'height', 'href' ]
|
||||
};
|
||||
|
||||
ve.dm.MWInlineImageNode.static.matchTagNames = null;
|
||||
ve.dm.MWInlineImageNode.static.matchTagNames = [ 'span' ];
|
||||
|
||||
ve.dm.MWInlineImageNode.static.matchRdfaTypes = [
|
||||
'mw:Image',
|
||||
|
|
Loading…
Reference in a new issue