From 6b8e4c2661a236a85ff5f253251bfc8b65d4e78d Mon Sep 17 00:00:00 2001 From: MicroBlock <66859419+MicroCBer@users.noreply.github.com> Date: Tue, 8 Aug 2023 19:57:28 +0800 Subject: [PATCH] feat: paste file --- templates/index.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index 043f4ba..15d15d4 100644 --- a/templates/index.html +++ b/templates/index.html @@ -393,6 +393,12 @@ evt.preventDefault(); }; + document.onpaste = function (event) { + const data = (event.clipboardData || event.originalEvent.clipboardData); + if(data.files.length === 0) return; + attachFileButton.textContent = "Attached: " + data.files[0].name; + hiddenFileButton.files = data.files; + } -{% include "footer.html" %} \ No newline at end of file +{% include "footer.html" %}