Requests for comment/Live preview
A proposal to update the code in the UserPreference "Use live preview (experimental)".
Live preview | |
---|---|
Component | General |
Creation date | |
Author(s) | Quiddity |
Document status | Declined See Phabricator. |
Background
editWe 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.
- Aha! TheDJ is amazingly fantastic as always, and is already working on some parts of this, at https://gerrit.wikimedia.org/r/#/c/131346/ and possibly more in bugzilla:39272 (Live Preview tracking bug)
Proposal
editI 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 | ||||||
Retain cursor position | ||||||
<ref>, <references /> | ||||||
<ref name=""> defined outside edited section | ||||||
Configurable button location | n/a | Takes over the default submit buttons | (config) | |||
Not scrolling to top on preview | configurable, on by default | (see wikEd help for scrolling buttons and shortcuts) | ? | |||
<syntaxhighlight> (GeSHi) on non-.js/.css pages | ||||||
<categorytree> | ||||||
<math> | ||||||
Raw watchlist editing preview | ||||||
Hovercards (beta) | (upcoming version) | |||||
Media viewer (video clip) support | WIP, see T74675 | (upcoming version) | ||||
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 (talk • contribs) 23:23, 15 September 2012 (UTC)"
- "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)"
- "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 (talk • contribs) 23:23, 15 September 2012 (UTC)"
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)
- RFC was removed from consideration. The reason being that it is mostly already implemented or underway to being implemented.
References
edit- ↑ wikEd code: User:Cacycle/wikEd.js, see the following consecutive functions: wikEd.LocalPreview(), wikEd.LocalPreviewAjaxHandler(), wikEd.GetArticleText(), wikEd.GetArticleTextAjaxHandler(), wikEd.ParseNamedRefs(), and wikEd.FilePreviewAjaxHandler()