Configurable ActionText

I’m not sure if I got the idea of A May of WTFs right, but here goes:

I just decided to use ActionText for the first time in a new project. I needed a simple rich text editor with support for bold, italic and hyperlinks.

I couldn’t find any way to pass any configuration to Trix. There’s some documentation, mentioning some way to disable some of the action buttons, after the editor has been initialized. This could be improved, especially for actiontext. I’d love to see something as simple as:

f.rich_text_editor :content, actions: %w[bold italic hyperlink]

Another huge pain-point is ActionText’s dependency on ActiveStorage. I understand, there’s already a paperclip icon with the editor that’s difficult to disable (as mentioned above). But what if I don’t use ActiveStorage and use Paperclip (for example) or Carrierwave or Dragonfly or Shrine? And I have it all 100% configured and I don’t want to reinvent the wheel with ActiveStorage?

What if I simply don’t want to allow file uploading?

Rails is omakase, but here seems like the chefs have decided. Thanks!

6 Likes

I’d take this a step further and say that it would be wonderful to have configurable front-end editors, an idea that @DHH has expressed support for in the past.

config.action_text.editor = :quill

Pretty please?

5 Likes

I think that configurable front-end editors would be a great idea! (and also, a configuration option for which asset upload provider ActionText uses.)

Right now, because the Rails maintainers aren’t being paid to work on Rails full time, features are much more likely to make it in if they come from someone’s real-world use case. I think that if someone wanted to do the work to add a different asset upload provider or front-end editor to ActionText for their use case, and then upstream that work, the maintainers would be delighted.

2 Likes

I’d be happy to see an easy way to slim down the formatting options available in Action Text. I’d even be interested in seeing a different text editor swapped in, but that would be a massive undertaking, which would require a long-term committed contributor to step forward and do the work :+1:

1 Like

I also had to configure the formatting options in Action Text before.

As far as I remember, the only option to configure the Trix toolbar is to override the complete toolbar HTML template? Maybe a solution to configurable formatting options would be two PRs:

  • Making the toolbar’s buttons configurable in the Trix-Editor
  • Integration of these options in Action Text

Please Do Investigate :smile:

I will :smiley:
I’ll come up with a Proof of Concept for a configurable Action Text with formatting options and post a link here

3 Likes

https://github.com/lazaronixon/trix-extensions

In the line of allowing configure ActionText, I am exploring this approach: Comparing rails:main...ceritium:actiontext-class · rails/rails · GitHub

Demo: actiontext-configuration-demo/page.rb at master · ceritium/actiontext-configuration-demo · GitHub

It allows for example add custom validations actiontext-configuration-demo/custom_rich_text.rb at master · ceritium/actiontext-configuration-demo · GitHub

For anyone stumbling along here, I’ve been hard at work at an ActionText compatible rich text editor leveraging ProseMirror / TipTap. While storage solutions aren’t configurable currently, it does allow a much more configurable frontend experience. Documentation is still light, but figured I’d give it a plug.

Also, it supports real time collaboration if you use a compatible websocket server.

4 Likes

Wow looks great @KonnorRogers :clap: