aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_text
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2018-06-05 16:37:50 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2018-06-05 16:37:50 +0200
commit9e5ab1ebd9a80a78f9daaf38a9ee244e60b8af1c (patch)
tree51b48e539bd7894d422b607de596d7458fac263b /lib/action_text
parent21aa1d4b55686eda40eb8315822d32de157964ba (diff)
downloadrails-9e5ab1ebd9a80a78f9daaf38a9ee244e60b8af1c.tar.gz
rails-9e5ab1ebd9a80a78f9daaf38a9ee244e60b8af1c.tar.bz2
rails-9e5ab1ebd9a80a78f9daaf38a9ee244e60b8af1c.zip
By default, coercing to a string should produce a formatted output
Open to other ways of doing this, but didn’t want to require embedding the trix-content class inside the actual HTML that Trix persists. So this seemed like a reasonable alternative. Thoughts @javan or @sstephenson?
Diffstat (limited to 'lib/action_text')
-rw-r--r--lib/action_text/content.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/action_text/content.rb b/lib/action_text/content.rb
index c63e0c3525..ce40505329 100644
--- a/lib/action_text/content.rb
+++ b/lib/action_text/content.rb
@@ -54,7 +54,7 @@ module ActionText
end
def to_s
- to_html.html_safe
+ "<div class='trix-content'>#{to_html}</div>".html_safe
end
def as_json(*)