Skip to content
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

Support "copy-on-select" in web UI #55

Open
JedMeister opened this issue Jun 12, 2024 · 4 comments
Open

Support "copy-on-select" in web UI #55

JedMeister opened this issue Jun 12, 2024 · 4 comments

Comments

@JedMeister
Copy link

I use the Linux "copy-on-select; paste-on-middle-click" lots. And currently Notesium web UI does not support the "copy-on-select" bit - the "paste-on-middle-click" works fine.

TBH, I find it a constant frustration as I'm so used to using it (muscle memory?), that whenever I copy anything out of Notesium, I constantly find myself having to go back and use <CTRL><c> - then I have to use <CTRL><v> to paste (Windows style...).

I probably should just bite the bullet and use it in the terminal because then it would "just work" (default behaviour in any X app AFAIK), but I don't because I'm lazy... 😁

From what I gather after doing a bit of reading, the "copy-on-select" is more correctly called "PRIMARY selection". Hopefully these links are of some value?:

FWIW apparently this functionality has been in X since the 90s. And whilst it seems to be an X11 specific feature, I run Wayland these days and it seems to work fine in almost all apps. I have hit a few that don't honor it, but the only one I can think of OTTOMH is Notesium! 😜

@alonswartz
Copy link
Owner

@JedMeister I can confirm copy-on-select works as expected in chrome, but does not seem to work in firefox (129.0.2).

What browser/version are you using?
Could you test to see if copy-on-select works for you here: https://codemirror.net/5/mode/markdown/

@JedMeister
Copy link
Author

Hmm. It works on the main text, but not the code window - which I'm guessing was what you wanted me to test?

I'm not sure how much you've poked around, but here are a couple of docs that may be relevant?:

https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText
https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/write

I'm not sure whether leveraging FF addon stuff is possible? (AFAIK they're just js snippets but I don't know... 🤣). In case it is relevant, here's another doc:

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard

And here's a FF addon:

https://addons.mozilla.org/en-US/firefox/addon/copy-on-select-2/
https://github.com/farblos/copy-on-select-2

I haven't tested it, but am happy to if leveraging some of that might be of value?

@alonswartz
Copy link
Owner

@JedMeister sorry for the delay on this.

I don't have a fix yet, but I do have some ideas. Before attempting a fix, I need to hone in on what works, and what doesn't, and in which scenario. I've setup 2 tests:

Could you try test1 (specifically cm-ce (contenteditable) and let me know how it goes.
The test2 is more methodical, here are my results (where external is neovim running in a terminal).

Chrome:
screenshot-1731068257

Firefox:
screenshot-1731068256

@alonswartz
Copy link
Owner

Additionally, could you try codemirror6 and see if addresses the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants