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
9913b04b
Commit
9913b04b
authored
Feb 02, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move addFile to file-panel.js
parent
2b4e2019
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
file-explorer.js
src/app/files/file-explorer.js
+0
-24
file-panel.js
src/app/panels/file-panel.js
+25
-1
No files found.
src/app/files/file-explorer.js
100755 → 100644
View file @
9913b04b
...
...
@@ -165,30 +165,6 @@ function fileExplorer (appAPI, files) {
var
textUnderEdit
=
null
var
textInRename
=
false
self
.
api
=
{}
self
.
api
.
addFile
=
function
addFile
(
file
)
{
function
loadFile
()
{
var
fileReader
=
new
FileReader
()
fileReader
.
onload
=
function
(
event
)
{
if
(
helper
.
checkSpecialChars
(
file
.
name
))
{
modalDialogCustom
.
alert
(
'Special characters are not allowed'
)
return
}
var
success
=
files
.
set
(
name
,
event
.
target
.
result
)
if
(
!
success
)
modalDialogCustom
.
alert
(
'Failed to create file '
+
name
)
else
self
.
events
.
trigger
(
'focus'
,
[
name
])
}
fileReader
.
readAsText
(
file
)
}
var
name
=
files
.
type
+
'/'
+
file
.
name
if
(
!
files
.
exists
(
name
))
{
loadFile
()
}
else
{
modalDialogCustom
.
confirm
(
null
,
`The file
${
name
}
already exists! Would you like to overwrite it?`
,
()
=>
{
loadFile
()
})
}
}
function
getElement
(
path
)
{
var
label
=
self
.
element
.
querySelector
(
`label[data-path="
${
path
}
"]`
)
if
(
label
)
return
getLiFrom
(
label
)
...
...
src/app/panels/file-panel.js
View file @
9913b04b
/* global FileReader */
var
async
=
require
(
'async'
)
var
$
=
require
(
'jquery'
)
var
yo
=
require
(
'yo-yo'
)
...
...
@@ -143,7 +144,30 @@ function filepanel (appAPI, filesProvider) {
// the files module. Please ask the user here if they want to overwrite
// a file and then just use `files.add`. The file explorer will
// pick that up via the 'fileAdded' event from the files module.
;[...
this
.
files
].
forEach
(
fileExplorer
.
api
.
addFile
)
;[...
this
.
files
].
forEach
((
file
)
=>
{
var
files
=
fileExplorer
.
files
function
loadFile
()
{
var
fileReader
=
new
FileReader
()
fileReader
.
onload
=
function
(
event
)
{
if
(
helper
.
checkSpecialChars
(
file
.
name
))
{
modalDialogCustom
.
alert
(
'Special characters are not allowed'
)
return
}
var
success
=
files
.
set
(
name
,
event
.
target
.
result
)
if
(
!
success
)
modalDialogCustom
.
alert
(
'Failed to create file '
+
name
)
else
self
.
events
.
trigger
(
'focus'
,
[
name
])
}
fileReader
.
readAsText
(
file
)
}
var
name
=
files
.
type
+
'/'
+
file
.
name
if
(
!
files
.
exists
(
name
))
{
loadFile
()
}
else
{
modalDialogCustom
.
confirm
(
null
,
`The file
${
name
}
already exists! Would you like to overwrite it?`
,
()
=>
{
loadFile
()
})
}
})
}
// ----------------- resizeable ui ---------------
...
...
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