I am using the bootstrap-wysihtml5 gem, a WYSIWYG form text editor, for my app.
When I enter something that looks like this into my text area:
\”this is a test to see if bold and italic are working\”
I see this in my view:
\"this is a test to see if **bold** and *italic* are working\"
Any html is shown as code instead of getting rendered as formatted text.
It seems the formatting is getting coded, it\’s just not rendering correctly.
What could be causing this?
My code is as below, and closely follows the ReadMe.
posts/_form.html.erb
<%= form_for @post, :html => { :multipart => true } do |f| %>
<%= f.label :content %>
<%= f.text_area :content, :class => \'wysihtml5\' %>
<%= f.label :photo %>
<%= f.file_field :photo %>
<script type=\"text/javascript\">
$(\'.wysihtml5\').each(function(i, elem) {
$(elem).wysihtml5();
});
</script>
<div class=\"actions\">
<%= f.submit %>
</div>
<% end %>
posts/_post.html.erb
<div class=\"photo\"><%= image_tag post.photo.url %></div>
<div class=\"content\"><%= post.content %></div>





Rating:
The post javascript – formatted text not rendering and showing up as code in the view appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/javascript-formatted-text-not-rendering-and-showing-up-as-code-in-the-view.html
No comments:
Post a Comment