Prioritize shortcut matching by level

This commit is contained in:
Enrico Ros
2024-08-14 13:51:10 -07:00
parent a7812b7bb9
commit e96c9247c3
@@ -36,6 +36,11 @@ export const useGlobalShortcutsStore = create<ShortcutsStore>((set, get) => ({
};
}),
getAllShortcuts: () => Object.values(get().shortcutGroups).flat(),
/**
* Returns all shortcuts, priritized by level (descending).
*/
getAllShortcuts: () => Object.values(get().shortcutGroups)
.flat()
.sort((a, b) => (b.level ?? 0) - (a.level ?? 0)),
}));