hotkeys osx compat
This commit is contained in:
@@ -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']")){
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user