fix: Exclude text selections from flow actions in PageComponent (#8827)

fix: check for text selection on copy

Co-authored-by: Ítalo Johnny <italojohnnydosanjos@gmail.com>
This commit is contained in:
Cristhian Zanforlin Lousa 2025-07-04 14:20:34 -03:00 committed by GitHub
commit 98c4e6ecb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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));
}
}