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

Add clipboard button on commit #1462

Merged
merged 4 commits into from
Feb 21, 2021
Merged

Conversation

wmertens
Copy link
Contributor

@wmertens wmertens commented Feb 6, 2021

Right now, it shows when you hover or click the commit. How can I make it also show when I just hover over the commit hash?

Should this have a test? What should it test?

@campersau
Copy link
Collaborator

Please note that navigator.clipboard.writeText will only work on localhost and https sites. Since ungit can bind to other hostnames as well (or all 0.0.0.0) this would not work in these cases.

Note that the API only works when served over secured domains (https) or localhost and when the page is the browser's currently active tab.

https://web.dev/async-clipboard/#security-and-permissions

See also https://stackoverflow.com/a/30810322 for possible workarounds.
You can test this scenario by setting ungitBindIp to 0.0.0.0 and then load ungit with http://[yourcomputername]:8448


ungit uses octicon icons everywhere else so I think it would be better to use them here too. E.g. https://primer.style/octicons/clippy-16


What do you think about making the button smaller like btn-xs?

@wmertens
Copy link
Contributor Author

wmertens commented Feb 7, 2021

@campersau actually I'm a complete n00b at KO and I'm working on the nodegit branch, this was a quick hack to get a feel for it. If you were to implement your suggestions I'd be really grateful 😅 (if not, I totally understand, I'm just saying that I wouldn't feel offended in the least if you implemented this properly, on the contrary)

@campersau
Copy link
Collaborator

@wmertens How do you like that?
image

Ref: #108

@wmertens
Copy link
Contributor Author

wmertens commented Feb 8, 2021

@campersau 💯 😍

@wmertens
Copy link
Contributor Author

wmertens commented Feb 8, 2021

I just wonder how to show the button when you hover over the commit message, not the commit node. That way you can quickly copy an oid from the page.

@campersau
Copy link
Collaborator

Or just keep the button always visible regardless of mouseover?

@wmertens
Copy link
Contributor Author

Hmm right, I was worrying that it adds too much visual noise

@campersau
Copy link
Collaborator

campersau commented Feb 21, 2021

@wmertens this is how you would only show the button on mouseenter / mouseleave but since the button is higher than the text it moves the files a bit down when it gets rendered. So for simplicity I am going to show the button when the node is selected.
4530d03

@campersau campersau merged commit 5282c9d into FredrikNoren:master Feb 21, 2021
@wmertens wmertens deleted the clipboard branch February 21, 2021 14:04
@campersau campersau mentioned this pull request Apr 2, 2021
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.

2 participants