Skip to content

Commit

Permalink
Use OS based Hotkey-Modifier FS#1958
Browse files Browse the repository at this point in the history
Because ALT-GR fires a CTRL-ALT event on Windows systems, but ALT-GR is
needed to write square brackets on German Keyboards, CTRL-ALT can not be
used as modifier.

This patch introdues OS dependent modifiers. Mac systems continue to use
CTRL-ALT, all other systems use only ALT.

Let's hope this works out.
  • Loading branch information
splitbrain committed Jun 27, 2010
1 parent 09edb71 commit ce19c34
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/scripts/hotkeys.js
@@ -1,6 +1,6 @@
/**
* Some of these scripts were taken from TinyMCE (http://tinymce.moxiecode.com/) and were modified for DokuWiki
*
*
* Class handles accesskeys using javascript and also provides ability
* to register and use other hotkeys as well.
*
Expand All @@ -17,6 +17,8 @@ function Hotkeys() {
* this.modifier = 'ctrl+alt+shift';
* this.modifier = 'alt';
* this.modifier = 'alt+shift';
*
* overwritten in intitialize (see below)
*/
this.modifier = 'ctrl+alt';

Expand All @@ -34,6 +36,14 @@ function Hotkeys() {
*/
this.initialize = function() {
var t = this;

//switch modifier key based on OS FS#1958
if(is_macos){
t.modifier = 'ctrl+alt';
}else{
t.modifier = 'alt';
}

/**
* Lookup all anchors with accesskey and register event - go to anchor
* target.
Expand Down Expand Up @@ -97,7 +107,7 @@ function Hotkeys() {
*
* @param e KeyboardEvent
* @author Marek Sacha <sachamar@fel.cvut.cz>
* @return b boolean
* @return b boolean
*/
this.onkeyup = function(e) {
var t = this;
Expand Down

0 comments on commit ce19c34

Please sign in to comment.