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
refactor(client): render cheatsheet shortcuts via renderShortcutKbds
Elian Doran3ee891bc4fe1
diff --git a/apps/client/src/widgets/dialogs/help.tsx b/apps/client/src/widgets/dialogs/help.tsxindex 4080fb07c2..e4c2840c6e 100644--- a/apps/client/src/widgets/dialogs/help.tsx+++ b/apps/client/src/widgets/dialogs/help.tsx@@ -1,11 +1,12 @@import Modal from "../react/Modal.jsx";import { t } from "../../services/i18n.js";-import { ComponentChildren } from "preact";+import { ComponentChildren, Fragment } from "preact";import appContext, { CommandNames } from "../../components/app_context.js";import RawHtml from "../react/RawHtml.jsx";import { useEffect, useState } from "preact/hooks";import keyboard_actions from "../../services/keyboard_actions.js";-import { formatShortcut, joinShortcut } from "../../services/keyboard_shortcut_display.js";+import { joinElements } from "../react/react_utils.js";+import { renderShortcutKbds } from "../react/shortcut_kbd.js";import { useTriliumEvent } from "../react/hooks.jsx";export default function HelpDialog() {@@ -140,12 +141,7 @@ function KeyboardShortcut({ commands, description }: { commands: CommandNames |function FixedKeyboardShortcut({ keys, description }: { keys?: string[], description: string }) {return (<li>- {keys && keys.map((key, index) =>- <>- <kbd key={index}>{joinShortcut(formatShortcut(key))}</kbd>- {index < keys.length - 1 ? ", " : "" }- </>- )} - <RawHtml html={description} />+ {joinElements(keys?.map((key, index) => <Fragment key={index}>{renderShortcutKbds(key)}</Fragment>))} - <RawHtml html={description} /></li>);}