Reputation: 4497
I've installed SimpleMDE on my rails app on a textarea for creating posts. The issue I have is when I want to edit the content of the post.body (ie the textarea that has the simplemde) looks indented like you see on the screenshot:
I have viewed the source code on show action in case it generates some extra tags, but the markdown looks fine
which makes me think that its something wrong with the editor. How can I fix this indentation that shows on the editor?
Here is also my code
# The gemfile
gem 'simplemde', '~> 0.1.0'
gem 'redcarpet', '~> 3.4'
# gem 'html-pipeline', '~> 2.5'
# gem 'github-markdown', '~> 0.6.9'
# gem 'sanitize', '~> 4.4'
# the _form.html.haml file
= f.input :body, as: :text, input_html: { class: 'simplemde' }
# the coffescript file
simplemde = null
$(document).on 'turbolinks:before-visit', ->
if simplemde?
simplemde.toTextArea()
simplemde = null
$(document).on 'turbolinks:load', ->
simplemde = new SimpleMDE(element: $('.simplemde')[0])
Upvotes: 0
Views: 630
Reputation: 4497
I have found a solution, so I'm going to post it here just in case anyone else needs it.
https://github.com/NextStepWebs/simplemde-markdown-editor/issues/480
Basically all needed todo was to replace
= f.input :body
with
~ f.input :body # notice the tilde symbol
and this would fix everything.
However if there's a much better solution, I'd appreciate if someone would post it.
Upvotes: 1