mirror of
https://github.com/zadam/trilium.git
synced 2026-01-06 14:44:25 +01:00
fix: toggling right pane visibility incorrectly affects all windows
Some checks failed
Checks / main (push) Has been cancelled
Some checks failed
Checks / main (push) Has been cancelled
This commit is contained in:
parent
644d3a181f
commit
3420374649
@ -3,15 +3,15 @@ import clsx from "clsx";
|
|||||||
import { t } from "../../services/i18n";
|
import { t } from "../../services/i18n";
|
||||||
import options from "../../services/options";
|
import options from "../../services/options";
|
||||||
import ActionButton from "../react/ActionButton";
|
import ActionButton from "../react/ActionButton";
|
||||||
import { useState } from "preact/hooks";
|
import { useState, useCallback } from "preact/hooks";
|
||||||
import { useTriliumEvent } from "../react/hooks";
|
import { useTriliumEvent } from "../react/hooks";
|
||||||
|
|
||||||
export default function RightPaneToggle() {
|
export default function RightPaneToggle() {
|
||||||
const [ rightPaneVisible, setRightPaneVisible ] = useState(options.is("rightPaneVisible"));
|
const [ rightPaneVisible, setRightPaneVisible ] = useState(options.is("rightPaneVisible"));
|
||||||
|
|
||||||
useTriliumEvent("toggleRightPane", () => {
|
useTriliumEvent("toggleRightPane", useCallback(() => {
|
||||||
setRightPaneVisible(current => !current);
|
setRightPaneVisible(current => !current);
|
||||||
});
|
}, []));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import "./RightPanelContainer.css";
|
|||||||
|
|
||||||
import Split from "@triliumnext/split.js";
|
import Split from "@triliumnext/split.js";
|
||||||
import { VNode } from "preact";
|
import { VNode } from "preact";
|
||||||
import { useState, useEffect, useRef } from "preact/hooks";
|
import { useState, useEffect, useRef, useCallback } from "preact/hooks";
|
||||||
|
|
||||||
import appContext from "../../components/app_context";
|
import appContext from "../../components/app_context";
|
||||||
import { WidgetsByParent } from "../../services/bundle";
|
import { WidgetsByParent } from "../../services/bundle";
|
||||||
@ -11,7 +11,7 @@ import { t } from "../../services/i18n";
|
|||||||
import options from "../../services/options";
|
import options from "../../services/options";
|
||||||
import { DEFAULT_GUTTER_SIZE } from "../../services/resizer";
|
import { DEFAULT_GUTTER_SIZE } from "../../services/resizer";
|
||||||
import Button from "../react/Button";
|
import Button from "../react/Button";
|
||||||
import { useActiveNoteContext, useLegacyWidget, useNoteProperty, useTriliumEvent, useTriliumOptionBool, useTriliumOptionJson } from "../react/hooks";
|
import { useActiveNoteContext, useLegacyWidget, useNoteProperty, useTriliumEvent, useTriliumOptionJson } from "../react/hooks";
|
||||||
import Icon from "../react/Icon";
|
import Icon from "../react/Icon";
|
||||||
import LegacyRightPanelWidget from "../right_panel_widget";
|
import LegacyRightPanelWidget from "../right_panel_widget";
|
||||||
import HighlightsList from "./HighlightsList";
|
import HighlightsList from "./HighlightsList";
|
||||||
@ -30,13 +30,13 @@ export default function RightPanelContainer({ widgetsByParent }: { widgetsByPare
|
|||||||
const [ rightPaneVisible, setRightPaneVisible ] = useState(options.is("rightPaneVisible"));
|
const [ rightPaneVisible, setRightPaneVisible ] = useState(options.is("rightPaneVisible"));
|
||||||
const items = useItems(rightPaneVisible, widgetsByParent);
|
const items = useItems(rightPaneVisible, widgetsByParent);
|
||||||
useSplit(rightPaneVisible);
|
useSplit(rightPaneVisible);
|
||||||
useTriliumEvent("toggleRightPane", () => {
|
useTriliumEvent("toggleRightPane", useCallback(() => {
|
||||||
setRightPaneVisible(current => {
|
setRightPaneVisible(current => {
|
||||||
const newValue = !current;
|
const newValue = !current;
|
||||||
options.save("rightPaneVisible", newValue.toString());
|
options.save("rightPaneVisible", newValue.toString());
|
||||||
return newValue;
|
return newValue;
|
||||||
});
|
});
|
||||||
});
|
}, []));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="right-pane">
|
<div id="right-pane">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user