I have written a plugin that shows a button next to the line of text a cursor is on. I would like to have this behavior occur only when hovering over the node.
I have seen the suggestion to use
handleDOMEvents here: How to add custom event handler to a node, more spcifically, mouse hover over a link?. But the mouseover and mouseenter events are attached to the editor, regardless of whether I use this prop in the plugin constructor or EditorView constructor.
Additionally, I am wondering how I can know which node is hovered, as I’m currently using
view.state.selection to determine the node that the cursor is on. In a different approach, I created a custom ParagraphView and attached event listeners to its dom, but was unable to determine which node was hovered (the plugin requires access to a custom node attribute). Is there some way to create a transaction on mouse events?
I would appreciate any help thanks!