title: How to get the HTML of selected elements using TypeScript?
body: <p>I am running an <code>Ionic 2</code> app with <code>TypeScript</code> and I need to get the <code>HTML</code> of the items, selected by the mouse, when clicking a specific button.</p>
  
  <p>I have tried different solutions, but none of these seemed to work. This is important because I should be able to retrieve an image URL in case an image is included in the selected text.</p>
  
  <p>With my current solution, images are not even shown in the text selection.</p>
  
  <p>How could I make it work in <code>TypeScript</code>? I have tried replacing <code>document.selection</code> to <code>.getSelection()</code> etc, but without any luck.</p>
  
  <hr>
  
  <p><strong>HTML</strong></p>
  
  <p><code>&lt;p&gt;test &lt;b&gt;ok&lt;/b&gt; &lt;img src="./test.jpg" /&gt; &lt;/p&gt;</code></p>
  
  <p>When Ok and the image are selected, the output should be</p>
  
  <p><code>&lt;b&gt;ok&lt;/b&gt; &lt;img src="./test.jpg" /&gt;</code></p>