feat(useClipboardItems): new function#3477
Conversation
|
@okxiaoliang4 @antfu could you please approve the check? |
antfu
left a comment
There was a problem hiding this comment.
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
useClipboardfunction. The new parametertransform2ClipboardItemslets the user specify how to convert the input value to a list of clipboard items.🤖 Generated by Copilot at 207ed0e
transform2ClipboardItemstouseClipboardto customize the clipboard data (link, link, link)