From f5f3a3d704a42f871c982bee9f1fede170caaf41 Mon Sep 17 00:00:00 2001 From: Anton Alexeyev Date: Wed, 11 Jun 2025 11:09:51 +0700 Subject: [PATCH] Fix image paste in new chat (#9203) Signed-off-by: Anton Alexeyev --- .../src/components/message/MessageInput.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/communication-resources/src/components/message/MessageInput.svelte b/plugins/communication-resources/src/components/message/MessageInput.svelte index cb5c8b60b4..461ff41e62 100644 --- a/plugins/communication-resources/src/components/message/MessageInput.svelte +++ b/plugins/communication-resources/src/components/message/MessageInput.svelte @@ -243,16 +243,16 @@ function pasteAction (_: any, evt: ClipboardEvent): boolean { let target: HTMLElement | null = evt.target as HTMLElement let allowed = false + const hasFiles = Array.from(evt.clipboardData?.items ?? []).some((i) => i.kind === 'file') while (target != null) { target = target.parentElement - if (target === inputElement) { + if ((hasFiles && target === refContainer) || target === inputElement) { allowed = true } } if (!allowed) { return false } - const hasFiles = Array.from(evt.clipboardData?.items ?? []).some((i) => i.kind === 'file') if (hasFiles) { void loadFiles(evt)