diff --git a/client/modules/IDE/components/Editor.js b/client/modules/IDE/components/Editor.js index 913987c5..1f82fa22 100644 --- a/client/modules/IDE/components/Editor.js +++ b/client/modules/IDE/components/Editor.js @@ -110,6 +110,10 @@ class Editor extends React.Component { this._cm.setOption('mode', 'css'); } else if (this.props.file.name.match(/.+\.html$/i)) { this._cm.setOption('mode', 'htmlmixed'); + } else if (this.props.file.name.match(/.+\.json$/i)) { + this._cm.setOption('mode', 'application/json'); + } else { + this._cm.setOption('mode', 'text/plain'); } } diff --git a/client/modules/IDE/components/NewFileModal.js b/client/modules/IDE/components/NewFileModal.js index 784ec2a7..df3592d0 100644 --- a/client/modules/IDE/components/NewFileModal.js +++ b/client/modules/IDE/components/NewFileModal.js @@ -51,8 +51,8 @@ function validate(formProps) { if (!formProps.name) { errors.name = 'Please enter a name'; - } else if (!formProps.name.match(/(.+\.js$|.+\.css$)/)) { - errors.name = 'File must be of type JavaScript or CSS.'; + } else if (!formProps.name.match(/(.+\.js$|.+\.css$|.+\.json$|.+\.txt)/i)) { + errors.name = 'File must be of type JavaScript, CSS, JSON, or TXT.'; } return errors;