Is your feature request related to a problem? Please describe.
In many place a user can copy something to a clipboard.
Currently they have the issues of:
- Being implemented separately (logic, error handling, checking for support)
- UI/UX inconsistencies
- in some places we show success notifications
- in some places we use button changes
Describe the solution you'd like
- Decide on consistent UI/UX patterns
- Use consistent UI/UX patterns
- Encapsulate UI/UX patterns in reusable components
- Share copy-handling code between components
Describe alternatives you've considered
No response
Additional context
Having shared logic, we could write more elaborate copy-handling code supporting more browsers.
Simple module exposing an async copy function that uses the Async Clipboard API (navigator.clipboard) in secure contexts (HTTPS / localhost), with automatic fallback to document.execCommand('copy') for non-secure contexts or older browsers.
https://www.npmjs.com/package/copy-to-clipboard
Might use contribute back to https://github.com/nextcloud-libraries/nextcloud-vue/blob/f460a5c48898a9cebc656923b9c0ac4ffb969851/src/composables/useCopy.ts
Changing the button icon in place for a few seconds in case of success seems to be a very common pattern.
If no icon is used button text can change from "Copy text" to "Copied!" for a second or so.
Is your feature request related to a problem? Please describe.
In many place a user can copy something to a clipboard.
Currently they have the issues of:
Describe the solution you'd like
Describe alternatives you've considered
No response
Additional context
Having shared logic, we could write more elaborate copy-handling code supporting more browsers.
Might use contribute back to https://github.com/nextcloud-libraries/nextcloud-vue/blob/f460a5c48898a9cebc656923b9c0ac4ffb969851/src/composables/useCopy.ts
Changing the button icon in place for a few seconds in case of success seems to be a very common pattern.
If no icon is used button text can change from "Copy text" to "Copied!" for a second or so.