diff --git a/frontend/package.json b/frontend/package.json index 069ad0c995..4580bd3bee 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -11,6 +11,7 @@ "format": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json}\"" }, "dependencies": { + "@codemirror/commands": "^6.7.1", "@codemirror/lang-python": "^6.1.6", "@codemirror/language-data": "^6.5.1", "@codemirror/theme-one-dark": "^6.1.2", diff --git a/frontend/pages/code/editor.tsx b/frontend/pages/code/editor.tsx index 9f45bc6f7f..55d0187632 100644 --- a/frontend/pages/code/editor.tsx +++ b/frontend/pages/code/editor.tsx @@ -8,9 +8,9 @@ import * as Y from 'yjs' import { useSession } from 'next-auth/react' import { languages } from '@codemirror/language-data' import { userColor } from '@/util/cursor-colors' -import { CodeMirrorEditorProps, CodeMirrorEditorRef } from '@/types/editor' import { oneDark } from '@codemirror/theme-one-dark' import { javascript } from '@codemirror/lang-javascript' +import { indentWithTab } from '@codemirror/commands' const CodeMirrorEditor = forwardRef(({ roomId, language }: { roomId: string; language: string }, ref) => { const editorContainerRef = useRef(null) @@ -62,7 +62,7 @@ const CodeMirrorEditor = forwardRef(({ roomId, language }: { roomId: string; lan const state = EditorState.create({ doc: ytext.toString(), extensions: [ - keymap.of([...yUndoManagerKeymap]), + keymap.of([...yUndoManagerKeymap, indentWithTab]), basicSetup, oneDark, compartment.of(javascript()), diff --git a/package-lock.json b/package-lock.json index a4a5514e02..50f1f7c921 100644 --- a/package-lock.json +++ b/package-lock.json @@ -266,6 +266,7 @@ "frontend": { "version": "0.1.0", "dependencies": { + "@codemirror/commands": "^6.7.1", "@codemirror/lang-python": "^6.1.6", "@codemirror/language-data": "^6.5.1", "@codemirror/theme-one-dark": "^6.1.2",