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
e73f6df4
Commit
e73f6df4
authored
Mar 02, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix creation of "code-sample" && use of initialWorkspace
parent
f0a274ae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
file-panel.js
apps/remix-ide/src/app/panels/file-panel.js
+3
-3
remix-ui-workspace.tsx
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
+8
-6
No files found.
apps/remix-ide/src/app/panels/file-panel.js
View file @
e73f6df4
...
...
@@ -139,12 +139,12 @@ module.exports = class Filepanel extends ViewPlugin {
if
(
loadedFromGist
)
return
if
(
params
.
code
)
{
try
{
await
this
.
_deps
.
fileManager
.
c
reateWorkspace
(
'code-sample'
)
await
this
.
processC
reateWorkspace
(
'code-sample'
)
this
.
_deps
.
fileProviders
.
workspace
.
setWorkspace
(
'code-sample'
)
var
hash
=
ethutil
.
bufferToHex
(
ethutil
.
keccak
(
params
.
code
))
const
fileName
=
'contract-'
+
hash
.
replace
(
'0x'
,
''
).
substring
(
0
,
10
)
+
'.sol'
const
path
=
'browser/'
+
workspacesPath
+
'/code-sample/'
+
fileName
await
this
.
_deps
.
file
Manager
.
writeFile
(
path
,
atob
(
params
.
code
))
const
path
=
fileName
await
this
.
_deps
.
file
Providers
.
workspace
.
set
(
path
,
atob
(
params
.
code
))
this
.
initialWorkspace
=
'code-sample'
await
this
.
_deps
.
fileManager
.
openFile
(
fileName
)
}
catch
(
e
)
{
...
...
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
View file @
e73f6df4
...
...
@@ -62,12 +62,7 @@ export const Workspace = (props: WorkspaceProps) => {
useEffect
(()
=>
{
const
getWorkspaces
=
async
()
=>
{
if
(
props
.
workspaces
&&
Array
.
isArray
(
props
.
workspaces
))
{
if
(
props
.
initialWorkspace
)
{
props
.
workspace
.
setWorkspace
(
props
.
initialWorkspace
)
setState
(
prevState
=>
{
return
{
...
prevState
,
workspaces
:
props
.
workspaces
,
currentWorkspace
:
props
.
initialWorkspace
}
})
}
else
if
(
props
.
workspaces
.
length
>
0
&&
state
.
currentWorkspace
===
NO_WORKSPACE
)
{
if
(
props
.
workspaces
.
length
>
0
&&
state
.
currentWorkspace
===
NO_WORKSPACE
)
{
props
.
workspace
.
setWorkspace
(
props
.
workspaces
[
0
])
setState
(
prevState
=>
{
return
{
...
prevState
,
workspaces
:
props
.
workspaces
,
currentWorkspace
:
props
.
workspaces
[
0
]
}
...
...
@@ -91,6 +86,13 @@ export const Workspace = (props: WorkspaceProps) => {
props
.
localhost
.
event
.
register
(
'disconnected'
,
(
event
)
=>
{
remixdExplorer
.
hide
()
})
if
(
props
.
initialWorkspace
)
{
props
.
workspace
.
setWorkspace
(
props
.
initialWorkspace
)
setState
(
prevState
=>
{
return
{
...
prevState
,
currentWorkspace
:
props
.
initialWorkspace
}
})
}
},
[])
const
[
state
,
setState
]
=
useState
({
...
...
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