A brand new CharacterCount extension
Published December 9th, 2021 by @hanspagel
The CharacterCount extensions is one of those tiny, but really useful utility-like extensions. Its job is to count characters and limit the input. Shouldn’t be that hard we thought.
Turned out it is. The counting was off in too many cases and the way we limited the content led to strange behaviour in a lot of cases. Thanks to all the bug reports we’ve got a pretty picture of what’s wrong, what people want and how complex it is to get even that seemingly small task right.
Philipp took all your input and did a complete rewrite of the extension. Here are my favorite cases we handle now (but didn’t before):
- Dispatching a transaction that adds content before and after the document? That’ll get blocked.
- Paste a really long text and it’s just trimmed to the configured length.
- Paste content with a table where the limit would chop off half the table: Blocked.
With the new extension you can also switch between two different counting modes, count characters or words, and can even count characters just for a specific node.
Read more about the rewrite in the Pull Request on GitHub and more about the
CharacterCount extension in the docs.