From 9ce3558a44d377bcda1fa05caeb3a4be44be97c9 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Fri, 10 Nov 2017 16:58:03 -0800 Subject: [PATCH] Fix typescript vs js naming descrepancy - Closes #139 --- README.md | 6 +++--- lib/constants.js | 21 +++++++++++---------- pages/editor.js | 5 ++++- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1af31a1..db79e0d 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,8 @@ Carbon is a project by
briandennis](https://github.com/briandennis)
[💻](https://github.com/dawnlabs/carbon/commits?author=briandennis "Code") [📖](https://github.com/dawnlabs/carbon/commits?author=briandennis "Documentation") [🚇](#infra-briandennis "Infrastructure (Hosting, Build-Tools, etc)") [👀](#review-briandennis "Reviewed Pull Requests") | [
mfix22](https://github.com/mfix22)
[💬](#question-mfix22 "Answering Questions") [💻](https://github.com/dawnlabs/carbon/commits?author=mfix22 "Code") [🤔](#ideas-mfix22 "Ideas, Planning, & Feedback") | [
jakedex](https://github.com/jakedex)
[💬](#question-jakedex "Answering Questions") [💻](https://github.com/dawnlabs/carbon/commits?author=jakedex "Code") [🎨](#design-jakedex "Design") [📹](#video-jakedex "Videos") | [
andrewda](https://github.com/andrewda)
[💬](#question-andrewda "Answering Questions") [💻](https://github.com/dawnlabs/carbon/commits?author=andrewda "Code") [🐛](https://github.com/dawnlabs/carbon/issues?q=author%3Aandrewda "Bug reports") [👀](#review-andrewda "Reviewed Pull Requests") | [
yeskunall](https://github.com/yeskunall)
[💻](https://github.com/dawnlabs/carbon/commits?author=yeskunall "Code") [📖](https://github.com/dawnlabs/carbon/commits?author=yeskunall "Documentation") [🔧](#tool-yeskunall "Tools") [🐛](https://github.com/dawnlabs/carbon/issues?q=author%3Ayeskunall "Bug reports") | [
stoshfabricius](https://github.com/stoshfabricius)
[💻](https://github.com/dawnlabs/carbon/commits?author=stoshfabricius "Code") | [
jkling38](https://github.com/jkling38)
[📖](https://github.com/dawnlabs/carbon/commits?author=jkling38 "Documentation") | +| [
briandennis](https://github.com/briandennis)
[💻](https://github.com/dawnlabs/carbon/commits?author=briandennis "Code") [📖](https://github.com/dawnlabs/carbon/commits?author=briandennis "Documentation") [🚇](#infra-briandennis "Infrastructure (Hosting, Build-Tools, etc)") [👀](#review-briandennis "Reviewed Pull Requests") | [
mfix22](https://github.com/mfix22)
[💬](#question-mfix22 "Answering Questions") [💻](https://github.com/dawnlabs/carbon/commits?author=mfix22 "Code") [🤔](#ideas-mfix22 "Ideas, Planning, & Feedback") | [
jakedex](https://github.com/jakedex)
[💬](#question-jakedex "Answering Questions") [💻](https://github.com/dawnlabs/carbon/commits?author=jakedex "Code") [🎨](#design-jakedex "Design") [📹](#video-jakedex "Videos") | [
andrewda](https://github.com/andrewda)
[💬](#question-andrewda "Answering Questions") [💻](https://github.com/dawnlabs/carbon/commits?author=andrewda "Code") [🐛](https://github.com/dawnlabs/carbon/issues?q=author%3Aandrewda "Bug reports") [👀](#review-andrewda "Reviewed Pull Requests") | [
yeskunall](https://github.com/yeskunall)
[💻](https://github.com/dawnlabs/carbon/commits?author=yeskunall "Code") [📖](https://github.com/dawnlabs/carbon/commits?author=yeskunall "Documentation") [🔧](#tool-yeskunall "Tools") [🐛](https://github.com/dawnlabs/carbon/issues?q=author%3Ayeskunall "Bug reports") | [
stoshfabricius](https://github.com/stoshfabricius)
[💻](https://github.com/dawnlabs/carbon/commits?author=stoshfabricius "Code") | [
jkling38](https://github.com/jkling38)
[📖](https://github.com/dawnlabs/carbon/commits?author=jkling38 "Documentation") | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| [
otobrglez](https://github.com/otobrglez)
[💻](https://github.com/dawnlabs/carbon/commits?author=otobrglez "Code") | [
darahak](https://github.com/darahak)
[📖](https://github.com/dawnlabs/carbon/commits?author=darahak "Documentation") | [
dom96](https://github.com/dom96)
[💻](https://github.com/dawnlabs/carbon/commits?author=dom96 "Code") | [
elrumordelaluz](https://github.com/elrumordelaluz)
[💻](https://github.com/dawnlabs/carbon/commits?author=elrumordelaluz "Code") | [
cjb](https://github.com/cjb)
[💻](https://github.com/dawnlabs/carbon/commits?author=cjb "Code") | [
Krzysztof-Cieslak](https://github.com/Krzysztof-Cieslak)
[💻](https://github.com/dawnlabs/carbon/commits?author=Krzysztof-Cieslak "Code") | [
fernahh](https://github.com/fernahh)
[📖](https://github.com/dawnlabs/carbon/commits?author=fernahh "Documentation") | -| [
g3r4n](https://github.com/g3r4n)
[💻](https://github.com/dawnlabs/carbon/commits?author=g3r4n "Code") | [
Mat Gadd](http://drarok.com/)
[🐛](https://github.com/dawnlabs/carbon/issues?q=author%3ADrarok "Bug reports") [💻](https://github.com/dawnlabs/carbon/commits?author=Drarok "Code") | [
Brad Davies](https://bradlab.co.uk)
[🐛](https://github.com/dawnlabs/carbon/issues?q=author%3Avarbrad "Bug reports") [💻](https://github.com/dawnlabs/carbon/commits?author=varbrad "Code") | +| [
otobrglez](https://github.com/otobrglez)
[💻](https://github.com/dawnlabs/carbon/commits?author=otobrglez "Code") | [
darahak](https://github.com/darahak)
[📖](https://github.com/dawnlabs/carbon/commits?author=darahak "Documentation") | [
dom96](https://github.com/dom96)
[💻](https://github.com/dawnlabs/carbon/commits?author=dom96 "Code") | [
elrumordelaluz](https://github.com/elrumordelaluz)
[💻](https://github.com/dawnlabs/carbon/commits?author=elrumordelaluz "Code") | [
cjb](https://github.com/cjb)
[💻](https://github.com/dawnlabs/carbon/commits?author=cjb "Code") | [
Krzysztof-Cieslak](https://github.com/Krzysztof-Cieslak)
[💻](https://github.com/dawnlabs/carbon/commits?author=Krzysztof-Cieslak "Code") | [
fernahh](https://github.com/fernahh)
[📖](https://github.com/dawnlabs/carbon/commits?author=fernahh "Documentation") | +| [
g3r4n](https://github.com/g3r4n)
[💻](https://github.com/dawnlabs/carbon/commits?author=g3r4n "Code") | [
Mat Gadd](http://drarok.com/)
[🐛](https://github.com/dawnlabs/carbon/issues?q=author%3ADrarok "Bug reports") [💻](https://github.com/dawnlabs/carbon/commits?author=Drarok "Code") | [
Brad Davies](https://bradlab.co.uk)
[🐛](https://github.com/dawnlabs/carbon/issues?q=author%3Avarbrad "Bug reports") [💻](https://github.com/dawnlabs/carbon/commits?author=varbrad "Code") | diff --git a/lib/constants.js b/lib/constants.js index 643b575..88c5410 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -195,7 +195,8 @@ export const LANGUAGES = [ }, { name: 'JavaScript', - mode: 'javascript' + mode: 'javascript', + short: 'javascript' }, { name: 'JSON', @@ -370,14 +371,14 @@ const unfold = (f, seed) => { if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') { const alreadyLoaded = new Set() - LANGUAGES.filter( - language => language.mode !== 'auto' && language.mode !== 'text' - ).forEach(language => { - if (language.mode && !alreadyLoaded.has(language.mode)) { - alreadyLoaded.add(language.mode) - language.custom - ? require(`./customModes/${language.mode}`) - : require(`codemirror/mode/${language.mode}/${language.mode}`) + LANGUAGES.filter(language => language.mode !== 'auto' && language.mode !== 'text').forEach( + language => { + if (language.mode && !alreadyLoaded.has(language.mode)) { + alreadyLoaded.add(language.mode) + language.custom + ? require(`./customModes/${language.mode}`) + : require(`codemirror/mode/${language.mode}/${language.mode}`) + } } - }) + ) } diff --git a/pages/editor.js b/pages/editor.js index a3f9cdf..74bb5d3 100644 --- a/pages/editor.js +++ b/pages/editor.js @@ -21,6 +21,7 @@ import { LANGUAGES, LANGUAGE_MIME_HASH, LANGUAGE_MODE_HASH, + LANGUAGE_NAME_HASH, DEFAULT_LANGUAGE, DEFAULT_THEME, COLORS, @@ -147,7 +148,9 @@ class Editor extends React.Component { /> this.setState({ language: language.mime || language.mode })}