From cd1a2900570946658e6916534968e778b843640a Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 4 Dec 2023 18:10:22 -0300 Subject: [PATCH] fix(PageComponent): update onKeyDown event handler to prevent copying text when there is a selection --- .../src/pages/FlowPage/components/PageComponent/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx index a48674d56..4cf5a7484 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -90,7 +90,10 @@ export default function Page({ useEffect(() => { const onKeyDown = (event: KeyboardEvent) => { - if (!isWrappedWithClass(event, "nocopy")) { + if ( + !isWrappedWithClass(event, "nocopy") && + window.getSelection()?.toString().length === 0 + ) { if ( (event.ctrlKey || event.metaKey) && event.key === "c" &&