From c0eb34927f43a18a54c13c3659294c25d7cc2e7c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 16 Dec 2025 18:23:14 +0200 Subject: [PATCH] feat(layout): keyboard shortcut for basic properties --- apps/client/src/widgets/ribbon/NoteActions.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/ribbon/NoteActions.tsx b/apps/client/src/widgets/ribbon/NoteActions.tsx index bb6d9a8d8..a6aaf14ff 100644 --- a/apps/client/src/widgets/ribbon/NoteActions.tsx +++ b/apps/client/src/widgets/ribbon/NoteActions.tsx @@ -1,5 +1,6 @@ import { ConvertToAttachmentResponse } from "@triliumnext/commons"; -import { useContext } from "preact/hooks"; +import { Dropdown as BootstrapDropdown } from "bootstrap"; +import { useContext, useRef } from "preact/hooks"; import appContext, { CommandNames } from "../../components/app_context"; import Component from "../../components/component"; @@ -20,7 +21,7 @@ import MovePaneButton from "../buttons/move_pane_button"; import ActionButton from "../react/ActionButton"; import Dropdown from "../react/Dropdown"; import { FormDropdownDivider, FormDropdownSubmenu, FormListHeader, FormListItem, FormListToggleableItem } from "../react/FormList"; -import { useIsNoteReadOnly, useNoteContext, useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumOption } from "../react/hooks"; +import { useIsNoteReadOnly, useNoteContext, useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumEvent, useTriliumOption } from "../react/hooks"; import { ParentComponent } from "../react/react_utils"; import { NoteTypeDropdownContent, useNoteBookmarkState, useShareState } from "./BasicPropertiesTab"; import NoteActionsCustom from "./NoteActionsCustom"; @@ -60,6 +61,7 @@ function RevisionsButton({ note }: { note: FNote }) { } function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: NoteContext }) { + const dropdownRef = useRef(null); const parentComponent = useContext(ParentComponent); const noteType = useNoteProperty(note, "type") ?? ""; const [viewType] = useNoteLabel(note, "viewType"); @@ -78,8 +80,15 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not const { isReadOnly, enableEditing } = useIsNoteReadOnly(note, noteContext); const isNormalViewMode = noteContext?.viewScope?.viewMode === "default"; + // Keyboard shortcuts. + useTriliumEvent("toggleRibbonTabBasicProperties", () => { + if (!isNewLayout) return; + dropdownRef.current?.toggle(); + }); + return (