Rovak / InlineAttachment

Easily paste and upload files/images in plain textareas
http://git.razko.nl/InlineAttachment
MIT License
619 stars 77 forks source link

Question: Why does this library work only on Chrome? #22

Closed ritvvijparrikh closed 10 years ago

ritvvijparrikh commented 10 years ago

Hello Roy, do you know the specific reasons why the library works only in Chrome? We love this functionality and if you can guide us, we can contribute to extend it for other browsers - specially FF and Safari.

Rovak commented 10 years ago

Hi Ritvvij,

Drag & drop should work on all browsers which support the HTML 5 file api & dragdrop, which include Firefox and Safari.

The copy+paste support is still lacking in most browsers and only seems to work in Chrome for now. In Firefox the paste event is fired, but you need to manually enable clipboard data to be able to read images (source 1, source 2). Right now the library crashes in firefox when reading items here

There are some tricks to work around it by first converting an element to contenteditable and then handle the paste event, a pretty outdated article describes the solution here

Its been a while since i did a full compatibility check, i'll add a new issue in which i'll rerun tests in the current browsers.

ritvvijparrikh commented 10 years ago

Thank you. I saw the open task w.r.t. browser testing. We will add whatever we discover in our testing in comments of that issue.