From da2ab68fcc2365cde219af37441cd7914ef1d460 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 3 Apr 2023 10:29:26 +0200 Subject: [PATCH] Cleanup some enums to consts --- dev/Common/Enums.js | 10 ++--- dev/Common/EnumsUser.js | 53 ++++++++--------------- dev/Model/Message.js | 5 +-- dev/Screen/User/MailBox.js | 4 +- dev/Screen/User/Settings.js | 4 +- dev/Settings/User/General.js | 10 ++--- dev/Stores/User/Message.js | 6 +-- dev/Stores/User/Settings.js | 6 +-- dev/View/Popup/Compose.js | 3 +- dev/View/User/MailBox/FolderList.js | 18 ++++---- dev/View/User/MailBox/MessageList.js | 64 ++++++++++++++-------------- dev/View/User/MailBox/MessageView.js | 40 ++++++++--------- dev/View/User/SystemDropDown.js | 6 +-- 13 files changed, 103 insertions(+), 126 deletions(-) diff --git a/dev/Common/Enums.js b/dev/Common/Enums.js index 804d10b78..028d2a700 100644 --- a/dev/Common/Enums.js +++ b/dev/Common/Enums.js @@ -5,12 +5,10 @@ export const /** * @enum {string} */ -Scope = { - MessageList: 'MessageList', - FolderList: 'FolderList', - MessageView: 'MessageView', - Settings: 'Settings' -}, +ScopeMessageList = 'MessageList', +ScopeFolderList = 'FolderList', +ScopeMessageView = 'MessageView', +ScopeSettings = 'Settings', /** * @enum {number} diff --git a/dev/Common/EnumsUser.js b/dev/Common/EnumsUser.js index daa637d66..bc3c873ba 100644 --- a/dev/Common/EnumsUser.js +++ b/dev/Common/EnumsUser.js @@ -25,12 +25,12 @@ export const FolderType = { FILES : 25; JOURNAL : 26; */ -}; +}, /** * @enum {string} */ -export const FolderMetadataKeys = { +FolderMetadataKeys = { // RFC 5464 Comment: '/private/comment', CommentShared: '/shared/comment', @@ -39,12 +39,12 @@ export const FolderMetadataKeys = { // Kolab KolabFolderType: '/private/vendor/kolab/folder-type', KolabFolderTypeShared: '/shared/vendor/kolab/folder-type' -}; +}, /** * @enum {string} */ -export const ComposeType = { +ComposeType = { Empty: 0, Reply: 1, ReplyAll: 2, @@ -52,51 +52,32 @@ export const ComposeType = { ForwardAsAttachment: 4, Draft: 5, EditAsNew: 6 -}; +}, /** * @enum {number} */ -export const - ClientSideKeyNameExpandedFolders = 3, - ClientSideKeyNameFolderListSize = 4, - ClientSideKeyNameMessageListSize = 5, - ClientSideKeyNameLastSignMe = 7, - ClientSideKeyNameMessageHeaderFullInfo = 9, - ClientSideKeyNameMessageAttachmentControls = 10; +ClientSideKeyNameExpandedFolders = 3, +ClientSideKeyNameFolderListSize = 4, +ClientSideKeyNameMessageListSize = 5, +ClientSideKeyNameLastSignMe = 7, +ClientSideKeyNameMessageHeaderFullInfo = 9, +ClientSideKeyNameMessageAttachmentControls = 10, /** * @enum {number} */ -export const MessageSetAction = { +MessageSetAction = { SetSeen: 0, UnsetSeen: 1, SetFlag: 2, UnsetFlag: 3 -}; +}, /** * @enum {number} */ -export const MessagePriority = { - Low: 5, - Normal: 3, - High: 1 -}; - -/** - * @enum {string} - */ -export const EditorDefaultType = { - Html: 'Html', - Plain: 'Plain' -}; - -/** - * @enum {number} - */ -export const Layout = { -// NoPreview: 0, - SidePreview: 1, - BottomPreview: 2 -}; +//LayoutNoView = 0, +LayoutSideView = 1, +LayoutBottomView = 2 +; diff --git a/dev/Model/Message.js b/dev/Model/Message.js index b54868823..32241386e 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -1,6 +1,5 @@ import ko from 'ko'; -import { MessagePriority } from 'Common/EnumsUser'; import { i18n } from 'Common/Translator'; import { doc, SettingsGet } from 'Common/Globals'; @@ -87,7 +86,7 @@ export class MessageModel extends AbstractModel { hasVirus: null, // or boolean when scanned dateTimestamp: 0, internalTimestamp: 0, - priority: MessagePriority.Normal, + priority: 3, // Normal senderEmailsString: '', senderClearEmailsString: '', @@ -237,7 +236,7 @@ export class MessageModel extends AbstractModel { checked: this.checked(), unseen: this.isUnseen(), focused: this.focused(), - priorityHigh: this.priority() === MessagePriority.High, + priorityHigh: this.priority() === 1, withAttachments: !!this.attachments().length, // hasChildrenMessage: 1 < this.threadsLen(), hasUnseenSubMessage: this.hasUnseenSubMessage(), diff --git a/dev/Screen/User/MailBox.js b/dev/Screen/User/MailBox.js index a6d721bd4..8450f7648 100644 --- a/dev/Screen/User/MailBox.js +++ b/dev/Screen/User/MailBox.js @@ -1,4 +1,4 @@ -import { Scope } from 'Common/Enums'; +import { ScopeMessageList } from 'Common/Enums'; import { doc, createElement, Settings } from 'Common/Globals'; import { pString, pInt } from 'Common/Utils'; import { moveAction } from 'Common/UtilsUser'; @@ -57,7 +57,7 @@ export class MailBoxUserScreen extends AbstractScreen { onShow() { this.updateWindowTitle(); AppUserStore.focusedState('none'); - AppUserStore.focusedState(Scope.MessageList); + AppUserStore.focusedState(ScopeMessageList); } /** diff --git a/dev/Screen/User/Settings.js b/dev/Screen/User/Settings.js index 1bd88707e..4df2a1574 100644 --- a/dev/Screen/User/Settings.js +++ b/dev/Screen/User/Settings.js @@ -1,4 +1,4 @@ -import { Scope } from 'Common/Enums'; +import { ScopeSettings } from 'Common/Enums'; import { keyScope, SettingsCapa } from 'Common/Globals'; import { runSettingsViewModelHooks } from 'Common/Plugins'; import { initOnStartOrLangChange, i18n } from 'Common/Translator'; @@ -65,7 +65,7 @@ export class SettingsUserScreen extends AbstractSettingsScreen { onShow() { this.setSettingsTitle(); - keyScope(Scope.Settings); + keyScope(ScopeSettings); } setSettingsTitle() { diff --git a/dev/Settings/User/General.js b/dev/Settings/User/General.js index 4de273568..1fe548cc4 100644 --- a/dev/Settings/User/General.js +++ b/dev/Settings/User/General.js @@ -2,7 +2,7 @@ import ko from 'ko'; import { SMAudio } from 'Common/Audio'; import { SaveSettingStatus } from 'Common/Enums'; -import { EditorDefaultType, Layout } from 'Common/EnumsUser'; +import { LayoutSideView, LayoutBottomView } from 'Common/EnumsUser'; import { setRefreshFoldersInterval } from 'Common/Folders'; import { Settings, SettingsGet } from 'Common/Globals'; import { isArray } from 'Common/Utils'; @@ -71,8 +71,8 @@ export class UserSettingsGeneral extends AbstractViewSettings { editorDefaultTypes: () => { translateTrigger(); return [ - { id: EditorDefaultType.Html, name: i18n('SETTINGS_GENERAL/EDITOR_HTML') }, - { id: EditorDefaultType.Plain, name: i18n('SETTINGS_GENERAL/EDITOR_PLAIN') } + { id: 'Html', name: i18n('SETTINGS_GENERAL/EDITOR_HTML') }, + { id: 'Plain', name: i18n('SETTINGS_GENERAL/EDITOR_PLAIN') } ]; }, @@ -88,8 +88,8 @@ export class UserSettingsGeneral extends AbstractViewSettings { translateTrigger(); return [ { id: 0, name: i18n('SETTINGS_GENERAL/LAYOUT_NO_SPLIT') }, - { id: Layout.SidePreview, name: i18n('SETTINGS_GENERAL/LAYOUT_VERTICAL_SPLIT') }, - { id: Layout.BottomPreview, name: i18n('SETTINGS_GENERAL/LAYOUT_HORIZONTAL_SPLIT') } + { id: LayoutSideView, name: i18n('SETTINGS_GENERAL/LAYOUT_VERTICAL_SPLIT') }, + { id: LayoutBottomView, name: i18n('SETTINGS_GENERAL/LAYOUT_HORIZONTAL_SPLIT') } ]; } }); diff --git a/dev/Stores/User/Message.js b/dev/Stores/User/Message.js index a2376c4a6..c49626a58 100644 --- a/dev/Stores/User/Message.js +++ b/dev/Stores/User/Message.js @@ -1,4 +1,4 @@ -import { Scope } from 'Common/Enums'; +import { ScopeMessageList, ScopeMessageView } from 'Common/Enums'; import { elementById } from 'Common/Globals'; import { exitFullscreen } from 'Common/Fullscreen'; import { addObservablesTo, addSubscribablesTo } from 'External/ko'; @@ -25,9 +25,9 @@ export const MessageUserStore = new class { clearTimeout(this.MessageSeenTimer); elementById('rl-right').classList.toggle('message-selected', !!message); if (message) { - SettingsUserStore.usePreviewPane() || AppUserStore.focusedState(Scope.MessageView); + SettingsUserStore.usePreviewPane() || AppUserStore.focusedState(ScopeMessageView); } else { - AppUserStore.focusedState(Scope.MessageList); + AppUserStore.focusedState(ScopeMessageList); exitFullscreen(); } [...(this.bodiesDom()?.children || [])].forEach(el => el.hidden = true); diff --git a/dev/Stores/User/Settings.js b/dev/Stores/User/Settings.js index d1d12bb5f..2be7aef57 100644 --- a/dev/Stores/User/Settings.js +++ b/dev/Stores/User/Settings.js @@ -1,7 +1,7 @@ import ko from 'ko'; import { koComputable, addObservablesTo } from 'External/ko'; -import { Layout } from 'Common/EnumsUser'; +import { LayoutSideView, LayoutBottomView } from 'Common/EnumsUser'; import { pInt } from 'Common/Utils'; import { $htmlCL, SettingsGet, fireEvent } from 'Common/Globals'; import { ThemeStore } from 'Stores/Theme'; @@ -54,8 +54,8 @@ export const SettingsUserStore = new class { const toggleLayout = () => { const value = self.usePreviewPane(); - $htmlCL.toggle('sm-msgView-side', Layout.SidePreview === value); - $htmlCL.toggle('sm-msgView-bottom', Layout.BottomPreview === value); + $htmlCL.toggle('sm-msgView-side', LayoutSideView === value); + $htmlCL.toggle('sm-msgView-bottom', LayoutBottomView === value); fireEvent('rl-layout', value); }; self.layout.subscribe(toggleLayout); diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 9d6dacb1a..c3d362f07 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -7,7 +7,6 @@ import { import { ComposeType, - EditorDefaultType, FolderType } from 'Common/EnumsUser'; @@ -100,7 +99,7 @@ const } }, - isPlainEditor = () => EditorDefaultType.Plain === SettingsUserStore.editorDefaultType(), + isPlainEditor = () => 'Plain' === SettingsUserStore.editorDefaultType(), /** * @param {string} prefix diff --git a/dev/View/User/MailBox/FolderList.js b/dev/View/User/MailBox/FolderList.js index dce24ed33..9c4860886 100644 --- a/dev/View/User/MailBox/FolderList.js +++ b/dev/View/User/MailBox/FolderList.js @@ -1,6 +1,6 @@ import ko from 'ko'; -import { Scope } from 'Common/Enums'; +import { ScopeFolderList, ScopeMessageList } from 'Common/Enums'; import { addShortcut, stopEvent } from 'Common/Globals'; import { mailBox, settings } from 'Common/Links'; //import { setFolderETag } from 'Common/Cache'; @@ -116,12 +116,12 @@ export class MailFolderList extends AbstractViewLeft { hasher.setHash(mailBox(folder.fullNameHash, 1, search)); } - AppUserStore.focusedState(Scope.MessageList); + AppUserStore.focusedState(ScopeMessageList); } } }); - addShortcut('arrowup,arrowdown', '', Scope.FolderList, event => { + addShortcut('arrowup,arrowdown', '', ScopeFolderList, event => { let items = [], index = 0; dom.querySelectorAll('li a').forEach(node => { if (node.offsetHeight || node.getClientRects().length) { @@ -145,17 +145,17 @@ export class MailFolderList extends AbstractViewLeft { return false; }); - addShortcut('enter,open', '', Scope.FolderList, () => { + addShortcut('enter,open', '', ScopeFolderList, () => { const item = qs('li a.focused'); if (item) { - AppUserStore.focusedState(Scope.MessageList); + AppUserStore.focusedState(ScopeMessageList); item.click(); } return false; }); - addShortcut('space', '', Scope.FolderList, () => { + addShortcut('space', '', ScopeFolderList, () => { const item = qs('li a.focused'), folder = item && ko.dataFor(item); if (folder) { @@ -167,9 +167,9 @@ export class MailFolderList extends AbstractViewLeft { return false; }); -// addShortcut('tab', 'shift', Scope.FolderList, () => { - addShortcut('escape,tab,arrowright', '', Scope.FolderList, () => { - AppUserStore.focusedState(Scope.MessageList); +// addShortcut('tab', 'shift', ScopeFolderList, () => { + addShortcut('escape,tab,arrowright', '', ScopeFolderList, () => { + AppUserStore.focusedState(ScopeMessageList); moveAction(false); return false; }); diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index 5a2ae1cd4..8b32d6f50 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -1,7 +1,7 @@ import ko from 'ko'; import { addObservablesTo, addComputablesTo } from 'External/ko'; -import { Scope } from 'Common/Enums'; +import { ScopeFolderList, ScopeMessageList, ScopeMessageView } from 'Common/Enums'; import { ComposeType, FolderType, MessageSetAction } from 'Common/EnumsUser'; @@ -45,7 +45,7 @@ import { ComposePopupView } from 'View/Popup/Compose'; import { MessageModel } from 'Model/Message'; -import { Layout, ClientSideKeyNameMessageListSize } from 'Common/EnumsUser'; +import { LayoutSideView, ClientSideKeyNameMessageListSize } from 'Common/EnumsUser'; import { setLayoutResizer } from 'Common/UtilsUser'; const @@ -426,7 +426,7 @@ export class MailMessageList extends AbstractViewRight { } let b = moveAction(); - AppUserStore.focusedState(b ? Scope.MessageList : Scope.FolderList); + AppUserStore.focusedState(b ? ScopeMessageList : ScopeFolderList); moveAction(!b); } } @@ -569,7 +569,7 @@ export class MailMessageList extends AbstractViewRight { fToggle = () => { let layout = SettingsUserStore.usePreviewPane(); setLayoutResizer(top, ClientSideKeyNameMessageListSize, - layout ? (Layout.SidePreview === layout ? 'Width' : 'Height') : 0 + layout ? (LayoutSideView === layout ? 'Width' : 'Height') : 0 ); }; if (top) { @@ -578,14 +578,14 @@ export class MailMessageList extends AbstractViewRight { } }, 1); - this.selector.init(b_content, Scope.MessageList); + this.selector.init(b_content, ScopeMessageList); addEventsListeners(dom, { click: event => { ThemeStore.isMobile() && !eqs(event, '.toggleLeft') && leftPanelDisabled(true); - if (eqs(event, '.messageList') && Scope.MessageView === AppUserStore.focusedState()) { - AppUserStore.focusedState(Scope.MessageList); + if (eqs(event, '.messageList') && ScopeMessageView === AppUserStore.focusedState()) { + AppUserStore.focusedState(ScopeMessageList); } let el = eqs(event, '.e-paginator a'); @@ -667,7 +667,7 @@ export class MailMessageList extends AbstractViewRight { // initShortcuts - addShortcut('enter,open', '', Scope.MessageList, () => { + addShortcut('enter,open', '', ScopeMessageList, () => { if (formFieldFocused()) { MessagelistUserStore.mainSearch(sLastSearchValue); return false; @@ -679,42 +679,42 @@ export class MailMessageList extends AbstractViewRight { }); // archive (zip) - registerShortcut('z', '', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('z', '', [ScopeMessageList, ScopeMessageView], () => { this.archiveCommand(); return false; }); // delete - registerShortcut('delete', 'shift', Scope.MessageList, () => { + registerShortcut('delete', 'shift', ScopeMessageList, () => { MessagelistUserStore.listCheckedOrSelected().length && this.deleteWithoutMoveCommand(); return false; }); -// registerShortcut('3', 'shift', Scope.MessageList, () => { - registerShortcut('delete', '', Scope.MessageList, () => { +// registerShortcut('3', 'shift', ScopeMessageList, () => { + registerShortcut('delete', '', ScopeMessageList, () => { MessagelistUserStore.listCheckedOrSelected().length && this.deleteCommand(); return false; }); // check mail - addShortcut('r', 'meta', [Scope.FolderList, Scope.MessageList, Scope.MessageView], () => { + addShortcut('r', 'meta', [ScopeFolderList, ScopeMessageList, ScopeMessageView], () => { this.reload(); return false; }); // check all - registerShortcut('a', 'meta', Scope.MessageList, () => { + registerShortcut('a', 'meta', ScopeMessageList, () => { this.checkAll(!(this.checkAll() && !this.isIncompleteChecked())); return false; }); // write/compose (open compose popup) - registerShortcut('w,c,new', '', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('w,c,new', '', [ScopeMessageList, ScopeMessageView], () => { showMessageComposer(); return false; }); // important - star/flag messages - registerShortcut('i', '', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('i', '', [ScopeMessageList, ScopeMessageView], () => { const checked = MessagelistUserStore.listCheckedOrSelected(); if (checked.length) { listAction( @@ -726,7 +726,7 @@ export class MailMessageList extends AbstractViewRight { return false; }); - registerShortcut('t', '', [Scope.MessageList], () => { + registerShortcut('t', '', [ScopeMessageList], () => { let message = MessagelistUserStore.selectedMessage() || MessagelistUserStore.focusedMessage(); if (0 < message?.threadsLen()) { this.gotoThread(message); @@ -735,38 +735,38 @@ export class MailMessageList extends AbstractViewRight { }); // move - registerShortcut('insert', '', Scope.MessageList, () => { + registerShortcut('insert', '', ScopeMessageList, () => { this.moveCommand(); return false; }); // read - registerShortcut('q', '', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('q', '', [ScopeMessageList, ScopeMessageView], () => { this.seenMessagesFast(true); return false; }); // unread - registerShortcut('u', '', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('u', '', [ScopeMessageList, ScopeMessageView], () => { this.seenMessagesFast(false); return false; }); - registerShortcut('f,mailforward', 'shift', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('f,mailforward', 'shift', [ScopeMessageList, ScopeMessageView], () => { this.forwardCommand(); return false; }); if (SettingsCapa('Search')) { // search input focus - addShortcut('/', '', [Scope.MessageList, Scope.MessageView], () => { + addShortcut('/', '', [ScopeMessageList, ScopeMessageView], () => { this.focusSearch(true); return false; }); } // cancel search - addShortcut('escape', '', Scope.MessageList, () => { + addShortcut('escape', '', ScopeMessageList, () => { if (this.messageListSearchDesc()) { this.cancelSearch(); return false; @@ -777,25 +777,25 @@ export class MailMessageList extends AbstractViewRight { }); // change focused state - addShortcut('tab', 'shift', Scope.MessageList, () => { - AppUserStore.focusedState(Scope.FolderList); + addShortcut('tab', 'shift', ScopeMessageList, () => { + AppUserStore.focusedState(ScopeFolderList); return false; }); - addShortcut('arrowleft', '', Scope.MessageList, () => { - AppUserStore.focusedState(Scope.FolderList); + addShortcut('arrowleft', '', ScopeMessageList, () => { + AppUserStore.focusedState(ScopeFolderList); return false; }); - addShortcut('tab,arrowright', '', Scope.MessageList, () => { + addShortcut('tab,arrowright', '', ScopeMessageList, () => { if (MessageUserStore.message()) { - AppUserStore.focusedState(Scope.MessageView); + AppUserStore.focusedState(ScopeMessageView); return false; } }); - addShortcut('arrowleft', 'meta', Scope.MessageView, ()=>false); - addShortcut('arrowright', 'meta', Scope.MessageView, ()=>false); + addShortcut('arrowleft', 'meta', ScopeMessageView, ()=>false); + addShortcut('arrowright', 'meta', ScopeMessageView, ()=>false); - addShortcut('f', 'meta', Scope.MessageList, this.advancedSearchClick); + addShortcut('f', 'meta', ScopeMessageList, this.advancedSearchClick); } advancedSearchClick() { diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index ff7bd4caa..9bfa4f7e3 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -1,7 +1,7 @@ import ko from 'ko'; import { addObservablesTo, addComputablesTo, addSubscribablesTo } from 'External/ko'; -import { Scope } from 'Common/Enums'; +import { ScopeMessageList, ScopeMessageView } from 'Common/Enums'; import { ComposeType, @@ -335,23 +335,23 @@ export class MailMessageView extends AbstractViewRight { } }); - keyScopeReal.subscribe(value => this.messageDomFocused(Scope.MessageView === value)); + keyScopeReal.subscribe(value => this.messageDomFocused(ScopeMessageView === value)); // initShortcuts // exit fullscreen, back - addShortcut('escape', '', Scope.MessageView, () => { + addShortcut('escape', '', ScopeMessageView, () => { if (!this.viewModelDom.hidden && currentMessage()) { const preview = SettingsUserStore.usePreviewPane(); if (isFullscreen()) { exitFullscreen(); if (preview) { - AppUserStore.focusedState(Scope.MessageList); + AppUserStore.focusedState(ScopeMessageList); } } else if (!preview) { currentMessage(null); } else { - AppUserStore.focusedState(Scope.MessageList); + AppUserStore.focusedState(ScopeMessageList); } return false; @@ -359,13 +359,13 @@ export class MailMessageView extends AbstractViewRight { }); // fullscreen - addShortcut('enter,open', '', Scope.MessageView, () => { + addShortcut('enter,open', '', ScopeMessageView, () => { isFullscreen() || toggleFullscreen(); return false; }); // reply - registerShortcut('r,mailreply', '', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('r,mailreply', '', [ScopeMessageList, ScopeMessageView], () => { if (currentMessage()) { this.replyCommand(); return false; @@ -374,13 +374,13 @@ export class MailMessageView extends AbstractViewRight { }); // replyAll - registerShortcut('a', '', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('a', '', [ScopeMessageList, ScopeMessageView], () => { if (currentMessage()) { this.replyAllCommand(); return false; } }); - registerShortcut('mailreply', 'shift', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('mailreply', 'shift', [ScopeMessageList, ScopeMessageView], () => { if (currentMessage()) { this.replyAllCommand(); return false; @@ -388,7 +388,7 @@ export class MailMessageView extends AbstractViewRight { }); // forward - registerShortcut('f,mailforward', '', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('f,mailforward', '', [ScopeMessageList, ScopeMessageView], () => { if (currentMessage()) { this.forwardCommand(); return false; @@ -396,13 +396,13 @@ export class MailMessageView extends AbstractViewRight { }); // message information - registerShortcut('i', 'meta', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('i', 'meta', [ScopeMessageList, ScopeMessageView], () => { currentMessage() && this.toggleFullInfo(); return false; }); // toggle message blockquotes - registerShortcut('b', '', [Scope.MessageList, Scope.MessageView], () => { + registerShortcut('b', '', [ScopeMessageList, ScopeMessageView], () => { const message = currentMessage(); if (message?.body) { message.body.querySelectorAll('details').forEach(node => node.open = !node.open); @@ -410,37 +410,37 @@ export class MailMessageView extends AbstractViewRight { } }); - addShortcut('arrowup,arrowleft', 'meta', [Scope.MessageList, Scope.MessageView], () => { + addShortcut('arrowup,arrowleft', 'meta', [ScopeMessageList, ScopeMessageView], () => { this.goUpCommand(); return false; }); - addShortcut('arrowdown,arrowright', 'meta', [Scope.MessageList, Scope.MessageView], () => { + addShortcut('arrowdown,arrowright', 'meta', [ScopeMessageList, ScopeMessageView], () => { this.goDownCommand(); return false; }); // delete - addShortcut('delete', '', Scope.MessageView, () => { + addShortcut('delete', '', ScopeMessageView, () => { this.deleteCommand(); return false; }); - addShortcut('delete', 'shift', Scope.MessageView, () => { + addShortcut('delete', 'shift', ScopeMessageView, () => { this.deleteWithoutMoveCommand(); return false; }); // change focused state - addShortcut('arrowleft', '', Scope.MessageView, () => { + addShortcut('arrowleft', '', ScopeMessageView, () => { if (!isFullscreen() && currentMessage() && SettingsUserStore.usePreviewPane() && !oMessageScrollerDom().scrollLeft) { - AppUserStore.focusedState(Scope.MessageList); + AppUserStore.focusedState(ScopeMessageList); return false; } }); - addShortcut('tab', 'shift', Scope.MessageView, () => { + addShortcut('tab', 'shift', ScopeMessageView, () => { if (!isFullscreen() && currentMessage() && SettingsUserStore.usePreviewPane()) { - AppUserStore.focusedState(Scope.MessageList); + AppUserStore.focusedState(ScopeMessageList); } return false; }); diff --git a/dev/View/User/SystemDropDown.js b/dev/View/User/SystemDropDown.js index 9d57e1458..04687d8fe 100644 --- a/dev/View/User/SystemDropDown.js +++ b/dev/View/User/SystemDropDown.js @@ -2,7 +2,7 @@ import { AppUserStore } from 'Stores/User/App'; import { AccountUserStore } from 'Stores/User/Account'; //import { FolderUserStore } from 'Stores/User/Folder'; -import { Scope } from 'Common/Enums'; +import { ScopeMessageList, ScopeMessageView, ScopeSettings } from 'Common/Enums'; import { settings } from 'Common/Links'; import { showScreenPopup } from 'Knoin/Knoin'; @@ -112,7 +112,7 @@ export class SystemDropDownUserView extends AbstractViewRight { } onBuild() { - registerShortcut('m', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => { + registerShortcut('m', '', [ScopeMessageList, ScopeMessageView, ScopeSettings], () => { if (!this.viewModelDom.hidden) { // exitFullscreen(); this.accountMenuDropdownTrigger(true); @@ -121,7 +121,7 @@ export class SystemDropDownUserView extends AbstractViewRight { }); // shortcuts help - registerShortcut('?,f1,help', '', [Scope.MessageList, Scope.MessageView, Scope.Settings], () => { + registerShortcut('?,f1,help', '', [ScopeMessageList, ScopeMessageView, ScopeSettings], () => { if (!this.viewModelDom.hidden) { showScreenPopup(KeyboardShortcutsHelpPopupView); return false;