Page MenuHomePhabricator

Refactor preview front-end into reusable API
Open, Needs TriagePublic8 Estimated Story Points


The preview-fetching and -displaying logic in mediawiki.action.edit.preview.js should be moved into a new reusable JS API, so that it can also be used by the new realtime preview function that's being built into WikiEditor (T289794).

We're proposing to expose the API in a similar way to, e.g.

The new API should be able to handle fetching the preview and inserting it in all required places in the HTML page, and also optionally only return the info in case callers want to do specific things.

var preview = require( '' );
preview.doLivePreview(); // Will do much the same as the existing function with this name.

The live-diff won't be changed by any of this.

Event Timeline

Samwilson added a subscriber: Krinkle.

@Krinkle we thought that you might have an opinion on the naming and structure of this new API. Does the above sound okay to you? Or do you know who else we should ping?

ldelench_wmf set the point value for this task to 5.Oct 27 2021, 11:54 AM
ldelench_wmf moved this task from New & TBD Tickets to Estimated on the Community-Tech board.
NRodriguez changed the point value for this task from 5 to 8.Dec 6 2021, 4:01 PM

Change 745962 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/core@master] [WIP] Refactor preview frontend logic into JavaScript API