codeslayer1 / react-ckeditor

CKEditor component for React with plugin and custom event listeners support
MIT License
130 stars 34 forks source link

Don't update content if it is undefined #58

Open abumalick opened 5 years ago

abumalick commented 5 years ago

Hello,

Thanks for the great plugin !

The problem

In the current state, if content prop is undefined, the editor would reset his content on every update.

The solution

Check if content prop is defined before updating editor data.

Why do we want that ?

(I don't want the editor to be fully controlled because it will cause a lot of useless renders and a lot of calls to getData(), I prefer to update my content on blur event

Notes

If someone needs to reset the editor he can pass an empty string to the content prop.