Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
c3e56831
Commit
c3e56831
authored
May 17, 2021
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch reserved keywords and display modal
parent
1ee1462f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
file-explorer.tsx
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
+16
-0
No files found.
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
View file @
c3e56831
...
@@ -584,8 +584,23 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -584,8 +584,23 @@ export const FileExplorer = (props: FileExplorerProps) => {
modal
(
'Validation Error'
,
'Special characters are not allowed'
,
'OK'
,
()
=>
{})
modal
(
'Validation Error'
,
'Special characters are not allowed'
,
'OK'
,
()
=>
{})
}
else
{
}
else
{
if
(
state
.
focusEdit
.
isNew
)
{
if
(
state
.
focusEdit
.
isNew
)
{
if
((
content
===
props
.
name
)
||
(
content
.
indexOf
(
'gist-'
)
===
0
))
{
removeInputField
(
parentFolder
)(
dispatch
)
modal
(
'Reserved Keyword'
,
`File name contains remix reserved keywords. '
${
content
}
'`
,
{
label
:
'Close'
,
fn
:
()
=>
{}
},
null
)
}
else
{
state
.
focusEdit
.
type
===
'file'
?
createNewFile
(
joinPath
(
parentFolder
,
content
))
:
createNewFolder
(
joinPath
(
parentFolder
,
content
))
state
.
focusEdit
.
type
===
'file'
?
createNewFile
(
joinPath
(
parentFolder
,
content
))
:
createNewFolder
(
joinPath
(
parentFolder
,
content
))
removeInputField
(
parentFolder
)(
dispatch
)
removeInputField
(
parentFolder
)(
dispatch
)
}
}
else
{
if
((
content
===
props
.
name
)
||
(
content
.
indexOf
(
'gist-'
)
===
0
))
{
editRef
.
current
.
textContent
=
state
.
focusEdit
.
lastEdit
modal
(
'Reserved Keyword'
,
`File name contains remix reserved keywords. '
${
content
}
'`
,
{
label
:
'Close'
,
fn
:
()
=>
{}
},
null
)
}
else
{
}
else
{
const
oldPath
:
string
=
state
.
focusEdit
.
element
const
oldPath
:
string
=
state
.
focusEdit
.
element
const
oldName
=
extractNameFromKey
(
oldPath
)
const
oldName
=
extractNameFromKey
(
oldPath
)
...
@@ -594,6 +609,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -594,6 +609,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
editRef
.
current
.
textContent
=
extractNameFromKey
(
oldPath
)
editRef
.
current
.
textContent
=
extractNameFromKey
(
oldPath
)
renamePath
(
oldPath
,
newPath
)
renamePath
(
oldPath
,
newPath
)
}
}
}
setState
(
prevState
=>
{
setState
(
prevState
=>
{
return
{
...
prevState
,
focusEdit
:
{
element
:
null
,
isNew
:
false
,
type
:
''
,
lastEdit
:
''
}
}
return
{
...
prevState
,
focusEdit
:
{
element
:
null
,
isNew
:
false
,
type
:
''
,
lastEdit
:
''
}
}
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment