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
538d37f9
Commit
538d37f9
authored
Dec 06, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix save readonly explorer file
parent
f46b82d9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
basicReadOnlyExplorer.js
src/app/files/basicReadOnlyExplorer.js
+9
-2
No files found.
src/app/files/basicReadOnlyExplorer.js
View file @
538d37f9
...
@@ -32,15 +32,18 @@ class BasicReadOnlyExplorer {
...
@@ -32,15 +32,18 @@ class BasicReadOnlyExplorer {
}
}
set
(
path
,
content
,
cb
)
{
set
(
path
,
content
,
cb
)
{
this
.
addReadOnly
(
path
,
content
)
if
(
cb
)
cb
()
return
true
return
true
}
}
addReadOnly
(
path
,
content
)
{
addReadOnly
(
path
,
content
)
{
var
unprefixedPath
=
this
.
removePrefix
(
path
)
try
{
// lazy try to format JSON
try
{
// lazy try to format JSON
content
=
JSON
.
stringify
(
JSON
.
parse
(
content
),
null
,
'
\
t'
)
content
=
JSON
.
stringify
(
JSON
.
parse
(
content
),
null
,
'
\
t'
)
}
catch
(
e
)
{}
}
catch
(
e
)
{}
this
.
files
[
this
.
type
+
'/'
+
p
ath
]
=
content
this
.
files
[
this
.
type
+
'/'
+
unprefixedP
ath
]
=
content
this
.
event
.
trigger
(
'fileAdded'
,
[
this
.
type
+
'/'
+
p
ath
,
true
])
this
.
event
.
trigger
(
'fileAdded'
,
[
this
.
type
+
'/'
+
unprefixedP
ath
,
true
])
return
true
return
true
}
}
...
@@ -101,6 +104,10 @@ class BasicReadOnlyExplorer {
...
@@ -101,6 +104,10 @@ class BasicReadOnlyExplorer {
})
})
return
tree
return
tree
}
}
removePrefix
(
path
)
{
return
path
.
indexOf
(
this
.
type
+
'/'
)
===
0
?
path
.
replace
(
this
.
type
+
'/'
,
''
)
:
path
}
}
}
module
.
exports
=
BasicReadOnlyExplorer
module
.
exports
=
BasicReadOnlyExplorer
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