Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@ export default function draftToHtml(
}
}
}
return html.join('');
const cleanedHtml = html.map((htmlBlock) =>
htmlBlock === "<p></p>\n" ? "<br>\n" : htmlBlock
);
return cleanedHtml.join("");
}
8 changes: 7 additions & 1 deletion lib/draftjs-to-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -676,6 +678,7 @@
return listHtml.join('');
}

/* @flow */
/**
* The function will generate html markup for given draftjs editorContent.
*/
Expand Down Expand Up @@ -714,7 +717,10 @@
}
}

return html.join('');
var cleanedHtml = html.map(function (htmlBlock) {
return htmlBlock === "<p></p>\n" ? "<br>\n" : htmlBlock;
});
return cleanedHtml.join("");
}

return draftToHtml;
Expand Down