'use strict'; import { shell } from 'electron'; import BaseSection = require('./base-section'); class ShortcutsSection extends BaseSection { // TODO: TypeScript - Here props should be object type props: any; constructor(props: any) { super(); this.props = props; } // TODO - Deduplicate templateMac and templateWinLin functions. In theory // they both should be the same the only thing different should be the userOSKey // variable but there seems to be inconsistences between both function, one has more // lines though one may just be using more new lines and other thing is the use of +. templateMac(): string { const userOSKey = '⌘'; return `

settingsTip: These desktop app shortcuts extend the Zulip webapp's keyboard shortcuts.

Application Shortcuts
${userOSKey}, Settings
${userOSKey}K Keyboard Shortcuts
${userOSKey} + Shift + M Toggle Do Not Disturb
Shift${userOSKey}D Reset App Settings
${userOSKey}L Log Out
${userOSKey}H Hide Zulip
Option${userOSKey}H Hide Others
${userOSKey}Q Quit Zulip
Edit Shortcuts
${userOSKey}Z Undo
Shift${userOSKey}Z Redo
${userOSKey}X Cut
${userOSKey}C Copy
${userOSKey}V Paste
Shift${userOSKey}V Paste and Match Style
${userOSKey}A Select All
Control${userOSKey}Space Emoji & Symbols
View Shortcuts
${userOSKey}R Reload
Shift${userOSKey}R Hard Reload
Control${userOSKey}F Enter Full Screen
${userOSKey}+ Zoom In
${userOSKey}- Zoom Out
${userOSKey}0 Actual Size
${userOSKey} + Shift + S Toggle Sidebar
Option${userOSKey}I Toggle DevTools for Zulip App
Option${userOSKey}U Toggle DevTools for Active Tab
Ctrl + Tab Switch to Next Organization
Ctrl + Shift + Tab Switch to Previous Organization
History Shortcuts
${userOSKey} Back
${userOSKey} Forward
Window Shortcuts
${userOSKey}M Minimize
${userOSKey}W Close
`; } templateWinLin(): string { const userOSKey = 'Ctrl'; return `

settingsTip: These desktop app shortcuts extend the Zulip webapp's keyboard shortcuts.

Application Shortcuts
${userOSKey} + , Settings
${userOSKey} + K Keyboard Shortcuts
${userOSKey} + Shift + M Toggle Do Not Disturb
${userOSKey} + L Log Out
${userOSKey} + Q Quit Zulip
Edit Shortcuts
${userOSKey} + Z Undo
${userOSKey} + Y Redo
${userOSKey} + X Cut
${userOSKey} + C Copy
${userOSKey} + V Paste
${userOSKey} + Shift + V Paste and Match Style
${userOSKey} + A Select All
View Shortcuts
${userOSKey} + R Reload
${userOSKey} + Shift + R Hard Reload
F11 Toggle Full Screen
${userOSKey} + = Zoom In
${userOSKey} + - Zoom Out
${userOSKey} + 0 Actual Size
${userOSKey} + Shift + S Toggle Sidebar
${userOSKey} + Shift + I Toggle DevTools for Zulip App
${userOSKey} + Shift + U Toggle DevTools for Active Tab
${userOSKey} + Tab Switch to Next Organization
${userOSKey} + Shift + Tab Switch to Previous Organization
History Shortcuts
Alt + Back
Alt + Forward
Window Shortcuts
${userOSKey} + M Minimize
${userOSKey} + W Close
`; } openHotkeysExternalLink(): void { const link = 'https://zulipchat.com/help/keyboard-shortcuts'; const externalCreateNewOrgEl = document.querySelector('#open-hotkeys-link'); externalCreateNewOrgEl.addEventListener('click', () => { shell.openExternal(link); }); } init(): void { this.props.$root.innerHTML = (process.platform === 'darwin') ? this.templateMac() : this.templateWinLin(); this.openHotkeysExternalLink(); } } export = ShortcutsSection;