Remove remaining process.env

Summary: Per title

Reviewed By: passy

Differential Revision: D32721205

fbshipit-source-id: 8e8a7fcac7d73f32d7fb59f852a8099cfe20e542
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent 2b4981c7cb
commit 058785a509
8 changed files with 37 additions and 14 deletions

View File

@@ -20,6 +20,7 @@ import {debounce} from 'lodash';
import ToggleButton from '../ToggleSwitch';
import React from 'react';
import {Layout, theme, Toolbar} from 'flipper-plugin';
import {getRenderHostInstance} from '../../../RenderHost';
const SearchBar = styled(Toolbar)({
height: 42,
@@ -298,9 +299,11 @@ export default function Searchable(
};
onKeyDown = (e: KeyboardEvent) => {
const {platform} =
getRenderHostInstance().serverConfig.environmentInfo.os;
const ctrlOrCmd = (e: KeyboardEvent) =>
(e.metaKey && process.platform === 'darwin') ||
(e.ctrlKey && process.platform !== 'darwin');
(e.metaKey && platform === 'darwin') ||
(e.ctrlKey && platform !== 'darwin');
if (e.key === 'f' && ctrlOrCmd(e) && this._inputRef) {
e.preventDefault();

View File

@@ -32,6 +32,7 @@ import {debounce} from 'lodash';
import {DEFAULT_ROW_HEIGHT} from './types';
import {notNull} from '../../../utils/typeUtils';
import {getFlipperLib, textContent} from 'flipper-plugin';
import {getRenderHostInstance} from '../../../RenderHost';
const EMPTY_OBJECT = {};
Object.freeze(EMPTY_OBJECT);
@@ -328,12 +329,13 @@ export class ManagedTable extends React.Component<
onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
const {highlightedRows} = this.state;
const {platform} = getRenderHostInstance().serverConfig.environmentInfo.os;
if (highlightedRows.size === 0) {
return;
}
if (
((e.metaKey && process.platform === 'darwin') ||
(e.ctrlKey && process.platform !== 'darwin')) &&
((e.metaKey && platform === 'darwin') ||
(e.ctrlKey && platform !== 'darwin')) &&
e.keyCode === 67
) {
e.stopPropagation();
@@ -421,6 +423,7 @@ export class ManagedTable extends React.Component<
if (!this.props.highlightableRows) {
return;
}
const {platform} = getRenderHostInstance().serverConfig.environmentInfo.os;
if (e.shiftKey) {
// prevents text selection
@@ -430,8 +433,7 @@ export class ManagedTable extends React.Component<
let {highlightedRows} = this.state;
const contextClick =
e.button !== 0 ||
(process.platform === 'darwin' && e.button === 0 && e.ctrlKey);
e.button !== 0 || (platform === 'darwin' && e.button === 0 && e.ctrlKey);
if (contextClick) {
if (!highlightedRows.has(row.key)) {
@@ -445,8 +447,8 @@ export class ManagedTable extends React.Component<
document.addEventListener('mouseup', this.onStopDragSelecting);
if (
((process.platform === 'darwin' && e.metaKey) ||
(process.platform !== 'darwin' && e.ctrlKey)) &&
((platform === 'darwin' && e.metaKey) ||
(platform !== 'darwin' && e.ctrlKey)) &&
this.props.multiHighlight
) {
highlightedRows.add(row.key);