mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
If a user copies a gif from a website into their clipboard and then tries to paste it into the Discourse composer, we would only paste a static single frame of the original gif. This happens because the browser doesn't store the original image in the clipboard, but two entries: 1. image/png with the frame of the copy moment 2. text/html with the markup of the gif img element This commit adds an heuristic that detects this and makes us pick the clipboard content of text/html instead of the image/png when this happens. From there our existing HTML paste logic handles and converts the HTML img tag into markdown, preserving even the alt text. See https://meta.discourse.org/t/-/218720 for context.