From 5e170b63ca753eab457a27c160ec78741083be92 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Wed, 18 Nov 2020 16:51:03 +0000 Subject: [PATCH] Switch back to using for inline images Bug: T266143 Change-Id: I74fe96a47d8a4d7717891c16e49f5a4d6599018a --- modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js | 9 ++++----- modules/ve-mw/tests/dm/ve.dm.mwExample.js | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js b/modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js index dd0ce4ffcf..44c92bfaeb 100644 --- a/modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js +++ b/modules/ve-mw/dm/nodes/ve.dm.MWInlineImageNode.js @@ -43,9 +43,8 @@ ve.dm.MWInlineImageNode.static.preserveHtmlAttributes = function ( attribute ) { return attributes.indexOf( attribute ) === -1; }; -// is here for backwards compatibility with Parsoid content that may be -// stored in RESTBase. This is now generated as . It should -// be safe to remove when verion 1.5 content is no longer acceptable. +// For a while, Parsoid switched to for inline images, but +// then decided to switch back to in T266143. ve.dm.MWInlineImageNode.static.matchTagNames = [ 'span', 'figure-inline' ]; ve.dm.MWInlineImageNode.static.disallowedAnnotationTypes = [ 'link' ]; @@ -56,7 +55,7 @@ ve.dm.MWInlineImageNode.static.toDataElement = function ( domElements, converter typeofAttrs, classes, recognizedClasses, errorIndex, width, height, types, mwDataJSON, mwData; - container = domElements[ 0 ]; // or + container = domElements[ 0 ]; // or imgWrapper = container.children[ 0 ]; // or if ( !imgWrapper ) { // Malformed figure, alienate (T267282) @@ -139,7 +138,7 @@ ve.dm.MWInlineImageNode.static.toDataElement = function ( domElements, converter ve.dm.MWInlineImageNode.static.toDomElements = function ( data, doc ) { var firstChild, srcAttr, mediaClass = data.attributes.mediaClass, - container = doc.createElement( data.attributes.tagName || 'figure-inline' ), + container = doc.createElement( data.attributes.tagName || 'span' ), img = doc.createElement( this.typesToTags[ mediaClass ] ), classes = [], originalClasses = data.attributes.originalClasses; diff --git a/modules/ve-mw/tests/dm/ve.dm.mwExample.js b/modules/ve-mw/tests/dm/ve.dm.mwExample.js index 11829635d3..0f7ad23254 100644 --- a/modules/ve-mw/tests/dm/ve.dm.mwExample.js +++ b/modules/ve-mw/tests/dm/ve.dm.mwExample.js @@ -307,11 +307,11 @@ ve.dm.mwExample.MWBlockImage = { ve.dm.mwExample.MWInlineImage = { html: - '' + + '' + '' + 'alt text' + '' + - '', + '', data: { type: 'mwInlineImage', attributes: { @@ -328,7 +328,7 @@ ve.dm.mwExample.MWInlineImage = { type: 'none', originalClasses: 'foo mw-valign-text-top', unrecognizedClasses: [ 'foo' ], - tagName: 'figure-inline' + tagName: 'span' } }, storeItems: {