Skip to content

Commit

Permalink
fix: editor disappear when closing a maximized panel (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalYoung authored Jul 29, 2021
1 parent d8a6e43 commit 7b32028
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions src/workbench/workbench.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,32 @@ export function WorkbenchView(props: IWorkbench & ILayout & ILayoutController) {
horizontalSplitPanePos,
} = props;

const getContent = (panelMaximized: boolean, panelHidden: boolean) => {
const editor = (
<Pane
initialSize={panelHidden ? '100%' : horizontalSplitPanePos[0]}
maxSize="100%"
minSize="10%"
>
<EditorView />
</Pane>
);

const panel = (
<Pane>
<PanelView />
</Pane>
);

if (panelHidden) {
return editor;
}
if (panelMaximized) {
return panel;
}
return [editor, panel];
};

return (
<div id={ID_APP} className={appClassName} tabIndex={0}>
<div className={workbenchClassName}>
Expand Down Expand Up @@ -75,24 +101,7 @@ export function WorkbenchView(props: IWorkbench & ILayout & ILayoutController) {
// react-split-pane onChange: (newSizes: [size, ratio]) => void;
onChange={onHorizontalPaneSizeChange as any}
>
{!panel.panelMaximized ? (
<Pane
initialSize={
panel.hidden
? '100%'
: horizontalSplitPanePos[0]
}
maxSize="100%"
minSize="10%"
>
<EditorView />
</Pane>
) : null}
{!panel.hidden ? (
<Pane>
<PanelView />
</Pane>
) : null}
{getContent(!!panel.panelMaximized, !!panel.hidden)}
</SplitPane>
</SplitPane>
</div>
Expand Down

0 comments on commit 7b32028

Please sign in to comment.