diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-12-12 12:37:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-12 12:37:25 +0800 |
commit | 1e751d81b321c07f14ad25e034bf87a1e060e5ef (patch) | |
tree | a8747cc985dda0895247a089035deb0db675b14e /web_src/js | |
parent | dfd75944992fc6508ec891b4c29715c23e59e4ed (diff) | |
download | gitea-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.ts | 1 |
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}) => { |