brouberol/5esheets

Render the markdown content of text fields, and allow their edition

Closed this issue · 1 comments

The way this worked in the previous, vanilla-JS app, was:

  • each text field that contained markdown was actually invisible, and doubled up by a div containing the rendered markdown content (rendered via https://github.com/markedjs/marked)
  • when the focusin event was triggered, the div was hidden, and the text field was shown
  • after edition, when the focusout event was triggered, the text field was hidden, and the div was shown

The trick was to make the text field part of the overall form, but not the div. This allowed us to evaluate and render mini macros, such as @int_mod on the fly, and not have the rendered value be saved to DB at the next form submit.

Fixed by #249