Merge pull request #1166 from processing/expand-file-types
fixes #1162, fixes #1118, adds shader and .bin files to web editor
This commit is contained in:
commit
8281a7ee9e
2 changed files with 7 additions and 4 deletions
|
@ -5,6 +5,7 @@ import classNames from 'classnames';
|
|||
import InlineSVG from 'react-inlinesvg';
|
||||
import NewFileForm from './NewFileForm';
|
||||
import FileUploader from './FileUploader';
|
||||
import { CREATE_FILE_REGEX } from '../../../../server/utils/fileUtils';
|
||||
|
||||
const exitUrl = require('../../../images/exit.svg');
|
||||
|
||||
|
@ -71,8 +72,8 @@ function validate(formProps) {
|
|||
|
||||
if (!formProps.name) {
|
||||
errors.name = 'Please enter a name';
|
||||
} else if (!formProps.name.match(/(.+\.js$|.+\.css$|.+\.json$|.+\.txt$|.+\.csv$|.+\.tsv$)/i)) {
|
||||
errors.name = 'File must be of type JavaScript, CSS, JSON, TXT, CSV, or TSV.';
|
||||
} else if (!formProps.name.match(CREATE_FILE_REGEX)) {
|
||||
errors.name = 'Invalid file type. Valid extensions are .js, .css, .json, .txt, .csv, .tsv, .frag, and .vert.';
|
||||
}
|
||||
|
||||
return errors;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
export const fileExtensionsArray = ['gif', 'jpg', 'jpeg', 'png', 'bmp', 'wav', 'flac', 'ogg',
|
||||
'oga', 'mp4', 'm4p', 'mp3', 'm4a', 'aiff', 'aif', 'm4v', 'aac', 'webm', 'mpg', 'mp2',
|
||||
'mpeg', 'mpe', 'mpv', 'js', 'jsx', 'html', 'htm', 'css', 'json', 'csv', 'obj', 'svg',
|
||||
'otf', 'ttf', 'txt', 'mov', 'vert', 'frag'];
|
||||
'otf', 'ttf', 'txt', 'mov', 'vert', 'frag', 'bin'];
|
||||
|
||||
export const mimeTypes = `image/*,audio/*,text/javascript,text/html,text/css,
|
||||
application/json,application/x-font-ttf,application/x-font-truetype,text/plain,
|
||||
|
@ -22,6 +22,8 @@ export const STRING_REGEX = /(['"])((\\\1|.)*?)\1/gm;
|
|||
// these are files that have to be linked to with a blob url
|
||||
export const PLAINTEXT_FILE_REGEX = /.+\.(json|txt|csv|vert|frag|tsv)$/i;
|
||||
// these are files that users would want to edit as text (maybe svg should be here?)
|
||||
export const TEXT_FILE_REGEX = /.+\.(json|txt|csv|vert|frag|js|css|html|htm|jsx)$/i;
|
||||
export const TEXT_FILE_REGEX = /.+\.(json|txt|csv|tsv|vert|frag|js|css|html|htm|jsx)$/i;
|
||||
export const NOT_EXTERNAL_LINK_REGEX = /^(?!(http:\/\/|https:\/\/))/;
|
||||
export const EXTERNAL_LINK_REGEX = /^(http:\/\/|https:\/\/)/;
|
||||
|
||||
export const CREATE_FILE_REGEX = /.+\.(json|txt|csv|tsv|js|css|frag|vert)$/i;
|
||||
|
|
Loading…
Reference in a new issue