vendure-ecommerce / vendure

The commerce platform with customization in its DNA.
https://www.vendure.io
MIT License
5.39k stars 943 forks source link

Default value in RichTextEditor #2884

Open phuoymakara opened 2 weeks ago

phuoymakara commented 2 weeks ago

Describe the bug Hello all, I need help I can not set the default value in RichTextEditor in the React Component.

To Reproduce Steps to reproduce the behavior: <RichTextEditor name="content" readOnly={false} defaultValue={<p>hello</p>} />

michaelbromley commented 1 week ago

I managed to implement support for defaultValue, but there is still a bug whereby after the first keypress in the editor, the component seems to un-mount and re-mount again, resetting the content to empty.

Due to my lack of in-depth understanding of React, I'm finding this hard to solve. For some reason, the useEffect clean-up is being called after the first key press.

@AleksanderBondar maybe you have time to take a look?