mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-02 16:59:40 +00:00
Replace fragile selectors with direct options from Dropzone
This commit is contained in:
parent
29d353f3a7
commit
7e55d4dc1f
@ -543,9 +543,12 @@ function initIssueTemplateCommentEditors(commentForm: HTMLFormElement) {
|
|||||||
showElem(commentForm.querySelectorAll('.combo-editor-dropzone .form-field-real'));
|
showElem(commentForm.querySelectorAll('.combo-editor-dropzone .form-field-real'));
|
||||||
hideElem(commentForm.querySelectorAll('.combo-editor-dropzone .combo-markdown-editor'));
|
hideElem(commentForm.querySelectorAll('.combo-editor-dropzone .combo-markdown-editor'));
|
||||||
queryElems(commentForm, '.combo-editor-dropzone .form-field-dropzone', (dropzoneContainer) => {
|
queryElems(commentForm, '.combo-editor-dropzone .form-field-dropzone', (dropzoneContainer) => {
|
||||||
const dropzone = dropzoneContainer.closest('.combo-editor-dropzone')?.querySelector('.dropzone');
|
const dropzoneEl = dropzoneContainer.closest<HTMLElement>('.combo-editor-dropzone')?.querySelector<HTMLElement>('.dropzone');
|
||||||
const hasUploadedFiles = dropzone?.querySelector('.dz-preview') !== null;
|
const dzInstance = dropzoneEl?.dropzone;
|
||||||
if (!hasUploadedFiles) hideElem(dropzoneContainer);
|
|
||||||
|
if (dzInstance && dzInstance.files.length === 0) {
|
||||||
|
hideElem(dropzoneContainer);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// activate this markdown editor
|
// activate this markdown editor
|
||||||
|
Loading…
Reference in New Issue
Block a user