diff --git a/js/index.js b/js/index.js index 16c705b..50307c9 100644 --- a/js/index.js +++ b/js/index.js @@ -43,5 +43,8 @@ export default function draftToHtml( } } } - return html.join(''); + const cleanedHtml = html.map((htmlBlock) => + htmlBlock === "

\n" ? "
\n" : htmlBlock + ); + return cleanedHtml.join(""); } diff --git a/lib/draftjs-to-html.js b/lib/draftjs-to-html.js index 55f02e7..ac48b0b 100644 --- a/lib/draftjs-to-html.js +++ b/lib/draftjs-to-html.js @@ -4,6 +4,8 @@ (global = global || self, global.draftjsToHtml = factory()); }(this, (function () { 'use strict'; + /* @flow */ + /** * Utility function to execute callback for eack key->value pair. */ @@ -676,6 +678,7 @@ return listHtml.join(''); } + /* @flow */ /** * The function will generate html markup for given draftjs editorContent. */ @@ -714,7 +717,10 @@ } } - return html.join(''); + var cleanedHtml = html.map(function (htmlBlock) { + return htmlBlock === "

\n" ? "
\n" : htmlBlock; + }); + return cleanedHtml.join(""); } return draftToHtml;