Configurable ActionText

I鈥檓 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鈥檛 find any way to pass any configuration to Trix. There鈥檚 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鈥檇 love to see something as simple as:

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

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

What if I simply don鈥檛 want to allow file uploading?

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

6 Likes

I鈥檇 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鈥檛 being paid to work on Rails full time, features are much more likely to make it in if they come from someone鈥檚 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鈥檇 be happy to see an easy way to slim down the formatting options available in Action Text. I鈥檇 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鈥檚 buttons configurable in the Trix-Editor
  • Integration of these options in Action Text

Please Do Investigate :smile:

I will :smiley:
I鈥檒l 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鈥檝e been hard at work at an ActionText compatible rich text editor leveraging ProseMirror / TipTap. While storage solutions aren鈥檛 configurable currently, it does allow a much more configurable frontend experience. Documentation is still light, but figured I鈥檇 give it a plug.

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

4 Likes

Wow looks great @KonnorRogers :clap: