From 973572d060d59ce2c8bced9e72ebdb0b6560dd0a Mon Sep 17 00:00:00 2001 From: Chhavi Goyal Date: Fri, 12 Dec 2025 03:53:59 -0500 Subject: [PATCH] fix: improve keyboard shortcuts (#5601) Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: James George <25279263+jamesgeorge007@users.noreply.github.com> --- packages/hoppscotch-common/locales/en.json | 6 +- .../src/components/MonacoScriptEditor.vue | 6 ++ .../src/components/app/Shortcuts.vue | 7 +- .../src/composables/codemirror.ts | 53 ++++++++++-- .../hoppscotch-common/src/helpers/actions.ts | 65 ++++++++++++++ .../src/helpers/keybindings.ts | 85 +++++++++++++++++-- .../src/helpers/shortcuts.ts | 31 ++++++- .../src/helpers/utils/dom.ts | 24 ++++++ 8 files changed, 260 insertions(+), 17 deletions(-) diff --git a/packages/hoppscotch-common/locales/en.json b/packages/hoppscotch-common/locales/en.json index 78448af1..82dcd403 100644 --- a/packages/hoppscotch-common/locales/en.json +++ b/packages/hoppscotch-common/locales/en.json @@ -1370,7 +1370,11 @@ "command_menu": "Search & command menu", "help_menu": "Help menu", "show_all": "Keyboard shortcuts", - "title": "General" + "title": "General", + "comment_uncomment": "Comment/Uncomment", + "close_tab": "Close Tab", + "undo": "Undo", + "redo": "Redo" }, "miscellaneous": { "invite": "Invite people to Hoppscotch", diff --git a/packages/hoppscotch-common/src/components/MonacoScriptEditor.vue b/packages/hoppscotch-common/src/components/MonacoScriptEditor.vue index 5bc0c0ba..33f7b9e5 100644 --- a/packages/hoppscotch-common/src/components/MonacoScriptEditor.vue +++ b/packages/hoppscotch-common/src/components/MonacoScriptEditor.vue @@ -99,6 +99,12 @@ const ensureCompilerOptions = (() => { command: null, }) + // Add Cmd+Y redo keybinding for Monaco + monaco.editor.addKeybindingRule({ + keybinding: monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyY, + command: "redo", + }) + applied = true } })() diff --git a/packages/hoppscotch-common/src/components/app/Shortcuts.vue b/packages/hoppscotch-common/src/components/app/Shortcuts.vue index ac025542..f4efd9f8 100644 --- a/packages/hoppscotch-common/src/components/app/Shortcuts.vue +++ b/packages/hoppscotch-common/src/components/app/Shortcuts.vue @@ -1,5 +1,10 @@