There is a certain html in the clipboard

<img src="http://this.site-tt.ru/photos/opacity.png" class="ke ke-D83DDE12" emoji="D83DDE12" style="background-image: url(&quot;../img/emoji.png&quot;);"> 

there is a text field, suppose, the usual paragraph (p), where I paste the text of their clipboard. You can make it so that I put in an already formatted html (with the link cut off and the 'style' attribute removed):

 <p contenteditable="true"><img src="/photos/opacity.png" class="ke ke-D83DDE12" emoji="D83DDE12"></p>. 

Or, make it so that it is copied to the buffer already formatted, as in "p"

  • How does this markup go into buffer exchange? Simple copying or using execCommand ('copy')? How is this inserted into <p>? - MedvedevDev
  • Ctrl + v, or pkm> paste, because I don’t know how else)) - Zhabka azazina
  • Or, you can make it so that when ctrl + v (or pkm> paste), this tag is not inserted at all, but only the text - Zhabka Azazina

1 answer 1

Demo

 Дальше обрабатываешь данные 

Be careful, there are es6 features, in some browsers, especially old ones will not work. You can use polyfills