I played with it myself, and it was not so obvious.
Here's how I ended up getting the job:
You need to call wysihtml5() on the textarea element, best_in_place:activate to the best_in_place:activate event. This is my application.js.coffee :
$(".best_in_place").each (index, element) -> $element = $(element) $element .best_in_place() .on 'best_in_place:activate', () -> $element.find(".wysihtml5").each -> $this = $(this) $this.wysihtml5()
I added the wysihtml5 css class using the inner_class option in the helper:
<%= best_in_place @client, :info, type: :textarea, nil: "Click here to add content!", inner_class: 'wysihtml5' }, sanitize: false, display_as: :info_html %>
Note that I use display_as: :info_html , since I have this field in the model to store the processed html, but you can use display_with: lambda { |v| v.html_safe } display_with: lambda { |v| v.html_safe } if this is not your case.
And now this is the hard part: the current version (3.0.3) of best_in_place does not play well with wysihtml5 , since the text space has become blurry to replace it with a contenteditable iframe , which in turn has made the editable operation be canceled. I needed to roll up some modifications to the gem, and I hope that it will be combined (you can see the full discussion here ), but in the meantime you can use my fork . If you do this, then you need to provide your view helper with this additional option: skip_blur: true .
dgilperez
source share