Add regext to test multiline strings

This commit is contained in:
okbel
2018-03-05 17:55:56 -03:00
parent d26e2a328f
commit 4320263bcc
@@ -2,9 +2,10 @@ export function htmlNormalizer(htmlInput) {
const str = htmlInput;
// We are normalizing the input from contenteditable of each browser, also removing unnecesary html tags
// https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Editable_content#Differences_in_markup_generation
console.log(htmlInput);
return str
.replace('<p>', '<div>') // IE outputs <p> instead of <div>s
.replace('</p>', '</div>') // IE outputs <p> instead of <div>s
.replace('<div>', '<br>')
.replace('</div>', '');
.replace(/<p>/g, '<br>')
.replace(/<\/p>/g, '')
.replace(/<div>/g, '<br>')
.replace(/<\/div>/g, '');
}