mirror of
https://github.com/zadam/trilium.git
synced 2025-12-20 14:24:27 +01:00
chore(layout/right_pane): bring back resizer
This commit is contained in:
parent
f46de50f17
commit
dac923e45d
@ -1,7 +1,28 @@
|
|||||||
//! This is currently only used for the new layout.
|
//! This is currently only used for the new layout.
|
||||||
import "./RightPanelContainer.css";
|
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() {
|
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 (
|
return (
|
||||||
<div id="right-pane">
|
<div id="right-pane">
|
||||||
Hi there.
|
Hi there.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user