Optimize Playground

This commit is contained in:
2024-01-25 15:35:52 +08:00
parent 34034ec59b
commit 96acaddf77
12 changed files with 58 additions and 33 deletions

View File

@@ -110,6 +110,10 @@ const FileSelector = ({
}
const handleOnValidateTab = (newFileName: string, oldFileName: string) => {
if (newFileName.length > 40) {
onError?.('File name is too long, maximum 40 characters.')
}
if (!/\.(jsx|tsx|js|ts|css|json)$/.test(newFileName)) {
onError?.('Playground only supports *.jsx, *.tsx, *.js, *.ts, *.css, *.json files.')
@@ -219,4 +223,6 @@ const FileSelector = ({
)
}
FileSelector.Item = Item
export default FileSelector