1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | 'use strict';
|
12 |
|
13 | var UserAgent = require("fbjs/lib/UserAgent");
|
14 |
|
15 | var isSoftNewlineEvent = require("./isSoftNewlineEvent");
|
16 |
|
17 | var isOSX = UserAgent.isPlatform('Mac OS X');
|
18 | var KeyBindingUtil = {
|
19 | |
20 |
|
21 |
|
22 |
|
23 |
|
24 | isCtrlKeyCommand: function isCtrlKeyCommand(e) {
|
25 | return !!e.ctrlKey && !e.altKey;
|
26 | },
|
27 | isOptionKeyCommand: function isOptionKeyCommand(e) {
|
28 | return isOSX && e.altKey;
|
29 | },
|
30 | usesMacOSHeuristics: function usesMacOSHeuristics() {
|
31 | return isOSX;
|
32 | },
|
33 | hasCommandModifier: function hasCommandModifier(e) {
|
34 | return isOSX ? !!e.metaKey && !e.altKey : KeyBindingUtil.isCtrlKeyCommand(e);
|
35 | },
|
36 | isSoftNewlineEvent: isSoftNewlineEvent
|
37 | };
|
38 | module.exports = KeyBindingUtil; |
\ | No newline at end of file |