Last modified: 2014-09-22 02:18:29 UTC
Since Gerrit change #87917 the preview feature from LiquidThreads is not using AJAX. When I click on preview: * It shows a popup saying "You have unsaved text open on this page. You may lose it if you go away from this page." * If I confirm, it reloads the page instead of showing a spinner and updating just the content.
This is because LiquidThreads is relying on core edit.preview.js to bind the click handler on the document.body. I'll undo that part of the optimisation for now but this is really something that LQT should fix. A click handler on an element by the ID of '#wpPreview' is not a public API and LQT has no business in trying to hijack that click. The reason LQT could do this until now is because it basically reproduces most of the EditPage HTML (including the exact HTML IDs and classes on buttons and other form fields), except for the 'id="editform"' attribute on the form element. At first I thought adding that ID wouldn't help (since LQT creates it dynamically and the core js would've already run) but actually it would fix it because LQT loads the core javascript manually. It does need to take care to re-use that element once bound, but that shouldn't be a problem. In the short to medium term LQT developers should either not re-use this core javascript file and just write a few lines that do the same, or write a patch in core to make it a proper javascript interface.
Change 88619 had a related patch set uploaded by Krinkle: mediawiki.action.edit.preview: Fix for LiquidThreads hack https://gerrit.wikimedia.org/r/88619
Krinkle, should this be marked as FIXED or it requires some extra cleanup?
(Quoting comment #1) > I'll undo that part of the optimisation for now but this is really something > that LQT should fix.
Should we change the bug title then? (The live preview of a reply is working again)
https://gerrit.wikimedia.org/r/#/c/88619/ was merged ages ago. (In reply to Helder from comment #5) > Should we change the bug title then? Yes. But no idea to what. Feel free to go ahead. :)