diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.ts b/apps/client/src/widgets/type_widgets/options/shortcuts.ts index 04d75262d..c8a4fc23b 100644 --- a/apps/client/src/widgets/type_widgets/options/shortcuts.ts +++ b/apps/client/src/widgets/type_widgets/options/shortcuts.ts @@ -3,7 +3,7 @@ import utils from "../../../services/utils.js"; import dialogService from "../../../services/dialog.js"; import OptionsWidget from "./options_widget.js"; import { t } from "../../../services/i18n.js"; -import type { OptionNames, KeyboardShortcut } from "@triliumnext/commons"; +import type { OptionNames, KeyboardShortcut, KeyboardShortcutWithRequiredActionName } from "@triliumnext/commons"; const TPL = /*html*/`
@@ -75,10 +75,10 @@ export default class KeyboardShortcutsOptions extends OptionsWidget { for (const action of actions) { const $tr = $(""); - if (action.separator) { + if ("separator" in action) { $tr.append($('').attr("style", "background-color: var(--accented-background-color); font-weight: bold;").text(action.separator)); } else if (action.defaultShortcuts && action.actionName) { - $tr.append($("").text(action.actionName)) + $tr.append($("").text(action.friendlyName)) .append( $("").append( $(``) @@ -145,9 +145,9 @@ export default class KeyboardShortcutsOptions extends OptionsWidget { return; } - const action = globActions.find((act) => act.actionName === actionName); + const action = globActions.find((act) => "actionName" in act && act.actionName === actionName) as KeyboardShortcutWithRequiredActionName; - if (!action || !action.actionName) { + if (!action) { this.$widget.find(el).hide(); return; } @@ -157,6 +157,7 @@ export default class KeyboardShortcutsOptions extends OptionsWidget { .toggle( !!( action.actionName.toLowerCase().includes(filter) || + (action.friendlyName && action.friendlyName.toLowerCase().includes(filter)) || (action.defaultShortcuts ?? []).some((shortcut) => shortcut.toLowerCase().includes(filter)) || (action.effectiveShortcuts ?? []).some((shortcut) => shortcut.toLowerCase().includes(filter)) || (action.description && action.description.toLowerCase().includes(filter))