Skip to content

Commit 82c9589

Browse files
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 <[email protected]>
1 parent 54fe47f commit 82c9589

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
@@ -542,7 +542,12 @@ function initIssueTemplateCommentEditors(commentForm: HTMLFormElement) {
542542
// deactivate all markdown editors
543543
showElem(commentForm.querySelectorAll('.combo-editor-dropzone .form-field-real'));
544544
hideElem(commentForm.querySelectorAll('.combo-editor-dropzone .combo-markdown-editor'));
545-
hideElem(commentForm.querySelectorAll('.combo-editor-dropzone .form-field-dropzone'));
545+
queryElems(commentForm, '.combo-editor-dropzone .form-field-dropzone', (dropzoneContainer) => {
546+
// if "form-field-dropzone" exists, then "dropzone" must also exist
547+
const dropzone = dropzoneContainer.querySelector<HTMLElement>('.dropzone').dropzone;
548+
const hasUploadedFiles = dropzone.files.length !== 0;
549+
toggleElem(dropzoneContainer, hasUploadedFiles);
550+
});
546551

547552
// activate this markdown editor
548553
hideElem(fieldTextarea);

0 commit comments

Comments
 (0)