Fix copy cell wrong cell bug
Summary: It was relying on hash keys to be in order, which obviously won't work. Logs plugin, on "copy message" was copying a timestamp instead. Fixed by using the columnOrder state instead. Reviewed By: danielbuechele Differential Revision: D15535281 fbshipit-source-id: 2d7db95c16cc4f75c0d9cf14806fcc80cc8e4bd9
This commit is contained in:
committed by
Facebook Github Bot
parent
6aa3457fb4
commit
592bd2671f
@@ -462,10 +462,8 @@ class ManagedTable extends React.Component<
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onCopyCell = (rowId: string, column: string) => {
|
onCopyCell = (rowId: string, index: number) => {
|
||||||
const cellText = getTextContentOfRow(rowId)[
|
const cellText = getTextContentOfRow(rowId)[index];
|
||||||
Object.keys(this.props.columns).indexOf(column)
|
|
||||||
];
|
|
||||||
clipboard.writeText(cellText);
|
clipboard.writeText(cellText);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -481,14 +479,17 @@ class ManagedTable extends React.Component<
|
|||||||
{
|
{
|
||||||
click: this.onCopy,
|
click: this.onCopy,
|
||||||
label: 'Copy cell',
|
label: 'Copy cell',
|
||||||
submenu: Object.keys(this.props.columns).map((column, index) => ({
|
submenu: this.state.columnOrder
|
||||||
label: this.props.columns[column].value,
|
.filter(c => c.visible)
|
||||||
click: () => {
|
.map(c => c.key)
|
||||||
const rowId = this.state.highlightedRows.values().next()
|
.map((column, index) => ({
|
||||||
.value;
|
label: this.props.columns[column].value,
|
||||||
rowId && this.onCopyCell(rowId, column);
|
click: () => {
|
||||||
},
|
const rowId = this.state.highlightedRows.values().next()
|
||||||
})),
|
.value;
|
||||||
|
rowId && this.onCopyCell(rowId, index);
|
||||||
|
},
|
||||||
|
})),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: [];
|
: [];
|
||||||
|
|||||||
Reference in New Issue
Block a user