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
e4c026bd
Commit
e4c026bd
authored
Jun 28, 2019
by
LianaHus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"save as" saves a copy with .vy extention and a number
parent
32ae5681
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
+22
-9
fileManager.js
src/app/files/fileManager.js
+22
-9
No files found.
src/app/files/fileManager.js
View file @
e4c026bd
...
...
@@ -5,6 +5,7 @@ const EventEmitter = require('events')
var
globalRegistry
=
require
(
'../../global/registry'
)
var
CompilerImport
=
require
(
'../compiler/compiler-imports'
)
var
toaster
=
require
(
'../ui/tooltip'
)
var
helper
=
require
(
'../../lib/helper.js'
)
import
{
FileSystemApi
}
from
'remix-plugin'
import
*
as
packageJson
from
'../../../package.json'
...
...
@@ -136,19 +137,31 @@ class FileManager extends FileSystemApi {
async
setFile
(
path
,
content
)
{
if
(
this
.
currentRequest
)
{
let
reject
=
false
let
savedAs
AnotherFile
=
false
let
savedAs
Copy
=
false
let
actions
=
(
toaster
)
=>
{
return
yo
`<div class="container ml-1">
<button class="btn btn-primary btn-sm m-1" onclick=
${(
e
)
=>
{
reject
=
true
;
e
.
target
.
innerHTML
=
'Canceled'
;
toaster
.
hide
()
}}
>
Cancel
<
/button
>
<button class="btn btn-primary btn-sm m-1" onclick=
${(
e
)
=>
{
if
(
savedAsAnotherFile
)
return
savedAsAnotherFile
=
true
const
newPath
=
path
+
'.'
+
this
.
currentRequest
.
from
this
.
_setFileInternal
(
newPath
,
content
)
this
.
switchFile
(
newPath
)
reject
=
true
;
e
.
target
.
innerHTML
=
'Canceled'
;
toaster
.
hide
()
}}
>
Cancel
<
/button
>
<
button
class
=
"btn btn-primary btn-sm m-1"
onclick
=
$
{(
e
)
=>
{
if
(
savedAsCopy
)
return
savedAsCopy
=
true
const
fileProvider
=
this
.
fileProviderOf
(
path
)
if
(
!
fileProvider
)
return
helper
.
createNonClashingNameWithPrefix
(
path
,
fileProvider
,
''
,
(
error
,
newFile
)
=>
{
if
(
error
)
return
modalDialogCustom
.
alert
(
'Failed to create file. '
+
newFile
+
' '
+
error
)
if
(
!
fileProvider
.
set
(
newFile
,
content
))
return
modalDialogCustom
.
alert
(
'Failed to create a file '
+
newFile
)
this
.
switchFile
(
newFile
)
})
e
.
target
.
innerHTML
=
'Saved'
toaster
.
hide
()
}}
>
Save
As
Copy
<
/button
>
}}
>
Save
As
Copy
<
/button
>
<
/div>
`
}
await toaster(yo`
...
...
@@ -159,7 +172,7 @@ class FileManager extends FileSystemApi {
<
/span
>
<
/div>`, actions, { time: 4000 }
)
if
(
reject
)
throw
new
Error
(
`set file operation on
${
path
}
aborted by user.`
)
if
(
savedAs
AnotherFile
)
return
if
(
savedAs
Copy
)
return
}
this
.
_setFileInternal
(
path
,
content
)
}
...
...
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