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

* fix: ctrl+enter inserting newline in code

* chore: add 'cmd+enter' to the key list

---------

Co-authored-by: nivedin <nivedinp@gmail.com>
This commit is contained in:
Muhammed Ajmal M
2024-07-02 15:07:27 +05:30
committed by GitHub
parent fe79c47d1f
commit 71ac013a38

View File

@@ -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",