From f9bc00e5cddf7a26187ce4a8055290017836a42a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Thu, 29 Jun 2023 09:19:54 +0200 Subject: [PATCH] We used to use `

` to seperate block between them. now use `

` trix doesn't allow the use of `

` as block separator since it can not contain `

`: use `
` and _emulate_ as `

` with margin bottom --- app/services/trix_scrubber.rb | 2 +- app/webpacker/css/admin/trix.scss | 4 ++++ app/webpacker/css/darkswarm/_shop-modals.scss | 4 ++++ app/webpacker/css/darkswarm/_shop-product-rows.scss | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/services/trix_scrubber.rb b/app/services/trix_scrubber.rb index b8328ffc1c..a8aed288c0 100644 --- a/app/services/trix_scrubber.rb +++ b/app/services/trix_scrubber.rb @@ -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 diff --git a/app/webpacker/css/admin/trix.scss b/app/webpacker/css/admin/trix.scss index e582277143..39caa36dae 100644 --- a/app/webpacker/css/admin/trix.scss +++ b/app/webpacker/css/admin/trix.scss @@ -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; diff --git a/app/webpacker/css/darkswarm/_shop-modals.scss b/app/webpacker/css/darkswarm/_shop-modals.scss index bb6b6480dc..812dfa60ff 100644 --- a/app/webpacker/css/darkswarm/_shop-modals.scss +++ b/app/webpacker/css/darkswarm/_shop-modals.scss @@ -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 { diff --git a/app/webpacker/css/darkswarm/_shop-product-rows.scss b/app/webpacker/css/darkswarm/_shop-product-rows.scss index 401db4f8a0..39051651d1 100644 --- a/app/webpacker/css/darkswarm/_shop-product-rows.scss +++ b/app/webpacker/css/darkswarm/_shop-product-rows.scss @@ -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 {