VE currently supports basic manipulations using surface.change( transaction ) or to do replacements similar to FindAndReplace dialog but it has some gaps:
Not intuitive/no interface for replacements - Some scripts use different tricks for doing replacements (en:User:ערן/veReplace.js, ro:Utilizator:Strainu/ve.js) and a standard and easy method for doing it would make it easier for future maintenance and for supporting those usages.
Global replacements aren't supported - Going global replacements similar to hewiki/fawiki scripts isn't possible with the current model, and even if it is it would be inefficient (hewiki runs ~850 regex replacements on the whole document)
Replacement that keep annotations aren't possible
Who would benefit: At least fawiki, hewiki, rowiki and ruwiki users, presumably many more
What most of the scripts needs are:
A utility function for doing replacement (similar to ve.dm.Document.prototype.findText maybe ve.dm.Document.prototype.replaceText)
The replacement should be able to keep the annotations
Advance use: sometimes (as you can see in fawiki) replacements are context aware. It may be too far to support such complex replacements within ve itself, but providing documentation how to do it would be great.
Moved from Bots and gadgets to Editing as we supposedly would want a general solution rather than a gadget on a few select wikis. Max Semenik (talk) 19:48, 8 November 2017 (UTC)
I support this request. I think this is a major blocker for advanced gadgets for VisualEditor, hence blocker for wider adaption of VE for experienced users. eranroz (talk) 10:36, 17 November 2017 (UTC)