Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

129
Vistas
How to Copy Formatted Email to Clipboard

I am using React and I have an email template that I want to provide users. I have created a formatted email component and tried using dangerouslySetInnerHTML to show the formatted email in a dialog.

I want to know if there is a way for me to add copy to clipboard button to copy the email with all of the formatting including bolding and hyperlinks.

I would prefer to use the FormattedEmail component but would be okay with using dangerouslySetInnerHTML.

Option 1

<Dialog
   isShown={showDialog}
   onCloseComplete={() => setShowDialog(false)}
   topOffset={4}
   footer={ <Button onClick={CopyToClipboard}> Click here to copy the template </Button>}
>
    <FormattedEmail />
</Dialog>

Option 2

<Dialog
   isShown={showDialog}
   onCloseComplete={() => setShowDialog(false)}
   topOffset={4}
   footer={ <Button onClick={CopyToClipboard}> Click here to copy the template </Button>}
>
 <div id="to-copy" dangerouslySetInnerHTML={{ __html:`${email}`}}></div>
</Dialog>

The FormattedEmail component is a combination of different typography html tags

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda