Page MenuHomePhabricator

LivePreview doesn't allow interaction with page content outside of #wikiPreview (it is not passed to mw.hook)
Open, MediumPublic

Description

Currently, LivePreview only passes the $wikiPreview to the hook
https://github.com/wikimedia/mediawiki/blob/6709a1fd082bcbc1b89d499edeafa04fd2e8a517/resources/src/mediawiki.action/mediawiki.action.edit.preview.js#L101
but the script changes the page content in many other places:
https://github.com/wikimedia/mediawiki/blob/6709a1fd082bcbc1b89d499edeafa04fd2e8a517/resources/src/mediawiki.action/mediawiki.action.edit.preview.js#L31-L43
The new content for these parts should also be made available to the user, by passing them to the hook (as VisualEditor does, for example
https://github.com/wikimedia/mediawiki-extensions-VisualEditor/blob/ccdc215a9882d6bb3e079ca822f64c9089c0d363/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js#L1574
).

This would allow scripts like
https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-featured-articles-links.js&oldid=619815637
to update the modifications of the language links after the user makes some changes and use the live preview (in the example, the "badges" for featured/good articles in other languages).

Also, this is likely what UniversalLanguageSelector needs in order to fix bug T53029.

Details

Reference
bz69108

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:34 AM
bzimport set Reference to bz69108.
bzimport added a subscriber: Unknown Object (MLST).
TheDJ set Security to None.
TheDJ removed a subscriber: Unknown Object (MLST).