Fix image paste in new chat (#9203)

Signed-off-by: Anton Alexeyev <alexeyev.anton@gmail.com>
This commit is contained in:
Anton Alexeyev
2025-06-11 11:09:51 +07:00
committed by GitHub
parent 4fd31df4c3
commit f5f3a3d704
@@ -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)