can add and edit json/txt files
This commit is contained in:
parent
280d3e69ea
commit
d262783ec1
2 changed files with 6 additions and 2 deletions
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue