node.textContent returns text without whitespace between nodes

I’m trying to pull the plain text out of the editor, but when I use editorState.doc.textContent new line breaks aren’t preserved and text gets smashed together. I tried using textBetween and passed in ‘\n\n’ as the block separator, but that also didn’t work. Any suggestions?

Hi @jessica,

welcome )

textBetween should work fine. Could you post your code? This is what I’d do. At least on the examples from the website that seems to work.

doc.textBetween(0, doc.nodeSize - 2, '\n')



Well, huh. That does seem to work! Thanks :slight_smile: