ActionText is a new inclusion in the rails framework version 6.0, and it enables the creation and storage of rich text content in your rails applications. This means that now features like changing the font and format of text and embedding images and hyperlinks can be done directly in the ruby on rails framework.
As its front-end, ActionText uses the trix- a rich text editor- that provides the user with a
Any files that you need can be uploaded to cloud platforms of your choosing through the incorporated Active Storage in ActiveText. It allows you to upload your files/attachments to a cloud storage service like Google Cloud or Microsoft Azure and links them to Active Record objects which we can use to interact with those uploads.
Trixmakes the process of uploading very simple with it just requiring the user to drag and drop the required attachments from their local directory to the editor.
Use the following steps to use ActionText in your project:
In order to use ActionText the first step is to install it using the following terminal command
bin/rails action_text:install
Now you need to include trix and ActionText in your application.js file
// application.js
require("trix")
require("@rails/actiontext")
Import the trix stylesheet in the actiontext.scss file
// actiontext.scss
@import "trix/dist/trix";
Now, import this actiontext.scss file in your application.scss stylesheet pack:
// application.scss
@import "./actiontext.scss";
With that you are now ready to use ActionText in your Rails project.
Click here to see how you can create a whole project using
ActionText.
Free Resources