fix pasting images

master
Aevann 2024-11-13 15:37:48 +02:00
parent 17efb9c1c6
commit 4caea1b9f3
1 changed files with 4 additions and 4 deletions

View File

@ -681,7 +681,10 @@ document.onpaste = function(event) {
const focused = document.activeElement; const focused = document.activeElement;
let input; let input;
if (file_upload) { if (focused) {
input = focused.parentElement.querySelector('input[type="file"]')
}
else if (file_upload) {
if (location.pathname.endsWith('/submit') && focused && focused.id == 'post-text') { if (location.pathname.endsWith('/submit') && focused && focused.id == 'post-text') {
input = document.getElementById('file-upload-submit') input = document.getElementById('file-upload-submit')
} }
@ -698,9 +701,6 @@ document.onpaste = function(event) {
return; return;
} }
} }
else if (focused) {
input = focused.parentElement.querySelector('input[type="file"]')
}
else { else {
input = document.querySelector('input[type="file"]') input = document.querySelector('input[type="file"]')
} }