editor.js
editor.js copied to clipboard
renderFromHTML removes <br> tags
renderFromHTML function doesn't seem to keep BR-tags. Same behaviour in pasting, might not be needed for pasting but for renderFromHTML it should work IMO
It doesnt matter how the BR-tag is written in the html-string, all those examples don't work:
renderFromHTML('<p>before<br>after</p>')
renderFromHTML('<p>before<br />after</p>')
renderFromHTML('<p>before<br/>after</p>')
Same issue here. Has anyone found a solution for that?
Anything new on this on ? Or any workaround ?
I came up with a workaround. But Oh boy is it ugly 💩
editor?.blocks.renderFromHTML(value.replaceAll('<br>', '##br##'));
await sleep(100);
const temp = await editor?.save()!;
for (const block of temp.blocks) {
if (block.type === 'paragraph') {
block.data.text = block.data.text.replaceAll('##br##', '<br>');
}
}
editor?.blocks.render(temp);