From 9e244f758cfcd4cbb6ba2c177309ef120a44deef Mon Sep 17 00:00:00 2001 From: JeLuF Date: Fri, 7 Apr 2023 22:24:35 +0200 Subject: [PATCH] Don't paste empty prompts When pasting e.g. an image, window.clipboardData).getData('text') returns an empty string, which would delete the prompt. https://discord.com/channels/1014774730907209781/1093186485563424838 --- ui/media/js/dnd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/media/js/dnd.js b/ui/media/js/dnd.js index a16fbc65..1ac967ae 100644 --- a/ui/media/js/dnd.js +++ b/ui/media/js/dnd.js @@ -608,7 +608,7 @@ document.addEventListener('paste', async (event) => { } const paste = (event.clipboardData || window.clipboardData).getData('text') const selection = window.getSelection() - if (selection.toString().trim().length <= 0 && await parseContent(paste)) { + if (paste != "" && selection.toString().trim().length <= 0 && await parseContent(paste)) { event.preventDefault() return }