Make getFlipperLib generally available, and use it to decouple opening links from Electron
Summary: This stack reduces our direct dependency on Electron, for example by exposing our own API to open links. Also exposing `getFlipperLib` as API from `flipper-plugin`, so that these utility methods are available outside plugin contexts as well. Reviewed By: timur-valiev Differential Revision: D29661689 fbshipit-source-id: 0c0523326eeb0d9d8fbe3e03c4609327bb53596b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2b236c6114
commit
5dbd3bd414
@@ -14,7 +14,7 @@ import styled from '@emotion/styled';
|
||||
import React, {MouseEvent, KeyboardEvent} from 'react';
|
||||
import {theme} from '../theme';
|
||||
import {Layout} from '../Layout';
|
||||
import {_getFlipperLibImplementation} from 'flipper-plugin';
|
||||
import {getFlipperLib} from 'flipper-plugin';
|
||||
import {DownOutlined, RightOutlined} from '@ant-design/icons';
|
||||
|
||||
const {Text} = Typography;
|
||||
@@ -221,7 +221,7 @@ class ElementsRow extends PureComponent<ElementsRowProps, ElementsRowState> {
|
||||
{
|
||||
label: 'Copy',
|
||||
click: () => {
|
||||
_getFlipperLibImplementation()?.writeTextToClipboard(
|
||||
getFlipperLib()?.writeTextToClipboard(
|
||||
props.onCopyExpandedTree(props.element, 0),
|
||||
);
|
||||
},
|
||||
@@ -229,7 +229,7 @@ class ElementsRow extends PureComponent<ElementsRowProps, ElementsRowState> {
|
||||
{
|
||||
label: 'Copy expanded child elements',
|
||||
click: () =>
|
||||
_getFlipperLibImplementation()?.writeTextToClipboard(
|
||||
getFlipperLib()?.writeTextToClipboard(
|
||||
props.onCopyExpandedTree(props.element, 255),
|
||||
),
|
||||
},
|
||||
@@ -253,7 +253,7 @@ class ElementsRow extends PureComponent<ElementsRowProps, ElementsRowState> {
|
||||
return {
|
||||
label: `Copy ${o.name}`,
|
||||
click: () => {
|
||||
_getFlipperLibImplementation()?.writeTextToClipboard(o.value);
|
||||
getFlipperLib()?.writeTextToClipboard(o.value);
|
||||
},
|
||||
};
|
||||
}),
|
||||
@@ -555,9 +555,7 @@ export class Elements extends PureComponent<ElementsProps, ElementsState> {
|
||||
) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
_getFlipperLibImplementation()?.writeTextToClipboard(
|
||||
selectedElement.name,
|
||||
);
|
||||
getFlipperLib()?.writeTextToClipboard(selectedElement.name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user