DEV Community

Discussion on: Setting up a basic rich text editor in React

Collapse
 
crimsonmed profile image
Médéric Burlet

The idea is indeed to restrict the length. Have you tried working with CKEdit plugins?
ckeditor.com/old/forums/CKEditor-3...

This looks promising for limiting the number of characters.

CKEdit clipboard is an extension that you also have to install:
ckeditor.com/docs/ckeditor5/latest...

You could also check this:
stackoverflow.com/questions/497090...

They look at pasting the clipboard content as text. This would remove any formatting that needs to happen and might lighten the load a lot.

Thread Thread
 
johnniepop profile image
Ivan Popov

Hi Médéric,
Thanks for your time.

I've seen some of the resources you provided. The point is that all of those, and the other working solutions I've found are vanilla javascript, and I can't figure how to reuse them in my react component. I mean, I already have the length altering function but I can't figure out with what prop to access it.

As for the plugin, yes it was one of the first things I tried but weirdly, after a seemingly successful installation, my project stops compiling (the '@@ckeditor/ckeditor5-clipboard' package is seen from the editor but not from the compiler).

Here (github.com/ckeditor/ckeditor5-reac...) I found a piece of useful example code but still not sure how to link it to the CKEditor component. I might ask a question directly in the project.

Cheers!

Thread Thread
 
johnniepop profile image
Ivan Popov
Thread Thread
 
johnniepop profile image
Ivan Popov • Edited

So a CKEditor dev gave some useful hints and I managed to fix my problem. I posted my solution also on stackoverflow: stackoverflow.com/questions/652636...