Use supported languages
This commit is contained in:
parent
0e49165967
commit
626be3882b
|
@ -2,20 +2,12 @@ import React from 'react';
|
||||||
import MonacoEditor from 'react-monaco-editor';
|
import MonacoEditor from 'react-monaco-editor';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
const supportedLanguages = ['css', 'sol', 'html', 'json'];
|
||||||
|
|
||||||
class TextEditor extends React.Component {
|
class TextEditor extends React.Component {
|
||||||
language() {
|
language() {
|
||||||
switch(this.props.file.name.split('.').pop()) {
|
const extension = this.props.file.name.split('.').pop();
|
||||||
case 'css':
|
return supportedLanguages[supportedLanguages.indexOf(extension)] || 'javascript';
|
||||||
return 'css';
|
|
||||||
case 'sol':
|
|
||||||
return 'sol';
|
|
||||||
case 'html':
|
|
||||||
return 'html';
|
|
||||||
case 'json':
|
|
||||||
return 'json';
|
|
||||||
default:
|
|
||||||
return 'javascript';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extractRowCol(errorMessage) {
|
extractRowCol(errorMessage) {
|
||||||
|
|
Loading…
Reference in New Issue