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`.
pull/31513/head^2
silverwind 5 months ago committed by GitHub
parent d655ff18b3
commit 62b3738968
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      web_src/js/features/comp/ComboMarkdownEditor.js

@ -264,7 +264,9 @@ class ComboMarkdownEditor {
}); });
this.applyEditorHeights(this.container.querySelector('.CodeMirror-scroll'), this.options.editorHeights); this.applyEditorHeights(this.container.querySelector('.CodeMirror-scroll'), this.options.editorHeights);
await attachTribute(this.easyMDE.codemirror.getInputField(), {mentions: true, emoji: true}); 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); hideElem(this.textareaMarkdownToolbar);
} }

Loading…
Cancel
Save