N°7552 - CKEditor: Include CKE styles in the backoffice theme and emails style

This commit is contained in:
Molkobain
2024-07-23 11:52:39 +02:00
parent 377e06d99a
commit 086d2f0ba4
8 changed files with 57 additions and 17 deletions

View File

@@ -628,7 +628,7 @@ class ActionEmail extends ActionNotification
*/
protected function _DoExecute($oTrigger, $aContextArgs, &$oLog)
{
$sStyles = file_get_contents(APPROOT.'css/email.css');
$sStyles = file_get_contents(APPROOT . utils::GetCSSFromSASS("css/email.scss"));
$sStyles .= MetaModel::GetConfig()->Get('email_css');
$oEmail = new EMail();
@@ -867,7 +867,13 @@ class ActionEmail extends ActionNotification
*/
protected function BuildMessageBody(bool $bHighlightPlaceholders = false): string
{
$sBody = $this->Get('body');
// Wrap content with a specific class in order to apply styles of HTML fields through the emogrifier (see `css/email.scss`)
$sBody = <<<HTML
<div class="email-is-html-content">
{$this->Get('body')}
</div>
HTML;
/** @var ormDocument $oHtmlTemplate */
$oHtmlTemplate = $this->Get('html_template');
if ($oHtmlTemplate && !$oHtmlTemplate->IsEmpty()) {

View File

@@ -103,7 +103,8 @@ $ibo-figure--spacing-y: 2em !default;
* See https://bulma.io/documentation/elements/content/
*/
.ibo-is-html-content {
@extend .content;
@extend .content; /* Bulma styles */
@extend .ck-content; /* CKEditor styles */
/* For table to render like in CKEditor, works with bulma lib. overload see:
* - ../../vendors/_bulma-variables-overload.scss)

View File

@@ -8,7 +8,7 @@
@import "../../../node_modules/bulma-scss/utilities/all";
@import "../../../node_modules/bulma-scss/base/all";
@import "../../../node_modules/bulma-scss/elements/content";
@import "ckeditor";
@import "ckeditor/all";
@import "c3";
@import "tippy";
@import "jqueryui";

View File

@@ -0,0 +1,7 @@
/*!
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
@import "../../../../js/ckeditor/build/compiled-theme"; /* CKEditor content styles (tables, lists, ...) */
@import "overloads"; /* Overloads of CKEditor styles for the backoffice */

File diff suppressed because one or more lines are too long

18
css/email.scss Normal file
View File

@@ -0,0 +1,18 @@
/* Note: only CSS1 is supported here (see the limitations of emogrifier: https://github.com/jjriv/emogrifier/) */
.caselog_header {
padding: 3px;
border-top: 1px solid #fff;
background-color: #ddd;
padding-left: 16px;
width: 100%;
}
.caselog_header_date {
}
.caselog_header_user {
}
/* N°7611 - Ensure to embed HTML fields styles */
@import "../js/ckeditor/build/compiled-theme";
.email-is-html-content {
@extend .ck-content;
}

File diff suppressed because one or more lines are too long