-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paste by using middle click in firefox not working #931
Comments
This is a known issue 1. It doesn't seem to be solveable without patching Firefox. |
Instead of patching Firefox, I guess an extension may work. |
Since no one has linked to it already, here is the relevant bug within Firefox's Bugzilla. It looks like there are options that currently work in the developer edition of Firefox (I tried the first provided example, turned the <p> element into a <textarea> and the code worked). It appears that the FF team are still trying to make sure that the clipboard API standard gets nailed down first before this will get fixed in CodeMirror. |
The bug in Firefox's Bugzilla linked to by frostyfrog was marked as resolved about a month ago, but the problem persists for codemirror. Any progress on this? |
Not sure what they are supposed to have fixed there, but in Firefox nightly there's still no paste event for middle-click pasting. |
The following minimal HTML will fire the onpaste event in Firefox 55 (linux) with a middle click:
It also works on textareas, etc., even without the contenteditable attribute. I can't figure out how to make that work for codeMirror, however, if it is possible. |
Middle click works fine to paste in Firefox with the similar EditArea javascript editor -- Example here. How did they manage it? |
@frabjous it's a big textarea, with all normal features like GTK editing keys available. The colorful text is laid under it. It doesn't support multiple selections however. |
A fix would be most welcome, e.g. for our teaching with Jupyter under linux. Thanks in advance! |
I'm annoyed by Jupyter not supporting middle-click paste just yesterday....There is no way to copy a value from output to the input without this feature when I've mapped Ctrl-C to interrupt the kernel instead. |
Wanted to chime in that there's also a related Firefox bug ticket open about this issue too. https://bugzilla.mozilla.org/show_bug.cgi?id=953389 |
The original FF issue has been resolved. Does this mean we can have this fixed? I'm using Jupyter, and middle click not working severely limits my productivity. |
I'm still not seeing any paste events generated for middle clicks on uneditable elements in Firefox 59, so no, I guess the functionality we need to make this work still isn't there. |
The thing that looks editable in CodeMirror isn't actually editable on the HTML level (it's static content, and focus is put on a hidden textarea), so Firefox doesn't understand that it should allow paste when this element is middle-clicked and doesn't generate the events necessary to access the clipboard. |
Hi @marijnh, I had a look at the generated html. I'm not sure how to reproduce a minimal example so that I can file a bug report on the FF bugzilla. I feel waiting for the issue to be fixed without a specific bug report on the FF bugzilla isn't going to help the situation. I would be happy to file the report, and follow up, if you could help me create a minimal example. Thanks |
Minimal example: an empty document with a |
Hi @marijnh, sorry to repeat myself. I am not a web developer (only good with languages like Python, C++, etc), and don't know how to create an example from your description of the issue. Could you please help with a code snippet I could work with? |
Here's one: <!DOCTYPE html>
<html>
<meta charset="utf-8" />
<title>Test paste events</title>
<body>
</body>
<script type="text/javascript">
<!--
document.onpaste = function(e) {
const p = document.createElement('p')
p.textContent = "You've pasted something of types " + e.clipboardData.types
document.body.appendChild(p)
}
//-->
</script>
</html> See it live. This page shows when something is pasted. Middle-button pastes work in Google Chrome but not Firefox. |
Okay, perfect! Now I'll follow up with the FF bugzilla. |
You can find the new bug report here. Cheers, |
Incidentally, with the following small changes to the mwe, it already works in firefox:
That is, adding the "contenteditable" flag to the body tag makes it generate the events. The return false at the end of the function prevents it from actually pasting in the contents, as it normally would. I have no idea if these changes are compatible with the rest of codemirror's codebase. |
See the |
This is a issue that's difficult if not impossible to solve with the fundamental approach currently taken by CodeMirror. We are working on a rewrite (CodeMirror 6) that will address this issue, and we are currently raising money for this work: See the announcement for more information about the rewrite and a demo. Note that CodeMirror 6 is by no means stable or usable in production, yet. It's highly unlikely that we pick up this issue for CodeMirror 5, though. |
Hello there, I'm currently monkey-patching the codeMirror version we use in Firefox DevTools, and everything seems to work fine (using |
Apparently not, github won't let me assign this to you (I guess you can only assign team members?). But don't let that stop you! |
I won't :) PR's coming up
Le ven. 18 janv. 2019 à 14:45, Marijn Haverbeke <[email protected]>
a écrit :
… Apparently not, github won't let me assign this to you (I guess you can
only assign team members?). But don't let that stop you!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#931 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjSO2Vj54xotY0s7lSFXeK6O6zE5nneks5vEc_vgaJpZM4APVFn>
.
|
I think this might need to be reopened; I can't middle-click to paste on any of the demos of the codemirror.net site with Firefox 76.0 on Ubuntu 19.10. Perhaps worth noting that it does appear to work on the CM6 demo site. |
It still works for me (Firefox 75 and 76 on Debian)... |
Trying demos on codemirror.net with Firefox 76.0.1 on Ubuntu 18.04: can paste, but can't copy by selecting or double clicking. Same behaviour on https://codemirror.net/6/. |
Uh I remember wrong. It doesn't paste what I select in the CodeMirror editor; it does paste what I select outside the CodeMirror editor. (It works weird this way to me.) |
Yes, this is a known issue on the Firefox side: https://bugzilla.mozilla.org/show_bug.cgi?id=1593761 |
Middle click to paste text in CodeMirror2 doesn't work in Firefox browser but works in Chrome.
The text was updated successfully, but these errors were encountered: