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
a79cd654
Unverified
Commit
a79cd654
authored
Apr 30, 2021
by
yann300
Committed by
GitHub
Apr 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use workspace provider for setting up the files (#978)
fix
https://github.com/ethereum/remix-project/issues/976
parent
3b91875c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
file-panel.js
apps/remix-ide/src/app/panels/file-panel.js
+5
-4
remix-ui-workspace.tsx
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
+4
-0
No files found.
apps/remix-ide/src/app/panels/file-panel.js
View file @
a79cd654
...
...
@@ -136,6 +136,7 @@ module.exports = class Filepanel extends ViewPlugin {
}
async
initWorkspace
()
{
this
.
renderComponent
()
const
queryParams
=
new
QueryParams
()
const
gistHandler
=
new
GistHandler
()
const
params
=
queryParams
.
get
()
...
...
@@ -203,13 +204,13 @@ module.exports = class Filepanel extends ViewPlugin {
if
(
checkSpecialChars
(
workspaceName
)
||
checkSlash
(
workspaceName
))
throw
new
Error
(
'special characters are not allowed'
)
if
(
await
this
.
workspaceExists
(
workspaceName
))
throw
new
Error
(
'workspace already exists'
)
else
{
this
.
_deps
.
fileProviders
.
workspace
.
setWorkspace
(
workspaceName
)
const
browserProvider
=
this
.
_deps
.
fileProviders
.
browser
const
workspacesPath
=
this
.
_deps
.
fileProviders
.
workspace
.
workspacesPath
const
workspaceProvider
=
this
.
_deps
.
fileProviders
.
workspace
await
this
.
processCreateWorkspace
(
workspaceName
)
workspaceProvider
.
setWorkspace
(
workspaceName
)
await
this
.
request
.
setWorkspace
(
workspaceName
)
// tells the react component to switch to that workspace
for
(
const
file
in
examples
)
{
try
{
await
browserProvider
.
set
(
'browser/'
+
workspacesPath
+
'/'
+
workspaceName
+
'/'
+
examples
[
file
].
name
,
examples
[
file
].
content
)
await
workspaceProvider
.
set
(
examples
[
file
].
name
,
examples
[
file
].
content
)
}
catch
(
error
)
{
console
.
error
(
error
)
}
...
...
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
View file @
a79cd654
...
...
@@ -49,6 +49,10 @@ export const Workspace = (props: WorkspaceProps) => {
return
createWorkspace
()
}
props
.
request
.
setWorkspace
=
(
workspaceName
)
=>
{
return
setWorkspace
(
workspaceName
)
}
props
.
request
.
createNewFile
=
()
=>
{
if
(
!
state
.
workspaces
.
length
)
createNewWorkspace
(
'default_workspace'
)
props
.
plugin
.
resetNewFile
()
...
...
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