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

175
Views
Renderizar React-Component dentro de ContentEditable

Uso un ContentEditable de react-contenteditable , dentro de él me gustaría mostrar un botón, que abre un menú al hacer clic, como este . Ya funciona, cuando represento el botón normalmente como un componente (no dentro de Contendeditable).

Desafortunadamente, react-contenteditable solo me permite configurar el html como se muestra en este ejemplo .

Ya intenté usar ReactDomServer.renderToStaticMarkup y ReactDomServer.renderToString , pero el botón activa la función onClick definida cuando hago clic en él.

Aquí está el código que probé: ( addSummaryStatementButton es el botón correspondiente y ContentEditable el contenido editable correspondiente.

 render = () => { const addSummaryStatementButton = <AddSummaryStatementButton addSummaryStatement={() => console.log('add summary statement')}/>; const staticMarkup = ReactDomServer.renderToStaticMarkup(addSummaryStatementButton); const stringMarkup = ReactDomServer.renderToString(addSummaryStatementButton); let summary = this.props.summary; summary = summary + '<br />' + staticMarkup + '<br />' + stringMarkup; return <div className='summary-area'> <div className='summary'> <ContentEditable html={summary} disabled={false} // use true to disable edition onChange={this.handleChange} // handle innerHTML change spellCheck={false} onBlur={this.props.analyzeSummary} /> </div> </div>; };

¡Estoy muy feliz por cualquier idea!

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!