title: How can I copy to clipboard and preserve formatting
body: <p>I have some text that I have inputted into a &quot;dangerouslySetInnerHTML&quot; to display appropriate formatting. The formatting includes line breaks, bold tags and hyperlinks.</p>
  <p>I want a user to be able to copy from clipboard while preserving the formatting of the template.</p>
  <p>I managed to copy from clipboard but the copied text includes the raw html and not the formatting.</p>
  <p>Ex.</p>
  <pre><code>const myTemplate = &lt;p&gt;Hello &lt;a href=&quot;${link}&quot;&gt;User&lt;/a&gt;&lt;/p&gt;
  
  //Template 
  &lt;Dialog
    isShown={showDialog}
    onCloseComplete={() =&gt; setShowDialog(false)}
    topOffset={4}
    footer={
       &lt;Button onClick={() =&gt; navigator.clipboard.writeText(
               document?.getElementById('to-copy')?.innerHTML,
              )
            }
            &gt;
            Click here to copy the template
           &lt;/Button&gt;
  
  
  &lt;div id=&quot;to-copy&quot; dangerouslySetInnerHTML={{ __html: `${myTemplate}` }}&gt;&lt;/div&gt;
  </code></pre>
  <p>Desired Output:</p>
  <p>Hello User(hyperlink)</p>