mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +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
|
|
@ -2,7 +2,7 @@ import { AppUserStore } from 'Stores/User/App';
|
|||
import { AccountUserStore } from 'Stores/User/Account';
|
||||
import { MessageUserStore } from 'Stores/User/Message';
|
||||
|
||||
import { Capa, KeyState } from 'Common/Enums';
|
||||
import { Capa, Scope } from 'Common/Enums';
|
||||
import { settings } from 'Common/Links';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
|
@ -36,7 +36,7 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight {
|
|||
capaAdditionalAccounts: Settings.capa(Capa.AdditionalAccounts)
|
||||
});
|
||||
|
||||
this.allowContacts = !!AppUserStore.contactsIsAllowed();
|
||||
this.allowContacts = AppUserStore.contactsIsAllowed();
|
||||
|
||||
this.addAccountClick = this.addAccountClick.bind(this);
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
shortcuts.add('m,contextmenu', '', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
|
||||
shortcuts.add('m,contextmenu', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
|
||||
if (this.viewModelVisible) {
|
||||
MessageUserStore.messageFullScreenMode(false);
|
||||
this.accountMenuDropdownTrigger(true);
|
||||
|
|
@ -115,7 +115,7 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight {
|
|||
});
|
||||
|
||||
// shortcuts help
|
||||
shortcuts.add('?,f1,help', '', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
|
||||
shortcuts.add('?,f1,help', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => {
|
||||
if (this.viewModelVisible) {
|
||||
showScreenPopup(KeyboardShortcutsHelpPopupView);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import { ClientSideKeyName } from 'Common/EnumsUser';
|
|||
|
||||
import { getNotification, getNotificationFromResponse, reload as translatorReload, convertLangName } from 'Common/Translator';
|
||||
|
||||
import { AppUserStore } from 'Stores/User/App';
|
||||
import { LanguageStore } from 'Stores/Language';
|
||||
|
||||
import * as Local from 'Storage/Client';
|
||||
|
|
@ -45,8 +44,8 @@ class LoginUserView extends AbstractViewCenter {
|
|||
this.addObservables({
|
||||
loadingDesc: SettingsGet('LoadingDescription'),
|
||||
|
||||
email: '',
|
||||
password: '',
|
||||
email: SettingsGet('DevEmail'),
|
||||
password: SettingsGet('DevPassword'),
|
||||
signMe: false,
|
||||
additionalCode: '',
|
||||
|
||||
|
|
@ -232,9 +231,6 @@ class LoginUserView extends AbstractViewCenter {
|
|||
break;
|
||||
}
|
||||
|
||||
this.email(AppUserStore.devEmail);
|
||||
this.password(AppUserStore.devPassword);
|
||||
|
||||
setTimeout(() => {
|
||||
LanguageStore.language.subscribe((value) => {
|
||||
this.langRequest(true);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { Capa, KeyState } from 'Common/Enums';
|
||||
import { Focused } from 'Common/EnumsUser';
|
||||
import { Capa, Scope } from 'Common/Enums';
|
||||
import { leftPanelDisabled, moveAction, Settings } from 'Common/Globals';
|
||||
import { mailBox, settings } from 'Common/Links';
|
||||
import { setFolderHash } from 'Common/Cache';
|
||||
|
|
@ -39,9 +38,9 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
|
|||
this.leftPanelDisabled = leftPanelDisabled;
|
||||
|
||||
this.allowComposer = Settings.capa(Capa.Composer);
|
||||
this.allowContacts = !!AppUserStore.contactsIsAllowed();
|
||||
this.allowContacts = AppUserStore.contactsIsAllowed();
|
||||
|
||||
this.folderListFocused = ko.computed(() => Focused.FolderList === AppUserStore.focusedState());
|
||||
this.folderListFocused = ko.computed(() => Scope.FolderList === AppUserStore.focusedState());
|
||||
|
||||
this.isInboxStarred = ko.computed(
|
||||
() =>
|
||||
|
|
@ -89,7 +88,7 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
|
|||
);
|
||||
}
|
||||
|
||||
AppUserStore.focusedState(Focused.MessageList);
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -117,7 +116,7 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
|
|||
el && fSelectFolder(el, event, false);
|
||||
});
|
||||
|
||||
shortcuts.add('arrowup,arrowdown', '', KeyState.FolderList, event => {
|
||||
shortcuts.add('arrowup,arrowdown', '', Scope.FolderList, event => {
|
||||
let items = [], index = 0;
|
||||
dom.querySelectorAll('.b-folders .e-item .e-link:not(.hidden)').forEach(node => {
|
||||
if (node.offsetHeight || node.getClientRects().length) {
|
||||
|
|
@ -141,17 +140,17 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
|
|||
return false;
|
||||
});
|
||||
|
||||
shortcuts.add('enter,open', '', KeyState.FolderList, () => {
|
||||
shortcuts.add('enter,open', '', Scope.FolderList, () => {
|
||||
const item = qs('.b-folders .e-item .e-link:not(.hidden).focused');
|
||||
if (item) {
|
||||
AppUserStore.focusedState(Focused.MessageList);
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
item.click();
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
shortcuts.add('space', '', KeyState.FolderList, () => {
|
||||
shortcuts.add('space', '', Scope.FolderList, () => {
|
||||
const item = qs('.b-folders .e-item .e-link:not(.hidden).focused'),
|
||||
folder = item && ko.dataFor(item);
|
||||
if (folder) {
|
||||
|
|
@ -163,9 +162,9 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
|
|||
return false;
|
||||
});
|
||||
|
||||
// shortcuts.add('tab', 'shift', KeyState.FolderList, () => {
|
||||
shortcuts.add('escape,tab,arrowright', '', KeyState.FolderList, () => {
|
||||
AppUserStore.focusedState(Focused.MessageList);
|
||||
// shortcuts.add('tab', 'shift', Scope.FolderList, () => {
|
||||
shortcuts.add('escape,tab,arrowright', '', Scope.FolderList, () => {
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
moveAction(false);
|
||||
return false;
|
||||
});
|
||||
|
|
@ -173,7 +172,7 @@ export class FolderListMailBoxUserView extends AbstractViewLeft {
|
|||
AppUserStore.focusedState.subscribe(value => {
|
||||
let el = qs('.b-folders .e-item .e-link.focused');
|
||||
el && qs('.b-folders .e-item .e-link.focused').classList.remove('focused');
|
||||
if (Focused.FolderList === value) {
|
||||
if (Scope.FolderList === value) {
|
||||
el = qs('.b-folders .e-item .e-link.selected');
|
||||
el && qs('.b-folders .e-item .e-link.selected').classList.add('focused');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@ import ko from 'ko';
|
|||
|
||||
import {
|
||||
Capa,
|
||||
KeyState
|
||||
Scope
|
||||
} from 'Common/Enums';
|
||||
|
||||
import {
|
||||
Focused,
|
||||
ComposeType,
|
||||
FolderType,
|
||||
MessageSetAction
|
||||
|
|
@ -175,7 +174,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
mobileCheckedStateHide: () => ThemeStore.isMobile() ? !MessageUserStore.listChecked().length : true,
|
||||
|
||||
messageListFocused: () => Focused.MessageList === AppUserStore.focusedState()
|
||||
messageListFocused: () => Scope.MessageList === AppUserStore.focusedState()
|
||||
});
|
||||
|
||||
this.hasCheckedOrSelectedLines = MessageUserStore.hasCheckedOrSelected,
|
||||
|
|
@ -324,7 +323,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
let b = moveAction();
|
||||
AppUserStore.focusedState(b ? Focused.MessageList : Focused.FolderList);
|
||||
AppUserStore.focusedState(b ? Scope.MessageList : Scope.FolderList);
|
||||
moveAction(!b);
|
||||
}
|
||||
}
|
||||
|
|
@ -666,13 +665,13 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
onBuild(dom) {
|
||||
const eqs = (ev, s) => ev.target.closestWithin(s, dom);
|
||||
|
||||
this.selector.init(dom.querySelector('.b-content'), KeyState.MessageList);
|
||||
this.selector.init(dom.querySelector('.b-content'), Scope.MessageList);
|
||||
|
||||
dom.addEventListener('click', event => {
|
||||
ThemeStore.isMobile() && leftPanelDisabled(true);
|
||||
|
||||
if (eqs(event, '.messageList .b-message-list-wrapper') && Focused.MessageView === AppUserStore.focusedState()) {
|
||||
AppUserStore.focusedState(Focused.MessageList);
|
||||
if (eqs(event, '.messageList .b-message-list-wrapper') && Scope.MessageView === AppUserStore.focusedState()) {
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
}
|
||||
|
||||
let el = eqs(event, '.e-paginator .e-page');
|
||||
|
|
@ -701,7 +700,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
initShortcuts() {
|
||||
shortcuts.add('enter,open', '', KeyState.MessageList, () => {
|
||||
shortcuts.add('enter,open', '', Scope.MessageList, () => {
|
||||
if (this.message() && this.useAutoSelect()) {
|
||||
dispatchEvent(new CustomEvent('mailbox.message-view.toggle-full-screen'));
|
||||
return false;
|
||||
|
|
@ -712,18 +711,18 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
if (Settings.capa(Capa.MessageListActions)) {
|
||||
// archive (zip)
|
||||
shortcuts.add('z', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('z', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
this.archiveCommand();
|
||||
return false;
|
||||
});
|
||||
|
||||
// delete
|
||||
shortcuts.add('delete', 'shift', KeyState.MessageList, () => {
|
||||
shortcuts.add('delete', 'shift', Scope.MessageList, () => {
|
||||
MessageUserStore.listCheckedOrSelected().length && this.deleteWithoutMoveCommand();
|
||||
return false;
|
||||
});
|
||||
// shortcuts.add('3', 'shift', KeyState.MessageList, () => {
|
||||
shortcuts.add('delete', '', KeyState.MessageList, () => {
|
||||
// shortcuts.add('3', 'shift', Scope.MessageList, () => {
|
||||
shortcuts.add('delete', '', Scope.MessageList, () => {
|
||||
MessageUserStore.listCheckedOrSelected().length && this.deleteCommand();
|
||||
return false;
|
||||
});
|
||||
|
|
@ -731,33 +730,33 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
if (Settings.capa(Capa.Reload)) {
|
||||
// check mail
|
||||
shortcuts.add('r', 'meta', [KeyState.FolderList, KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('r', 'meta', [Scope.FolderList, Scope.MessageList, Scope.MessageView], () => {
|
||||
this.reloadCommand();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// check all
|
||||
shortcuts.add('a', 'meta', KeyState.MessageList, () => {
|
||||
shortcuts.add('a', 'meta', Scope.MessageList, () => {
|
||||
this.checkAll(!(this.checkAll() && !this.isIncompleteChecked()));
|
||||
return false;
|
||||
});
|
||||
|
||||
// write/compose (open compose popup)
|
||||
shortcuts.add('w,c,new', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('w,c,new', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
showMessageComposer();
|
||||
return false;
|
||||
});
|
||||
|
||||
if (Settings.capa(Capa.MessageListActions)) {
|
||||
// important - star/flag messages
|
||||
shortcuts.add('i', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('i', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
this.flagMessagesFast();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
shortcuts.add('t', '', [KeyState.MessageList], () => {
|
||||
shortcuts.add('t', '', [Scope.MessageList], () => {
|
||||
let message = this.selectorMessageSelected();
|
||||
if (!message) {
|
||||
message = this.selectorMessageFocused();
|
||||
|
|
@ -772,7 +771,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
if (Settings.capa(Capa.MessageListActions)) {
|
||||
// move
|
||||
shortcuts.add('insert', '', KeyState.MessageList, () => {
|
||||
shortcuts.add('insert', '', Scope.MessageList, () => {
|
||||
if (this.newMoveToFolder) {
|
||||
this.moveNewCommand();
|
||||
} else {
|
||||
|
|
@ -785,33 +784,33 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
if (Settings.capa(Capa.MessageListActions)) {
|
||||
// read
|
||||
shortcuts.add('q', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('q', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
this.seenMessagesFast(true);
|
||||
return false;
|
||||
});
|
||||
|
||||
// unread
|
||||
shortcuts.add('u', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('u', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
this.seenMessagesFast(false);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
shortcuts.add('f,mailforward', 'shift', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('f,mailforward', 'shift', [Scope.MessageList, Scope.MessageView], () => {
|
||||
this.multyForwardCommand();
|
||||
return false;
|
||||
});
|
||||
|
||||
if (Settings.capa(Capa.Search)) {
|
||||
// search input focus
|
||||
shortcuts.add('/', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('/', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
this.inputMessageListSearchFocus(true);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// cancel search
|
||||
shortcuts.add('escape', '', KeyState.MessageList, () => {
|
||||
shortcuts.add('escape', '', Scope.MessageList, () => {
|
||||
if (this.messageListSearchDesc()) {
|
||||
this.cancelSearch();
|
||||
return false;
|
||||
|
|
@ -824,21 +823,21 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
|||
});
|
||||
|
||||
// change focused state
|
||||
shortcuts.add('tab', 'shift', KeyState.MessageList, () => {
|
||||
AppUserStore.focusedState(Focused.FolderList);
|
||||
shortcuts.add('tab', 'shift', Scope.MessageList, () => {
|
||||
AppUserStore.focusedState(Scope.FolderList);
|
||||
return false;
|
||||
});
|
||||
shortcuts.add('arrowleft', '', KeyState.MessageList, () => {
|
||||
AppUserStore.focusedState(Focused.FolderList);
|
||||
shortcuts.add('arrowleft', '', Scope.MessageList, () => {
|
||||
AppUserStore.focusedState(Scope.FolderList);
|
||||
return false;
|
||||
});
|
||||
shortcuts.add('tab,arrowright', '', KeyState.MessageList, () => {
|
||||
this.message() && AppUserStore.focusedState(Focused.MessageView);
|
||||
shortcuts.add('tab,arrowright', '', Scope.MessageList, () => {
|
||||
this.message() && AppUserStore.focusedState(Scope.MessageView);
|
||||
return false;
|
||||
});
|
||||
|
||||
shortcuts.add('arrowleft', 'meta', KeyState.MessageView, ()=>false);
|
||||
shortcuts.add('arrowright', 'meta', KeyState.MessageView, ()=>false);
|
||||
shortcuts.add('arrowleft', 'meta', Scope.MessageView, ()=>false);
|
||||
shortcuts.add('arrowright', 'meta', Scope.MessageView, ()=>false);
|
||||
}
|
||||
|
||||
prefetchNextTick() {
|
||||
|
|
|
|||
|
|
@ -4,14 +4,13 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
|||
|
||||
import {
|
||||
Capa,
|
||||
KeyState
|
||||
Scope
|
||||
} from 'Common/Enums';
|
||||
|
||||
import {
|
||||
ComposeType,
|
||||
ClientSideKeyName,
|
||||
FolderType,
|
||||
Focused,
|
||||
MessageSetAction
|
||||
} from 'Common/EnumsUser';
|
||||
|
||||
|
|
@ -80,7 +79,8 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
this.allowMessageActions = Settings.capa(Capa.MessageActions);
|
||||
this.allowMessageListActions = Settings.capa(Capa.MessageListActions);
|
||||
|
||||
this.attachmentsActions = AppUserStore.attachmentsActions;
|
||||
const attachmentsActions = Settings.app('attachmentsActions');
|
||||
this.attachmentsActions = ko.observableArray(Array.isNotEmpty(attachmentsActions) ? attachmentsActions : []);
|
||||
|
||||
this.message = MessageUserStore.message;
|
||||
this.hasCheckedMessages = MessageUserStore.hasCheckedMessages;
|
||||
|
|
@ -186,7 +186,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
return '';
|
||||
},
|
||||
|
||||
messageFocused: () => Focused.MessageView === AppUserStore.focusedState(),
|
||||
messageFocused: () => Scope.MessageView === AppUserStore.focusedState(),
|
||||
|
||||
messageListAndMessageViewLoading:
|
||||
() => MessageUserStore.listCompleteLoading() || MessageUserStore.messageLoading()
|
||||
|
|
@ -364,7 +364,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
onBuild(dom) {
|
||||
this.fullScreenMode.subscribe(value => value && this.message() && AppUserStore.focusedState(Focused.MessageView));
|
||||
this.fullScreenMode.subscribe(value => value && this.message() && AppUserStore.focusedState(Scope.MessageView));
|
||||
|
||||
this.showFullInfo.subscribe(value => Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0'));
|
||||
|
||||
|
|
@ -462,13 +462,13 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
});
|
||||
|
||||
AppUserStore.focusedState.subscribe((value) => {
|
||||
if (Focused.MessageView !== value) {
|
||||
if (Scope.MessageView !== value) {
|
||||
this.scrollMessageToTop();
|
||||
this.scrollMessageToLeft();
|
||||
}
|
||||
});
|
||||
|
||||
keyScopeReal.subscribe(value => this.messageDomFocused(KeyState.MessageView === value && !inFocus()));
|
||||
keyScopeReal.subscribe(value => this.messageDomFocused(Scope.MessageView === value && !inFocus()));
|
||||
|
||||
this.oMessageScrollerDom = dom.querySelector('.messageItem');
|
||||
|
||||
|
|
@ -485,12 +485,12 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
this.fullScreenMode(false);
|
||||
|
||||
if (preview) {
|
||||
AppUserStore.focusedState(Focused.MessageList);
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
}
|
||||
} else if (!preview) {
|
||||
this.message(null);
|
||||
} else {
|
||||
AppUserStore.focusedState(Focused.MessageList);
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -501,16 +501,16 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
|
||||
initShortcuts() {
|
||||
// exit fullscreen, back
|
||||
shortcuts.add('escape,backspace', '', KeyState.MessageView, this.escShortcuts.bind(this));
|
||||
shortcuts.add('escape,backspace', '', Scope.MessageView, this.escShortcuts.bind(this));
|
||||
|
||||
// fullscreen
|
||||
shortcuts.add('enter,open', '', KeyState.MessageView, () => {
|
||||
shortcuts.add('enter,open', '', Scope.MessageView, () => {
|
||||
this.toggleFullScreen();
|
||||
return false;
|
||||
});
|
||||
|
||||
// reply
|
||||
shortcuts.add('r,mailreply', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('r,mailreply', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
if (MessageUserStore.message()) {
|
||||
this.replyCommand();
|
||||
return false;
|
||||
|
|
@ -519,14 +519,14 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
});
|
||||
|
||||
// replaAll
|
||||
shortcuts.add('a', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('a', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
if (MessageUserStore.message()) {
|
||||
this.replyAllCommand();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
shortcuts.add('mailreply', 'shift', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('mailreply', 'shift', [Scope.MessageList, Scope.MessageView], () => {
|
||||
if (MessageUserStore.message()) {
|
||||
this.replyAllCommand();
|
||||
return false;
|
||||
|
|
@ -535,7 +535,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
});
|
||||
|
||||
// forward
|
||||
shortcuts.add('f,mailforward', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('f,mailforward', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
if (MessageUserStore.message()) {
|
||||
this.forwardCommand();
|
||||
return false;
|
||||
|
|
@ -545,7 +545,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
});
|
||||
|
||||
// message information
|
||||
shortcuts.add('i', 'meta', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('i', 'meta', [Scope.MessageList, Scope.MessageView], () => {
|
||||
if (MessageUserStore.message()) {
|
||||
this.showFullInfo(!this.showFullInfo());
|
||||
}
|
||||
|
|
@ -553,7 +553,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
});
|
||||
|
||||
// toggle message blockquotes
|
||||
shortcuts.add('b', '', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('b', '', [Scope.MessageList, Scope.MessageView], () => {
|
||||
const message = MessageUserStore.message();
|
||||
if (message && message.body) {
|
||||
message.body.querySelectorAll('.rlBlockquoteSwitcher').forEach(node => node.click());
|
||||
|
|
@ -562,46 +562,46 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
|
|||
return true;
|
||||
});
|
||||
|
||||
shortcuts.add('arrowup,arrowleft', 'meta', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('arrowup,arrowleft', 'meta', [Scope.MessageList, Scope.MessageView], () => {
|
||||
this.goUpCommand();
|
||||
return false;
|
||||
});
|
||||
|
||||
shortcuts.add('arrowdown,arrowright', 'meta', [KeyState.MessageList, KeyState.MessageView], () => {
|
||||
shortcuts.add('arrowdown,arrowright', 'meta', [Scope.MessageList, Scope.MessageView], () => {
|
||||
this.goDownCommand();
|
||||
return false;
|
||||
});
|
||||
|
||||
// print
|
||||
shortcuts.add('p,printscreen', 'meta', [KeyState.MessageView, KeyState.MessageList], () => {
|
||||
shortcuts.add('p,printscreen', 'meta', [Scope.MessageView, Scope.MessageList], () => {
|
||||
this.message() && this.message().printMessage();
|
||||
return false;
|
||||
});
|
||||
|
||||
// delete
|
||||
shortcuts.add('delete', '', KeyState.MessageView, () => {
|
||||
shortcuts.add('delete', '', Scope.MessageView, () => {
|
||||
this.deleteCommand();
|
||||
return false;
|
||||
});
|
||||
shortcuts.add('delete', 'shift', KeyState.MessageView, () => {
|
||||
shortcuts.add('delete', 'shift', Scope.MessageView, () => {
|
||||
this.deleteWithoutMoveCommand();
|
||||
return false;
|
||||
});
|
||||
|
||||
// change focused state
|
||||
shortcuts.add('arrowleft', '', KeyState.MessageView, () => {
|
||||
shortcuts.add('arrowleft', '', Scope.MessageView, () => {
|
||||
if (!this.fullScreenMode() && this.message() && SettingsUserStore.usePreviewPane()) {
|
||||
if (this.oMessageScrollerDom && 0 < this.oMessageScrollerDom.scrollLeft) {
|
||||
return true;
|
||||
}
|
||||
AppUserStore.focusedState(Focused.MessageList);
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// shortcuts.add('tab', 'shift', KeyState.MessageView, (event, handler) => {
|
||||
shortcuts.add('tab', '', KeyState.MessageView, () => {
|
||||
// shortcuts.add('tab', 'shift', Scope.MessageView, (event, handler) => {
|
||||
shortcuts.add('tab', '', Scope.MessageView, () => {
|
||||
if (!this.fullScreenMode() && this.message() && SettingsUserStore.usePreviewPane()) {
|
||||
AppUserStore.focusedState(Focused.MessageList);
|
||||
AppUserStore.focusedState(Scope.MessageList);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { KeyState } from 'Common/Enums';
|
||||
import { Scope } from 'Common/Enums';
|
||||
import { leftPanelDisabled } from 'Common/Globals';
|
||||
import { settings, mailbox } from 'Common/Links';
|
||||
import { getFolderInboxName } from 'Common/Cache';
|
||||
|
|
@ -27,7 +27,7 @@ export class MenuSettingsUserView extends AbstractViewLeft {
|
|||
&& leftPanelDisabled(true)
|
||||
);
|
||||
|
||||
shortcuts.add('arrowup,arrowdown', '', KeyState.Settings,
|
||||
shortcuts.add('arrowup,arrowdown', '', Scope.Settings,
|
||||
settingsMenuKeysHandler(dom.querySelectorAll('.b-settings-menu .e-item')));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue