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
fix(useClipboard): use legacy way when without permission #3379
Conversation
@antfu could you please approve the check |
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.
You should probably test it goes for the legacy method when the permission is denied
Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com>
Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com>
My mistake, thanks for your correction |
This pr has a few bugs and I will open a new pr #3812 to fix this. |
fixes #2494
Before submitting the PR, please make sure you do the following
fixes #123
).Description
use legacy methods as a fallback when clipboard is supported but without permission
Additional context
🤖 Generated by Copilot at f04e403
This pull request enhances the
useClipboard
function with permission checks. It uses theusePermission
function to query and request the clipboard permission before reading or writing to the clipboard.🤖 Generated by Copilot at f04e403
usePermission
function to check clipboard access (link)permissionRead
andpermissionWrite
variables to store the result ofusePermission
(link)updateText
function to conditionally callnavigator.clipboard.readText
based onpermissionRead
(link)copy
function to conditionally callnavigator.clipboard.writeText
based onpermissionWrite
(link)