layerssss/paste.js

Demo is offline (404)

Closed this issue · 10 comments

Wanted to check whether pasting text into a pasteable textarea works in FF (as it doesn't in my project, and I wanted to check back), but sadly the demo's offline.

@jmuheim Sorry that's because I recently messed up my domain name settings, please move here to view the demo: http://gh-pages.micy.in/paste.js/

Thanks it's up again. And pasting definitely is working in FF, so it has to be a problem on my side.

If you got time, could you maybe navigate to http://pimp.suhail.uberspace.de/, log in using josh/joshjosh, then go to http://pimp.suhail.uberspace.de/en/documents/3/edit and try pasting an image from clipboard into the content field? Using Chrome: works like a charm. Using FF: doesn't work. Any idea where's the problem?

Hi, @jmuheim I've followed you url in Firefox and found it working. But only in these way:

  1. copy image from other programs, e.g. press "Screen Print", or "Cmd + Ctl + Shift + 3", and paste it in the textarea
  2. click image in Firefox, but from the same origin ("http://pimp.suhail.uberspace.de"), e.g. the "amazon" image being already there, and click "copy image", then paste it in the textarea

But not working in this way:

  1. click image in Firefox but from another domain, e.g. from another website. then click "copy image", then paste it in the textarea (and nothing will happen)

Because in this way, I can only get the url instead of true imagedata from firefox, and I'll have to do CORS request, which is usually not possible from just "any website".

But good news: try the demo http://gh-pages.micy.in/paste.js/ in Firefox and do "3.", you will see another dialog since we have the url of pasted image, if that's useful for you (if you can fetch the image from server side), dig into the source code to see how you can handle that

btw, cool apps!

I think I wasn't clear enough. ;)

The pasting of image from clipboard definitely's working also in FF. But you can't copy and paste a text into the "Content" textarea.

So it seems to be a problem when paste.js decides between whether an image was pasted or text, and while pasting the image works in FF as expected, when pasting text in FF, the text doesn't occur in the textarea (though it should).

In your demo, both work as expected, so it seems to be a problem on my side. I just hoped maybe you would spot the problem faster than me.

Did you have some time to inspect this? I'll definitely have to take a look at it myself soon, but I'm no big JavaScript hacker and maybe you'd like to donate a few minutes to me and maybe find the problem much quicker?

If not, I absolutely understand. :)

Hi @jmuheim , it will be great if you can help me out on this issue. Text-pasting breaking in FF has been an issue for a long time.

The challenge presented by FF is that, the only way we can get image-data from FF is to use a invisible div[contenteditable] to capture the input cursor, then from there we can get the base64-encoded image binary. But when a piece of text got pasted, it will be pasted in the invisible div[contenteditable], not in the textarea as user would expect. So whenever we got a text pasted, we try to emulate the text-pasting behaviour in the textarea. BBBBUUUT, if anything got wrong, e.g. failed to trigger or capture paste event, we will be swallowing the native paste-behaviour on the textarea but without being able to emulate it. There're are several issues related to this problem: #24 #23 #22 #19 . Now I think it's happening again.

The source code (paste.coffee) is written by coffee-script. You can install coffee-script compiler by npm install coffee-script -g, and npm is bundled with nodejs. After you get both of them, you'll be able to compile to paste.coffee into paste.js by running make. (if you are using Windows, you could use coffee --compile paste.coffee instead)

You'll be able to view the demo in index.html.

I will take a look at this soon. Would be great if we would figure something out to make this work.

👍

@jmuheim It seems not possible for me to reproduce this problem now. I'll close this before we can find a way to reproduce it.
image

I pointed this up long before:

Thanks it's up again. And pasting definitely is working in FF, so it has to be a problem on my side.

I will take a look at the problem on my side myself. Maybe I have to grab the newest version of the source.