Especially for editable content
This commit is contained in:
@@ -9,4 +9,5 @@
|
|||||||
@import "components/forms";
|
@import "components/forms";
|
||||||
@import "components/notifications";
|
@import "components/notifications";
|
||||||
@import "components/pagination";
|
@import "components/pagination";
|
||||||
|
@import "components/rich_text";
|
||||||
@import "components/tables";
|
@import "components/tables";
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
@layer base {
|
||||||
|
main {
|
||||||
|
.rich-text {
|
||||||
|
ul {
|
||||||
|
@apply list-disc list-inside;
|
||||||
|
|
||||||
|
li {
|
||||||
|
@apply my-2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ol {
|
||||||
|
@apply list-decimal list-inside;
|
||||||
|
|
||||||
|
li {
|
||||||
|
@apply my-2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
li > ul,
|
||||||
|
li > ol {
|
||||||
|
@apply ps-6 my-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
@apply my-8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<% if @editable_content.has_content? %>
|
<% if @editable_content.has_content? %>
|
||||||
<% if @editable_content.rich_text %>
|
<% if @editable_content.rich_text %>
|
||||||
|
<div class="rich-text">
|
||||||
<%= helpers.markdown_to_html @editable_content.content %>
|
<%= helpers.markdown_to_html @editable_content.content %>
|
||||||
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= @editable_content.content %>
|
<%= @editable_content.content %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def markdown_to_html(string)
|
def markdown_to_html(string)
|
||||||
raw Kramdown::Document.new(string, { input: "GFM" }).to_html
|
raw Kramdown::Document.new(string, {
|
||||||
|
input: "GFM"
|
||||||
|
}).to_html
|
||||||
end
|
end
|
||||||
|
|
||||||
def image_url_for(attachment)
|
def image_url_for(attachment)
|
||||||
|
|||||||
Reference in New Issue
Block a user