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
00b590eb
Commit
00b590eb
authored
Feb 16, 2021
by
ioedeveloper
Committed by
GitHub
Feb 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed unnecessay changes
parent
ac332a2e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
file-explorer.tsx
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
+5
-5
No files found.
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
View file @
00b590eb
...
@@ -337,7 +337,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -337,7 +337,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
const
dirName
=
newFolderPath
+
'/'
const
dirName
=
newFolderPath
+
'/'
try
{
try
{
const
exists
=
await
fileManager
.
exists
(
dirName
,
'folder'
)
const
exists
=
await
fileManager
.
exists
(
dirName
)
if
(
exists
)
return
if
(
exists
)
return
await
fileManager
.
mkdir
(
dirName
)
await
fileManager
.
mkdir
(
dirName
)
...
@@ -345,6 +345,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -345,6 +345,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
return
{
...
prevState
,
focusElement
:
[{
key
:
newFolderPath
,
type
:
'folder'
}]
}
return
{
...
prevState
,
focusElement
:
[{
key
:
newFolderPath
,
type
:
'folder'
}]
}
})
})
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'error: '
,
e
)
toast
(
'Failed to create folder: '
+
newFolderPath
)
toast
(
'Failed to create folder: '
+
newFolderPath
)
}
}
}
}
...
@@ -372,10 +373,10 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -372,10 +373,10 @@ export const FileExplorer = (props: FileExplorerProps) => {
})
})
}
}
const
renamePath
=
async
(
oldPath
:
string
,
newPath
:
string
,
type
?:
string
)
=>
{
const
renamePath
=
async
(
oldPath
:
string
,
newPath
:
string
)
=>
{
try
{
try
{
const
fileManager
=
state
.
fileManager
const
fileManager
=
state
.
fileManager
const
exists
=
await
fileManager
.
exists
(
newPath
,
type
)
const
exists
=
await
fileManager
.
exists
(
newPath
)
if
(
exists
)
{
if
(
exists
)
{
modal
(
'Rename File Failed'
,
'File name already exists'
,
{
modal
(
'Rename File Failed'
,
'File name already exists'
,
{
...
@@ -814,10 +815,9 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -814,10 +815,9 @@ export const FileExplorer = (props: FileExplorerProps) => {
const
oldPath
:
string
=
state
.
focusEdit
.
element
const
oldPath
:
string
=
state
.
focusEdit
.
element
const
oldName
=
extractNameFromKey
(
oldPath
)
const
oldName
=
extractNameFromKey
(
oldPath
)
const
newPath
=
oldPath
.
replace
(
oldName
,
content
)
const
newPath
=
oldPath
.
replace
(
oldName
,
content
)
const
type
:
string
=
state
.
focusEdit
.
type
editRef
.
current
.
textContent
=
extractNameFromKey
(
oldPath
)
editRef
.
current
.
textContent
=
extractNameFromKey
(
oldPath
)
renamePath
(
oldPath
,
newPath
,
type
)
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