Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

want dynamic attribute on the strong element #740

Open
viking7982 opened this issue Apr 2, 2024 · 0 comments
Open

want dynamic attribute on the strong element #740

viking7982 opened this issue Apr 2, 2024 · 0 comments

Comments

@viking7982
Copy link

viking7982 commented Apr 2, 2024

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>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant