Page MenuHomePhabricator

CX2: Support gallery
Closed, ResolvedPublic1 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

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 created this task.Apr 4 2018, 6:02 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 4 2018, 6:02 AM
santhosh triaged this task as Normal priority.EditedApr 4 2018, 6:05 AM
santhosh added a project: ContentTranslation.
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?

Looks good to me

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

santhosh moved this task from Backlog to QA on the Language-2018-Apr-June board.
Pginer-WMF updated the task description. (Show Details)Apr 6 2018, 7:11 AM
Deskana closed this task as Resolved.Apr 9 2018, 3:27 PM
Deskana set the point value for this task to 1.
Arrbee moved this task from QA to Done on the Language-2018-Apr-June board.Apr 10 2018, 12:47 PM