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 (2010) (T289794).
We're proposing to expose the API in a similar way to mw.plugin.page.watch.ajax, e.g. mw.plugin.page.preview.
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( 'mediawiki.page.preview' ); 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.