Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Paste by using middle click in firefox not working #931

Closed

Description

@alex-sl-eng

Middle click to paste text in CodeMirror2 doesn't work in Firefox browser but works in Chrome.

Activity

  1. marijnh commented on Nov 7, 2012

    @marijnh
    Member

    This is a known issue 1. It doesn't seem to be solveable without patching Firefox.

  2. lilydjwg commented on Mar 16, 2015

    @lilydjwg

    Instead of patching Firefox, I guess an extension may work.

  3. TheTechmage commented on May 10, 2015

    @TheTechmage

    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.

  4. frabjous commented on Mar 29, 2017

    @frabjous

    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?

  5. marijnh commented on Mar 30, 2017

    @marijnh
    Member

    Not sure what they are supposed to have fixed there, but in Firefox nightly there's still no paste event for middle-click pasting.

  6. frabjous commented on May 3, 2017

    @frabjous

    The following minimal HTML will fire the onpaste event in Firefox 55 (linux) with a middle click:

    <html>
    <body>
    <div width="100%" contenteditable onpaste="alert('you pasted');" >
      Middle click here
    </div>
    </body>
    </html>
    

    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.

  7. frabjous commented on Oct 25, 2017

    @frabjous

    Middle click works fine to paste in Firefox with the similar EditArea javascript editor -- Example here. How did they manage it?

  8. lilydjwg commented on Oct 26, 2017

    @lilydjwg

    @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.

  9. nthiery commented on Jan 17, 2018

    @nthiery

    A fix would be most welcome, e.g. for our teaching with Jupyter under linux.

    Thanks in advance!

  10. lilydjwg commented on Jan 17, 2018

    @lilydjwg

    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.

  11. simcop2387 commented on May 8, 2018

    @simcop2387

    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

  12. suvayu commented on May 10, 2018

    @suvayu

    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.

  13. marijnh commented on May 11, 2018

    @marijnh
    Member

    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.

  14. suvayu commented on May 11, 2018

    @suvayu

    Hi @marijnh, I can middle click paste pretty much everywhere in FF on a wide range of websites. Could you be a bit more specific (sorry, I'm not a web developer). Maybe I could help test and narrow down the exact issue?

    PS: the latest release is FF 60.

  15. marijnh commented on May 12, 2018

    @marijnh
    Member

    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.

  16. 7 remaining items

  17. marijnh commented on May 15, 2018

    @marijnh
    Member

    See the inputStyle option, but that is unfortunately not very solid yet. There are plans to rewrite the library to work with contentEditable from the base up, which would sidestep such issues, but it's not clear yet how and when that will really happen.

  18. adrianheine commented on Sep 6, 2018

    @adrianheine
    Contributor

    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.

  19. added this to the Fixed in rewrite milestone on Sep 6, 2018
  20. nchevobbe commented on Jan 18, 2019

    @nchevobbe
    Contributor

    Hello there, I'm currently monkey-patching the codeMirror version we use in Firefox DevTools, and everything seems to work fine (using dispatchEvent instead of focusing the input on scroller's paste).
    Could someone assign me the bug? I'll open a PR shortly.

  21. assigned and unassigned on Jan 18, 2019
  22. marijnh commented on Jan 18, 2019

    @marijnh
    Member

    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!

  23. nchevobbe commented on Jan 18, 2019

    @nchevobbe
    Contributor
  24. marijnh commented on Jan 22, 2019

    @marijnh
    Member

    This was finally fixed in #5751 (but see also #5754 )

  25. cu commented on May 14, 2020

    @cu

    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.

  26. marijnh commented on May 14, 2020

    @marijnh
    Member

    It still works for me (Firefox 75 and 76 on Debian)...

  27. dmitry-at-publons commented on May 14, 2020

    @dmitry-at-publons

    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/.

  28. lilydjwg commented on May 15, 2020

    @lilydjwg

    And it pastes the clipboard selection, not the primary selection as native applications do.

    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.)

  29. nchevobbe commented on May 15, 2020

    @nchevobbe
    Contributor

    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/.

    Yes, this is a known issue on the Firefox side: https://bugzilla.mozilla.org/show_bug.cgi?id=1593761

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions