fix(composer): get rid of extra blank lines on paste

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://review.inboxapp.com/D1357
This commit is contained in:
Evan Morikawa 2015-03-26 22:07:13 -04:00
parent e5f3f3087b
commit 1c56e5c15b

View file

@ -645,8 +645,14 @@ ContenteditableComponent = React.createClass
blockquote: "p"
table: "p"
cleanHtml.replace(/<p>/gi, "").replace(/<\/p>/gi, "<br/><br/>")
# We sanitized everything and convert all whitespace-inducing elements
# into <p> tags. We want to de-wrap <p> tags and replace with two line
# breaks instead.
cleanHTML = cleanHtml.replace(/<p[\s\S]*?>/gim, "").replace(/<\/p>/gi, "<br/><br/>")
# We never want more then 2 line breaks in a row.
# https://regex101.com/r/gF6bF4/2
cleanHTML.replace(/(<br\/?>\s*){3,}/g, "<br/><br/>")