Finish Playground

This commit is contained in:
2024-01-12 16:57:25 +08:00
parent dc64b4993c
commit ed4cef1c78
13 changed files with 156 additions and 71 deletions

View File

@@ -64,10 +64,10 @@ const FileSelector: React.FC<FileSelectorProps> = ({
}
const handleOnCancel = () => {
onError?.('')
if (!creating) {
return
}
tabs.pop()
setTabs([...tabs])
setCreating(false)
@@ -111,7 +111,10 @@ const FileSelector: React.FC<FileSelectorProps> = ({
return false
}
if (tabs.includes(newFileName) && newFileName !== oldFileName) {
if (
tabs.map((item) => item.toLowerCase()).includes(newFileName.toLowerCase()) &&
newFileName.toLowerCase() !== oldFileName.toLowerCase()
) {
onError?.(`File "${newFileName}" already exists.`)
return false
}