From 8a87cf3705d1f2cb316ad86b2e33b8c48f5038ef Mon Sep 17 00:00:00 2001 From: AlexeyOplachko Date: Fri, 9 Feb 2024 19:05:51 +0200 Subject: [PATCH 1/8] fix: copy from a flow popup # Conflicts: # src/components/SimplePanel.tsx --- src/components/SimplePanel.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/components/SimplePanel.tsx b/src/components/SimplePanel.tsx index 4d8e5f4..a6434d8 100644 --- a/src/components/SimplePanel.tsx +++ b/src/components/SimplePanel.tsx @@ -112,8 +112,19 @@ export const DetaiItem: React.FC = ({ item, theme }: any): JSX.Element | nu try { isJSON = typeof JSON.parse(value) === 'object'; } catch (e) { } + const textAreaRef: any = useRef(null); + function copyToClipboard() { + if (textAreaRef && textAreaRef.current) { + textAreaRef.current.focus(); + textAreaRef.current.select(); + document.execCommand('copy'); + } + }; + const [copyValue, setCopyValue] = useState('') return (
+