angular-clipboard
angular-clipboard copied to clipboard
throw failure copy
Hi, and thank you for this small module. I'm trying to resize image and convert to base64 text and copy to clipboard. But it throws error when higher resolution image to copy. Is copy text has limit ?
I'm not aware of any limitations to the size of what you copy to the clipboard (except for actual memory limitations in the system). Which error are you getting?
in the title I said throw failure copy. When I inspect in console it says "failure copy". I tried to use service and copyText lower than 400px width image it worked just fine. width: 400px image to base64 44k characters copied fine. But when I tried to copy width: 800px image to base64 and copy it failed. And I don't think there is actual memory issue. Because when I'm trying to copy resized base64 image result put into textarea and using Command + C it copied. Actually right now I'm using Command + C manually copying. It scares the users. Because they don't know what is going on xD I will reproduce the error in plunker later...
I was having a similar issue (same error message) when trying to copy a long text string (over 32,000 characters). From testing with other methods, I think that the issue is due to the permissions from the trusted user event (button click). I placed a timeout on the command document.execCommand('copy'), and any timeout greater than 1000ms after the click event would cause the command to fail (no matter how small the text being copied was). So if your function is taking more than 1second after the click to generate/copy the text, then document.execCommand('copy') seems to fail. This was done on Chrome v.51.0.2704.84. However, I am so far unable to find any documentation on how the trusted user events are handled to support this theory.
I still get this error. I am using it as a service with Google Chrome (latest version). The following snippet is run on click.
$http.get('api/passengers/generatePublicLink/'+$stateParams.id).success(function(id){
if (!clipboard.supported) {
console.log('Sorry, copy to clipboard is not supported');
}else{
clipboard.copyText('mytext');
}
});
Is there a solution yet?
I'm also getting this error on some of the browsers, not all of them, but if it happens on the same machine it happens on all browser, can it be related to browsers permissions settings ?
I'm getting this error too when I try to copy a big text, and then I found a similar issue from stackoverflow https://stackoverflow.com/questions/44774820/copying-to-clipboard-with-document-execcommandcopy-fails-with-big-texts I guess this the same?