hotkeys osx compat

This commit is contained in:
perploug
2013-10-17 01:08:39 +02:00
parent 205d5f7d71
commit 3f76a130f1
2 changed files with 11 additions and 0 deletions

View File

@@ -4,8 +4,10 @@
**/
angular.module("umbraco.directives")
.directive('hotkey', function ($window, keyboardService, $log) {
return function (scope, el, attrs) {
var keyCombo = attrs["hotkey"];
keyboardService.bind(keyCombo, function() {
var element = $(el);
if(element.is("a,button,input[type='button'],input[type='submit']")){

View File

@@ -11,11 +11,20 @@ angular.module('umbraco.services')
'keyCode': false
};
var isMac = navigator.platform.toUpperCase().indexOf('MAC')>=0;
// Store all keyboard combination shortcuts
keyboardManagerService.keyboardEvent = {};
// Add a new keyboard combination shortcut
keyboardManagerService.bind = function (label, callback, opt) {
//replace ctrl key with meta key
if(isMac){
label = label.replace("ctrl","meta");
}
var fct, elt, code, k;
// Initialize opt object
opt = angular.extend({}, defaultOpt, opt);