title: Confluence: copy to clipboard button
body: <p>I am using Confluence 5.10.8. On some pages I have several text snippets to be copied to the clipboard by the reader. For each of those text snippets I would like to be able to add a non-editable text field and a button to copy the text to the clipboard when clicking it, maybe like this:</p>
  
  <p><a href="https://i.stack.imgur.com/Ruh8R.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ruh8R.png" alt="enter image description here"></a></p>
  
  <p>I also need some visual feedback to indicate the text was copied.</p>
  
  <p>I think a <a href="https://confluence.atlassian.com/doc/writing-user-macros-4485.html" rel="nofollow noreferrer">user macro</a> is the right thing to do this, right? Something like (does not copy yet):</p>
  
  <pre><code>## @param Text:title=Text|type=string|required=true|desc=The text to be displayed and copied 
  &lt;!-- font-awesome contains the clipboard icon --&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"&gt; 
  &lt;span style="white-space: nowrap"&gt;
      &lt;input type="text" value="$paramText" size="$paramText.length()" readonly&gt;
      &lt;button class="fa fa-clipboard" title="click to copy"&gt;
  &lt;/span&gt;
  </code></pre>