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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action Text rich text area tag should use to_trix_html value #41514

Merged

Conversation

abhaynikam
Copy link
Contributor

Related to: #38027 (comment)

This PR aims to suggest to use to_trix_html instead of action text to_s when using rich_text_area_tag. Added a delegate in the model to make to_trix_html method available easier similar to to_s or to_plain_text. Not sure if this would require changelog entry. Please do let me know and I'll add the changelog if needed 馃槉

@rails-bot rails-bot bot added the actiontext label Feb 22, 2021
@abhaynikam abhaynikam force-pushed the fixes-rich-text-area-tag-scenario branch from 700b16c to 67b3ee2 Compare February 22, 2021 05:54
@georgeclaghorn
Copy link
Contributor

I think we should have rich_text_area_tag call to_trix_html automatically instead:

input_tag = hidden_field_tag(name, value.try(:to_trix_html) || value, id: options[:input])

/cc @javan

@georgeclaghorn georgeclaghorn self-assigned this Feb 27, 2021
@abhaynikam abhaynikam force-pushed the fixes-rich-text-area-tag-scenario branch 2 times, most recently from 5e0f098 to 50dceba Compare February 27, 2021 13:19
@abhaynikam
Copy link
Contributor Author

@georgeclaghorn Thank you for the feedback. Implemented the suggested changes. rich_text_area_tag value would automatically call to_trix_html now. 馃槉

actiontext/test/template/form_helper_test.rb Outdated Show resolved Hide resolved
actiontext/test/template/form_helper_test.rb Outdated Show resolved Hide resolved
@abhaynikam abhaynikam force-pushed the fixes-rich-text-area-tag-scenario branch from 50dceba to 413f7ee Compare February 28, 2021 06:01
@abhaynikam
Copy link
Contributor Author

@georgeclaghorn Addressed all the comments. Please have another look 馃槉

@georgeclaghorn georgeclaghorn merged commit adc5eb6 into rails:main Feb 28, 2021
@javan
Copy link
Contributor

javan commented Mar 1, 2021

I think we should have rich_text_area_tag call to_trix_html automatically instead

A belated 馃憤 from me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants