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
e7120360
Commit
e7120360
authored
Feb 02, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix element
parent
1c252bd8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
18 deletions
+25
-18
file-explorer.js
src/app/files/file-explorer.js
+25
-18
No files found.
src/app/files/file-explorer.js
View file @
e7120360
...
@@ -53,14 +53,12 @@ var css = csjs`
...
@@ -53,14 +53,12 @@ var css = csjs`
`
`
module
.
exports
=
fileExplorer
module
.
exports
=
fileExplorer
var
focusElement
=
null
var
focusPath
=
null
function
fileExplorer
(
appAPI
,
files
)
{
function
fileExplorer
(
appAPI
,
files
)
{
var
self
=
this
var
self
=
this
this
.
events
=
new
EventManager
()
this
.
events
=
new
EventManager
()
this
.
files
=
files
this
.
files
=
files
this
.
focusElement
=
null
this
.
focusPath
=
null
function
remixdDialog
()
{
function
remixdDialog
()
{
return
yo
`<div>This file has been changed outside of Remix IDE.</div>`
return
yo
`<div>This file has been changed outside of Remix IDE.</div>`
}
}
...
@@ -117,7 +115,18 @@ function fileExplorer (appAPI, files) {
...
@@ -117,7 +115,18 @@ function fileExplorer (appAPI, files) {
})
})
self
.
treeView
.
event
.
register
(
'leafClick'
,
function
(
key
,
data
,
label
)
{
self
.
treeView
.
event
.
register
(
'leafClick'
,
function
(
key
,
data
,
label
)
{
if
(
self
.
focusElement
)
{
self
.
focusElement
.
classList
.
remove
(
css
.
hasFocus
)
self
.
focusElement
=
null
self
.
focusPath
=
null
}
self
.
focusElement
=
self
.
treeView
.
labelAt
(
key
)
if
(
self
.
focusElement
)
{
self
.
focusElement
.
classList
.
add
(
css
.
hasFocus
)
self
.
focusPath
=
key
self
.
events
.
trigger
(
'focus'
,
[
key
])
self
.
events
.
trigger
(
'focus'
,
[
key
])
appAPI
.
config
.
set
(
'currentFile'
,
key
)
}
})
})
self
.
treeView
.
event
.
register
(
'nodeClick'
,
function
(
path
,
childrenContainer
)
{
self
.
treeView
.
event
.
register
(
'nodeClick'
,
function
(
path
,
childrenContainer
)
{
...
@@ -130,8 +139,7 @@ function fileExplorer (appAPI, files) {
...
@@ -130,8 +139,7 @@ function fileExplorer (appAPI, files) {
if
(
error
)
console
.
error
(
error
)
if
(
error
)
console
.
error
(
error
)
if
(
!
fileTree
)
return
if
(
!
fileTree
)
return
var
newTree
=
normalize
(
path
,
fileTree
)
var
newTree
=
normalize
(
path
,
fileTree
)
newTree
=
self
.
treeView
.
renderProperties
(
newTree
,
false
)
self
.
treeView
.
updateNodeFromJSON
(
path
,
newTree
,
false
)
self
.
treeView
.
updateNode
(
path
,
newTree
)
})
})
})
})
...
@@ -145,16 +153,10 @@ function fileExplorer (appAPI, files) {
...
@@ -145,16 +153,10 @@ function fileExplorer (appAPI, files) {
}
}
appAPI
.
event
.
register
(
'currentFileChanged'
,
(
newFile
,
explorer
)
=>
{
appAPI
.
event
.
register
(
'currentFileChanged'
,
(
newFile
,
explorer
)
=>
{
if
(
focusElement
&&
newFile
!==
focusPath
)
{
if
(
self
.
focusElement
&&
explorer
.
type
!==
files
.
type
&&
self
.
focusPath
!==
newFile
)
{
focusElement
.
classList
.
remove
(
css
.
hasFocus
)
self
.
focusElement
.
classList
.
remove
(
css
.
hasFocus
)
}
self
.
focusElement
=
null
if
(
explorer
===
files
)
{
self
.
focusPath
=
null
focusElement
=
self
.
treeView
.
labelAt
(
newFile
)
if
(
focusElement
)
{
focusPath
=
newFile
focusElement
.
classList
.
add
(
css
.
hasFocus
)
appAPI
.
config
.
set
(
'currentFile'
,
newFile
)
}
}
}
})
})
fileEvents
.
register
(
'fileRemoved'
,
fileRemoved
)
fileEvents
.
register
(
'fileRemoved'
,
fileRemoved
)
...
@@ -273,8 +275,13 @@ function fileExplorer (appAPI, files) {
...
@@ -273,8 +275,13 @@ function fileExplorer (appAPI, files) {
if
(
error
)
console
.
error
(
error
)
if
(
error
)
console
.
error
(
error
)
if
(
!
fileTree
)
return
if
(
!
fileTree
)
return
fileTree
=
normalize
(
folderpath
,
fileTree
)
fileTree
=
normalize
(
folderpath
,
fileTree
)
var
newTree
=
self
.
treeView
.
renderProperties
(
fileTree
,
false
)
self
.
treeView
.
updateNodeFromJSON
(
folderpath
,
fileTree
,
false
)
self
.
treeView
.
updateNode
(
folderpath
,
newTree
)
self
.
focusElement
=
self
.
treeView
.
labelAt
(
self
.
focusPath
)
// TODO: here we update the selected file (it applicable)
// cause we are refreshing the interface of the whole directory when there's a new file.
if
(
self
.
focusElement
&&
!
self
.
focusElement
.
classList
.
contains
(
css
.
hasFocus
))
{
self
.
focusElement
.
classList
.
add
(
css
.
hasFocus
)
}
})
})
}
}
})
})
...
...
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