atom-keymap
Advanced tools
Comparing version 0.23.0 to 0.24.0
(function() { | ||
var AtomModifiers, KeyboardEventModifiers, SpecificityCache, WindowsAndLinuxCharCodeTranslations, charCodeFromKeyIdentifier, fs, isAscii, keyFromCharCode, loophole, modifier, normalizeKeystroke, parseKeystroke, parser, pegjs, specificity, translateCharCodeForWindowsAndLinuxChromiumBug, _i, _j, _len, _len1, _ref, _ref1, _ref2; | ||
var AtomModifiers, KeyboardEventModifiers, NumPadToASCII, SpecificityCache, WindowsAndLinuxCharCodeTranslations, charCodeFromKeyIdentifier, fs, isASCII, keyFromCharCode, loophole, modifier, normalizeKeystroke, numpadToASCII, parseKeystroke, parser, pegjs, specificity, translateCharCodeForWindowsAndLinuxChromiumBug, _i, _j, _len, _len1, _ref, _ref1, _ref2; | ||
@@ -113,2 +113,20 @@ specificity = require('clear-cut').specificity; | ||
NumPadToASCII = { | ||
79: 47, | ||
74: 42, | ||
77: 45, | ||
75: 43, | ||
78: 46, | ||
96: 48, | ||
65: 49, | ||
66: 50, | ||
67: 51, | ||
68: 52, | ||
69: 53, | ||
70: 54, | ||
71: 55, | ||
72: 56, | ||
73: 57 | ||
}; | ||
exports.normalizeKeystrokes = function(keystrokes) { | ||
@@ -137,3 +155,6 @@ var keystroke, normalizedKeystroke, normalizedKeystrokes, _k, _len2, _ref3; | ||
} | ||
if (!isAscii(charCode) && isAscii(event.keyCode)) { | ||
if (event.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) { | ||
charCode = numpadToASCII(charCode); | ||
} | ||
if (!isASCII(charCode) && isASCII(event.keyCode)) { | ||
charCode = event.which; | ||
@@ -168,2 +189,5 @@ } | ||
} | ||
if (event.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) { | ||
keystroke.push('num'); | ||
} | ||
if (key != null) { | ||
@@ -185,3 +209,3 @@ keystroke.push(key); | ||
var alt, bubbles, cancelable, cmd, ctrl, event, keyCode, keyIdentifier, location, shift, target, view, _ref3; | ||
_ref3 = _arg != null ? _arg : {}, ctrl = _ref3.ctrl, shift = _ref3.shift, alt = _ref3.alt, cmd = _ref3.cmd, keyCode = _ref3.keyCode, target = _ref3.target; | ||
_ref3 = _arg != null ? _arg : {}, ctrl = _ref3.ctrl, shift = _ref3.shift, alt = _ref3.alt, cmd = _ref3.cmd, keyCode = _ref3.keyCode, target = _ref3.target, location = _ref3.location; | ||
event = document.createEvent('KeyboardEvent'); | ||
@@ -218,3 +242,5 @@ bubbles = true; | ||
} | ||
location = KeyboardEvent.DOM_KEY_LOCATION_STANDARD; | ||
if (location == null) { | ||
location = KeyboardEvent.DOM_KEY_LOCATION_STANDARD; | ||
} | ||
event.initKeyboardEvent('keydown', bubbles, cancelable, view, keyIdentifier, location, ctrl, alt, shift, cmd); | ||
@@ -348,6 +374,11 @@ if (target != null) { | ||
isAscii = function(charCode) { | ||
isASCII = function(charCode) { | ||
return (0 <= charCode && charCode <= 127); | ||
}; | ||
numpadToASCII = function(charCode) { | ||
var _ref3; | ||
return (_ref3 = NumPadToASCII[charCode]) != null ? _ref3 : charCode; | ||
}; | ||
}).call(this); |
{ | ||
"name": "atom-keymap", | ||
"version": "0.23.0", | ||
"version": "0.24.0", | ||
"description": "Atom's DOM-aware keymap module", | ||
@@ -5,0 +5,0 @@ "main": "./lib/keymap-manager", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42197
1169