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

Allow context menu to display options for both copy text and copy URL #3474

Closed
wants to merge 1 commit into from

Conversation

jbrr
Copy link

@jbrr jbrr commented Jul 8, 2020

Fixes #3404, kind of. It also adds a minor feature, which may not be desirable.

I'm not sure when this changed, but when a user on MacOS secondary clicks a link, it also selects the link text. It seemed like the least risky way to fix this was to add an extra option to the context menu. The new logic is, if text which is not part of a link is selected when the user secondary clicks, the context menu shows "Copy". If the user secondary clicks on a link without any selected text (presumably this is still possible on Windows and Linux, although I have not tested), the context menu will show "Copy Link Address". If the user secondary clicks on a link and has selected text, there will be two context menu options - "Copy" and "Copy Link Address". This will always be the case on MacOS, as far as I can tell.

I don't see any tests around any of this, but I'm happy to update them if that was an oversight on my part. I also don't have easy access to a Windows or Linux machine, so I've only tested on MacOS 10.15.5 Catalina, but this appears to work just fine there.

This is my first time attempting to contribute, apologies if I missed anything!

context_menu03

context_menu01

context_menu02

Issue laurent22#3404 points out that on MacOS, right clicking on a link
only displays the 'Copy' context menu item, instead of 'Copy Link'.
It appears that MacOS selects the text while secondary clicking so
the currently implemented conditional exits before realizing a link
is also present. This change will allow context menu items for both
copying text and the link URL. It would likely be cleaner to have
ContextMenuItemType enum values in an array, and display options
based on the items in the array, but I'm worried about unintended
consequences of that big of a refactor since I don't really see tests
around any of this.
@laurent22
Copy link
Owner

I think your fix makes sense but I'm making a few changes related to the context menu in the UI Update branch so I think we'll have to go back to it once this branch is merged.

@jbrr
Copy link
Author

jbrr commented Sep 5, 2020

Sounds good, thanks @laurent22. Feel free to just close this if you end up addressing it in that PR, or I can try to address any merge conflicts when that work is complete!

@laurent22 laurent22 changed the base branch from master to release-1.2 September 22, 2020 12:23
@laurent22
Copy link
Owner

laurent22 commented Sep 22, 2020

@jbrr, I've rebase the pull request on the 1.2 release and as expected there are a few conflicts. Nothing to complex to solve at first sight, but could you try to fix them and see if your feature still works on macOS?

@jbrr
Copy link
Author

jbrr commented Sep 30, 2020

@laurent22 sorry about that, I've been on vacation for the last 2 weeks and didn't bring my computer. I'll try to fix the conflicts and test it on my machine later this week or this weekend.

@IzhakJakov
Copy link

IzhakJakov commented Oct 1, 2020

It might be useful to add an option to convert webpage (from the link) to a note.
I assume this wouldn't be hard, since this functionality is already in the extension for firefox/chrome.

@laurent22
Copy link
Owner

@jbrr, in fact let's wait till version 1.3 to merge this as I expect it will bring more conflicts so may as well fix them all in one go. Sorry about that, your pull request arrives in the middle of various major changes so that makes things a bit complicated.

@jbrr
Copy link
Author

jbrr commented Oct 8, 2020

@laurent22 no problem at all. Feel free to ping me again when things have calmed down a little bit.

@laurent22
Copy link
Owner

@jbrr, the latest changes are now on dev and should be stable, so if you'd like to fix the conflict I think we can merge your PR.

@laurent22
Copy link
Owner

@jbrr, I'll close this pull request for now, but feel free to resubmit if you'd like to fix it, or I may go back to it at some point too.

@laurent22 laurent22 closed this Oct 20, 2020
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

Successfully merging this pull request may close these issues.

links can't be copied anymore
3 participants