From 62b373896869da769992fbad06d13606c57c5585 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 28 Jun 2024 07:59:22 +0200 Subject: [PATCH] Fix JS error with disabled attachment and easymde (#31511) Not sure if this is a regression from https://github.com/go-gitea/gitea/pull/30513, but when attachments are disabled, `this.dropzone` is null and the code had failed in `initEasyMDEPaste` trying to access `dropzoneEl.dropzone`. --- web_src/js/features/comp/ComboMarkdownEditor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web_src/js/features/comp/ComboMarkdownEditor.js b/web_src/js/features/comp/ComboMarkdownEditor.js index 21779e32a8..f511adab1a 100644 --- a/web_src/js/features/comp/ComboMarkdownEditor.js +++ b/web_src/js/features/comp/ComboMarkdownEditor.js @@ -264,7 +264,9 @@ class ComboMarkdownEditor { }); this.applyEditorHeights(this.container.querySelector('.CodeMirror-scroll'), this.options.editorHeights); await attachTribute(this.easyMDE.codemirror.getInputField(), {mentions: true, emoji: true}); - initEasyMDEPaste(this.easyMDE, this.dropzone); + if (this.dropzone) { + initEasyMDEPaste(this.easyMDE, this.dropzone); + } hideElem(this.textareaMarkdownToolbar); }