mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 13:39:22 +03:00
Prevent unloading of browser window when popups (like composer window) are open.
This commit is contained in:
parent
8eaf9dc9c3
commit
f2d172de7d
2 changed files with 7 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import { doc, $htmlCL } from 'Common/Globals';
|
|||
import { arrayLength, isFunction } from 'Common/Utils';
|
||||
|
||||
let currentScreen = null,
|
||||
popupsVisible = 0,
|
||||
defaultScreenName = '';
|
||||
|
||||
const SCREENS = {},
|
||||
|
|
@ -60,6 +61,7 @@ const SCREENS = {},
|
|||
|
||||
vm.modalVisibility.subscribe(value => {
|
||||
if (value) {
|
||||
++popupsVisible;
|
||||
vmDom.style.zIndex = 3000 + popupVisibilityNames().length + 10;
|
||||
vmDom.hidden = false;
|
||||
vm.storeAndSetScope();
|
||||
|
|
@ -69,6 +71,7 @@ const SCREENS = {},
|
|||
vmDom.classList.add('show'); // trigger the transitions
|
||||
});
|
||||
} else {
|
||||
popupsVisible = Math.max(0, popupsVisible-1);
|
||||
vm.onHide && vm.onHide();
|
||||
vmDom.classList.remove('show');
|
||||
vm.restoreScope();
|
||||
|
|
@ -268,6 +271,8 @@ export const
|
|||
}
|
||||
},
|
||||
|
||||
arePopupsVisible = () => 0 < popupsVisible,
|
||||
|
||||
/**
|
||||
* @param {Function} ViewModelClassToShow
|
||||
* @returns {boolean}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue