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
feat(useClipboardItems): new function #3477
feat(useClipboardItems): new function #3477
Conversation
@okxiaoliang4 @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.
I am not sure about this. useClipboard
is designed to work with plain text (as the returned ref holds strings). For custom ClipboardItem
, I think it might be better to handle it on the userland. Even if it could be a composable, it would better be useClipboardItems
and handle bi-directional reactivity (if it's not possible to work bi-directional, then it would become out-of-scope of VueUse)
@antfu Thx for replying and that make senses. Thus I'm going to try to add a |
eb1411a
to
0cb4dd9
Compare
support to pass a parameter |transform2ClipboardItems| to customize clipboardItems
fix #3450
Before submitting the PR, please make sure you do the following
fixes #123
).Description
Currently, useClipboard only support writeText, but sometimes we need to specify mime type.
So I add a |transform2ClipboardItems| optional property in options, people can customize their ClipboardItems.
As a result, useClipboard now use the navigator.clipboard.write instead of navigator.clipboard.writeText.
fix #3450
Additional context
🤖 Generated by Copilot at 207ed0e
Add support for customizing clipboard data in
useClipboard
function. The new parametertransform2ClipboardItems
lets the user specify how to convert the input value to a list of clipboard items.🤖 Generated by Copilot at 207ed0e
transform2ClipboardItems
touseClipboard
to customize the clipboard data (link, link, link)