Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/shortcut hints: improve the shortcut hints button
Adorian Doran0246cbd4a92f
diff --git a/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.css b/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.cssindex f972b6690a..3d4fbbfd03 100644--- a/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.css+++ b/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.css@@ -6,5 +6,7 @@.shortcut-hint-button-key {font-size: 0.85em;+ font-family: monospace;+ letter-spacing: .5pt;}}diff --git a/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.spec.tsx b/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.spec.tsxindex fd246e3257..0c93687467 100644--- a/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.spec.tsx+++ b/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.spec.tsx@@ -12,7 +12,7 @@ import appContext from "../../components/app_context.js";import Component from "../../components/component.js";import type { ShortcutHintSection } from "../../services/shortcut_hints.js";import { ParentComponent } from "../react/react_utils.js";-import ShortcutHintButton from "./shortcut_hint_button.js";+import ShortcutHintButton, { ShortcutHintOverlayButton } from "./shortcut_hint_button.js";let container: HTMLDivElement;@@ -43,6 +43,20 @@ describe("ShortcutHintButton", () => {expect(button?.querySelector(".shortcut-hint-button-key")).not.toBeNull();});+ it("exposes a bare overlay button (no group wrapper) for existing overlay groups", () => {+ container = document.createElement("div");+ document.body.appendChild(container);+ act(() => render(+ <ParentComponent.Provider value={new Component()}><ShortcutHintOverlayButton /></ParentComponent.Provider>,+ container+ ));++ expect(container.querySelector(".tn-overlay-control-group")).toBeNull();+ const button = container.querySelector("button");+ expect(button?.classList.contains("tn-overlay-text-button")).toBe(true);+ expect(button?.querySelector("kbd")?.textContent).toBe("?");+ });+it("collects its context's hints and opens the pane anchored to itself on click", () => {const section: ShortcutHintSection = { hints: [{ keys: ["A"], labelKey: "a" }] };const host = new Component();