Skip to content

Commit

Permalink
fix: empty defaultpath focus
Browse files Browse the repository at this point in the history
  • Loading branch information
maxiaobo01 committed Jul 9, 2022
1 parent f83ba30 commit 47e42b0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions demo/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const App = () => {
// useEffect(() => {
// window.addEventListener('message', res => console.log(res));
// }, []);
const [activePath, setActivePath] = useState('/style.md');
const [activePath, setActivePath] = useState('/index.js');

useEffect(() => {
console.log(files);
Expand Down Expand Up @@ -176,7 +176,7 @@ const App = () => {
setActivePath(args[1]);
}}
ref={editorRef}
defaultPath="/app/index.jsx"
defaultPath={activePath}
defaultFiles={files}
options={{
fontSize: 14,
Expand Down
2 changes: 1 addition & 1 deletion src/multi/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const MultiEditorComp = React.forwardRef<MultiRefType, MultiEditorIProps>
const [openedFiles, setOpenedFiles] = useState<Array<{
status?: string,
path: string,
}>>(defaultPath ? [{
}>>(defaultPath && filesRef.current[defaultPath] ? [{
path: defaultPath,
}] : []);

Expand Down

0 comments on commit 47e42b0

Please sign in to comment.