我在textarea的rails应用程序上安装了SimpleMDE,用于创建帖子。我遇到的问题是,当我想编辑post.body的内容时(即具有简单文本的文本区域)看起来缩进,就像您在屏幕截图上看到的那样:

我已经查看了显示操作上的源代码,以防它产生额外的标记,但是标记看起来很好。

这让我觉得编辑出了问题。如何修复编辑器上显示的缩进?
这也是我的代码
# 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])发布于 2017-03-21 22:03:42
我找到了一个解决方案,所以我会把它放在这里,以防其他人需要它。
https://github.com/NextStepWebs/simplemde-markdown-editor/issues/480
基本上所有需要做的就是
= f.input :body使用
~ f.input :body # notice the tilde symbol这能解决所有问题。
然而,如果有一个更好的解决方案,我会很感激有人会张贴它。
https://stackoverflow.com/questions/42923696
复制相似问题