From 1e751d81b321c07f14ad25e034bf87a1e060e5ef Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 12 Dec 2024 12:37:25 +0800 Subject: [PATCH] Fix JS error when dropping a file to a editor without dropzone (#32804) `dropzoneEl` may not exist --- web_src/js/features/comp/EditorUpload.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/web_src/js/features/comp/EditorUpload.ts b/web_src/js/features/comp/EditorUpload.ts index b1f49cbe92667..89982747ea5de 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}) => {