Skip to content

Commit 971ba9f

Browse files
authoredMar 26, 2024··
fix(vision): fixes bug where codemirror would insert a new line on cmd-return (#6123)
1 parent 3822da2 commit 971ba9f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed
 

‎packages/@sanity/vision/src/codemirror/extensions.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
syntaxHighlighting,
99
} from '@codemirror/language'
1010
import {highlightSelectionMatches} from '@codemirror/search'
11-
import {Extension} from '@codemirror/state'
11+
import {type Extension} from '@codemirror/state'
1212
import {
1313
drawSelection,
1414
highlightActiveLine,
@@ -31,5 +31,16 @@ export const codemirrorExtensions: Extension[] = [
3131
history(),
3232
drawSelection(),
3333
syntaxHighlighting(defaultHighlightStyle, {fallback: true}),
34-
keymap.of([defaultKeymap, historyKeymap].flat().filter(Boolean)),
34+
keymap.of(
35+
[
36+
// Override the default keymap for Mod-Enter to not insert a new line, we have a custom event handler for executing queries
37+
{key: 'Mod-Enter', run: () => true},
38+
39+
// Add the default keymap and history keymap
40+
defaultKeymap,
41+
historyKeymap,
42+
]
43+
.flat()
44+
.filter(Boolean),
45+
),
3546
]

0 commit comments

Comments
 (0)
Please sign in to comment.