1 import { c } from 'ttag';
3 import isTruthy from '@proton/utils/isTruthy';
5 import { altKey, isSafari as checkIsSafari, metaKey, shiftKey } from '../helpers/browser';
6 import type { KeyboardKeyType } from '../interfaces';
8 export const editorShortcuts: Record<string, KeyboardKeyType[]> = {
9 addAttachment: ['Meta', 'Shift', 'A'],
10 addEncryption: ['Meta', 'Shift', 'E'],
11 addExpiration: ['Meta', 'Shift', 'X'],
12 addLink: ['Meta', 'K'],
14 deleteDraft: ['Meta', 'Alt', 'Backspace'],
15 maximize: ['Meta', 'Shift', 'M'],
16 minimize: ['Meta', 'M'],
18 send: ['Meta', 'Enter'],
19 emojiPicker: ['Meta', 'E'] as KeyboardKeyType[],
22 export const getShortcuts = () => {
23 const isSafari = checkIsSafari();
27 name: c('Keyboard shortcut section name').t`Basic navigation`,
31 name: c('Keyboard shortcut name').t`Move up`,
35 name: c('Keyboard shortcut name').t`Jump to first`,
36 keys: `${metaKey} + ↑`,
39 name: c('Keyboard shortcut name').t`Move down`,
43 name: c('Keyboard shortcut name').t`Jump to last`,
44 keys: `${metaKey} + ↓`,
47 name: c('Keyboard shortcut name').t`Move right / expand`,
51 name: c('Keyboard shortcut name').t`Move left / collapse`,
57 name: c('Keyboard shortcut section name').t`Basic actions`,
61 name: c('Keyboard shortcut name').t`Apply / open`,
65 name: c('Keyboard shortcut name').t`Cancel / close`,
69 name: c('Keyboard shortcut name').t`Open this modal`,
73 name: c('Keyboard shortcut name').t`Select / unselect`,
77 name: c('Keyboard shortcut name').t`Open command panel`,
78 keys: `${metaKey} + K`,
83 name: c('Keyboard shortcut section name').t`Folder shortcuts`,
86 name: c('Keyboard shortcut name').t`Go to Inbox`,
90 name: c('Keyboard shortcut name').t`Go to Archive`,
94 name: c('Keyboard shortcut name').t`Go to Sent`,
98 name: c('Keyboard shortcut name').t`Go to Starred`,
102 name: c('Keyboard shortcut name').t`Go to Drafts`,
106 name: c('Keyboard shortcut name').t`Go to Trash`,
110 name: c('Keyboard shortcut name').t`Go to Spam`,
114 name: c('Keyboard shortcut name').t`Go to All Mail`,
120 name: c('Keyboard shortcut section name').t`Composer shortcuts`,
123 name: c('Keyboard shortcut name').t`Save draft`,
124 keys: `${metaKey} + S`,
127 name: c('Keyboard shortcut name').t`Send email`,
128 keys: `${metaKey} + Enter`,
131 name: c('Keyboard shortcut name').t`Close draft`,
135 name: c('Keyboard shortcut name').t`Minimize / maximize composer`,
136 keys: `${metaKey} + M`,
139 name: c('Keyboard shortcut name').t`Expand / contract composer`,
140 keys: `${metaKey} + ${shiftKey} + M`,
143 name: c('Keyboard shortcut name').t`Attach file`,
144 keys: `${metaKey} + ${shiftKey} + A`,
147 name: c('Keyboard shortcut name').t`Add expiration time`,
148 keys: `${metaKey} + ${shiftKey} + X`,
151 name: c('Keyboard shortcut name').t`Add encryption`,
152 keys: `${metaKey} + ${shiftKey} + E`,
155 name: c('Keyboard shortcut name').t`Insert link`,
156 keys: `${metaKey} + K`,
159 name: c('Keyboard shortcut name').t`Discard draft`,
160 keys: `${metaKey} + ${altKey} + Backspace`,
165 name: c('Keyboard shortcut section name').t`List shortcuts`,
168 name: c('Keyboard shortcut name').t`Open previous message`,
172 name: c('Keyboard shortcut name').t`Open next message`,
176 name: c('Keyboard shortcut name').t`Select / unselect`,
180 name: c('Keyboard shortcut name').t`Show unread emails`,
181 keys: `${shiftKey} + U`,
184 name: c('Keyboard shortcut name').t`Show all emails`,
185 keys: `${shiftKey} + A`,
188 name: c('Keyboard shortcut name').t`Select / unselect all`,
189 keys: `${metaKey} + A`,
192 name: c('Keyboard shortcut name').t`Search`,
198 name: c('Keyboard shortcut section name').t`Action shortcuts`,
201 name: c('Keyboard shortcut name').t`New message`,
205 name: c('Keyboard shortcut name').t`Star`,
209 name: c('Keyboard shortcut name').t`Mark as unread`,
213 name: c('Keyboard shortcut name').t`Mark as read`,
217 name: c('Keyboard shortcut name').t`Label as...`,
221 name: c('Keyboard shortcut name').t`Filter`,
225 name: c('Keyboard shortcut name').t`Move to...`,
229 name: c('Keyboard shortcut name').t`Move to Inbox`,
233 name: c('Keyboard shortcut name').t`Move to Archive`,
237 name: c('Keyboard shortcut name').t`Move to Spam`,
241 name: c('Keyboard shortcut name').t`Move to Trash`,
245 name: c('Keyboard shortcut name').t`Delete permanently`,
246 keys: `${metaKey} + Backspace`,
251 name: c('Keyboard shortcut section name').t`Message shortcuts`,
254 name: c('Keyboard shortcut name').t`Reply`,
258 name: c('Keyboard shortcut name').t`Reply all`,
259 keys: `${shiftKey} + R`,
262 name: c('Keyboard shortcut name').t`Forward`,
263 keys: `${shiftKey} + F`,
266 name: c('Keyboard shortcut name').t`Load remote content`,
267 keys: `${shiftKey} + C`,
270 name: c('Keyboard shortcut name').t`Load embedded images`,
271 keys: `${shiftKey} + E`,
274 name: c('Keyboard shortcut name').t`Show original message`,