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
feat(options): highlight shortcuts changed from their default
Elian Doranf6e3f29355ed
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 0be6fc1075..624652c384 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1731,7 +1731,8 @@"reload_app": "Reload app to apply changes","set_all_to_default": "Set all shortcuts to the default","confirm_reset": "Do you really want to reset all keyboard shortcuts to the default?",- "no_results": "No shortcuts found matching '{{filter}}'"+ "no_results": "No shortcuts found matching '{{filter}}'",+ "modified_from_default": "This shortcut has been changed from its default."},"spellcheck": {"title": "Spell Check",diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.css b/apps/client/src/widgets/type_widgets/options/shortcuts.cssindex 6ff326ddc3..fae7c0221b 100644--- a/apps/client/src/widgets/type_widgets/options/shortcuts.css+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.css@@ -28,6 +28,16 @@width: 25%;}+ .shortcut-modified-indicator {+ display: inline-block;+ width: 0.5em;+ height: 0.5em;+ margin-right: 0.5em;+ border-radius: 50%;+ background-color: var(--link-color);+ vertical-align: middle;+ }+.separator {background-color: var(--accented-background-color);font-weight: bold;diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx b/apps/client/src/widgets/type_widgets/options/shortcuts.tsxindex af85496573..8547e6bb17 100644--- a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.tsx@@ -108,6 +108,10 @@ export default function ShortcutSettings() {)}+function isShortcutModified(action: ActionKeyboardShortcut) {+ return !arrayEqual(action.effectiveShortcuts ?? [], action.defaultShortcuts ?? []);+}+function filterKeyboardAction(action: KeyboardShortcut, filter: string) {// Hide separators when filtering is active.if ("separator" in action) {@@ -145,7 +149,11 @@ function KeyboardShortcutTable({ filteredKeyboardActions, filter }: { filteredKe</td>: (<>- <td>{action.friendlyName}</td>+ <td>+ {isShortcutModified(action) &&+ <span class="shortcut-modified-indicator" title={t("shortcuts.modified_from_default")} />}+ {action.friendlyName}+ </td><td><ShortcutEditor keyboardShortcut={action} /></td>