mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
modalVisibility() to modalVisible()
This commit is contained in:
parent
86374433b9
commit
36feca6ce7
3 changed files with 30 additions and 36 deletions
|
|
@ -58,9 +58,9 @@ export class AbstractViewPopup extends AbstractView
|
||||||
{
|
{
|
||||||
super('Popups' + name, ViewType.Popup);
|
super('Popups' + name, ViewType.Popup);
|
||||||
this.keyScope.scope = name;
|
this.keyScope.scope = name;
|
||||||
this.modalVisibility = ko.observable(false).extend({ rateLimit: 0 });
|
this.modalVisible = ko.observable(false).extend({ rateLimit: 0 });
|
||||||
shortcuts.add('escape,close', '', name, () => {
|
shortcuts.add('escape,close', '', name, () => {
|
||||||
if (this.modalVisibility() && this.onClose()) {
|
if (this.modalVisible() && this.onClose()) {
|
||||||
this.closeCommand();
|
this.closeCommand();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +90,7 @@ AbstractViewPopup.showModal = function(params = []) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractViewPopup.hidden = function() {
|
AbstractViewPopup.hidden = function() {
|
||||||
return !this.__vm || !this.__vm.modalVisibility();
|
return !this.__vm || !this.__vm.modalVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AbstractViewCenter extends AbstractView
|
export class AbstractViewCenter extends AbstractView
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ const
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.modalVisibility.subscribe(value => {
|
vm.modalVisible.subscribe(value => {
|
||||||
if (value) {
|
if (value) {
|
||||||
visiblePopups.add(vm);
|
visiblePopups.add(vm);
|
||||||
vmDom.style.zIndex = 3000 + (visiblePopups.size * 2);
|
vmDom.style.zIndex = 3000 + (visiblePopups.size * 2);
|
||||||
|
|
@ -154,7 +154,7 @@ const
|
||||||
*/
|
*/
|
||||||
hideScreenPopup = ViewModelClassToHide => {
|
hideScreenPopup = ViewModelClassToHide => {
|
||||||
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom) {
|
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom) {
|
||||||
ViewModelClassToHide.__vm.modalVisibility(false);
|
ViewModelClassToHide.__vm.modalVisible(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -266,7 +266,7 @@ export const
|
||||||
|
|
||||||
vm.onBeforeShow && vm.onBeforeShow(...params);
|
vm.onBeforeShow && vm.onBeforeShow(...params);
|
||||||
|
|
||||||
vm.modalVisibility(true);
|
vm.modalVisible(true);
|
||||||
|
|
||||||
vm.onShow && vm.onShow(...params);
|
vm.onShow && vm.onShow(...params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -534,7 +534,6 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
Remote.request('SendMessage',
|
Remote.request('SendMessage',
|
||||||
(iError, data) => {
|
(iError, data) => {
|
||||||
this.sending(false);
|
this.sending(false);
|
||||||
if (this.modalVisibility()) {
|
|
||||||
if (iError) {
|
if (iError) {
|
||||||
if (Notification.CantSaveMessage === iError) {
|
if (Notification.CantSaveMessage === iError) {
|
||||||
this.sendSuccessButSaveError(true);
|
this.sendSuccessButSaveError(true);
|
||||||
|
|
@ -547,7 +546,6 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
} else {
|
} else {
|
||||||
this.closeCommand();
|
this.closeCommand();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setFolderHash(this.draftsFolder(), '');
|
setFolderHash(this.draftsFolder(), '');
|
||||||
setFolderHash(sSentFolder, '');
|
setFolderHash(sSentFolder, '');
|
||||||
this.reloadDraftFolder();
|
this.reloadDraftFolder();
|
||||||
|
|
@ -626,11 +624,10 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCommand() {
|
deleteCommand() {
|
||||||
if (AskPopupView.hidden() && this.modalVisibility()) {
|
AskPopupView.hidden()
|
||||||
showScreenPopup(AskPopupView, [
|
&& showScreenPopup(AskPopupView, [
|
||||||
i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'),
|
i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'),
|
||||||
() => {
|
() => {
|
||||||
if (this.modalVisibility()) {
|
|
||||||
const
|
const
|
||||||
sFromFolderFullName = this.draftsFolder(),
|
sFromFolderFullName = this.draftsFolder(),
|
||||||
aUidForRemove = [this.draftUid()];
|
aUidForRemove = [this.draftUid()];
|
||||||
|
|
@ -638,10 +635,8 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
MessagelistUserStore.removeMessagesFromList(sFromFolderFullName, aUidForRemove);
|
MessagelistUserStore.removeMessagesFromList(sFromFolderFullName, aUidForRemove);
|
||||||
this.closeCommand();
|
this.closeCommand();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
onClose() {
|
onClose() {
|
||||||
this.skipCommand();
|
this.skipCommand();
|
||||||
|
|
@ -652,7 +647,6 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
this.bSkipNextHide = true;
|
this.bSkipNextHide = true;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.modalVisibility() &&
|
|
||||||
!this.saving() &&
|
!this.saving() &&
|
||||||
!this.sending() &&
|
!this.sending() &&
|
||||||
!FolderUserStore.draftsFolderNotEnabled() &&
|
!FolderUserStore.draftsFolderNotEnabled() &&
|
||||||
|
|
@ -676,7 +670,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
autosaveStart() {
|
autosaveStart() {
|
||||||
clearTimeout(this.iTimer);
|
clearTimeout(this.iTimer);
|
||||||
this.iTimer = setTimeout(()=>{
|
this.iTimer = setTimeout(()=>{
|
||||||
if (this.modalVisibility()
|
if (this.modalVisible()
|
||||||
&& !FolderUserStore.draftsFolderNotEnabled()
|
&& !FolderUserStore.draftsFolderNotEnabled()
|
||||||
&& SettingsUserStore.allowDraftAutosave()
|
&& SettingsUserStore.allowDraftAutosave()
|
||||||
&& !this.isEmptyForm(false)
|
&& !this.isEmptyForm(false)
|
||||||
|
|
@ -1191,7 +1185,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
tryToClosePopup() {
|
tryToClosePopup() {
|
||||||
if (AskPopupView.hidden() && this.modalVisibility()) {
|
if (AskPopupView.hidden()) {
|
||||||
if (this.bSkipNextHide || (this.isEmptyForm() && !this.draftUid())) {
|
if (this.bSkipNextHide || (this.isEmptyForm() && !this.draftUid())) {
|
||||||
this.closeCommand();
|
this.closeCommand();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1371,7 +1365,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
const el = doc.getElementById('rl-app');
|
const el = doc.getElementById('rl-app');
|
||||||
this.oContent = initFullscreen(el, () =>
|
this.oContent = initFullscreen(el, () =>
|
||||||
ThemeStore.isMobile()
|
ThemeStore.isMobile()
|
||||||
&& this.modalVisibility()
|
&& this.modalVisible()
|
||||||
&& (getFullscreenElement() !== el)
|
&& (getFullscreenElement() !== el)
|
||||||
&& this.skipCommand()
|
&& this.skipCommand()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue