Created
December 3, 2012 07:43
-
-
Save mkelley33/4193432 to your computer and use it in GitHub Desktop.
best_in_place: fix disappearing line-breaks in textarea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery -> | |
$('[id^="best_in_place_your_object_"],[id$="address"]').on 'best_in_place:update', (event) -> | |
$address = $(event.target) | |
$address.data('bestInPlaceEditor').original_content = $address.html() | |
$address.html $address.html().replace(/[\n\r]+/g, '<br>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h4><%= best_in_place your_object, :address, type: :textarea, display_with: -> v { v.gsub(/[\r\n]+/, '<br>').html_safe } %></h4> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment