NodeView selection bug

I have a bug that is also in the NodeView demo.

  1. Select some text in paragraph node
  2. Select some text in code (NodeView) node
  3. Toggle bold
  4. Old text block selection gets bolded

Expected: when text in code block is selected, the menu options change, so [B] isn’t available.

ProseMirror is retaining its representation of the selection when the node view gets focused (because it doesn’t know anything about the meaning of the selection/focus inside that). You can work around this by having the code editor update the ProseMirror selection when it receives focus, as I did in this patch, where I set it to a node selection on the code block. You could even make it update the ProseMirror selection to the precise character position of the code editor selection whenever that changes, but I figured that in that demo, there’s not much value in that.

Thanks for that patch.

When the node is selected the cursor / highlight isn’t showing up in my PM > NodeView > React > textarea. Anybody have any ideas?

See when I double-click to select “now” … no highlight but I can type to overwrite.

(I think it is a React snafu with focus synthetic event propagation. :unamused:)