mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
Fix copy-paste of text creating unintended blocks (#7903)
This commit is contained in:
@@ -378,7 +378,14 @@ const FlowEditor: React.FC<{
|
||||
|
||||
const handleKeyDown = useCallback(
|
||||
(event: KeyboardEvent) => {
|
||||
if (isAnyModalOpen) return; // Prevent copy/paste if any modal is open
|
||||
// Prevent copy/paste if any modal is open or if the focus is on an input element
|
||||
const activeElement = document.activeElement;
|
||||
const isInputField =
|
||||
activeElement?.tagName === "INPUT" ||
|
||||
activeElement?.tagName === "TEXTAREA" ||
|
||||
activeElement?.getAttribute("contenteditable") === "true";
|
||||
|
||||
if (isAnyModalOpen || isInputField) return;
|
||||
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
if (event.key === "c" || event.key === "C") {
|
||||
@@ -432,13 +439,15 @@ const FlowEditor: React.FC<{
|
||||
}
|
||||
},
|
||||
[
|
||||
addNodes,
|
||||
addEdges,
|
||||
setNodes,
|
||||
copiedNodes,
|
||||
copiedEdges,
|
||||
nodeId,
|
||||
isAnyModalOpen,
|
||||
nodes,
|
||||
edges,
|
||||
copiedNodes,
|
||||
setNodes,
|
||||
addNodes,
|
||||
copiedEdges,
|
||||
addEdges,
|
||||
nodeId,
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user