Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: ctrl+enter inserting newline in code (#4108)

Muhammed Ajmal M71ac013a3846
diff --git a/packages/hoppscotch-common/src/composables/codemirror.ts b/packages/hoppscotch-common/src/composables/codemirror.ts
index c2005f027..0b491c837 100644
--- a/packages/hoppscotch-common/src/composables/codemirror.ts
+++ b/packages/hoppscotch-common/src/composables/codemirror.ts
@@ -11,6 +11,7 @@ import {
EditorState,
Compartment,
EditorSelection,
+ Prec,
} from "@codemirror/state"
import {
Language,
@@ -367,6 +368,15 @@ export function useCodemirror(
run: indentLess,
},
]),
+ Prec.highest(
+ keymap.of([
+ {
+ key: "Cmd-Enter" /* macOS */ || "Ctrl-Enter" /* Windows */,
+ preventDefault: true,
+ run: () => true,
+ },
+ ])
+ ),
tooltips({
parent: document.body,
position: "absolute",