-
Notifications
You must be signed in to change notification settings - Fork 127
ui: Add button to copy address on wallets page #1639
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
Conversation
@@ -232,6 +233,10 @@ export default class WalletsPage extends BasePage { | |||
Doc.hide(this.page.forms) | |||
} | |||
|
|||
copyAddress () { | |||
navigator.clipboard.writeText(this.page.depositAddress.textContent || '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. https://caniuse.com/mdn-api_clipboard_writetext
I'm assuming 'click'
counts as a "user gesture event handlers such as pointerdown or pointerup." so it will work on Safari. Can anyone test on Safari?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works on Safari. I put the icon inside the box.. I think it looks better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What host makes that happen @buck54321 ? A non-loopback addr? |
http://[::]:54321 The test app server |
So is that a chrome bug with ipv6? That looks like it should qualify as a secure context/origin. |
Looks like this does the trick. https://github.com/martonp/dcrdex/compare/copyAddress...buck54321:martonp-copy-addr?expand=1 |
Ah, yes! I read it as |
Actually, this would prevent me from copying if I access the client from, say, my tablet on the same network. Maybe navigator.clipboard won't work for us? |
I think it's OK. The user can get around that other ways, including putting an https server in front of it or changing the browser flags et. |
Is it unsafe to use |
I'm switching dcrdata over and it's working alright there: https://github.com/decred/dcrdata/pull/1917/files |
I pulled your commit in @buck54321 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working well.
I think it would be nice if there was indication that the copy worked. Like a message that says Copied!
or something. dcrdata has this if you click on the copy icon https://dcrdata.decred.org/address/DsZJ3hUqfaGR4GbwvLDLaSxTGJvYk6ypk4K
Uh oh!
There was an error while loading. Please reload this page.