Default values ​​in Sun editor in React
P粉438918323
P粉438918323 2023-09-08 10:47:07
0
1
492

I want to set default values ​​for Sun editor.

The default value I got from the database

I set the default value like this but it doesn't work.

<SunEditor
     autoFocus={true}
     onChange={handleEditorChange}
     setOptions={toolbarOptions}
     defaultValue={guide.description}
/>

Data in the database Enter image description here

Only this works

<SunEditor
     autoFocus={true}
     onChange={handleEditorChange}
     setOptions={toolbarOptions}
     defaultValue={"<p>The editor's default value</p>"}
/>

P粉438918323
P粉438918323

reply all(1)
P粉885035114

Try the api function of react-sun-editor

<SunEditor
     autoFocus={true}
     onChange={handleEditorChange}
     setOptions={toolbarOptions}
     setContents={guide.description}
/>

Suneditor-react readme file link

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!