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
c90c0631
Commit
c90c0631
authored
Apr 19, 2017
by
chriseth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix readonly files in file explorer and sync to tabs.
parent
f303e7f7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
41 deletions
+20
-41
app.js
src/app.js
+10
-25
file-explorer.js
src/app/file-explorer.js
+5
-6
files.js
src/app/files.js
+1
-6
storage.js
src/app/storage.js
+4
-4
No files found.
src/app.js
View file @
c90c0631
...
...
@@ -161,21 +161,6 @@ var run = function () {
var
editor
=
new
Editor
(
document
.
getElementById
(
'input'
))
// ---------------- FilePanel --------------------
/****************************************************************************
var sources = {
'test/client/credit.sol': '',
'src/voting.sol': '',
'src/leasing.sol': '',
'src/gmbh/contract.sol': false,
'src/gmbh/test.sol': false,
'src/gmbh/company.sol': false,
'src/gmbh/node_modules/ballot.sol': false,
'src/ug/finance.sol': false,
'app/solidity/mode.sol': true,
'app/ethereum/constitution.sol': true
}
Object.keys(sources).forEach(function (key) { files.set(key, sources[key]) })
/****************************************************************************/
var
css
=
csjs
`
.filepanel {
display : flex;
...
...
@@ -215,7 +200,7 @@ var run = function () {
})
api
.
register
(
'focus'
,
function
(
path
)
{
[...
window
.
files
.
querySelectorAll
(
'.file .name'
)].
forEach
(
function
(
span
)
{
if
(
span
.
innerText
===
path
)
switchToFile
(
path
)
// @TODO: scroll into view
if
(
span
.
innerText
===
path
)
switchToFile
(
path
)
})
})
files
.
event
.
register
(
'fileRenamed'
,
function
(
oldName
,
newName
)
{
...
...
@@ -224,7 +209,15 @@ var run = function () {
})
})
files
.
event
.
register
(
'fileRemoved'
,
function
(
path
)
{
if
(
path
===
ui
.
get
(
'currentFile'
))
ui
.
set
(
'currentFile'
,
''
)
editor
.
discard
(
path
)
if
(
path
===
ui
.
get
(
'currentFile'
))
{
ui
.
set
(
'currentFile'
,
''
)
switchToNextFile
()
}
refreshTabs
()
})
files
.
event
.
register
(
'fileAdded'
,
function
(
path
)
{
refreshTabs
()
})
// ------------------ gist publish --------------
...
...
@@ -342,10 +335,6 @@ var run = function () {
if
(
confirm
(
'Are you sure you want to remove: '
+
name
+
' from local storage?'
))
{
if
(
!
files
.
remove
(
name
))
{
alert
(
'Error while removing file'
)
}
else
{
ui
.
set
(
'currentFile'
,
''
)
switchToNextFile
()
editor
.
discard
(
name
)
}
}
return
false
...
...
@@ -394,10 +383,6 @@ var run = function () {
}
$
(
'#input'
).
toggle
(
currentFileOpen
)
$
(
'#output'
).
toggle
(
currentFileOpen
)
$filesEl
.
animate
({
left
:
Math
.
max
((
0
-
activeFilePos
()
+
(
FILE_SCROLL_DELTA
/
2
)),
0
)
+
'px'
},
'slow'
,
function
()
{
reAdjust
()
})
}
var
$scrollerRight
=
$
(
'.scroller-right'
)
...
...
src/app/file-explorer.js
View file @
c90c0631
...
...
@@ -76,11 +76,14 @@ function fileExplorer (appAPI, files) {
</span>
`
appUI
.
register
(
'currentFile'
,
fileFocus
)
appUI
.
register
(
'fileChanged'
,
(
changedFiles
)
=>
{
if
(
changedFiles
[
0
]
==
'currentFile'
)
{
fileFocus
(
files
.
get
(
'currentfile'
))
}
})
fileEvents
.
register
(
'fileRemoved'
,
fileRemoved
)
fileEvents
.
register
(
'fileRenamed'
,
fileRenamed
)
fileEvents
.
register
(
'fileAdded'
,
fileAdded
)
fileEvents
.
register
(
'fileChanged'
,
fileChanged
)
var
filepath
=
null
var
focusElement
=
null
...
...
@@ -216,8 +219,6 @@ function fileExplorer (appAPI, files) {
})
}
function
fileChanged
(
filepath
)
{
}
function
fileFocus
(
path
)
{
if
(
filepath
===
path
)
return
filepath
=
path
...
...
@@ -253,8 +254,6 @@ function fileExplorer (appAPI, files) {
el
.
className
=
css
.
fileexplorer
element
.
parentElement
.
replaceChild
(
el
,
element
)
element
=
el
fileFocus
(
filepath
)
appAPI
.
switchToFile
(
filepath
)
}
element
.
api
=
api
...
...
src/app/files.js
View file @
c90c0631
...
...
@@ -138,12 +138,7 @@ function Files (storage) {
var
tree
=
{}
var
self
=
this
storage
.
keys
().
forEach
(
function
(
path
)
{
// NOTE: as a temporary measure do not show the config file
if
(
path
===
'.remix.config'
)
{
return
}
Object
.
keys
(
this
.
list
()).
forEach
(
function
(
path
)
{
hashmapize
(
tree
,
path
,
{
'/readonly'
:
self
.
isReadOnly
(
path
),
'/content'
:
self
.
get
(
path
)
...
...
src/app/storage.js
View file @
c90c0631
...
...
@@ -39,17 +39,17 @@ function Storage (prefix) {
this
.
keys
=
function
()
{
return
safeKeys
()
// filter any names not including
sol:
// filter any names not including
the prefix
.
filter
(
function
(
item
)
{
return
item
.
indexOf
(
prefix
,
0
)
===
0
})
// remove
sol:
from filename
.
map
(
function
(
item
)
{
return
item
.
replace
(
/^sol:/
,
''
)
})
// remove
prefix
from filename
.
map
(
function
(
item
)
{
return
item
.
substr
(
prefix
.
length
)
})
}
// on startup, upgrade the old storage layout
safeKeys
().
forEach
(
function
(
name
)
{
if
(
name
.
indexOf
(
'sol-cache-file-'
,
0
)
===
0
)
{
var
content
=
window
.
localStorage
.
getItem
(
name
)
window
.
localStorage
.
setItem
(
name
.
replace
(
/^sol-cache-file-/
,
prefix
),
content
)
window
.
localStorage
.
setItem
(
name
.
replace
(
/^sol-cache-file-/
,
'sol:'
),
content
)
window
.
localStorage
.
removeItem
(
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