Skip to content

Commit 5c517f1

Browse files
committed
fix(frontend/editor): Open new panels within code panels
1 parent 3d17da8 commit 5c517f1

File tree

1 file changed

+11
-3
lines changed
  • frontend/src/features/editor/services

1 file changed

+11
-3
lines changed

frontend/src/features/editor/services/editor.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@ export async function openFile(filepath: string) {
1818
const id = `file:${filepath}`;
1919
const filename = filepath.split("/").pop();
2020

21-
if (!untrack(dockview).getPanel(id)) {
22-
untrack(dockview).addPanel({
21+
const dockview_ = untrack(dockview);
22+
if (!dockview_.getPanel(id)) {
23+
const nearestPanel = dockview_.panels.find((p) => p.id != "output") ??
24+
dockview_.activePanel;
25+
const isNearestPanelOutput = dockview_.activePanel.id == "output";
26+
27+
dockview_.addPanel({
2328
id,
2429
component: "code",
2530
title: filename,
26-
position: { direction: "above", referencePanel: "output" },
31+
position: {
32+
direction: isNearestPanelOutput ? "above" : "within",
33+
referencePanel: nearestPanel,
34+
},
2735
});
2836
}
2937
}

0 commit comments

Comments
 (0)