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:
parent
a88829a9d6
commit
98c4e6ecb0
1 changed files with 5 additions and 1 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue