image of blg

How to add mention functionality in lexical editor

Test for blog.

3 min

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

Terminal.sh

npm i lexical @lexical/react

Terminal.sh

npm i lexical @lexical/react

Config for Lexical

lexicalConfig.ts

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

lexicalConfig.ts

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 = "";