Skip to content

Commit

Permalink
Fix #9737 - Fix issue with campaigns displaying a blank email template
Browse files Browse the repository at this point in the history
Use TinyMCE init function to set template body rather than triggering on page load
  • Loading branch information
JackBuchanan authored and jack7anderson7 committed Oct 15, 2024
1 parent a36dbfc commit 8e94309
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
32 changes: 28 additions & 4 deletions include/SuiteEditor/SuiteEditorConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,50 @@ class SuiteEditorConnector
{
public static function getSuiteSettings($html, $width)
{
return array(
$settings = [
'contents' => $html,
'textareaId' => 'body_text',
'elementId' => 'email_template_editor',
'width' => $width,
'clickHandler' => "function(e){
onClickTemplateBody();
}",
'tinyMCESetup' => "{
];

if($_REQUEST["module"] == "Campaigns"){
//use loadtemplate() to populate template body on TinyMCE initialisation rather than page load for campaigns
$settings['tinyMCESetup'] = "{
setup: function(editor) {
editor.on('focus', function(e){
onClickTemplateBody();
});
editor.on('init', function(e){
loadtemplate();
});
},
height : '480',
plugins: ['code', 'table', 'link', 'image'],
toolbar: ['fontselect | fontsizeselect | bold italic underline | forecolor backcolor | styleselect | outdent indent | link image'],
convert_urls: false,
}"
);
}";
}else{
//default TinyMCESetup settings
$settings['tinyMCESetup'] = "{
setup: function(editor) {
editor.on('focus', function(e){
onClickTemplateBody();
});
},
height : '480',
plugins: ['code', 'table', 'link', 'image'],
toolbar: ['fontselect | fontsizeselect | bold italic underline | forecolor backcolor | styleselect | outdent indent | link image'],
convert_urls: false,
}";
}



return $settings;
}

/**
Expand Down
16 changes: 8 additions & 8 deletions modules/Campaigns/WizardMarketing.html
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,11 @@ <h4 class="header-4" style="border-bottom: solid 1px #eee;">{$MOD.LBL_TEMPLATE}<
</div>
<script>
{literal}
$(function(){
if(document.getElementById('template_id').value) {
onEmailTemplateChange(document.getElementById('template_id'), '{$MOD.LBL_COPY_OF}');
}
});
function loadtemplate() {
if (document.getElementById('template_id').value) {
onEmailTemplateChange(document.getElementById('template_id'), '{$MOD.LBL_COPY_OF}');
}
}
{/literal}
</script>
</div>
Expand Down Expand Up @@ -1131,7 +1131,7 @@ <h4 class="header-4">{$MOD.LBL_MRKT_NAME}</h4>
if(oe_stored_options[mailbox.value]) {
var focusOe = oe_stored_options[mailbox.value];
// from name

if(!fn.value) {
var fromName = focusOe.smtp_from_name ? focusOe.smtp_from_name : (
focusOe.from_name ? focusOe.from_name : (
Expand Down Expand Up @@ -1418,7 +1418,7 @@ <h4 class="header-4" style="border-bottom: solid 1px #eee;padding-bottom: 8px">{
<!-- BEGIN: NoInbound2 -->
<tr>
<td valign="top" scope="row">
{$MOD.LBL_ATTACHMENTS}:
{$MOD.LBL_ATTACHMENTS}:
</td>
<td colspan="2" nowrap id="attachments_container">
{$ATTACHMENTS}
Expand All @@ -1441,7 +1441,7 @@ <h4 class="header-4" style="border-bottom: solid 1px #eee;padding-bottom: 8px">{
<input type="hidden" id="documentId" name="seldoc" tabindex="0" />
<input type="hidden" id="docRevId" name="seldoc" tabindex="0" />
<input type="hidden" id="documentType" name="seldoc" tabindex="0" />


<input type="hidden" name="attach_to_template_id" id="attach_to_template_id" value="{$TEMPLATE_ID}">
<input type="hidden" name="campaign_id" value="{$CAMPAIGN_ID}">
Expand Down

0 comments on commit 8e94309

Please sign in to comment.