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
9067c636
Unverified
Commit
9067c636
authored
Jan 25, 2021
by
yann300
Committed by
GitHub
Jan 25, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #769 from ethereum/open-focus
Open manually created file
parents
11c3db77
4a083e2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
addFile.ts
apps/remix-ide-e2e/src/commands/addFile.ts
+1
-1
file-explorer.tsx
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
+11
-4
No files found.
apps/remix-ide-e2e/src/commands/addFile.ts
View file @
9067c636
...
...
@@ -24,7 +24,7 @@ function addFile (browser: NightwatchBrowser, name: string, content: NightwatchC
.
sendKeys
(
'*[data-id="treeViewLitreeViewItembrowser/blank"] .remixui_items'
,
browser
.
Keys
.
ENTER
)
.
pause
(
2000
)
.
waitForElementVisible
(
`li[data-id="treeViewLitreeViewItembrowser/
${
name
}
"]`
)
.
click
(
`li[data-id="treeViewLitreeViewItembrowser/
${
name
}
"]`
)
//
.click(`li[data-id="treeViewLitreeViewItembrowser/${name}"]`)
.
setEditorValue
(
content
.
content
)
.
pause
(
1000
)
.
perform
(
function
()
{
...
...
libs/remix-ui/file-explorer/src/lib/file-explorer.tsx
View file @
9067c636
...
...
@@ -285,7 +285,12 @@ export const FileExplorer = (props: FileExplorerProps) => {
const
createFile
=
await
fileManager
.
writeFile
(
newName
,
''
)
if
(
!
createFile
)
{
toast
(
'Failed to create file '
+
newName
)
return
toast
(
'Failed to create file '
+
newName
)
}
else
{
await
fileManager
.
open
(
newName
)
setState
(
prevState
=>
{
return
{
...
prevState
,
focusElement
:
[{
key
:
newName
,
type
:
'file'
}]
}
})
}
}
})
...
...
@@ -300,7 +305,9 @@ export const FileExplorer = (props: FileExplorerProps) => {
if
(
exists
)
return
await
fileManager
.
mkdir
(
dirName
)
// addFolder(parentFolder, newFolderPath)
setState
(
prevState
=>
{
return
{
...
prevState
,
focusElement
:
[{
key
:
newFolderPath
,
type
:
'folder'
}]
}
})
}
catch
(
e
)
{
console
.
log
(
'error: '
,
e
)
toast
(
'Failed to create folder: '
+
newFolderPath
)
...
...
@@ -376,7 +383,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
setState
(
prevState
=>
{
const
uniquePaths
=
[...
new
Set
([...
prevState
.
expandPath
,
...
expandPath
])]
return
{
...
prevState
,
files
,
expandPath
:
uniquePaths
,
focusElement
:
[{
key
:
filePath
,
type
:
'file'
}]
}
return
{
...
prevState
,
files
,
expandPath
:
uniquePaths
}
})
if
(
filePath
.
includes
(
'_test.sol'
))
{
plugin
.
event
.
trigger
(
'newTestFileCreated'
,
[
filePath
])
...
...
@@ -393,7 +400,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
setState
(
prevState
=>
{
const
uniquePaths
=
[...
new
Set
([...
prevState
.
expandPath
,
...
expandPath
])]
return
{
...
prevState
,
files
,
expandPath
:
uniquePaths
,
focusElement
:
[{
key
:
folderPath
,
type
:
'folder'
}]
}
return
{
...
prevState
,
files
,
expandPath
:
uniquePaths
}
})
}
...
...
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