Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.41k stars 316 forks source link

Blocks form submission with no feedback. #536

Open bernd-wechner opened 1 year ago

bernd-wechner commented 1 year ago

Describe the bug Blocks form submission with no feedback.

To Reproduce

  1. Add a markdownfield.models.MarkdownField to a Django model
  2. forget to set blank=True (which permits submission of blank fields on Django ModelForms)
  3. Try and submit a form with that field on it

The Submit button does nothing. Submits nothing. And displays nothing on the page. Took me a while to trace it to this editor (just added in his iteration). As I only had the minified JS to look at not diagnosed further but can see it binds to the submit event and I presume blocks submission if blank fields are not permitted and probably wants to notify the user but there may be some configuration error, or a bug maybe, whatever, that is preventing any visible indication.

My fix was just to set blank=True as submitting nothing is perfectly valid in our context. But it took a while to trace so I thought I'd drop a note (that said, this looks like a super popular little editor and has hundreds of pen issues and I see a v3.0 rewrite is underway, so issues like this one may just not be worth anyone's time to more than triage if that (and hope it goes away in 3.0 ;-).

Expected behavior I'd expect it it to pop up a little message saying what's happened. Other Django fields do that ... or not block submission. But this could well relate to how the markdownfield package integrates with the editor and initialises it. i.e. it might be a downstream issue.