diff --git a/app/helpers/action_text/tag_helper.rb b/app/helpers/action_text/tag_helper.rb
index 28c62166dd..8d1ff0aaad 100644
--- a/app/helpers/action_text/tag_helper.rb
+++ b/app/helpers/action_text/tag_helper.rb
@@ -2,6 +2,17 @@ module ActionText
module TagHelper
cattr_accessor(:id, instance_accessor: false) { 0 }
+ # Returns a `trix-editor` tag that instantiates the Trix JavaScript editor as well as a hidden field
+ # that Trix will write to on changes, so the content will be sent on form submissions.
+ #
+ # ==== Options
+ # * :class - Defaults to "trix-content" which ensures default styling is applied.
+ #
+ # ==== Example
+ #
+ # rich_text_area_tag "content", message.content
+ # #
+ # #
def rich_text_area_tag(name, value = nil, options = {})
options = options.symbolize_keys
@@ -37,6 +48,18 @@ module ActionView::Helpers
end
module FormHelper
+ # Returns a `trix-editor` tag that instantiates the Trix JavaScript editor as well as a hidden field
+ # that Trix will write to on changes, so the content will be sent on form submissions.
+ #
+ # ==== Options
+ # * :class - Defaults to "trix-content" which ensures default styling is applied.
+ #
+ # ==== Example
+ # form_with(model: @message) do |form|
+ # form.rich_text_area :content
+ # end
+ # #
+ # #
def rich_text_area(object_name, method, options = {})
Tags::ActionText.new(object_name, method, self, options).render
end
diff --git a/app/models/action_text/rich_text.rb b/app/models/action_text/rich_text.rb
index 0b6043bd74..94cf595fac 100644
--- a/app/models/action_text/rich_text.rb
+++ b/app/models/action_text/rich_text.rb
@@ -1,3 +1,7 @@
+# The RichText record holds the content produced by the Trix editor in a serialized `body` attribute.
+# It also holds all the references to the embedded files, which are stored using Active Storage.
+# This record is then associated with the Active Record model the application desires to have
+# rich text content using the `has_rich_text` class method.
class ActionText::RichText < ActiveRecord::Base
self.table_name = "action_text_rich_texts"