rails / actiontext

Edit and display rich text in Rails applications
406 stars 62 forks source link

The Frontend Editor Should be Configurable #41

Closed btoconnor closed 5 years ago

btoconnor commented 5 years ago

As part of the Rails framework, I think the particular frontend text editor should be configurable. There's enough plumbing in ActionText to be valuable for every WYSIWYG editor, such as the action_text_rich_blogs table for baked content, the ActiveStorage integration and the other conveniences provided by the framework. The Trix editor is just but one component.

For example, one should be able to selected Quill as their editor of choice in the configuration file:

config.action_text.editor = :quill

This would then instantiate the Quill editor for any forms built with the f.rich_text_area helper.

I've browsed through the source code and have a decent idea of what would need to change in order to support something like Quill, but I'm unfamiliar with the best practices with making a configurable framework like this.

I'm happy to take a stab at the code if someone were willing to help guide me along the way with what would need to change to make this happen and get accepted.

Thanks.

dhh commented 5 years ago

Please do take a stab! Would love to see the editor be configurable.

On Nov 17, 2018, at 11:39, btoconnor notifications@github.com wrote:

As part of the Rails framework, I think the particular frontend text editor should be configurable. There's enough plumbing in ActionText to be valuable for every WYSIWYG editor, such as the action_text_rich_blogs table for baked content, the ActiveStorage integration and the other conveniences provided by the framework. The Trix editor is just but one component.

For example, one should be able to selected Quill as their editor of choice in the configuration file:

config.action_text.editor = :quill This would then instantiate the Quill editor for any forms built with the f.rich_text_area helper.

I've browsed through the source code and have a decent idea of what would need to change in order to support something like Quill, but I'm unfamiliar with the best practices with making a configurable framework like this.

I'm happy to take a stab at the code if someone were willing to help guide me along the way with what would need to change to make this happen and get accepted.

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

matthewd commented 5 years ago

I'm unfamiliar with the best practices with making a configurable framework like this.

The short answer is to check out existing precedent in other Rails components, like Action Mailer delivery methods, Active Record database adapters, Action Cable transport adapters, and Active Storage backends.

I'd suggest glancing through at least a couple of those, to better get a feel for what's consistent, what's unique to each, and which one seems the best fit to base the new abstraction on.

btoconnor commented 5 years ago

Great - thanks for the tips. I'll see what I can come up with!

georgeclaghorn commented 5 years ago

I’m closing this because Action Text has been merged into Rails. If you end up taking a stab at this, please open a PR on rails/rails. Thanks!