Fix Selecting a language and then going back to auto

- Closes #37
main
Mike Fix 7 years ago committed by Jake Dexheimer
parent 878e9e4f2e
commit 26ea4615f7

@ -1,4 +1,4 @@
import { toHash } from './util'
import toHash from 'tohash'
export const THEMES_ARRAY = [
{
@ -73,7 +73,8 @@ export const THEMES = toHash(THEMES_ARRAY)
export const LANGUAGES = [
{
name: 'Auto'
name: 'Auto',
module: 'auto'
},
{
name: 'Plain Text'
@ -291,7 +292,9 @@ const unfold = (f, seed) => {
}`
if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') {
LANGUAGES.forEach((language) => {
LANGUAGES
.filter(language => language.module !== 'auto')
.forEach((language) => {
if (language.module) {
!language.custom
? require(`codemirror/mode/${language.module}/${language.module}`)

@ -1,10 +0,0 @@
export const toHash = (array) => {
return array.reduce((hash, item) => {
const id = item.id
if (hash[id]) {
throw new Error('ID already exists')
}
hash[id] = item
return hash
}, {})
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save