Best in Place Editor Clearing TextArea

327 views Asked by At

I am using the Best in Place editor to enable an inline text editor in my Rails app.

When I click on a best in place element, it shows an empty textarea instead of the current value of the text editor. For example, if I have the text "Test Project" and click on the best in place editor, it sets the text to "&nbsp" If I click out of the best in place area, though, it returns to the correct static text.

Here is a video of the bug: https://youtu.be/xA18Odj47sc

Here is what my code looks like:

<%= best_in_place @collection, :name, :type => :textarea, :nil => @collection.name, :sanitize => false, :value => @collection.name %>

And this is what gets rendered on the page:

Before click:

      <span class="best_in_place" id="best_in_place_collection_1_name" data-url="/collections/introduction-to-product-design--3" data-object="collection" data-attribute="name" data-nil="Test Project" data-type="textarea" data-sanitize="false">Test Project</span>

After click:

<span class="best_in_place" id="best_in_place_collection_1_name" data-url="/collections/introduction-to-product-design--3" data-object="collection" data-attribute="name" data-nil="Test Project" data-type="textarea" data-sanitize="false">
      <form action="javascript:void(0)" style="display:inline">
          <textarea style="min-width: 193px; min-height: 66px; overflow: hidden;"></textarea>
          <div style="position: absolute; display: none; word-wrap: break-word; font-weight: 400; width: 206px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; font-size: 14px; padding: 4px 6px;">&nbsp;</div>  
      </form>
</span>
1

There are 1 answers

0
scientiffic On

I think there must be a bug because after I simplified the best in place text area to:

 <%= best_in_place @collection, :name, :type => :textarea %>

it seemed to work. Perhaps something is currently wrong with setting a value.