From bc1c9fce51be4bc68e271f3b9f5b37c761d4166e Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Wed, 26 Sep 2018 14:03:00 +0100 Subject: [PATCH] Extract DEFAULT_LANGUAGE --- embark-ui/src/components/TextEditor.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/embark-ui/src/components/TextEditor.js b/embark-ui/src/components/TextEditor.js index a77a0be3..725fd3df 100644 --- a/embark-ui/src/components/TextEditor.js +++ b/embark-ui/src/components/TextEditor.js @@ -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) {