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 11import React from 'react' ;
22import { Link } from 'react-router-dom' ;
3+ import brace from 'brace' ;
34
45import { downloadSnippet } from '../helpers' ;
56
67const RecentSnippetItem = ( { snippet } ) => {
8+ const { modesByName } = brace . acequire ( 'ace/ext/modelist' ) ;
9+ const mode = modesByName [ snippet . get ( 'syntax' ) ] || modesByName . text ;
10+ const syntax = mode . caption ;
711 const snippetTitle = snippet . get ( 'title' ) || `#${ snippet . get ( 'id' ) } , Untitled` ;
812 const download = ( ) => downloadSnippet ( snippet ) ;
913
@@ -12,7 +16,7 @@ const RecentSnippetItem = ({ snippet }) => {
1216 < div className = "recent-snippet-data" >
1317 < div >
1418 < 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 >
1620 </ div >
1721 < span className = "recent-snippet-data-author" > By Guest</ span >
1822 </ div >
You can’t perform that action at this time.
0 commit comments