Skip to content

Build your personal knowledge base with Trilium Notes

feat(layout): keyboard shortcut for promoted attributes

Elian Doran77b92385cbc6
diff --git a/apps/client/src/widgets/layout/NoteTitleActions.tsx b/apps/client/src/widgets/layout/NoteTitleActions.tsx
index a04bfc2429..2e13c5f10f 100644
--- a/apps/client/src/widgets/layout/NoteTitleActions.tsx
+++ b/apps/client/src/widgets/layout/NoteTitleActions.tsx
@@ -1,7 +1,7 @@
import "./NoteTitleActions.css";
import clsx from "clsx";
-import { useEffect, useState } from "preact/hooks";
+import { useEffect, useRef, useState } from "preact/hooks";
import NoteContext from "../../components/note_context";
import FNote from "../../entities/fnote";
@@ -10,7 +10,7 @@ import CollectionProperties from "../note_bars/CollectionProperties";
import { checkFullHeight, getExtendedWidgetType } from "../NoteDetail";
import { PromotedAttributesContent, usePromotedAttributeData } from "../PromotedAttributes";
import Collapsible, { ExternallyControlledCollapsible } from "../react/Collapsible";
-import { useNoteContext, useNoteProperty } from "../react/hooks";
+import { useNoteContext, useNoteProperty, useTriliumEvent } from "../react/hooks";
import SearchDefinitionTab from "../ribbon/SearchDefinitionTab";
export default function NoteTitleActions() {
@@ -57,6 +57,9 @@ function PromotedAttributes({ note, componentId, noteContext }: {
});
}, [ note, noteContext ]);
+ // Keyboard shortcut.
+ useTriliumEvent("toggleRibbonTabPromotedAttributes", () => setExpanded(!expanded));
+
if (!cells?.length) return false;
return (note && (
<ExternallyControlledCollapsible