Wikimedia-contrib icon indicating copy to clipboard operation
Wikimedia-contrib copied to clipboard

[TemplateScript] support VisualEditor

Open Pathoschild opened this issue 10 years ago • 2 comments

Add support for editing VisualEditor content. TemplateScript already supports the #wpTextbox1 wikitext editor and CodeEditor (since 2.0).

Pathoschild avatar Aug 29 '15 18:08 Pathoschild

VisualEditor support is tricky:

This raises a few issues for TemplateScript:

  • TemplateScript assumes all content can be manipulated through a text representation. That isn't true for VisualEditor. For example, with some work it could edit the text but it couldn't manipulate links which are non-textual.
  • Scripts that deal with wikitext won't work as expected (for example, '''bold text''' won't match bold text).
  • Search & replace across format boundaries need to resolve the boundaries somehow. (For example, do we bold the replace if half the match is bold?)

Pathoschild avatar Aug 29 '15 19:08 Pathoschild

If I remember correctly, there is a way to get the wikitext which corresponds to the current VisualEditor representation the user is seeing in a page (no idea what is the command for that though), and this could be used so that users can apply the usual search/replace to this representation before saving the page (but if I'm not mistaken, this would have to be saved through the usual ways instead of using VE - that is, it would only be useful if the replacements are done after the user finished using VE for changing the page).

It is likely the same principle which allows one to switch to wikitext while editing with VE, but not to switch back to VE once the user is using wikitext.

he7d3r avatar Aug 29 '15 19:08 he7d3r