mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 03:29:20 +03:00
Add "Automatically save draft" option
This commit is contained in:
parent
8da988fef2
commit
45fe0217f2
7 changed files with 40 additions and 6 deletions
|
|
@ -2,10 +2,14 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {delegateRunOnDestroy} from 'Common/Utils';
|
||||
import {delegateRunOnDestroy, boolToAjax} from 'Common/Utils';
|
||||
import {Magics} from 'Common/Enums';
|
||||
import {bIsHttps} from 'Common/Globals';
|
||||
|
||||
import PgpStore from 'Stores/User/Pgp';
|
||||
import SettingsStore from 'Stores/User/Settings';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
|
||||
|
|
@ -20,6 +24,8 @@ class OpenPgpUserSettings
|
|||
|
||||
this.openPgpKeyForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.allowDraftAutosave = SettingsStore.allowDraftAutosave;
|
||||
|
||||
this.isHttps = bIsHttps;
|
||||
}
|
||||
|
||||
|
|
@ -66,6 +72,16 @@ class OpenPgpUserSettings
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
_.delay(() => {
|
||||
|
||||
this.allowDraftAutosave.subscribe(
|
||||
Remote.saveSettingsHelper('AllowDraftAutosave', boolToAjax)
|
||||
);
|
||||
|
||||
}, Magics.Time50ms);
|
||||
}
|
||||
}
|
||||
|
||||
export {OpenPgpUserSettings, OpenPgpUserSettings as default};
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class SettingsUserStore
|
|||
|
||||
this.showImages = ko.observable(false);
|
||||
this.useCheckboxesInList = ko.observable(true);
|
||||
this.allowDraftAutosave = ko.observable(true);
|
||||
this.useThreads = ko.observable(false);
|
||||
this.replySameFolder = ko.observable(false);
|
||||
|
||||
|
|
@ -61,6 +62,7 @@ class SettingsUserStore
|
|||
|
||||
this.showImages(!!Settings.settingsGet('ShowImages'));
|
||||
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
|
||||
this.allowDraftAutosave(!!Settings.settingsGet('AllowDraftAutosave'));
|
||||
this.useThreads(!!Settings.settingsGet('UseThreads'));
|
||||
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
|
||||
|
||||
|
|
|
|||
|
|
@ -314,8 +314,8 @@ class ComposePopupView extends AbstractViewNext
|
|||
this.saveMessageResponse = _.bind(this.saveMessageResponse, this);
|
||||
|
||||
Events.sub('interval.2m', () => {
|
||||
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
|
||||
!this.saving() && !this.sending() && !this.savedError())
|
||||
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && SettingsStore.allowDraftAutosave() &&
|
||||
!this.isEmptyForm(false) && !this.saving() && !this.sending() && !this.savedError())
|
||||
{
|
||||
this.saveCommand();
|
||||
}
|
||||
|
|
@ -519,7 +519,7 @@ class ComposePopupView extends AbstractViewNext
|
|||
this.bSkipNextHide = true;
|
||||
|
||||
if (this.modalVisibility() && !this.saving() && !this.sending() &&
|
||||
!FolderStore.draftFolderNotEnabled())
|
||||
!FolderStore.draftFolderNotEnabled() && SettingsStore.allowDraftAutosave())
|
||||
{
|
||||
this.saveCommand();
|
||||
}
|
||||
|
|
@ -563,8 +563,8 @@ class ComposePopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
autosaveFunction() {
|
||||
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
|
||||
!this.saving() && !this.sending() && !this.savedError())
|
||||
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && SettingsStore.allowDraftAutosave() &&
|
||||
!this.isEmptyForm(false) && !this.saving() && !this.sending() && !this.savedError())
|
||||
{
|
||||
this.saveCommand();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue