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

Multiple instances trigger same onChange event #47

Closed
NSpehler opened this issue Nov 26, 2021 · 2 comments · Fixed by #49
Closed

Multiple instances trigger same onChange event #47

NSpehler opened this issue Nov 26, 2021 · 2 comments · Fixed by #49

Comments

@NSpehler
Copy link

Hello,

I'm trying to use 2 instances of ReactTrixRTEInput on the same page, by giving them different IDs, but they trigger the same onChange event, so the content get mixed up when they end up in the state.

Here's a reproduction of the issue:
https://codesandbox.io/s/react-trix-rte-hsxql

My workaround at the moment is to manually check which input triggered the onChange event, but that's not very elegant:

onChange={(e) =>
    e.target.getAttribute("input") === "react-trix-1" && setFirstValue(e.target.value)
}

Have you seen this issue before?

Thank you for your help,
Nicolas

@abhaynikam
Copy link
Owner

@NSpehler Thanks for reporting the issue ❤️ . We have resolved the issue and released new version of the package. Please upgrade to v1.0.16.

You can even test it on Sandbox(shared by you): https://codesandbox.io/s/react-trix-rte-forked-g2gi2?file=/src/index.js

@NSpehler
Copy link
Author

Thank you so much!

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

Successfully merging a pull request may close this issue.

2 participants