mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Cleanup AppUserStore
Simplify KeyState/Focused as Scope enum
This commit is contained in:
parent
62cb918180
commit
eff92c3152
27 changed files with 177 additions and 232 deletions
|
|
@ -32,21 +32,21 @@ export const Capa = {
|
|||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
export const KeyState = {
|
||||
export const Scope = {
|
||||
All: 'all',
|
||||
None: 'none',
|
||||
ContactList: 'contact-list',
|
||||
MessageList: 'message-list',
|
||||
FolderList: 'folder-list',
|
||||
MessageView: 'message-view',
|
||||
Compose: 'compose',
|
||||
Settings: 'settings',
|
||||
Menu: 'menu',
|
||||
PopupComposeOpenPGP: 'compose-open-pgp',
|
||||
PopupMessageOpenPGP: 'message-open-pgp',
|
||||
PopupViewOpenPGP: 'view-open-pgp',
|
||||
PopupKeyboardShortcutsHelp: 'popup-keyboard-shortcuts-help',
|
||||
PopupAsk: 'popup-ask'
|
||||
Contacts: 'Contacts',
|
||||
MessageList: 'MessageList',
|
||||
FolderList: 'FolderList',
|
||||
MessageView: 'MessageView',
|
||||
Compose: 'Compose',
|
||||
Settings: 'Settings',
|
||||
Menu: 'Menu',
|
||||
ComposeOpenPgp: 'ComposeOpenPgp',
|
||||
MessageOpenPgp: 'MessageOpenPgp',
|
||||
ViewOpenPgpKey: 'ViewOpenPgpKey',
|
||||
KeyboardShortcutsHelp: 'KeyboardShortcutsHelp',
|
||||
Ask: 'Ask'
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,15 +1,5 @@
|
|||
/* eslint quote-props: 0 */
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
export const Focused = {
|
||||
None: 'none',
|
||||
MessageList: 'message-list',
|
||||
MessageView: 'message-view',
|
||||
FolderList: 'folder-list'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { Scope } from 'Common/Enums';
|
||||
|
||||
export const doc = document;
|
||||
|
||||
|
|
@ -29,24 +29,24 @@ leftPanelDisabled.subscribe(value => {
|
|||
moveAction.subscribe(value => value && leftPanelDisabled() && leftPanelDisabled(false));
|
||||
|
||||
// keys
|
||||
export const keyScopeReal = ko.observable(KeyState.All);
|
||||
export const keyScopeReal = ko.observable(Scope.All);
|
||||
|
||||
export const keyScope = (()=>{
|
||||
let keyScopeFake = KeyState.All;
|
||||
let keyScopeFake = Scope.All;
|
||||
dropdownVisibility.subscribe(value => {
|
||||
if (value) {
|
||||
keyScope(KeyState.Menu);
|
||||
} else if (KeyState.Menu === shortcuts.getScope()) {
|
||||
keyScope(Scope.Menu);
|
||||
} else if (Scope.Menu === shortcuts.getScope()) {
|
||||
keyScope(keyScopeFake);
|
||||
}
|
||||
});
|
||||
return ko.computed({
|
||||
read: () => keyScopeFake,
|
||||
write: value => {
|
||||
if (KeyState.Menu !== value) {
|
||||
if (Scope.Menu !== value) {
|
||||
keyScopeFake = value;
|
||||
if (dropdownVisibility()) {
|
||||
value = KeyState.Menu;
|
||||
value = Scope.Menu;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue