Extract DEFAULT_LANGUAGE

This commit is contained in:
Anthony Laibe 2018-09-26 14:03:00 +01:00 committed by Pascal Precht
parent 626be3882b
commit 0d3dd56a86
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D

View File

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