Rails 4 WYSIWYG Bootsy not displaying formatting

前端 未结 4 572
温柔的废话
温柔的废话 2021-01-19 01:44

I\'ve just followed the install instructions at the the bootsy gem page and it all looks good until I save and look at the post\'s content.

This is what the output l

相关标签:
4条回答
  • 2021-01-19 02:28

    maybe use raw?

    <%= raw(post.body) %>
    
    0 讨论(0)
  • 2021-01-19 02:30

    You need to have something like this, escape html:

    <%= f.bootsy_area(:body, class: 'bg-code').html_safe %>

    0 讨论(0)
  • 2021-01-19 02:35

    Sergio is correct but have the .html_safe on the output rather than the input.

    For example, on a post index:

    <%= post.body.html_safe %>
    

    Hope this helps.

    0 讨论(0)
  • 2021-01-19 02:37

    You can also add to bootsy.rb

    config.editor_options = {
      html: true
      .....
    }
    

    to enable you to toggle html in the bootsy editor .

    0 讨论(0)
提交回复
热议问题