Firefox 50 makes image pasting hack superfluous

There is still some time until Firefox 50 becomes stable in November 2016, but as a noteworthy number of developers could use it already from September when it will promoted to Firefox Developer Edition (in fact, I’m using it already with Firefox Nightly), 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://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:

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) and so we can anticipate a fix or (if it’s a feature) a hint on how to solve this conceptually.

6 Likes

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

3 Likes

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

4 Likes

The issue is now fixed in Discourse and in Firefox, so this topic can be closed.

4 Likes