Re-split library and preview when the editor is hidden; remember the editor's width

This commit is contained in:
2026-06-09 23:54:20 +03:00
parent 418bf23cd8
commit 3c053310ac
10 changed files with 452 additions and 14 deletions
+12 -1
View File
@@ -51,6 +51,16 @@ export function PaneToggleStrip() {
preview: previewVisible,
};
// The strip's own element — its parent is the panes row, so we can measure the
// width available to the panes (row minus this strip) when toggling the editor,
// which needs it to remember/restore the editor's width (PanesStore.togglePane).
const stripRef = useRef<HTMLDivElement>(null);
const panesInner = (): number => {
const strip = stripRef.current;
const row = strip?.parentElement;
return row ? row.clientWidth - strip.offsetWidth : 0;
};
// Roving tabindex over the toggles + the trailing Datasets action (the divider
// is not a control). One tab stop; the focused index is the only `tabIndex=0`.
const count = PANES.length + 1;
@@ -88,6 +98,7 @@ export function PaneToggleStrip() {
return (
<div
ref={stripRef}
role="toolbar"
aria-orientation="vertical"
aria-label="Workspace panes"
@@ -117,7 +128,7 @@ export function PaneToggleStrip() {
.filter(Boolean)
.join(' ')}
onClick={() => {
togglePane(item.pane);
togglePane(item.pane, panesInner());
setFocusIndex(i);
}}
onKeyDown={(e) => onKeyDown(e, i)}