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
4dd9a621
Commit
4dd9a621
authored
Jan 27, 2021
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed new file after collapse and display modal for gist access token
parent
e68610c8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
17 deletions
+54
-17
file-explorer.tsx
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
+54
-17
No files found.
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
View file @
4dd9a621
...
@@ -40,21 +40,22 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -40,21 +40,22 @@ export const FileExplorer = (props: FileExplorerProps) => {
isNew
:
false
,
isNew
:
false
,
lastEdit
:
''
lastEdit
:
''
},
},
expandPath
:
[],
expandPath
:
[
name
],
modalOptions
:
{
focusModal
:
{
hide
:
true
,
hide
:
true
,
title
:
''
,
title
:
''
,
message
:
''
,
message
:
''
,
ok
:
{
ok
:
{
label
:
'
Ok
'
,
label
:
''
,
fn
:
null
fn
:
()
=>
{}
},
},
cancel
:
{
cancel
:
{
label
:
'
Cancel
'
,
label
:
''
,
fn
:
null
fn
:
()
=>
{}
},
},
handleHide
:
null
handleHide
:
null
},
},
modals
:
[],
toasterMsg
:
''
toasterMsg
:
''
})
})
const
editRef
=
useRef
(
null
)
const
editRef
=
useRef
(
null
)
...
@@ -196,6 +197,28 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -196,6 +197,28 @@ export const FileExplorer = (props: FileExplorerProps) => {
}
}
},
[
externalUploads
])
},
[
externalUploads
])
useEffect
(()
=>
{
if
(
state
.
modals
.
length
>
0
)
{
setState
(
prevState
=>
{
const
focusModal
=
{
hide
:
false
,
title
:
prevState
.
modals
[
0
].
title
,
message
:
prevState
.
modals
[
0
].
message
,
ok
:
prevState
.
modals
[
0
].
ok
,
cancel
:
prevState
.
modals
[
0
].
cancel
,
handleHide
:
prevState
.
modals
[
0
].
handleHide
}
prevState
.
modals
.
shift
()
return
{
...
prevState
,
focusModal
,
modals
:
prevState
.
modals
}
})
}
},
[
state
.
modals
])
const
resolveDirectory
=
async
(
folderPath
,
dir
:
File
[],
isChild
=
false
):
Promise
<
File
[]
>
=>
{
const
resolveDirectory
=
async
(
folderPath
,
dir
:
File
[],
isChild
=
false
):
Promise
<
File
[]
>
=>
{
if
(
!
isChild
&&
(
state
.
focusEdit
.
element
===
'browser/blank'
)
&&
state
.
focusEdit
.
isNew
&&
(
dir
.
findIndex
(({
path
})
=>
path
===
'browser/blank'
)
===
-
1
))
{
if
(
!
isChild
&&
(
state
.
focusEdit
.
element
===
'browser/blank'
)
&&
state
.
focusEdit
.
isNew
&&
(
dir
.
findIndex
(({
path
})
=>
path
===
'browser/blank'
)
===
-
1
))
{
dir
=
state
.
focusEdit
.
type
===
'file'
?
[...
dir
,
{
dir
=
state
.
focusEdit
.
type
===
'file'
?
[...
dir
,
{
...
@@ -645,7 +668,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -645,7 +668,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
const
handleHideModal
=
()
=>
{
const
handleHideModal
=
()
=>
{
setState
(
prevState
=>
{
setState
(
prevState
=>
{
return
{
...
prevState
,
modalOptions
:
{
...
state
.
modalOptions
,
hide
:
true
}
}
return
{
...
prevState
,
focusModal
:
{
...
state
.
focusModal
,
hide
:
true
}
}
})
})
}
}
...
@@ -653,15 +676,14 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -653,15 +676,14 @@ export const FileExplorer = (props: FileExplorerProps) => {
setState
(
prevState
=>
{
setState
(
prevState
=>
{
return
{
return
{
...
prevState
,
...
prevState
,
modalOptions
:
{
modals
:
[...
prevState
.
modals
,
...
prevState
.
modalOptions
,
{
hide
:
false
,
message
,
message
,
title
,
title
,
ok
,
ok
,
cancel
,
cancel
,
handleHide
:
handleHideModal
handleHide
:
handleHideModal
}
}]
}
}
})
})
}
}
...
@@ -933,6 +955,20 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -933,6 +955,20 @@ export const FileExplorer = (props: FileExplorerProps) => {
<
TreeView
id=
'treeView'
>
<
TreeView
id=
'treeView'
>
<
TreeViewItem
id=
"treeViewItem"
<
TreeViewItem
id=
"treeViewItem"
label=
{
label=
{
<
div
onClick=
{
(
e
)
=>
{
e
.
stopPropagation
()
let
expandPath
=
[]
if
(
!
state
.
expandPath
.
includes
(
props
.
name
))
{
expandPath
=
[
props
.
name
,
...
new
Set
([...
state
.
expandPath
])]
}
else
{
expandPath
=
[...
new
Set
(
state
.
expandPath
.
filter
(
key
=>
key
&&
(
typeof
key
===
'string'
)
&&
!
key
.
startsWith
(
props
.
name
)))]
}
setState
(
prevState
=>
{
return
{
...
prevState
,
expandPath
}
})
plugin
.
resetFocus
(
true
)
}
}
>
<
FileExplorerMenu
<
FileExplorerMenu
title=
{
name
}
title=
{
name
}
menuItems=
{
props
.
menuItems
}
menuItems=
{
props
.
menuItems
}
...
@@ -942,8 +978,9 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -942,8 +978,9 @@ export const FileExplorer = (props: FileExplorerProps) => {
uploadFile=
{
uploadFile
}
uploadFile=
{
uploadFile
}
fileManager=
{
state
.
fileManager
}
fileManager=
{
state
.
fileManager
}
/>
/>
</
div
>
}
}
expand=
{
true
}
>
expand=
{
state
.
expandPath
.
includes
(
props
.
name
)
}
>
<
div
className=
'pb-2'
>
<
div
className=
'pb-2'
>
<
TreeView
id=
'treeViewMenu'
>
<
TreeView
id=
'treeViewMenu'
>
{
{
...
@@ -958,11 +995,11 @@ export const FileExplorer = (props: FileExplorerProps) => {
...
@@ -958,11 +995,11 @@ export const FileExplorer = (props: FileExplorerProps) => {
{
{
props
.
name
&&
<
ModalDialog
props
.
name
&&
<
ModalDialog
id=
{
props
.
name
}
id=
{
props
.
name
}
title=
{
state
.
modalOptions
.
title
}
title=
{
state
.
focusModal
.
title
}
message=
{
state
.
modalOptions
.
message
}
message=
{
state
.
focusModal
.
message
}
hide=
{
state
.
modalOptions
.
hide
}
hide=
{
state
.
focusModal
.
hide
}
ok=
{
state
.
modalOptions
.
ok
}
ok=
{
state
.
focusModal
.
ok
}
cancel=
{
state
.
modalOptions
.
cancel
}
cancel=
{
state
.
focusModal
.
cancel
}
handleHide=
{
handleHideModal
}
handleHide=
{
handleHideModal
}
/>
/>
}
}
...
...
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