aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-12-12 12:37:25 +0800
committerGitHub <noreply@github.com>2024-12-12 12:37:25 +0800
commit1e751d81b321c07f14ad25e034bf87a1e060e5ef (patch)
treea8747cc985dda0895247a089035deb0db675b14e /web_src/js
parentdfd75944992fc6508ec891b4c29715c23e59e4ed (diff)
downloadgitea-1e751d81b321c07f14ad25e034bf87a1e060e5ef.tar.gz
gitea-1e751d81b321c07f14ad25e034bf87a1e060e5ef.zip
Fix JS error when dropping a file to a editor without dropzone (#32804)
`dropzoneEl` may not exist
Diffstat (limited to 'web_src/js')
-rw-r--r--web_src/js/features/comp/EditorUpload.ts1
1 files changed, 1 insertions, 0 deletions
diff --git a/web_src/js/features/comp/EditorUpload.ts b/web_src/js/features/comp/EditorUpload.ts
index b1f49cbe92..89982747ea 100644
--- a/web_src/js/features/comp/EditorUpload.ts
+++ b/web_src/js/features/comp/EditorUpload.ts
@@ -178,6 +178,7 @@ export function initTextareaEvents(textarea, dropzoneEl) {
});
textarea.addEventListener('drop', (e) => {
if (!e.dataTransfer.files.length) return;
+ if (!dropzoneEl) return;
handleUploadFiles(new TextareaEditor(textarea), dropzoneEl, e.dataTransfer.files, e);
});
dropzoneEl?.dropzone.on(DropzoneCustomEventRemovedFile, ({fileUuid}) => {