# Firefox 50 makes image pasting hack superfluous

**URL:** https://meta.discourse.org/t/firefox-50-makes-image-pasting-hack-superfluous/48017
**Category:** Development
**Created:** [July 31, 2016, 2:25am UTC](https://meta.discourse.org/t/firefox-50-makes-image-pasting-hack-superfluous/48017 "2016-07-31T02:25:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![claas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/claas/32/71725_2.png) [@claas](https://meta.discourse.org/u/claas)
#### Post date: [July 31, 2016, 2:25am UTC](https://meta.discourse.org/t/firefox-50-makes-image-pasting-hack-superfluous/48017/1 "2016-07-31T02:25:33Z")

</div>

There is still some time until [Firefox 50 becomes stable in November 2016](https://wiki.mozilla.org/RapidRelease/Calendar), but as a noteworthy number of developers could use it already from September when it will promoted to [Firefox Developer Edition](https://www.mozilla.org/en-US/firefox/developer/) (in fact, I’m using it already with [Firefox Nightly](https://nightly.mozilla.org/)), I suppose it is not too early to point out that the following _firefoxPastingHack_ for pasting images will not be necessary (and even counterproductive) any more due to `clipboardData.items` being implemented in Firefox 50 (see [Mozilla Bug 906420](https://bugzilla.mozilla.org/show_bug.cgi?id=906420)):

> <https://github.com/discourse/discourse/blob/3200d836f70a4233c3d7b8ed7605ba1d2720d314/app/assets/javascripts/discourse/components/composer-editor.js.es6#L296-L377>

This said, pasting an image into Discourse using Firefox 50 currently yields two to four (mostly three) instances of the same image being inserted:

> ![](https://global.discourse-cdn.com/meta/original/3X/8/f/8f9c2c3fb9b0a1367502743f84b81dd94becb7cd.png)

This is due to the fact that the paste event contains both a _png_ and a _jpeg_ version of the image. Whether this is intended or not, is expected to be cleared very soon (in [Mozilla Bug 1290688](https://bugzilla.mozilla.org/show_bug.cgi?id=1290688)) and so we can anticipate a fix or (if it’s a feature) a hint on how to solve this conceptually.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 31, 2016, 4:13am UTC](https://meta.discourse.org/t/firefox-50-makes-image-pasting-hack-superfluous/48017/2 "2016-07-31T04:13:01Z")

</div>

Nice, perhaps we can switch to feature detection as opposed to user agent ?

---

<div class="post-metadata">

### Author: ![claas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/claas/32/71725_2.png) [@claas](https://meta.discourse.org/u/claas)
#### Post date: [July 31, 2016, 12:17pm UTC](https://meta.discourse.org/t/firefox-50-makes-image-pasting-hack-superfluous/48017/3 "2016-07-31T12:17:41Z")

</div>

> [@sam](#):
>
> Nice, perhaps we can switch to feature detection as opposed to user agent ?

That would be ideal. If not possible, it would suffice to add a version constraint here:

> <https://github.com/discourse/discourse/blob/3200d836f70a4233c3d7b8ed7605ba1d2720d314/app/assets/javascripts/discourse/components/composer-editor.js.es6#L299>

---

<div class="post-metadata">

### Author: ![claas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/claas/32/71725_2.png) [@claas](https://meta.discourse.org/u/claas)
#### Post date: [August 17, 2016, 7:47pm UTC](https://meta.discourse.org/t/firefox-50-makes-image-pasting-hack-superfluous/48017/4 "2016-08-17T19:47:13Z")

</div>

The issue is now fixed [in Discourse](https://github.com/discourse/discourse/commit/24201d4638884e57fec1d47fdfdf697e49f30f56) and [in Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=1290688#c15), so this topic can be closed.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [August 17, 2016, 7:47pm UTC](https://meta.discourse.org/t/firefox-50-makes-image-pasting-hack-superfluous/48017/5 "2016-08-17T19:47:29Z")

</div>


