Closes #2638: Copy Button for Secrets #2860
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #2638
Added a copy button after unlocking secret.
As mentioned in #2638, the clipboard cannot be modified while running an asynchronous operation (like AJAX call) since the user-triggered event would have been processed before the response is received.
There are hacky solutions, but I'd rather keep things simple. There is a draft API that addresses this challenge, but its support is not wide enough, yet.
Note: I have purposefully avoided adding the copy button to the secret_edit.html page as I see it as unnecessary (you wouldn't normally go to edit to unlock then copy the secret). However, if you'd like it there for consistency, you can copy the button from secret.html (that's the only change needed).