From 9d0e2fa64a798d8720ec28d325a123b91baae54f Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 4 Aug 2021 09:58:49 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03807=20Bring=20back=20styling=20to=20raw?= =?UTF-8?q?=20HTML=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bulma minireset (https://github.com/jgthms/bulma/blob/master/sass/base/minireset.sass) was applied everywhere in iTop. This was causing HTML content without any Bulma or iTop 3.0.* CSS classes to render with no styles anymore, not even the default browser's ones. Especially rendering for content styled in CK Editor was problematic... This commit creates a new `ibo-is-html-content` CSS class (in css/backoffice/utils/helpers/_misc.scss) that just extends the `content` Bulma class (indirection to reduce framework coupling). This new iTop CSS class is added in : * AttributeText and its children when format is HTML * HTML components * activity entries in HTML format The class can also be used elsewhere when needed, for example in modules having custom pages that aren't using yet the iTop 3.0.* UI components or CSS classes. --- core/attributedef.class.inc.php | 2 +- css/backoffice/utils/helpers/_misc.scss | 8 ++++++++ templates/base/components/html/layout.html.twig | 2 +- .../activity-panel/activity-entry/caselog-entry.html.twig | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 9095be0ac..2b82b99e9 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -4165,7 +4165,7 @@ class AttributeText extends AttributeString { $sValue = self::RenderWikiHtml($sValue, true /* wiki only */); - return "
".InlineImage::FixUrls($sValue).'
'; + return "
".InlineImage::FixUrls($sValue).'
'; } } diff --git a/css/backoffice/utils/helpers/_misc.scss b/css/backoffice/utils/helpers/_misc.scss index 25b46bffe..531c3e11b 100644 --- a/css/backoffice/utils/helpers/_misc.scss +++ b/css/backoffice/utils/helpers/_misc.scss @@ -142,6 +142,14 @@ body.ibo-has-fullscreen-descendant { @extend %ibo-font-code-150; } +/* + * A single class to handle WYSIWYG generated content, where only HTML tags are available + * See https://bulma.io/documentation/elements/content/ + */ +.ibo-is-html-content { + @extend .content; +} + /***********************************************************************/ /* Sticky headers */ /* */ diff --git a/templates/base/components/html/layout.html.twig b/templates/base/components/html/layout.html.twig index ef12b8056..a5b8f3a48 100644 --- a/templates/base/components/html/layout.html.twig +++ b/templates/base/components/html/layout.html.twig @@ -1 +1 @@ -{{ oUIBlock.GetHtml()|raw }} \ No newline at end of file +
{{ oUIBlock.GetHtml()|raw }}
\ No newline at end of file diff --git a/templates/base/layouts/activity-panel/activity-entry/caselog-entry.html.twig b/templates/base/layouts/activity-panel/activity-entry/caselog-entry.html.twig index bde9fd3e1..fb80f0aad 100644 --- a/templates/base/layouts/activity-panel/activity-entry/caselog-entry.html.twig +++ b/templates/base/layouts/activity-panel/activity-entry/caselog-entry.html.twig @@ -1,4 +1,4 @@ {% extends 'base/layouts/activity-panel/activity-entry/layout.html.twig' %} -{% block iboActivityEntryExtraClasses %}ibo-caselog-entry ibo-caselog-entry--entry-for-caselog-{{ oUIBlock.GetCaseLogRank() }}{% endblock %} +{% block iboActivityEntryExtraClasses %}ibo-caselog-entry ibo-caselog-entry--entry-for-caselog-{{ oUIBlock.GetCaseLogRank() }} ibo-is-html-content{% endblock %} {% block iboActivityEntryExtraDataAttributes %}data-entry-caselog-attribute-code="{{ oUIBlock.GetAttCode() }}"{% endblock %} \ No newline at end of file