Skip to content

Commit

Permalink
Merge pull request #409 from larssandergreen/2.x
Browse files Browse the repository at this point in the history
Fix Leave site? warning when not required
  • Loading branch information
mattwire authored Dec 2, 2020
2 parents 91cddfe + b0afd1d commit 37b7c3c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions templates/CRM/Mosaico/Page/EditorIframe.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@

var plugins = [];
var config = {/literal}{$mosaicoConfig}{literal};

window.onbeforeunload = function(e) {
e.preventDefault();
e.returnValue = "{/literal}{ts}Exit email composer without saving?{/ts}{literal}";
};

window.addEventListener('beforeunload', function(e) {
if(window.parent.document.getElementById('crm-mosaico').style.display !== "none") {
e.preventDefault();
e.returnValue = "{/literal}{ts}Exit email composer without saving?{/ts}{literal}";
}
});

if (window.top.crmMosaicoIframe) {
window.top.crmMosaicoIframe(window, Mosaico, config, plugins);
Expand Down

0 comments on commit 37b7c3c

Please sign in to comment.