Rovak / InlineAttachment

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

doesn't work in firefox 26(latest) #25

Open jurek7 opened 10 years ago

jurek7 commented 10 years ago

On paste only(drag & drop works):

TypeError: clipboardData.items is undefined

Rovak commented 10 years ago

Hi Jurek,

This may relate to a comment i posted earlier about browser compatibility, https://github.com/Rovak/InlineAttachment/issues/22#issuecomment-31296773

I will doublecheck if anything has changed in the latest firefox which may allow the browser to read clipboard data during a paste event.

jurek7 commented 10 years ago

i checked similar javascript on http://pasteboard.co/ and it works.

Rovak commented 10 years ago

Thanks for pointing to a working implementation in firefox, most likely it is using a contenteditable element which catches paste event with the data. I'm not sure how this works in combination with a textarea.

I will keep this issue open for further research

fcsonline commented 10 years ago

I'm totally agree about the compatibility check, however I just created a PR to mitigate this issue.

https://github.com/Rovak/InlineAttachment/pull/31

acpadhi commented 9 years ago

Here is another link, that may show some pointers about how to do it in firefox. http://joelb.me/blog/2011/code-snippet-accessing-clipboard-images-with-javascript/

BTW, the link is from the same guy who did pasteboard.co , at least that is what I read in some forum.

I read somewhere else also(can't remember the URL, shall check and post again) which has a working version in Chrome, but for firefox, mentions, just loose focus from the text area and then paste. So I think, that trick could also be used. I had checked it to be working fine too on firefox, but after losing focus from the area of interest.

Rovak commented 9 years ago

Thanks for the pointers, i will try and implement it in version 2

Rovak commented 9 years ago

Got a prototype working in #41

acpadhi commented 9 years ago

Excellent. Already past midnight here. I will try it over the weekend and report my findings.

For the time being, I am already using your published version in my personal website which i am developing for blogging purposes. I am surely keen to have this working well, and most likely will explore options on how to integrate with CK Editor as well in the simplest way.

Shall keep you posted on my testing with your recent changes around weekend or Monday.

Rovak commented 9 years ago

I just made an update which moved the firefox logic to the core of InlineAttachment, this means it should now "just work" without making any changes to existing code.

I only made it for the default textarea now (see https://github.com/Rovak/InlineAttachment/blob/2.0.0-firefox/demo/input.html), i will add the other editors later.

layerssss commented 9 years ago

Hi, rovak, you might want to check out my work paste.js. I managed to made a unified image-pasting interface for IE9+/Chrome/Firefox. Hope it can help solve this issue.

Anyway, I still can't make it work for safari. It seems hopeless.

Rovak commented 9 years ago

@layerssss thanks for the pointer! I will take a look at it.

Rovak commented 9 years ago

Looks like Paste events will be supported in Firefox 41, see https://developer.mozilla.org/en-US/Firefox/Releases/41. Will add support when 41 is released