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
e78ed7e6
Commit
e78ed7e6
authored
Sep 12, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add callback to provider set
parent
77929cef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
browser-files-tree.js
src/app/files/browser-files-tree.js
+3
-1
browser-files.js
src/app/files/browser-files.js
+5
-2
No files found.
src/app/files/browser-files-tree.js
View file @
e78ed7e6
...
...
@@ -53,11 +53,12 @@ function FilesTree (name, storage) {
return
content
}
this
.
set
=
function
(
path
,
content
)
{
this
.
set
=
function
(
path
,
content
,
cb
)
{
var
unprefixedpath
=
this
.
removePrefix
(
path
)
updateRefs
(
unprefixedpath
,
'add'
)
var
exists
=
storage
.
exists
(
unprefixedpath
)
if
(
!
storage
.
set
(
unprefixedpath
,
content
))
{
if
(
cb
)
cb
(
'error updating '
+
path
)
return
false
}
if
(
!
exists
)
{
...
...
@@ -65,6 +66,7 @@ function FilesTree (name, storage) {
}
else
{
event
.
trigger
(
'fileChanged'
,
[
this
.
type
+
'/'
+
unprefixedpath
])
}
if
(
cb
)
cb
()
return
true
}
...
...
src/app/files/browser-files.js
View file @
e78ed7e6
...
...
@@ -38,16 +38,18 @@ function Files (storage) {
return
content
}
this
.
set
=
function
(
path
,
content
)
{
this
.
set
=
function
(
path
,
content
,
cb
)
{
var
unprefixedpath
=
this
.
removePrefix
(
path
)
// NOTE: ignore the config file
if
(
path
===
'.remix.config'
)
{
if
(
cb
)
cb
(
'change not allowed'
)
return
false
}
if
(
!
this
.
isReadOnly
(
unprefixedpath
))
{
var
exists
=
storage
.
exists
(
unprefixedpath
)
if
(
!
storage
.
set
(
unprefixedpath
,
content
))
{
if
(
cb
)
cb
(
'error updating '
+
path
)
return
false
}
if
(
!
exists
)
{
...
...
@@ -55,9 +57,10 @@ function Files (storage) {
}
else
{
event
.
trigger
(
'fileChanged'
,
[
this
.
type
+
'/'
+
unprefixedpath
])
}
if
(
cb
)
cb
()
return
true
}
if
(
cb
)
cb
(
'is read only'
)
return
false
}
...
...
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