mirror of
https://github.com/zadam/trilium.git
synced 2025-12-20 22:34:23 +01:00
feat(layout): keyboard shortcut for note paths
This commit is contained in:
parent
4f1c19f1e2
commit
998a16ab87
@ -1,6 +1,6 @@
|
|||||||
import "./StatusBar.css";
|
import "./StatusBar.css";
|
||||||
|
|
||||||
import { Locale } from "@triliumnext/commons";
|
import { KeyboardActionNames, Locale } from "@triliumnext/commons";
|
||||||
import { Dropdown as BootstrapDropdown } from "bootstrap";
|
import { Dropdown as BootstrapDropdown } from "bootstrap";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { type ComponentChildren } from "preact";
|
import { type ComponentChildren } from "preact";
|
||||||
@ -381,12 +381,18 @@ function AttributesPane({ note, noteContext, attributesShown, setAttributesShown
|
|||||||
|
|
||||||
//#region Note paths
|
//#region Note paths
|
||||||
function NotePaths({ note, hoistedNoteId, notePath }: StatusBarContext) {
|
function NotePaths({ note, hoistedNoteId, notePath }: StatusBarContext) {
|
||||||
|
const dropdownRef = useRef<BootstrapDropdown>(null);
|
||||||
const sortedNotePaths = useSortedNotePaths(note, hoistedNoteId);
|
const sortedNotePaths = useSortedNotePaths(note, hoistedNoteId);
|
||||||
const count = sortedNotePaths?.length ?? 0;
|
const count = sortedNotePaths?.length ?? 0;
|
||||||
|
const enabled = count > 1;
|
||||||
|
|
||||||
return (count > 1 &&
|
// Keyboard shortcut.
|
||||||
|
useTriliumEvent("toggleRibbonTabNotePaths", () => enabled && dropdownRef.current?.show());
|
||||||
|
|
||||||
|
return (enabled &&
|
||||||
<StatusBarDropdown
|
<StatusBarDropdown
|
||||||
title={t("status_bar.note_paths_title")}
|
title={t("status_bar.note_paths_title")}
|
||||||
|
dropdownRef={dropdownRef}
|
||||||
dropdownContainerClassName="dropdown-note-paths"
|
dropdownContainerClassName="dropdown-note-paths"
|
||||||
icon="bx bx-directions"
|
icon="bx bx-directions"
|
||||||
text={t("status_bar.note_paths", { count })}
|
text={t("status_bar.note_paths", { count })}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user