mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 21:19:21 +03:00
Convert user stores to single object instances
Removed unused ContactUserStore.exportingCsv and ContactUserStore.exportingVcf
This commit is contained in:
parent
914c6e8d14
commit
6a454ec624
46 changed files with 671 additions and 710 deletions
|
|
@ -1,36 +1,31 @@
|
|||
import ko from 'ko';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
|
||||
class AccountUserStore {
|
||||
constructor() {
|
||||
ko.addObservablesTo(this, {
|
||||
email: '',
|
||||
parentEmail: '',
|
||||
signature: ''
|
||||
});
|
||||
export const AccountUserStore = {
|
||||
accounts: ko.observableArray(),
|
||||
loading: ko.observable(false).extend({ debounce: 100 }),
|
||||
|
||||
this.accounts = ko.observableArray();
|
||||
this.accounts.loading = ko.observable(false).extend({ debounce: 100 });
|
||||
getEmailAddresses: () => AccountUserStore.accounts.map(item => item ? item.email : null).filter(v => v),
|
||||
|
||||
this.getEmailAddresses = () => this.accounts.map(item => item ? item.email : null).filter(v => v);
|
||||
accountsUnreadCount: ko.computed(() => 0),
|
||||
// accountsUnreadCount: ko.computed(() => {
|
||||
// let result = 0;
|
||||
// AccountUserStore.accounts().forEach(item => {
|
||||
// if (item) {
|
||||
// result += item.count();
|
||||
// }
|
||||
// });
|
||||
// return result;
|
||||
// }),
|
||||
|
||||
this.accountsUnreadCount = ko.computed(() => 0);
|
||||
// this.accountsUnreadCount = ko.computed(() => {
|
||||
// let result = 0;
|
||||
// this.accounts().forEach(item => {
|
||||
// if (item)
|
||||
// {
|
||||
// result += item.count();
|
||||
// }
|
||||
// });
|
||||
// return result;
|
||||
// });
|
||||
populate: () => {
|
||||
AccountUserStore.email(SettingsGet('Email'));
|
||||
AccountUserStore.parentEmail(SettingsGet('ParentEmail'));
|
||||
}
|
||||
};
|
||||
|
||||
populate() {
|
||||
this.email(SettingsGet('Email'));
|
||||
this.parentEmail(SettingsGet('ParentEmail'));
|
||||
}
|
||||
}
|
||||
|
||||
export default new AccountUserStore();
|
||||
ko.addObservablesTo(AccountUserStore, {
|
||||
email: '',
|
||||
parentEmail: '',
|
||||
signature: ''
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,63 +4,59 @@ import { Focused } from 'Common/EnumsUser';
|
|||
import { keyScope, leftPanelDisabled, Settings, SettingsGet } from 'Common/Globals';
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
class AppUserStore {
|
||||
constructor() {
|
||||
ko.addObservablesTo(this, {
|
||||
currentAudio: '',
|
||||
export const AppUserStore = {
|
||||
attachmentsActions: ko.observableArray(),
|
||||
|
||||
focusedState: Focused.None,
|
||||
devEmail: '',
|
||||
devPassword: '',
|
||||
|
||||
projectHash: '',
|
||||
threadsAllowed: false,
|
||||
populate: () => {
|
||||
AppUserStore.projectHash(SettingsGet('ProjectHash'));
|
||||
|
||||
composeInEdit: false,
|
||||
AppUserStore.contactsAutosave(!!SettingsGet('ContactsAutosave'));
|
||||
AppUserStore.useLocalProxyForExternalImages(!!SettingsGet('UseLocalProxyForExternalImages'));
|
||||
|
||||
contactsAutosave: false,
|
||||
useLocalProxyForExternalImages: false,
|
||||
|
||||
contactsIsAllowed: false
|
||||
});
|
||||
|
||||
this.focusedState.subscribe(value => {
|
||||
switch (value) {
|
||||
case Focused.MessageList:
|
||||
keyScope(KeyState.MessageList);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(true);
|
||||
break;
|
||||
case Focused.MessageView:
|
||||
keyScope(KeyState.MessageView);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(true);
|
||||
break;
|
||||
case Focused.FolderList:
|
||||
keyScope(KeyState.FolderList);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
this.attachmentsActions = ko.observableArray();
|
||||
|
||||
this.devEmail = '';
|
||||
this.devPassword = '';
|
||||
}
|
||||
|
||||
populate() {
|
||||
this.projectHash(SettingsGet('ProjectHash'));
|
||||
|
||||
this.contactsAutosave(!!SettingsGet('ContactsAutosave'));
|
||||
this.useLocalProxyForExternalImages(!!SettingsGet('UseLocalProxyForExternalImages'));
|
||||
|
||||
this.contactsIsAllowed(!!SettingsGet('ContactsIsAllowed'));
|
||||
AppUserStore.contactsIsAllowed(!!SettingsGet('ContactsIsAllowed'));
|
||||
|
||||
const attachmentsActions = Settings.app('attachmentsActions');
|
||||
this.attachmentsActions(Array.isNotEmpty(attachmentsActions) ? attachmentsActions : []);
|
||||
AppUserStore.attachmentsActions(Array.isNotEmpty(attachmentsActions) ? attachmentsActions : []);
|
||||
|
||||
this.devEmail = SettingsGet('DevEmail');
|
||||
this.devPassword = SettingsGet('DevPassword');
|
||||
AppUserStore.devEmail = SettingsGet('DevEmail');
|
||||
AppUserStore.devPassword = SettingsGet('DevPassword');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default new AppUserStore();
|
||||
ko.addObservablesTo(AppUserStore, {
|
||||
currentAudio: '',
|
||||
|
||||
focusedState: Focused.None,
|
||||
|
||||
projectHash: '',
|
||||
threadsAllowed: false,
|
||||
|
||||
composeInEdit: false,
|
||||
|
||||
contactsAutosave: false,
|
||||
useLocalProxyForExternalImages: false,
|
||||
|
||||
contactsIsAllowed: false
|
||||
});
|
||||
|
||||
AppUserStore.focusedState.subscribe(value => {
|
||||
switch (value) {
|
||||
case Focused.MessageList:
|
||||
keyScope(KeyState.MessageList);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(true);
|
||||
break;
|
||||
case Focused.MessageView:
|
||||
keyScope(KeyState.MessageView);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(true);
|
||||
break;
|
||||
case Focused.FolderList:
|
||||
keyScope(KeyState.FolderList);
|
||||
ThemeStore.isMobile() && leftPanelDisabled(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,32 +1,25 @@
|
|||
import ko from 'ko';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
|
||||
class ContactUserStore {
|
||||
constructor() {
|
||||
this.contacts = ko.observableArray();
|
||||
this.contacts.loading = ko.observable(false).extend({ debounce: 200 });
|
||||
this.contacts.importing = ko.observable(false).extend({ debounce: 200 });
|
||||
this.contacts.syncing = ko.observable(false).extend({ debounce: 200 });
|
||||
this.contacts.exportingVcf = ko.observable(false).extend({ debounce: 200 });
|
||||
this.contacts.exportingCsv = ko.observable(false).extend({ debounce: 200 });
|
||||
export const ContactUserStore = ko.observableArray();
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
allowContactsSync: false,
|
||||
enableContactsSync: false,
|
||||
contactsSyncUrl: '',
|
||||
contactsSyncUser: '',
|
||||
contactsSyncPass: ''
|
||||
});
|
||||
}
|
||||
ContactUserStore.loading = ko.observable(false).extend({ debounce: 200 });
|
||||
ContactUserStore.importing = ko.observable(false).extend({ debounce: 200 });
|
||||
ContactUserStore.syncing = ko.observable(false).extend({ debounce: 200 });
|
||||
|
||||
populate() {
|
||||
this.allowContactsSync(!!SettingsGet('ContactsSyncIsAllowed'));
|
||||
this.enableContactsSync(!!SettingsGet('EnableContactsSync'));
|
||||
ko.addObservablesTo(ContactUserStore, {
|
||||
allowSync: false,
|
||||
enableSync: false,
|
||||
syncUrl: '',
|
||||
syncUser: '',
|
||||
syncPass: ''
|
||||
});
|
||||
|
||||
this.contactsSyncUrl(SettingsGet('ContactsSyncUrl'));
|
||||
this.contactsSyncUser(SettingsGet('ContactsSyncUser'));
|
||||
this.contactsSyncPass(SettingsGet('ContactsSyncPassword'));
|
||||
}
|
||||
}
|
||||
ContactUserStore.populate = function() {
|
||||
this.allowSync(!!SettingsGet('ContactsSyncIsAllowed'));
|
||||
this.enableSync(!!SettingsGet('EnableContactsSync'));
|
||||
|
||||
export default new ContactUserStore();
|
||||
this.syncUrl(SettingsGet('ContactsSyncUrl'));
|
||||
this.syncUser(SettingsGet('ContactsSyncUser'));
|
||||
this.syncPass(SettingsGet('ContactsSyncPassword'));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { folderListOptionsBuilder } from 'Common/UtilsUser';
|
|||
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
|
||||
class FolderUserStore {
|
||||
export const FolderUserStore = new class {
|
||||
constructor() {
|
||||
ko.addObservablesTo(this, {
|
||||
/**
|
||||
|
|
@ -124,10 +124,6 @@ class FolderUserStore {
|
|||
)
|
||||
);
|
||||
|
||||
this.subscribers();
|
||||
}
|
||||
|
||||
subscribers() {
|
||||
const fRemoveSystemFolderType = (observable) => () => {
|
||||
const folder = getFolderFromCacheList(observable());
|
||||
if (folder) {
|
||||
|
|
@ -200,6 +196,4 @@ class FolderUserStore {
|
|||
|
||||
return result.filter((value, index, self) => self.indexOf(value) == index);
|
||||
}
|
||||
}
|
||||
|
||||
export default new FolderUserStore();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ import { EmailCollectionModel } from 'Model/EmailCollection';
|
|||
import { MessageModel } from 'Model/Message';
|
||||
import { MessageCollectionModel } from 'Model/MessageCollection';
|
||||
|
||||
import AppStore from 'Stores/User/App';
|
||||
import AccountStore from 'Stores/User/Account';
|
||||
import FolderStore from 'Stores/User/Folder';
|
||||
import PgpStore from 'Stores/User/Pgp';
|
||||
import SettingsStore from 'Stores/User/Settings';
|
||||
import NotificationStore from 'Stores/User/Notification';
|
||||
import { AppUserStore } from 'Stores/User/App';
|
||||
import { AccountUserStore } from 'Stores/User/Account';
|
||||
import { FolderUserStore } from 'Stores/User/Folder';
|
||||
import { PgpUserStore } from 'Stores/User/Pgp';
|
||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||
import { NotificationUserStore } from 'Stores/User/Notification';
|
||||
|
||||
import Remote from 'Remote/User/Fetch';
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ const
|
|||
|
||||
doc.body.append(hcont);
|
||||
|
||||
class MessageUserStore {
|
||||
export const MessageUserStore = new class {
|
||||
constructor() {
|
||||
this.staticMessage = new MessageModel();
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ class MessageUserStore {
|
|||
);
|
||||
|
||||
this.messageListPageCount = ko.computed(() => {
|
||||
const page = Math.ceil(this.messageListCount() / SettingsStore.messagesPerPage());
|
||||
const page = Math.ceil(this.messageListCount() / SettingsUserStore.messagesPerPage());
|
||||
return 0 >= page ? 1 : page;
|
||||
});
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ class MessageUserStore {
|
|||
read: this.messageListSearch,
|
||||
write: (value) => {
|
||||
rl.route.setHash(
|
||||
mailBox(FolderStore.currentFolderFullNameHash(), 1, value.toString().trim(), this.messageListThreadUid())
|
||||
mailBox(FolderUserStore.currentFolderFullNameHash(), 1, value.toString().trim(), this.messageListThreadUid())
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
@ -226,11 +226,11 @@ class MessageUserStore {
|
|||
|
||||
this.message.subscribe(message => {
|
||||
if (message) {
|
||||
if (!SettingsStore.usePreviewPane()) {
|
||||
AppStore.focusedState(Focused.MessageView);
|
||||
if (!SettingsUserStore.usePreviewPane()) {
|
||||
AppUserStore.focusedState(Focused.MessageView);
|
||||
}
|
||||
} else {
|
||||
AppStore.focusedState(Focused.MessageList);
|
||||
AppUserStore.focusedState(Focused.MessageList);
|
||||
|
||||
this.messageFullScreenMode(false);
|
||||
this.hideMessageBodies();
|
||||
|
|
@ -262,12 +262,12 @@ class MessageUserStore {
|
|||
if (Array.isNotEmpty(newMessages)) {
|
||||
newMessages.forEach(item => addNewMessageCache(folder, item.Uid));
|
||||
|
||||
NotificationStore.playSoundNotification();
|
||||
NotificationUserStore.playSoundNotification();
|
||||
|
||||
const len = newMessages.length;
|
||||
if (3 < len) {
|
||||
NotificationStore.displayDesktopNotification(
|
||||
AccountStore.email(),
|
||||
NotificationUserStore.displayDesktopNotification(
|
||||
AccountUserStore.email(),
|
||||
i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
|
||||
'COUNT': len
|
||||
}),
|
||||
|
|
@ -275,7 +275,7 @@ class MessageUserStore {
|
|||
);
|
||||
} else {
|
||||
newMessages.forEach(item => {
|
||||
NotificationStore.displayDesktopNotification(
|
||||
NotificationUserStore.displayDesktopNotification(
|
||||
EmailCollectionModel.reviveFromJson(item.From).toString(),
|
||||
item.Subject,
|
||||
{ 'Folder': item.Folder, 'Uid': item.Uid }
|
||||
|
|
@ -306,11 +306,11 @@ class MessageUserStore {
|
|||
messageList = this.messageList,
|
||||
currentMessage = this.message();
|
||||
|
||||
const trashFolder = FolderStore.trashFolder(),
|
||||
spamFolder = FolderStore.spamFolder(),
|
||||
const trashFolder = FolderUserStore.trashFolder(),
|
||||
spamFolder = FolderUserStore.spamFolder(),
|
||||
fromFolder = getFolderFromCacheList(fromFolderFullNameRaw),
|
||||
toFolder = toFolderFullNameRaw ? getFolderFromCacheList(toFolderFullNameRaw) : null,
|
||||
currentFolderFullNameRaw = FolderStore.currentFolderFullNameRaw(),
|
||||
currentFolderFullNameRaw = FolderUserStore.currentFolderFullNameRaw(),
|
||||
messages =
|
||||
currentFolderFullNameRaw === fromFolderFullNameRaw
|
||||
? messageList.filter(item => item && uidForRemove.includes(pInt(item.uid)))
|
||||
|
|
@ -391,7 +391,7 @@ class MessageUserStore {
|
|||
|
||||
rl.route.setHash(
|
||||
mailBox(
|
||||
FolderStore.currentFolderFullNameHash(),
|
||||
FolderUserStore.currentFolderFullNameHash(),
|
||||
this.messageListPage(),
|
||||
this.messageListSearch(),
|
||||
this.messageListThreadUid()
|
||||
|
|
@ -405,7 +405,7 @@ class MessageUserStore {
|
|||
|
||||
rl.route.setHash(
|
||||
mailBox(
|
||||
FolderStore.currentFolderFullNameHash(),
|
||||
FolderUserStore.currentFolderFullNameHash(),
|
||||
this.messageListPage(),
|
||||
this.messageListSearch(),
|
||||
this.messageListThreadUid()
|
||||
|
|
@ -418,7 +418,7 @@ class MessageUserStore {
|
|||
|
||||
rl.route.setHash(
|
||||
mailBox(
|
||||
FolderStore.currentFolderFullNameHash(),
|
||||
FolderUserStore.currentFolderFullNameHash(),
|
||||
this.messageListPageBeforeThread(),
|
||||
this.messageListSearch()
|
||||
),
|
||||
|
|
@ -454,7 +454,7 @@ class MessageUserStore {
|
|||
*/
|
||||
initOpenPgpControls(messageTextBody, message) {
|
||||
messageTextBody && messageTextBody.querySelectorAll('.b-plain-openpgp:not(.inited)').forEach(node =>
|
||||
PgpStore.initMessageBodyControls(node, message)
|
||||
PgpUserStore.initMessageBodyControls(node, message)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -517,13 +517,13 @@ class MessageUserStore {
|
|||
let isHtml = !!json.Html;
|
||||
if (isHtml) {
|
||||
resultHtml = json.Html.toString();
|
||||
if (SettingsStore.removeColors()) {
|
||||
if (SettingsUserStore.removeColors()) {
|
||||
resultHtml = removeColors(resultHtml);
|
||||
}
|
||||
} else if (json.Plain) {
|
||||
resultHtml = plainToHtml(json.Plain.toString());
|
||||
|
||||
if ((message.isPgpSigned() || message.isPgpEncrypted()) && PgpStore.capaOpenPGP()) {
|
||||
if ((message.isPgpSigned() || message.isPgpEncrypted()) && PgpUserStore.capaOpenPGP()) {
|
||||
plain = pString(json.Plain);
|
||||
|
||||
const isPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(plain);
|
||||
|
|
@ -578,7 +578,7 @@ class MessageUserStore {
|
|||
message.showInternalImages();
|
||||
}
|
||||
|
||||
if (message.hasImages() && SettingsStore.showImages()) {
|
||||
if (message.hasImages() && SettingsUserStore.showImages()) {
|
||||
message.showExternalImages();
|
||||
}
|
||||
|
||||
|
|
@ -725,7 +725,7 @@ class MessageUserStore {
|
|||
|
||||
this.messageListCount(iCount);
|
||||
this.messageListSearch(pString(collection.Search));
|
||||
this.messageListPage(Math.ceil(iOffset / SettingsStore.messagesPerPage() + 1));
|
||||
this.messageListPage(Math.ceil(iOffset / SettingsUserStore.messagesPerPage() + 1));
|
||||
this.messageListThreadUid(pString(data.Result.ThreadUid));
|
||||
|
||||
this.messageListEndFolder(collection.Folder);
|
||||
|
|
@ -740,7 +740,7 @@ class MessageUserStore {
|
|||
|
||||
clearNewMessageCache();
|
||||
|
||||
if (folder && (cached || unreadCountChange || SettingsStore.useThreads())) {
|
||||
if (folder && (cached || unreadCountChange || SettingsUserStore.useThreads())) {
|
||||
rl.app.folderInformation(folder.fullNameRaw, collection);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -749,6 +749,4 @@ class MessageUserStore {
|
|||
this.messageListError(getNotification(data && data.ErrorCode ? data.ErrorCode : Notification.CantGetMessageList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new MessageUserStore();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import Audio from 'Common/Audio';
|
||||
import { SMAudio } from 'Common/Audio';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import * as Links from 'Common/Links';
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ if (WorkerNotifications && ServiceWorkerRegistration && ServiceWorkerRegistratio
|
|||
console.log('ServiceWorker Notifications not supported');
|
||||
}
|
||||
|
||||
class NotificationUserStore {
|
||||
export const NotificationUserStore = new class {
|
||||
constructor() {
|
||||
this.enableSoundNotification = ko.observable(false);
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ class NotificationUserStore {
|
|||
*/
|
||||
playSoundNotification(skipSetting) {
|
||||
if (skipSetting ? true : this.enableSoundNotification()) {
|
||||
Audio.playNotification();
|
||||
SMAudio.playNotification();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,6 +106,4 @@ class NotificationUserStore {
|
|||
this.enableSoundNotification(!!SettingsGet('SoundNotification'));
|
||||
this.enableDesktopNotification(!!SettingsGet('DesktopNotifications'));
|
||||
}
|
||||
}
|
||||
|
||||
export default new NotificationUserStore();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { i18n } from 'Common/Translator';
|
|||
import { pString } from 'Common/Utils';
|
||||
import { doc } from 'Common/Globals';
|
||||
|
||||
import AccountStore from 'Stores/User/Account';
|
||||
import { AccountUserStore } from 'Stores/User/Account';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ function domControlSignedClickHelper(store, dom, armoredMessage) {
|
|||
};
|
||||
}
|
||||
|
||||
class PgpUserStore {
|
||||
export const PgpUserStore = new class {
|
||||
constructor() {
|
||||
this.capaOpenPGP = ko.observable(false);
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ class PgpUserStore {
|
|||
* @returns {?}
|
||||
*/
|
||||
findSelfPrivateKey(password) {
|
||||
return this.findPrivateKeyByEmail(AccountStore.email(), password);
|
||||
return this.findPrivateKeyByEmail(AccountUserStore.email(), password);
|
||||
}
|
||||
|
||||
decryptMessage(message, recipients, fCallback) {
|
||||
|
|
@ -365,6 +365,4 @@ class PgpUserStore {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new PgpUserStore();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import ko from 'ko';
|
||||
|
||||
class QuotaUserStore {
|
||||
export const QuotaUserStore = new class {
|
||||
constructor() {
|
||||
this.quota = ko.observable(0);
|
||||
this.usage = ko.observable(0);
|
||||
|
|
@ -21,6 +21,4 @@ class QuotaUserStore {
|
|||
this.quota(quota * 1024);
|
||||
this.usage(usage * 1024);
|
||||
}
|
||||
}
|
||||
|
||||
export default new QuotaUserStore();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { pInt } from 'Common/Utils';
|
|||
import { $htmlCL, SettingsGet } from 'Common/Globals';
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
class SettingsUserStore {
|
||||
export const SettingsUserStore = new class {
|
||||
constructor() {
|
||||
this.layout = ko
|
||||
.observable(Layout.SidePreview)
|
||||
|
|
@ -36,7 +36,12 @@ class SettingsUserStore {
|
|||
|
||||
this.usePreviewPane = ko.computed(() => Layout.NoPreview !== this.layout() && !ThemeStore.isMobile());
|
||||
|
||||
this.subscribers();
|
||||
this.layout.subscribe(value => {
|
||||
$htmlCL.toggle('rl-no-preview-pane', Layout.NoPreview === value);
|
||||
$htmlCL.toggle('rl-side-preview-pane', Layout.SidePreview === value);
|
||||
$htmlCL.toggle('rl-bottom-preview-pane', Layout.BottomPreview === value);
|
||||
dispatchEvent(new CustomEvent('rl-layout', {detail:value}));
|
||||
});
|
||||
|
||||
let iAutoLogoutTimer;
|
||||
this.delayLogout = (() => {
|
||||
|
|
@ -50,15 +55,6 @@ class SettingsUserStore {
|
|||
}).throttle(5000);
|
||||
}
|
||||
|
||||
subscribers() {
|
||||
this.layout.subscribe(value => {
|
||||
$htmlCL.toggle('rl-no-preview-pane', Layout.NoPreview === value);
|
||||
$htmlCL.toggle('rl-side-preview-pane', Layout.SidePreview === value);
|
||||
$htmlCL.toggle('rl-bottom-preview-pane', Layout.BottomPreview === value);
|
||||
dispatchEvent(new CustomEvent('rl-layout', {detail:value}));
|
||||
});
|
||||
}
|
||||
|
||||
populate() {
|
||||
this.layout(pInt(SettingsGet('Layout')));
|
||||
this.editorDefaultType(SettingsGet('EditorDefaultType'));
|
||||
|
|
@ -75,6 +71,4 @@ class SettingsUserStore {
|
|||
|
||||
this.delayLogout();
|
||||
}
|
||||
}
|
||||
|
||||
export default new SettingsUserStore();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import ko from 'ko';
|
|||
|
||||
// import Remote from 'Remote/User/Fetch';
|
||||
|
||||
class TemplateUserStore {
|
||||
export const TemplateUserStore = new class {
|
||||
constructor() {
|
||||
this.templates = ko.observableArray();
|
||||
this.templates.loading = ko.observable(false).extend({ debounce: 100 });
|
||||
|
|
@ -29,6 +29,4 @@ class TemplateUserStore {
|
|||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
export default new TemplateUserStore();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue