|
I would like to know if there is a way to trigger a mention using the dollar sign ($). My goal is to mention various symbols like Is there a method or existing functionality that supports this format for mentions? Any guidance or examples would be greatly appreciated! Thank you! |
Replies: 1 comment 2 replies
|
Hi @MarLapuz! I'm Dosu and I’m helping the lexical-beautiful-mentions team. Yes, you can trigger mentions using the dollar sign ($) in lexical-beautiful-mentions. The plugin supports custom triggers, so you just need to add '$' as a key in your mention items and (optionally) in the triggers array if you're using async search or utility functions. For example: const mentionItems = {
"$": [
{ value: "AAPL", uid: "AAPL" },
{ value: "NVDA", uid: "NVDA" },
{ value: "AMZN", uid: "AMZN" }
],
"@": [ /* ...other items... */ ]
};
// If using async search:
<BeautifulMentionsPlugin
items={mentionItems}
triggers={["$", "@"]}
/>You can also customize the mention style for '$' in your theme config: const beautifulMentionsTheme = {
"$": "bg-green-100 text-green-800 px-1 mx-px rounded",
"$Focused": "outline-none shadow-md"
};No code changes are needed—just list '$' as a trigger in your config and it will work for mentions like To reply, just mention @dosu. Share context across your team and agents. Try Dosu. |
The plugin does support custom triggers like
$, but there are a few things that can prevent it from working:$need to be escaped in the configuration because the plugin builds its regex directly from the triggers array. Try using"\\$"as the key in yourmentionItemsand in yourtriggersarray instead of just"$"(reference).$to trigger after any character, setpreTriggerChars="[\\s\\S]"in your plugin props (reference).mentionItemsandtriggersprops are structured like: