mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Merge branch 'develop' of github.com:getinsomnia/insomnia into develop
This commit is contained in:
commit
931f01c447
@ -73,6 +73,7 @@ export const PLUGIN_PATH = path.join(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Hotkeys
|
// Hotkeys
|
||||||
|
export const MNEMONIC_SYM = isMac() ? '' : '&';
|
||||||
export const MOD_SYM = isMac() ? '⌘' : 'Ctrl';
|
export const MOD_SYM = isMac() ? '⌘' : 'Ctrl';
|
||||||
export const ALT_SYM = isMac() ? '⌃' : 'Alt';
|
export const ALT_SYM = isMac() ? '⌃' : 'Alt';
|
||||||
export const SHIFT_SYM = isMac() ? '⇧' : 'Shift';
|
export const SHIFT_SYM = isMac() ? '⇧' : 'Shift';
|
||||||
|
@ -27,6 +27,14 @@ export const SHOW_REQUEST_SETTINGS: Hotkey = {
|
|||||||
keycode: keycodes.comma
|
keycode: keycodes.comma
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const SHOW_KEYBOARD_SHORTCUTS: Hotkey = {
|
||||||
|
description: 'Show Keyboard Shortcuts',
|
||||||
|
meta: true,
|
||||||
|
alt: false,
|
||||||
|
shift: true,
|
||||||
|
keycode: keycodes.forwardslash
|
||||||
|
};
|
||||||
|
|
||||||
export const SHOW_SETTINGS: Hotkey = {
|
export const SHOW_SETTINGS: Hotkey = {
|
||||||
description: 'Show App Preferences',
|
description: 'Show App Preferences',
|
||||||
meta: true,
|
meta: true,
|
||||||
|
@ -5,6 +5,7 @@ import fs from 'fs';
|
|||||||
import LocalStorage from './local-storage';
|
import LocalStorage from './local-storage';
|
||||||
import {
|
import {
|
||||||
CHANGELOG_BASE_URL,
|
CHANGELOG_BASE_URL,
|
||||||
|
MNEMONIC_SYM,
|
||||||
getAppLongName,
|
getAppLongName,
|
||||||
getAppName,
|
getAppName,
|
||||||
getAppVersion,
|
getAppVersion,
|
||||||
@ -94,13 +95,13 @@ export function createWindow() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const applicationMenu = {
|
const applicationMenu = {
|
||||||
label: 'Application',
|
label: `${MNEMONIC_SYM}Application`,
|
||||||
submenu: [
|
submenu: [
|
||||||
...(isMac()
|
...(isMac()
|
||||||
? [{ label: `About ${getAppName()}`, role: 'about' }, { type: 'separator' }]
|
? [{ label: `A${MNEMONIC_SYM}bout ${getAppName()}`, role: 'about' }, { type: 'separator' }]
|
||||||
: []),
|
: []),
|
||||||
{
|
{
|
||||||
label: 'Preferences',
|
label: `${MNEMONIC_SYM}Preferences`,
|
||||||
accelerator: 'CmdOrCtrl+,',
|
accelerator: 'CmdOrCtrl+,',
|
||||||
click: function(menuItem, window, e) {
|
click: function(menuItem, window, e) {
|
||||||
if (!window || !window.webContents) {
|
if (!window || !window.webContents) {
|
||||||
@ -110,7 +111,7 @@ export function createWindow() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Changelog',
|
label: `${MNEMONIC_SYM}Changelog`,
|
||||||
click: function(menuItem, window, e) {
|
click: function(menuItem, window, e) {
|
||||||
if (!window || !window.webContents) {
|
if (!window || !window.webContents) {
|
||||||
return;
|
return;
|
||||||
@ -120,21 +121,21 @@ export function createWindow() {
|
|||||||
},
|
},
|
||||||
...(isMac() ? [{ type: 'separator' }, { role: 'hide' }, { role: 'hideothers' }] : []),
|
...(isMac() ? [{ type: 'separator' }, { role: 'hide' }, { role: 'hideothers' }] : []),
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ label: 'Quit', accelerator: 'CmdOrCtrl+Q', click: () => app.quit() }
|
{ label: `${MNEMONIC_SYM}Quit`, accelerator: 'CmdOrCtrl+Q', click: () => app.quit() }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const editMenu = {
|
const editMenu = {
|
||||||
label: 'Edit',
|
label: `${MNEMONIC_SYM}Edit`,
|
||||||
submenu: [
|
submenu: [
|
||||||
{ label: 'Undo', accelerator: 'CmdOrCtrl+Z', selector: 'undo:' },
|
{ label: `${MNEMONIC_SYM}Undo`, accelerator: 'CmdOrCtrl+Z', selector: 'undo:' },
|
||||||
{ label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', selector: 'redo:' },
|
{ label: `${MNEMONIC_SYM}Redo`, accelerator: 'Shift+CmdOrCtrl+Z', selector: 'redo:' },
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ label: 'Cut', accelerator: 'CmdOrCtrl+X', selector: 'cut:' },
|
{ label: `Cu${MNEMONIC_SYM}t`, accelerator: 'CmdOrCtrl+X', selector: 'cut:' },
|
||||||
{ label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:' },
|
{ label: `${MNEMONIC_SYM}Copy`, accelerator: 'CmdOrCtrl+C', selector: 'copy:' },
|
||||||
{ label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:' },
|
{ label: `${MNEMONIC_SYM}Paste`, accelerator: 'CmdOrCtrl+V', selector: 'paste:' },
|
||||||
{
|
{
|
||||||
label: 'Select All',
|
label: `Select ${MNEMONIC_SYM}All`,
|
||||||
accelerator: 'CmdOrCtrl+A',
|
accelerator: 'CmdOrCtrl+A',
|
||||||
selector: 'selectAll:'
|
selector: 'selectAll:'
|
||||||
}
|
}
|
||||||
@ -142,11 +143,11 @@ export function createWindow() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const viewMenu = {
|
const viewMenu = {
|
||||||
label: 'View',
|
label: `${MNEMONIC_SYM}View`,
|
||||||
submenu: [
|
submenu: [
|
||||||
{ role: 'togglefullscreen' },
|
{ label: `Toggle ${MNEMONIC_SYM}Full Screen`, role: 'togglefullscreen' },
|
||||||
{
|
{
|
||||||
label: 'Actual Size',
|
label: `${MNEMONIC_SYM}Actual Size`,
|
||||||
accelerator: 'CmdOrCtrl+0',
|
accelerator: 'CmdOrCtrl+0',
|
||||||
click: () => {
|
click: () => {
|
||||||
const window = BrowserWindow.getFocusedWindow();
|
const window = BrowserWindow.getFocusedWindow();
|
||||||
@ -160,7 +161,7 @@ export function createWindow() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Zoom In',
|
label: `Zoom ${MNEMONIC_SYM}In`,
|
||||||
accelerator: isMac() ? 'CmdOrCtrl+Plus' : 'CmdOrCtrl+=',
|
accelerator: isMac() ? 'CmdOrCtrl+Plus' : 'CmdOrCtrl+=',
|
||||||
click: () => {
|
click: () => {
|
||||||
const window = BrowserWindow.getFocusedWindow();
|
const window = BrowserWindow.getFocusedWindow();
|
||||||
@ -175,7 +176,7 @@ export function createWindow() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Zoom Out',
|
label: `Zoom ${MNEMONIC_SYM}Out`,
|
||||||
accelerator: 'CmdOrCtrl+-',
|
accelerator: 'CmdOrCtrl+-',
|
||||||
click: () => {
|
click: () => {
|
||||||
const window = BrowserWindow.getFocusedWindow();
|
const window = BrowserWindow.getFocusedWindow();
|
||||||
@ -189,7 +190,7 @@ export function createWindow() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Toggle Sidebar',
|
label: `Toggle ${MNEMONIC_SYM}Sidebar`,
|
||||||
accelerator: 'CmdOrCtrl+\\',
|
accelerator: 'CmdOrCtrl+\\',
|
||||||
click: () => {
|
click: () => {
|
||||||
const window = BrowserWindow.getFocusedWindow();
|
const window = BrowserWindow.getFocusedWindow();
|
||||||
@ -201,31 +202,35 @@ export function createWindow() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Toggle DevTools',
|
label: `Toggle ${MNEMONIC_SYM}DevTools`,
|
||||||
click: () => mainWindow.toggleDevTools()
|
click: () => mainWindow.toggleDevTools()
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const windowMenu = {
|
const windowMenu = {
|
||||||
label: 'Window',
|
label: `${MNEMONIC_SYM}Window`,
|
||||||
role: 'window',
|
role: 'window',
|
||||||
submenu: [{ role: 'minimize' }, ...(isMac() ? [{ role: 'close' }] : [])]
|
submenu: [
|
||||||
|
{ label: `${MNEMONIC_SYM}Minimize`, role: 'minimize' },
|
||||||
|
...(isMac() ? [{ label: `${MNEMONIC_SYM}Close`, role: 'close' }] : [])
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const helpMenu = {
|
const helpMenu = {
|
||||||
label: 'Help',
|
label: `${MNEMONIC_SYM}Help`,
|
||||||
role: 'help',
|
role: 'help',
|
||||||
id: 'help',
|
id: 'help',
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: 'Contact Support',
|
label: `Contact ${MNEMONIC_SYM}Support`,
|
||||||
click: () => {
|
click: () => {
|
||||||
shell.openExternal('https://insomnia.rest/support/');
|
shell.openExternal('https://insomnia.rest/support/');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Keyboard Shortcuts',
|
label: `${MNEMONIC_SYM}Keyboard Shortcuts`,
|
||||||
|
accelerator: 'CmdOrCtrl+Shift+?',
|
||||||
click: (menuItem, window, e) => {
|
click: (menuItem, window, e) => {
|
||||||
if (!window || !window.webContents) {
|
if (!window || !window.webContents) {
|
||||||
return;
|
return;
|
||||||
@ -234,14 +239,15 @@ export function createWindow() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Show App Data Folder',
|
label: `Show App ${MNEMONIC_SYM}Data Folder`,
|
||||||
click: (menuItem, window, e) => {
|
click: (menuItem, window, e) => {
|
||||||
const directory = misc.getDataDirectory();
|
const directory = misc.getDataDirectory();
|
||||||
shell.showItemInFolder(directory);
|
shell.showItemInFolder(directory);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Insomnia Help',
|
label: `Insomnia ${MNEMONIC_SYM}Help`,
|
||||||
|
accelerator: !isMac() ? 'F1' : null,
|
||||||
click: () => {
|
click: () => {
|
||||||
shell.openExternal('https://support.insomnia.rest');
|
shell.openExternal('https://support.insomnia.rest');
|
||||||
}
|
}
|
||||||
@ -251,7 +257,7 @@ export function createWindow() {
|
|||||||
|
|
||||||
if (!isMac()) {
|
if (!isMac()) {
|
||||||
helpMenu.submenu.unshift({
|
helpMenu.submenu.unshift({
|
||||||
label: 'About',
|
label: `${MNEMONIC_SYM}About`,
|
||||||
click: () => {
|
click: () => {
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
@ -272,21 +278,21 @@ export function createWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const developerMenu = {
|
const developerMenu = {
|
||||||
label: 'Developer',
|
label: `${MNEMONIC_SYM}Developer`,
|
||||||
position: 'before=help',
|
position: 'before=help',
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: 'Reload',
|
label: `${MNEMONIC_SYM}Reload`,
|
||||||
accelerator: 'Shift+F5',
|
accelerator: 'Shift+F5',
|
||||||
click: () => mainWindow.reload()
|
click: () => mainWindow.reload()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Toggle DevTools',
|
label: `Toggle ${MNEMONIC_SYM}DevTools`,
|
||||||
accelerator: 'Alt+CmdOrCtrl+I',
|
accelerator: 'Alt+CmdOrCtrl+I',
|
||||||
click: () => mainWindow.toggleDevTools()
|
click: () => mainWindow.toggleDevTools()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Resize to Default',
|
label: `Resize to Defaul${MNEMONIC_SYM}t`,
|
||||||
click: () =>
|
click: () =>
|
||||||
mainWindow.setBounds({
|
mainWindow.setBounds({
|
||||||
x: 100,
|
x: 100,
|
||||||
@ -296,7 +302,7 @@ export function createWindow() {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Take Screenshot',
|
label: `Take ${MNEMONIC_SYM}Screenshot`,
|
||||||
click: function() {
|
click: function() {
|
||||||
mainWindow.capturePage(image => {
|
mainWindow.capturePage(image => {
|
||||||
const buffer = image.toPNG();
|
const buffer = image.toPNG();
|
||||||
@ -309,10 +315,10 @@ export function createWindow() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toolsMenu = {
|
const toolsMenu = {
|
||||||
label: 'Tools',
|
label: `${MNEMONIC_SYM}Tools`,
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: 'Reload Plugins',
|
label: `${MNEMONIC_SYM}Reload Plugins`,
|
||||||
accelerator: 'CmdOrCtrl+Shift+R',
|
accelerator: 'CmdOrCtrl+Shift+R',
|
||||||
click: () => {
|
click: () => {
|
||||||
const window = BrowserWindow.getFocusedWindow();
|
const window = BrowserWindow.getFocusedWindow();
|
||||||
|
@ -23,6 +23,7 @@ class Shortcuts extends PureComponent {
|
|||||||
<div>
|
<div>
|
||||||
<table className="table--fancy">
|
<table className="table--fancy">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
{this.renderHotkey(hotkeys.SHOW_KEYBOARD_SHORTCUTS)}
|
||||||
{this.renderHotkey(hotkeys.SHOW_QUICK_SWITCHER)}
|
{this.renderHotkey(hotkeys.SHOW_QUICK_SWITCHER)}
|
||||||
{this.renderHotkey(hotkeys.SEND_REQUEST)}
|
{this.renderHotkey(hotkeys.SEND_REQUEST)}
|
||||||
{this.renderHotkey(hotkeys.SHOW_SEND_OPTIONS)}
|
{this.renderHotkey(hotkeys.SHOW_SEND_OPTIONS)}
|
||||||
|
@ -99,6 +99,12 @@ class App extends PureComponent {
|
|||||||
|
|
||||||
_setGlobalKeyMap() {
|
_setGlobalKeyMap() {
|
||||||
this._globalKeyMap = [
|
this._globalKeyMap = [
|
||||||
|
[
|
||||||
|
hotkeys.SHOW_KEYBOARD_SHORTCUTS,
|
||||||
|
() => {
|
||||||
|
showModal(SettingsModal, TAB_INDEX_SHORTCUTS);
|
||||||
|
}
|
||||||
|
],
|
||||||
[
|
[
|
||||||
hotkeys.SHOW_WORKSPACE_SETTINGS,
|
hotkeys.SHOW_WORKSPACE_SETTINGS,
|
||||||
() => {
|
() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user