How does the lexical editor directly inject mentions into the editor through events?

207 Views Asked by At

I am using the NewMentionsPlugin of the official playground to meet the requirements.

plugin source code :https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/plugins/MentionsPlugin/index.tsx

this Plugin can solve the problem of users entering @ to bring in the mentionNode.

May I ask how I can inject a specific mentionNode into the editor directly through the button event, I expect it to be injected at the selection position.

I expect that I can inject the mentionNode into the editor through the button event, and I expect that the button event can have parameters, so that I can specify which mention content to bring.

0

There are 0 best solutions below