mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-31 19:19:00 +08:00
Bugfix: close popups on browser back/forward hash change
This commit is contained in:
parent
985a4f5077
commit
631b487163
1 changed files with 9 additions and 4 deletions
|
@ -4,7 +4,7 @@ import { doc, $htmlCL } from 'Common/Globals';
|
|||
import { arrayLength, isFunction } from 'Common/Utils';
|
||||
|
||||
let currentScreen = null,
|
||||
popupsVisible = 0,
|
||||
visiblePopups = new Set,
|
||||
defaultScreenName = '';
|
||||
|
||||
const SCREENS = {},
|
||||
|
@ -61,7 +61,7 @@ const SCREENS = {},
|
|||
|
||||
vm.modalVisibility.subscribe(value => {
|
||||
if (value) {
|
||||
++popupsVisible;
|
||||
visiblePopups.add(vm);
|
||||
vmDom.style.zIndex = 3000 + popupVisibilityNames().length + 10;
|
||||
vmDom.hidden = false;
|
||||
vm.storeAndSetScope();
|
||||
|
@ -71,7 +71,7 @@ const SCREENS = {},
|
|||
vmDom.classList.add('show'); // trigger the transitions
|
||||
});
|
||||
} else {
|
||||
popupsVisible = Math.max(0, popupsVisible-1);
|
||||
visiblePopups.delete(vm);
|
||||
vm.onHide && vm.onHide();
|
||||
vmDom.classList.remove('show');
|
||||
vm.restoreScope();
|
||||
|
@ -123,6 +123,11 @@ const SCREENS = {},
|
|||
screenName = defaultScreenName;
|
||||
}
|
||||
|
||||
// Close all popups
|
||||
for (let vm of visiblePopups) {
|
||||
vm.closeCommand();
|
||||
}
|
||||
|
||||
if (screenName) {
|
||||
vmScreen = screen(screenName);
|
||||
if (!vmScreen) {
|
||||
|
@ -271,7 +276,7 @@ export const
|
|||
}
|
||||
},
|
||||
|
||||
arePopupsVisible = () => 0 < popupsVisible,
|
||||
arePopupsVisible = () => 0 < visiblePopups.size,
|
||||
|
||||
/**
|
||||
* @param {Function} ViewModelClassToShow
|
||||
|
|
Loading…
Reference in a new issue