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

Closed
6 of 12 tasks
sedubois opened this issue Apr 22, 2024 · 5 comments
Closed
6 of 12 tasks

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

sedubois opened this issue Apr 22, 2024 · 5 comments
Labels

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
Copy link
Contributor

This issue has been marked as stale because there was no activity for the past 15 days.

@github-actions github-actions bot added the Stale label May 23, 2024
@sedubois
Copy link
Contributor Author

I would love to see this fixed. Lack of action text support prevents us from finishing our migration to Avo started a few months ago.

@adrianthedev
Copy link
Collaborator

adrianthedev commented May 23, 2024

Hey @sedubois.

It's true we didn't have all of these documented. I added them now (docs link).
I also added a demo app with the source code available (it's not that much).

We are a bit squeezed on time and can't add a has_rich_text test case on the dummy app, but we'll gladly take on a PR, please.
We'll definitely take a helping hand on tweaking the generator to use the trix field instead of :text. You're 100% on point with that suggestion.

Please let me know if there's anything else we can help you with in regards with documentation about Active Text and Action Storage, otherwise I'll close this to keep the issue queue clean.

@sedubois
Copy link
Contributor Author

@adrianthedev it's great to have a first Avo demo with has_rich_text, thanks!

It does demonstrate that embed captions don't yet work, the caption text is displayed in the wrong place and breaks when re-saving the resource:
https://trix.avodemo.com/avo/resources/posts/1/edit

Screenshot 2024-05-23 at 12 55 20

It is also mentioned in this comment:
#2715 (comment)

The other issue is this one with custom embeds, I don't know how to fix it but provided a repro:
#2627

@adrianthedev
Copy link
Collaborator

For the custom embeds we'd need to dig in deeper and that takes time. Would you be open to book some paid support so we can look into it further?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants