mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 00:47:04 +03:00
Revamp isPopupVisible to AbstractViewPopup.hidden
This commit is contained in:
parent
d7ed6ce423
commit
686138ae15
5 changed files with 19 additions and 18 deletions
|
|
@ -4,6 +4,7 @@ import { inFocus, addObservablesTo, addComputablesTo, addSubscribablesTo } from
|
||||||
import { Scope } from 'Common/Enums';
|
import { Scope } from 'Common/Enums';
|
||||||
import { keyScope, Settings, leftPanelDisabled } from 'Common/Globals';
|
import { keyScope, Settings, leftPanelDisabled } from 'Common/Globals';
|
||||||
import { ViewType } from 'Knoin/Knoin';
|
import { ViewType } from 'Knoin/Knoin';
|
||||||
|
//import { showScreenPopup } from 'Knoin/Knoin';
|
||||||
|
|
||||||
class AbstractView {
|
class AbstractView {
|
||||||
constructor(templateID, type)
|
constructor(templateID, type)
|
||||||
|
|
@ -87,6 +88,14 @@ export class AbstractViewPopup extends AbstractView
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
AbstractViewPopup.show = function(params = []) {
|
||||||
|
showScreenPopup(this, params);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
AbstractViewPopup.hidden = function() {
|
||||||
|
return !this.__vm || !this.__vm.modalVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
export class AbstractViewCenter extends AbstractView
|
export class AbstractViewCenter extends AbstractView
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,11 @@ const
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
|
||||||
|
getScreenPopupViewModel = ViewModelClassToShow =>
|
||||||
|
(buildViewModel(ViewModelClassToShow) && ViewModelClassToShow.__dom) && ViewModelClassToShow.__vm;
|
||||||
|
|
||||||
|
|
||||||
export const
|
export const
|
||||||
ViewType = {
|
ViewType = {
|
||||||
|
|
@ -271,9 +275,6 @@ export const
|
||||||
return fResult;
|
return fResult;
|
||||||
},
|
},
|
||||||
|
|
||||||
getScreenPopupViewModel = ViewModelClassToShow =>
|
|
||||||
(buildViewModel(ViewModelClassToShow) && ViewModelClassToShow.__dom) && ViewModelClassToShow.__vm,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function} ViewModelClassToShow
|
* @param {Function} ViewModelClassToShow
|
||||||
* @param {Array=} params
|
* @param {Array=} params
|
||||||
|
|
@ -294,13 +295,6 @@ export const
|
||||||
|
|
||||||
arePopupsVisible = ko.observable(false),
|
arePopupsVisible = ko.observable(false),
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Function} ViewModelClassToShow
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
isPopupVisible = ViewModelClassToShow =>
|
|
||||||
ViewModelClassToShow && ViewModelClassToShow.__vm && ViewModelClassToShow.__vm.modalVisibility(),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array} screensClasses
|
* @param {Array} screensClasses
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@ import { Capa } from 'Common/Enums';
|
||||||
import { Settings } from 'Common/Globals';
|
import { Settings } from 'Common/Globals';
|
||||||
import { delegateRunOnDestroy } from 'Common/UtilsUser';
|
import { delegateRunOnDestroy } from 'Common/UtilsUser';
|
||||||
|
|
||||||
//import { showScreenPopup } from 'Knoin/Knoin';
|
|
||||||
|
|
||||||
//import { EmailModel } from 'Model/Email';
|
//import { EmailModel } from 'Model/Email';
|
||||||
//import { OpenPgpKeyModel } from 'Model/OpenPgpKey';
|
//import { OpenPgpKeyModel } from 'Model/OpenPgpKey';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ import Remote from 'Remote/User/Fetch';
|
||||||
import { ComposeAttachmentModel } from 'Model/ComposeAttachment';
|
import { ComposeAttachmentModel } from 'Model/ComposeAttachment';
|
||||||
import { EmailModel } from 'Model/Email';
|
import { EmailModel } from 'Model/Email';
|
||||||
|
|
||||||
import { decorateKoCommands, isPopupVisible, showScreenPopup } from 'Knoin/Knoin';
|
import { decorateKoCommands, showScreenPopup } from 'Knoin/Knoin';
|
||||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||||
|
|
||||||
import { FolderSystemPopupView } from 'View/Popup/FolderSystem';
|
import { FolderSystemPopupView } from 'View/Popup/FolderSystem';
|
||||||
|
|
@ -549,7 +549,7 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCommand() {
|
deleteCommand() {
|
||||||
if (!isPopupVisible(AskPopupView) && this.modalVisibility()) {
|
if (AskPopupView.hidden() && this.modalVisibility()) {
|
||||||
showScreenPopup(AskPopupView, [
|
showScreenPopup(AskPopupView, [
|
||||||
i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'),
|
i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'),
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -1113,7 +1113,7 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
tryToClosePopup() {
|
tryToClosePopup() {
|
||||||
if (!isPopupVisible(AskPopupView) && this.modalVisibility()) {
|
if (AskPopupView.hidden() && this.modalVisibility()) {
|
||||||
if (this.bSkipNextHide || (this.isEmptyForm() && !this.draftUid())) {
|
if (this.bSkipNextHide || (this.isEmptyForm() && !this.draftUid())) {
|
||||||
this.closeCommand();
|
this.closeCommand();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { arrayLength } from 'Common/Utils';
|
||||||
|
|
||||||
import Remote from 'Remote/Admin/Fetch';
|
import Remote from 'Remote/Admin/Fetch';
|
||||||
|
|
||||||
import { decorateKoCommands, isPopupVisible, showScreenPopup } from 'Knoin/Knoin';
|
import { decorateKoCommands, showScreenPopup } from 'Knoin/Knoin';
|
||||||
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
||||||
import { AskPopupView } from 'View/Popup/Ask';
|
import { AskPopupView } from 'View/Popup/Ask';
|
||||||
|
|
||||||
|
|
@ -89,7 +89,7 @@ class PluginPopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
tryToClosePopup() {
|
tryToClosePopup() {
|
||||||
if (!isPopupVisible(AskPopupView)) {
|
if (AskPopupView.hidden()) {
|
||||||
showScreenPopup(AskPopupView, [
|
showScreenPopup(AskPopupView, [
|
||||||
i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'),
|
i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'),
|
||||||
() => this.modalVisibility() && this.cancelCommand()
|
() => this.modalVisibility() && this.cancelCommand()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue