mirror of
https://github.com/zadam/trilium.git
synced 2025-12-20 22:34:23 +01:00
feat(right_pane_widget): hide highlights if disabled in settings
This commit is contained in:
parent
e94704ce64
commit
c0cd9e36d9
@ -8,7 +8,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, useNoteProperty, useTriliumOptionBool } from "../react/hooks";
|
import { useActiveNoteContext, useNoteProperty, useTriliumOptionBool, useTriliumOptionJson } from "../react/hooks";
|
||||||
import Icon from "../react/Icon";
|
import Icon from "../react/Icon";
|
||||||
import HighlightsList from "./HighlightsList";
|
import HighlightsList from "./HighlightsList";
|
||||||
import TableOfContents from "./TableOfContents";
|
import TableOfContents from "./TableOfContents";
|
||||||
@ -17,13 +17,14 @@ const MIN_WIDTH_PERCENT = 5;
|
|||||||
|
|
||||||
export default function RightPanelContainer() {
|
export default function RightPanelContainer() {
|
||||||
const [ rightPaneVisible, setRightPaneVisible ] = useTriliumOptionBool("rightPaneVisible");
|
const [ rightPaneVisible, setRightPaneVisible ] = useTriliumOptionBool("rightPaneVisible");
|
||||||
|
const [ highlightsList ] = useTriliumOptionJson<string[]>("highlightsList");
|
||||||
useSplit(rightPaneVisible);
|
useSplit(rightPaneVisible);
|
||||||
|
|
||||||
const { note } = useActiveNoteContext();
|
const { note } = useActiveNoteContext();
|
||||||
const noteType = useNoteProperty(note, "type");
|
const noteType = useNoteProperty(note, "type");
|
||||||
const items = (rightPaneVisible ? [
|
const items = (rightPaneVisible ? [
|
||||||
(noteType === "text" || noteType === "doc") && <TableOfContents />,
|
(noteType === "text" || noteType === "doc") && <TableOfContents />,
|
||||||
noteType === "text" && <HighlightsList />
|
noteType === "text" && highlightsList.length > 0 && <HighlightsList />
|
||||||
] : []).filter(Boolean);
|
] : []).filter(Boolean);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user