From 10c49bf7942e70625eed9ff6d7b4962f889390a5 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Fri, 30 Apr 2021 18:26:39 +0100 Subject: [PATCH] Fixed file linking for libraries --- libs/remix-ui/file-explorer/src/lib/file-explorer.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx index a2566c5848..fc8c89450a 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx @@ -240,7 +240,9 @@ export const FileExplorer = (props: FileExplorerProps) => { if (!createFile) { return toast('Failed to create file ' + newName) } else { - await fileManager.open(newName) + const path = newName.indexOf(props.name + '/') === 0 ? newName.replace(props.name + '/', '') : newName + + await fileManager.open(path) setState(prevState => { return { ...prevState, focusElement: [{ key: newName, type: 'file' }] } }) @@ -557,6 +559,7 @@ export const FileExplorer = (props: FileExplorerProps) => { } const handleClickFile = (path: string) => { + path = path.indexOf(props.name + '/') === 0 ? path.replace(props.name + '/', '') : path state.fileManager.open(path) setState(prevState => { return { ...prevState, focusElement: [{ key: path, type: 'file' }] }