From 01f7a564b04deef4bbed8508c51cf171cc980bc9 Mon Sep 17 00:00:00 2001 From: Saurabh Gupta <48244990+dadarya0@users.noreply.github.com> Date: Wed, 30 Mar 2022 21:11:03 +0530 Subject: [PATCH 1/2] Merge pull request #1724 from acquia/MAUT-7359 MAUT-7359 : COX auto experiencing formatting issues with sent emails --- app/bundles/CoreBundle/Assets/js/11.editor.js | 3 +++ app/bundles/FormBundle/Form/Type/SubmitActionEmailType.php | 2 +- app/bundles/LeadBundle/Form/Type/EmailType.php | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/bundles/CoreBundle/Assets/js/11.editor.js b/app/bundles/CoreBundle/Assets/js/11.editor.js index 5adf657ffa..8750a30943 100644 --- a/app/bundles/CoreBundle/Assets/js/11.editor.js +++ b/app/bundles/CoreBundle/Assets/js/11.editor.js @@ -284,6 +284,8 @@ Mautic.GetCkEditorConfigOptions = function(ckEditorToolbarOptions, tokenCallbac { color: '#4c4ce6', label: 'Blue' }, { color: '#994ce6', label: 'Purple' } ]; + const allowFullHtmlAttr = textarea.attr('allow-full-html'); + const allowFullHtml = typeof allowFullHtmlAttr !== 'undefined' ? allowFullHtmlAttr : false; const ckEditorOption = { toolbar: { items: ckEditorToolbar, @@ -328,6 +330,7 @@ Mautic.GetCkEditorConfigOptions = function(ckEditorToolbarOptions, tokenCallbac allowedProtocols: [ 'https?', 'tel', 'sms', 'sftp', 'smb', 'slack' ] }, htmlSupport: { + fullPage: allowFullHtml, allow: [ { name: /^(a|span)$/, diff --git a/app/bundles/FormBundle/Form/Type/SubmitActionEmailType.php b/app/bundles/FormBundle/Form/Type/SubmitActionEmailType.php index a0543b6756..69160aab13 100644 --- a/app/bundles/FormBundle/Form/Type/SubmitActionEmailType.php +++ b/app/bundles/FormBundle/Form/Type/SubmitActionEmailType.php @@ -63,7 +63,7 @@ class SubmitActionEmailType extends AbstractType [ 'label' => 'mautic.form.action.sendemail.message', 'label_attr' => ['class' => 'control-label'], - 'attr' => ['class' => 'form-control editor editor-basic'], + 'attr' => ['class' => 'form-control editor editor-basic', 'allow-full-html' => true], 'required' => false, 'data' => $message, ] diff --git a/app/bundles/LeadBundle/Form/Type/EmailType.php b/app/bundles/LeadBundle/Form/Type/EmailType.php index d99f3c5b75..27f2a3aaa6 100644 --- a/app/bundles/LeadBundle/Form/Type/EmailType.php +++ b/app/bundles/LeadBundle/Form/Type/EmailType.php @@ -109,6 +109,7 @@ class EmailType extends AbstractType 'class' => 'form-control editor editor-basic-fullpage editor-builder-tokens editor-email', 'data-token-callback' => 'email:getBuilderTokens', 'data-token-activator' => '{', + 'allow-full-html' => true, ], ] ); From 8faefd639390a1a67c78b7861c3a0b4fd38bb954 Mon Sep 17 00:00:00 2001 From: John Linhart Date: Tue, 4 Nov 2025 13:26:41 +0000 Subject: [PATCH 2/2] Updates for CK editof v5 --- app/bundles/CoreBundle/Assets/js/11.editor.js | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/bundles/CoreBundle/Assets/js/11.editor.js b/app/bundles/CoreBundle/Assets/js/11.editor.js index 8750a30943..4607dbd65e 100644 --- a/app/bundles/CoreBundle/Assets/js/11.editor.js +++ b/app/bundles/CoreBundle/Assets/js/11.editor.js @@ -261,10 +261,10 @@ Mautic.ConvertFieldToCkeditor = function(textarea, ckEditorToolbarOptions) { ckEditors.delete( textarea[0] ) } const tokenCallback = textarea.attr('data-token-callback'); - Mautic.InitCkEditor(textarea, Mautic.GetCkEditorConfigOptions(ckEditorToolbarOptions, tokenCallback)); + Mautic.InitCkEditor(textarea, Mautic.GetCkEditorConfigOptions(ckEditorToolbarOptions, tokenCallback, textarea)); } -Mautic.GetCkEditorConfigOptions = function(ckEditorToolbarOptions, tokenCallback) { +Mautic.GetCkEditorConfigOptions = function(ckEditorToolbarOptions, tokenCallback, textarea = null) { const defaultOptions = ['undo', 'redo', '|', 'bold', 'italic', 'underline', 'heading', 'fontfamily', 'fontsize', 'fontColor', 'fontBackgroundColor', 'alignment', 'numberedList', 'bulletedList', 'blockQuote', 'removeFormat', 'link', 'ckfinder', 'mediaEmbed', 'insertTable', 'sourceEditing']; const ckEditorToolbar = typeof ckEditorToolbarOptions != "undefined" && ckEditorToolbarOptions.length > 0 ? ckEditorToolbarOptions : defaultOptions; const ckEditorColors = [ @@ -284,8 +284,7 @@ Mautic.GetCkEditorConfigOptions = function(ckEditorToolbarOptions, tokenCallbac { color: '#4c4ce6', label: 'Blue' }, { color: '#994ce6', label: 'Purple' } ]; - const allowFullHtmlAttr = textarea.attr('allow-full-html'); - const allowFullHtml = typeof allowFullHtmlAttr !== 'undefined' ? allowFullHtmlAttr : false; + const allowFullHtml = textarea && typeof textarea.attr('allow-full-html') !== 'undefined'; const ckEditorOption = { toolbar: { items: ckEditorToolbar, @@ -330,8 +329,18 @@ Mautic.GetCkEditorConfigOptions = function(ckEditorToolbarOptions, tokenCallbac allowedProtocols: [ 'https?', 'tel', 'sms', 'sftp', 'smb', 'slack' ] }, htmlSupport: { - fullPage: allowFullHtml, - allow: [ + fullPage: { + allowRenderStylesFromHead: allowFullHtml + }, + allow: allowFullHtml ? [ + { + // Allow all HTML elements + name: /.*/, + attributes: true, + classes: true, + styles: true + } + ] : [ { name: /^(a|span)$/, attributes: true,