diff --git a/modules/ve/dm/nodes/ve.dm.MWBlockImageNode.js b/modules/ve/dm/nodes/ve.dm.MWBlockImageNode.js index 2cf69f0dc9..3e43fa01c9 100644 --- a/modules/ve/dm/nodes/ve.dm.MWBlockImageNode.js +++ b/modules/ve/dm/nodes/ve.dm.MWBlockImageNode.js @@ -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 diff --git a/modules/ve/dm/nodes/ve.dm.MWInlineImageNode.js b/modules/ve/dm/nodes/ve.dm.MWInlineImageNode.js index 8d18920f94..efb03aa683 100644 --- a/modules/ve/dm/nodes/ve.dm.MWInlineImageNode.js +++ b/modules/ve/dm/nodes/ve.dm.MWInlineImageNode.js @@ -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',