react-mentions
react-mentions copied to clipboard
want dynamic attribute on the strong element
Hi:
In my project, I want the Mention strong elements with different styles.
Also, when I click an a Mention Strong element, I want to know which mention item i click and then I can do futher configuration on that metioned data. When I double click on the input, I can use document.elementsFromPoint to get the strong element easily but it's hard to find the id correspond to the clicked strong element.
It would be greate if I can add some dynamic attributes on the Strong element.
Like
const Mention = ({ id, display, style, className, classNames, getDynamicAttrs }) => {
const styles = useStyles(defaultStyle, { style, className, classNames })
const attrs = getDynamicAttrs ? getDynamicAttrs(id) : {}
return <strong {...styles} {...attrs}>{display}</strong>
}