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

97
Views
Cómo se guarda la imagen en Draftwysiwyg en ReactJS

Uso el Draft wysiwyg para mi proyecto React.

Pero solo puedo obtener texto simple, pero no puedo obtener y guardar la imagen.

¿Cómo puedo guardar texto e imagen en mi servidor usando Draft wysiwyg ?

editor de texto componente:

 class TextEditor extends Component { constructor(props) { super(props); this.state = { editorState: EditorState.createEmpty(), uploadedImages: [], }; this._uploadImageCallBack = this._uploadImageCallBack.bind(this); } onEditorStateChange = (editorState) => { this.setState({ editorState, }); }; _uploadImageCallBack(file) { let uploadedImages = this.state.uploadedImages; const imageObject = { file: file, localSrc: URL.createObjectURL(file), }; uploadedImages.push(imageObject); this.setState({ uploadedImages: uploadedImages }); return new Promise((resolve, reject) => { resolve({ data: { link: imageObject.localSrc } }); }); } render() { const { editorState } = this.state; return ( <div style={{ height: "100%", width: "100%" }}> <Editor editorState={editorState} toolbarClassName='toolbarClassName' wrapperClassName='wrapperClassName' editorClassName='editorClassName' onEditorStateChange={this.onEditorStateChange} toolbar={{ inline: { inDropdown: true }, list: { inDropdown: true }, textAlign: { inDropdown: true }, link: { inDropdown: true }, history: { inDropdown: true }, image: { uploadCallback: this._uploadImageCallBack }, inputAccept: "application/pdf,text/plain,application/vnd.openxmlformatsofficedocument.wordprocessingml.document,application/msword,application/vnd.ms-excel", }} /> </div> ); } } export default TextEditor;

Uso el componente TextEditor , que es un componente de clase, en otro componente, que es el componente funcional, y de ahí envío los datos al servidor.

gracias por los que me ayudan!

about 4 years ago · Juan Pablo Isaza
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!