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

No documentation/demo/testing for Action Text has_rich_text #2714

Open
2 of 12 tasks
sedubois opened this issue Apr 22, 2024 · 0 comments
Open
2 of 12 tasks

No documentation/demo/testing for Action Text has_rich_text #2714

sedubois opened this issue Apr 22, 2024 · 0 comments

Comments

@sedubois
Copy link
Contributor

sedubois commented Apr 22, 2024

Describe the bug

I could find neither in the documentation nor in the Avo Demo nor in the test suite how to hook up a resource with Action Text has_rich_text attributes.

Expected behavior

  • the documentation explains how to configure an Avo resource field to show and edit Action Text rich text as defined by the presence of has_rich_text in the Rails model
  • when the model contains has_rich_text :body (*), rails g avo:resource generates an Avo field of the correct type and with the correct parameters (currently it generates field :body, as: :text). NB: The closest existing field name is :trix but the field name :rich_text would make more sense in my view (this field is about more than just the front-end editor, and using another name than trix also opens the door to other editors such as prosemirror, tiptap, rhino).
  • the Avo field works without the presence of an attachment_key parameter and without the presence of has_many_attached on the Rails model
  • the demo has a model with has_rich_text, with support for rich text editing and embeds of images and other media types; the corresponding Avo resource has a corresponding field defined, allowing to view and edit the rich text, without needing an attachment_key parameter
  • the demo DB has an action_text_rich_texts table and other files generated by action_text:install, e.g. app/views/active_storage/blobs/_blob.html.erb
  • the test suite tests that Avo fields are created appropriately for models with has_rich_text

Models and resource files

class Post < ApplicationRecord
  has_rich_text :body
end

Additional context

The documentation and demo do make use of a trix Avo field (example), but only hooked up into regular :text ActiveRecord attributes, not Action Text (example).

The Avo Demo DB schema does not contain an action_text_rich_texts table nor other Action Text config files. It looks like rails action_text:install was not run.

Impact

  • High impact (It makes my app un-usable.)
  • Medium impact (I'm annoyed, but I'll live.)
  • Low impact (It's really a tiny thing that I could live with.)

Urgency

  • High urgency (I can't continue development without it.)
  • Medium urgency (I found a workaround, but I'd love to have it fixed.)
  • Low urgency (It can wait. I just wanted you to know about it.)

Our current workaround is to suspend our Avo migration and continuing to rely on Administrate, due to some outstanding questions with the Avo Trix field, primarily related to the management of embeds. We also tried to check the situation with the latest main commit but encountered issues. Clearer documentation/demo on the subject would be helpful.

(*) or other equivalent definitions, such as translates :body, backend: :action_text in the case of this gem I wrote. In all cases the rich text is available as record.body or record.rich_text_body and returns an object of type ActionText::RichText.

@sedubois sedubois changed the title No documentation/demo for Action Text has_rich_text No documentation/demo/testing for Action Text has_rich_text May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant