I try to get the current hovered DOM node with view.domAtPos
like this:
new Plugin({
props: {
handleDOMEvents: {
mousemove(view, event) {
const posAtCoords = view.posAtCoords({
left: event.clientX,
top: event.clientY,
})
if (!posAtCoords) {
return false
}
const pos = posAtCoords.pos
// wrong for atom block nodes
const node = view.domAtPos(pos)
return false
},
},
},
})
For atom block nodes (like an image) domAtPos
always returns the prosemirror element itself and I don’t know why. I would have expected to get the image tag. I’ve set up a demo reproducing this:
The image node is at position 6.