Jump to content

Requests for comment/Live preview

From mediawiki.org
Request for comment (RFC)
Live preview
Component General
Creation date
Author(s) Quiddity
Document status Declined
See Phabricator.

A proposal to update the code in the UserPreference "Use live preview (experimental)".

Background

[edit]

We currently have Live preview as a default part of MediaWiki. It was created in 2007 (?) and hasn't changed much since. There are various newer and better userscripts.

Proposal

[edit]

I suggest merging the best bits of all the alternatives, into a single [gadget/extension/core feature] that can be used at all wikis (WMF and elsewhere).

I also suggest renaming it (because it's not "live" in the sense of concurrent, it's just quicker than default) to "fast preview" or similar.

A table comparing features.

Feature standard preview Manual:Live preview (code: git) w:User:Js/ajaxPreview (code: .js) w:User:Anomie/ajaxpreview.js wikEd code: [1] w:User:Pilaf/InstaView
Preserve undo history N Yes Yes Yes Yes Yes
Retain cursor position N Yes Yes N Yes Yes
<ref>, <references /> N N Yes Yes Yes N
<ref name=""> defined outside edited section N N N Yes Yes N
Configurable button location n/a Takes over the default submit buttons Yes (config) N Yes N
Not scrolling to top on preview N N Yes configurable, on by default N Yes (see wikEd help for scrolling buttons and shortcuts) ?
<syntaxhighlight> (GeSHi) on non-.js/.css pages Yes Yes Yes N Yes N
<categorytree> Yes Yes Yes Yes Yes N
<math> Yes Yes Yes Yes Yes N
Raw watchlist editing preview N N N N Yes N
Hovercards (beta) Yes Yes Yes N Yes (upcoming version) N
Media viewer (video clip) support Yes N WIP, see T74675 N N Yes (upcoming version) N
Server interaction method full page reload 1 json POST to api.php 1 json POST to api.php 1 json POST to api.php 1 html POST to api.php or 1 html non-API POST to index.php, uses Live preview if possible local
Remarks - - - - gadget on many Wikimedia wikis
(incl. up to ~56,000 users on Wikipedias, per m:Gadgets)
- Internet Explorer not supported
outdated code, not actively developed

Notes

[edit]
  • Most of the other variants I can find - e.g. w:User:CBM/quickpreview.js, fr:MediaWiki:Gadget-QPreview.js, etc - are based on Alex Smotrov's original script, which is what "User:Js/ajaxPreview" is from. Alex seems to have not edited in ~1 year, but I'll email him for feedback (and to thank him for the excellent scripts :).
  • There are two comments by TheDJ and Anomie in this 2012 thread that might be relevant, specifically:
    "The problem with all of them, is that they are unable to load JS and CSS that is specific to your view. So for instance, if you add a video, then preview, the JS code to handle the video won't be loaded. This is one of the primary reasons this functionality isn't on by default yet I presume. —TheDJ (talkcontribs) 23:23, 15 September 2012 (UTC)"[reply]
    "AFAIK, all of the currently available options do in fact use the servers anyway; most are posting to the MediaWiki API, while the "live preview" option in the preferences seems to contact its own private "API" on the servers. The VisualEditor and Parsoid projects may change this. Anomie 02:20, 16 September 2012 (UTC)"[reply]

Please add/fix further details or scripts, to the table. Thanks!

No script can reliably activate video clips, please help fixing this (see bug 72675). Cacycle (talk) 10:06, 4 November 2014 (UTC)[reply]
  • RFC was removed from consideration. The reason being that it is mostly already implemented or underway to being implemented.

References

[edit]
  1. wikEd code: User:Cacycle/wikEd.js, see the following consecutive functions: wikEd.LocalPreview(), wikEd.LocalPreviewAjaxHandler(), wikEd.GetArticleText(), wikEd.GetArticleTextAjaxHandler(), wikEd.ParseNamedRefs(), and wikEd.FilePreviewAjaxHandler()