Page MenuHomePhabricator

Header of diff in the editor missing when using live preview
Closed, ResolvedPublic

Description

Header of diff in the editor is missing when using live preview.

Live preview disabled:

image.png (2×3 px, 291 KB)

Live preview enabled:
image.png (2×3 px, 313 KB)

The text "Latest revision / Your text" in missing in the second screenshot.

Event Timeline

Right, I noticed this while working on the live preview code for T109166, but forgot to create a task. I think partly it might be because I wasn't sure about the value of having these headers. On second thought though, I think we should include them.

Note: this was not caused by the recent work on the live preview, the headers were never there.

It's also worth noting that:

  1. The HTML for the headers is generated in DifferenceEngine::addHeader(), called by ::getDiff(), but ApiCompare doesn't use that (it only gets the diff body)
  2. The specific messages used there are chosen in EditPage::showDiff; in particular, the "Latest revision" one may vary depending on the page.

Perhaps the logic for choosing the messages might be moved out of EditPage into some diff-related class, and ApiCompare could have an option to use that. I'm not sure where the concept of "diffing the latest revision and some new text" should live.

Change 732029 had a related patch set uploaded (by Fomafix; author: Fomafix):

[mediawiki/core@master] mediawiki.action.edit.preview: Use same UI as in normal diff

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

Change 732029 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.action.edit.preview: Use same UX as in normal diff

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