Last modified: 2014-04-16 19:18:43 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T59536, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57536 - VisualEditor: Fire a hook before the page is saved
VisualEditor: Fire a hook before the page is saved
Status: RESOLVED WONTFIX
Product: VisualEditor
Classification: Unclassified
MediaWiki integration (Other open bugs)
unspecified
All All
: Low enhancement
: ---
Assigned To: Editing team bugs – take if you're interested!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-25 13:16 UTC by Strainu
Modified: 2014-04-16 19:18 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Strainu 2013-11-25 13:16:23 UTC
Some Wikipedias have hooks for the source editor that process the wikitext before it is saved. The only thing to currently do this for the Visual Editor seems to be to hook in the 'wikipage.content' event and do an API edit that processes the text as intended.

Instead, the visual editor should offer a different event, such as visualeditor.beforesave, that would allow such processing to take place when saving the content.
Comment 1 James Forrester 2013-11-25 15:50:55 UTC
What stage of the save do you want? 

* HTML is ready to be saved
* HTML is converted to wikitext
* Wikitext is back from Parsoid and is ready to be saved
* VE just sent the wikitext to MW API
* VE just got the confirmation token back from MW API
* …
Comment 2 Strainu 2013-11-25 16:01:03 UTC
Ideally, there would be an event for each of these stages :) 

Realistically, in order to reuse existing code, the best time would probably be when the Wikitext is ready to be saved (since that would be the equivalent for pressing the "Save" button). Of course, the callback needs to be able to give the modified wikitext back to VE.
Comment 3 James Forrester 2014-04-16 19:18:43 UTC
Re-evaluating – if you want a client-side hook, this is a WONTFIX (both for specific reasons to this bug to do with catastrophic performance hits, and also because events are not a sane way to go).

If you want a VE-specific server-side (PHP) hook on wikitext save, we could do that more reasonably (as MediaWiki's too far down that road to pull back).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links