Use supported languages

This commit is contained in:
Anthony Laibe 2018-09-26 13:53:22 +01:00 committed by Pascal Precht
parent 0e49165967
commit 626be3882b
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 4 additions and 12 deletions

View File

@ -2,20 +2,12 @@ import React from 'react';
import MonacoEditor from 'react-monaco-editor';
import PropTypes from 'prop-types';
const supportedLanguages = ['css', 'sol', 'html', 'json'];
class TextEditor extends React.Component {
language() {
switch(this.props.file.name.split('.').pop()) {
case 'css':
return 'css';
case 'sol':
return 'sol';
case 'html':
return 'html';
case 'json':
return 'json';
default:
return 'javascript';
}
const extension = this.props.file.name.split('.').pop();
return supportedLanguages[supportedLanguages.indexOf(extension)] || 'javascript';
}
extractRowCol(errorMessage) {