(Go: >> BACK << -|- >> HOME <<)

Page MenuHomePhabricator

Investigate: Match the preview area to the wikitext area
Closed, ResolvedPublic2 Estimated Story Points

Description

User Story

When I open the preview editor, I want the preview to match the place inside my wikitext, so that I can easily compare my output to the wikitext markup I am writing.

Acceptance Criteria

  • Output scrolling should match the visible output that maps to the wikitext
  • If scrolling happens in the wikitext box while the preview is open, the output should also scroll and viceversa.

Event Timeline

@nayoub and Natalia to sync on interaction patterns for toggling on and off the "scroll and follow" behavior

NRodriguez renamed this task from Match the preview area to the wikitext area to Investigate: Match the preview area to the wikitext area.Nov 10 2021, 12:47 PM
NRodriguez set the point value for this task to 2.

Some conversation about using Parsoid to do this "very accurately": T284796#7246062

It sounds like our approach here is going to be to scroll the preview area to the same percentage as the editing box. This can be inaccurate where there's a big discrepancy between wikitext height and rendered HTML height (e.g. large list of infobox parameters, only one of which is rendered; or a tall image, which requires only a single line in wikitext).

Change 801968 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Realtime preview: match scroll positions between textarea and preview

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

Change 801969 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Realtime preview: keep original scroll position when enabling/disabling

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

Change 801969 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Realtime preview: keep original scroll position when enabling/disabling

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

Change 801968 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Realtime preview: match scroll positions between textarea and preview

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

@Samwilson I find the auto-scrolling does not happen when syntax highlighting (CodeMirror) is on. Is this expected?

No, that's a bug! Thanks for reminding me. :-) I'll sort it out.

Following today's retro, we decided to revert this for now.
cc @NRodriguez

Change 806358 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Realtime Preview: remove the scroll linking between source and preview

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

Change 806358 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Realtime Preview: remove the scroll linking between source and preview

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

This feature has been added and then removed, so it can skip QA. The bug with not scrolling in CodeMirror is now correct behaviour. :)

Since this was merely an investigation, not a feature, and the feature was removed, going to mark the investigation part as done. We are deciding NOT to implement this feature in the meantime