Page MenuHomePhabricator

CX2: Support gallery
Closed, ResolvedPublic1 Estimated Story Points

Description

cxserver auto adapts galleries to target language. It machine translates the image captions, adapts Image namespaces. The adapted gallery works fine with VisualEditor, except the rendering in translation column has blank images:

Actual result:Expected result
image.png (645×1 px, 196 KB)
image.png (664×1 px, 333 KB)

This will also resolve:

  1. T101927: Image captions of gallery lose HTML markup if any while adapting and publishing
  2. T105132: <gallery> captions cannot be edited with content translation
  3. T191436: Galleries not rendering in visual diffs

Event Timeline

santhosh triaged this task as Medium priority.EditedApr 4 2018, 6:05 AM
santhosh added a subscriber: Esanders.

The reason for missing images is, ve.dm.MWGalleryImageNode.static.toDomElements does not add src attribute to img tags. This gallery html without src attributes get machine translated and adapted and placed in translation column. It produce valid wiki markup, except cause blank images when displayed.

The following one line change in ve.dm.MWGalleryImageNode.js resolves the issue.

diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageNode.js b/modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageNode.js
index dca2bb59a..3fab066b2 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWGalleryImageNode.js
@@ -105,6 +105,7 @@ ve.dm.MWGalleryImageNode.static.toDomElements = function ( data, doc ) {
        // a.setAttribute( 'href', model.attributes.src );

        img.setAttribute( 'resource', model.attributes.resource );
+       img.setAttribute( 'src', model.attributes.src );
        if ( alt ) {
                img.setAttribute( 'alt', alt );
        }

@Esanders, is this change acceptable at VE or should we subclass ve.dm.MWGalleryImageNode in CX?

Change 424279 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Add img.src's to gallery DM output

https://gerrit.wikimedia.org/r/424279

Change 424279 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Add img.src's to gallery DM output

https://gerrit.wikimedia.org/r/424279

Deskana set the point value for this task to 1.