File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { Link } from 'react-router-dom' ;
3
+ import brace from 'brace' ;
3
4
4
5
import { downloadSnippet } from '../helpers' ;
5
6
6
7
const RecentSnippetItem = ( { snippet } ) => {
8
+ const { modesByName } = brace . acequire ( 'ace/ext/modelist' ) ;
9
+ const mode = modesByName [ snippet . get ( 'syntax' ) ] || modesByName . text ;
10
+ const syntax = mode . caption ;
7
11
const snippetTitle = snippet . get ( 'title' ) || `#${ snippet . get ( 'id' ) } , Untitled` ;
8
12
const download = ( ) => downloadSnippet ( snippet ) ;
9
13
@@ -12,7 +16,7 @@ const RecentSnippetItem = ({ snippet }) => {
12
16
< div className = "recent-snippet-data" >
13
17
< div >
14
18
< Link to = { `${ snippet . get ( 'id' ) } ` } className = "recent-snippet-data-title" > { snippetTitle } </ Link >
15
- < span className = "recent-snippet-data-lang" > [ { snippet . get ( ' syntax' , 'Text' ) } ]</ span >
19
+ < span className = "recent-snippet-data-lang" > [ { syntax } ]</ span >
16
20
</ div >
17
21
< span className = "recent-snippet-data-author" > By Guest</ span >
18
22
</ div >
You can’t perform that action at this time.
0 commit comments