Page MenuHomePhabricator

Modify VisualEditor to trigger a hook with sections data for table of contents re-rendering
Closed, ResolvedPublicBUG REPORT

Description

To unblock the web team from working on T307251, the replacePageContent method will need to be modified to trigger updates to the table of contents.

https://gerrit.wikimedia.org/g/mediawiki/extensions/VisualEditor/+/f247aea770e98a19636fba6ba03fe6e9055d977e/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js#681

Web team needs

  • Please trigger a hook with the sections prop returned by the parse API.
  • The hook should only be triggered if there has been a change in the sections on a given page.

Related Objects

Event Timeline

Per what @ovasileva and @Esanders and I talked about offline in separate conversations, the next steps here are:

  • 1) The Editing Team to decide what they think is the best approach for "telling" the ToC when and how it needs to be updated upon an edit being published. E.g. Do they support the approach being proposed in this ticket? Do they propose an alternative approach?
  • 2A) If the Editing Team supports the approach currently being proposed in this ticket, we'll provide an estimate for when the Web Team can expect us to have implemented said approach.
  • 2B) If the Editing Team supports an approach that is different from the approach currently being proposed in this ticket, we'll communicate as much to the Web Team so that we can work together on defining a path forward to ensuring the ToC has what it needs to update itself after an edit is published.

Per what @ovasileva and @Esanders and I talked about offline in separate conversations, the next steps here are:

  • 1) The Editing Team to decide what they think is the best approach for "telling" the ToC when and how it needs to be updated upon an edit being published. E.g. Do they support the approach being proposed in this ticket? Do they propose an alternative approach?

Per the meetings the Editing and Web Teams had last week, specifically the inter-team meeting we had on 10 May, the Editing Team supports the approach being proposed in this ticket's description.

  • 2A) If the Editing Team supports the approach currently being proposed in this ticket, we'll provide an estimate for when the Web Team can expect us to have implemented said approach.

In-line with the above, the Editing Team is going to write a patch to implement what the task description describes and the Web Team will review it once done.

Change 802680 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Fire new 'wikipage.tableOfContents' hook to update TOC after save

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

Change 802680 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Fire new 'wikipage.tableOfContents' hook to update TOC after save

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