How to exec a custom MenuItem when an editor element is clicked

I have a custom block node type and a custom “Insert” menu sub-item patterned after the examples, (it opens a custom modal that follows the same design/system as the rest of the app).

The UX i’m looking for is after an item of this custom type is inserted, and the user goes back and selects the block element again (blue outline occurs like with a hr tag). After this, I’d like a subsequent click on the already-selected element to open the same “Insert” MenuItem.

Everything works great (essentially it functions as a “replace”) if I manually go and click “insert” again after re-selecting the custom block element, I’d just like to know how I can re-open that menu item automatically when the element is clicked, so the user doesn’t have to go back up and hunt in the “insert” menu… I’ve spent some time reviewing the docs and so far the answer has eluded me, any help that’s available would be very much appreciated :slight_smile:

The handleClickOn prop should allow you to implement this in a relatively straightforward way I think – when it’s called, check whether the clicked node is also the selected node, and whether it is of the given type, and if so, open your dialog.

Thanks much @marijn. Works well, and also inspired a refactor of a lazy pattern :slight_smile: