Toggling ProseMirror Plugin on React state change

Hi everyone,

We are trying to add a Modal (React component) that is appearing next to the text selection, which allows users to change the selected text and hyperlink (two input fields inside the floating Modal). We are thinking of implementing the Modal and its dynamic (next to text selection) position using a Plugin. The only issue we are facing this modal needs to toggle (appear/disappear) in the correct position based on the Toolbar click (React component state change triggered by onClick).

Question: Is there a way to have the Plugin toggle on React state change form the Toolbar click? Any thoughts/ideas/alternative solutions would be greatly appreciated!

You can use tr.setMeta and tr.getMeta to communicate between a ProseMirror plugin, and a React component with has access to an EditorView (then you can call view.dispatch(

Thank you, @bhl!