Make copying an element list out its attributes instead of a useless id

Summary: When copying elements from the layout inspector its much more useful to copy all associated attributes rather than just the name and an implementation detail id.

Reviewed By: jknoxville

Differential Revision: D17727520

fbshipit-source-id: 8ac1828059cc10f7f9faf0bdc72eb3d57c881121
This commit is contained in:
Hilal Alsibai
2019-10-03 03:39:19 -07:00
committed by Facebook Github Bot
parent 9bce894b71
commit 447e918607

View File

@@ -238,7 +238,11 @@ class ElementsRow extends PureComponent<ElementsRowProps, ElementsRowState> {
{ {
label: 'Copy', label: 'Copy',
click: () => { click: () => {
clipboard.writeText(props.element.name + ' id=' + props.element.id); const attrs = props.element.attributes.reduce(
(acc, val) => acc + ` ${val.name}=${val.value}`,
'',
);
clipboard.writeText(`${props.element.name}${attrs}`);
}, },
}, },
{ {