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
e8917724
Commit
e8917724
authored
Jan 25, 2018
by
serapath
Committed by
yann300
Feb 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix file explorer update events 1/2
parent
f9e518ac
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
20 deletions
+28
-20
app.js
src/app.js
+1
-1
browser-files.js
src/app/files/browser-files.js
+8
-4
file-explorer.js
src/app/files/file-explorer.js
+18
-15
shared-folder.js
src/app/files/shared-folder.js
+1
-0
No files found.
src/app.js
View file @
e8917724
...
...
@@ -497,7 +497,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
switchFile
:
function
(
path
)
{
fileManager
.
switchFile
(
path
)
},
event
:
this
.
event
,
event
:
fileManager
.
event
,
currentFile
:
function
()
{
return
config
.
get
(
'currentFile'
)
},
...
...
src/app/files/browser-files.js
View file @
e8917724
...
...
@@ -118,19 +118,21 @@ function Files (storage) {
this
.
resolveDirectory
=
function
(
path
,
callback
)
{
var
self
=
this
if
(
path
[
0
]
===
'/'
)
path
=
path
.
substring
(
1
)
if
(
path
[
0
]
===
'.'
&&
path
[
1
]
===
'/'
)
path
=
path
.
substring
(
2
)
if
(
!
path
)
return
callback
(
null
,
{
[
self
.
type
]:
{
}
})
path
=
self
.
removePrefix
(
''
+
(
path
||
''
))
var
filesList
=
{}
var
tree
=
{}
// add r/w filesList to the list
storage
.
keys
().
forEach
((
path
)
=>
{
// NOTE: as a temporary measure do not show the config file
if
(
path
!==
'.remix.config'
)
{
filesList
[
self
.
type
+
'/'
+
path
]
=
false
filesList
[
path
]
=
false
}
})
// add r/o files to the list
Object
.
keys
(
readonly
).
forEach
((
path
)
=>
{
filesList
[
self
.
type
+
'/'
+
path
]
=
true
filesList
[
path
]
=
true
})
Object
.
keys
(
filesList
).
forEach
(
function
(
path
)
{
...
...
@@ -139,7 +141,7 @@ function Files (storage) {
'/content'
:
self
.
get
(
path
)
})
})
return
callback
(
null
,
tree
[
path
]
||
{}
)
return
callback
(
null
,
tree
)
function
hashmapize
(
obj
,
path
,
val
)
{
var
nodes
=
path
.
split
(
'/'
)
var
i
=
0
...
...
@@ -155,7 +157,9 @@ function Files (storage) {
}
this
.
removePrefix
=
function
(
path
)
{
return
path
.
indexOf
(
this
.
type
+
'/'
)
===
0
?
path
.
replace
(
this
.
type
+
'/'
,
''
)
:
path
path
=
path
.
indexOf
(
this
.
type
)
===
0
?
path
.
replace
(
this
.
type
,
''
)
:
path
if
(
path
[
0
]
===
'/'
)
return
path
.
substring
(
1
)
return
path
}
// rename .browser-solidity.json to .remix.config
...
...
src/app/files/file-explorer.js
View file @
e8917724
...
...
@@ -53,6 +53,8 @@ var css = csjs`
`
module
.
exports
=
fileExplorer
var
focusElement
=
null
function
fileExplorer
(
appAPI
,
files
)
{
var
self
=
this
this
.
files
=
files
...
...
@@ -101,7 +103,7 @@ function fileExplorer (appAPI, files) {
}
},
formatSelf
:
function
formatSelf
(
key
,
data
,
li
)
{
var
isRoot
=
data
.
path
.
indexOf
(
'/'
)
===
-
1
var
isRoot
=
data
.
path
===
self
.
files
.
type
return
yo
`<label class="
${
data
.
children
?
css
.
folder
:
css
.
file
}
"
data-path="
${
data
.
path
}
"
style="
${
isRoot
?
'font-weight:bold;'
:
''
}
"
...
...
@@ -125,7 +127,7 @@ function fileExplorer (appAPI, files) {
if
(
!
fileTree
)
return
var
newTree
=
normalize
(
path
,
fileTree
)
var
tree
=
self
.
treeView
.
renderProperties
(
newTree
,
false
)
childrenContainer
.
appendChild
(
tree
)
;[...
tree
.
children
].
forEach
(
child
=>
childrenContainer
.
appendChild
(
child
)
)
})
})
...
...
@@ -143,7 +145,6 @@ function fileExplorer (appAPI, files) {
<i class="fa fa-trash" aria-hidden="true"></i>
</span>
`
appAPI
.
event
.
register
(
'currentFileChanged'
,
(
newFile
,
explorer
)
=>
{
if
(
explorer
===
files
)
{
fileFocus
(
newFile
)
...
...
@@ -157,7 +158,6 @@ function fileExplorer (appAPI, files) {
fileEvents
.
register
(
'fileAdded'
,
fileAdded
)
var
filepath
=
null
var
focusElement
=
null
var
textUnderEdit
=
null
var
textInRename
=
false
...
...
@@ -335,19 +335,20 @@ function fileExplorer (appAPI, files) {
function
fileFocus
(
path
)
{
if
(
filepath
===
path
)
return
filepath
=
path
var
el
=
getElement
(
filepath
)
expandPathTo
(
el
)
setTimeout
(
function
focusNode
()
{
el
.
click
()
},
0
)
setTimeout
(
function
focusNode
()
{
// @TODO: fix file tree expand logic to account for async remixd loading logic
var
el
=
getElement
(
filepath
)
expandPathTo
(
el
)
setTimeout
(
function
focusNode
()
{
el
.
click
()
},
0
)
},
0
)
}
function
fileRemoved
(
filepath
)
{
// @TODO: only important if currently visible in TreeView
var
li
=
getElement
(
filepath
)
if
(
li
)
li
.
parentElement
.
removeChild
(
li
)
}
function
fileRenamed
(
oldName
,
newName
,
isFolder
)
{
// @TODO: only important if currently visible in TreeView
var
li
=
getElement
(
oldName
)
if
(
li
)
{
oldName
=
oldName
.
split
(
'/'
)
...
...
@@ -369,13 +370,15 @@ function fileExplorer (appAPI, files) {
}
function
fileAdded
(
filepath
)
{
// @TODO: only important if currently visible in TreeView
self
.
files
.
resolveDirectory
(
'./'
,
(
error
,
files
)
=>
{
var
folderpath
=
filepath
.
split
(
'/'
).
slice
(
0
,
-
1
).
join
(
'/'
)
self
.
files
.
resolveDirectory
(
folderpath
,
(
error
,
fileTree
)
=>
{
if
(
error
)
console
.
error
(
error
)
var
element
=
self
.
treeView
.
render
(
files
)
element
.
className
=
css
.
fileexplorer
self
.
element
.
parentElement
.
replaceChild
(
element
,
self
.
element
)
self
.
element
=
element
if
(
!
fileTree
)
return
fileTree
=
normalize
(
folderpath
,
fileTree
)
var
newTree
=
self
.
treeView
.
renderProperties
(
fileTree
,
false
)
var
currentTree
=
self
.
treeView
.
nodeAt
(
folderpath
)
currentTree
.
innerHTML
=
''
;[...
newTree
.
children
].
forEach
(
child
=>
currentTree
.
appendChild
(
child
))
})
}
}
...
...
src/app/files/shared-folder.js
View file @
e8917724
...
...
@@ -159,6 +159,7 @@ module.exports = class SharedFolder {
resolveDirectory
(
path
,
callback
)
{
var
self
=
this
if
(
path
[
0
]
===
'/'
)
path
=
path
.
substring
(
1
)
if
(
path
[
0
]
===
'.'
&&
path
[
1
]
===
'/'
)
path
=
path
.
substring
(
2
)
if
(
!
path
)
return
callback
(
null
,
{
[
self
.
type
]:
{
}
})
path
=
self
.
removePrefix
(
''
+
(
path
||
''
))
self
.
remixd
.
dir
(
path
,
callback
)
...
...
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