From 4a52af358e3cfa187a4c3ecf21cfd96f0f5db0dd Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Tue, 16 Jun 2020 04:29:36 -0700 Subject: [PATCH] NotificationHub: allow to select notification text and copy it Summary: Enabled selection of notification text + added a context menu item to copy the selected text only. Reviewed By: passy Differential Revision: D22065704 fbshipit-source-id: 510e68d50a54329aaeefb9b3097bc4283f884dc9 --- desktop/app/src/NotificationsHub.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/desktop/app/src/NotificationsHub.tsx b/desktop/app/src/NotificationsHub.tsx index 0f46be712..b8dc501c3 100644 --- a/desktop/app/src/NotificationsHub.tsx +++ b/desktop/app/src/NotificationsHub.tsx @@ -370,6 +370,7 @@ const NotificationContent = styled(FlexColumn)<{isSelected?: boolean}>( maxHeight: props.isSelected ? 'none' : 56, lineHeight: 1.4, color: props.isSelected ? colors.light50 : colors.light30, + userSelect: 'text', }), ); @@ -429,7 +430,7 @@ class NotificationItem extends Component< > { constructor(props: ItemProps & PluginNotification) { super(props); - const items = []; + const items: Array = []; if (props.onHidePlugin && props.plugin) { items.push({ label: `Hide ${getPluginTitle(props.plugin)} plugin`, @@ -443,7 +444,8 @@ class NotificationItem extends Component< }); } items.push( - {label: 'Copy', click: this.copy}, + {label: 'Copy', role: 'copy'}, + {label: 'Copy All', click: this.copy}, {label: 'Create Paste', click: this.createPaste}, ); @@ -451,7 +453,7 @@ class NotificationItem extends Component< } state = {reportedNotHelpful: false}; - contextMenuItems: Array<{label: string; click: (() => any) | undefined}>; + contextMenuItems: Array; deepLinkButton = React.createRef(); createPaste = () => {