From bc59d4ca8048e29028ef1b6551157aa2ed273acf Mon Sep 17 00:00:00 2001 From: poliphilochu Date: Sat, 6 Jul 2024 21:15:50 +0800 Subject: [PATCH] refs #40870. Add user preference check for sidePanel in mailingEditor --- packages/mailingEditor/mailingEditor.js | 12 ++++++------ templates/CRM/common/sidePanel.tpl | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/mailingEditor/mailingEditor.js b/packages/mailingEditor/mailingEditor.js index 23e943c9d..0261807fe 100644 --- a/packages/mailingEditor/mailingEditor.js +++ b/packages/mailingEditor/mailingEditor.js @@ -1667,8 +1667,10 @@ _checkPanelOpen(); } }); - // check default open - _checkPanelOpen(); + + if (!window.neticrmSidePanelOptions.userPreference) { + _checkPanelOpen(); + } $("#Upload").off("click").on("click", ".form-submit", function(event) { $(this).closest("form").data("action", $(this).attr("name")); @@ -3054,12 +3056,10 @@ this.initialized = true; }, open: function() { - $(_panels).addClass("is-opened"); - $("body").addClass("nsp-is-opened"); + window.neticrmSidePanelInstance ? window.neticrmSidePanelInstance.open() : $(_panels).addClass("is-opened"); }, close: function() { - $(_panels).removeClass("is-opened"); - $("body").removeClass("nsp-is-opened"); + window.neticrmSidePanelInstance ? window.neticrmSidePanelInstance.close() : $(_panels).removeClass("is-opened"); } } diff --git a/templates/CRM/common/sidePanel.tpl b/templates/CRM/common/sidePanel.tpl index 7312b084d..5bc39be5a 100644 --- a/templates/CRM/common/sidePanel.tpl +++ b/templates/CRM/common/sidePanel.tpl @@ -26,6 +26,7 @@ neticrmSidePanelOpts.fullscreen = "{/literal}{$fullscreen}{literal}"; neticrmSidePanelOpts.userPreference = "{/literal}{$userPreference}{literal}"; neticrmSidePanelOpts.debugMode = "{/literal}{$config->debug}{literal}"; + window.neticrmSidePanelOptions = neticrmSidePanelOpts; window.neticrmSidePanelInstance = $(".nsp-container").neticrmSidePanel(".nsp-container", neticrmSidePanelOpts); }); })(cj);