Detecting editor blur event from plugins

Let’s take the official tooltip example as a base:

Once a selection is made, a tooltip is rendered thanks to a Prosemirror plugin. Now, if you click outside of the editor, this last lose the focus but the tooltip remains visible.

My question is about the recommended manner to detect the editor blur event from plugins so that the tooltip could be hidden on editor blur if we consider the previous example.

What would be the recommended manner? I was thinking about catching the blur event at the editor level by registering a listener with handleDOMEvents and upon event to send a second event that plugins have previously registered for. Is there a better approach?

Plugins can directly provide their own handleDOMEvents prop, so I don’t think that kind of indirection is necessary.

Thanks. I should learn to read :slight_smile:

A quick search didn’t fall in the Plugins reference documentation but after some attention I got it:

Props are configuration values that can be passed to an editor view or included in a plugin