The first thing you need to do is actually listen to the event. While you probably listen on a part of a DOM, it made the most sense to me to listen at the window level: window.addEventListener('paste', e => { // do stuff }); Easy peasy.
When the event is fired, your event object gets a clipboardData object. This object is used both for reading and writing to the clipboard. You can, if you choose, prevent the default paste behavior with the usual e.preventDefault(). This will impact pasting into form fields for example.
There are then two ways you can access the data from the paste. The first involves the method which as you would expect, gets data from the clipboard. If you copy HTML, you get a plain text copy of the HTML. If you want the HTML, you can do: let data = e.clipboardData.getData('text/html'); Interestingly enough, if you take this result and add it to the DOM, it looks great.
Collection
[
|
...
]