File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 11
11
},
12
12
"dependencies" : {
13
13
"@babel/runtime" : " ^7.28.2" ,
14
+ "@codemirror/lang-cpp" : " ^6.0.3" ,
14
15
"@codemirror/lang-go" : " ^6.0.1" ,
15
16
"@codemirror/lang-java" : " ^6.0.2" ,
16
17
"@codemirror/lang-javascript" : " ^6.2.4" ,
Original file line number Diff line number Diff line change 15
15
<!-- 代码编辑器 -->
16
16
<div class =" flex-1 flex flex-col overflow-hidden" >
17
17
<div class =" bg-gray-100 px-4 py-2 border-b border-gray-200 flex items-center justify-between flex-shrink-0" >
18
- <h2 class =" text-sm font-medium text-gray-700" >{{ getLanguageDisplayName(currentLanguage) }} 代码编辑器</h2 >
18
+ <div class =" flex items-center space-x-3" >
19
+ <img :src =" `/icons/${currentLanguage.replace(/\d+$/, '')}.svg`" class =" w-5 h-5" :alt =" currentLanguage" />
20
+ <h2 class =" text-sm font-medium text-gray-700" >{{ getLanguageDisplayName(currentLanguage) }} 代码编辑器</h2 >
21
+ </div >
22
+
19
23
<div class =" flex items-center space-x-2 text-xs text-gray-500" >
20
24
<span ><strong >{{ (code || '').length }}</strong > 字符</span >
21
25
<span ><strong >{{ (code || '').split('\n').length }}</strong > 行</span >
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { javascript } from '@codemirror/lang-javascript'
4
4
import { go } from '@codemirror/lang-go'
5
5
import { java } from '@codemirror/lang-java'
6
6
import { rust } from '@codemirror/lang-rust'
7
+ import { cpp } from '@codemirror/lang-cpp'
7
8
import { shell } from '@codemirror/legacy-modes/mode/shell'
8
9
import { swift } from '@codemirror/legacy-modes/mode/swift'
9
10
import { kotlin , scala } from '@codemirror/legacy-modes/mode/clike'
@@ -161,6 +162,8 @@ export function useCodeMirrorEditor(props: Props)
161
162
return java ( )
162
163
case 'rust' :
163
164
return rust ( )
165
+ case 'c' :
166
+ return cpp ( )
164
167
case 'shell' :
165
168
return StreamLanguage . define ( shell )
166
169
case 'swift' :
You can’t perform that action at this time.
0 commit comments