redraft
Version:
Renders the result of Draft.js convertToRaw using provided callbacks, works well with React
10 lines (8 loc) • 359 B
JavaScript
// to render to a plain string we need to be sure all the arrays are joined after render
export const joinRecursively = (array) => array.map((child) => {
if (Array.isArray(child)) {
return joinRecursively(child);
}
return child;
}).join('');
export const makeList = children => children.map(child => `<li>${joinRecursively(child)}</li>`).join('');