react-mentions icon indicating copy to clipboard operation
react-mentions copied to clipboard

want dynamic attribute on the strong element

Open viking7982 opened this issue 1 year ago • 0 comments

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>
}

viking7982 avatar Apr 02 '24 15:04 viking7982