From 82c9589faa8cdecc46963c5458fb2c124d31de56 Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Sat, 26 Jul 2025 20:06:21 +0200 Subject: [PATCH] Only hide dropzone when no files have been uploaded (#35156) Instead of always hiding the dropzone when it's not active: - hide it when when there are no uploaded files and it becomes inactive - don't hide it when there are uploaded files Fixes #35125 --------- Co-authored-by: wxiaoguang --- web_src/js/features/repo-issue.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web_src/js/features/repo-issue.ts b/web_src/js/features/repo-issue.ts index 49e8fc40a2..b330b4869b 100644 --- a/web_src/js/features/repo-issue.ts +++ b/web_src/js/features/repo-issue.ts @@ -542,7 +542,12 @@ function initIssueTemplateCommentEditors(commentForm: HTMLFormElement) { // deactivate all markdown editors showElem(commentForm.querySelectorAll('.combo-editor-dropzone .form-field-real')); hideElem(commentForm.querySelectorAll('.combo-editor-dropzone .combo-markdown-editor')); - hideElem(commentForm.querySelectorAll('.combo-editor-dropzone .form-field-dropzone')); + queryElems(commentForm, '.combo-editor-dropzone .form-field-dropzone', (dropzoneContainer) => { + // if "form-field-dropzone" exists, then "dropzone" must also exist + const dropzone = dropzoneContainer.querySelector('.dropzone').dropzone; + const hasUploadedFiles = dropzone.files.length !== 0; + toggleElem(dropzoneContainer, hasUploadedFiles); + }); // activate this markdown editor hideElem(fieldTextarea);