From 2d9d0314b93ed2a19b2f1d6643d2d2804fd2ee42 Mon Sep 17 00:00:00 2001 From: Timur Valiev Date: Tue, 3 Mar 2020 08:54:15 -0800 Subject: [PATCH] add a context menu to copy URI Summary: It's handy to copy images URI to paste it in other tools Reviewed By: mweststrate Differential Revision: D20221861 fbshipit-source-id: 09074b434d5c1277bb83daa7846b885717c5ee8d --- src/plugins/fresco/ImagesSidebar.tsx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/plugins/fresco/ImagesSidebar.tsx b/src/plugins/fresco/ImagesSidebar.tsx index 26e52ef5a..94c8fca1d 100644 --- a/src/plugins/fresco/ImagesSidebar.tsx +++ b/src/plugins/fresco/ImagesSidebar.tsx @@ -11,6 +11,7 @@ import {ImageData} from './api'; import {ImageEventWithId} from './index'; import { Component, + ContextMenu, DataDescription, Text, Panel, @@ -21,6 +22,7 @@ import { styled, } from 'flipper'; import React from 'react'; +import {clipboard, MenuItemConstructorOptions} from 'electron'; type ImagesSidebarProps = { image: ImageData; @@ -59,6 +61,14 @@ export default class ImagesSidebar extends Component< if (!this.props.image.uri) { return null; } + + const contextMenuItems: MenuItemConstructorOptions[] = [ + { + label: 'Copy URI', + click: () => clipboard.writeText(this.props.image.uri!), + }, + ]; + return ( @@ -69,11 +79,13 @@ export default class ImagesSidebar extends Component< - + + +