ProseMirror / prosemirror

The ProseMirror WYSIWYM editor
http://prosemirror.net/
MIT License
7.59k stars 335 forks source link

textBetween ignores empty paragraphs #1419

Closed Septh closed 10 months ago

Septh commented 10 months ago

Given the following block node (shown here in a html-y way, but I am actually talking of PM nodes):

<block>
  <p>1</p>
  <p></p>   // <-- note: empty paragraph
  <p>2</p>
</block>

Because the empty paragraph is present is the block's contents, I would expect block.textBetween(startOfBlock, endOBlock, "\n") to return "1\n\n2" (somehow akin to what array.join() does) but I'm getting "1\n2" instead. Is this intended behavior?

marijnh commented 10 months ago

I don't think that was intentional. Attached patch should improve it.