Fixed file linking for libraries

pull/5370/head
ioedeveloper 4 years ago
parent a56a1ca8b3
commit 10c49bf794
  1. 5
      libs/remix-ui/file-explorer/src/lib/file-explorer.tsx

@ -240,7 +240,9 @@ export const FileExplorer = (props: FileExplorerProps) => {
if (!createFile) { if (!createFile) {
return toast('Failed to create file ' + newName) return toast('Failed to create file ' + newName)
} else { } else {
await fileManager.open(newName) const path = newName.indexOf(props.name + '/') === 0 ? newName.replace(props.name + '/', '') : newName
await fileManager.open(path)
setState(prevState => { setState(prevState => {
return { ...prevState, focusElement: [{ key: newName, type: 'file' }] } return { ...prevState, focusElement: [{ key: newName, type: 'file' }] }
}) })
@ -557,6 +559,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
} }
const handleClickFile = (path: string) => { const handleClickFile = (path: string) => {
path = path.indexOf(props.name + '/') === 0 ? path.replace(props.name + '/', '') : path
state.fileManager.open(path) state.fileManager.open(path)
setState(prevState => { setState(prevState => {
return { ...prevState, focusElement: [{ key: path, type: 'file' }] } return { ...prevState, focusElement: [{ key: path, type: 'file' }] }

Loading…
Cancel
Save