Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
¿Cómo prellenar CkEditor con datos usando React.js?

Estoy creando un blog y quiero darle al usuario la posibilidad de actualizar su publicación, pero no estoy seguro de cómo pasar los datos de contenido de la publicación original a mi editor de texto enriquecido.

 import { CKEditor } from '@ckeditor/ckeditor5-react' import ClassicEditor from '@ckeditor/ckeditor5-build-classic' function UpdatePost() { const [content, setContent] = useState('') const { post_id } = useParams(); useEffect(() => { const fetchPost = async () => { const formData = await getPost(post_id); setContent(formData.content); }; fetchPost(); }, [post_id]); const handleSubmit = async (event) => { event.preventDefault(); const updated = await updatePost({ post_id, content: content, }) }; return ( <div> <form onSubmit={handleSubmit} > <h1 class="create-post-header-text">Update Post</h1> <CKEditor config={{ placeholder: "Content..." }} class="ck-editor" editor={ClassicEditor} onChange={(event, editor) => { const data = editor.getData() setContent(data) }} /> </label> </form> </div > ); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede ayudar, prueba esto...

 <CKEditor config={{ placeholder: "Content..." }} class="ck-editor"`enter code here` editor={ClassicEditor} data={<div dangerouslySetInnerHTML={{ __html: content }} />} onChange={(event, editor) => { const data = editor.getData() setContent(data) }} / >
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!