Replace fragile selectors with direct options from Dropzone

This commit is contained in:
Bart van der Braak 2025-07-25 11:46:35 +02:00 committed by GitHub
parent 29d353f3a7
commit 7e55d4dc1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -543,9 +543,12 @@ function initIssueTemplateCommentEditors(commentForm: HTMLFormElement) {
showElem(commentForm.querySelectorAll('.combo-editor-dropzone .form-field-real'));
hideElem(commentForm.querySelectorAll('.combo-editor-dropzone .combo-markdown-editor'));
queryElems(commentForm, '.combo-editor-dropzone .form-field-dropzone', (dropzoneContainer) => {
const dropzone = dropzoneContainer.closest('.combo-editor-dropzone')?.querySelector('.dropzone');
const hasUploadedFiles = dropzone?.querySelector('.dz-preview') !== null;
if (!hasUploadedFiles) hideElem(dropzoneContainer);
const dropzoneEl = dropzoneContainer.closest<HTMLElement>('.combo-editor-dropzone')?.querySelector<HTMLElement>('.dropzone');
const dzInstance = dropzoneEl?.dropzone;
if (dzInstance && dzInstance.files.length === 0) {
hideElem(dropzoneContainer);
}
});
// activate this markdown editor