We used to use <p> to seperate block between them. now use <div>

trix doesn't allow the use of `<p>` as block separator since it can not contain `<figure>`: use `<div>` and _emulate_ as `<p>` with margin bottom
This commit is contained in:
Jean-Baptiste Bellet
2023-06-29 09:19:54 +02:00
parent b6e047086a
commit f9bc00e5cd
4 changed files with 13 additions and 1 deletions

View File

@@ -2,7 +2,7 @@
class TrixScrubber < Rails::Html::PermitScrubber
ALLOWED_TAGS = ["p", "b", "strong", "em", "i", "a", "u", "br", "del", "h1", "blockquote", "pre",
"ul", "ol", "li"].freeze
"ul", "ol", "li", "div"].freeze
ALLOWED_ATTRIBUTES = ["href", "target", "src", "alt"].freeze
def initialize

View File

@@ -15,6 +15,10 @@ trix-editor {
color: #9fc820; // Equivalent to text-angular a
}
div {
margin-bottom: 1.5rem; // Equivalent to text-angular p (trix doesn't use p as default one, since we could not include figures inside p)
}
// Copy/pasted from _type.scss
blockquote {
line-height: 1.6;

View File

@@ -11,6 +11,10 @@
.product-description {
margin: 1rem 0.25rem 0.25rem 0;
.text-small div {
margin-bottom: 1.5rem; // Equivalent to p (trix doesn't use p as separator by default, so emulate div as p to be backward compatible)
}
}
.property-selectors li {

View File

@@ -158,6 +158,10 @@
// line-clamp is not supported in Safari
line-height: 1rem;
height: 1.75rem;
> div {
margin-bottom: 1.5rem; // Equivalent to p (trix doesn't use p as separator by default, so emulate div as p to be backward compatible)
}
}
.product-properties {