From 98c4e6ecb04bb0a9a02fe06496b38c7f12486086 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Fri, 4 Jul 2025 14:20:34 -0300 Subject: [PATCH] fix: Exclude text selections from flow actions in PageComponent (#8827) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: check for text selection on copy Co-authored-by: Ítalo Johnny --- .../src/pages/FlowPage/components/PageComponent/index.tsx | 6 +++++- 1 file changed, 5 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 5fc90cc19..d343941aa 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -254,13 +254,17 @@ export default function Page({ const multipleSelection = lastSelection?.nodes ? lastSelection?.nodes.length > 0 : false; + const hasTextSelection = + (window.getSelection()?.toString().length ?? 0) > 0; + if ( !isWrappedWithClass(e, "noflow") && + !hasTextSelection && (isWrappedWithClass(e, "react-flow__node") || multipleSelection) ) { e.preventDefault(); (e as unknown as Event).stopImmediatePropagation(); - if (window.getSelection()?.toString().length === 0 && lastSelection) { + if (lastSelection) { setLastCopiedSelection(_.cloneDeep(lastSelection)); } }