layerssss / paste.js

read image/text data from clipboard (cross-browser)
http://layerssss.github.io/paste.js/
MIT License
463 stars 94 forks source link

How to detect whether browser supports pasting? #36

Open jmuheim opened 7 years ago

jmuheim commented 7 years ago

Hey there

Thanks a lot for this amazing little helper, we use it in our web app extensively.

We have an image upload field, which is simply a textarea now, and using paste.js, a pasted image is converted to base64, and the base64 string is sent to the app and there saved as a normal PNG file.

At the moment, we rely on users having a supporting browser (IE11, FF, Chrome). But we'd like to add a switch that displays a normal upload field, when the browser doesn't support pasting.

Is there an easy way to detect this? You have this matrix in the README; it would be great to have a little JavaScript helper method returning true/false depending on support status.

Best wishes.

layerssss commented 7 years ago

Hi @jmuheim , there's no way to detect the support straight forward. But I can definitely put an API to indicate the support, after I can do some testing through BrowserStack, specifically around mobile browsers. 👍 I'll pop you when it's there.

layerssss commented 7 years ago

I mentioned mobile browsers because on some browsers / versions although there is API support, but no interaction for "paste" (i.e, press Ctrl + V)

jmuheim commented 7 years ago

Great, thank you! :-)

On 17 Feb 2017, at 00:27, Michael Yin <notifications@github.com mailto:notifications@github.com> wrote:

I mentioned mobile browsers because on some browsers / versions although there is API support, but no interaction for "paste" (i.e, press Ctrl + V)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/layerssss/paste.js/issues/36#issuecomment-280497983, or mute the thread https://github.com/notifications/unsubscribe-auth/ABuxxxgOTM9FuCbI-csV07l-nl3pEN96ks5rdNtlgaJpZM4MCuqR.

https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png https://github.com/layerssss/paste.js https://github.com/layerssss/paste.js/issues/36#issuecomment-280497983

jmuheim commented 7 years ago

Any news on this?

layerssss commented 7 years ago

@jmuheim I've found myself hard to allocate time for this. Do you have a schedule for implementing related feature in Reviewable? (I'll try to implement the API before that)

FYI: it's now working in Safari 🎉

https://github.com/layerssss/paste.js/issues/42

jmuheim commented 7 years ago

What's "Reviewable"?

No I don't have a schedule. Take yourself time, it's good to hear that you're planning to add it.

layerssss commented 7 years ago

Haha, my bad, forget my question. Yeah, I'll push it recently!

jmuheim commented 7 years ago

;-)

On 15 May 2017, at 12:45, Michael Yin <notifications@github.com mailto:notifications@github.com> wrote:

Haha, my bad, forget my question. Yeah, I'll push it recently!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/layerssss/paste.js/issues/36#issuecomment-301440563, or mute the thread https://github.com/notifications/unsubscribe-auth/ABuxx9mIJRN7DkOGkNRhJhbyrbZddpjpks5r6Cy-gaJpZM4MCuqR.

https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png https://github.com/layerssss/paste.js https://github.com/layerssss/paste.js/issues/36#issuecomment-301440563