Missing mouse events on image NodeSpec

I am having a problem with (image nodeSpec) and mouse events/selection. I have something in my config that has me at my wit’s end.

I have an app with 2 PM instances. In one, the setup is basically using barely more complex than the basic PM demo. It has my own @mention plugin, but that’s about it. When adding an image, I can click the and get the expected ProseMirror-selectednode class on the node. This instance has no nodeviews or schema changes.

On the other instance, I have more complex model, plus some NodeViews. However, I still have the sample “image” nodespec for images. In this instance, I cannot click an and select it to save my life. I am unable to select a range of document that includes the image and get the image in the clipboard.

I’ve tried all sorts of things to triangulate the problem–including attempting to break the demo. But I can’t. I’ve disabled all plugins of my own (except those found in the official PM repos). There must be something off with my schema or something.

My question: What can I do to troubleshoot this issue? I have handleClick and handleClickOn handlers in the editor props of my view constructor that log the events, but they are silent when I click on an .

1 Like

Ok, this was really dumb. I’m leaving the solution here because I’ve seen this happen before and brushed it off. This time, it was a show stopper.

I had this structure: < p> some text < img … /> < /p>

I had a NodeView for “paragraph” that had stopEvents(e) { if ( e is mousedown ) return true }.
That errant line of code was a left-over battle with trying to keep events for a React widget from bubbling up. I didn’t consider that it stopped the bubbling of

NodeView< paragraph > (has stopEvents handler) NodeView< image > (no custom stopEvents handler)

Oddly enough, the bogus handler in the paragraph node view did not affect the click-ability of the paragraph text itself.

1 Like