Middle mouse button paste in gecko#31
Middle mouse button paste in gecko#31pstjvn wants to merge 3 commits intochjj:masterfrom pstjvn:master
Conversation
…ny source. Not as aesthetically pleasing (the pasted content appears for a moment there), but works correctly for pasting from any source. Needs some testing on older hardware for the timeout in the timing of receiving DOMCharacterDataModified but works good on recent netbooks and recent PCs.
|
I see an issue with the second attempt: If I paste text with space in it the bash interpreter does not seem to like it. |
No.
What you have looks interesting. I kind to want to fool around with it a bit first.
Hmm, I'll see if I can figure it out once I try it. |
|
Bump, +1, etc. It is a little flaky, though. Sometimes it pastes twice, for no adequately explained reason. |
|
I spent some time today trying to get this working again with current tty.js and current Firefox. The reason I was getting things pasted twice (2 months ago) was that the regular paste handler was running as well as the code from @pstjvn. It seems that Firefox 25.0.1 and Nightly now support right-click paste events for divs if they have contentEditable == true. See this gist for a user.js file that patches up bindPaste() and adds a new mousedown listener: https://gist.github.com/risacher/7837761 This seems to work in Firefox, Chrome, and Safari - but I'm not sure I'm testing all the cases that are supposed to work. |
This is a naive/lazy implementation for gecko middle mouse paste.
Gecko prohibits access to clipboard data in paste events. There are two solutions for this: either Flash or making diff to the content before the paste event and after it.
Because of how the terminal works (i.e. it expects text only, not html) a more simple solution would be to detect selection in the page and save the text of the selection and then use it in the case of paste event. It will not cover the case where the user wants to paste text from the clipboard, but is still useful because it can store selections from other windows/tabs in the same page.