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
b5c2366a
Unverified
Commit
b5c2366a
authored
Apr 08, 2021
by
yann300
Committed by
GitHub
Apr 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update file-explorer.tsx
parent
c0767cd2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
file-explorer.tsx
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
+8
-1
No files found.
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
View file @
b5c2366a
...
@@ -515,6 +515,12 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -515,6 +515,12 @@ export const FileExplorer = (props: FileExplorerProps) => {
// the files module. Please ask the user here if they want to overwrite
// the files module. Please ask the user here if they want to overwrite
// a file and then just use `files.add`. The file explorer will
// a file and then just use `files.add`. The file explorer will
// pick that up via the 'fileAdded' event from the files module.
// pick that up via the 'fileAdded' event from the files module.
const
parentFolder
=
state
.
focusElement
[
0
]
?
state
.
focusElement
[
0
].
type
===
'folder'
?
state
.
focusElement
[
0
].
key
:
extractParentFromKey
(
state
.
focusElement
[
0
].
key
)
:
name
const
expandPath
=
[...
new
Set
([...
state
.
expandPath
,
parentFolder
])]
setState
(
prevState
=>
{
return
{
...
prevState
,
expandPath
}
});
[...
target
.
files
].
forEach
((
file
)
=>
{
[...
target
.
files
].
forEach
((
file
)
=>
{
const
loadFile
=
(
name
:
string
):
void
=>
{
const
loadFile
=
(
name
:
string
):
void
=>
{
...
@@ -545,7 +551,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -545,7 +551,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
}
}
fileReader
.
readAsText
(
file
)
fileReader
.
readAsText
(
file
)
}
}
const
name
=
file
.
name
const
name
=
`
${
parentFolder
}
/
${
file
.
name
}
`
filesProvider
.
exists
(
name
,
(
error
,
exist
)
=>
{
filesProvider
.
exists
(
name
,
(
error
,
exist
)
=>
{
if
(
error
)
console
.
log
(
error
)
if
(
error
)
console
.
log
(
error
)
...
@@ -995,6 +1001,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -995,6 +1001,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
<
div
onClick=
{
(
e
)
=>
{
<
div
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
()
e
.
stopPropagation
()
if
(
e
&&
(
e
.
target
as
any
).
getAttribute
(
'data-id'
)
===
'fileExplorerUploadFileuploadFile'
)
return
// we don't want to let propagate the input of type file
if
(
e
&&
(
e
.
target
as
any
).
getAttribute
(
'data-id'
)
===
'fileExplorerUploadFileuploadFile'
)
return
// we don't want to let propagate the input of type file
let
expandPath
=
[]
let
expandPath
=
[]
if
(
!
state
.
expandPath
.
includes
(
props
.
name
))
{
if
(
!
state
.
expandPath
.
includes
(
props
.
name
))
{
...
...
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