Fix contextClick after multi-highlight

Summary:
Select multiple rows, and then right click, or use Ctrl-click.
This was broken, it was resetting the selection when this happened.
This fixes it.

Now after selecting multiple, what happens depends where you right-click.

If you right-click within the current selection, it stays selected and you can copy it.
But if you right-click outside the current selection, that row becomes the new selected set, and you will just be able to copy that one. This feels right to me.

Reviewed By: passy

Differential Revision: D15822668

fbshipit-source-id: 6a6cda8a8f16fec55cffa52c1c2ff958c86b3f43
This commit is contained in:
John Knox
2019-06-14 09:10:55 -07:00
committed by Facebook Github Bot
parent 0eca3ac1e1
commit 062cbc0dbd

View File

@@ -383,11 +383,17 @@ class ManagedTable extends React.Component<
e.button !== 0 ||
(process.platform === 'darwin' && e.button === 0 && e.ctrlKey);
if (!contextClick) {
this.dragStartIndex = index;
document.addEventListener('mouseup', this.onStopDragSelecting);
if (contextClick) {
if (!highlightedRows.has(row.key)) {
highlightedRows.clear();
highlightedRows.add(row.key);
}
return;
}
this.dragStartIndex = index;
document.addEventListener('mouseup', this.onStopDragSelecting);
if (
((process.platform === 'darwin' && e.metaKey) ||
(process.platform !== 'darwin' && e.ctrlKey)) &&