Allow user to copy the row attributes in the layour inspector

Summary: Allows user to copy the row attributes.

Reviewed By: passy

Differential Revision: D18811929

fbshipit-source-id: 62335a7c0b5f1557704c0d8d9ea258b4c7cbfdcf
This commit is contained in:
Pritesh Nandgaonkar
2019-12-09 05:08:38 -08:00
committed by Facebook Github Bot
parent 3696697c6b
commit 0c13943139

View File

@@ -240,7 +240,7 @@ class ElementsRow extends PureComponent<ElementsRowProps, ElementsRowState> {
getContextMenu = (): Array<MenuItemConstructorOptions> => {
const {props} = this;
const items: Array<MenuItemConstructorOptions> = [
let items: Array<MenuItemConstructorOptions> = [
{
type: 'separator',
},
@@ -269,6 +269,16 @@ class ElementsRow extends PureComponent<ElementsRowProps, ElementsRowState> {
},
},
];
items = items.concat(
props.element.attributes.map(o => {
return {
label: `Copy ${o.name}`,
click: () => {
clipboard.writeText(o.value);
},
};
}),
);
for (const extension of props.contextMenuExtensions) {
items.push({