aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/action_text/content/_layout.html.erb3
-rw-r--r--lib/action_text/content.rb6
2 files changed, 8 insertions, 1 deletions
diff --git a/app/views/action_text/content/_layout.html.erb b/app/views/action_text/content/_layout.html.erb
new file mode 100644
index 0000000000..be3ca295c8
--- /dev/null
+++ b/app/views/action_text/content/_layout.html.erb
@@ -0,0 +1,3 @@
+<div class="trix-content">
+ <%= document %>
+</div>
diff --git a/lib/action_text/content.rb b/lib/action_text/content.rb
index ce40505329..2eff8bb361 100644
--- a/lib/action_text/content.rb
+++ b/lib/action_text/content.rb
@@ -53,8 +53,12 @@ module ActionText
end.to_html
end
+ def to_html_with_layout
+ ActionText.renderer.render(partial: "action_text/content/layout", locals: { document: to_html.html_safe }).html_safe
+ end
+
def to_s
- "<div class='trix-content'>#{to_html}</div>".html_safe
+ to_html_with_layout
end
def as_json(*)