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

Copying empty text to clipboard throws javascript error. #148

Closed
dweepcan opened this issue Dec 10, 2015 · 3 comments
Closed

Copying empty text to clipboard throws javascript error. #148

dweepcan opened this issue Dec 10, 2015 · 3 comments
Labels

Comments

@dweepcan
Copy link

I was trying to replace ZeroClipboard with this new clipboard.js library to get rid of the flash dependancy, but I felt this one workflow was unsupported with this library. An example of this is showcased here: https://jsfiddle.net/o6g9gu2w/. When trying to copy empty text, due to user input being empty, I get the following error: Missing required attributes, use either "target" or "text" caused by the following line

throw new Error('Missing required attributes, use either "target" or "text"');
. I would like to know if there is a way for me to catch or prevent this error or how this could be fixed. This is the only thing preventing me from switching to this library.

@zenorocha
Copy link
Owner

Hey @dweepcan,

Some sort of string needs to be returned, so we can include a space if input is empty.
https://jsfiddle.net/zenorocha/o6g9gu2w/4/

Let me know if you have any other problems.

@dweepcan
Copy link
Author

@zenorocha But this means that whatever was previously in the clipboard is destroyed which might be unexpected/annoying for the user.

@zenorocha
Copy link
Owner

Fixed at 7a5a910. Please use v1.5.10 in order to benefit from this.

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

No branches or pull requests

2 participants