Page MenuHomePhabricator

Replace workaround for MWReferenceContextItem in ContentTranslation
Open, Needs TriagePublic

Description

Follow-up to T286788:

I debugged this issue and found that the preview element created by ve.ui.MWReferenceContextItem uses default arguments of ve.ui.MWPreviewElement. ve.ui.MWPreviewElement has useView configuration as false by default and causes not rendering the references from its DOM model as required for section translation.

As a workaround, I created a custom getRendering method in Section translation and use it as as override for ve.ui.MWReferenceContextItem.prototype.getRendering(see https://gerrit.wikimedia.org/r/741102). It fixed the issue, but I am not happy with this method as I am having a copy of ve.ui.MWReferenceContextItem.prototype.getRendering in SX detached from the updates in upstream.

@DLynch @matmarex Do you have any suggestions for better fix?

Event Timeline

The obvious thing would be to create a ve.ui.MWReferenceContextItem.prototype.getPreviewElement method in Cite, or maybe a ve.ui.MWReferenceContextItem.static.previewUseView property, and let ContentTranslation override it so that it works correctly. I think we'd be happy to do that.

But the situation prompts the question, why doesn't rendering the preview from model (the thing that happens in MWPreviewElement when useView=false) work in ContentTranslation? Possibly that's the real bug and it would be good to fix it. But I think this would require someone to figure out how both MWPreviewElement and ContentTranslation works in detail, and possibly no one wants to spend too much time on that. (Unless @Esanders knows the answer off the top of his head, haven't got a chance to ask yet.)

But the situation prompts the question, why doesn't rendering the preview from model (the thing that happens in MWPreviewElement when useView=false) work in ContentTranslation?

May be somehow related to the difference in reference previews work in VE and CX? in VE, they appear as popups near references. In CX, they goes to a special area in UI(tools column CX UI)? Just a guess.