Disable pasting in composer when in background

This commit is contained in:
Jamie Kyle 2024-06-13 16:22:07 -07:00 committed by GitHub
parent b315162676
commit 5dcb42f964
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 57 additions and 4 deletions

View file

@ -8,6 +8,7 @@ import { useEscapeHandling } from '../../hooks/useEscapeHandling';
export type PropsType = {
conversationId: string;
hasOpenModal: boolean;
hasOpenPanel: boolean;
isSelectMode: boolean;
onExitSelectMode: () => void;
processAttachments: (options: {
@ -24,6 +25,7 @@ export type PropsType = {
export function ConversationView({
conversationId,
hasOpenModal,
hasOpenPanel,
isSelectMode,
onExitSelectMode,
processAttachments,
@ -57,6 +59,10 @@ export function ConversationView({
const onPaste = React.useCallback(
(event: React.ClipboardEvent<HTMLDivElement>) => {
if (hasOpenModal || hasOpenPanel) {
return;
}
if (!event.clipboardData) {
return;
}
@ -102,7 +108,7 @@ export function ConversationView({
event.preventDefault();
}
},
[conversationId, processAttachments]
[conversationId, processAttachments, hasOpenModal, hasOpenPanel]
);
useEscapeHandling(