On 04 Jun 2014, at 07:31, Rosali myroundcube@mail4us.net wrote:
Hey devs, i have a preliminary version of the keyboards shortcuts plugin with user settings. It was a complete rewrite. I struggled a lot with what to support as far as keys go. Javascript has multiple key events you can hook into, each with their pros and cons. The easiest would have been to use 'keypress', but then you miss out on a lot of keys (basically only a-z0-9 and a few extras).
I used 'keydown', but because the browser landscape with regards to keyboard events is a huge mess, im limiting the allowed keys to a relatively small subset. If you think 'how hard can it be', i invite you to read http://unixpapa.com/js/key.html and weep. And that page is even outdated, as I found opera responses that did not match any of that and conflicted with apple meta keys.
So, at least for now, you can use a-z, 0-9, F1-F12, Page Up, Page Down, End, Home, Insert Delete and Num0-9, and all of those combined with Shift/Ctrl/Alt. Yes, this means you cant use / , . ? [ ] ; : ' " etc. The browsers simply return too many permutation differences to support all that. I may be able to support some of those at a later stage.
I also replaced the keyboard icon, I redid the help popup, and i have preliminary support for other plugins. But that probably needs a bit more testing. I dont have all available roundcube commands supported yet, thats simply a matter of going through them. And it's pretty easy to create your own commands, so if anyone would like something specific done that can be create in javascript and could be useful to others, by all means tell me.
If you have some time, you can get the current alpha at https://github.com/corbosman/keyboard_shortcuts/tree/usersetting
Let me know if you find any bugs, or have suggestions,
In regards to site navigation F1 - F3 the plugin is incompatible with my 'tabbed' plugin. This plugin loads Roundcube tasks into iframes. The purpose is to be able to switch between tasks without a delay. I'll try to create a compatibility patch.
As far as I can see on a first glance, the tasks shortcuts (F1 - F3) are hardcoded. What about creating these shortcuts dynamically by parsing the top taskbar? This way you get all plugins which creates a topmenu icon.
F8 = Help. I don't think it is a good choice. 'Help' is already occupied by several plugins (real help for Roundcube). I suggest to use something like "Shortcuts legend".
Nothing is hardcoded, thats the whole point :) I did make F1-F3 defaults in the config. But thats easy enough to change. Any suggestions? I prefer not to parse anything in JS, because someone should just be able to read the config file to see the shortcuts. Also, if the order of the tasks would change, the shortcuts would change. And finally, where I generate the command list that you can have shortcuts for, i cant parse js, thats all php. So I wont know that there is a plugin that has a command that can have a settable shortcut unless the plugin that registers that task also registers a command with my plugin.
I'll change the text for Help. (that what it was when I took it over from you, and I never changed it :) )
Cor