Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

124
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda