|
|
@@ -1,9 +1,9 @@
|
|
|
import { useMemo } from 'react';
|
|
|
|
|
|
-import { indentWithTab } from '@codemirror/commands';
|
|
|
+import { indentWithTab, defaultKeymap } from '@codemirror/commands';
|
|
|
import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
|
|
|
import { languages } from '@codemirror/language-data';
|
|
|
-import { EditorState, type Extension } from '@codemirror/state';
|
|
|
+import { EditorState, Prec, type Extension } from '@codemirror/state';
|
|
|
import { keymap, EditorView } from '@codemirror/view';
|
|
|
import { useCodeMirror, type UseCodeMirror } from '@uiw/react-codemirror';
|
|
|
import deepmerge from 'ts-deepmerge';
|
|
|
@@ -30,6 +30,7 @@ export type UseCodeMirrorEditor = {
|
|
|
const defaultExtensions: Extension[] = [
|
|
|
markdown({ base: markdownLanguage, codeLanguages: languages }),
|
|
|
keymap.of([indentWithTab]),
|
|
|
+ Prec.lowest(keymap.of(defaultKeymap)),
|
|
|
];
|
|
|
|
|
|
export const useCodeMirrorEditor = (props?: UseCodeMirror): UseCodeMirrorEditor => {
|