diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/hotkey.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/hotkey.directive.js index 8a992a9538..2f66acc36c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/hotkey.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/hotkey.directive.js @@ -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']")){ diff --git a/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js b/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js index 53b677aabb..a0306e11c6 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/keyboard.service.js @@ -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);