Skip to content

Commit f4b4b0b

Browse files
GiteaBotbartvdbraakwxiaoguang
authored
Only hide dropzone when no files have been uploaded (go-gitea#35156) (go-gitea#35167)
Backport go-gitea#35156 by @bartvdbraak 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 go-gitea#35125 Co-authored-by: Bart van der Braak <bartvdbraak@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent 9959604 commit f4b4b0b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

web_src/js/features/repo-issue.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,12 @@ function initIssueTemplateCommentEditors(commentForm: HTMLFormElement) {
547547
// deactivate all markdown editors
548548
showElem(commentForm.querySelectorAll('.combo-editor-dropzone .form-field-real'));
549549
hideElem(commentForm.querySelectorAll('.combo-editor-dropzone .combo-markdown-editor'));
550-
hideElem(commentForm.querySelectorAll('.combo-editor-dropzone .form-field-dropzone'));
550+
queryElems(commentForm, '.combo-editor-dropzone .form-field-dropzone', (dropzoneContainer) => {
551+
// if "form-field-dropzone" exists, then "dropzone" must also exist
552+
const dropzone = dropzoneContainer.querySelector<HTMLElement>('.dropzone').dropzone;
553+
const hasUploadedFiles = dropzone.files.length !== 0;
554+
toggleElem(dropzoneContainer, hasUploadedFiles);
555+
});
551556

552557
// activate this markdown editor
553558
hideElem(fieldTextarea);

0 commit comments

Comments
 (0)