import * as React from 'react'; import { useGridApiOptionHandler, useGridNativeEventListener } from '../../utils'; import { gridFocusCellSelector } from '../focus/gridFocusStateSelector'; import { serializeCellValue } from '../export/serializers/csvSerializer'; function writeToClipboardPolyfill(data) { const span = document.createElement('span'); span.style.whiteSpace = 'pre'; span.style.userSelect = 'all'; span.style.opacity = '0px'; span.textContent = data; document.body.appendChild(span); const range = document.createRange(); range.selectNode(span); const selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range); try { document.execCommand('copy'); } finally { document.body.removeChild(span); } } function copyToClipboard(data) { if (navigator.clipboard) { navigator.clipboard.writeText(data).catch(() => { writeToClipboardPolyfill(data); }); } else { writeToClipboardPolyfill(data); } } function hasNativeSelection(element) { var _window$getSelection; // When getSelection is called on an