WYSIWYG: char counter and maxChar limit in datatype fix

What was the issue? 

There was no easy way of limiting the number of characters in a WYSIWYG, which was a feature that could be really useful to us and many other developers for limiting content for the end-user. In addition to limiting the number of characters, a character counter would also be of use by constantly showing the number of characters while the user is typing. 

How did you solve it? 

For the feature to be implemented, I had to add the wordcount plugin for CKEditor, which is the component Pimcore uses for its editable WYSIWYG. After adding the required files and initializing them in the CKEditor configuration, I’ve added a maximum character field to the WYSIWYG data type which I would then read while initializing the editable and apply character limiting if it was set.

Why is this fix important?

In some projects, while the documentation was being written we encountered the need to limit the number of characters a WYSIWYG could hold. Currently, there is no counter and limiting isn't possible. By adding this, we could finally use character limiting natively inside Pimcore without any hassle and I think that many other developers will appreciate this feature as well.

How does it feel to contribute to a platform such as Pimcore? 

Since this is my first contribution on an open-source project ever, plus it’s for Pimcore which I use on a daily basis (and enjoy it of course), I’ve been delighted to be part of the contributing community. Feels special knowing that you can say ‘hey, I did that’, once your contribution gets released. 

And if you want to check out this pull request, just follow the link! 

Looking for Exponential Growth? Let’s Get Started.
Explore next

Pimcore guides & How to

Collection of latest concepts, viewpoints and examples from the Pimcore word written by Pimcore industry experts.

Discover more