Skip to content
Browse files

Strip crap contenteditable newlines

  • Loading branch information...
1 parent 80bebea commit 88dd9b0496b42807c1f817c30a798568e6a7d002 Gareth Rees committed
Showing with 5 additions and 0 deletions.
  1. +5 −0 app/controllers/pages_controller.rb
View
5 app/controllers/pages_controller.rb
@@ -60,6 +60,11 @@ def update
Rails.logger.info "ID: #{params[:id]}"
Rails.logger.info "BODY: #{params[:page][:body].inspect}"
+
+ # Convert <div> line breaks to <p>
+ params[:page][:body] = params[:page][:body].gsub(/\<div\>/, '<p>')
+ params[:page][:body] = params[:page][:body].gsub(/\<\/div\>/, '</p>')
+ params[:page][:body] = params[:page][:body].gsub(/\<p\>\<br\>\<\/p\>/, '')
respond_to do |format|
if @page.update_attributes(params[:page])

0 comments on commit 88dd9b0

Please sign in to comment.
Something went wrong with that request. Please try again.