diff --git a/dev/Knoin/Knoin.js b/dev/Knoin/Knoin.js index a4cd56a40..80168fb06 100644 --- a/dev/Knoin/Knoin.js +++ b/dev/Knoin/Knoin.js @@ -4,8 +4,7 @@ import { doc, $htmlCL } from 'Common/Globals'; import { isNonEmptyArray } from 'Common/Utils'; let currentScreen = null, - defaultScreenName = '', - popupVisibilityNames = []; + defaultScreenName = ''; const SCREENS = {}, autofocus = dom => { @@ -13,7 +12,7 @@ const SCREENS = {}, af && af.focus(); }; -export const popupVisibility = ko.computed(() => 0 < popupVisibilityNames.length); +export const popupVisibilityNames = ko.observableArray([]); export const ViewType = { Popup: 'Popups', @@ -109,7 +108,7 @@ function buildViewModel(ViewModelClass, vmScreen) { vm.modalVisibility.subscribe(value => { if (value) { - vmDom.style.zIndex = 3000 + popupVisibilityNames.length + 10; + vmDom.style.zIndex = 3000 + popupVisibilityNames().length + 10; vmDom.hidden = false; vm.storeAndSetScope(); popupVisibilityNames.push(vm.viewModelName); @@ -121,7 +120,7 @@ function buildViewModel(ViewModelClass, vmScreen) { vm.onHide && vm.onHide(); vmDom.classList.remove('show'); vm.restoreScope(); - popupVisibilityNames = popupVisibilityNames.filter(v=>v!==vm.viewModelName); + popupVisibilityNames(popupVisibilityNames.filter(v=>v!==vm.viewModelName)); } vmDom.setAttribute('aria-hidden', !value); }); diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index df688cee5..87acdc9b9 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -39,7 +39,7 @@ import { ThemeStore } from 'Stores/Theme'; import Remote from 'Remote/User/Fetch'; -import { decorateKoCommands, showScreenPopup, popupVisibility } from 'Knoin/Knoin'; +import { decorateKoCommands, showScreenPopup, popupVisibilityNames } from 'Knoin/Knoin'; import { AbstractViewRight } from 'Knoin/AbstractViews'; import { FolderClearPopupView } from 'View/Popup/FolderClear'; @@ -67,7 +67,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight { this.allowMessageListActions = Settings.capa(Capa.MessageListActions); this.allowDangerousActions = Settings.capa(Capa.DangerousActions); - this.popupVisibility = popupVisibility; + this.popupVisibility = ko.computed(() => 0 < popupVisibilityNames().length); this.message = MessageUserStore.message; this.messageList = MessageUserStore.list;