feat: response shortcuts (#2705)
This commit is contained in:
@@ -32,6 +32,9 @@ export type HoppAction =
|
||||
| "settings.theme.light" // Use light theme
|
||||
| "settings.theme.dark" // Use dark theme
|
||||
| "settings.theme.black" // Use black theme
|
||||
| "response.preview.toggle" // Toggle response preview
|
||||
| "response.file.download" // Download response as file
|
||||
| "response.copy" // Copy response to clipboard
|
||||
|
||||
type BoundActionList = {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
@@ -23,7 +23,7 @@ type Key =
|
||||
| "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t"
|
||||
| "u" | "v" | "w" | "x" | "y" | "z" | "0" | "1" | "2" | "3"
|
||||
| "4" | "5" | "6" | "7" | "8" | "9" | "up" | "down" | "left"
|
||||
| "right" | "/" | "?"
|
||||
| "right" | "/" | "?" | "."
|
||||
/* eslint-enable */
|
||||
|
||||
type ModifierBasedShortcutKey = `${ModifierKeys}-${Key}`
|
||||
@@ -58,6 +58,9 @@ export const bindings: {
|
||||
"alt-d": "navigation.jump.documentation",
|
||||
"alt-m": "navigation.jump.profile",
|
||||
"alt-s": "navigation.jump.settings",
|
||||
"ctrl-shift-p": "response.preview.toggle",
|
||||
"ctrl-j": "response.file.download",
|
||||
"ctrl-.": "response.copy",
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,6 +133,9 @@ function getPressedKey(ev: KeyboardEvent): Key | null {
|
||||
// Check if question mark
|
||||
if (val === "/") return "/"
|
||||
|
||||
// Check if period
|
||||
if (val === ".") return "."
|
||||
|
||||
// If no other cases match, this is not a valid key
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -79,6 +79,19 @@ export default [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
section: "shortcut.response.title",
|
||||
shortcuts: [
|
||||
{
|
||||
keys: [getPlatformSpecialKey(), "J"],
|
||||
label: "shortcut.response.download",
|
||||
},
|
||||
{
|
||||
keys: [getPlatformSpecialKey(), "."],
|
||||
label: "shortcut.response.copy",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
section: "shortcut.navigation.title",
|
||||
shortcuts: [
|
||||
|
||||
Reference in New Issue
Block a user