问题
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 looks like in the view:
<h2>Header</h2><h3>Sub head:</h3><br><img alt="Thumb 1320236280147" src="/uploads/bootsy/image/1/1320236280147.jpg">
It seems that none of the html formatting is being rendered as it is being escaped by quoation marks or something like that - has anyone else had this problem? I haven't seen any issues on the github page or on SO to point me in the right direction.
I haven't done anything yet apart from follow the gem install instructions but maybe I missed something or am just making a stupid mistake.
If there's anything else you want to know please just ask.
Cheers
回答1:
You need to have something like this, escape html:
<%= f.bootsy_area(:body, class: 'bg-code').html_safe %>
回答2:
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.
回答3:
maybe use raw?
<%= raw(post.body) %>
回答4:
You can also add to bootsy.rb
config.editor_options = {
html: true
.....
}
to enable you to toggle html in the bootsy editor .
来源:https://stackoverflow.com/questions/26594898/rails-4-wysiwyg-bootsy-not-displaying-formatting