chore(layout/right_pane): bring back resizer

This commit is contained in:
Elian Doran 2025-12-17 23:17:25 +02:00
parent f46de50f17
commit dac923e45d
No known key found for this signature in database

View File

@ -1,7 +1,28 @@
//! This is currently only used for the new layout.
import "./RightPanelContainer.css";
import Split from "@triliumnext/split.js";
import { useEffect } from "preact/hooks";
import options from "../../services/options";
import { DEFAULT_GUTTER_SIZE } from "../../services/resizer";
const MIN_WIDTH_PERCENT = 5;
export default function RightPanelContainer() {
useEffect(() => {
// We are intentionally omitting useTriliumOption to avoid re-render due to size change.
const rightPaneWidth = Math.max(MIN_WIDTH_PERCENT, options.getInt("rightPaneWidth") ?? MIN_WIDTH_PERCENT);
const splitInstance = Split(["#center-pane", "#right-pane"], {
sizes: [100 - rightPaneWidth, rightPaneWidth],
gutterSize: DEFAULT_GUTTER_SIZE,
minSize: [300, 180],
rtl: glob.isRtl,
onDragEnd: (sizes) => options.save("rightPaneWidth", Math.round(sizes[1]))
});
return () => splitInstance.destroy();
}, []);
return (
<div id="right-pane">
Hi there.