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:
@@ -11,6 +11,7 @@ import {
|
|||||||
EditorState,
|
EditorState,
|
||||||
Compartment,
|
Compartment,
|
||||||
EditorSelection,
|
EditorSelection,
|
||||||
|
Prec,
|
||||||
} from "@codemirror/state"
|
} from "@codemirror/state"
|
||||||
import {
|
import {
|
||||||
Language,
|
Language,
|
||||||
@@ -367,6 +368,15 @@ export function useCodemirror(
|
|||||||
run: indentLess,
|
run: indentLess,
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
|
Prec.highest(
|
||||||
|
keymap.of([
|
||||||
|
{
|
||||||
|
key: "Cmd-Enter" /* macOS */ || "Ctrl-Enter" /* Windows */,
|
||||||
|
preventDefault: true,
|
||||||
|
run: () => true,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
),
|
||||||
tooltips({
|
tooltips({
|
||||||
parent: document.body,
|
parent: document.body,
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
|
|||||||
Reference in New Issue
Block a user