The simples way to do HTML based editing is for the client to receive fully annotated parsoid HTML, modify it, and then send back the modified HTML (plus optionally the unmodified HTML, for selser). This is much simpler than the approach used by Visual Editor on WMF sites, which relies on server side stashin of content to save bandwidth.
It would be simple enough to allow the PageHTMLHandler to return fully annotated HTML for editing.
Parsoid can generate three flavors of HTML:
- HTML suitable only for page views. No data attributes or element IDs needed.
- with data-parsoid attributs inlined,
- with only element IDs inlined, with data-parsoid (page bundle) stashed.
Currently, PageHTMLHandle effectively supports two flavors:
- per default, it returns HTML with parsoid element IDs
- if the stash parameter is set, it will also stash the page bundle in the background.
To support output of fully annotated HTML, we will need to:
- introduce a flavor parameter. flavor=view is the default, flavor=edit is the new mode. We may want to support additional flavors in the future (e.g. a low bandwidth flavor).
- If stash is set, that implies flavor=edit. If both are set and flavor is not "edit", an error should be returned.
- The ETag of the fully annotated HTML must be different from the ETag of the stripped HTML.
- Currently, the "view" flavor will return the same HTML as the "edit"+"stash" (no data-parsoid attributes). So they may have the same ETag.
- There is a bit of confusion here: based on the intent, "stash" implied "edit". But effectively, "stah" causes the same freturn value as "view".