palantir / blueprint

A React-based UI toolkit for the web
https://blueprintjs.com/
Apache License 2.0
20.75k stars 2.18k forks source link

Table. Copy the contents of Cell to the clipboard. #4585

Closed ivanmem closed 3 years ago

ivanmem commented 3 years ago

Environment

"@blueprintjs/core": "^3.41.0", "@blueprintjs/table": "^3.8.26",

Question

How do I allow the user to select text for copy to clipboard? or maybe there is some other way to make a copy of what's inside the Cell? I know about the getCellClipboardData property, but it seems too complicated to me. There, only indices go into the input, but the content itself is not. In my implementation, it is impossible to find out by indices which property in the object needs to be copied.

Maybe there is some example of a table wrapper that implements copying to the content buffer?

lanzhenw commented 3 years ago

check bodyContextMenuRenderer, it is the right click menu. There is a copy component, click that will copy the actual data to clipboard.

ivanmem commented 3 years ago

Okay I realized that I would have to get the data by indexes. Thanks.