angular-hotkeys icon indicating copy to clipboard operation
angular-hotkeys copied to clipboard

Added optional 'category' for hotkeys.

Open ebbe-brandstrup opened this issue 8 years ago • 6 comments

When displaying the cheatsheet, the hotkeys are shown per category in a 2 column layout which also handles small window sizes.

If no category is specified for a hotkey, the hotkey defaults to a configurable default category.

If no hotkeys have a category, the cheatsheet looks like it used to.

Related to #120.

Thanks for a great hotkey system @chieffancypants

ebbe-brandstrup avatar Feb 22 '16 09:02 ebbe-brandstrup

Thank you @ebbe-brandstrup. IMO this is just a necessary feature :smile:

kfei avatar May 18 '16 06:05 kfei

+1

niemyjski avatar May 18 '16 10:05 niemyjski

@ebbe-brandstrup Did you just forget to also add this new capability i.e., attrs.hotkeyCategory to the directive?

kfei avatar May 19 '16 08:05 kfei

@kfei yes, indeed, I didn't catch that. I haven't been using the directive for registering hotkeys.

I have actually gone another direction with this since it doesn't look like the PR has interest. I have created an angular component (angular 1.5) to show the cheatsheet with categories. The component just injects the hotkeys service and extracts categories from the description field (I assume that hotkeys that contain a pipe character are of the format <category>|<description>. Descriptions without a pipe go into the "generic" category.

This approach has the advantage that I can keep updating angular-hotkeys without maintaining my fork :-)

I have a put together a gist to share it in case you guys can also benefit from it:

gist for cheatsheet component

This then gets hooked up by just placing a <hotkeys-cheatsheet></hotkeys-cheatsheet> element at the bottom of my index.html body tag. Also, I then disable the default cheatsheet stuff in my angular config block: hotkeysProvider.includeCheatSheet = false;

Note, I'm using MeteorJS 1.3 and angular-meteor (via npm) and LESS and as you can see it's ES6. So you'll need to adjust a bit to register the component differently if you don't use ES6 and the import/export stuff.

ebbe-brandstrup avatar May 19 '16 12:05 ebbe-brandstrup

@ebbe-brandstrup Thanks for your tips. I'm going to just steal your idea of using the pipe character as a workaround now. You're right, maintaining an own fork is just a pain :dizzy_face:

kfei avatar May 20 '16 04:05 kfei

+1

Blewin avatar Aug 07 '16 00:08 Blewin