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

Support custom name and ID attributes #19

Merged
merged 3 commits into from
Dec 2, 2020

Conversation

OtherCroissant
Copy link
Contributor

Hi! Thanks for this package, it really helped me getting trix with attachments working in my react application.

I had two problems with the implmentation, which I thought I could share:

  • My project already imported Trix as a module. Because some weird combination, webpack thinks that the included Trix is different from the Trix that is included in the react-trix-rte. It resulted in a empty object when I imported Trix in my custom code. Removing the import from the react-trix-rte component implementation, fixed this issue. The import itself was done in this component only as a nice service, because it is not really used in the code of the component itself.
  • In parts of our application not yet migrated to react, I want to create a Trix editor component in a simple form input definition for the plain old forms. For this to work, the input has to have a name, and sometimes an ID that fits the form context. Therefore I needed to be able to set the ID and the name as a property of the react component. Now I can pass the ID and the name to the component when calling the react component with the rails-react reac_component helper.

Hope this helps!

@abhaynikam
Copy link
Owner

@cunknown PR looks good to me ❤️ . Could you add a changelog entry for both the problem PR resolves and add your GitHub id? I will test and merge it by today EOD and release a new version of the package.

Thank you for your work 🎉

@OtherCroissant
Copy link
Contributor Author

@abhaynikam Something like this?

Copy link
Owner

@abhaynikam abhaynikam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cunknown LGTM 🎉 . Will test it once and merge it. Thanks ❤️

@abhaynikam abhaynikam merged commit eea5e5e into abhaynikam:master Dec 2, 2020
@abhaynikam
Copy link
Owner

Released V1.0.7. Please feel free to upgrade. This is a breaking change for people upgrading unless manually import Trix from 'trix'; is added.

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 this pull request may close these issues.

2 participants