chieffancypants / angular-hotkeys

Configuration-centric keyboard shortcuts for your Angular apps.
http://chieffancypants.github.io/angular-hotkeys/
MIT License
1.68k stars 248 forks source link

When using Array as combo, only the first keyboard shortcut shows up on shift+? #242

Open thatkookooguy opened 8 years ago

thatkookooguy commented 8 years ago

When I add the following code to my app, everything works great:

hotkeys.add({
  combo: ['s', 'mod+f'],
  description: 'Search',
  callback: function(e) {
    $('input.search-text').focus();
    if (e.preventDefault) {
      e.preventDefault();
    }
  }
});

Both keyboard shortcuts work. But only one of them (the first one in the list) appears when I enter the Shift+? page. (tried changing the order and always the first one appears and the others are ignored):

screen_shot_2016-08-11_at_11_00_49

rerodrigues commented 8 years ago

Hi @Thatkookooguy

It is not exactly a bug, it is by design. cfp chose show only the first combo for an action. It is stated in the commented source code.

However some people, like you and me, thinks that it would be better to display all possible combinations.

For this reason I've a created a fork adding this functionality and also made a pull request for this feature.

If cfp will someday merge it back is beyond me, but until then you can use my fork in https://github.com/rerodrigues/angular-hotkeys and vote for the pull request in https://github.com/chieffancypants/angular-hotkeys/pull/240

Hope I've helped in someway

[]s