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

Copied text has a grey background when pasted into gmail or google docs. #46

Open
rlpacht opened this issue Oct 3, 2016 · 8 comments
Open

Comments

@rlpacht
Copy link

rlpacht commented Oct 3, 2016

This is pretty much the same issue as #43 but now the background is grey instead of yellow. Do you know what might cause this and if there is a way to make that not happen?

@sudodoki
Copy link
Owner

sudodoki commented Oct 3, 2016

@rlpacht which browser are you experiencing this in? Can you provide codepen/jsfiddle/jsbin with reproducible keys? Supposedly, 30590d4#diff-168726dbe96b3ce427e7fedce31bb0bcR26 should force this to have no background whatsoever

@rlpacht
Copy link
Author

rlpacht commented Oct 3, 2016

It's happening for me in chrome.

@shrey18111
Copy link

shrey18111 commented Nov 1, 2016

@sudodoki This issue is happening for me in chrome as well when I paste into Google Sheets. When I perform the paste, the background color of the cells is this grey color.

@sudodoki
Copy link
Owner

sudodoki commented Nov 2, 2016

@shrey18111 not sure what you mean - is Google Sheets using this library?

@alejandro-arrabal
Copy link

@sudodoki This issue is happening for me when I had styles for body element http://codepen.io/AArrabal/pen/dNzKjq?editors=0110

@gravitypersists
Copy link

this would be fixed by fixing #47 - by specifying 'text/plain' as the format type.

Until then, you can get around it by adding:

    document.addEventListener('copy', e => {
      e.clipboardData.setData('text/html', STRING_TO_COPY);
      e.preventDefault();
    });

see updated codepen: http://codepen.io/anon/pen/KWQxXG?editors=0110

@webuniverseio
Copy link

@gravitypersists doesn't seem to be working in latest Chrome

@webuniverseio
Copy link

Oh, that's because of text/html in the example, Should be text/plain 😄

julienw added a commit to julienw/copy-to-clipboard that referenced this issue Apr 4, 2019
julienw added a commit to julienw/copy-to-clipboard that referenced this issue May 4, 2019
If `style` parameter isn't specified, this forces a text/plain copy to make it easier to work with word processors.
This also changes the example code to exhibit the bug of issue sudodoki#46 so
that it's easier to test.

Fixes sudodoki#46
julienw added a commit to julienw/copy-to-clipboard that referenced this issue May 4, 2019
If `style` parameter isn't specified, this forces a text/plain copy to make it easier to work with word processors.
This also changes the example code to exhibit the bug of issue sudodoki#46 so
that it's easier to test.

Fixes sudodoki#46
julienw added a commit to julienw/copy-to-clipboard that referenced this issue May 4, 2019
If `style` parameter isn't specified, this forces a text/plain copy to make it easier to work with word processors.
This also changes the example code to exhibit the bug of issue sudodoki#46 so
that it's easier to test.

Fixes sudodoki#46
julienw added a commit to julienw/copy-to-clipboard that referenced this issue May 4, 2019
If `style` parameter isn't specified, this forces a text/plain copy to make it easier to work with word processors.
This also changes the example code to exhibit the bug of issue sudodoki#46 so
that it's easier to test.

Fixes sudodoki#46
julienw added a commit to julienw/copy-to-clipboard that referenced this issue May 4, 2019
If `style` parameter isn't specified, this forces a text/plain copy to make it easier to work with word processors.
This also changes the example code to exhibit the bug of issue sudodoki#46 so
that it's easier to test.

Fixes sudodoki#46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants