Can we replace text with react nodes

Hi @marijn
This is related to codemirror 5.
Can we render a link element(any visual element) from autocomplete popover using codemirror 5?
If not then is there a callback exposed when we are clicking on a item in autocomplete popover such that we can use the replaceWith property of markText to replace the text with a element.