Hi.
I have an extension that hooks into ParserAfterParse to modify the generated HTML (Lingo). The problem is, that apparently this hook is never called when a page is edited using Visual Editor, which means my extension does not get to modify the page's HTML content until it is purged (action=purge) or edited using the old editor.
Is this intentional or is it a VE bug? Does anybody have any advice on how I could work around this? E.g. an alternative hook I should use?
Cheers Stephan
VE's edits should be (indirectly) going through the action=edit API.
On 8 October 2016 at 20:56, Stephan Gambke s7eph4n@gmail.com wrote:
Hi.
I have an extension that hooks into ParserAfterParse to modify the generated HTML (Lingo). The problem is, that apparently this hook is never called when a page is edited using Visual Editor, which means my extension does not get to modify the page's HTML content until it is purged (action=purge) or edited using the old editor.
Is this intentional or is it a VE bug? Does anybody have any advice on how I could work around this? E.g. an alternative hook I should use?
Cheers Stephan _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Hi,
VE's edits should be (indirectly) going through the action=edit API.
I'm not sure this answer is very helpful. I wonder about this as well whether edits initiated by VE/NWE will actually end-up being processed by the standard hooks available or not (and I'm mean those provided by PHP, no disrespect but I don't care much for node.js, parsoid or whathever is en vogue these days).
As an extension developer (with limited volunteer time), I don't have the desire to create a setup to incur a technical dept beyond HTML/JS and PHP but to users who use our extensions I would expect that hooks such as `ParserAfterTidy`, `ParserAfterParse` or `InternalParseBeforeLinks` or run no matter what or how an edit was made.
Cheers
On 10/8/16, Alex Monk amonk@wikimedia.org wrote:
VE's edits should be (indirectly) going through the action=edit API.
On 8 October 2016 at 20:56, Stephan Gambke s7eph4n@gmail.com wrote:
Hi.
I have an extension that hooks into ParserAfterParse to modify the generated HTML (Lingo). The problem is, that apparently this hook is never called when a page is edited using Visual Editor, which means my extension does not get to modify the page's HTML content until it is purged (action=purge) or edited using the old editor.
Is this intentional or is it a VE bug? Does anybody have any advice on how I could work around this? E.g. an alternative hook I should use?
Cheers Stephan _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
-- Alex Monk VisualEditor/Editing team https://wikimediafoundation.org/wiki/User:Krenair_(WMF) _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Sat, Oct 8, 2016 at 5:37 PM, James HK jamesin.hongkong.1@gmail.com wrote:
Hi,
VE's edits should be (indirectly) going through the action=edit API.
I'm not sure this answer is very helpful.
To translate: "it should work exactly the same as edits made with the API", or to elaborate further: "yes, a ParserAfterParse hook should be called at parse time after an edit made with VisualEditor, though it won't be reflected while you're looking at Visual Editor".
There might, however, be something about how the hook is being used that causes it not to do what is expected when editing is done via the API versus when it's done using the classic editor form.
For instance, if the hook assumes it's happening during action=edit and tries to pull data from $_REQUEST or $wgRequest, it will very likely fail in this and other circumstances when parsing happens separately from an edit, or happens during an edit but with different parameters and circumstances than the classic HTML form editor.
Without knowing what the hook is doing, it's hard to say whether something else might be going wrong.
-- brion
On 9 October 2016 at 01:37, James HK jamesin.hongkong.1@gmail.com wrote:
VE's edits should be (indirectly) going through the action=edit API.
I'm not sure this answer is very helpful. I wonder about this as well whether edits initiated by VE/NWE will actually end-up being processed by the standard hooks available or not
It means yes, all VE edits should be going through the normal API edit processing code used by thousands of scripts, bots and external clients every day. I expect it works roughly the same as the UI edit processing code - if not, that's more likely a bug with ApiEditPage than with the VisualEditor extension. https://phabricator.wikimedia.org/diffusion/EVED/browse/master/ApiVisualEdit...
wikitech-l@lists.wikimedia.org