mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: fix copy/paste on table cells
When selecting text via mouse, our ReactTable cells' click handler triggers an event. - check event target to be the link, only then handle the event
This commit is contained in:
parent
b00e709aee
commit
5a23723f2c
@ -21,10 +21,16 @@ function prepareRows(rows, columnNames) {
|
|||||||
export default class Table extends PureComponent<TableProps> {
|
export default class Table extends PureComponent<TableProps> {
|
||||||
getCellProps = (state, rowInfo, column) => {
|
getCellProps = (state, rowInfo, column) => {
|
||||||
return {
|
return {
|
||||||
onClick: () => {
|
onClick: (e: React.SyntheticEvent) => {
|
||||||
const columnKey = column.Header;
|
// Only handle click on link, not the cell
|
||||||
const rowValue = rowInfo.row[columnKey];
|
if (e.target) {
|
||||||
this.props.onClickCell(columnKey, rowValue);
|
const link = e.target as HTMLElement;
|
||||||
|
if (link.className === 'link') {
|
||||||
|
const columnKey = column.Header;
|
||||||
|
const rowValue = rowInfo.row[columnKey];
|
||||||
|
this.props.onClickCell(columnKey, rowValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user