Skip to content

Commit

Permalink
Strip bad line breaks when validating pasted content.
Browse files Browse the repository at this point in the history
MS Word and other awful software inserts line breaks for no reason, which
causes formatting problems.
  • Loading branch information
boonebgorges committed Jun 8, 2016
1 parent ee05545 commit fc1e9af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assets/js/cacap.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ window.wp = window.wp || {};
clean_content += content;
}

// Remove bad line breaks from MS Word paste (all line breaks should be
// followed immediately by an HTML tag)
clean_content = clean_content.replace( /\n([^<])/g, " $1" );

return clean_content;
},

Expand Down

0 comments on commit fc1e9af

Please sign in to comment.