From 447e9186075997759d0aa907d6ae56b95f1f3156 Mon Sep 17 00:00:00 2001 From: Hilal Alsibai Date: Thu, 3 Oct 2019 03:39:19 -0700 Subject: [PATCH] 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 --- src/ui/components/elements-inspector/elements.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui/components/elements-inspector/elements.tsx b/src/ui/components/elements-inspector/elements.tsx index 7ebb2cf51..92c9f66dd 100644 --- a/src/ui/components/elements-inspector/elements.tsx +++ b/src/ui/components/elements-inspector/elements.tsx @@ -238,7 +238,11 @@ class ElementsRow extends PureComponent { { label: 'Copy', 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}`); }, }, {