abhaynikam/react-trix-rte

Multiple instances trigger same onChange event

Closed this issue · 2 comments

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

@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

Thank you so much!