I do not see a direct fix, but you could use a json field with a custom editor.
Instead of just saving the string you save your content as a json object.
{
"text": "<p>Hello World</p>",
"wordCount": 2
}
The only disadvantage is that json fields cannot be searched.
You could also use the approach to add two more fields:
- textAndWordCount (JSON)
- text (String)
- wordCount (Number)
then you a normal schema to extract both fields from the json field
ctx.data.text.iv = ctx.data.textAndWordCount.iv.text
ctx.data.wordCount.iv = ctx.data.wordCount.iv.text
replace()
another alternative is a script, but this is complicated.
First you have to get the texts from the html, this is complicated and you have to search for a regex solution or so.
Then word count should be easy as long as you do not have to deal with chinese characters or so.