Skip to content
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

Fixed configuration of success handler #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danielpanteleit
Copy link

@danielpanteleit danielpanteleit commented May 4, 2023

v-clipboard:success did not work correctly, but was instead interpreted as just a v-clipboard. As long as you did not return anything from this function this still worked, but resulted in a "Clipboard input is empty" log entry.

@beatrizsmerino
Copy link

I get the same warning message, despite successfully has copying the data to the clipboard

Captura de pantalla 2024-03-25 a las 4 28 47

beatrizsmerino added a commit to beatrizsmerino/vue-editor that referenced this pull request Mar 25, 2024
…h `v-clipboard:copy`

Error:
- When the copy button is pressed a success alert is displayed, but the console message `Clipboard input is empty` appears.
- This message appears despite fixing the issue, it is a package problem and is not fixed at this time.

Reason:
- The `v-clipboard:copy` directive of the `vue-clipboard2` package does not exist in the `v-clipboard` package.
- When using the `v-clipboard` directive of the `v-clipboard` package to execute a method (`copyData`), it no longer returns the copied value (`json`) by itself, as towards the `v-clipboard:copy` directive of the `vue-clipboard2` package.

Solution:
- Replace the `v-clipboard:copy` directive with the `v-clipboard` directive.
- The `copyData` method needs to use `this.$clipboard.copy(value)` or `Clipboard.copy(value)` to copy the value.
In this case, since the package has been imported globally, `this.$clipboard.copy(value)` would be used, but with `setup` we cannot use `this`. So import `Clipboard` from `v-clipboard` package  into the component and use `Clipboard.copy(value)` instead.
You need to globally import the `v-clipboard` package to use the `v-clipboard` directive.

References:
- euvl/v-clipboard#39
- https://www.npmjs.com/package/vue-clipboard2
- https://www.npmjs.com/package/v-clipboard
- https://codesandbox.io/p/sandbox/mystifying-breeze-csgc5f?file=%2Fsrc%2FApp.vue%3A43%2C7-43%2C22
@LordZombi
Copy link

I did it like in commit above but still getting Clipboard input is empty

@beatrizsmerino
Copy link

beatrizsmerino commented Jul 6, 2024

I did it like in commit above but still getting Clipboard input is empty

Captura de pantalla 2024-07-07 a las 0 39 11

I have checked and it keeps happening to me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants