From 5a64dc48cbb1af7551f204e28c4b3d10926d1356 Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 28 Feb 2024 20:12:31 +0200 Subject: [PATCH] fix this https://rdrama.net/h/sports/post/249562/in-memory-of-jimiewhales-horny-horners/6025587#context --- files/assets/js/core.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 3f248662c..5809b51c5 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -523,9 +523,13 @@ function handle_files(input, newfiles) { oldfiles[ta.id] = new DataTransfer(); } - const oldtext = ta.value; - for (let file of newfiles) { + if (oldfiles[ta.id].items.length == 20) + { + window.alert("You can't upload more than 20 files at one time!") + break + } + if (file.name == 'image.png') { const blob = file.slice(0, file.size, 'image/png'); const new_name = Math.random().toString(32).substring(2,10) + '.png' @@ -537,15 +541,6 @@ function handle_files(input, newfiles) { input.files = oldfiles[ta.id].files; - if (input.files.length > 20) - { - window.alert("You can't upload more than 20 files at one time!") - input.value = null - ta.value = oldtext - oldfiles[ta.id] = new DataTransfer(); - return - } - markdown(ta) autoExpand(ta)