mozilla-iam / dino-park-front-end

Front-end for Mozillians.org
Mozilla Public License 2.0
37 stars 32 forks source link

Copying key to clipboard adds padding #661

Open bkochendorfer opened 3 years ago

bkochendorfer commented 3 years ago

Describe the bug When you click Copy on the Keys section of the UI the key is copied to system clipboard but has left padding.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://people.mozilla.org/p/bkochendorfer
  2. Scroll down to Keys
  3. Click Copy next to ssh key.
  4. Paste buffer somewhere, you will notice left padding is added.

Expected behavior When copying we should copy the contents of the key not including left padding.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context I believe this is the javascript generating this issue, https://github.com/mozilla-iam/dino-park-front-end/blob/master/src/components/ui/Key.vue#L49. According to MDN Document.execCommandis deprecated so perhaps moving this to clipboard api would help https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API

gene1wood commented 3 years ago

Interestingly there are two different things going on here.

For the GPG key, indeed the copy function is the problem. For the SSH key, the actual key is formatted in the DOM with extra padding which would also need to be fixed.