The paste event in browsers
Browsers allow you to capture a paste
event in a DOM element [1] [2].
This event fires before any clipboard data is inserted into the document, which makes it ideal for manipulating the data and pasting the manipulated data instead.
In Today I Learned by Hashrocket we recently utilized this feature to enable pasting images straight into the post editor. The image is then uploaded to imgur.com and the resulting URL is pasted as a Markdown Image Tag into the textbox.
If you are interested in adding similar functionality to your site check out this PR.
Also consider hosting your own fork of TIL.
Tweet