Selecting a Block-Level Node after Insertion

I thought that perhaps the nodesBetween-Method was not including the end position, because the newly inserted node is always missing in the iteration, but upon further investigation, it seems like the anchor is not in fact after the node.

When I insert an image into an empty document (Edit: empty in the sense that it contains only an empty paragraph), tr.selection.anchor is 0 after tr.replaceSelectionWith(). Shouldn’t it be 1 if it was really after the inserted node?

The only time iterating to tr.selection.anchor without +1 seems to work is when inserting the image in the middle of a paragraph node, e.g. when splitting a word in half.

Re losing focus when contentDOM is present, that was a false alarm, I had an unrelated element stealing focus from the editor when it was loaded in a modal. The selection via iteration works the same whether the NodeView has a contentDOM or not.