VisualEditor: Re-run wikipage content handlers (jquery.makeCollapsible, jquery.tablesorter) when rendering new revision after save
Closed, ResolvedPublic

Description

At the moment, the VE's refresh after save isn't a full refresh - it refreshes "in place", using the parsoid DOM. This isn't something things like gadgets or site JS recognise, and so the reloaded page lacks power user functionality. Save should simply refresh the page cleanly to avoid this issue.


Version: unspecified
Severity: normal

bzimport set Reference to bz51565.
Ironholds created this task.Via LegacyJul 17 2013, 7:02 PM
Thryduulf added a comment.Via ConduitJul 17 2013, 7:14 PM
  • Bug 51568 has been marked as a duplicate of this bug. ***
Krinkle added a comment.Via ConduitJul 17 2013, 7:33 PM

No, we should not refresh because of this. This is not a new bug, this is a known issue in mediawiki core for years with "live preview".

The difference being that in 2013 (unlike several years ago when live preview came along) we have solved this. Recently I developed mw.hook in core with an event "wikipage.content". Gadgets should listen to that instead of document-ready.

Refreshing for every rendering is not a solution but a work around to have the native browser document trigger "ready" again. The solution is to have these wikipage (not html document) related actions be bound to its ready event and be able to fire that on-demand if the wiki page has changed (e.g. due to ajax navigation, live preview or page rendering like VisualEditor).

This has been solved and it is up to gadgets to start using it.

I'm rephrasing this bug to instead be a task for VisualEditor to start using this event (like LivePreview does in core).

gerritbot added a comment.Via ConduitJul 18 2013, 1:39 AM

Change 74313 had a related patch set uploaded by Krinkle:
mediawiki.page.ready: Use wikipage.content instead of domready

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

Esanders added a comment.Via ConduitJul 18 2013, 7:33 PM

We may need this to fire when we re-render parts of the document in editing mode, e.g. you are using the Math extension with JS rendering (MathJax), or you re-render a template containing a makecollapsible.

Mattflaschen added a comment.Via ConduitJul 19 2013, 10:52 PM

Some cases (e.g. navigation popups) may not want to fire in editing mode. I'm not sure if that's best done with a separate hook, or just by making the listener check the mode.

gerritbot added a comment.Via ConduitJul 26 2013, 12:18 AM

Change 74313 merged by jenkins-bot:
mediawiki.page.ready: Use wikipage.content instead of domready

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

Krinkle added a comment.Via ConduitJul 30 2013, 4:26 PM

This hook will not fire in VisualEditor's editing mode. Nodes are protected and don't allow interaction anyway.

These hooks are for enhancements. Anything that's required for display should be handled by VisualEditor's ContentEditable node implementation (e.g. including Timeline, Math, etc.).

gerritbot added a comment.Via ConduitJul 30 2013, 5:58 PM

Change 76751 had a related patch set uploaded by Krinkle:
mw.ViewPageTarget: Fire 'wikipage.content' hook after saving

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

gerritbot added a comment.Via ConduitJul 30 2013, 8:47 PM

Change 76751 merged by jenkins-bot:
mw.ViewPageTarget: Fire 'wikipage.content' hook after saving

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

Jdforrester-WMF added a comment.Via ConduitJul 30 2013, 9:10 PM

This is now merged and will be deployed later today.

Thryduulf added a comment.Via ConduitAug 22 2013, 3:28 PM

Javascript (or at least navigation popups) are again not working after a page is saved but do work when the page is reloaded.

To test:

  1. Enable the navigation popups gadget
  2. View any page editable in VE
  3. Hover over any link to see a popup
  4. Load the page in VE and save an edit (it doesn't mater what)
  5. Hover over any link and fail to see a popup.
  6. Reload the page, hover over the link and see a popup
He7d3r added a comment.Via ConduitAug 24 2013, 12:23 AM

The code of the gadget is not using the 'wikipage.content' hook introduced to fix bug 30713 (and added to VE on Gerrit Change 76751):
https://en.wikipedia.org/wiki/MediaWiki:Gadget-popups.js

I've made a request for this on its talk page:
https://en.wikipedia.org/wiki/MediaWiki_talk:Gadget-popups.js#Use_the_.27wikipage.content.27_hook

He7d3r added a comment.Via ConduitNov 3 2013, 10:20 AM

Hmm... Visual editor still doesn't call MathJax after saving the page (all I see is the source code of the formulas, e.g. $ \mathbb{N} $).

matmarex added a comment.Via ConduitNov 3 2013, 11:26 AM

That's because the Math extension doesn't support this yet; see bug 36060.

Mattflaschen removed a subscriber: Mattflaschen.Via WebDec 3 2014, 5:32 AM

Add Comment