Add and remove HotKey handler for keyboard events supporting almost any key combination.
The syntax is as follows:
$(document).on( 'keydown' , 'ctrl+a' , fn);
|
Example configuration for inserting a Link with the HotKey `Ctrl-u` (default: `Ctrl-l`)
Aloha.settings = {
plugins: {
link: {
hotKey: { insertLink: 'ctrl+u' }
}
}
}
|
- Types Supported types are `‘keydown’`, `‘keyup’` and `‘keypress’`
- Addendum Firefox is the most liberal one in the manner of letting you capture all short-cuts even those that are built-in in the browser such as `Ctrl-t` for new tab, or `Ctrl-a` for selecting all text. You can always bubble them up to the browser by returning `true` in your handler.
Others, (IE) either let you handle built-in short-cuts, but will add their functionality after your code has executed. Or (Opera/Safari) will not pass those events to the DOM at all.
So, if you bind `Ctrl-Q` or `Alt-F4` and your Safari/Opera window is closed don’t be surprised.
Code from jquery.hotkeys
The HotKey feature is still being developed. Not all shortcuts are available at the moment.
Document action |
Shortcut |
Select all |
CtrlA |
Copy |
CtrlC |
Paste |
CtrlV |
Cut |
CtrlX |
Undo* |
CtrlZ |
Redo* |
CtrlY |
Increase paragraph indentation* |
Tab |
Decrease paragraph indentation* |
ShiftTab |
Text formatting |
Shortcut |
Bold |
CtrlB |
Italicize |
CtrlI |
Underline |
CtrlU |
Superscript |
Ctrl. |
Subscript |
Ctrl, |
Clear formatting |
Ctrl\ |
Paragraph formatting |
Shortcut |
Normal paragraph style |
CtrlAlt0 |
Header style 1 |
CtrlAlt1 |
Header style 2 |
CtrlAlt2 |
Header style 3 |
CtrlAlt3 |
Header style 4 |
CtrlAlt4 |
Header style 5 |
CtrlAlt5 |
Header style 6 |
CtrlAlt6 |
Preformatted |
CtrlAltP |
Left alignment* |
CtrlShiftL |
Center alignment* |
CtrlShiftE |
Right alignment* |
CtrlShiftR |
Full justify* |
CtrlShiftJ |
Numbered list* |
CtrlShift7 |
Bulleted list* |
CtrlShift8 |
Actions |
Shortcut |
Insert link |
CtrlK |
Navigation |
Shortcut |
Move to next heading* |
Ctrl + Alt + N then Ctrl + Alt + H |
Move to previous heading* |
Ctrl + Alt + P then Ctrl + Alt + H |
Plugins |
Shortcut |
WAI Lang: Insert Annotation |
CtrlShiftl |
- not implemented yet Reference: https://docs.google.com/support/bin/answer.py?answer=179738