Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Strip crap contenteditable newlines

  • Loading branch information...
commit 88dd9b0496b42807c1f817c30a798568e6a7d002 1 parent 80bebea
Gareth Rees authored
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])
Please sign in to comment.
Something went wrong with that request. Please try again.