Add markdown field support through SimpleMDE #2949
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was looking for markdown editing support in
rails_admin
and came across this stale issue #1235. After some digging I couldn't find a satisfactory solution in built-in support or plugins, so thought I'd take a stab at it myself.I decided to go with SimpleMDE after some research since it looks neat and very simple to use.
With this feature, you can do
field :text_field, :simple_mde
and have a SimpleMDE markdown editor. The easiest way to enable it issimplemde-rails
which unfortunately uses a somewhat outdated SimpleMDE version,but I've opened an issue there to hopefully update itfixed in KHN190/simplemde-rails#1. Users can also just load SimpleMDE themselves.This is how it looks like:
Test coverage:
Linter is complaining that 2 lines in the coffeescripts are too long... but there are longer lines existing in the same file, not sure if I should bother with it.
cc @mshibuya