image of blg

How to add mention functionality in lexical editor

it took me a lot of time to figure out how how to implement "@" functionality in lexical its already exist in the lexical playground

Installation

npm i lexical @lexical/react
npm i lexical @lexical/react

Config for Lexical

export const lexical = {
namespace: "mention-editor",
theme: { paragraph: "editor-paragraph" },
onError: (error: Error) => console.log(error),
nodes: [],
};
export const lexical = {
namespace: "mention-editor",
theme: { paragraph: "editor-paragraph" },
onError: (error: Error) => console.log(error),
nodes: [],
};

Creating node for Mention

const a = "";
const a = "";