Description
Summary
I've gotten this working locally by doing the following, but I know it's wrong 😄
const copiedCells = controlledDataGridRef.current.unstable_applyPipeProcessors('clipboardCopy', ''); navigator.clipboard.writeText(copiedCells);
Basically, I'd rather not reference unstable internal functions when implementing functionality. We need to be able to right click a cell or selection of cells to copy them to the clipboard. This presented a couple issues (having to use slots and having to rely on an event rather than getting params for the context menu, like header context, made it more difficult to determine whether the cell is selected), but primary among them that in order to implement the copy functionality, I had the option of either re-implementing the handleClipboardCopy functionality that exists in useGridSelection.tsx (ew), or using unstable_applyPipeProcessors to get at the guts of the function and reusing it.
Don't make me do bad things, please ;)
(P.S: If I can get really greedy, I'd also like first class support for cell context menus that pass cell and row context like the header context menus do).
Examples
No response
Motivation
I've implemented this already in my code using the unstable_applyPipeProcessors code above, but I'm implementing a cell context menu that allows users to context click a selection of cells to copy them to the clipboard:
There was no programmatic/clean way to trigger a copy. I'd like that to be added.
Search keywords: copy, clipboard
Order ID: 108843
Metadata
Metadata
Assignees
Labels
Projects
Status